try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e1bfa1ae-16e6-4caf-946a-5b23c6e780bb",e._sentryDebugIdIdentifier="sentry-dbid-e1bfa1ae-16e6-4caf-946a-5b23c6e780bb")}catch(e){}("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:{}).SENTRY_RELEASE={id:"a88cfbd6e95243bfc25558cffa1a0b4b0fe8f5dc"};(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7530],{17530:(e,n,a)=>{a.r(n),a.d(n,{default:()=>p});a(96540);var s=a(7960),i=a(99275),o=a(24609),t=a(6304),r=a(99728),l=a(29022),d=a(36348),c=a(79748),m=a(97665),u=a(74848);const h=(0,s.A)((()=>Promise.resolve().then(a.bind(a,38648))),"SignIn"),f={noRoomPermission:{header:e=>`Your role doesn't give you permission to access any of the troubleshooting information on ${e}.`},noSpacePermission:{header:e=>`Your role doesn't give you permission to access any information on ${e}.`},noRooms:{header:e=>`You currently don't have permission to see any room on ${e}.`},windowsAgent:{header:()=>"Windows Agent dashboard is not available locally."}},g=e=>{let{onClick:n,spaceName:a}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(i.Text,{margin:[2,0,0],children:"You can also leave this Space if you wish. "}),(0,u.jsx)(i.Button,{flavour:"borderless",icon:"switch_off",label:`Leave ${a}`,margin:[0,0,0,7],onClick:n,strong:!0})]})},b=["noSpacePermission","noRoomPermission"],p=e=>{let{reason:n}=e;const a=(0,o.ap)(),[s,,p,x]=(0,t.A)(),{header:y}=f[n],j=(0,o.bq)(),v=(0,r.JT)("billing:ReadBasic");return(0,u.jsx)(l.A,{title:y(a.name),children:(0,u.jsxs)(u.Fragment,{children:["noSpacePermission"===n&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(i.Text,{children:"Please contact the Space administrators if this is unexpected."}),(0,u.jsx)(g,{onClick:p,spaceName:a.name})]}),v&&b.includes(n)&&(0,u.jsxs)(i.Text,{children:["To manage Plan & Billing information please"," ",(0,u.jsx)(c.A,{as:m.N_,to:`/spaces/${j}/settings/billing`,children:"click here."})]}),"noRooms"===n&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(i.Text,{children:"Please contact a Space administrator or manager if this is unexpected."}),(0,u.jsx)(g,{onClick:p,spaceName:a.name})]}),"windowsAgent"===n&&(0,u.jsxs)(i.Flex,{column:!0,gap:2,children:[(0,u.jsx)(i.Text,{children:"Please sign in to view the Netdata dashboard."}),(0,u.jsx)(i.Flex,{children:(0,u.jsx)(h,{})})]}),s&&(0,u.jsx)(d.A,{id:a.id,name:a.name,onClose:x})]})})}},36348:(n,a,s)=>{s.d(a,{A:()=>w});var i=s(96540),o=s(99275),t=s(97665),r=s(46587),l=s(86706),d=(s(98992),s(54520),s(30569)),c=s(84929),m=s(63872),u=s(77389),h=s(99236),f=s(24609),g=s(32874),b=s(15624),p=s(49916);var x=s(64999),y=s(74848);const j="leave-space-dialog",v="leaveSpaceDialog",w=n=>{let{id:a,name:s,onClose:w}=n;const A=(0,t.Zp)(),C=(0,r.uW)("id"),S=(0,l.Gi)(),$=(0,l.i3)(),k=(0,l.pB)(),P=(n=>{const[,a]=(0,m.A)();return(0,d.yF)((0,i.useCallback)((async(s,i,o)=>{let{currentUserId:t,onSuccess:r,onError:d}=o;const m=await s((0,f.nC)("ids")),x=m.filter((e=>n!==e)),y=e=>{i(e,c.Ut)},[j]=x;if(!j)return void a({header:"Spaces",text:h.sh.leave});const{slug:v}=j&&await s((0,b.Ay)(j));i((0,f.nC)("ids"),x),i(g.A,(e=>e.filter((e=>e!==n))));try{await(0,u.XY)(n,[t]),r&&r(v),(0,l.Z8)(y,n),(0,p.Is)(y,n),y((0,b.Ay)(n))}catch(e){i((0,f.nC)("ids"),m),d&&d()}}),[n,a]))})(a),T=(0,x.A)(a),F=(0,i.useCallback)((e=>A(`/spaces/${e}`)),[]),I=1===S.length,L=1===$.length&&k,Y=I?{confirmLabel:"Yes, leave","data-ga":`${j}-last-member`,"data-testid":`${v}LastMember`,handleConfirm:()=>T({onSuccess:F}),message:(0,y.jsxs)(y.Fragment,{children:["If you leave, space ",(0,y.jsx)("strong",{children:s})," will be deleted immediately.",(0,y.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${s} space`}:L?{confirmLabel:"Give rights","data-ga":`${j}-last-admin`,"data-testid":`${v}LastAdmin`,handleConfirm:()=>A("users"),isConfirmPositive:!0,message:(0,y.jsxs)(y.Fragment,{children:["You are the last admin of ",(0,y.jsx)("strong",{children:s})," space. Please give admin rights to another member so you can leave this space."]}),title:`Leave ${s} space`}:{confirmLabel:"Yes, leave","data-ga":j,"data-testid":v,handleConfirm:()=>P({currentUserId:C,onSuccess:F}),message:(0,y.jsxs)(y.Fragment,{children:["You are about to leave ",(0,y.jsx)("strong",{children:s})," space.",(0,y.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${s} space`};return(0,y.jsx)(o.ConfirmationDialog,{handleDecline:w,...Y})}}}]);