!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]="e64832dc-26ea-4e8b-9ee9-4433adcc06fb",e._sentryDebugIdIdentifier="sentry-dbid-e64832dc-26ea-4e8b-9ee9-4433adcc06fb")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"30b1ba65cc8722be7e184f4a401fb43e6b21634d"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[7959],{7959:(e,n,t)=>{t.r(n),t.d(n,{default:()=>g});t(62953);var a=t(96540),o=t(83199),l=t(3914),s=t(87659),r=t(46741),c=t(98496),i=t(39522),d=t(4659),m=t(84976);const u={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,".")}},f=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}))},g=e=>{let{reason:n}=e;const t=(0,l.ap)(),[g,,b,p]=(0,s.A)(),{header:h}=u[n],y=(0,l.bq)(),E=(0,r.JT)("billing:ReadBasic");return a.createElement(c.A,{title:h(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(f,{onClick:b,spaceName:t.name})),E&&"noRooms"!==n&&a.createElement(o.Text,null,"To manage Plan & Billing information please"," ",a.createElement(d.A,{as:m.N_,to:"/spaces/".concat(y,"/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(f,{onClick:b,spaceName:t.name})),g&&a.createElement(i.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(83199),s=t(47767),r=t(22292),c=t(55463),i=(t(17333),t(98992),t(54520),t(62953),t(47444)),d=t(71835),m=t(54702),u=t(55189),f=t(3914),g=t(48849),b=t(56639),p=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)(),_=(e=>{const[,n]=(0,d.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 d=await a.getPromise((0,f.nC)("ids")),h=d.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,b.Ay)(y));o((0,f.nC)("ids"),h),o(g.A,(n=>n.filter((n=>n!==e))));try{await(0,m.XY)(e,[s]),r&&r(E),(0,c.Z8)(l,e),(0,p.Is)(l,e),l((0,b.Ay)(e))}catch(v){o((0,f.nC)("ids"),d),i&&i()}}}),[e])})(n),L=(0,h.A)(n),P=(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:()=>L({onSuccess:P}),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:()=>_({currentUserId:C,onSuccess:P}),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))}}}]);