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]="442b45ca-cc82-45ca-8b1e-f11b0d1054be",e._sentryDebugIdIdentifier="sentry-dbid-442b45ca-cc82-45ca-8b1e-f11b0d1054be")}catch(e){}("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:{}).SENTRY_RELEASE={id:"1bb8aa54b6deb0d4e541ef02c3c43ba128927d94"};(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7530],{17530:(e,n,s)=>{s.r(n),s.d(n,{default:()=>p});s(96540);var a=s(7960),i=s(46093),o=s(24609),t=s(6304),r=s(99728),l=s(29022),d=s(36348),c=s(79748),m=s(15920),u=s(74848);const h=(0,a.A)((()=>Promise.resolve().then(s.bind(s,38648))),"SignIn"),g={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."}},f=e=>{let{onClick:n,spaceName:s}=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 ${s}`,margin:[0,0,0,7],onClick:n,strong:!0})]})},b=["noSpacePermission","noRoomPermission"],p=e=>{let{reason:n}=e;const s=(0,o.ap)(),[a,,p,x]=(0,t.A)(),{header:y}=g[n],j=(0,o.bq)(),v=(0,r.JT)("billing:ReadBasic");return(0,u.jsx)(l.A,{title:y(s.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)(f,{onClick:p,spaceName:s.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)(f,{onClick:p,spaceName:s.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,{})})]}),a&&(0,u.jsx)(d.A,{id:s.id,name:s.name,onClose:x})]})})}},36348:(n,s,a)=>{a.d(s,{A:()=>w});var i=a(96540),o=a(46093),t=a(15920),r=a(46587),l=a(86706),d=(a(98992),a(54520),a(30569)),c=a(84929),m=a(63872),u=a(77389),h=a(99236),g=a(24609),f=a(32874),b=a(15624),p=a(49916);var x=a(64999),y=a(74848);const j="leave-space-dialog",v="leaveSpaceDialog",w=n=>{let{id:s,name:a,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[,s]=(0,m.A)();return(0,d.yF)((0,i.useCallback)((async(a,i,o)=>{let{currentUserId:t,onSuccess:r,onError:d}=o;const m=await a((0,g.nC)("ids")),x=m.filter((e=>n!==e)),y=e=>{i(e,c.Ut)},[j]=x;if(!j)return void s({header:"Spaces",text:h.sh.leave});const{slug:v}=j&&await a((0,b.Ay)(j));i((0,g.nC)("ids"),x),i(f.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,g.nC)("ids"),m),d&&d()}}),[n,s]))})(s),T=(0,x.A)(s),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:a})," will be deleted immediately.",(0,y.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${a} 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:a})," space. Please give admin rights to another member so you can leave this space."]}),title:`Leave ${a} 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:a})," space.",(0,y.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${a} space`};return(0,y.jsx)(o.ConfirmationDialog,{handleDecline:w,...Y})}}}]);