!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"95b7c22eb8a2502481fe65c08f3bb8d7c317f943"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="71229b79-d0b2-432b-85dc-9cef4dc672c8",e._sentryDebugIdIdentifier="sentry-dbid-71229b79-d0b2-432b-85dc-9cef4dc672c8")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[7530],{17530(e,n,s){s.r(n),s.d(n,{default:()=>b});s(74423);var a=s(11759),o=s(24609),i=s(6304),t=s(99728),r=s(29022),c=s(36348),l=s(79748),d=s(5981),m=s(15750),u=s(74848);const h={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}.`}},g=e=>{let{onClick:n,spaceName:s}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.Text,{margin:[2,0,0],children:"You can also leave this Space if you wish. "}),(0,u.jsx)(a.Button,{flavour:"borderless",icon:"switch_off",label:`Leave ${s}`,margin:[0,0,0,7],onClick:n,strong:!0})]})},f=["noSpacePermission","noRoomPermission"],b=e=>{let{reason:n}=e;const s=(0,o.ap)(),[b,,p,x]=(0,i.A)(),{header:y}=h[n],v=(0,o.bq)(),j=(0,m.A)(),C=(0,t.JT)("billing:ReadBasic");return(0,u.jsx)(r.A,{title:y(s.name),children:(0,u.jsxs)(u.Fragment,{children:["noSpacePermission"===n&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.Text,{children:"Please contact the Space administrators if this is unexpected."}),(0,u.jsx)(g,{onClick:p,spaceName:s.name})]}),C&&f.includes(n)&&(0,u.jsxs)(a.Text,{children:["To manage Plan & Billing information please"," ",(0,u.jsx)(l.A,{as:d.N_,to:j(`/spaces/${v}/settings/billing`),children:"click here."})]}),"noRooms"===n&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.Text,{children:"Please contact a Space administrator or manager if this is unexpected."}),(0,u.jsx)(g,{onClick:p,spaceName:s.name})]}),b&&(0,u.jsx)(c.A,{id:s.id,name:s.name,onClose:x})]})})}},36348(e,n,s){s.d(n,{A:()=>C});var a=s(96540),o=s(11759),i=s(5981),t=s(46587),r=s(86706),c=(s(98992),s(54520),s(30569)),l=s(84929),d=s(63872),m=s(77389),u=s(99236),h=s(24609),g=s(32874),f=s(15624),b=s(49916);const p=e=>{const[,n]=(0,d.A)();return(0,c.yF)((0,a.useCallback)(async(s,a,o)=>{let{currentUserId:i,onSuccess:t,onError:c}=o;const d=await s((0,h.nC)("ids")),p=d.filter(n=>e!==n),x=e=>{a(e,l.Ut)},[y]=p;if(!y)return void n({header:"Spaces",text:u.sh.leave});const{slug:v}=y&&await s((0,f.Ay)(y));a((0,h.nC)("ids"),p),a(g.A,n=>n.filter(n=>n!==e));try{await(0,m.XY)(e,[i]),t&&t(v),(0,r.Z8)(x,e),(0,b.Is)(x,e),x((0,f.Ay)(e))}catch(j){a((0,h.nC)("ids"),d),c&&c()}},[e,n]))};s.dn(p);var x=s(64999),y=s(74848);const v="leave-space-dialog",j="leaveSpaceDialog",C=e=>{let{id:n,name:s,onClose:c}=e;const l=(0,i.Zp)(),d=(0,t.uW)("id"),m=(0,r.Gi)(),u=(0,r.i3)(),h=(0,r.pB)(),g=p(n),f=(0,x.A)(n),b=(0,a.useCallback)(e=>l(`/spaces/${e}`),[]),C=1===m.length,w=1===u.length&&h,A=C?{confirmLabel:"Yes, leave","data-ga":`${v}-last-member`,"data-testid":`${j}LastMember`,handleConfirm:()=>f({onSuccess:b}),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`}:w?{confirmLabel:"Give rights","data-ga":`${v}-last-admin`,"data-testid":`${j}LastAdmin`,handleConfirm:()=>l("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":v,"data-testid":j,handleConfirm:()=>g({currentUserId:d,onSuccess:b}),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:c,...A})}}}]);