File: //proc/self/root/opt/netdata/netdata-web-files/v3/2448.bf9afd03e201dc0d82ad.chunk.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"d59f3e13055072acb481db3c59603d296982e8b2"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c7fdd287-5a17-4abf-bc6e-dc9f736a96a0",e._sentryDebugIdIdentifier="sentry-dbid-c7fdd287-5a17-4abf-bc6e-dc9f736a96a0")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[2448],{64903(e,t,n){"use strict";n.d(t,{A:()=>j});var a=n(38429),s=n(96540),i=n(6304);const l=(e,t)=>{const n=e&&!isNaN(parseInt(e))?Math.min(parseInt(e),t):null;return null===n?"":n<10?"0"+n:n.toString()},o=e=>{let{value:t,min:n,max:a,onChange:o}=e;const[r,,d,c]=(0,i.A)(),[u,m]=(0,s.useState)(l(t,a)),[h,g]=(0,s.useState)();return{inputProps:(0,s.useMemo)(()=>r?{type:"number",min:n,max:a}:{type:"text"},[r,n,a]),renderedValue:u,error:h,onInput:(0,s.useCallback)(e=>{const t=e?.target?.value,n=parseInt(t,10);n>a?g(`Maximum value is ${a}`):g();const s=Math.min(n,a);o(s),m(t)},[a,o,m,g]),onFocus:d,onBlur:(0,s.useCallback)(e=>{const t=e?.target?.value;c(),m(l(t,a))},[a,c,m])}},r={hours:99,minutes:59,seconds:59,default:59},d={hours:0,minutes:0,seconds:0,default:0};var c=n(74891),u=n(74848);const m=(0,c.A)(a.Flex),h=e=>{let{value:t,onChange:n,min:s=d.default,max:i=r.default,inputProps:l={},...c}=e;const{inputProps:h,renderedValue:g,error:x,onInput:p,onFocus:b,onBlur:j}=o({value:t,min:s,max:i,onChange:n});return(0,u.jsx)(m,{tooltip:x,tooltipProps:{align:"bottom"},children:(0,u.jsx)(a.TextInput,{width:{base:20},value:g,onInput:p,onFocus:b,onBlur:j,size:"small",error:x,hideErrorMessage:!0,...l,...h,...c})})},g=e=>{let{value:t,onChange:n,applyOnChange:a}=e;const{hours:i,minutes:l,seconds:o}=(e=>null===e||isNaN(e)?{hours:null,minutes:null,seconds:null}:{hours:Math.floor(e/3600),minutes:Math.floor(e%3600/60),seconds:e%60})(t),[r,d]=(0,s.useState)(i),[c,u]=(0,s.useState)(l),[m,h]=(0,s.useState)(o),g=(0,s.useCallback)(()=>{const e=function(){let{hours:e=0,minutes:t=0,seconds:n=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 60*e*60+60*t+n}({hours:r,minutes:c,seconds:m});n(e)},[r,c,m,n]);return(0,s.useEffect)(()=>{a&&g()},[a,r,c,m,g]),{hours:r,minutes:c,seconds:m,onHoursChange:d,onMinutesChange:u,onSecondsChange:h,onApply:g}};var x=n(94404);const p=(0,c.A)(a.Flex),b=(0,x.A)(a.Button),j=e=>{let{testId:t,value:n,onChange:a,applyOnChange:s,minValues:i=d,maxValues:l=r,hideSeconds:o,inputProps:c={},...m}=e;const{disabledTooltip:x,disabled:j,...f}=m,{hours:v,minutes:C,seconds:y,onHoursChange:w,onMinutesChange:T,onSecondsChange:A,onApply:S}=g({value:n,onChange:a,applyOnChange:s});return(0,u.jsxs)(p,{"data-testid":`duration-selector-container-${t}`,gap:2,alignItems:"end",tooltip:j?x:null,tooltipProps:{align:"bottom"},children:[(0,u.jsx)(h,{label:"Hours",value:v,min:i.hours,max:l.hours,onChange:w,disabled:j,inputProps:c,...f}),(0,u.jsx)(h,{label:"Minutes",value:C,min:i.minutes,max:l.minutes,onChange:T,disabled:j,inputProps:c,...f}),o?null:(0,u.jsx)(h,{label:"Seconds",value:y,min:i.seconds,max:l.seconds,onChange:A,disabled:j,inputProps:c,...f}),s?null:(0,u.jsx)(b,{label:"Apply",onClick:S,small:!0,payload:{info:"Apply reachability notifications delay",testId:t},...m})]})}},93926(e,t,n){"use strict";n.d(t,{A:()=>i});var a=n(38429),s=n(74848);const i=e=>{let{message:t,title:n,footer:i,...l}=e;const o=l?.["data-testid"]||"functionError";return(0,s.jsxs)(a.Flex,{alignItems:"center",column:!0,"data-testid":o,flex:!0,gap:3,justifyContent:"center",padding:[0,20],...l,children:[(0,s.jsx)(a.H3,{"data-testid":`${o}-title`,children:n}),(0,s.jsx)(a.TextBig,{color:"textDescription","data-testid":`${o}-message`,children:t}),i]})}},80320(e,t,n){"use strict";n.d(t,{A:()=>p});var a=n(38429),s=n(95263),i=n(74848);const l=e=>{let{"data-testid":t="input",description:n,isRequired:l,onChange:o,title:r,...d}=e;return(0,i.jsxs)(a.Flex,{column:!0,"data-testid":t,flex:"grow",gap:1,children:[(0,i.jsx)(s.A,{"data-testid":t,description:n,isRequired:l,title:r}),(0,i.jsx)(a.TextInput,{"data-testid":`${t}-field`,onChange:e=>{let{target:t}=e;return o(t.value)},...d})]})};n(98992),n(81454);const o=e=>{let{"data-testid":t="select",description:n,getDataGa:l,fields:o,id:r,isRequired:d,onChange:c,secrets:u,setSecrets:m,title:h,...g}=e;return(0,i.jsxs)(a.Flex,{column:!0,"data-testid":t,flex:"grow",gap:1,children:[(0,i.jsx)(s.A,{"data-testid":t,description:n,isRequired:d,title:h}),(0,i.jsx)(a.Select,{"data-testid":`${t}-field`,menuPortalTarget:document.body,onChange:e=>c(e),menuPlacement:"auto",...g}),Object.values(o?.[g.value?.value]||{}).map(e=>{let{getValue:n,id:a,onChange:s,...o}=e;return(0,i.jsx)(x,{"data-ga":l(`${r}-${a}-${o.component}`),"data-testid":`${t}-${a}`,id:a,onChange:s({id:r,setSecrets:m,subsetId:a}),value:n({id:r,secrets:u,subsetId:a}),...o},a)})]})};n(8872);var r=n(96540),d=n(90179),c=n.n(d),u=n(97200),m=n.n(u),h=n(52838);const g={default:()=>null,pairs:e=>{let{componentPairs:t,"data-testid":n="pairs",description:l,getDataGa:o,id:d,isRequired:u,placeholder:g,setSecrets:x,title:b}=e;const[j,f]=(0,r.useState)({});(0,r.useEffect)(()=>{const e=Object.values(j).reduce((e,t)=>{let{key:n,value:a}=t;return n?{...e,[n]:a||""}:e},{});x(t=>Object.keys(e).length?{...t,[d]:e}:c()(t,d))},[j]);return(0,i.jsxs)(a.Flex,{column:!0,"data-testid":n,gap:1,children:[(0,i.jsxs)(a.Flex,{alignItems:"center",justifyContent:"between",children:[(0,i.jsx)(s.A,{"data-testid":n,description:l,isRequired:u,title:b}),t.map(e=>{const s=(0,h.$Q)(e);return(0,i.jsx)(a.Button,{"data-ga":o(`${d}-${s}-add`),"data-testid":`${n}-${s}Add`,label:1===t.length?"Add":`Add ${s}`,flavour:"hollow",icon:"plus",onClick:()=>(e=>f(t=>({...t,[m()("pair_")]:{key:"",components:e,value:""}})))(e)},s)})]}),Object.entries(j).map(e=>{let[t,{key:s,components:l,value:r}]=e;const[u,m]=l,x=(0,h.$Q)(l);return(0,i.jsxs)(a.Flex,{alignItems:"end",gap:2,children:[(0,i.jsx)(p,{component:u,"data-ga":o(`${d}-${x}-key`),"data-testid":`${n}-${x}Key`,onChange:e=>f(n=>({...n,[t]:{...n[t],key:e}})),value:s,placeholder:g,title:"Key"}),(0,i.jsx)(p,{component:m,"data-ga":o(`${d}-${x}-value`),"data-testid":`${n}-${x}Value`,onChange:e=>f(n=>({...n,[t]:{...n[t],value:e}})),value:r,placeholder:g,title:"Value"}),(0,i.jsx)(a.Button,{flavour:"borderless",icon:"trashcan",margin:[0,0,1,0],neutral:!0,onClick:()=>{f(e=>c()(e,t))}})]},`${x}-${t}`)})]})},input:l,select:o},x=e=>{let{component:t,...n}=e;const a=g[t]||g.default;return(0,i.jsx)(a,{...n})},p=x},95263(e,t,n){"use strict";n.d(t,{A:()=>l});var a=n(38429),s=n(45087),i=n(74848);const l=e=>{let{description:t,isRequired:n,title:l,...o}=e;const r=o["data-testid"]?`${o["data-testid"]}-label`:"fieldLabel";return(0,i.jsxs)(a.Flex,{"data-testid":`${r}-container`,gap:1,children:[(0,i.jsxs)(a.Text,{color:"textLite","data-testid":r,children:[l,n&&" *"]}),t&&(0,i.jsx)(s.A,{align:"top",content:t,"data-testid":`${r}-info`,plain:!0,children:(0,i.jsx)(a.Icon,{color:"textLite",name:"information",size:"small"})})]})}},15679(e,t,n){"use strict";n.d(t,{A:()=>l});var a=n(38429),s=n(45087),i=n(74848);const l=(o=e=>{let{value:t,...n}=e;return(0,i.jsx)(a.Pill,{"data-testid":"pill-content",flavour:"neutral",size:"small",...n,children:t})},e=>{let{noTooltip:t,...n}=e;return t?(0,i.jsx)(o,{...n}):(0,i.jsx)(s.A,{content:n.value,children:(0,i.jsx)(a.Box,{children:(0,i.jsx)(o,{...n})})})});var o},98563(e,t,n){"use strict";n.d(t,{$m:()=>r,He:()=>i,Jg:()=>m,MU:()=>l,Oj:()=>d,W6:()=>o,fn:()=>c,id:()=>u});var a=n(882),s=n(38429);const i=(0,a.default)(s.Flex).attrs({alignItems:"center",color:"text",gap:1,hoverColor:"text"}).withConfig({displayName:"styled__AnchorComponent",componentId:"sc-wc4x41-0"})(["&,&:hover{text-decoration:none;}"]),l=(0,a.default)(s.Icon).attrs({height:"130px",width:"130px"}).withConfig({displayName:"styled__BlurredIcon",componentId:"sc-wc4x41-1"})(["filter:blur(70px);position:absolute;left:0;top:0;opacity:0.5;"]),o=(0,a.default)(s.TextSmall).withConfig({displayName:"styled__LearnMoreTest",componentId:"sc-wc4x41-2"})(["position:relative;"]),r=(0,a.default)(s.ModalContent).attrs(e=>({height:{base:"80vh",max:"80vh",min:45},width:{base:121,max:140,min:70},...e})).withConfig({displayName:"styled__ModalContent",componentId:"sc-wc4x41-3"})(["box-shadow:0 18px 28px rgb(9 30 66 / 15%),0 0 1px rgb(9 30 66 / 31%);"]),d=(0,a.default)(s.ModalCloseButton).attrs({color:"text",height:"16px",width:"16px"}).withConfig({displayName:"styled__ModalClose",componentId:"sc-wc4x41-4"})(["&:hover{fill:",";}"],(0,s.getColor)("selected")),c=(0,a.default)(s.Flex).attrs(e=>{let{hasBorder:t,...n}=e;return{...t?{border:{side:"bottom",color:"disabled"}}:{},column:!0,padding:[3],...n}}).withConfig({displayName:"styled__ModalSection",componentId:"sc-wc4x41-5"})([""]),u=(0,a.default)(s.Icon).attrs({name:"warning_triangle",height:"18px",width:"18px",color:["yellow","amber"]}).withConfig({displayName:"styled__WarningIcon",componentId:"sc-wc4x41-6"})(["position:absolute;top:0;right:0;z-index:1;"]),m=(0,a.default)(s.Icon).attrs({height:"12px",width:"12px",color:"white"}).withConfig({displayName:"styled__SystemIcon",componentId:"sc-wc4x41-7"})(["position:relative;top:2px;"])},71282(e,t,n){"use strict";n.d(t,{A:()=>p});var a=n(96540),s=n(63950),i=n.n(s),l=n(38429),o=n(18739),r=n(63872),d=n(60908),c=n(94404),u=n(3319),m=n(6304),h=n(37785),g=n(74848);const x=(0,c.A)(l.Button),p=e=>{let{onConfirm:t,onDecline:n=i(),onCancellingEnd:s=i()}=e;const c=(0,o.M4)(),[p,b]=(0,r.A)(),{id:j}=(0,h.A)(),{sendLog:f,isReady:v}=(0,u.A)(),[C,,y,w]=(0,m.A)(),T=(0,a.useCallback)(()=>{y(),c({productId:j}).then(()=>{p({header:"Successfully canceled subscription",text:"You are now on Community plan"}),f({feature:"TrialOptOut",isSuccess:!0})}).catch(()=>{b({header:"Failed to cancel the subscription",text:"Remained on Business plan"}),f({feature:"TrialOptOut",isFailure:!0,error:"Failed to cancel the subscription"})}).finally(()=>{s(),w()})},[j,v]),A=(0,a.useCallback)(()=>{t?t():T()},[t,T]);return(0,g.jsx)(l.Modal,{backdropProps:{backdropBlur:!0},children:(0,g.jsx)(d.Ay,{feature:"TrialOptOut",children:(0,g.jsxs)(l.ModalContent,{width:{base:140},children:[(0,g.jsx)(l.ModalHeader,{children:(0,g.jsx)(l.Flex,{gap:2,alignItems:"center",children:(0,g.jsx)(l.H4,{children:"Opt out of Free Trial"})})}),(0,g.jsx)(l.ModalBody,{children:C?(0,g.jsx)(l.Flex,{height:"100px",children:(0,g.jsx)(l.TextBig,{children:"Changing billing plan..."})}):(0,g.jsxs)(l.Flex,{gap:2,column:!0,children:[(0,g.jsx)(l.H3,{children:"Are You Sure?"}),(0,g.jsx)(l.TextBig,{children:"It looks like you have chosen to opt-out of your free 14-day business trial. Are you sure you do not want to experience all the features Netdata has to offer?"}),(0,g.jsx)(l.TextBig,{children:"By opting out, you will be downgraded to the community plan immediately."})]})}),(0,g.jsx)(l.ModalFooter,{children:(0,g.jsxs)(l.Flex,{justifyContent:"end",gap:4,padding:[1,2],children:[(0,g.jsx)(x,{feature:"TrialOptOut",label:"Yes, I am sure!",flavour:"hollow",small:!0,onClick:A,disabled:!j||C,textTransform:""}),(0,g.jsx)(x,{feature:"TrialOptOut",label:"No, I want the trial!",small:!0,onClick:n,disabled:C,textTransform:""})]})})]})})})}},42711(e,t,n){"use strict";n.d(t,{A:()=>c});var a=n(96540),s=n(63950),i=n.n(s),l=n(38429),o=n(3319),r=n(74848);const d={default:"Or you can opt to downgrade immediately",billing:"Or you can opt to downgrade immediately"},c=e=>{let{flavour:t="default",onOptOutClick:n=i(),...s}=e;const{sendLog:c,isReady:u}=(0,o.A)(),m=(0,a.useCallback)(()=>{n(),c({feature:"TrialOptOut",isStart:!0})},[u]);return(0,r.jsxs)(l.Text,{...s,children:["After the trial, you'll automatically switch to the free Community plan."," ",(0,r.jsx)(l.Box,{"data-testid":"upgrade-to-business-banner",onClick:m,as:l.Text,cursor:"pointer",textDecoration:"underline",color:"primary",children:d[t]}),"."]})}},43891(e,t,n){"use strict";n.d(t,{K:()=>i,P:()=>l});var a=n(882),s=n(38429);const i=a.default.ul.withConfig({displayName:"styled__StyledList",componentId:"sc-z791f1-0"})(["list-style:disc outside none;margin-left:16px;"]),l=(0,a.default)(s.ModalContent).attrs(e=>{let{isMobile:t}=e;return{width:t?{base:"95vw"}:{}}}).withConfig({displayName:"styled__TrialWelcomeModalContent",componentId:"sc-z791f1-1"})([""])},37785(e,t,n){"use strict";n.d(t,{A:()=>r,s:()=>o});var a=n(18739),s=n(18387),i=n(50979);const l=e=>{const{value:t}=(0,a.lU)();if(!t?.[e])return{};const n=Object.keys(t[e]).sort(s.M7)[0];return{id:t[e][n]?t[e][n][0]?.id:null,version:n}},o=()=>l(i.VH.homelab),r=()=>l(i.VH.free)},52448(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>vi});var a=n(76667),s=n(24609),i=n(96540),l=n(7960),o=n(882),r=n(38429),d=n(44926),c=n(32788),u=n(29263),m=n(85005),h=(n(98992),n(54520),n(81454),n(99728)),g=n(49916),x=n(6304),p=n(73467),b=n(71236),j=n(74848);const f=[{id:"name",accessor:"name",header:"Name",cell:e=>{let{getValue:t,row:{original:{isMember:n}}}=e;const a=t(),s=(0,h.JT)("room:ReadAll");return(0,j.jsxs)(r.Flex,{alignItems:"center",children:[s&&n&&(0,j.jsx)(p.A,{margin:[0,1,0,0]}),(0,j.jsx)(r.Text,{margin:s&&!n&&[0,0,0,4],children:a})]})}},{id:"nodeCount",accessor:"nodeCount",header:"Nodes",cell:e=>{let{getValue:t}=e;return`${t()||0}`}},{id:"memberCount",accessor:"memberCount",header:()=>"Users",cell:e=>{let{getValue:t}=e;return`${t()||0}`}},{id:"silencing",accessorKey:"silencingState",header:"Silencing",cell:e=>{let{getValue:t}=e;return(0,j.jsx)(b.A,{flavour:"room",silencing:t()})}}];n(33110),n(74423),n(3949);var v=n(30569),C=n(84929),y=n(50433),w=n(258),T=n(19186),A=n(68781),S=n(93933);const I=e=>(0,v.yF)((0,i.useCallback)(async function(t,n,a){let{onSuccess:s,onFail:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const l=await t((0,g.$e)({id:e,key:"ids"})),o=a.map(e=>{let{id:t}=e;return t}),r=l.filter(e=>!o.includes(e));n((0,g.$e)({id:e,key:"ids"}),r);const d=await Promise.all(r.map(e=>t((0,T.LS)({id:e}))));try{if(await(async(e,t)=>Promise.all(t.map(t=>(0,w.HN)(e,t))))(e,o),n(A.yz,(0,S.Pb)(d)),o.forEach(t=>n((0,g.Oy)(e),t)),a.forEach(t=>{let{id:a,slug:s}=t;n((0,T.LS)({id:a}),C.Ut),n((0,A.x4)([e,s]),C.Ut)}),s&&s(),a.length>1)(0,y.r0)("Rooms were successfully deleted from Space!");else{const[e]=a;(0,y.r0)(`Room ${e.name} was successfully deleted!`)}}catch(c){n((0,g.$e)({id:e,key:"ids"}),l),i&&i(c)}},[e]));var k=n(8363);const F=e=>{let{spaceId:t,spaceName:n,startIsCreating:l}=e;const o=I(t),r=(0,h.JT)("space:Delete"),d=(0,h.JT)("room:Read"),c=(0,h.JT)("room:Create"),u=(0,h.JT)("space:CreatePersonalSilencingRule"),m=(e,t)=>{if(!e)return;const n=Array.isArray(e)?e.map(e=>{let{id:t,name:n}=e;return{id:t,name:n}}):[{id:e.id,name:e.name}];o(n,{onSuccess:()=>t.toggleAllRowsSelected(!1)})},g=(e,t)=>{const n=t.length;if(!n)return"";return 1===n?(0,k.kI)(t[0].name):(0,k.kI)(n)},x=(e,t)=>{const a=t.length;if(!a)return"";const s={...1===a?{name:t[0].name}:{roomsLength:a},spaceName:n};return(0,j.jsx)(k.rj,{...s})},{pathname:p}=(0,a.zy)(),b=(0,s.bq)(),f=(0,a.Zp)(),v=(0,i.useCallback)(e=>f(`${p}/${e}`),[p,f]),C=(0,i.useMemo)(()=>({goto:{handleAction:e=>{let{slug:t}=e;return v(t)},icon:"chevron_right",tooltipText:"Room settings",isDisabled:()=>!d},addRule:{handleAction:e=>{const t={roomId:e.id};f(`/spaces/${b}/settings/notifications#notificationsActiveTab=1&silencingRulePrefill=${JSON.stringify(t)}`)},icon:"alarm_off",flavour:"hollow",neutral:!1,isDisabled:()=>!u,tooltipText:"Add new silencing rule",confirmation:!1},delete:{confirmLabel:"Yes, delete",confirmationMessage:e=>(0,j.jsx)(k.rj,{name:e.name,spaceName:n}),confirmationTitle:e=>(0,k.TU)(e.name),dataGa:e=>{let{slug:t}=e;return`manage-rooms::click-delete::${t}`},declineLabel:"Cancel",handleAction:m,isDisabled:e=>{let{untouchable:t}=e;return t||!r},tooltipText:"Delete room"}}),[r,v,u,d]);return{bulkActions:(0,i.useMemo)(()=>({addEntry:{dataGa:"manage-rooms::click::add-room",handleAction:l,isDisabled:!c,tooltipText:"Create room","data-onboarding-id":"create-room-button"},delete:{confirmationMessage:x,confirmationTitle:g,confirmLabel:"Yes, delete",dataGa:"manage-rooms::delete-bulk",declineLabel:"Cancel",handleAction:m,isDisabled:!r,tooltipText:"Delete rooms"}}),[c,r,x,g]),rowActions:C,onClickRow:v}},P=()=>{const e=(0,g.DL)(),t=(0,h.JT)("room:Delete"),n=e.filter(e=>!e.isAgent).map(e=>({...e,disabled:e.untouchable||!t})),[a,l]=(0,i.useState)(""),o=(0,s.ap)("name"),r=(0,s.ap)("id"),[d,,c,u]=(0,x.A)(),[,m]=(0,i.useState)([]),{bulkActions:p,rowActions:b}=F({startIsCreating:c,spaceId:r,spaceName:o});return{roomList:n,globalFilter:a,spaceName:o,spaceId:r,isCreating:d,rowActions:b,bulkActions:p,columns:f,startIsCreating:c,stopIsCreating:u,setGlobalFilter:l,onRowSelected:m,dataGa:"manage-rooms"}};var M=n(60908);const $=e=>{const{roomList:t,spaceName:n,isCreating:a,columns:s,setGlobalFilter:i,stopIsCreating:l,onRowSelected:o,rowActions:d,bulkActions:c,dataGa:u}=P();return(0,j.jsxs)(M.Ay,{tab:"Rooms",children:[(0,j.jsxs)(r.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...e,children:[(0,j.jsxs)(r.H3,{children:["Rooms of ",n]}),(0,j.jsx)(r.Table,{onSearch:i,onRowSelected:o,enableSorting:!0,dataColumns:s,enableSelection:!0,data:t,bulkActions:c,rowActions:d,dataGa:u,testPrefixCallback:e=>e.name})]}),a&&(0,j.jsx)(m.n,{onClose:l})]})};var L=n(92368),R=n(98545),N=n(6387),D=n(80372),B=n(43276),_=n(10602),V=n(24013);const O=()=>{const e=(0,_.CK)();return{nodes:(0,V.Gt)(e).map(e=>({...e,disabled:e.hasAccessibleData}))||[],nodeIds:e}};var E=n(37156);const U=(0,l.A)(()=>n.e(2634).then(n.bind(n,12634)),"Rules"),H=(0,i.memo)(e=>{let{roomUntouchable:t,...n}=e;const{nodes:a}=O({roomUntouchable:t});return(0,j.jsx)(M.Ay,{tab:"Room::Nodes",children:(0,j.jsxs)(r.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...n,children:[(0,j.jsx)(i.Suspense,{fallback:"",children:(0,j.jsx)(U,{roomUntouchable:t})}),(0,j.jsx)(E.A,{flavour:"roomNodes",showClaimNodeOnEmptySpace:!0,enableSelection:!0,customNodes:a,roomUntouchable:t})]})})});var W=n(47410),Y=n(82505),q=n(83488),J=n.n(q),G=n(66245),z=n.n(G),K=n(86706),Z=n(63231),Q=n(6084);const X=[{id:"user",accessorKey:"user",header:"Name",cell:e=>{let{cell:t}=e;const{avatarURL:n,name:a}=t.row.original;return(0,j.jsxs)(r.Flex,{alignItems:"center",gap:2,children:[(0,j.jsx)(Q.A,{src:n,title:a}),(0,j.jsx)(r.TextSmall,{children:a})]})}},{id:"email",accessorKey:"email",header:"Email",cell:e=>{let{getValue:t}=e;return(0,j.jsx)(r.TextSmall,{children:t()})}}],ee=[{id:"user",desc:!1}],te=e=>{let{setSelected:t}=e;const n=(0,K.Gi)(),a=(0,Y.lb)(),s=(0,i.useMemo)(()=>z()(n,a),[n,a]),l=(0,i.useCallback)(e=>{t(e.map(e=>e.id))},[]),o=(0,Z.Uv)(s);return(0,j.jsx)(r.Flex,{alignItems:"start",padding:[1],overflow:{horizontal:"hidden",vertical:"auto"},children:(0,j.jsx)(r.Table,{dataColumns:X,data:o,autoResetSelectedRows:!0,sortableBy:ee,onSearch:J(),onRowSelected:l,enableSelection:!0,enableSorting:!0})})};var ne=n(94404);const ae=(0,ne.A)(r.Button),se=e=>{let{onAdd:t,onClose:n,selected:a,error:s,name:i}=e;return(0,j.jsxs)(r.Flex,{alignItems:"center",justifyContent:"between",children:[s?(0,j.jsxs)(r.Text,{color:"error",children:["Select at least 1 user to add to ",i]}):(0,j.jsx)("div",{}),(0,j.jsxs)(r.Flex,{gap:2,children:[(0,j.jsx)(r.Button,{neutral:!0,flavour:"hollow",onClick:n,label:"Cancel"}),(0,j.jsx)(ae,{disabled:!a.length,label:`Add ${a.length} members`,onClick:t})]})]})};var ie=n(76238),le=n(80269),oe=n(64091),re=n(40298),de=n(12724),ce=n(51900),ue=n(63872),me=n(63936),he=n(79748),ge=n(33821),xe=n(56523),pe=n(3319);const be=e=>{let{email:t}=e;return(0,oe.B9)(t)},je={header:"Invitations",text:"Invitations successfully sent!"},fe=e=>{const{id:t,slug:n}=(0,s.ap)(),a=(0,T.ID)(),l=(0,T.wz)(a,"name"),[o,d]=(0,i.useState)([]),{recordMilestone:c,defaultMilestones:u}=(0,xe.A)(),{sendLog:m}=(0,pe.A)(),[,,g,x]=(0,re.gg)(t),[,p]=(0,ue.A)(),[b,f]=(0,i.useState)(),[v,C]=(0,i.useState)(),y=e=>{const{header:t,text:n}=e||je,a=(0,de.UI)({header:t,text:n,success:!0});ce.A.success(a,{context:"manageInvitations"}),c(u.firstTeamMemberInvited),m({feature:"InvitedToRoom",isSuccess:!0,invitationCount:o.length}),d([]),f(Math.random())},w=(0,i.useCallback)(()=>{const e=o.filter(be).map(e=>({email:e.email,name:e.name,role:v,roomIDs:[a]})),t=`${window.envSettings.cloudUrl}/spaces/${n}/join-space`;g(e,t,{onSuccess:y,onError:p})},[o,a,v]),A=(0,h._s)();return(0,j.jsxs)(r.Flex,{column:!0,...e,children:[(0,j.jsxs)(r.H4,{children:["Send invitations to ",l," room"]}),(0,j.jsx)(ie.BZ,{children:"TIP: You can send more invitations at once, separate each with a comma."}),(0,j.jsx)(le.y,{invitations:o,setInvitations:d},b),(0,j.jsx)(r.H5,{margin:[4,0,0],children:"Role"}),(0,j.jsxs)(ie.BZ,{children:["Choose a role for invited user."," ",(0,j.jsx)(he.A,{href:ge.S0,target:"_blank",rel:"noopener noreferrer",Component:r.TextSmall,children:"Learn more"})]}),(0,j.jsx)(me.A,{availableRoles:A,dataGA:"invite-to-room",dataTestId:"invite-selectRole",onChange:e=>{C(e.target.value)},value:v}),(0,j.jsx)(r.Box,{alignSelf:"end",margin:[4,0,0],children:(0,j.jsx)(r.Button,{label:"Send",onClick:w,disabled:0===o.length||!v,flavour:"hollow",isLoading:x})})]})},ve=e=>{let{onClose:t,room:n}=e;const[a,s]=(0,i.useState)([]),[l,o]=(0,i.useState)(!1),d=(0,Y.n)(n.spaceId,n.id),m=(0,i.useCallback)(()=>{if(!a.length)return o(!0);o(!1),d(a),t()},[a,d]);return(0,j.jsxs)(c.GO,{onClose:t,children:[(0,j.jsx)(u.z,{onClose:t,isSubmodal:!0,title:(0,j.jsxs)(j.Fragment,{children:["Manage room",(0,j.jsx)(r.TextBig,{color:"textLite",children:"\xa0/ Add Users"})]})}),(0,j.jsxs)(W.U,{children:["Add users to room\xa0",n.name]}),(0,j.jsxs)(c.Yv,{children:[(0,j.jsx)(fe,{margin:[0,0,4]}),(0,j.jsx)(r.Flex,{column:!0,flex:!0,overflow:"hidden",padding:[0,0,2,0],children:(0,j.jsx)(te,{setSelected:s})}),(0,j.jsx)(se,{onClose:t,onAdd:m,selected:a,error:l,name:n.name})]})]})};var Ce=n(96600),ye=n(46587);const we=e=>`Remove ${e}`,Te=e=>{let{name:t,usersLength:n}=e;return n?1===n&&t?we(t):`Remove ${a=n} ${1===a?"user":"users"}`:"";var a},Ae=e=>{let{name:t,roomName:n}=e;return(0,j.jsxs)(j.Fragment,{children:["You are about to remove ",(0,j.jsx)("strong",{children:t})," from room ",(0,j.jsx)("strong",{children:n}),".",(0,j.jsx)("br",{}),"Are you sure you want to continue?"]})},Se=e=>{let{roomName:t,usersLength:n}=e;const a=1===n?`${n} user`:`${n} users`;return(0,j.jsxs)(j.Fragment,{children:["You are about to remove ",(0,j.jsx)("strong",{children:a})," from room ",(0,j.jsx)("strong",{children:t}),".",(0,j.jsx)("br",{}),"Are you sure you want to continue?"]})},Ie=e=>{let{name:t,roomName:n,usersLength:a}=e;return a?1===a&&t?(0,j.jsx)(Ae,{name:t,roomName:n}):(0,j.jsx)(Se,{roomName:n,usersLength:a}):""},ke=e=>{let{spaceId:t,roomId:n,startIsInviting:a,canRemoveUser:s,untouchable:l}=e;const o=(0,Y.zC)(t,n),r=(0,T.XA)("name"),{sendButtonClickedLog:d,isReady:c}=(0,pe.A)(),u=e=>{if(!e)return;const t=Array.isArray(e)?e.map(e=>{let{user:t}=e;return t.id}):[e?.user.id];o(t)},m=(0,i.useCallback)(()=>{a(),c&&d({label:"Invite users"},!0)},[c,d]);return{rowActions:(0,i.useMemo)(()=>({remove:{confirmLabel:"Yes, remove",confirmationMessage:e=>(0,j.jsx)(Ae,{name:e.name,roomName:r}),confirmationTitle:e=>we(e.name),declineLabel:"Cancel",disabledTooltipText:e=>l?"It's not allowed to remove users from this room. Try removing them from the space.":e.isSelf?"You cannot remove yourself. Click the leave button on the room tab.":s?"Remove is disabled":"You don't have the required permissions to remove users from this room",handleAction:u,isDisabled:e=>e.disabled,tooltipText:"Remove user from room"}}),[we,u,Ae,r]),bulkActions:(0,i.useMemo)(()=>({addEntry:{handleAction:m,tooltipText:"Invite users"},remove:{confirmLabel:"Yes, remove",confirmationMessage:(e,t)=>(0,j.jsx)(Ie,{name:t[0].name,roomName:r,usersLength:t.length}),confirmationTitle:(e,t)=>Te({name:t[0].name,usersLength:t.length}),declineLabel:"Cancel",disabledTooltipText:e=>l?"It's not allowed to remove users from this room. Try removing them from the space.":e.length?s?"Remove is disabled":"You don't have the required permissions to remove users from this room":"You haven't selected any users",handleAction:u,tooltipText:"Remove users from room"}}),[u,Ie,r,a,Te])}},Fe=e=>{let{untouchable:t}=e;const n=(0,i.useMemo)(()=>[{id:"name",accessor:"name",header:"Name",cell:e=>{let{getValue:t}=e;return`${t()}`}},{id:"user",accessor:"user",header:"Users",cell:e=>{let{getValue:t}=e;const{name:n,avatarURL:a,email:s}=t();return(0,j.jsxs)(r.Flex,{alignItems:"center",gap:2,children:[(0,j.jsx)(Q.A,{src:a,title:`${n} - ${s||"email not set"}`}),(0,j.jsx)(r.TextSmall,{children:n})]})}},{id:"email",accessor:"email",header:"Email",width:300,align:"center",cell:e=>{let{getValue:t}=e;return(0,j.jsx)(r.TextSmall,{children:t()})}}],[]),a=(0,Y.di)(),l=(0,ye.uW)("id"),o=(0,h.JT)("space:RemoveUser"),[d,c]=(0,i.useState)([]),[u,m]=(0,i.useState)(""),[g,,p,b]=(0,x.A)(),f=(0,s.ap)("id"),v=(0,T.ID)(),{rowActions:C,bulkActions:y}=ke({selectedRows:d,spaceId:f,roomId:v,startIsInviting:p,canRemoveUser:o,untouchable:t});return{columns:n,data:(0,i.useMemo)(()=>(0,Ce.L)({data:a,currentUserId:l,canRemoveUser:o,untouchable:t}),[a]),columnVisibility:{name:!1},members:a,rowActions:C,bulkActions:y,isInviting:g,globalFilter:u,stopIsInviting:b,onRowSelected:c,setGlobalFilter:m,canRemoveUser:o}},Pe=e=>{let{room:t,...n}=e;const{untouchable:a}=t,{columns:s,data:i,columnVisibility:l,members:o,rowActions:d,bulkActions:c,isInviting:u,stopIsInviting:m,onRowSelected:h,setGlobalFilter:g,canRemoveUser:x}=Fe({untouchable:a});return(0,j.jsx)(M.Ay,{tab:"Room::User",children:(0,j.jsxs)(r.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...n,children:[(0,j.jsxs)(r.H3,{children:["Users in this room (",o.length,")"]}),(0,j.jsx)(r.Table,{enableSelection:!0,enableSorting:!0,columnVisibility:l,data:i,dataColumns:s,rowActions:d,bulkActions:c,onRowSelected:h,onSearch:g,testPrefixCallback:e=>e.name}),u&&(0,j.jsx)(ve,{onClose:m,room:t})]})})},Me={room:0,nodes:1,users:2},$e=(0,o.default)(r.Box).attrs({height:"100%",padding:[4,0],border:{side:"top",color:"border"},flex:"1",overflow:"hidden"}).withConfig({displayName:"manageRoomModal__TabContent",componentId:"sc-lrxs0y-0"})([""]),Le={1:{polling:!0,pollingInterval:1e4},default:{polling:!1}},Re=()=>{const e=(0,a.Zp)(),t=(0,s.vt)(),{roomSlug:n,spaceSlug:l,settingsTab:o}=(0,a.g)(),d=(0,T.J_)(t,n),[c,u]=(0,i.useState)(Le.default);(0,R.A)({spaceId:t,id:d,...c}),(0,N.A)(t,d);const m=(0,h.JT)("room:ReadUsers"),g=(0,T.wz)(d),[x,p]=(0,i.useState)(g.name),{search:b}=(0,a.zy)(),{tab:f="room"}=B.A.parse(b),v=Me[f],[C,y]=(0,i.useState)(v),[w,A,S]=(0,r.useInputValue)({maxChars:255,value:g.description}),I=(0,i.useCallback)(()=>{e((0,a.tW)(D.bq,{spaceSlug:l,settingsTab:o}))},[l,o]),k=(0,T.a8)(g.id,{shouldPersist:!0,onSuccess:I}),F=(0,i.useCallback)(()=>k({name:x,description:w}),[x,w,k]),P=(0,i.useCallback)(e=>{y(e),u(Le[e]||Le.default)},[y,u]);return(0,j.jsxs)(r.Flex,{column:!0,justifyContent:"between",overflow:"hidden","data-testid":"manageRoom",flex:"1",height:"100%",children:[(0,j.jsxs)(r.Tabs,{"data-testid":"manageRoom-tabs",selected:C,onChange:P,TabContent:$e,height:"100%",position:"relative",overflow:"hidden",width:"100%",children:[(0,j.jsx)(r.Tab,{"data-testid":"manageRoom-roomTab",label:(0,j.jsx)(r.H5,{children:"Room"}),children:(0,j.jsx)(L.U,{roomName:x,setRoomName:p,roomDescription:w,setRoomDescription:A,charsDescIndicator:S,"data-testid":"manageRoom-roomTabContent",id:g.id,navigateToParent:I,onSaveClick:F})}),(0,j.jsx)(r.Tab,{"data-testid":"manageRoom-nodesTab",label:(0,j.jsx)(r.H5,{children:"Nodes"}),children:(0,j.jsx)(H,{roomUntouchable:g.untouchable,"data-testid":"manageRoom-nodesTabContent"})}),m&&(0,j.jsx)(r.Tab,{"data-testid":"manageRoom-usersTab",label:(0,j.jsx)(r.H5,{children:"Users"}),children:(0,j.jsx)(Pe,{"data-testid":"manageRoom-usersTabContent",room:g})})]}),C===Me.room&&(0,j.jsx)(r.Flex,{justifyContent:"end"})]})};var Ne=n(61841);const De=e=>{let{children:t}=e;return(0,Ne.TP)(),t},Be=e=>{let{children:t}=e;return(0,T.XA)().loaded?t:null},_e=()=>(0,j.jsxs)(a.BV,{children:[(0,j.jsx)(a.qh,{path:"/",element:(0,j.jsx)($,{})}),(0,j.jsx)(a.qh,{path:":roomSlug",element:(0,j.jsx)(De,{children:(0,j.jsx)(Be,{children:(0,j.jsx)(Re,{})})})})]});var Ve=n(89942),Oe=n(39175),Ee=n(83864),Ue=n(41395),He=n(45087),We=n(74891);const Ye=(0,We.A)(r.Pill),qe={creator:{name:"Creator",tooltip:"The creator of this space"},scim_rule:{name:"SCIM rule",tooltip:"Joined space by SCIM group"},invitation:{name:"Invitation",tooltip:"Joined space by invitation"},default:{name:"Unknown",tooltip:null}},Je=[{id:"name",accessor:"name",header:"Name",cell:e=>{let{getValue:t}=e;return`${t()}`}},{id:"user",accessor:"user",width:300,header:"Users",cell:e=>{let{getValue:t}=e;const{name:n,avatarURL:a,email:s}=t();return(0,j.jsxs)(r.Flex,{alignItems:"center",gap:2,children:[(0,j.jsx)(Q.A,{src:a,title:`${n} - ${s||"email not set"}`}),(0,j.jsx)(r.TextSmall,{children:n})]})}},{id:"email",accessor:"email",header:"Email",width:300,align:"center",cell:e=>{let{getValue:t}=e;return(0,j.jsx)(r.TextSmall,{children:t()})}},{id:"type",accessor:"type",header:"Role",width:100,align:"center",cell:e=>{let{getValue:t,row:{original:{user:{deactivated:n}}}}=e;return(0,j.jsxs)(r.Flex,{alignItems:"center",gap:1,children:[(0,j.jsx)(r.TextSmall,{strong:!0,children:(0,Ue.Zr)(t())}),n&&(0,j.jsx)(He.A,{content:"This user's role doesn't have permission to access any information on the Space. Please review user's role or space's plan.",children:(0,j.jsx)(r.Icon,{name:"warning_triangle",height:"18px",width:"18px",color:["yellow","amber"]})})]})}},{id:"joinMethod",accessor:"joinMethod",header:"Join method",width:100,align:"center",cell:e=>{let{getValue:t}=e;const n=t(),{name:a,tooltip:s}=(0,i.useMemo)(()=>qe[n]||qe.default,[n]);return(0,j.jsx)(Ye,{flavour:"neutral",hollow:!0,tooltip:s,children:(0,j.jsx)(r.TextSmall,{children:a})})}}];n(8872);var Ge=n(77389),ze=n(95201),Ke=n(72884),Ze=n(31035);const Qe=e=>{const t=(0,Ke.t)();return(0,v.yF)((0,i.useCallback)(async function(n,a,s){let{onSuccess:i,onError:l}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=await n((0,K.kd)({id:e,key:"ids"})),r=o.filter(e=>!e.includes(s));a((0,K.kd)({id:e,key:"ids"}),r);try{await(0,Ge.XY)(e,s),(async e=>{let{cacheKeyPrefix:t,memberIds:n,spaceId:a}=e;const s=`${t}${(0,Ze.$)(a)}`;await(0,ze.y)({key:s,handleResults:e=>e.results.filter(e=>!n.includes(e.id))})})({cacheKeyPrefix:t,spaceId:e,memberIds:s}),i&&i()}catch(d){a((0,K.kd)({id:e,key:"ids"}),o),l&&l()}},[e]))},Xe=e=>(0,v.yF)((0,i.useCallback)(async function(t,n,a,s){let{onSuccess:i,onError:l}=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const o=await t((0,Z.Z6)(a)),r=await Promise.all(a.map(async n=>({mId:n,role:await t((0,K.K2)({id:n,spaceId:e}))}))),{role:d,...c}=s;a.forEach(e=>{n((0,Z.m)({id:e}),e=>({...e,...c}))}),d&&a.forEach(t=>{n((0,K.K2)({id:t,spaceId:e}),d)});try{await(async(e,t,n)=>Promise.all(t.map(async t=>await(0,Ge.w5)(e,t,n))))(e,a,s),i&&i()}catch(u){o.forEach(e=>{let{id:t,...a}=e;return n((0,Z.m)({id:t}),{id:t,...a})}),d&&r.forEach(t=>{let{mId:a,role:s}=t;return n((0,K.K2)({id:a,spaceId:e}),s)}),l&&l()}},[e])),et="change-user-role",tt="changeUserRole",nt=e=>{let{handleAction:t,ids:n,onClose:a}=e;const s=(0,K.$D)(n),l=1===s.length?s[0]:null,o=(0,h._s)(),[d,c]=(0,i.useState)(l);return(0,j.jsx)(r.ConfirmationDialog,{confirmLabel:"Save","data-ga":et,"data-testid":tt,handleConfirm:()=>{t(d),a()},handleDecline:a,isConfirmDisabled:!d,isConfirmPositive:!0,message:(0,j.jsxs)(r.Flex,{gap:2,column:!0,children:[(0,j.jsxs)(r.TextSmall,{children:["Learn more about Netdata role-based access model on"," ",(0,j.jsx)(he.A,{href:ge.S0,target:"_blank",rel:"noopener noreferrer",Component:r.TextSmall,children:"our documentation"})]}),(0,j.jsx)(me.A,{availableRoles:o,dataGA:et,dataTestId:tt,onChange:e=>{c(e.target.value)},value:d})]}),title:"Change roles"})},at=[{id:"id",accessor:"id"},{id:"name",accessor:"name",header:"Room"}];var st=n(55093);const it=e=>{let{loaded:t,rooms:n,error:a,setRoomIds:s}=e;const l=(0,i.useCallback)(e=>{const t=Object.entries(e).reduce((e,t)=>{let[n,a]=t;return[...e,...a?[n]:[]]},[]);s(t)},[s]),o=(0,i.useMemo)(()=>t?n.reduce((e,t)=>({...e,[t.id]:t.isMember}),{}):{},[t,n]);return(0,i.useEffect)(()=>{if(t&&!a){const e=n.reduce((e,t)=>[...e,...t.isMember?[t.id]:[]],[]);s(e)}},[t,n,a,s]),t?a?(0,j.jsx)(r.Flex,{alignItems:"center",justifyContent:"center",height:"200px",children:(0,j.jsx)(r.TextSmall,{children:a})}):(0,j.jsxs)(r.Flex,{column:!0,gap:2,height:{max:"300px"},children:[(0,j.jsx)(r.TextSmall,{children:"Select the rooms that user will be member of. Note that user will be removed from any room that is not selected."}),(0,j.jsx)(r.Table,{data:n,dataColumns:at,columnVisibility:{id:!1},enableSorting:!0,enableSelection:!0,rowSelection:o,getRowId:e=>{let{id:t}=e;return t},onRowSelectionChange:l})]}):(0,j.jsx)(st.A,{background:"dropdown",title:"Loading rooms...",height:"200px"})};var lt=n(35800),ot=n(32052);const rt=e=>{let{memberId:t}=e;const n=(0,s.vt)(),[,a]=(0,Z.ZN)({memberId:t}),l=(0,i.useCallback)(e=>{a(t=>({...t,loaded:!0,value:e}))},[a]),o=(0,i.useCallback)(e=>{a({...lt.yW,loaded:!0,error:e?.message||"Something went wrong"})},[a]);(0,ot.A)(()=>({enabled:!!t,fetch:()=>(0,Ge.Hw)(n,t),onSuccess:l,onFail:o}),[n,t])};var dt=n(30811);const ct=e=>{let{data:t,onClose:n}=e;const[a,s]=(0,i.useState)([]),l=t?.user?.id,[o,d]=(0,ue.A)(),c=(0,dt.l)();rt({memberId:l});const[u]=(0,Z.ZN)({memberId:l}),{loaded:m,value:h,error:g}=u,{rooms:x=[]}=h,p=(0,Z.Vj)({memberId:l}),b=(0,i.useCallback)(()=>{o({header:"Success",text:"Successfully updated user's rooms"}),c(),p()},[o,p,c]),f=(0,Z.Pb)({memberId:l,onSuccess:b,onError:()=>d}),v=(0,i.useCallback)(()=>{f(a)},[a,f]);return(0,j.jsx)(r.ConfirmationDialog,{confirmLabel:"Assign","data-testid":"user-rooms-assignment-dialog",handleConfirm:v,handleDecline:n,iconName:"space_new",isConfirmPositive:!0,message:(0,j.jsx)(it,{loaded:m,rooms:x,error:g,setRoomIds:s}),title:"Assign rooms"})},ut=e=>{let{spaceId:t,startIsInviting:n}=e;const a=Qe(t),s=Xe(t),l=(0,h.JT)("space:InviteUser"),o=(0,dt.l)(),r=(0,i.useCallback)(e=>{let{role:t,members:n}=e;s(n,{role:t},{onSuccess:o})},[]),d=e=>t=>{if(!e)return;const n=Array.isArray(e)?e.map(e=>{let{user:t}=e;return t.id}):[e?.user.id];r({role:t,members:n})},c=(0,i.useCallback)(()=>{},[]),u=(e,t)=>{if(!e)return;const n=Array.isArray(e)?e.map(e=>{let{user:t}=e;return t.id}):[e?.user.id];a(n,{onSuccess:()=>t.toggleAllRowsSelected(!1)})},m=(0,i.useCallback)(e=>(0,j.jsxs)(j.Fragment,{children:["Are you sure you want remove ",(0,j.jsx)("strong",{children:e.name})," from this space?"]}),[]),g=(0,i.useCallback)((e,t)=>{const n=t.length;return n?1===n?"Delete User":"Delete Users":""},[]),x=(0,i.useCallback)((e,t)=>{const n=t.length;return n?(0,j.jsxs)(j.Fragment,{children:["Are you sure you want remove"," ",(0,j.jsx)("strong",{children:1===n?t[0].name:`${t.length} users`})," ","from this space?"]}):""},[]);return{rowActions:(0,i.useMemo)(()=>({userSettings:{CustomUIAction:e=>{let{data:t,...n}=e;return(0,j.jsx)(nt,{ids:[t.user.id],...n})},handleAction:d,tooltipText:"Change Role",isDisabled:e=>e.disabled,disabledTooltipText:e=>e.isSelf?"You cannot change your role":"You don't have the required permissions to change roles for users"},roomAsignment:{CustomUIAction:ct,handleAction:c,icon:"space_new",tooltipText:"Assign rooms to user",isDisabled:e=>e.disabled,disabledTooltipText:"You cannot assign rooms to this user"},delete:{handleAction:u,confirmationTitle:"Delete User",confirmationMessage:m,isDisabled:e=>e.disabled,disabledTooltipText:e=>e.isSelf?"You cannot delete yourself. Try the space info tab, to leave space.":"You don't have the required permissions to remove users from space"}}),[]),bulkActions:(0,i.useMemo)(()=>({addEntry:{handleAction:n,tooltipText:"Invite user",isDisabled:()=>!l,disabledTooltipText:"You don't have the required permissions to invite new users","data-onboarding-id":"invite-user-button"},userSettings:{CustomUIAction:e=>{let{data:t,...n}=e;return(0,j.jsx)(nt,{ids:t.map(e=>{let{user:t}=e;return t.id}),...n})},handleAction:d,tooltipText:"Change Roles",disabledTooltipText:e=>e?.length?"You don't have the required permissions to change roles for users":"You haven't selected any users"},delete:{handleAction:u,confirmationTitle:g,confirmationMessage:x,disabledTooltipText:e=>e?.length?"You don't have the required permissions to remove users from space":"You haven't selected any users"}}),[l,g,x])}},mt=()=>{const e=(0,s.vt)(),t=(0,s.ns)(e,"name"),n=(0,K.bj)(),a=(0,ye.uW)("id"),[l,,o,r]=(0,x.A)(),[d,c]=(0,i.useState)(""),[u,m]=(0,i.useState)([]),{rowActions:g,bulkActions:p}=ut({selectedRows:u,spaceId:e,startIsInviting:o}),b=(0,h.JT)("space:RemoveUser"),j=(0,h.JT)("user:ChangeRoles"),f=(0,h.Ge)(),v=b||j,C=(0,i.useMemo)(()=>(e=>{let{fromRolePermissions:t,userList:n,canModifyUser:a,currentUserId:s}=e;return n.reduce((e,n)=>{const i=s===n?.id,l=t.includes(n.role);return e.push({name:n.name,email:n.email,user:{avatarURL:n.avatarURL,deactivated:n.deactivated,name:n.name,email:n.email,id:n.id},joinMethod:n.joinMethod,type:n.role,disabled:!l||!a||i,isSelf:i,canModifyUser:a,canSetRole:l}),e},[])})({userList:n,currentUserId:a,canModifyUser:v,fromRolePermissions:f}),[n]);return{columns:Je,spaceName:t,members:n,currentUserId:a,data:C,isInviting:l,globalFilter:d,rowActions:g,bulkActions:p,columnVisibility:{name:!1},onRowSelected:m,setGlobalFilter:c,startIsInviting:o,stopIsInviting:r,canModifyUser:v}},ht=e=>{const{columns:t,data:n,isInviting:a,rowActions:s,bulkActions:i,columnVisibility:l,stopIsInviting:o,setGlobalFilter:d,onRowSelected:c}=mt();return(0,j.jsxs)(M.Ay,{tab:"Users",children:[(0,j.jsxs)(r.Flex,{column:!0,height:"100%",overflow:"hidden",flex:"grow",padding:[2,4,0,4],...e,children:[(0,j.jsxs)(r.TextBig,{margin:[1,0,3],children:["Learn more about Netdata role-based access model on"," ",(0,j.jsx)(he.A,{href:ge.S0,target:"_blank",rel:"noopener noreferrer",Component:r.TextBig,children:"our documentation"})]}),(0,j.jsx)(r.Table,{onSearch:d,data:n,dataColumns:t,enableSorting:!0,enableSelection:!0,onRowSelected:c,bulkActions:i,rowActions:s,columnVisibility:l,testPrefixCallback:e=>e.name})]}),a&&(0,j.jsx)(Ee.d,{onClose:o,isSubmodal:!0})]})},gt=(0,l.A)(()=>n.e(9883).then(n.bind(n,49883)),"ManageAuth"),xt=(0,l.A)(()=>n.e(2248).then(n.bind(n,52248)),"ManageScimGroups"),pt={side:"top",type:"solid",size:"1px",color:"border"},bt=e=>{const t=(0,s.ap)("id"),n=(0,Oe.ES)(t),{userManagementActiveTab:a=0}=(0,Ve.PP)(),l=(0,i.useCallback)(e=>{const t=(0,Ve.PP)();(0,Ve.Z8)({...t,userManagementActiveTab:e})},[]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Flex,{padding:[0,0,0,4],...e,children:(0,j.jsx)(r.H3,{children:"User Management"})}),(0,j.jsxs)(r.Tabs,{selected:parseInt(a,10),onChange:l,height:"calc(100% - 110px)",margin:[4,0,0,0],children:[(0,j.jsx)(r.Tab,{"data-testid":"spaceSettings-user-management-users-tab",label:(0,j.jsx)(r.Text,{children:"Users"}),children:(0,j.jsx)(ht,{border:pt})}),n?null:(0,j.jsx)(r.Tab,{"data-testid":"spaceSettings-user-management-aaa-tab",label:(0,j.jsx)(r.Text,{children:"Authentication & Authorization"}),children:(0,j.jsx)(i.Suspense,{fallback:"",children:(0,j.jsx)(gt,{border:pt})})}),n?null:(0,j.jsx)(r.Tab,{"data-testid":"spaceSettings-user-management-scim-groups-tab",label:(0,j.jsx)(r.Text,{children:"Groups"}),children:(0,j.jsx)(i.Suspense,{fallback:"",children:(0,j.jsx)(xt,{border:pt})})})]})]})};var jt=n(55429),ft=n(28688),vt=n(51262);const Ct=(0,i.memo)(e=>{const t=(0,s.vt)(),n=(0,s.ap)("name"),{nodeIds:a,nodes:l}=(0,ft.A)(),{preferredNodes:o}=(0,vt.A)(),[d,c]=(0,i.useState)([]),[u,,m,h]=(0,x.A)();return(0,jt.A)(t),(0,i.useEffect)(()=>{a.length&&c(o.filter(e=>a.includes(e)))},[a,o]),(0,j.jsx)(M.Ay,{tab:"Nodes",children:(0,j.jsxs)(r.Flex,{column:!0,"data-testid":"manageClaimedNodes",height:"100%",overflow:"hidden",gap:3,...e,children:[(0,j.jsx)(r.H3,{"data-testid":"manageClaimedNodes-header",children:`Connect Nodes to ${n}`}),(0,j.jsx)(E.A,{showClaimNodeOnEmptySpace:!0,showClaimModalWithRoomSelection:!0,enableSelection:!0,customNodes:l,isSpace:!0,tempPreferredNodes:d,setTempPreferredNodes:c,loading:u,startLoading:m,stopLoading:h})]})})}),yt=Ct;var wt=n(3458),Tt=n(76571),At=n(49635);const St=e=>{let{name:t,spaceName:n}=e;return(0,j.jsxs)(j.Fragment,{children:["You are about to delete ",(0,j.jsx)("strong",{children:t})," channel from ",(0,j.jsx)("strong",{children:n})," space.",(0,j.jsx)("br",{}),"This cannot be undone. Are you sure you want to continue?"]})};var It=n(52838),kt=(n(37550),n(98563));const Ft=e=>{let{integration:t={},testId:n,...a}=e;const s=a.checked?"disable":"enable";return(0,j.jsx)(r.Toggle,{colored:!0,"data-testid":`${n}-toggle`,"data-ga":`manage-channels::toggle-${t.slug}-${s}::notifications-tab`,...a})},Pt=e=>{let{testId:t,tooltipContent:n="plan",...a}=e;return a.disabled?(0,j.jsx)(He.A,{align:"top",content:At.r7[n],"data-testid":`${t}-warning`,plain:!0,children:(0,j.jsxs)(r.Flex,{padding:[2,2,0,0],position:"relative",children:[(0,j.jsx)(kt.id,{"data-testid":`${t}-warningIcon`}),(0,j.jsx)(Ft,{testId:t,...a})]})}):(0,j.jsx)(Ft,{testId:t,...a})},Mt=e=>{let{"data-testid":t="cellName",enabled:n,id:a,integration:s,isAvailable:i,name:l,spaceId:o,tooltipContent:d,...c}=e;const u=(0,Tt.t5)(o,"channels"),m=(0,Tt.vq)(o,"channels");return(0,j.jsxs)(r.Flex,{alignItems:"center","data-testid":t,gap:4,...c,children:[(0,j.jsx)(Pt,{checked:n,disabled:!i,integration:s,onChange:e=>{let{target:t}=e;const n=t.checked;m(u.map(e=>e.id===a?{...e,enabled:n}:e)),(0,wt.Jq)(o,a,n)},testId:t,tooltipContent:d}),(0,j.jsx)(r.Text,{"data-testid":`${t}-label`,children:l})]})},$t=e=>{let{"data-testid":t="cellService",integration:n={},kindLabel:a,...s}=e;const i=At.a$[n.slug]||{};return(0,j.jsxs)(r.Flex,{alignItems:"center","data-testid":t,gap:2,justifyContent:"between",width:"100%",...s,children:[(0,j.jsxs)(r.Flex,{alignItems:"center","data-testid":`${t}-integration`,gap:2,children:[(0,j.jsx)(r.Icon,{"data-testid":`${t}-icon`,...i}),(0,j.jsx)(r.Text,{"data-testid":`${t}-label`,children:n.title})]}),(0,j.jsx)(He.A,{content:a,"data-testid":`${t}-kind`,plain:!0,children:(0,j.jsx)(r.Icon,{color:"textLite",height:"16px",name:At.HA[n.kind]?.icon,width:"16px"})})]})};var Lt=n(15679);const Rt=e=>{let{getValue:t}=e;const n=(t()||[]).map(e=>(0,Ue.Zr)(e.toLowerCase()));return n?.length?(0,j.jsx)(r.Flex,{"data-testid":"channelNotificationsCell",flexWrap:!0,gap:1,children:n.map(e=>(0,j.jsx)(r.Flex,{padding:[.5,0],children:(0,j.jsx)(Lt.A,{noTooltip:!0,value:e})},e))}):(0,j.jsx)(r.Text,{children:"*"})},Nt=e=>{let{canManageChannels:t,roomOptions:n,notificationOptions:a,spaceId:s}=e;return[{accessor:"name",cell:e=>{let{getValue:n,row:a}=e;return(0,j.jsx)(Mt,{enabled:a.original.enabled,id:a.original.id,integration:a.original.integration,isAvailable:t&&a.original.available,name:n(),spaceId:s,tooltipContent:t?"plan":"role"})},header:"Name",id:"name"},{accessor:"integration",cell:e=>{let{getValue:t,row:n}=e;return(0,j.jsx)($t,{integration:t(),kindLabel:n.original.kindLabel})},enableColumnFilter:!0,filterFn:(e,t,n)=>{const a=e.original.integration;return n.length<1||n.some(e=>{let{value:t}=e;return""===t||t===a?.slug})},header:"Service",id:"integration",meta:{filter:{component:"select",isMulti:!0,options:Object.keys(At.a$).map(e=>({label:e,value:e})),tiny:!0,"data-ga":"manage-integrations::select-service::notification-integrations-tab"},tooltip:(0,j.jsxs)(r.Flex,{column:!0,width:{max:"200px"},gap:2,children:[(0,j.jsx)(r.TextMicro,{children:"Services are distinguished in two categories."}),(0,j.jsxs)(r.TextMicro,{children:[(0,j.jsx)(kt.Jg,{name:At.HA.PERSONAL.icon})," ",(0,j.jsx)(r.TextMicro,{strong:!0,children:"Personal:"})," ",At.HA.PERSONAL.tooltip]}),(0,j.jsxs)(r.TextMicro,{children:[(0,j.jsx)(kt.Jg,{name:At.HA.SYSTEM.icon})," ",(0,j.jsx)(r.TextMicro,{strong:!0,children:"System:"})," ",At.HA.SYSTEM.tooltip]})]})}},{accessor:"notificationOptions",cell:Rt,enableColumnFilter:!0,filterFn:(e,t,n)=>n.length<1||n.some(t=>{let{label:n,value:a}=t;if(e.original.internal)return n===At.Oh.label;return e.original.notificationOptions.includes(a)}),header:"Notifications",id:"notificationOptions",meta:{filter:{component:"select",isMulti:!0,options:[...a,At.Oh],tiny:!0,"data-ga":"manage-integrations::select-notification::notification-integrations-tab"}}},{accessor:"rooms",cell:e=>{let{getValue:t,row:a}=e;const s={"data-testid":"channelRoomsCell"};if(a.original.internal)return(0,j.jsx)(r.Text,{...s,children:At.Oh.label});if(!a.original.rooms&&!a.original.rooms?.length)return(0,j.jsx)(r.Text,{...s,children:At.PT.label});const i=(0,It.Pl)({roomIds:t(),roomOptions:n});return(0,j.jsx)(r.Text,{"data-testid":"channelRoomsCell",children:i})},enableColumnFilter:!0,filterFn:(e,t,n)=>n.length<1||n.some(t=>{let{label:n,value:a}=t;if(e.original.internal)return n===At.Oh.label;const s=e.original.rooms||[];return s.length?s.includes(a):n===At.PT.label}),header:"Rooms",id:"rooms",meta:{filter:{component:"select",isMulti:!0,options:n,tiny:!0,"data-ga":"manage-integrations::select-room::notification-integrations-tab"}}}]};var Dt=n(42340),Bt=n(81391);const _t=(e,t)=>{const n=(0,Tt.ef)(t),a=(0,Bt.A)({all:!0});(0,ot.A)(()=>({enabled:!!t,fetch:()=>(0,wt.t9)(e,t),onFail:e=>n({...Dt.V,error:e.message}),onSettle:()=>n({loading:!1,loaded:!0}),onSuccess:e=>n({...Dt.V,...e.rooms?{roomSelections:a.filter(t=>{let{value:n}=t;return e.rooms.includes(n)})}:{},...e})}),[e,t])};var Vt=n(41258),Ot=n(71819);const Et=["MobileApp","Email"],Ut=()=>{const e=(0,a.Zp)(),t=(0,h.JT)("channel:Manage"),n=(0,s.vt)(),l=(0,s.ap)("name"),o=(0,s.bq)(),[r,d]=(0,ue.A)(),[c,u]=(0,i.useState)(""),m=(0,Tt.bY)();(0,Vt.A)(n);const g=(0,Tt.t5)(n,"channels"),x=(0,Tt.t5)(n,"currentChannelId"),p=(0,Tt.vq)(n,"channels"),b=(0,Tt.vq)(n,"currentChannelId"),f=(0,Bt.A)({all:!0,internal:!0}),v=(0,Ot.A)(),{alerts:C,name:y,rooms:w,secrets:T}=(0,Tt.g4)(x);_t(n,x);const A=(0,i.useCallback)(e=>{b(e)},[]),S=(0,i.useCallback)(async e=>{let{id:t}=e;try{await(0,wt.Wb)(n,t),p(g.filter(e=>e.id!==t)),r({header:"Configuration deleted successfully!"})}catch(a){d(a)}},[g,n]),I=(0,i.useCallback)(()=>{e((0,a.tW)(D.uX,{spaceSlug:o,settingsTab:D.A8,settingsSubTab:D.G0}))},[o]),k=(0,i.useMemo)(()=>({addEntry:{dataGa:"manage-channels::click-add-channel::notifications-tab",flavour:"hollow",handleAction:I,iconColor:"success",label:t?"Add Configuration":"View configurations",small:!0,strong:!0,width:"auto",...t?{}:{icon:""}}}),[t,I]),F=(0,i.useCallback)(e=>{e&&m({id:e})},[m]),P=(0,i.useMemo)(()=>({testNotification:{handleAction:e=>{let{id:t}=e;F(t)},icon:"notificationTrigger",confirmation:!1,tooltipText:"Test your notification settings",disabledTooltipText:"You cannot test this notification",isDisabled:e=>{let{slug:t}=e;return Et.includes(t)}},edit:{dataGa:e=>{let{integration:t={}}=e;return`manage-rooms::click-edit::${t.slug}`},disabledTooltipText:"Edit is disabled",handleAction:e=>{let{id:t}=e;A(t)},isDisabled:e=>{let{available:n,internal:a}=e;return!t||!n||a},TooltipComponent:He.A,tooltipText:"Edit setting"},delete:{confirmLabel:"Yes, delete",confirmationMessage:e=>{let{integration:t={}}=e;return(0,j.jsx)(St,{name:t.name,spaceName:l})},confirmationTitle:e=>{let{name:t}=e;return(0,It.O5)(t)},dataGa:e=>{let{integration:t={}}=e;return`manage-rooms::click-delete::${t.slug}`},declineLabel:"Cancel",handleAction:S,isDisabled:e=>{let{integration:n={}}=e;return!t||n.internal},TooltipComponent:He.A,tooltipText:"Delete setting"}}),[t,S,I]),M=(0,i.useMemo)(()=>Nt({canManageChannels:t,roomOptions:f,notificationOptions:v,spaceId:n}),[t,f,v,n]);return{bulkActions:k,channelData:g,currentChannelId:x,columns:M,dataGa:"manage-channels",onFilter:(e,t,n)=>{const a=e.original,s=n.toLowerCase();if(a.name?.toLowerCase()?.includes(s))return!0;if(a.integration?.slug?.toLowerCase()?.includes(s))return!0;if(a.notificationLabel?.toLowerCase()?.includes(s))return!0;if(a.internal)return At.Oh.label?.toLowerCase()?.includes(s);const i=a.rooms||[];if(!i.length)return At.PT.label?.toLowerCase()?.includes(s);return(0,It.Pl)({roomIds:i,roomOptions:f}).toLowerCase().includes(s)},onModalClose:()=>{p(g.map(e=>e.id===x?{...e,alerts:C,name:y,rooms:w,secrets:T}:e)),b("")},rowActions:P,search:c,setSearch:u}};n(23215);var Ht=n(10444),Wt=n(80320),Yt=n(95263),qt=n(64903);const Jt={hours:0,minutes:30},Gt=e=>{let{title:t,value:n,onChange:a}=e;const s=(0,i.useMemo)(()=>{const e=60*parseInt(n,10);return isNaN(e)?null:60*parseInt(n,10)},[n]),l=(0,i.useCallback)(e=>{a(e/60)},[a]);return(0,j.jsxs)(r.Flex,{column:!0,gap:1,children:[(0,j.jsx)(Yt.A,{title:t,description:"Set the desired redelivery time interval for notification to be repeated (From 30 minutes up to 24 hours)."}),(0,j.jsx)(qt.A,{testId:"notifications-repeat-interval",value:s,onChange:l,applyOnChange:!0,minValues:Jt,hideSeconds:!0})]})},zt=(0,ne.A)((0,We.A)(r.Button)),Kt="modal",Zt=e=>{let{id:t="new",integrationId:n,onClose:l,isSubmitEnabled:o,isTestEnabled:r,hasValidVerificationToken:d}=e;const{notificationOptions:c,name:u,repeatNotificationMin:m,rooms:h,slug:g,integration:x,secrets:p,verificationToken:b}=(0,Tt.g4)(t),f=(0,dt.l)(),v=(0,a.Zp)(),[C,y]=(0,ue.A)(),w=(0,s.vt)(),T=(0,s.bq)(),A=(0,Tt.bY)(),S=(0,i.useCallback)(()=>{(g||x)&&A({slug:g||x,secrets:p})},[g,p,A]),I=(0,a.tW)(D.bq,{spaceSlug:T,settingsTab:D.A8}),k=parseInt(m,10),F=(0,i.useCallback)(async()=>{try{const e={notification_options:c,integrationID:n,...u?{name:u}:{},...h?.length?{Rooms:h}:{},...k>0?{repeat_notification_min:k}:{},...b?{verification_token:b}:{},secrets:p};"new"===t?await(0,wt.Qb)(w,e):await(0,wt.eQ)(w,t,e),C({header:"new"===t?"Configuration created successfully!":"Configuration updated successfully!"}),f(),l(),v(I)}catch(e){y(e)}},[c,n,u,b,h,k,p,C,f,l,v,y]);return(0,j.jsxs)(kt.fn,{column:!1,gap:2,"data-testid":`${Kt}-footer`,justifyContent:"end",children:[(0,j.jsx)(zt,{feature:"IntegrationNotification",payload:{integrationId:n,integration:x,action:"test"},label:"Test",flavour:"hollow",onClick:S,disabled:!r,tooltipProps:{content:"Test your notification settings",align:"bottom"}}),(0,j.jsx)(zt,{feature:"IntegrationNotification",payload:{integrationId:n,integration:x,action:"new"===t?"create":"update"},"data-testid":`${Kt}-confirmButton`,disabled:!o,label:"Submit",onClick:F,tooltip:d?"Save your settings":"Verification token is required to verify access to the provided endpoint",tooltipProps:{align:"bottom"}})]})},Qt="modal",Xt=e=>{let{id:t="new",integrationId:n,settings:a,onClose:s,...l}=e;const{notificationOptions:o,title:d,description:c,docsLink:u,fields:m,integration:h,loaded:x,name:p,verificationToken:b,required:f,roomSelections:v,repeatNotificationMin:C,secrets:y,error:w,settings:T}=(0,Tt.g4)(t),A=(0,Ht.J)(),S=e=>`manage-${h}-channel::${e}::notification-${n?"integrations":"channels"}-tab`,I=(0,Bt.A)({all:!0}),k=(0,g.DL)(),F=(0,Tt.ef)(t,"notificationOptions"),P=(0,Tt.ef)(t,"name"),M=(0,Tt.ef)(t,"verificationToken"),$=(0,Tt.ef)(t,"roomSelections"),L=(0,Tt.ef)(t,"secrets"),R=(0,Tt.ef)(t,"rooms"),N=(0,Tt.ef)(t,"repeatNotificationMin"),[D,B]=(0,i.useState)({}),_=(0,Ot.A)(),V=(0,i.useMemo)(()=>o?_.filter(e=>o.includes(e.value)):[],[_,o]),O=(0,i.useMemo)(()=>Object.keys(D),[D]),E=(0,i.useMemo)(()=>f.every(e=>(0,It.ct)(e,y[e],m[e])),[f,y,m]),U=a||T,{tokenRequired:H}=U||{},W=(0,i.useMemo)(()=>!O.length||O.every(e=>{const t=y[e].selection;return D[e].every(n=>(0,It.ct)(n,y[e][n],m[e].fields[t][n]))}),[O,y,m,D]),Y=(0,i.useMemo)(()=>E&&W&&!!o?.length,[E,W,o?.length]),q=!H||!!b,J=(0,i.useMemo)(()=>!!Y&&!(H&&!b),[Y,H,b]),G=(0,i.useCallback)(e=>{F(e.map(e=>{let{value:t}=e;return t}))},[F]),z=(0,i.useCallback)(e=>{if(1===k.length)return;if(0===e.length)return R([]),void $([]);if(e.length===k.length||!e[e.length-1]?.value)return R([]),void $([At.PT]);const t=e.map(e=>{let{value:t}=e;return t}).filter(Boolean),n=e.length>1?e.filter(e=>e.value):e;R(t),$(n)},[k,R,$]);return x?(0,j.jsx)(r.Modal,{backdropProps:{backdropBlur:!0},onEsc:s,children:(0,j.jsxs)(kt.$m,{width:{max:A?"90vw":"500px"},height:{max:"95vh"},"data-testid":l["data-testid"]||Qt,...w?{height:"auto"}:{},children:[(0,j.jsx)(r.ModalHeader,{column:!0,"data-testid":`${Qt}-header`,gap:2,padding:[4],children:w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.H4,{children:"Error"}),s&&(0,j.jsx)(kt.Oj,{"data-ga":S("close-modal"),"data-testid":`${Qt}-close`,onClose:s})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(r.Flex,{alignItems:"center","data-testid":`${Qt}-headerMain`,children:[(0,j.jsxs)(r.Flex,{alignItems:"center",gap:2,"data-testid":`${Qt}-titleContainer`,children:[(0,j.jsx)(r.Icon,{"data-testid":`${Qt}-titleIcon`,...At.a$[h]||{}}),(0,j.jsx)(r.H4,{"data-testid":`${Qt}-title`,children:d})]}),s&&(0,j.jsx)(kt.Oj,{"data-ga":S("close-modal"),"data-testid":`${Qt}-close`,onClose:s})]}),(0,j.jsxs)(r.Text,{as:r.Box,color:"menuItem","data-testid":`${Qt}-description`,children:[c,"\xa0",(0,j.jsx)(he.A,{Component:r.Text,"data-ga":S("click-docs"),"data-testid":`${Qt}-docsLink`,href:u,target:"_blank",whiteSpace:"nowrap",children:"Learn how to configure it."})]})]})}),w?(0,j.jsx)(r.ModalBody,{alignItems:"center",justifyContent:"center",height:"180px",children:(0,j.jsx)(r.TextBig,{children:"string"===typeof w?w:"An error occurred"})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(r.ModalBody,{"data-testid":`${Qt}-body`,overflow:{vertical:"auto"},padding:[0],children:[(0,j.jsxs)(kt.fn,{gap:2,"data-testid":`${Qt}-standardFields`,hasBorder:!0,children:[(0,j.jsx)(r.Text,{"data-testid":`${Qt}-standardFields-header`,children:"Notification settings"}),(0,j.jsxs)(r.Flex,{column:!0,"data-testid":`${Qt}-standardFields-body`,gap:3,children:[(0,j.jsx)(Wt.A,{component:"input","data-ga":S("configuration-name-input"),"data-testid":`${Qt}-configurationName`,onChange:P,placeholder:"i.e All alerts from All nodes",title:"Configuration name",value:p}),(0,j.jsx)(Wt.A,{component:"select","data-ga":S("rooms-select"),"data-testid":`${Qt}-rooms`,isMulti:!0,closeMenuOnSelect:!1,onChange:z,options:I,placeholder:"Select rooms",title:"Rooms",value:v}),(0,j.jsx)(Wt.A,{component:"select","data-ga":S("notification-select"),"data-testid":`${Qt}-notifications`,isRequired:!0,isMulti:!0,closeMenuOnSelect:!1,onChange:G,options:_,placeholder:"Select notifications",title:"Notifications",value:V}),(0,j.jsx)(Gt,{title:"Notifications repeat",value:C,onChange:N})]})]}),(0,j.jsxs)(kt.fn,{gap:2,"data-testid":`${Qt}-dynamicFields`,hasBorder:!0,children:[(0,j.jsx)(r.Text,{"data-testid":`${Qt}-dynamicFields-header`,children:"Integration configuration"}),(0,j.jsx)(r.Flex,{column:!0,"data-testid":`${Qt}-dynamicFields-body`,gap:3,children:Object.values(m).map(e=>{let{id:t,getValue:n,onChange:a,...s}=e;return(0,j.jsx)(Wt.A,{"data-ga":S(`${t}-${s.component}`),"data-testid":`${Qt}-${t}`,getDataGa:S,id:t,onChange:a?.({id:t,setRequiredSubsets:B,setSecrets:L}),secrets:y,setSecrets:L,value:n?.({id:t,secrets:y}),...s},t)})})]}),H?(0,j.jsxs)(kt.fn,{gap:2,"data-testid":`${Qt}-verificationFields`,hasBorder:!0,children:[(0,j.jsx)(r.Text,{"data-testid":`${Qt}-standardFields-header`,children:"Verification"}),(0,j.jsxs)(r.Flex,{alignItems:"center",gap:2,children:[(0,j.jsx)(r.Flex,{width:"24px",children:(0,j.jsx)(r.Icon,{name:"warning_triangle",size:"small",color:"warning"})}),(0,j.jsx)(r.Text,{color:"menuItem",children:"Obtain a verification token to confirm access to the specified endpoint. Click Test, and the token will be sent to the provided endpoint."})]}),(0,j.jsx)(r.Flex,{column:!0,"data-testid":`${Qt}-verificationFields-body`,gap:3,children:(0,j.jsx)(Wt.A,{component:"input","data-ga":S("configuration-token-input"),"data-testid":`${Qt}-configurationToken`,onChange:M,placeholder:"Enter the token from the latest test notification sent to your webhook endpoint.",title:"Token",value:b||""})})]}):null]}),(0,j.jsx)(Zt,{id:t,integrationId:n,onClose:s,isSubmitEnabled:J,isTestEnabled:Y,hasValidVerificationToken:q})]})]})}):null},en=e=>{let{"data-testid":t="channelList",...n}=e;const{bulkActions:a,channelData:s,currentChannelId:i,columns:l,dataGa:o,onFilter:d,onModalClose:c,rowActions:u,search:m,setSearch:h}=Ut();return(0,j.jsx)(M.Ay,{tab:"Notifications::Channels",children:(0,j.jsxs)(r.Flex,{column:!0,"data-testid":t,gap:4,width:"100%",height:"100%",overflow:"hidden",padding:[2,4],flex:"1",...n,children:[(0,j.jsx)(r.Table,{bulkActions:a,data:s,dataColumns:l,dataGa:o,globalFilter:m,globalFilterFn:d,onSearch:h,rowActions:u,testPrefix:"channelList",testPrefixCallback:e=>e.name}),!!i&&(0,j.jsx)(Xt,{"data-testid":"editChannelModal",id:i,onClose:c})]})})},tn=0,nn=(0,l.A)(()=>n.e(9961).then(n.bind(n,19961)),"SilencingRules"),an=(0,l.A)(()=>n.e(2948).then(n.bind(n,22948)),"Reachability"),sn=()=>{const{notificationsActiveTab:e=tn}=(0,Ve.PP)(),t=(0,i.useCallback)(e=>{const t=(0,Ve.PP)();(0,Ve.Z8)({...t,notificationsActiveTab:e})},[]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Flex,{padding:[0,0,4,4],children:(0,j.jsx)(r.H3,{children:"Alerts & Notifications"})}),(0,j.jsxs)(r.Tabs,{selected:parseInt(e,10),onChange:t,height:"100%",overflow:"hidden",children:[(0,j.jsx)(r.Tab,{"data-testid":"spaceSettings-notifications-methods-tab","data-ga":"manage-space::click-tab::notifications-methods-tab",label:(0,j.jsx)(r.Text,{children:"Notification Methods"}),children:(0,j.jsx)(en,{})}),(0,j.jsx)(r.Tab,{"data-testid":"spaceSettings-notifications-silencing-rules-tab","data-ga":"manage-space::click-tab::notifications-silencing-rules-tab",label:(0,j.jsx)(r.Text,{children:"Silencing Rules"}),children:(0,j.jsx)(i.Suspense,{children:(0,j.jsx)(nn,{})})}),(0,j.jsx)(r.Tab,{"data-testid":"spaceSettings-reachability-notifications-tab","data-ga":"manage-space::click-tab::reachability-notifications-tab",label:(0,j.jsx)(r.Text,{children:"Reachability"}),children:(0,j.jsx)(i.Suspense,{children:(0,j.jsx)(an,{})})})]})]})};var ln=n(93926),on=n(39651);const rn=(0,We.A)(r.Button),dn=(0,We.A)(r.Flex),cn=e=>{let{available:t,"data-testid":n="card",description:a,docsLink:s,fields:l,id:o,internal:d,kind:c,kindLabel:u,slug:m,required:g,title:p,settings:b,...f}=e;const v=At.a$[m]||{},C=(0,Tt.Mw)("new"),y=(0,Tt.ef)("new"),w=(0,h.JT)("channel:Manage"),[T,,A,S]=(0,x.A)(!1),I=(0,i.useCallback)(()=>{y({...Dt.V,title:p,description:a,docsLink:s,fields:l,integration:m,loading:!1,loaded:!0,required:g,secrets:(0,It.s7)(l,g)}),A()},[a,s,l,m,g]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(r.Flex,{background:"elementBackground",column:!0,"data-testid":n,justifyContent:"between",flex:!1,height:37,padding:[3,2,2,3],margin:[0,0,4,0],position:"relative",overflow:"hidden",round:.5,width:75,...f,children:[(0,j.jsx)(kt.MU,{"data-testid":`${n}-blurredIcon`,...v}),(0,j.jsxs)(r.Flex,{column:!0,"data-testid":`${n}-details`,gap:3,margin:[0,0,3,0],children:[(0,j.jsxs)(r.Flex,{"data-testid":`${n}-header`,justifyContent:"between",children:[(0,j.jsxs)(r.Flex,{alignItems:"center","data-testid":`${n}-titleContainer`,gap:1,children:[(0,j.jsx)(r.Icon,{"data-testid":`${n}-icon`,...v}),(0,j.jsx)(r.Text,{"data-testid":`${n}-title`,children:p})]}),!d&&t&&(0,j.jsx)(rn,{"data-ga":`manage-integration-${m}::click-add::notification-integrations-tab`,"data-testid":`${n}-button`,disabled:!w,label:"Add",flavour:"hollow",icon:"plus",tooltip:w?null:At.WB,tooltipProps:{align:"bottom"},onClick:I}),!d&&!t&&(0,j.jsx)(on.A,{"data-ga":`manage-integration-${m}::click-plan-badge::notification-integrations-tab`})]}),(0,j.jsxs)(r.TextSmall,{color:"textDescription","data-testid":`${n}-description`,children:[a," ",s&&(0,j.jsx)(he.A,{Component:kt.W6,"data-ga":`manage-integration-${m}::click-docs::notification-integrations-tab`,"data-testid":`${n}-docsLink`,href:s,target:"_blank",whiteSpace:"nowrap",children:"Learn more."})]})]}),(0,j.jsx)(r.Flex,{justifyContent:"end",children:(0,j.jsxs)(dn,{alignItems:"end",alignSelf:"end",gap:1,"data-testid":`${n}-kindContainer`,tooltip:At.HA[c].tooltip,children:[(0,j.jsx)(r.Icon,{color:"textLite","data-testid":`${n}-kindIcon`,height:"16px",name:At.HA[c].icon,width:"16px"}),(0,j.jsx)(r.TextSmall,{color:"textLite","data-testid":`${n}-kind`,children:u})]})})]}),T&&(0,j.jsx)(Xt,{"data-testid":"createChannelModal",integrationId:o,settings:b,onClose:()=>{S(),C()}})]})},un=e=>{let{"data-testid":t="group",integrations:n,title:a,...s}=e;return n.length?(0,j.jsxs)(r.Flex,{column:!0,"data-testid":t,gap:2,position:"relative",...s,children:[(0,j.jsx)(r.TextBig,{color:"textDescription","data-testid":`${t}-title`,children:a}),(0,j.jsx)(r.Flex,{flexWrap:!0,"data-testid":`${t}-integrations`,gap:4,children:n.map(e=>(0,j.jsx)(cn,{"data-testid":`${e.slug}Card`,...e},e.slug))})]}):null};var mn=n(65746);const hn=e=>{const t=(0,Tt.EE)(e);(0,ot.A)(()=>({enabled:!!e,fetch:()=>(0,wt.b8)(e),onFail:e=>t({...mn.u,error:e.message}),onSettle:()=>t({loading:!1,loaded:!0}),onSuccess:e=>{t({...mn.u,...e})}}),[e])},gn=e=>{let{"data-testid":t="integrations",...n}=e;const l=(0,s.vt)(),o=(0,s.bq)();hn(l);const{available:d,error:c,loaded:u,unavailable:m}=(0,Tt.m$)(l),[h,g]=(0,i.useState)([]),[x,p]=(0,i.useState)([]),[b,f]=(0,i.useState)("");if(!u)return(0,j.jsx)(st.A,{"data-testid":`${t}-loader`,title:"Loading services..."});if(c)return(0,j.jsx)(ln.A,{"data-testid":`${t}-error`,message:c,title:`Services of ${o} are currently unavailable`});const v=(0,a.tW)(D.bq,{spaceSlug:o,settingsTab:D.A8});return(0,j.jsx)(M.Ay,{tab:"Notifications::Integrations",children:(0,j.jsxs)(r.Flex,{column:!0,"data-testid":t,...n,padding:[0,3,3],gap:3,overflow:"hidden",children:[(0,j.jsx)(r.Flex,{border:{side:"bottom",color:"placeholder"},"data-testid":`${t}-header`,width:"100%",children:(0,j.jsxs)(he.A,{as:a.N_,Component:kt.He,"data-ga":"manage-integrations::click-back::notification-integrations-tab","data-testid":`${t}-backLink`,to:v,children:[(0,j.jsx)(r.Icon,{"data-testid":`${t}-backIcon`,name:"arrow_left"}),(0,j.jsx)(r.H3,{"data-testid":`${t}-title`,children:D.ys[D.G0]})]})}),(0,j.jsxs)(r.Flex,{column:!0,"data-testid":`${t}-content`,gap:2,height:"100%",overflow:"hidden",children:[(0,j.jsx)(r.Box,{as:r.SearchInput,"data-ga":"manage-integrations::search::notification-integrations-tab","data-testid":`${t}-search`,iconLeft:(0,j.jsx)(r.Icon,{name:"magnify",color:"textLite"}),onChange:e=>{f(e),g((0,It.Zv)(d,e)),p((0,It.Zv)(m,e))},placeholder:"Search service",size:"small",width:{max:49.5}}),(0,j.jsxs)(r.Flex,{column:!0,"data-testid":`${t}-groups`,overflow:"auto",height:"100%",children:[(0,j.jsx)(un,{"data-testid":"integrationGroupAvailable",integrations:b?h:d,title:"Available"}),(0,j.jsx)(un,{"data-testid":"integrationGroupUnavailable",integrations:b?x:m,title:"Unavailable"})]})]})]})})},xn=()=>(0,j.jsxs)(a.BV,{children:[(0,j.jsx)(a.qh,{path:"/",element:(0,j.jsx)(sn,{})}),(0,j.jsx)(a.qh,{path:`/${D.G0}`,element:(0,j.jsx)(gn,{})})]});var pn=n(64587),bn=n(99236);const jn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[(0,r.useInputValue)({maxChars:20,value:e.name||""})||{},(0,r.useInputValue)({maxChars:30,value:e.slug||""})||{},(0,r.useInputValue)({maxChars:50,value:e.description||""})||{}]};var fn=n(36348),vn=n(52353),Cn=n(1174),yn=n(27965),wn=n(68531);const Tn={loading:!1,isAvailable:!1,isValid:!0,error:null},An=e=>{const t=(0,s.ap)(),[n,a]=(0,i.useState)(Tn);return(0,i.useEffect)(()=>{if(t.slug==e)a(Tn);else{const t=(0,vn.ni)(e);a({...Tn,isValid:!1,error:t})}},[t.slug,e]),(0,wn.A)(()=>{(0,vn.ni)(e)||t.slug==e||(a(e=>({...e,loading:!0})),(0,yn.Q9)(e).then(e=>{let{data:t}=e;a(e=>({...e,loading:!1,error:t.isAvailable?e.error:"slugNotAvailable"}))}).catch(e=>{a(t=>({...t,loading:!1,error:e.response?.data?.errorMessage||"Error while validating slug"}))}))},500,[e]),n},Sn=e=>{let{nameInput:t,slugInput:n,descriptionInput:a,onStartSlugValidation:s,onStopSlugValidation:l,onSlugValidationError:o,...d}=e;const[c,u,m,h]=t,[g,x,p,b]=n,[f,v,C,y]=a,{loading:w,error:T}=An(g);(0,i.useEffect)(()=>{(w?s:l)()},[w]),(0,i.useEffect)(()=>{o(T)},[T]);const A=(0,i.useMemo)(()=>(0,vn.fc)(c),[c]),S=(0,i.useMemo)(()=>(0,vn.e_)(f),[f]);return(0,j.jsxs)(r.Flex,{column:!0,gap:4,...d,children:[(0,j.jsx)(Cn.A,{Component:r.TextInput,permission:"space:UpdateMeta",label:"Name",value:c,onChange:u,error:vn.xc[A],isDirty:h,instantFeedback:"all",fieldIndicator:m,"data-testid":"textInputs-spaceName",containerStyles:{width:{base:150}}}),(0,j.jsx)(Cn.A,{Component:r.TextInput,permission:"space:UpdateMeta",label:"Slug",value:g,onChange:x,error:vn.xc[T]||T,isDirty:b,instantFeedback:"all",fieldIndicator:p,"data-testid":"textInputs-spaceSlug",containerStyles:{width:{base:150}}}),(0,j.jsx)(Cn.A,{Component:r.TextInput,permission:"space:UpdateMeta",label:"Description",value:f,onChange:v,error:vn.xc[S],isDirty:y,instantFeedback:"all",fieldIndicator:C,"data-testid":"textInputs-spaceDescription",containerStyles:{width:{base:150}}})]})};var In=n(30005);const kn=e=>{let{id:t,...n}=e;return(0,j.jsxs)(r.Flex,{column:!0,gap:1,...n,children:[(0,j.jsx)(r.Text,{strong:!0,children:"Space Id"}),(0,j.jsx)(In.Ay,{confirmationText:"Space ID copied to your clipboard.",children:t})]})};var Fn=n(6818);const Pn=()=>(0,j.jsxs)(r.Text,{lineHeight:1.5,children:["With the change of the Space Slug, previous ",(0,j.jsx)(r.Text,{strong:!0,children:"links will be broken"}),". In case you have some bookmarks or previous references using the previous Space Slug you should update them where possible. Please confirm you want to proceed with the change."]}),Mn=e=>{let{handleConfirm:t,handleDecline:n}=e;return(0,j.jsx)(r.ConfirmationDialog,{confirmLabel:"Continue","data-testid":"changeSpaceSlugDialog",handleConfirm:t,handleDecline:n,message:(0,j.jsx)(Pn,{}),title:"Space slug change"})};var $n=n(3561);const Ln=(0,ne.A)(r.Button),Rn=e=>{let{nameInput:t,slugInput:n,descriptionInput:a,onClose:l,isValidatingSlug:o,slugError:r,...d}=e;const c=(0,s.ap)(),u=(0,$n.A)(c.id),[m,h]=(0,i.useState)(!1),[g]=t,[p]=n,[b]=a,f=(0,i.useMemo)(()=>c.slug!==p,[c.slug,p]),[v,,C,y]=(0,x.A)(),w=()=>{l(f?p:null),h(!1)},T=()=>h(!1),A=(0,i.useCallback)(e=>{!e&&f?C():(h(!0),u({name:g,description:b,...f?{slug:p}:{}},{onSuccess:w,onFail:T}))},[g,p,b,c.slug]),S=(0,i.useCallback)(()=>A(!0),[A]),I=(0,i.useMemo)(()=>{const e=(0,vn.fc)(g),t=(0,vn.e_)(b);return!!(m||o||e||r||t)||c.name===g&&c.slug===p&&(c.description===b||!c.description&&!b)},[c,g,p,b,m,o]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ln,{label:"Save",onClick:A,isLoading:m||o,disabled:I,"data-testid":"saveSpace-button",feature:"SpaceSettings",...d}),v?(0,j.jsx)(Mn,{handleConfirm:S,handleDecline:y}):null]})},Nn=(0,i.memo)(e=>{let{onClose:t,...n}=e;const{localeDateString:a}=(0,pn.$j)(),l=(0,s.ap)(),o=(0,s.UV)("ids"),[d,,c,u]=(0,x.A)(),[m,,h,g]=(0,x.A)(),[p,b]=(0,i.useState)(),[f,v,C]=jn({name:l.name,slug:l.slug,description:l.description});if(!l.id)return null;const y=1===o.filter(e=>!(0,Oe.ES)(e)).length;return(0,j.jsxs)(M.Ay,{tab:"Info",children:[(0,j.jsxs)(r.Flex,{column:!0,gap:6,"data-testid":"manageSpace",padding:[0,0,6,0],width:{max:150},...n,children:[(0,j.jsxs)(r.Flex,{column:!0,"data-testid":"manageSpace-settings",children:[(0,j.jsx)(r.H3,{margin:[0,0,4,0],children:"Info"}),(0,j.jsxs)(r.Flex,{column:!0,gap:4,children:[(0,j.jsx)(Sn,{"data-testid":"manageSpace-nameInputs",nameInput:f,slugInput:v,descriptionInput:C,onStartSlugValidation:h,onStopSlugValidation:g,onSlugValidationError:b}),(0,j.jsx)(kn,{"data-testid":"manageSpace-spaceIdInput",id:l.id,width:{base:150}}),(0,j.jsx)(r.TextInput,{label:"Your role in space",value:(0,Ue.Zr)(l.roleInSpace),disabled:!0,containerStyles:{width:{base:150}}}),(0,j.jsx)(r.TextInput,{label:"Plan",value:(0,Ue.Vn)(l?.planName||""),disabled:!0,containerStyles:{width:{base:150}}}),l.createdAt?(0,j.jsx)(r.TextInput,{label:"Created at",value:a(new Date(l.createdAt)),disabled:!0,containerStyles:{width:{base:150}}}):null]})]}),(0,j.jsxs)(r.Flex,{"data-testid":"manageSpace-actions",justifyContent:"between",alignItems:"center",children:[(0,j.jsxs)(r.Flex,{"data-testid":"manageSpace-deleteLeaveActions",gap:4,children:[(0,j.jsx)(He.A,{align:"top",content:y&&bn.sh.leave,isBasic:!0,stretch:"align",children:(0,j.jsx)(r.Flex,{alignItems:"center",children:(0,j.jsx)(r.Button,{"data-ga":"manage-space-tab::click-leave-space::manage-space-modal","data-testid":"manageSpace-leave",disabled:y,icon:"switch_off",flavour:"borderless",label:"Leave space",neutral:!0,padding:[0],width:"fit-content",onClick:c})})}),(0,j.jsx)(Fn.A,{"data-testid":"manageSpace-delete",id:l.id,isLastSpace:y,name:l.name,onClose:t})]}),(0,j.jsx)(Rn,{"data-testid":"manageSpace-save",nameInput:f,slugInput:v,descriptionInput:C,onClose:t,isValidatingSlug:m,slugError:p})]})]}),d&&(0,j.jsx)(fn.A,{id:l.id,name:l.name,onClose:u})]})},()=>!0);var Dn=n(36229);const Bn=()=>{const e=(0,a.Zp)(),t=(0,s.vt)(),n=(0,a.RQ)(D.uX),l=(0,a.RQ)(D.bq),{params:o}=n||l||{},{spaceSlug:r="",settingsTab:d="",settingsSubTab:c=""}=o,u=(0,s.ap)("name"),m=(0,T.J_)(t,c),h=(0,T.wz)(m,"name"),g=D.ys[d],x=(0,i.useCallback)(()=>{e((0,a.tW)(D.bq,{spaceSlug:r,settingsTab:d}))},[r,d]),p=(0,i.useMemo)(()=>{const e=[{name:"Manage Space",isDisabled:!0},{name:u,isDisabled:!0},{name:g,...!!c&&{onClick:x}}];return c&&e.push({name:g===D.ys[D.aj]?h:D.ys[c]||c}),e},[x,h,u,g,c]);return(0,j.jsx)(Dn.A,{isBig:!0,items:p,showBackButton:!1,testid:"manageSpace"})};var _n=n(18739),Vn=n(62718),On=n(3941);const En=e=>(0,j.jsx)(r.Box,{as:"hr",height:"100%",sx:{borderWidth:"0px 0px 0px 1px",borderColor:"borderSecondary",borderStyle:"solid"},...e}),Un=()=>(0,j.jsx)(En,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}});var Hn=n(18387);const Wn=e=>{let{currentPlan:t,billingEmail:n,paymentMethod:a,businessName:s,vatNo:i,billingAddress:l}=e;const[o,d]=(0,_n.Qh)(),c=!!t.billingEmail&&!d,u=n||"",m=u?"":"Email is required",h=a?.id?`**** ${a?.id}`:"",g=h?"":"Payment method is required",x=l?"":"Billing address is required";return(0,j.jsxs)(r.Flex,{column:!0,gap:3,children:[(0,j.jsxs)(r.Flex,{gap:4,children:[(0,j.jsx)(r.TextInput,{value:u,label:"Billing email",placeholder:"Not specified",instantFeedback:"all",isDirty:!!m,error:m,disabled:!0}),(0,j.jsx)(r.TextInput,{value:h,label:"Default payment method",placeholder:"Not specified",instantFeedback:"all",isDirty:!!g,error:g,disabled:!0})]}),i&&(0,j.jsxs)(r.Flex,{gap:4,children:[(0,j.jsx)(r.TextInput,{value:s||"",label:"Business name",placeholder:"Not specified",disabled:!0}),(0,j.jsx)(r.TextInput,{value:i,label:"VAT number",placeholder:"Not specified",disabled:!0})]}),(0,j.jsx)(r.Flex,{children:(0,j.jsx)(r.TextInput,{value:(0,Hn.qN)(l)||"",label:"Billing address",placeholder:"Not specified",isDirty:!!x,error:x,disabled:!0})}),(0,j.jsxs)(he.A,{Component:r.Flex,cursor:c?"pointer":"default",disabled:!c,onClick:o,alignItems:"center",gap:1,"data-ga":"billing-options::click::billing",children:[(0,j.jsx)("span",{children:"Change billing information and payment method"}),(0,j.jsx)(r.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]})]})},Yn=e=>{let{onReset:t}=e;return(0,j.jsx)(r.Box,{as:r.Icon,name:"close_circle",onClick:t,cursor:"pointer",width:3,height:3,color:"border",position:"absolute",left:"2px"})},qn=e=>{let{promotionCode:t,onReset:n}=e;return(0,j.jsx)(r.Flex,{width:"100%",children:(0,j.jsx)(r.Pill,{padding:[0],flavour:"neutral",hollow:!0,children:(0,j.jsxs)(r.Flex,{position:"relative",gap:2,alignItems:"center",padding:[1,2,1,5],children:[(0,j.jsx)(Yn,{onReset:n}),(0,j.jsx)(r.Text,{children:t})]})})})},Jn=e=>{let{promotionCode:t,onApply:n,error:a}=e;const[s,l]=(0,i.useState)(t||""),o=()=>{l(""),n("")};return(0,j.jsxs)(r.Flex,{column:!0,gap:1,children:[(0,j.jsx)(r.Text,{strong:!0,children:"Promotion code"}),t&&!a?(0,j.jsx)(qn,{promotionCode:t,onReset:o}):(0,j.jsxs)(r.Flex,{column:!0,gap:1,children:[(0,j.jsxs)(r.Flex,{gap:2,alignItems:"baseline",children:[(0,j.jsx)(r.TextInput,{value:s,onChange:e=>l(e.target.value),placeholder:"Promotion code"}),!a&&(0,j.jsx)(r.Button,{label:"Apply",onClick:()=>n(s),padding:[3,4],disabled:!s}),!!s&&(0,j.jsx)(r.Button,{label:"Clear",flavour:"hollow",onClick:o,padding:[3,4],disabled:!s})]}),a&&(0,j.jsx)(r.Text,{color:"error",children:a})]})]})},Gn=e=>{let{needsCommitment:t,commitment:n,handleCommitmentChange:a}=e;return t&&(0,j.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,j.jsxs)(r.Flex,{gap:4,alignItems:"baseline",children:[(0,j.jsx)(r.Text,{strong:!0,style:{whiteSpace:"nowrap"},children:"Committed Nodes"}),(0,j.jsx)(r.TextInput,{onChange:a,value:n,placeholder:"i.e. 14",type:"number",min:1})]}),(0,j.jsx)(r.TextSmall,{children:"25% discount applied to the per-node cost of each committed node."})]})},zn=()=>(0,j.jsx)(r.Flex,{gap:4,alignItems:"baseline",children:(0,j.jsx)(r.Text,{strong:!0,style:{whiteSpace:"nowrap"},children:"Reports"})});var Kn=n(63950),Zn=n.n(Kn),Qn=n(88325);const Xn={earlyBird:()=>(0,j.jsxs)(r.Text,{children:["You are moving from ",(0,j.jsx)(r.Text,{strong:!0,children:"Early Bird"})," plan to another plan, you won't be able to come back to this. The ",(0,j.jsx)(r.Text,{strong:!0,children:"Community"})," free plan will be there if you wish to cancel but this doesn't allow you to invite or change users using the Member role."]}),communityV1:e=>{let{onCtaClick:t=Zn()}=e;const{url:n}=(0,Qn.A)();return(0,j.jsxs)(r.Text,{children:["You are moving from ",(0,j.jsx)(r.Text,{strong:!0,children:"Community (2023.02)"})," plan to another plan, you won't be able to come back to this. The new ",(0,j.jsx)(r.Text,{strong:!0,children:"Community (2023.11)"})," free plan will be there if you wish to cancel but this will have new limitation: max of 5 nodes active and max of 1 custom dashboard. See full details on the"," ",(0,j.jsx)(he.A,{as:a.N_,onClick:t,to:n,disabled:!n,children:(0,j.jsx)(r.Text,{color:"primary",children:"View plans page"})}),"."]})},pro:()=>(0,j.jsxs)(r.Text,{children:["You are moving from ",(0,j.jsx)(r.Text,{strong:!0,children:"Pro"})," plan to another plan by yourself, if you proceed we won't be able to migrate you to the Business plan with your current pricing conditions as communicated."]})},ea=e=>{let{currentPlan:t,...n}=e;const a=Xn[(e=>"earlyBird"==e.slug?"earlyBird":"free"==e.slug&&"2023.02"==e.version?"communityV1":"pro"==e.slug?"pro":null)(t)]||null;return a&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(En,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,j.jsxs)(r.Flex,{gap:3,children:[(0,j.jsx)(r.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,j.jsx)(a,{...n})]})]})};var ta=n(68534),na=n(43581);const aa=["STRIPE_INVOICE_UNPAID"],sa=()=>{const{warnings:e}=(0,ta.A)(),t=(0,i.useMemo)(()=>e.filter(e=>{let{warningKey:t}=e;return aa.includes(t)},[e]));return t.length?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(En,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,j.jsxs)(r.Flex,{gap:3,children:[(0,j.jsx)(r.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,j.jsx)(r.Flex,{column:!0,gap:1,children:t.map(e=>{let{warningKey:t,text:n}=e;return(0,j.jsx)(na.A,{children:n},t)})})]})]}):null},ia=e=>"earlyBird"===e?.slug?"earlyBird":e&&e.slug&&"free"!==e.slug?`${e.slug}-${e.interval}`:"free",la=o.default.div.withConfig({displayName:"withTableWrapper__TableWrapper",componentId:"sc-drcfxi-0"})(["margin-top:30px;"]);var oa=n(25457),ra=n(427);const da={size:50,minSize:50,maxSize:100},ca=e=>()=>(0,j.jsx)(r.Flex,{width:"100%",justifyContent:"end",children:e}),ua=e=>{let{getValue:t}=e;return(0,j.jsx)(r.Flex,{width:"100%",justifyContent:"end",children:t()})},ma=[{id:"name",accessor:"name",header:"",...da,fullWidth:!0},{id:"price",accessor:"price",header:ca("Price"),cell:ua,...da},{id:"qty",accessor:"qty",header:ca("Qty"),cell:ua,...da},{id:"month",accessor:"month",header:ca("Month"),cell:ua,...da},{id:"total",accessor:"total",header:ca("Total"),cell:ua,...da}],ha=e=>(0,j.jsxs)(r.Flex,{gap:3,...e,children:[(0,j.jsx)(r.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,j.jsx)(r.Text,{children:"No immediate charges are applicable to this plan subscription. On-demand usage charges will be applied based on your node period count."})]}),ga=(xa=r.Table,e=>(0,j.jsx)(la,{children:(0,j.jsx)(xa,{...e})}));var xa;const pa=e=>{let{lineItems:t,formatter:n}=e;return(0,j.jsx)(j.Fragment,{children:t.map(e=>{const t=(a=e).description?a.description.startsWith("Discount")?{color:"primary"}:a.description.startsWith("VAT")?{color:"textLite"}:{}:{};var a;const s=e.isInfo?r.TextSmall:r.Text;return(0,j.jsxs)(r.Flex,{justifyContent:"between",children:[(0,j.jsx)(s,{...t,children:e.description}),(0,j.jsx)(s,{...t,children:n.format(e.total?.amount)})]},e.description)})})},ba=(e=>t=>t.lineItems.totalPayable?t.lineItems.info?.length?(0,j.jsxs)(r.Flex,{column:!0,gap:1,children:[(0,j.jsx)(e,{...t}),(0,j.jsx)(pa,{lineItems:t.lineItems.info,formatter:t.formatter})]}):(0,j.jsx)(e,{...t}):null)(e=>{let{lineItems:t,formatter:n}=e;return(0,j.jsxs)(r.Flex,{justifyContent:"between",margin:[4,0,0,0],children:[(0,j.jsx)(r.H0,{strong:!0,children:"Total payable"}),(0,j.jsx)(r.H0,{strong:!0,"data-testid":"totalPayableAmountPreview",children:n.format(t.totalPayable.total.amount)})]})}),ja=e=>{let{previewData:t,lineItems:n,agree:a,toggleAgree:s,zeroPreviewSubscriptionTotal:l,isUpdate:o}=e;const{locale:d}=(0,ra.bO)(),c=(0,i.useMemo)(()=>(0,oa.A)(d),[d]),u=!o||!!t?.paymentMethod&&!!t?.billingAddress;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Un,{}),l&&(0,j.jsx)(ha,{padding:[0,0,2,0]}),(0,j.jsxs)(r.Flex,{gap:3,children:[(0,j.jsx)(r.Checkbox,{checked:a,onChange:s,disabled:!u}),(0,j.jsxs)(r.Text,{children:["I agree to Netdata Inc's"," ",(0,j.jsx)(he.A,{href:"https://www.netdata.cloud/service-terms/",rel:"noopener noreferrer",target:"_blank",children:"Terms of Service"})," ","and"," ",(0,j.jsx)(he.A,{href:"https://netdata.cloud/privacy",rel:"noopener noreferer",target:"_blank",children:"Privacy Policy"})]})]}),(0,j.jsx)(ba,{lineItems:n,formatter:c})]})},fa=e=>{let{lineItems:t}=e;const{locale:n}=(0,ra.bO)(),a=(0,i.useMemo)(()=>(0,oa.A)(n),[n]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ga,{dataColumns:ma,data:t.table}),(0,j.jsx)(Un,{}),(0,j.jsx)(pa,{lineItems:t.footer,formatter:a})]})};var va=n(43891),Ca=n(71282),ya=n(10853);const wa="initial",Ta=[{label:"Cost concerns"},{label:"Not using advanced features"},{label:"Switching to a different solution"},{label:"Temporary project ending"},{label:"Lack of specific feature (please specify)",specify:!0},{label:"Other (please specify}",specify:!0}],Aa=e=>{let{reason:t,setReason:n,text:a,setText:s}=e;const l=Ta.map(e=>({...e,value:e.label})),o=!!t.specify,d=(0,i.useCallback)(e=>{s(e?.target?.value)},[s]);return(0,j.jsxs)(r.Flex,{column:!0,gap:4,children:[(0,j.jsx)(r.Text,{children:"We're sorry to see you go. To help us improve, please tell us your main reason for downgrading:"}),(0,j.jsx)(r.Select,{options:l,value:t,onChange:n,placeholder:"Please select a reason"}),o?(0,j.jsx)(r.TextInput,{value:a,onChange:d,placeholder:"Please specify"}):null]})},Sa=()=>(0,j.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,j.jsx)(r.Text,{children:"Are you sure you want to downgrade to the Community plan?"}),(0,j.jsx)(r.Text,{children:"Downgrading will:"}),(0,j.jsxs)(va.K,{children:[(0,j.jsx)("li",{children:(0,j.jsx)(r.Text,{children:"Occur when your current subscription expires"})}),(0,j.jsx)("li",{children:(0,j.jsx)(r.Text,{children:"Affect all users on this Space"})}),(0,j.jsx)("li",{children:(0,j.jsx)(r.Text,{children:"Remove your access to premium features"})}),(0,j.jsx)("li",{children:(0,j.jsx)(r.Text,{children:"Restrict non-admin users' access to your Space"})}),(0,j.jsx)("li",{children:(0,j.jsx)(r.Text,{children:"Limit any business notification options after 24 hours"})})]}),(0,j.jsxs)(r.Text,{children:["We'd love to keep you on the Business plan."," ",(0,j.jsx)(he.A,{href:"mailto:support@netdata.com",as:"a",cursor:"pointer",textDecoration:"underline",children:"Can we help address any concerns"}),"?"]})]}),Ia=e=>{let{onConfirm:t,onClose:n}=e;const{sendButtonClickedLog:a}=(0,pe.A)(),{onTrial:s}=(0,ya.A)(),[l,o]=(0,i.useState)(),[d,c]=(0,i.useState)(""),[u,m]=(0,i.useState)(""),h=l==wa,g=h&&(!d||d.specify&&!u),x=(0,i.useCallback)(()=>{o(wa)},[o]),p=(0,i.useCallback)(()=>{g||(t(),n(),a({feature:"DowngradeToCommunity",reason:d?.label,details:u},!0))},[g,a,d,u]),b=h?p:x,f=h?"Submit and Continue Downgrade":"Proceed with Downgrade",v=(0,i.useCallback)(()=>{n(),a({description:"close-billing-plan-change-confirmation-dialog"},!0)},[a]);return s?(0,j.jsx)(Ca.A,{onDecline:v}):(0,j.jsx)(r.ConfirmationDialog,{confirmLabel:f,declineLabel:"Stay on Business Plan","data-ga":"downgrade-dialog","data-testid":"downgradeDialog",handleConfirm:b,handleDecline:v,isConfirmDisabled:g,message:h?(0,j.jsx)(Aa,{reason:d,setReason:c,text:u,setText:m}):(0,j.jsx)(Sa,{}),title:"Downgrade to Community?"})};var ka=n(50979);const Fa=e=>{let{isUpdate:t,currentPlan:n={},billingEmail:a,paymentMethod:s,...i}=e;const[l,o]=(0,_n.Qh)(),d=!!n.billingEmail&&!o;return t&&a&&s?null:(0,j.jsxs)(r.Flex,{gap:3,alignItems:"center",...i,children:[(0,j.jsx)(r.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,j.jsxs)(r.Flex,{column:!0,gap:1,children:[(0,j.jsxs)(r.Text,{children:["You can't proceed to checkout without having provided a"," ",(0,j.jsx)(r.Text,{strong:!0,children:"payment method"})," and a ",(0,j.jsx)(r.Text,{strong:!0,children:"billing address"}),"."]}),(0,j.jsx)(he.A,{cursor:d?"pointer":"default",disabled:!d,onClick:l,gap:1,"data-ga":"billing-options::click::billing",children:"Please go to the billing portal and fill a payment method"})]})]})},Pa=()=>(0,j.jsxs)(r.Flex,{gap:2,alignItems:"center",justifyContent:"center",children:[(0,j.jsx)(r.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,j.jsx)(r.Text,{children:"Your space cannot be upgraded, please contact billing@netdata.cloud to resolve the issue."})]});var Ma=n(47090);const $a=e=>e?`::commited-${e}`:"",La=(0,o.default)(r.Flex).withConfig({displayName:"checkoutTotals__CheckoutButtonWrapper",componentId:"sc-1q0h6ca-0"})(["background:",";padding:16px 0;position:sticky;bottom:0;z-index:20;"],(0,r.getColor)("mainBackground")),Ra=(0,ne.A)(r.Button),Na=(e=>t=>{let{title:n,isDowngrade:a,isUpdate:s,checkoutOrUpdate:i,...l}=t;const[o,,r,d]=(0,x.A)();return s&&a?(0,j.jsxs)(j.Fragment,{children:[o&&(0,j.jsx)(Ia,{title:n,onConfirm:i,onClose:d}),(0,j.jsx)(e,{onClick:r,...l})]}):(0,j.jsx)(e,{onClick:i,...l})})((0,o.default)(Ra).withConfig({displayName:"checkoutTotals__CheckoutButton",componentId:"sc-1q0h6ca-1"})(["flex:auto;"])),Da=e=>{let{title:t,slug:n,onClose:a,currentPlan:s,price:l,commitment:o,currentCommitment:d=0,email:c,needsCommitment:u,previewData:m,loadingPreview:h,isUpdate:g,promotionCode:p}=e;const{isBanned:b}=l||{},f=(v=s.slug,C=n,(ka.FJ[C]?.level||0)<(ka.FJ[v]?.level||0));var v,C;const[y,w]=(0,x.A)(!1),T=b||g&&!y||!g&&!c||u&&(d===o||!o||o<1),[A,S]=(0,x.A)(),I=(0,_n.L_)(),k=(0,_n.M4)(),F=g||s.billingEmail,P=F?k:I,{sendLog:M,isReady:$}=(0,pe.A)(),[L,R]=(0,ue.A)(),N=(0,i.useCallback)(()=>{S(),P({productId:l.id,email:m?.billingEmail||c,...u&&{commitment:o},...p&&{promotionCode:p}}).then(()=>{a(),M({isSuccess:!0,details:P===F?"update-billing-plan":"checkout-billing-plan"},!0),L({header:"Success",text:"You have successfully updated your plan"})}).catch(e=>{M({isFailure:!0,details:P===F?"update-billing-plan":"checkout-billing-plan"},!0);const t=e?.response?.data||e;R({header:"Error",text:(0,Ma.o)(t?.errorMsgKey,t?.errorMessage)||t?.errorMessage||"Something went wrong"})}).finally(()=>{S()})},[M,$]),{locale:D}=(0,ra.bO)(),B=(0,i.useMemo)(()=>(0,oa.A)(D),[D]),_=(V=m?.invoiceLineItems,O=B,(0,i.useMemo)(()=>{if(!V?.length||!O)return null;let e=!1;return V.reduce((t,n)=>"Total payable"==n.description?(t.totalPayable=n,e=!0,t):(n.unitPrice?t.table=[...t.table,{id:n.description,name:n.description,price:O.format(n.unitPrice.amount),qty:n.quantity,month:n.month,total:O.format(n.total?.amount)}]:e?t.info=[...t.info,{...n,isInfo:!0}]:t.footer=[...t.footer,n],t),{table:[],footer:[],info:[]})},[V,O]));var V,O;const E=(_?.footer||[]).some(e=>{let{description:t,total:n}=e;return"Subscription Total"===t&&0===n?.amount});return(0,j.jsxs)(r.Flex,{column:!0,gap:3,children:[h||!_||E?null:(0,j.jsx)(fa,{lineItems:_}),(0,j.jsxs)(La,{column:!0,gap:2,children:[g&&!h&&_&&(0,j.jsx)(ja,{isUpdate:g,previewData:m,lineItems:_,agree:y,toggleAgree:w,zeroPreviewSubscriptionTotal:E}),g&&!h&&(0,j.jsx)(Fa,{currentPlan:s,billingEmail:m?.billingEmail,paymentMethod:m?.paymentMethod,padding:[0,0,4,0],isUpdate:g}),b?(0,j.jsx)(Pa,{}):null,(0,j.jsx)(Na,{title:t,isDowngrade:f,label:g?"Checkout":"Proceed to checkout",disabled:!!T||A,checkoutOrUpdate:N,isLoading:A,"data-ga":`proceedTocheckoutButton::click-${ia(l)}${$a(o)}::billing`,"data-testid":"billingCheckoutTotals-proceedToCheckoutButton",isUpdate:g})]})]})},Ba=e=>{let{prices:t,currentPlan:n}=e;const[a,s]=(0,i.useState)(0),l=t[a],o=l?.commitment,r=(0,Bt.n)("id"),d=(0,_.gr)(r,"ids"),c=(0,V.BU)(d),u=Math.max(5,c.length),[m,h]=(0,i.useState)(n.committedNodes||u);return{recurringIndex:a,setRecurringIndex:s,price:l,needsCommitment:o,commitment:m,handleCommitmentChange:e=>h(e.target.value?parseInt(e.target.value,10):"")}},_a=e=>t=>{let{modalHeader:n="Checkout",...a}=t;return(0,j.jsx)(r.Modal,{"data-testid":"billing-modal",onEsc:a.onClose,onClickOutside:a.onClose,backdropProps:{backdropBlur:!0},children:(0,j.jsxs)(r.ModalContent,{width:{min:100,base:160},height:"90vh",children:[(0,j.jsxs)(r.ModalHeader,{children:[(0,j.jsx)(r.H4,{children:n}),(0,j.jsx)(r.ModalCloseButton,{onClose:a.onClose,testId:"close-button"})]}),(0,j.jsx)(r.ModalBody,{height:"100%",justifyContent:"between",overflow:{vertical:"auto"},children:(0,j.jsx)(e,{...a})})]})})},Va=3e5,Oa=_a(e=>{let{title:t,onClose:n,prices:s,currentPlan:l={},children:o}=e;const{recurringIndex:d,setRecurringIndex:c,price:u,needsCommitment:m,commitment:g,handleCommitmentChange:x}=Ba({prices:s,currentPlan:l}),{state:p}=(0,a.zy)(),[b,f]=(0,i.useState)(p?.coupon||""),[v,C]=(0,i.useState)(0),[y,w]=(0,i.useState)(Va),T=(0,h.JT)("billing:Manage"),A=(0,Hn.di)({price:u,promotionCode:b,commitment:g}),S=(0,_n.qW)(A,v),{loading:I,value:k,promoCodeError:F}=S;return(0,On.A)(()=>{I||C(e=>e+1)},y),(0,i.useEffect)(()=>{w(I?null:Va)},[I]),(0,j.jsx)(M.Ay,{feature:"Billing::UpdateModal",children:T?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(r.Flex,{column:!0,gap:4,children:[i.Children.map(o,e=>(0,i.cloneElement)(e,{recurringIndex:d,setRecurringIndex:c,priceLoadable:S})),(0,j.jsx)(Gn,{needsCommitment:m,commitment:g,handleCommitmentChange:x}),(0,j.jsx)(zn,{}),(0,j.jsx)(Un,{}),I?(0,j.jsx)(st.A,{title:"Loading billing info...",height:"auto"}):k?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Wn,{currentPlan:l,...k}),(0,j.jsx)(Un,{}),(0,j.jsx)(Jn,{promotionCode:b,onApply:f,error:F})]}):(0,j.jsx)("div",{children:"No data available"}),(0,j.jsx)(ea,{currentPlan:l,onCtaClick:n}),(0,j.jsx)(sa,{})]}),(0,j.jsx)(Da,{title:t,slug:u.slug,currentPlan:l,onClose:n,price:u,balance:l.balance,commitment:g,needsCommitment:m,previewData:k,loadingPreview:I,isUpdate:!0,promotionCode:b})]}):(0,j.jsx)(r.Flex,{children:(0,j.jsx)(r.TextBigger,{children:"You don't have permissions to change the plan."})})})});var Ea=n(67012);const Ua=_a(e=>{let{onClose:t,prices:n,currentPlan:s={},children:l}=e;const{recurringIndex:o,setRecurringIndex:d,price:c,needsCommitment:u,commitment:m,handleCommitmentChange:g}=Ba({prices:n,currentPlan:s}),x=(0,ye.uW)("email"),[p,b]=(0,i.useState)(s.billingEmail||x||""),f=(0,h.JT)("billing:Manage"),{state:v}=(0,a.zy)(),[C,y]=(0,i.useState)(v?.coupon||""),{discount:w,promoCodeError:T}=(0,_n.D)({productId:c.id,promotionCode:C,...u&&m&&{commitment:m}}),[A,S]=(0,i.useState)(0),I=(0,Hn.Lf)({price:c,promotionCode:C,commitment:m}),k=(0,_n.Tr)(I,A),{loading:F,value:P}=k;return(0,Ea.A)(()=>()=>S(e=>e+1),[w,!C]),(0,j.jsx)(M.Ay,{feature:"Billing::CheckoutModal",children:f?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(r.Flex,{column:!0,gap:4,children:[i.Children.map(l,e=>(0,i.cloneElement)(e,{recurringIndex:o,setRecurringIndex:d,priceLoadable:k})),(0,j.jsx)(Gn,{needsCommitment:u,commitment:m,handleCommitmentChange:g}),(0,j.jsx)(zn,{}),(0,j.jsx)(Un,{}),(0,j.jsx)(r.TextInput,{onChange:e=>b(e.target.value),value:p,label:"Billing email",placeholder:"jsmith@example.com"}),(0,j.jsx)(Un,{}),(0,j.jsx)(Jn,{promotionCode:C,onApply:y,error:T}),(0,j.jsx)(ea,{currentPlan:s,onCtaClick:t})]}),(0,j.jsx)(Da,{currentPlan:s,onClose:t,price:c,balance:s.balance,commitment:m,email:p,needsCommitment:u,previewData:P,loadingPreview:F,promotionCode:C})]}):(0,j.jsx)(r.Flex,{children:(0,j.jsx)(r.TextBigger,{children:"You don't have permissions to change the plan."})})})});n(72577);const Ha=e=>{let{text:t,iconProps:n={},iconRight:a,testId:s="billing-feature-item"}=e;return a?(0,j.jsxs)(r.Flex,{"data-test-id":s,width:"100%",gap:2,justifyContent:"between",children:[(0,j.jsx)(r.TextBig,{children:t}),(0,j.jsx)(r.Box,{width:5,children:(0,j.jsx)(r.Icon,{width:"20px",height:"20px",name:"check",color:"primary",...n})})]}):(0,j.jsxs)(r.Flex,{"data-test-id":s,gap:2,children:[(0,j.jsx)(r.Box,{width:5,children:(0,j.jsx)(r.Icon,{width:"20px",height:"20px",name:"check",color:"primary",...n})}),(0,j.jsx)(r.TextSmall,{children:t})]})},Wa=e=>{let{features:t,showViewDetails:n,iconRight:s}=e;return(0,j.jsxs)(r.Flex,{"data-testid":"billing-features-container",column:!0,gap:1,margin:[s?6:0,0,0,0],children:[t.map(e=>{let{text:t,icon:n,iconColor:a}=e;return(0,j.jsx)(Ha,{text:t,iconProps:{...n?{name:n}:{},...a?{color:a}:{}},iconRight:s},t)}),n&&(0,j.jsxs)(r.Flex,{gap:2,children:[(0,j.jsx)(r.Box,{width:5}),(0,j.jsxs)(he.A,{Component:r.Flex,as:a.N_,cursor:"pointer",alignItems:"center",gap:1,color:"text",hoverColor:"textFocus",to:"all-plans",children:[(0,j.jsx)(r.Text,{strong:!0,children:"View full details"}),(0,j.jsx)(r.Icon,{name:"chevron_right",width:"16px",height:"16px"})]})]})]})};var Ya=n(95565),qa=n(67462);const Ja=(0,We.A)(r.TextSmall),Ga=e=>{let{priceLoadable:t}=e;const{locale:n}=(0,ra.bO)(),a=(0,i.useMemo)(()=>(0,oa.A)(n),[n]),{loading:s,amount:l,error:o}=t||{};return s?(0,j.jsx)(r.Text,{lineHeight:"24px",children:"Getting price..."}):o?null:l?(0,j.jsxs)(r.H3,{children:[a.format(l),(0,j.jsx)(r.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):null},za=e=>{let{recurringIndex:t,slug:n,version:a,priceLoadable:s}=e;const{loading:l,value:o,hasError:d}=s||{};let c=0;const u=o?.invoiceLineItems;u?.length&&(c=u.find(e=>{let{description:t}=e;return"Nodes"==t})?.unitPrice?.amount);const m=(0,i.useMemo)(()=>function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{loading:t,amount:n}=e||{},a=!t&&!n;return[{free:(0,j.jsx)(r.H3,{children:"Free forever"}),homelab:(0,j.jsxs)(r.H3,{children:["$90.00",(0,j.jsx)(r.TextSmall,{color:"textLite",children:"/year"})]}),"business_2023.02":a?(0,j.jsxs)(r.H3,{children:["$3.00",(0,j.jsx)(r.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):(0,j.jsx)(Ga,{priceLoadable:e}),"business_2024.03":a?(0,j.jsxs)(r.H3,{children:["$4.50",(0,j.jsx)(r.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):(0,j.jsx)(Ga,{priceLoadable:e}),business:(0,j.jsx)(Ga,{priceLoadable:e})},{free:(0,j.jsx)(r.H3,{children:"Free forever"}),homelab:(0,j.jsxs)(r.H3,{children:["$10.00",(0,j.jsx)(r.TextSmall,{color:"textLite",children:"/month"})]}),"business_2023.02":(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(r.H3,{children:["$4.00",(0,j.jsx)(r.TextSmall,{color:"textLite",children:"/Node/month"})]})}),"business_2024.03":(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(r.H3,{children:["$6.00",(0,j.jsx)(r.TextSmall,{color:"textLite",children:"/Node/month"})]})}),business:(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(r.H3,{children:["$6.00",(0,j.jsx)(r.TextSmall,{color:"textLite",children:"/Node/month"})]})})}]}({loading:l,amount:c,error:d}),[l,c,d]);return(0,j.jsx)(r.Flex,{"data-testid":"billing-price-container",column:!0,gap:2,children:m[t][`${n}_${a}`]||m[t][n]})},Ka=o.default.div.withConfig({displayName:"pricingDetails__OneLine",componentId:"sc-hbslp4-0"})(["white-space:nowrap white-space:nowrap;"]),Za=e=>{let{nodesLastPeriod:t,committedNodes:n}=e;const a=t-n,s=a>0;return 0==a?(0,j.jsx)(r.TextSmall,{children:"You are using all your committed nodes."}):s?(0,j.jsxs)(r.TextSmall,{children:["You are using"," ",(0,j.jsxs)(r.TextSmall,{strong:!0,color:"error",children:[a," ",(0,qa.su)(a).toLowerCase()," more"]})," ","than your committed nodes."]}):(0,j.jsxs)(r.TextSmall,{children:["You are using"," ",(0,j.jsxs)(r.TextSmall,{strong:!0,color:"success",children:[t," out of ",n]})," ","committed ",(0,qa.su)(n).toLowerCase(),"."]})},Qa=e=>{let{interval:t,currentPeriodTo:n,atPeriodEnd:a,committedNodes:s,nodesLastPeriod:l,showAllPlans:o,showPromotion:d,cancelling:c,onCancelPlan:u,commitment:m}=e;const{localeDateString:h}=(0,pn.$j)(),g=(0,i.useMemo)(()=>"downgrade"==a?{action:"downgrades",color:"warning",tooltip:"You have requested subscription cancellation. To undo this action you can resubscribe."}:{action:"renews",color:"text",tooltip:null},[a]),x=(0,i.useMemo)(()=>({column:!0,gap:1,...o?{alignItems:"center"}:{}}),[o]);return(0,j.jsxs)(r.Flex,{...x,children:[!!n&&(0,j.jsxs)(r.TextSmall,{children:[(0,j.jsx)(r.TextSmall,{strong:!0,"data-testid":"billingPricingDetails-interval",children:`Billing ${ka.rY[t]}`})," ",(0,j.jsxs)(Ja,{color:g.color,tooltip:g.tooltip,noWrapper:!0,children:["(",g.action," ",h(new Date(n),{long:!1}),")"]})]}),d&&"month"===t&&(0,j.jsx)(he.A,{onClick:u,disabled:c,children:(0,j.jsx)(Ka,{children:"Save 25% by changing your billing frequency to yearly"})}),m?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(r.TextSmall,{children:["Committed Nodes:"," ",(0,j.jsx)(r.Text,{strong:!0,"data-testid":"billingPricingDetails-committedNodesNumber",children:s})]}),"number"===typeof l?(0,j.jsx)(Za,{nodesLastPeriod:l,committedNodes:s}):null]}):null]})},Xa=(e=>t=>{let{inModal:n,recurringIndex:a,setRecurringIndex:s,...i}=t;return n?(0,j.jsxs)(r.Flex,{"data-testid":"billing-recurring-index-container",width:"100%",justifyContent:"between",alignItems:"center",children:[(0,j.jsx)(e,{...i}),(0,j.jsx)(r.Flex,{gap:3,padding:[0,10],children:ka.HR.map((e,t)=>(0,j.jsx)(r.RadioButton,{checked:a===t,onChange:()=>s(t),"data-testid":`billingPaidPlans-${e}-radioButton`,children:(0,j.jsx)(r.Text,{color:"textDescription",children:(0,Ue.Zr)(ka.rY[e])})},e))})]}):(0,j.jsx)(e,{...i})})(e=>{let{children:t}=e;return(0,j.jsx)(r.H3,{"data-testid":"billingPricingDetails-activePlanName",children:t})}),es=e=>{let{slug:t,version:n,prices:a,recurringIndex:s=0,setRecurringIndex:l,currentPlan:o={},isActive:d,showAllPlans:c,showTeaserDetails:u,cancelling:m,onCancelPlan:h,title:g,features:x,nodesLastPeriod:p,inModal:b,priceLoadable:f}=e;const{onTrial:v}=(0,ya.A)(),C=d?o.pricing:a[s]?.pricing||{},y=(0,Hn.Kj)(t),w=(0,i.useMemo)(()=>({column:!0,gap:2,...c?{height:"140px",alignItems:"center"}:{}}),[c]),T=(0,i.useMemo)(()=>({column:!0,...c?{alignItems:"center"}:{}}),[c]);return(0,j.jsxs)(r.Flex,{"data-testid":"billing-pricing-details",...w,children:[(0,j.jsxs)(r.Flex,{...T,children:[(0,j.jsxs)(r.Flex,{alignItems:"center",gap:2,children:[(0,j.jsx)(Xa,{inModal:b,recurringIndex:s,setRecurringIndex:l,children:g}),d&&!c&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Pill,{flavour:"success","data-testid":"active-plan",icon:"checkmark_s",children:v?"Trial":"Active"}),v&&(0,j.jsx)(Ya.A,{children:(0,j.jsx)(r.TextBig,{color:"primary",children:"Upgrade Now!"})})]})]}),n&&(0,j.jsxs)(r.TextBig,{children:["(",n,")"]})]}),c||!d||"free"===t?(0,j.jsx)(za,{inModal:b,isActive:d,currentPlan:o,recurringIndex:s,slug:t,version:n,priceLoadable:f,...C}):null,!c&&u&&x?.[n]?(0,j.jsx)(Wa,{features:x[n],showViewDetails:!y}):null,d&&!(0,Hn.Kj)(t)&&!v&&(0,j.jsx)(Qa,{...o,showAllPlans:c,showPromotion:!0,cancelling:m,onCancelPlan:h,nodesLastPeriod:p})]})},ts=e=>{let{onConfirm:t,onDecline:n}=e;const{sendButtonClickedLog:a}=(0,pe.A)(),[s,l]=(0,x.A)(),o=(0,i.useCallback)(()=>{a({feature:"HomelabAcceptTerms"}),t()},[a]);return(0,j.jsx)(r.ConfirmationDialog,{title:"Terms of usage",confirmLabel:"I agree",declineLabel:"Close",handleConfirm:o,handleDecline:n,isConfirmPositive:!0,isConfirmDisabled:!s,message:(0,j.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,j.jsx)(r.Text,{children:"By continuing, you acknowledge that you will use Netdata ONLY for homelab purposes. If professional use is detected you will be downgraded, and will waive any rights to refunds."}),(0,j.jsxs)(r.Text,{children:["For more details on conditions please check our"," ",(0,j.jsx)(he.A,{href:"https://www.netdata.cloud/fair-usage-policy",rel:"noopener noreferrer",strong:!0,target:"_blank",children:"Fair Usage Policy"}),"."]}),(0,j.jsx)(r.Flex,{children:(0,j.jsx)(r.Checkbox,{checked:s,onChange:l,label:"I will NOT use the Homelab plan for professional purposes (this includes testing and staging environments).",labelPosition:"right",labelProps:{strong:!0,padding:[0,0,0,1]}})})]})})};var ns=n(81691),as=n(52950);const ss=()=>{const{reseller:e}=(0,s.ap)();return{isReseller:!!e?.ID}},is=()=>{const{isReseller:e}=ss();return e?(0,j.jsxs)(r.Flex,{"data-testid":"billing-reseller-warning",column:!0,gap:1,children:[(0,j.jsxs)(r.Text,{children:["This subscription is managed through a ",(0,j.jsx)(r.Text,{strong:!0,children:"Partner / Reseller"}),"."]}),(0,j.jsxs)(r.Text,{children:["To make any changes to your subscription, please contact your Partner / Reseller or reach out to"," ",(0,j.jsx)(he.A,{href:"mailto:sales@netdata.cloud",as:"a",cursor:"pointer",children:"sales@netdata.cloud"}),"."]})]}):null};var ls=n(3033),os=n(42711),rs=n(37785);const ds=(0,o.default)(r.Flex).attrs(e=>({background:"mainBackground",width:e.showAllPlans?"400px":{min:"280px"},justifyContent:e.showAllPlans?"start":"between",...e})).withConfig({displayName:"styled__StyledWrapper",componentId:"sc-1gqbztm-0"})(["place-self:",";"],e=>{let{showAllPlans:t}=e;return t?"center":"auto"});var cs=n(44913);const us=e=>{let{slug:t,version:n,prices:l=[],isSmall:o,isActive:d,currentPlan:c,showAllPlans:u,showTeaserDetails:m,allPlansView:g=!1,nodesLastPeriod:p,asAnchor:b,anchorText:f,...v}=e;const C=(0,ye.NJ)(),y=(0,s.vt)(),{isReseller:w}=ss(),{title:T,features:A}=ka.FJ[t]||ka.FJ.free,S=(0,h.JT)("billing:Manage"),{sendLog:I,sendButtonClickedLog:k,isReady:F}=(0,pe.A)(),{onTrial:P}=(0,ya.A)(),{cancelling:M,startCancelling:$,stopCancelling:L}=(0,_n.og)(),R="AWS"===c.paymentProvider,[N]=(0,cs.useStaticCoupon)(),D=(0,i.useCallback)(function(){let{label:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k({label:e},!0)},[k,F]),B=(0,Hn.z_)({currentPlan:c,slug:t,version:n,onTrial:P}),_=M||d&&(0,Hn.Kj)(t)||c.slug===ka.VH.earlyBird&&t===ka.VH.free||c.slug===ka.VH.free&&"2023.02"===c.version&&t===ka.VH.free&&"2023.11"===n,[V,O]=(0,i.useState)({}),[E,,U,H]=(0,x.A)(),[W,Y]=(0,ue.A)(),q=(0,_n.M4)(),J="cancel"===V.type&&!(0,Hn.Kj)(c.slug)&&!E,G="cancel"===V.type&&t===ka.VH.free&&"2023.11"===n,{id:z}=(0,rs.A)(),K=(0,dt.l)(),Z=(0,i.useCallback)(()=>{U(),$(),q({productId:z}).then(()=>{W({header:"Successfully canceled subscription",text:"You are now on Community plan"}),I({isSuccess:!0,description:"cancel-subscription"})}).catch(()=>{Y({header:"Failed to cancel the subscription",text:`Remained on ${T} plan`}),I({isFailure:!0,description:"cancel-subscription",error:"Failed to cancel the subscription"})}).finally(()=>{L(),K()})},[I,F]),Q=(0,i.useMemo)(()=>`user-${C}-space-${y}-accept-homelab-terms`,[C,y]),X=(0,i.useCallback)(()=>{localStorage.setItem(Q,!0)},[Q]),ee=(0,i.useCallback)(()=>"true"===localStorage.getItem(Q),[Q]),te=(0,i.useCallback)(e=>{if(!M&&!_)if(t!==ka.VH.homelab||c.slug===ka.VH.homelab||ee()){if((0,Hn.Kj)(t))return O({type:"cancel"}),void I(e,!0);if((0,Hn.Kj)(c.slug))return de("checkout"),void I(e,!0);de("update"),I(e,!0)}else O({type:"homelab"})},[I,F,V,O]),ne=(0,i.useCallback)(()=>{O({}),X(),setTimeout(()=>{te({action:ns.o1.buttonClicked},!0)},200)},[O,X,te]),ae=!!c.billingEmail,se=ae?Oa:Ua,{billingModalType:ie,billingModalSlug:le}=(0,Ve.PP)(),oe=["checkout","update"].includes(ie)&&t===le,re=(0,a.Zp)(),de=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const n=(0,Ve.PP)();(0,Ve.Z8)({...n,billingModalType:e,billingModalSlug:""===e?e:t}),re(location.pathname,{replace:!0,state:{coupon:t!==ka.VH.business&&t!==ka.VH.homelab||!N?void 0:N}})},[ce,,me,ge]=(0,x.A)(),xe=(0,i.useMemo)(()=>({column:!0,height:"100%",flex:o,gap:u?4:2,showAllPlans:u,isSmall:o,padding:u?[6]:[0,2,4,2],...u?{border:{side:"all",color:"border"}}:{},...v}),[u,o,v]);return(0,j.jsxs)(j.Fragment,{children:[b?(0,j.jsx)(he.A,{"data-testid":"billing-plan-as-anchor",onClick:()=>{te({action:ns.o1.buttonClicked,label:B,dataGa:`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`})},children:f}):(0,j.jsxs)(ds,{"data-testid":"billing-plan",...xe,children:[(0,j.jsx)(es,{slug:t,prices:l,isActive:d,currentPlan:c,cancelling:M,showAllPlans:u,showTeaserDetails:m,title:T,version:n,features:A,nodesLastPeriod:p,onCancelPlan:()=>te({action:ns.o1.buttonClicked,label:T})}),(0,j.jsx)(is,{}),!g&&(0,j.jsx)(Cn.A,{Component:r.Button,permission:"billing:Manage","data-ga":`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`,"data-testid":`billingPlan-${t}-${d?"currentPlan":"upgradeButton"}`,label:B,flavour:(0,Hn.Dy)(c?.slug,t),disabled:_,width:"100%",onClick:()=>te({action:ns.o1.buttonClicked,label:B,dataGa:`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`}),isLoading:M&&d,loadingLabel:"Cancelling"}),u&&!!A[n]?.length&&(0,j.jsx)(Wa,{features:A[n],iconRight:!0}),!u&&!w&&(0,j.jsxs)(j.Fragment,{children:[P&&(0,j.jsx)(ls.A,{flavour:"billing"}),(P||!(0,Hn.Kj)(c.slug))&&(0,j.jsxs)(r.Flex,{column:!0,gap:4,children:[(0,j.jsxs)(r.Flex,{gap:6,alignItems:"baseline",children:[P&&(0,j.jsx)(as.A,{}),!(0,Hn.Kj)(c.slug)&&!R&&(0,j.jsxs)(he.A,{Component:r.Flex,as:a.N_,cursor:"pointer",alignItems:"center",gap:1,color:"text",hoverColor:"textFocus",to:"all-plans",padding:[4,0,0],disabled:M,onClick:()=>D({label:S?"Change plan":"View plans"}),"data-testid":"billingPlan-viewMorePlansLink","data-ga":"change-plan::click::billing",children:[(0,j.jsx)("span",{children:S?"Change plan":"View plans"}),(0,j.jsx)(r.Icon,{name:"chevron_right",width:"16px",height:"16px"})]})]}),P&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(os.A,{flavour:"billing",color:"textLite",onOptOutClick:me}),ce&&(0,j.jsx)(Ca.A,{onDecline:ge,onCancellingEnd:()=>{}})]})]})]})]}),(J||G)&&(0,j.jsx)(Ia,{title:T,onConfirm:Z,onClose:()=>{H(),O({})}}),"homelab"===V.type?(0,j.jsx)(ts,{onConfirm:ne,onDecline:()=>O({})}):null,oe&&(0,j.jsx)(se,{title:T,onClose:()=>{H(),de()},prices:l,currentPlan:c,showProrations:ae,...ae?{modalHeader:"Update plan"}:{},children:(0,j.jsx)(es,{slug:t,prices:l,currentPlan:c,title:T,version:n,inModal:!0})})]})},ms=e=>{let{plans:t,isSmall:n,currentPlan:a,showAllPlans:s,showTeaserDetails:i,...l}=e;return(0,j.jsx)(j.Fragment,{children:ka.tD.map(e=>(Object.entries(t[e]||{})||[]).map(t=>{let[o,r]=t;return(0,j.jsx)(us,{slug:e,version:o,prices:r,isActive:a.slug===e&&a.version===o,isSmall:n,currentPlan:a,showAllPlans:s,showTeaserDetails:i,...l},`${e}-${o}`)}))})},hs=(0,l.A)(()=>n.e(4582).then(n.bind(n,52201)).then(e=>({default:e.TrialWarning})),"TrialWarning"),gs=e=>{let{isSmall:t,plans:n,currentPlan:a,showAllPlans:s=!1,showTeaserDetails:l=!1}=e;const{version:o}=(0,rs.A)(),d=(n.free?.[a?.version]||n.free?.[o])?.[0];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.Suspense,{fallback:"",children:(0,j.jsx)(hs,{showCoupon:!0})}),(0,j.jsxs)(r.Flex,{gap:6,children:[(0,j.jsx)(us,{slug:"free",version:d?.version,prices:d?.prices,isSmall:t,isActive:"free"===a.slug&&a.version==d?.version,currentPlan:a,showAllPlans:s,showTeaserDetails:l,...s?{background:"panelBg"}:{}}),(0,j.jsx)(ms,{plans:n,isSmall:t,currentPlan:a,showAllPlans:s,showTeaserDetails:l,...s?{background:"panelBg"}:{}})]})]})},xs=(0,o.default)(r.Flex).attrs(e=>({alignItems:"center",gap:4,...e})).withConfig({displayName:"headerInfo__HeaderInfo",componentId:"sc-xr03n9-0"})([""]),ps=()=>(0,j.jsxs)(r.Flex,{column:!0,gap:2,width:65,children:[(0,j.jsxs)(r.TextMicro,{children:[(0,j.jsx)(r.TextMicro,{strong:!0,children:"Available credit"})," for you to use on any plan subscriptions with us."]}),(0,j.jsx)(r.TextMicro,{children:"It is ok to change your mind, we will give you full flexibility! You can change the plan level, billing frequency or committed nodes, we won't hold you to any choice. When applicable, we'll credit you back on any unused amount."})]});var bs=n(55024);const js=(0,We.A)(he.A),fs=e=>{let{currentPlan:t}=e;const[n,a]=(0,_n.Qh)(),s=!!t.billingEmail&&!a,l=(0,h.JT)("billing:ReadAll"),o=t?.marketplaceUrl,d="AWS"===t?.paymentProvider,{locale:c}=(0,ra.bO)(),u=(0,i.useMemo)(()=>(0,oa.A)(c),[c]),m=(0,i.useCallback)(()=>{o&&(location.href=o)},[o]);return(0,j.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,j.jsx)(r.H3,{children:"Plan & Billing"}),(0,j.jsx)(xs,{children:l?(0,j.jsxs)(j.Fragment,{children:[d?null:(0,j.jsxs)(r.Flex,{gap:1,alignItems:"center",children:[(0,j.jsx)(r.Text,{children:"Credit:"}),(0,j.jsx)(r.Text,{"data-testid":"billingHeader-credits",strong:!0,children:u.format(t.balance.amount||0)}),(0,j.jsx)(He.A,{content:ps,align:"bottom",isBasic:!0,children:(0,j.jsx)(r.Icon,{name:"information",width:"16px",height:"16px",color:"textLite"})})]}),(0,j.jsxs)(r.Text,{children:["Billing email:"," ",(0,j.jsx)(r.Text,{strong:!0,"data-testid":"billingHeader-email",children:t.billingEmail||"-"})]}),(0,j.jsx)(bs.A,{}),o?(0,j.jsxs)(js,{Component:r.Flex,cursor:"pointer",onClick:m,alignItems:"center",gap:1,tooltip:"Manage your subscription on the AWS Marketplace","data-ga":"billing-options::click::billing","data-testid":"billingHeader-goToMarketplace",children:[(0,j.jsx)("span",{children:"Manage your Subscription"}),(0,j.jsx)(r.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]}):(0,j.jsxs)(he.A,{Component:r.Flex,cursor:s?"pointer":"default",disabled:!s,onClick:n,alignItems:"center",gap:1,"data-ga":"billing-options::click::billing","data-testid":"billingHeader-goToPortal",children:[(0,j.jsx)(r.Text,{color:"link",children:"Billing options and Invoices"}),(0,j.jsx)(r.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]})]}):(0,j.jsx)(bs.A,{})}),(0,j.jsx)(En,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}})]})};n(78898);var vs=n(43329),Cs=n(52365);function ys(e){const t=(0,Cs.A)(e?.in),n=(0,vs.w)(e?.in,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()-1),n.setHours(23,59,59,999),n}var ws=n(6463),Ts=n(69821),As=n(60125);function Ss(e,t,n){const{years:a=0,months:s=0,weeks:i=0,days:l=0,hours:o=0,minutes:r=0,seconds:d=0}=t,c=(0,As.a)(e,s+12*a,n),u=(0,Ts.e)(c,l+7*i,n),m=1e3*(d+60*(r+60*o));return(0,vs.w)(n?.in||e,+u-m)}var Is=n(63537),ks=n(66118),Fs=n(5638),Ps=n(44731),Ms=n(57814),$s=n(55164),Ls=n(47809);const Rs={nodes:1,p90:2,committed_nodes:3},Ns={"Daily count":"The weighted 90th percentile of the live node count during the day, taking time as the weight. If you have 30 live nodes throughout the day, except for a two hour peak of 44 live nodes, the daily value is 31.","Committed nodes":"The number of nodes committed to in the yearly plan. In case the period count is higher than the number of committed nodes, the difference is billed as overage.","Period count":"The 90th percentile of the daily counts for this period up to the date. The last value for the period is used as the number of nodes for the bill for that period."};ks.t1.register(ks.kc,ks.PP,ks.E8,ks.FN,ks.No,ks.s$,ks.m_,ks.ZT,ks.A6,Fs.A),ks.m_.positioners.follow=function(e,t){return!e?.length||t.y>360?(this._resolveAnimations().update(this,{opacity:0}),!1):(0===this.opacity&&this._resolveAnimations().update(this,{opacity:1}),{x:t.x,y:t.y})};const Ds=e=>({nodes:{label:"Daily count",type:"bar",color:(0,r.getColor)("text")({theme:e}),backgroundColor:(0,r.getColor)("primary")({theme:e}),borderColor:(0,r.getColor)("primary")({theme:e}),borderWidth:2,pointStyle:"rectangle",usePointStyle:!0},p90:{label:"Period count",type:"line",color:(0,r.getColor)("text")({theme:e}),borderColor:(0,r.getColor)(["purple","lilac"])({theme:e}),borderWidth:2,fill:!1,stepped:!0},committed_nodes:{label:"Committed nodes",type:"line",color:(0,r.getColor)("text")({theme:e}),borderColor:(0,r.getColor)(["blue","aquamarine"])({theme:e}),borderWidth:2,fill:!1,borderDash:[1,2],borderDashOffset:1,pointStyle:!1}}),Bs={border:{side:"all",color:"inputBorder",padding:[3]},round:!0},_s=ys(),Vs=(0,ws.o)(Ss(_s,{months:1})),Os=e=>{let{onNodesLastPeriodFetch:t}=e;const{offset:n}=(0,ra.bO)(),a=(0,s.vt)(),[l,d]=(0,i.useState)(()=>({start:Vs,end:_s})),[c,u,m]=(0,ot.A)(()=>({enabled:!!a&&!!l.start&&!!l.end,fetch:()=>(0,Ls.U2)(a,{after:Math.floor((0,Is.W)((0,pn.ii)(l.start,n))/1e3),before:Math.floor((0,Is.W)((0,pn.ii)(l.end,n))/1e3)}),initialValue:{labels:[],data:[]},onSuccess:e=>{let{data:n,labels:a}=e;if(!n.length)return;const s=n.at(-1),i=s[a.indexOf("nodes")],l=s[a.indexOf("timestamp")];t(e=>e.timestamp>l?e:{timestamp:l,value:i})}}),[a,l,t]),h=(0,i.useContext)(o.ThemeContext),g=(0,i.useMemo)(()=>{const e=c.data.map(e=>{let[t]=e;return t}),t=c.labels.reduce((t,n,a)=>a?[{...Ds(h)[n],data:e.map((e,t)=>c.data[t][a]),order:Rs[n]},...t]:t,[]);return{labels:e,datasets:t}},[c]),[x,p]=function(e){let{data:t,annotations:n=[]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{localeDateString:a}=(0,pn.$j)(),s=(0,i.useRef)(!1),l=(0,i.useRef)(),o=(0,i.useMemo)(()=>({interaction:{axis:"x"},plugins:{legend:{position:"bottom",align:"start",onClick:(e,t,n)=>{const a=n.legendItems.findIndex(e=>e.text===t.text);n.chart.isDatasetVisible(a)?n.chart.hide(a):n.chart.show(a)},labels:{generateLabels:e=>e.data.datasets.map((t,n)=>({fontColor:t.color,text:t.label,fillStyle:t.backgroundColor,strokeStyle:t.borderColor,pointStyle:"Daily count"===t.label?"rect":"line",hidden:!e.isDatasetVisible(n),order:t.order})).sort((e,t)=>e.order-t.order),usePointStyle:!0},onHover:function(e,t){!s.current&&l.current&&(s.current=!0,l.current.innerHTML=Ns[t.text],l.current.style.left=e.x+"px",l.current.style.top=e.y+"px",l.current.style.visibility="visible",l.current.style.transform="translateY(-100%)")},onLeave:function(){l.current&&(s.current=!1,l.current.innerHTML="",l.current.style.visibility="hidden")}},tooltip:{enabled:!0,mode:"nearest",intersect:!1,yAlign:"bottom",usePointStyle:!0,position:"follow",backgroundColor:(0,r.getColor)("tooltip")({theme:e}),color:(0,r.getColor)("tooltipText")({theme:e}),callbacks:{title:e=>{const[t]=e;return t?a(1e3*t.label,{month:"2-digit",day:"2-digit",year:"numeric",long:!1,dateStyle:void 0,timeZone:"UTC"}):""},labelPointStyle:e=>({pointStyle:"Total Nodes"===e.dataset.label?"rect":"line"}),label:e=>` ${e.formattedValue} ${e.dataset.label||""}`}},annotation:{annotations:n.reduce((n,a,s)=>({...n,[`annotation${s}`]:{type:"line",value:t.findIndex(e=>e[0]===a.timestamp),borderColor:(0,r.getRgbColor)("attention",.3)({theme:e}),borderDashOffset:0,borderWidth:10,drawTime:"afterDatasetsDraw",label:{drawTime:"afterDatasetsDraw",display:!1,backgroundColor:(0,r.getRgbColor)("attention",.8)({theme:e}),borderWidth:0,color:"white",content:a.name,textAlign:"center"},scaleID:"x",enter(e,t){const n=e.chart,a=n.options.plugins.annotation.annotations[`annotation${s}`];a.label.display=!0,a.label.position=t.y/e.chart.chartArea.height>.5?"start":"end",n.update()},leave(e){const t=e.chart;t.options.plugins.annotation.annotations[`annotation${s}`].label.display=!1,t.update()}}}),{})}},responsive:!0,maintainAspectRatio:!1,scales:{x:{ticks:{callback:function(e){return a(1e3*this.getLabelForValue(e),{month:"2-digit",day:"2-digit",year:"numeric",long:!1,dateStyle:void 0,timeZone:"UTC"})},color:(0,r.getColor)("textLite")({theme:e})}},y:{beginAtZero:!0,ticks:{color:(0,r.getColor)("textLite")({theme:e})}}}}),[e,t]);return[o,l]}(h,c);return(0,j.jsxs)(r.Flex,{column:!0,gap:4,children:[(0,j.jsxs)(r.Flex,{alignItems:"center",justifyContent:"between",children:[(0,j.jsx)(r.H3,{children:"Usage"}),(0,j.jsx)(Ms.A,{values:l,utc:n,onChange:d,tagging:"billing-usage",isPlaying:!1,onlyDates:!0,accessorProps:Bs,padding:[4,0],width:"auto",maxDate:_s})]}),(0,j.jsxs)(r.Flex,{position:"relative",height:90,children:[u?(0,j.jsx)(st.A,{height:"calculate(100vh-375px)",title:"Loading billing data..."}):m?(0,j.jsx)($s.H4,{title:"Chart couldn't be loaded"}):(0,j.jsx)(Ps.t1,{type:"bar",data:g,options:x}),(0,j.jsx)(r.Flex,{ref:p,background:"main",color:"generic",position:"absolute",round:!0,padding:[3],width:{max:75},sx:{visibility:"hidden"},onMouseOver:()=>p.current.style.visibility="hidden"})]})]})},Es=e=>{let{isSmall:t,currentPlan:n,loaded:a,currentLoaded:s,plans:l}=e;const[o,r]=(0,i.useState)({timestamp:null,value:null}),d=l[n.slug]?l[n.slug][n.version]:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fs,{currentPlan:n}),a&&s?(0,j.jsxs)(j.Fragment,{children:[(0,Hn.Kj)(n.slug)?(0,j.jsx)(gs,{isSmall:t,plans:l,currentPlan:n,showTeaserDetails:!0}):(0,j.jsx)(us,{slug:n.slug,version:n.version,prices:d,width:t?"auto":120,padding:[0],height:"auto",isSmall:t,isActive:!0,currentPlan:n,allPlansView:!0,nodesLastPeriod:o.value}),(0,j.jsx)(En,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,j.jsx)(Os,{onNodesLastPeriodFetch:r})]}):(0,j.jsx)(Vn.Jr,{})]})};var Us=n(41514);const Hs={year:"Yearly",month:"Monthly"},Ws=e=>{let{currentPlan:t}=e;const{locale:n}=(0,ra.bO)(),l=(0,i.useMemo)(()=>(0,oa.A)(n),[n]),o=(0,s.bq)(),[d,c]=(0,_n.Qh)(),{cancelling:u,startCancelling:m,stopCancelling:g}=(0,_n.og)(),p=!!t.billingEmail&&!c,[b,f]=(0,x.A)(),[v,C]=(0,ue.A)(),y=(0,_n.M4)(),{title:w}=ka.FJ[t.slug]||ka.FJ.free,{id:T}=(0,rs.A)(),A=(0,h.JT)("billing:Manage"),S=(0,h.JT)("billing:ReadAll"),{title:I}=ka.FJ[t?.slug]||ka.FJ.free,k=Hs[t?.interval];return(0,j.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,j.jsxs)(r.Flex,{gap:2,alignItems:"center",children:[(0,j.jsx)(he.A,{as:a.N_,to:`/spaces/${o}/settings/billing`,disabled:u,color:"text",hoverColor:"textLite",showToolTip:!0,content:"Back to Plan & Billing",align:"bottom",isBasic:!0,children:(0,j.jsx)(r.Icon,{name:"arrow_left",width:"20px",height:"20px",margin:[1.5,0,0]})}),(0,j.jsx)(r.H3,{children:"All Plans"})]}),(0,j.jsxs)(xs,{children:[(0,j.jsxs)(r.Flex,{gap:1,alignItems:"center",children:[(0,j.jsx)(r.Text,{children:"Active plan:"}),(0,j.jsx)(r.Text,{strong:!0,children:I})]}),k&&(0,j.jsxs)(r.Flex,{gap:1,alignItems:"center",children:[(0,j.jsx)(r.Text,{children:"Billing frequency:"}),(0,j.jsx)(r.Text,{strong:!0,children:k})]}),t.commitment?(0,j.jsxs)(r.Flex,{gap:1,alignItems:"center",children:[(0,j.jsx)(r.Text,{children:"Committed Nodes:"}),(0,j.jsx)(r.Text,{strong:!0,children:t?.committedNodes||0})]}):null,S&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(r.Flex,{gap:1,alignItems:"center",children:[(0,j.jsx)(r.Text,{children:"Credit:"}),(0,j.jsx)(r.Text,{strong:!0,children:l.format(t?.balance?.amount||0)}),(0,j.jsx)(He.A,{content:ps,align:"bottom",isBasic:!0,children:(0,j.jsx)(r.Icon,{name:"information",width:"16px",height:"16px",color:"textLite"})})]}),(0,j.jsxs)(r.Flex,{gap:1,alignItems:"center",children:[(0,j.jsx)(r.Text,{children:"Billing email:"}),(0,j.jsx)(r.Text,{strong:!0,children:t?.billingEmail||"-"})]})]}),(0,j.jsx)(bs.A,{}),(0,j.jsxs)(he.A,{Component:r.Flex,cursor:p?"pointer":"default",disabled:!p,onClick:d,alignItems:"center",gap:1,children:[(0,j.jsx)(r.Text,{color:"link",children:"Billing options and Invoices"}),(0,j.jsx)(r.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]}),!(0,Hn.Kj)(t?.slug)&&(0,j.jsx)(he.A,{Component:r.Flex,cursor:"pointer",onClick:f,alignItems:"center",gap:1,disabled:u||!A,"data-ga":"cancel-plan::click::billing",children:(0,j.jsx)(r.Text,{textDecoration:"underline",children:u?"Canceling plan...":"Cancel plan"})})]}),(0,j.jsx)(En,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),b&&(0,j.jsx)(Ia,{title:"Community",onConfirm:()=>{m(),y({productId:T}).then(()=>((0,Us.H)("billing","cancel-plan","global-view",{slug:t?.slug,interval:t?.interval,success:!0}),v({header:"Successfully requested subscription cancellation",text:"When your current subscription expires you will be moved to the Community Plan"}))).catch(()=>((0,Us.H)("billing","cancel-plan","global-view",{slug:t?.slug,interval:t?.interval,success:!1}),C({header:"Failed to cancel the subscription",text:`Remained on ${w} plan`}))).finally(()=>{g()})},onClose:f})]})},Ys=e=>{let{plans:t,currentPlan:n}=e;const{sendButtonClickedLog:a}=(0,pe.A)(),{version:s}=(0,rs.s)(),l=t[ka.VH.homelab]?.[s],o=(0,i.useCallback)(()=>{window.open("https://www.netdata.cloud/request-enterprise/","_blank","noopener,noreferrer"),a({feature:"OnPremContact"})},[a]),d=(0,i.useCallback)(()=>{window.open("https://www.netdata.cloud/pricing/","_blank","noopener,noreferrer"),a({feature:"OnPlanComparison"})},[a]);return(0,j.jsxs)(r.Flex,{column:!0,gap:2,alignItems:"center",children:[(0,j.jsxs)(r.Text,{children:["Check our"," ",(0,j.jsx)(us,{asAnchor:!0,anchorText:"Homelab Plan",slug:ka.VH.homelab,plans:t,version:s,prices:l,currentPlan:n})," ","for home-based projects and our ",(0,j.jsx)(he.A,{onClick:o,children:"On-prem Plan"})," for full onsite deployment!"]}),(0,j.jsx)(he.A,{onClick:d,children:"Check the full plan comparison on our website."})]})};var qs=n(29022);const Js=()=>(0,j.jsx)(qs.A,{title:"No access",children:(0,j.jsx)(r.Text,{children:"You don't have permissions to view this page."})}),Gs=e=>{let{plans:t,plansLoaded:n,currentPlan:a}=e;const{isReseller:s}=ss();return s?(0,j.jsx)(Js,{}):n?(0,j.jsxs)(r.Flex,{column:!0,gap:8,height:"100%",overflow:{vertical:"auto"},children:[(0,j.jsx)(Ws,{currentPlan:a}),(0,j.jsxs)(r.Flex,{column:!0,gap:8,alignItems:"center",children:[(0,j.jsx)(gs,{plans:t,currentPlan:a,showAllPlans:!0,showTeaserDetails:!0}),(0,j.jsx)(Ys,{plans:t,currentPlan:a})]})]}):(0,j.jsx)(Vn.Jr,{})},zs={month:"Monthly",year:"Yearly"},Ks=()=>{const[e,t]=(0,a.ok)(),[n,s]=(0,ue.A)();(0,i.useEffect)(()=>{const a=e.get("from"),s=e.get("from_committed_nodes"),i=e.get("interval"),l=e.get("result"),o=e.get("to"),r=e.get("to_committed_nodes"),d=e.get("from_trial"),c=e.get("bundle_quantity");(0,Hn.JR)(a,o);if(l){const u="success"===l,m={from:a,fromNodes:s,interval:i,to:o,toNodes:r,fromTrial:d,bundleQuantity:c,success:u};u&&n((e=>{let{from:t,to:n,fromNodes:a,toNodes:s,interval:i,fromTrial:l,bundleQuantity:o,success:r=!0}=e;if(o)return{header:"Successful purchase",text:`You have successfully purchased ${o} credits!`};if(l)return{header:r?"Successful upgrade":"Failed to upgrade",text:r?"You have successfully upgraded your plan":"Something went wrong"};const d=zs[i]||i;if(t===n&&a===s)return{header:r?"Successful billing cycle change":"Failed to update billing cycle",text:r?`Subscription billing cycle changed to ${d}`:`Subscription is still on ${d} billing cycle`};if(t===n)return{header:r?"Successful change of commitment":"Failed to change the commitment",text:r?`Commitment ${a<s?"increased":"decreased"} from ${a} to ${s} nodes`:`Commitment remained the same, ${a} nodes`};const c=!(0,Hn.JR)(t,n);return{header:r?`Successfully ${c?"downgraded":"upgraded"} plan`:`Failed to ${c?"downgrade":"upgrade"} plan`,text:r?`Subsrciprion ${c?"downgraded":"upgraded"} from ${t} to ${n} plan (${d})`:`Remained on ${t} plan`}})(m)),(0,Us.H)("billing","callback","global-view",m),e&&(e.delete("from"),e.delete("from_committed_nodes"),e.delete("interval"),e.delete("result"),e.delete("to"),e.delete("to_committed_nodes"),e.delete("from_trial"),t(e))}},[e,n,s])},Zs=()=>{const[e]=(0,Ne.Ay)();return(0,j.jsx)(a.C5,{replace:!0,to:`/spaces/${e}`})},Qs=e=>{let{title:t,message:n}=e;return(0,j.jsx)(qs.A,{title:t,children:(0,j.jsx)(r.TextBig,{children:n})})},Xs=()=>{Ks();const{loaded:e,value:t,hasError:n}=(0,_n.lU)(),{loaded:s,value:l,error:o}=(0,_n.JN)(),d="AWS"===l?.paymentProvider,c=(0,Ht.J)(),u=(0,i.useMemo)(()=>n?"Something went wrong while trying to fetch billing plans.":o,[n,o]);return e&&s?o||n?(0,j.jsx)(Qs,{title:"Error",message:u}):(0,j.jsx)(M.Ay,{feature:"Billing",children:(0,j.jsx)(r.Flex,{column:!0,height:"calc(100% - 30px)",gap:3,children:(0,j.jsxs)(a.BV,{children:[(0,j.jsx)(a.qh,{path:"/all-plans",element:d?(0,j.jsx)(Zs,{}):(0,j.jsx)(Gs,{plans:t,plansLoaded:e,currentPlan:l})}),(0,j.jsx)(a.qh,{path:"/",element:(0,j.jsx)(Es,{isSmall:c,currentPlan:l,loaded:e,currentLoaded:s,plans:t})})]})})}):(0,j.jsx)(Vn.Jr,{})};var ei=n(92318);const ti=o.default.img.withConfig({displayName:"notFound__Illustration",componentId:"sc-v5yh8i-0"})(["height:180px;width:180px;"]),ni=()=>{const e=`${ei.A.assetsBaseURL}/img/no-nodes-room.svg`;return(0,j.jsxs)(r.Flex,{column:!0,gap:4,alignItems:"center",justifyItems:"center",justifyContent:"center",height:"100%",width:"100%",padding:[0,0,"10%"],children:[(0,j.jsx)(ti,{src:e,alt:"Page not found",title:"Page not found"}),(0,j.jsxs)(r.Flex,{column:!0,gap:2,alignItems:"center",children:[(0,j.jsx)(r.H3,{children:"Page not found"}),(0,j.jsx)(r.Text,{children:"If the url is correct, contact your space administrator to check if you have the required permissions to view this page."})]})]})};var ai=n(14815),si=n(4204);const ii=(0,l.A)(()=>Promise.all([n.e(8791),n.e(9462)]).then(n.bind(n,89462))),li=(0,l.A)(()=>Promise.all([n.e(6394),n.e(7044)]).then(n.bind(n,97044))),oi=(0,o.default)(d.t).withConfig({displayName:"manageWorkspace__ColumnHeader",componentId:"sc-1q2o0yg-0"})(["width:180px;padding:16px;"]),ri=e=>t=>(0,j.jsx)(i.Suspense,{fallback:(0,j.jsx)(Vn.aW,{}),children:(0,j.jsx)(e,{...t})}),di=e=>t=>(0,j.jsx)(c.Yv,{flex:"1",overflow:"hidden",children:(0,j.jsx)(e,{...t})}),ci=e=>t=>{let{containerProps:n={},...a}=t;return(0,j.jsx)(c.Yv,{flex:"1",overflow:"hidden",height:"100%",padding:[4,0,0],...n,children:(0,j.jsx)(e,{...a})})},ui=di(Nn),mi=di(_e),hi=di(yt),gi=ci(bt),xi=ci(xn),pi=di(Xs),bi=ci(ri(ii)),ji=di(ri(li)),fi=(0,i.memo)(()=>{const e=(0,a.Zp)(),{state:t={},pathname:n}=(0,a.zy)(),{settingsTab:l,...o}=(0,a.g)(),[d]=(0,i.useState)(t?.previousUrlPath||null),m=(0,s.ap)("name"),g=(0,s.ap)("id"),x=(e=>{const t=D.IV.indexOf(e);return-1!==t?t:D.Wk})(l),p=(0,i.useCallback)(t=>{const a=((e,t)=>{const n=e.split("/"),a=n.indexOf("settings")+1-n.length;return`${n.slice(0,a).join("/")}/${D.IV[t]||D.Wk}`})(n,t);e(a)},[l]),b=(0,h.JT)("billing:ReadBasic"),f=(0,h.JT)("room:AddNode"),v=(0,h.JT)("user:ReadAll"),C=(0,h.JT)("channel:ReadAll"),y=(0,h.JT)("agent:ReadDynCfg"),w=(0,T.At)(),A=(0,Oe.ES)(g),S=(0,i.useMemo)(()=>({[D.mm]:!A,[D.aj]:!A&&f,[D.rF]:f||w,[D.KV]:!A&&v,[D.A8]:!A&&C,[D.bO]:!A&&b&&!si.ei,[D.Tv]:!A&&f,[D.$d]:y}),[A,f,w,v,C,b,y]);(0,i.useEffect)(()=>{D.ys[l]||e((0,a.tW)(n,{...o,settingsTab:D.Wk}))},[]),(0,i.useEffect)(()=>{b||l===D.bO&&e((0,a.tW)(n,{...o,settingsTab:D.Wk}))},[b,l]);const I=(0,s.bq)(),k=(0,i.useCallback)(t=>{e(t?`/spaces/${t}`:d||`/spaces/${I}`)},[d,I]);return m?(0,j.jsx)(M.Ay,{feature:"SpaceSettings",children:(0,j.jsxs)(c.GO,{full:!0,"data-testid":"manageWorkspaceModal",closeOnClickOutside:!1,closeOnEsc:!1,onClose:k,width:"100%",children:[(0,j.jsx)(u.z,{"data-testid":"manageWorkspaceModal-header",onClose:k,title:(0,j.jsx)(Bn,{})}),S[l]?(0,j.jsxs)(r.Tabs,{row:!0,column:!1,"data-testid":"manageWorkspaceModal-tabs",selected:x,onChange:p,TabsHeader:oi,tabsProps:{column:!0},height:"100%",noDefaultBorder:!0,position:"relative",overflow:"hidden",width:"100%",children:[S[D.mm]?(0,j.jsx)(r.Tab,{basis:0,"data-testid":"manageWorkspaceModal-spaceTab",label:D.ys[D.mm],"data-ga":"manage-space::click-tab::space-tab",isMenuItem:!0,children:(0,j.jsx)(ui,{"data-testid":"manageWorkspaceModal-spaceTabContent",onClose:k,small:!0})}):null,S[D.aj]?(0,j.jsx)(r.Tab,{basis:0,"data-testid":"manageWorkspaceModal-warRoomsTab","data-ga":"manage-space::click-tab::rooms-tab",label:D.ys[D.aj],isMenuItem:!0,children:(0,j.jsx)(mi,{"data-testid":"manageWorkspaceModal-warRoomsTabContent"})}):null,S[D.rF]?(0,j.jsx)(r.Tab,{basis:0,label:D.ys[D.rF],"data-testid":"manageWorkspaceModal-nodesTab","data-ga":"manage-space::click-tab::nodes-tab",isMenuItem:!0,children:(0,j.jsx)(hi,{"data-testid":"manageWorkspaceModal-nodesTabContent"})}):null,S[D.KV]?(0,j.jsx)(r.Tab,{basis:0,"data-testid":"manageWorkspaceModal-usersTab","data-ga":"manage-space::click-tab::users-tab",label:D.ys[D.KV],isMenuItem:!0,children:(0,j.jsx)(gi,{"data-testid":"manageWorkspaceModal-usersTabContent"})}):null,S[D.A8]?(0,j.jsx)(r.Tab,{basis:0,label:D.ys[D.A8],"data-testid":"manageWorkspaceModal-notificationsTab","data-ga":"manage-space::click-tab::notifications-tab",isMenuItem:!0,children:(0,j.jsx)(xi,{})}):null,S[D.bO]?(0,j.jsx)(r.Tab,{basis:0,"data-testid":"manageWorkspaceModal-billingTab","data-ga":"manage-space::click-tab::billing-tab",label:D.ys[D.bO],isMenuItem:!0,children:(0,j.jsx)(pi,{"data-testid":"manageWorkspaceModal-billingTabContent"})}):null,S[D.Tv]?(0,j.jsx)(r.Tab,{basis:0,"data-testid":"manageWorkspaceModal-integrationsTab","data-ga":"manage-space::click-tab::integrations-tab",label:D.ys[D.Tv],isMenuItem:!0,children:(0,j.jsx)(bi,{flavour:ai.D_.settingsPage,containerProps:{padding:[0]},"data-testid":"manageWorkspaceModal-integrationsTabContent"})}):null,S[D.$d]?(0,j.jsx)(r.Tab,{basis:0,"data-testid":"manageWorkspaceModal-configurationsTab","data-ga":"manage-space::click-tab::configurations-tab",label:D.ys[D.$d],isMenuItem:!0,children:(0,j.jsx)(ji,{})}):null]}):(0,j.jsx)(ni,{})]})}):null}),vi=()=>{const e=(0,s.ap)("id"),t=(0,Oe.ES)(e)?"virtual":"default",n=D.DT[t],{pathname:i,state:l}=(0,a.zy)();return(0,j.jsxs)(a.BV,{children:[(0,j.jsx)(a.qh,{path:"/",element:(0,j.jsx)(a.C5,{state:l,to:{pathname:`${i}/${n}`}})}),(0,j.jsx)(a.qh,{path:":settingsTab/*",element:(0,j.jsx)(fi,{})})]})}},36348(e,t,n){"use strict";n.d(t,{A:()=>C});var a=n(96540),s=n(38429),i=n(76667),l=n(46587),o=n(86706),r=(n(98992),n(54520),n(30569)),d=n(84929),c=n(63872),u=n(77389),m=n(99236),h=n(24609),g=n(32874),x=n(15624),p=n(49916);var b=n(64999),j=n(74848);const f="leave-space-dialog",v="leaveSpaceDialog",C=e=>{let{id:t,name:n,onClose:C}=e;const y=(0,i.Zp)(),w=(0,l.uW)("id"),T=(0,o.Gi)(),A=(0,o.i3)(),S=(0,o.pB)(),I=(e=>{const[,t]=(0,c.A)();return(0,r.yF)((0,a.useCallback)(async(n,a,s)=>{let{currentUserId:i,onSuccess:l,onError:r}=s;const c=await n((0,h.nC)("ids")),b=c.filter(t=>e!==t),j=e=>{a(e,d.Ut)},[f]=b;if(!f)return void t({header:"Spaces",text:m.sh.leave});const{slug:v}=f&&await n((0,x.Ay)(f));a((0,h.nC)("ids"),b),a(g.A,t=>t.filter(t=>t!==e));try{await(0,u.XY)(e,[i]),l&&l(v),(0,o.Z8)(j,e),(0,p.Is)(j,e),j((0,x.Ay)(e))}catch(C){a((0,h.nC)("ids"),c),r&&r()}},[e,t]))})(t),k=(0,b.A)(t),F=(0,a.useCallback)(e=>y(`/spaces/${e}`),[]),P=1===T.length,M=1===A.length&&S,$=P?{confirmLabel:"Yes, leave","data-ga":`${f}-last-member`,"data-testid":`${v}LastMember`,handleConfirm:()=>k({onSuccess:F}),message:(0,j.jsxs)(j.Fragment,{children:["If you leave, space ",(0,j.jsx)("strong",{children:n})," will be deleted immediately.",(0,j.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${n} space`}:M?{confirmLabel:"Give rights","data-ga":`${f}-last-admin`,"data-testid":`${v}LastAdmin`,handleConfirm:()=>y("users"),isConfirmPositive:!0,message:(0,j.jsxs)(j.Fragment,{children:["You are the last admin of ",(0,j.jsx)("strong",{children:n})," space. Please give admin rights to another member so you can leave this space."]}),title:`Leave ${n} space`}:{confirmLabel:"Yes, leave","data-ga":f,"data-testid":v,handleConfirm:()=>I({currentUserId:w,onSuccess:F}),message:(0,j.jsxs)(j.Fragment,{children:["You are about to leave ",(0,j.jsx)("strong",{children:n})," space.",(0,j.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${n} space`};return(0,j.jsx)(s.ConfirmationDialog,{handleDecline:C,...$})}},43581(e,t,n){"use strict";n.d(t,{A:()=>l});var a=n(22794),s=n(34412),i=n(74848);const l=e=>{let{children:t}=e;return(0,i.jsx)(a.A,{config:{nodes:s.A},children:t})}},68534(e,t,n){"use strict";n.d(t,{A:()=>s});n(98992),n(81454);var a=n(24609);const s=()=>{const e=(0,a.ap)(),{warnings:t}=e||{};return{warnings:(t||[]).map(e=>{let{kind:t,text:n,urgency:a}=e;return{warningKey:t,warningLevel:a||"info",text:n}})}}},97200(e,t,n){var a=n(13222),s=0;e.exports=function(e){var t=++s;return a(e)+t}}}]);