try{!function(){var 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]="bd4ff962-d704-4550-b53e-34c03a3ee20e",e._sentryDebugIdIdentifier="sentry-dbid-bd4ff962-d704-4550-b53e-34c03a3ee20e")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"bbf0f036d26e8d5cdf711f08d224a9283a4dee0b"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7530],{17530:(e,n,s)=>{s.r(n),s.d(n,{default:()=>p});var a=s(7960),i=s(63766),o=s(24609),t=s(6304),r=s(99728),l=s(29022),d=s(36348),c=s(79748),u=s(88934),m=s(74848);const h=(0,a.A)((()=>Promise.resolve().then(s.bind(s,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:s}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Text,{margin:[2,0,0],children:"You can also leave this Space if you wish. "}),(0,m.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}=f[n],v=(0,o.bq)(),j=(0,r.JT)("billing:ReadBasic");return(0,m.jsx)(l.A,{title:y(s.name),children:(0,m.jsxs)(m.Fragment,{children:["noSpacePermission"===n&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Text,{children:"Please contact the Space administrators if this is unexpected."}),(0,m.jsx)(g,{onClick:p,spaceName:s.name})]}),j&&b.includes(n)&&(0,m.jsxs)(i.Text,{children:["To manage Plan & Billing information please"," ",(0,m.jsx)(c.A,{as:u.N_,to:`/spaces/${v}/settings/billing`,children:"click here."})]}),"noRooms"===n&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Text,{children:"Please contact a Space administrator or manager if this is unexpected."}),(0,m.jsx)(g,{onClick:p,spaceName:s.name})]}),"windowsAgent"===n&&(0,m.jsxs)(i.Flex,{column:!0,gap:2,children:[(0,m.jsx)(i.Text,{children:"Please sign in to view the Netdata dashboard."}),(0,m.jsx)(i.Flex,{children:(0,m.jsx)(h,{})})]}),a&&(0,m.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(63766),t=a(88934),r=a(46587),l=a(86706),d=(a(98992),a(54520),a(30569)),c=a(84929),u=a(63872),m=a(77389),h=a(99236),f=a(24609),g=a(32874),b=a(15624),p=a(49916);var x=a(64999),y=a(74848);const v="leave-space-dialog",j="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,u.A)();return(0,d.yF)((0,i.useCallback)((async(a,i,o)=>{let{currentUserId:t,onSuccess:r,onError:d}=o;const u=await a((0,f.nC)("ids")),x=u.filter((e=>n!==e)),y=e=>{i(e,c.Ut)},[v]=x;if(!v)return void s({header:"Spaces",text:h.sh.leave});const{slug:j}=v&&await a((0,b.Ay)(v));i((0,f.nC)("ids"),x),i(g.A,(e=>e.filter((e=>e!==n))));try{await(0,m.XY)(n,[t]),r&&r(j),(0,l.Z8)(y,n),(0,p.Is)(y,n),y((0,b.Ay)(n))}catch(e){i((0,f.nC)("ids"),u),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":`${v}-last-member`,"data-testid":`${j}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":`${v}-last-admin`,"data-testid":`${j}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":v,"data-testid":j,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})}}}]);