!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="62a368e9-1215-429f-be37-3a87400cad95",e._sentryDebugIdIdentifier="sentry-dbid-62a368e9-1215-429f-be37-3a87400cad95")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"08864407160b3973b9b88c5ae92687282b21e2f4"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7959],{7959:(e,n,t)=>{t.r(n),t.d(n,{default:()=>f});t(62953);var a=t(96540),o=t(10058),l=t(3914),s=t(87659),r=t(98496),c=t(39522),i=t(4659),m=t(84976);const d={noRoomPermission:{header:e=>"Your role doesn't give you permission to access any of the troubleshooting information on ".concat(e,".")},noSpacePermission:{header:e=>"Your role doesn't give you permission to access any information on ".concat(e,".")},noRooms:{header:e=>"You currently don't have permission to see any room on ".concat(e,".")}},u=e=>{let{onClick:n,spaceName:t}=e;return a.createElement(a.Fragment,null,a.createElement(o.Text,{margin:[2,0,0]},"You can also leave this Space if you wish. "),a.createElement(o.Button,{flavour:"borderless",icon:"switch_off",label:"Leave ".concat(t),margin:[0,0,0,7],onClick:n,strong:!0}))},f=e=>{let{reason:n}=e;const t=(0,l.ap)(),[f,,g,p]=(0,s.A)(),{header:b}=d[n],h=(0,l.bq)();return a.createElement(r.A,{title:b(t.name)},a.createElement(a.Fragment,null,"noSpacePermission"===n&&a.createElement(a.Fragment,null,a.createElement(o.Text,null,"Please contact the Space administrators if this is unexpected."),a.createElement(u,{onClick:g,spaceName:t.name})),"noRoomPermission"===n&&a.createElement(o.Text,null,"To manage Plan & Billing information please"," ",a.createElement(i.A,{as:m.N_,to:"/spaces/".concat(h,"/settings/billing")},"click here.")),"noRooms"===n&&a.createElement(a.Fragment,null,a.createElement(o.Text,null,"Please contact a Space administrator or manager if this is unexpected."),a.createElement(u,{onClick:g,spaceName:t.name})),f&&a.createElement(c.A,{id:t.id,name:t.name,onClose:p})))}},39522:(e,n,t)=>{t.d(n,{A:()=>v});var a=t(58168),o=t(96540),l=t(10058),s=t(47767),r=t(22292),c=t(55463),i=(t(17333),t(98992),t(54520),t(62953),t(47444)),m=t(71835),d=t(54702),u=t(55189),f=t(3914),g=t(48849),p=t(56639),b=t(14994);var h=t(57992);const y="leave-space-dialog",E="leaveSpaceDialog",v=e=>{let{id:n,name:t,onClose:v}=e;const w=(0,s.Zp)(),C=(0,r.uW)("id"),A=(0,c.Gi)(),S=(0,c.i3)(),k=(0,c.pB)(),P=(e=>{const[,n]=(0,m.A)();return(0,i.Zs)((t=>{let{snapshot:a,set:o,reset:l}=t;return async t=>{let{currentUserId:s,onSuccess:r,onError:i}=t;const m=await a.getPromise((0,f.nC)("ids")),h=m.filter((n=>e!==n)),[y]=h;if(!y)return void n({header:"Spaces",text:u.sh.leave});const{slug:E}=y&&await a.getPromise((0,p.Ay)(y));o((0,f.nC)("ids"),h),o(g.A,(n=>n.filter((n=>n!==e))));try{await(0,d.XY)(e,[s]),r&&r(E),(0,c.Z8)(l,e),(0,b.Is)(l,e),l((0,p.Ay)(e))}catch(v){o((0,f.nC)("ids"),m),i&&i()}}}),[e])})(n),_=(0,h.A)(n),L=(0,o.useCallback)((e=>w("/spaces/".concat(e))),[]),Y=1===A.length,I=1===S.length&&k,x=Y?{confirmLabel:"Yes, leave","data-ga":"".concat(y,"-last-member"),"data-testid":"".concat(E,"LastMember"),handleConfirm:()=>_({onSuccess:L}),message:o.createElement(o.Fragment,null,"If you leave, space ",o.createElement("strong",null,t)," will be deleted immediately.",o.createElement("br",null),"Are you sure you want to continue?"),title:"Leave and delete ".concat(t," space")}:I?{confirmLabel:"Give rights","data-ga":"".concat(y,"-last-admin"),"data-testid":"".concat(E,"LastAdmin"),handleConfirm:()=>w("users"),isConfirmPositive:!0,message:o.createElement(o.Fragment,null,"You are the last admin of ",o.createElement("strong",null,t)," space. Please give admin rights to another member so you can leave this space."),title:"Leave ".concat(t," space")}:{confirmLabel:"Yes, leave","data-ga":y,"data-testid":E,handleConfirm:()=>P({currentUserId:C,onSuccess:L}),message:o.createElement(o.Fragment,null,"You are about to leave ",o.createElement("strong",null,t)," space.",o.createElement("br",null),"Are you sure you want to continue?"),title:"Leave ".concat(t," space")};return o.createElement(l.ConfirmationDialog,(0,a.A)({handleDecline:v},x))}}}]);