/usr/share/netdata/web/v3
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="72451796-4b8b-47b7-bd1f-b1d52248a6fd",e._sentryDebugIdIdentifier="sentry-dbid-72451796-4b8b-47b7-bd1f-b1d52248a6fd")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"f8a093c851f250f6860aa19890017cfe4325d631"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[3457,5187],{10853:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});n(98992),n(72577);var a=n(96540),i=n(46587),s=n(99728),l=n(24285),o=n(86706),r=(n(37550),n(32370)),d=n(73087),c=n(68399);var u=n(18739),m=n(53142),g=n(18387),h=n(19707);const x=e=>{const t=new Date(e||void 0).toLocaleDateString();return"Invalid Date"!==t?t:null},p=()=>{const e=(0,o.gk)(),t=(0,o.bj)(),{id:n,isAnonymous:p}=(0,i.uW)(),b=(0,a.useMemo)((()=>!!(t||[]).find((e=>e.id===n&&"creator"===e.joinMethod))),[n,t]),j=(0,h.I)(),{loaded:f,value:v,refresh:C}=(0,u.JN)(),{isFailure:y}=(0,m.A)(),{slug:w,trialEndsAt:T,paymentProvider:A}=v||{},S=(0,a.useMemo)((()=>(e=>{if(!e)return null;const t=new Date(e)-new Date;return Math.ceil(t/864e5)})(T)),[T]),I=f&&!!T&&!j,k=(0,s.JT)("billing:Manage"),[F]=(0,l.ng)("trialModalDismissed"),P=e&&b&&k&&(I||y)&&!localStorage.getItem(c.$B)&&!F,[M,$]=(0,a.useState)(localStorage.getItem(c.TB)),[L,R]=(0,a.useState)(),N=(D=S)>8?"default":D>3?"warning":"critical";var D;const B=!p&&k;return(0,a.useEffect)((()=>{const e=((e,t,n,a)=>{if(t<0)return!1;const i=new Date(e||void 0);if(!(0,r.f)(i))return!1;const s=new Date(a||void 0);if(!(0,r.f)(s))return t<=c.w1;const{days:l}=(0,d.F)({start:s,end:i});return n.some((e=>e>=t&&e<l))})(T,S,c.ml,M);R(e)}),[T,S,M]),{trialWelcomeVisible:P,sidebarWarningVisible:I,bannerVisible:L,dismissBanner:()=>{const e=(new Date).toISOString();$(e),localStorage.setItem(c.TB,e)},daysRemaining:S,trialEndsAt:x(T),trialEndsAtRaw:T,type:N,canUpgrade:B,onTrial:I,refreshPlan:C,planIsFreeOrEarlyBird:(0,g.Kj)(w),paymentProvider:A}}},15679:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var a=n(92415),i=n(45087),s=n(74848);const l=(o=e=>{let{value:t,...n}=e;return(0,s.jsx)(a.Pill,{"data-testid":"pill-content",flavour:"neutral",size:"small",...n,children:t})},e=>{let{noTooltip:t,...n}=e;return t?(0,s.jsx)(o,{...n}):(0,s.jsx)(i.A,{content:n.value,children:(0,s.jsx)(a.Box,{children:(0,s.jsx)(o,{...n})})})});var o},36348:(t,n,a)=>{"use strict";a.d(n,{A:()=>y});var i=a(96540),s=a(92415),l=a(88934),o=a(46587),r=a(86706),d=(a(98992),a(54520),a(30569)),c=a(84929),u=a(63872),m=a(77389),g=a(99236),h=a(24609),x=a(32874),p=a(15624),b=a(49916);var j=a(64999),f=a(74848);const v="leave-space-dialog",C="leaveSpaceDialog",y=t=>{let{id:n,name:a,onClose:y}=t;const w=(0,l.Zp)(),T=(0,o.uW)("id"),A=(0,r.Gi)(),S=(0,r.i3)(),I=(0,r.pB)(),k=(t=>{const[,n]=(0,u.A)();return(0,d.yF)((0,i.useCallback)((async(a,i,s)=>{let{currentUserId:l,onSuccess:o,onError:d}=s;const u=await a((0,h.nC)("ids")),j=u.filter((e=>t!==e)),f=e=>{i(e,c.Ut)},[v]=j;if(!v)return void n({header:"Spaces",text:g.sh.leave});const{slug:C}=v&&await a((0,p.Ay)(v));i((0,h.nC)("ids"),j),i(x.A,(e=>e.filter((e=>e!==t))));try{await(0,m.XY)(t,[l]),o&&o(C),(0,r.Z8)(f,t),(0,b.Is)(f,t),f((0,p.Ay)(t))}catch(e){i((0,h.nC)("ids"),u),d&&d()}}),[t,n]))})(n),F=(0,j.A)(n),P=(0,i.useCallback)((e=>w(`/spaces/${e}`)),[]),M=1===A.length,$=1===S.length&&I,L=M?{confirmLabel:"Yes, leave","data-ga":`${v}-last-member`,"data-testid":`${C}LastMember`,handleConfirm:()=>F({onSuccess:P}),message:(0,f.jsxs)(f.Fragment,{children:["If you leave, space ",(0,f.jsx)("strong",{children:a})," will be deleted immediately.",(0,f.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${a} space`}:$?{confirmLabel:"Give rights","data-ga":`${v}-last-admin`,"data-testid":`${C}LastAdmin`,handleConfirm:()=>w("users"),isConfirmPositive:!0,message:(0,f.jsxs)(f.Fragment,{children:["You are the last admin of ",(0,f.jsx)("strong",{children:a})," space. Please give admin rights to another member so you can leave this space."]}),title:`Leave ${a} space`}:{confirmLabel:"Yes, leave","data-ga":v,"data-testid":C,handleConfirm:()=>k({currentUserId:T,onSuccess:P}),message:(0,f.jsxs)(f.Fragment,{children:["You are about to leave ",(0,f.jsx)("strong",{children:a})," space.",(0,f.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${a} space`};return(0,f.jsx)(s.ConfirmationDialog,{handleDecline:y,...L})}},37785:(e,t,n)=>{"use strict";n.d(t,{A:()=>r,s:()=>o});var a=n(18739),i=n(18387),s=n(50979);const l=e=>{const{value:t}=(0,a.lU)();if(!t?.[e])return{};const n=Object.keys(t[e]).sort(i.M7)[0];return{id:t[e][n]?t[e][n][0]?.id:null,version:n}},o=()=>l(s.VH.homelab),r=()=>l(s.VH.free)},42711:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var a=n(96540),i=n(63950),s=n.n(i),l=n(92415),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=s(),...i}=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,{...i,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]}),"."]})}},43581:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var a=n(22794),i=n(34412),s=n(74848);const l=e=>{let{children:t}=e;return(0,s.jsx)(a.A,{config:{nodes:i.A},children:t})}},43891:(e,t,n)=>{"use strict";n.d(t,{K:()=>s,P:()=>l});var a=n(33185),i=n(92415);const s=a.default.ul.withConfig({displayName:"styled__StyledList",componentId:"sc-z791f1-0"})(["list-style:disc outside none;margin-left:16px;"]),l=(0,a.default)(i.ModalContent).attrs((e=>{let{isMobile:t}=e;return{width:t?{base:"95vw"}:{}}})).withConfig({displayName:"styled__TrialWelcomeModalContent",componentId:"sc-z791f1-1"})([""])},45187:(e,t,n)=>{"use strict";n.d(t,{R:()=>r,H:()=>d});var a=n(34843),i=n(52035);const s=(0,i.eU)(!1),l=(0,i.eU)(!1);var o=n(96540);const r=()=>{const[e,t]=(0,a.fp)(s);return{isInitialized:e,init:(0,o.useCallback)((()=>t(!0)),[t])}},d=()=>{const[e,t]=(0,a.fp)(l);return{isActive:e,activate:(0,o.useCallback)((()=>t(!0)),[t]),deactivate:(0,o.useCallback)((()=>t(!1)),[t])}}},52365:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var a=n(43329);function i(e){return(0,a.w)(e,Date.now())}},60266:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var a=n(96540),i=n(24609),s=n(10853);var l=n(6304);const o=e=>{const t=new Date(e||void 0).toDateString();return"Invalid Date"!==t?t:null},r=()=>{const e=(0,i.ap)(),t=(0,a.useMemo)((()=>`dismissedBumpedWarningKey_${e?.id}`),[e?.id]),[n,,,r]=(0,l.A)(!localStorage.getItem(t)),{trialEndsAtRaw:d}=(0,s.A)(),c=d&&"EarlybirdAndCommunitySunset"==e?.metadata?.joinTrialCode,u=n&&d&&c,m=c?"EARLYB25":null,g=(0,a.useCallback)((()=>{localStorage.setItem(t,!0),r()}),[r,t]);return{isModalVisible:u,isEarlybirdAndCommunitySunset:c,coupon:m,trialEndsAt:o(d),onClose:g}}},64903:(e,t,n)=>{"use strict";n.d(t,{A:()=>j});var a=n(92415),i=n(96540),s=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,s.A)(),[u,m]=(0,i.useState)(l(t,a)),[g,h]=(0,i.useState)();return{inputProps:(0,i.useMemo)((()=>r?{type:"number",min:n,max:a}:{type:"text"}),[r,n,a]),renderedValue:u,error:g,onInput:(0,i.useCallback)((e=>{const t=e?.target?.value,n=parseInt(t,10);n>a?h(`Maximum value is ${a}`):h();const i=Math.min(n,a);o(i),m(t)}),[a,o,m,h]),onFocus:d,onBlur:(0,i.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),g=e=>{let{value:t,onChange:n,min:i=d.default,max:s=r.default,inputProps:l={},...c}=e;const{inputProps:g,renderedValue:h,error:x,onInput:p,onFocus:b,onBlur:j}=o({value:t,min:i,max:s,onChange:n});return(0,u.jsx)(m,{tooltip:x,tooltipProps:{align:"bottom"},children:(0,u.jsx)(a.TextInput,{width:{base:20},value:h,onInput:p,onFocus:b,onBlur:j,size:"small",error:x,hideErrorMessage:!0,...l,...g,...c})})},h=e=>{let{value:t,onChange:n,applyOnChange:a}=e;const{hours:s,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,i.useState)(s),[c,u]=(0,i.useState)(l),[m,g]=(0,i.useState)(o),h=(0,i.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,i.useEffect)((()=>{a&&h()}),[a,r,c,m,h]),{hours:r,minutes:c,seconds:m,onHoursChange:d,onMinutesChange:u,onSecondsChange:g,onApply:h}};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:i,minValues:s=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}=h({value:n,onChange:a,applyOnChange:i});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)(g,{label:"Hours",value:v,min:s.hours,max:l.hours,onChange:w,disabled:j,inputProps:c,...f}),(0,u.jsx)(g,{label:"Minutes",value:C,min:s.minutes,max:l.minutes,onChange:T,disabled:j,inputProps:c,...f}),o?null:(0,u.jsx)(g,{label:"Seconds",value:y,min:s.seconds,max:l.seconds,onChange:A,disabled:j,inputProps:c,...f}),i?null:(0,u.jsx)(b,{label:"Apply",onClick:S,small:!0,payload:{info:"Apply reachability notifications delay",testId:t},...m})]})}},68399:(e,t,n)=>{"use strict";n.d(t,{$B:()=>o,TB:()=>r,W1:()=>i,ml:()=>s,ue:()=>a,w1:()=>l});const a={default:"successSemi",warning:"warningSemi",critical:"errorSemi"},i={default:{background:"successSemi",border:"success"},warning:{background:"warningSemi",border:"warning"},critical:{background:"errorSemi",border:"error"}},s=[10,3,2,1],l=12,o="dismissedTrialWelcome",r="dismissedTrialWarningDate"},68534:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});n(98992),n(81454);var a=n(24609);const i=()=>{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}}))}}},71282:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var a=n(96540),i=n(63950),s=n.n(i),l=n(92415),o=n(18739),r=n(63872),d=n(60908),c=n(94404),u=n(3319),m=n(6304),g=n(37785),h=n(74848);const x=(0,c.A)(l.Button),p=e=>{let{onConfirm:t,onDecline:n=s(),onCancellingEnd:i=s()}=e;const c=(0,o.M4)(),[p,b]=(0,r.A)(),{id:j}=(0,g.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((()=>{i(),w()}))}),[j,v]),A=(0,a.useCallback)((()=>{t?t():T()}),[t,T]);return(0,h.jsx)(l.Modal,{backdropProps:{backdropBlur:!0},children:(0,h.jsx)(d.Ay,{feature:"TrialOptOut",children:(0,h.jsxs)(l.ModalContent,{width:{base:140},children:[(0,h.jsx)(l.ModalHeader,{children:(0,h.jsx)(l.Flex,{gap:2,alignItems:"center",children:(0,h.jsx)(l.H4,{children:"Opt out of Free Trial"})})}),(0,h.jsx)(l.ModalBody,{children:C?(0,h.jsx)(l.Flex,{height:"100px",children:(0,h.jsx)(l.TextBig,{children:"Changing billing plan..."})}):(0,h.jsxs)(l.Flex,{gap:2,column:!0,children:[(0,h.jsx)(l.H3,{children:"Are You Sure?"}),(0,h.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,h.jsx)(l.TextBig,{children:"By opting out, you will be downgraded to the community plan immediately."})]})}),(0,h.jsx)(l.ModalFooter,{children:(0,h.jsxs)(l.Flex,{justifyContent:"end",gap:4,padding:[1,2],children:[(0,h.jsx)(x,{feature:"TrialOptOut",label:"Yes, I am sure!",flavour:"hollow",small:!0,onClick:A,disabled:!j||C,textTransform:""}),(0,h.jsx)(x,{feature:"TrialOptOut",label:"No, I want the trial!",small:!0,onClick:n,disabled:C,textTransform:""})]})})]})})})}},77058:(e,t,n)=>{"use strict";n.d(t,{A:()=>b});var a=n(96540),i=n(92415),s=n(63950),l=n.n(s),o=n(10853),r=(n(98992),n(54520),n(83268)),d=n(81391),c=n(24013);const u=()=>{const e=(0,d.n)("id"),t=(0,r.gr)(e,"loaded"),n=(0,r.gr)(e,"ids");return{loaded:t,windowsNodes:((0,c.Gt)(n)||[]).filter((e=>{let{os:t}=e;return"windows"===t?.id?.toLowerCase()}))}};var m=n(60266),g=n(99243),h=n(74848);const x={banner:{color:"main"},sidebar:{lineHeight:"1.6",color:"main"},freePlanUpgrade:{lineHeight:"1.6",color:"main"},billing:{color:"textLite"}},p=e=>{let{canUpgrade:t,onUpdateClick:n=l(),children:a,...s}=e;return t?(0,h.jsx)(i.Box,{"data-testid":"upgrade-to-business-banner",onClick:n,as:i.Text,cursor:"pointer",textDecoration:"underline",color:"main",...s,children:a}):null},b=e=>{let{flavour:t,couponRemainingDays:n,onUpdateClick:s=l()}=e;const{daysRemaining:r,canUpgrade:d,trialEndsAt:c}=(0,o.A)(),{isEarlybirdAndCommunitySunset:b}=(0,m.A)(),{loaded:j,windowsNodes:f}=u(),v=(0,a.useMemo)((()=>({isCoupon:n>0,isEarlybirdAndCommunitySunset:b,isBanner:"banner"===t,isSidebar:"sidebar"===t,isBilling:"billing"===t,isFreePlanUpgrade:"freePlanUpgrade"===t})),[t,n]);return(0,h.jsx)(i.Flex,{justifyContent:v.isBilling?"start":"center",alignItems:"center",width:"100%",gap:2,children:v.isCoupon?(0,h.jsxs)(i.Flex,{column:!0,children:[(0,h.jsx)(i.Text,{...x[t],fontSize:"10px",strong:!0,children:"BLACK FRIDAY OFFER"}),(0,h.jsx)(g.Te,{...x[t],fontSize:"38px",lineHeight:.8,strong:!0,children:"20% off"})]}):v.isEarlybirdAndCommunitySunset?(0,h.jsxs)(i.Flex,{column:!0,gap:1,alignItems:"center",children:[(0,h.jsxs)(i.Text,{...x[t],textAlign:"center",strong:!0,...v.isBanner?{}:{fontSize:"10px"},children:["Thank you for your support!"," ",v.isBanner?(0,h.jsx)(p,{canUpgrade:d,onUpdateClick:s,children:"Upgrade"}):null]}),(0,h.jsx)(i.Text,{...x[t],color:"primary",fontSize:"22px",lineHeight:.8,strong:!0,children:"25% Lifetime off"})]}):v.isFreePlanUpgrade?(0,h.jsx)(i.Text,{...x[t],children:"Upgrade your plan for unlimited access and Business features."}):(0,h.jsxs)(i.Flex,{column:!0,gap:1,justifyContent:"center",children:[(0,h.jsxs)(i.Text,{...x[t],children:["You have ",(0,h.jsx)(i.Text,{strong:!0,...x[t],children:`${r} days`})," ","left to explore all the features of Netdata Business."," ",v.isBilling&&(0,h.jsxs)(h.Fragment,{children:["Trial ends at"," ",(0,h.jsx)(i.Text,{strong:!0,...x[t],children:c}),"."," "]}),v.isBanner?(0,h.jsx)(p,{canUpgrade:d,onUpdateClick:s,children:"Consider upgrading for unlimited access."}):(0,h.jsx)(h.Fragment,{children:"Consider upgrading for unlimited access."})]}),j&&f.length?(0,h.jsxs)(i.Flex,{alignItems:"center",justifyContent:"center",gap:1,children:[(0,h.jsx)(i.Icon,{name:"warning_triangle",color:"warning"}),(0,h.jsxs)(i.Text,{...x[t],children:["Your"," ",(0,h.jsx)(i.Text,{strong:!0,...x[t],children:"Windows"})," ","nodes will be restricted after the trial period ends."]})]}):null]})})}},80320:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var a=n(92415),i=n(95263),s=n(74848);const l=e=>{let{"data-testid":t="input",description:n,isRequired:l,onChange:o,title:r,...d}=e;return(0,s.jsxs)(a.Flex,{column:!0,"data-testid":t,flex:"grow",gap:1,children:[(0,s.jsx)(i.A,{"data-testid":t,description:n,isRequired:l,title:r}),(0,s.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:g,...h}=e;return(0,s.jsxs)(a.Flex,{column:!0,"data-testid":t,flex:"grow",gap:1,children:[(0,s.jsx)(i.A,{"data-testid":t,description:n,isRequired:d,title:g}),(0,s.jsx)(a.Select,{"data-testid":`${t}-field`,menuPortalTarget:document.body,onChange:e=>c(e),menuPlacement:"auto",...h}),Object.values(o?.[h.value?.value]||{}).map((e=>{let{getValue:n,id:a,onChange:i,...o}=e;return(0,s.jsx)(x,{"data-ga":l(`${r}-${a}-${o.component}`),"data-testid":`${t}-${a}`,id:a,onChange:i({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),g=n(52838);const h={default:()=>null,pairs:e=>{let{componentPairs:t,"data-testid":n="pairs",description:l,getDataGa:o,id:d,isRequired:u,placeholder:h,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,s.jsxs)(a.Flex,{column:!0,"data-testid":n,gap:1,children:[(0,s.jsxs)(a.Flex,{alignItems:"center",justifyContent:"between",children:[(0,s.jsx)(i.A,{"data-testid":n,description:l,isRequired:u,title:b}),t.map((e=>{const i=(0,g.$Q)(e);return(0,s.jsx)(a.Button,{"data-ga":o(`${d}-${i}-add`),"data-testid":`${n}-${i}Add`,label:1===t.length?"Add":`Add ${i}`,flavour:"hollow",icon:"plus",onClick:()=>(e=>f((t=>({...t,[m()("pair_")]:{key:"",components:e,value:""}}))))(e)},i)}))]}),Object.entries(j).map((e=>{let[t,{key:i,components:l,value:r}]=e;const[u,m]=l,x=(0,g.$Q)(l);return(0,s.jsxs)(a.Flex,{alignItems:"end",gap:2,children:[(0,s.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:i,placeholder:h,title:"Key"}),(0,s.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:h,title:"Value"}),(0,s.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=h[t]||h.default;return(0,s.jsx)(a,{...n})},p=x},93457:(t,n,a)=>{"use strict";a.r(n),a.d(n,{default:()=>ps});var i=a(88934),s=a(24609),l=a(96540),o=a(7960),r=a(33185),d=a(92415),c=a(44926),u=a(32788),m=a(29263),g=a(85005),h=(a(98992),a(54520),a(81454),a(99728)),x=a(49916),p=a(6304),b=a(73467),j=a(71236),f=a(74848);const v=[{id:"name",accessor:"name",header:"Name",cell:e=>{let{getValue:t,row:{original:{isMember:n}}}=e;const a=t(),i=(0,h.JT)("room:ReadAll");return(0,f.jsxs)(d.Flex,{alignItems:"center",children:[i&&n&&(0,f.jsx)(b.A,{margin:[0,1,0,0]}),(0,f.jsx)(d.Text,{margin:i&&!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,f.jsx)(j.A,{flavour:"room",silencing:t()})}}];a(3949);var C=a(30569),y=a(84929),w=a(50433),T=a(258),A=a(19186),S=a(68781),I=a(93933);const k=t=>(0,C.yF)((0,l.useCallback)((async function(n,a,i){let{onSuccess:s,onFail:l}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=await n((0,x.$e)({id:t,key:"ids"})),r=i.map((e=>{let{id:t}=e;return t})),d=o.filter((e=>!r.includes(e)));a((0,x.$e)({id:t,key:"ids"}),d);const c=await Promise.all(d.map((e=>n((0,A.LS)({id:e})))));try{if(await(async(e,t)=>Promise.all(t.map((t=>(0,T.HN)(e,t)))))(t,r),a(S.yz,(0,I.Pb)(c)),r.forEach((e=>a((0,x.Oy)(t),e))),i.forEach((e=>{let{id:n,slug:i}=e;a((0,A.LS)({id:n}),y.Ut),a((0,S.x4)([t,i]),y.Ut)})),s&&s(),i.length>1)(0,w.r0)("Rooms were successfully deleted from Space!");else{const[e]=i;(0,w.r0)(`Room ${e.name} was successfully deleted!`)}}catch(e){a((0,x.$e)({id:t,key:"ids"}),o),l&&l(e)}}),[t]));var F=a(8363);const P=e=>{let{spaceId:t,spaceName:n,startIsCreating:a}=e;const o=k(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,F.kI)(t[0].name):(0,F.kI)(n)},x=(e,t)=>{const a=t.length;if(!a)return"";const i={...1===a?{name:t[0].name}:{roomsLength:a},spaceName:n};return(0,f.jsx)(F.rj,{...i})},{pathname:p}=(0,i.zy)(),b=(0,s.bq)(),j=(0,i.Zp)(),v=(0,l.useCallback)((e=>j(`${p}/${e}`)),[p,j]),C=(0,l.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};j(`/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,f.jsx)(F.rj,{name:e.name,spaceName:n}),confirmationTitle:e=>(0,F.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,l.useMemo)((()=>({addEntry:{dataGa:"manage-rooms::click::add-room",handleAction:a,isDisabled:!c,tooltipText:"Create room"},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}},M=()=>{const e=(0,x.DL)(),t=(0,h.JT)("room:Delete"),n=e.filter((e=>!e.isAgent)).map((e=>({...e,disabled:e.untouchable||!t}))),[a,i]=(0,l.useState)(""),o=(0,s.ap)("name"),r=(0,s.ap)("id"),[d,,c,u]=(0,p.A)(),[,m]=(0,l.useState)([]),{bulkActions:g,rowActions:b}=P({startIsCreating:c,spaceId:r,spaceName:o});return{roomList:n,globalFilter:a,spaceName:o,spaceId:r,isCreating:d,rowActions:b,bulkActions:g,columns:v,startIsCreating:c,stopIsCreating:u,setGlobalFilter:i,onRowSelected:m,dataGa:"manage-rooms"}};var $=a(60908);const L=e=>{const{roomList:t,spaceName:n,isCreating:a,columns:i,setGlobalFilter:s,stopIsCreating:l,onRowSelected:o,rowActions:r,bulkActions:c,dataGa:u}=M();return(0,f.jsxs)($.Ay,{tab:"Rooms",children:[(0,f.jsxs)(d.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...e,children:[(0,f.jsxs)(d.H3,{children:["Rooms of ",n]}),(0,f.jsx)(d.Table,{onSearch:s,onRowSelected:o,enableSorting:!0,dataColumns:i,enableSelection:!0,data:t,bulkActions:c,rowActions:r,dataGa:u,testPrefixCallback:e=>e.name})]}),a&&(0,f.jsx)(g.n,{onClose:l})]})};var R=a(92368),N=a(98545),D=a(6387),B=a(80372),_=a(86663),E=a(83268),U=a(24013);const V=()=>{const e=(0,E.CK)();return{nodes:(0,U.Gt)(e).map((e=>({...e,disabled:e.hasAccessibleData})))||[],nodeIds:e}};var H=a(37156);const O=(0,o.A)((()=>a.e(2634).then(a.bind(a,12634))),"Rules"),W=(0,l.memo)((e=>{let{roomUntouchable:t,...n}=e;const{nodes:a}=V({roomUntouchable:t});return(0,f.jsx)($.Ay,{tab:"Room::Nodes",children:(0,f.jsxs)(d.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...n,children:[(0,f.jsx)(l.Suspense,{fallback:"",children:(0,f.jsx)(O,{roomUntouchable:t})}),(0,f.jsx)(H.A,{flavour:"roomNodes",showClaimNodeOnEmptySpace:!0,enableSelection:!0,customNodes:a,roomUntouchable:t})]})})}));var Y=a(47410),q=a(82505),J=a(83488),z=a.n(J),G=a(66245),K=a.n(G),Z=a(86706),Q=a(63231),X=a(6084);const ee=[{id:"user",accessorKey:"user",header:"Name",cell:e=>{let{cell:t}=e;const{avatarURL:n,name:a}=t.row.original;return(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(X.A,{src:n,title:a}),(0,f.jsx)(d.TextSmall,{children:a})]})}},{id:"email",accessorKey:"email",header:"Email",cell:e=>{let{getValue:t}=e;return(0,f.jsx)(d.TextSmall,{children:t()})}}],te=[{id:"user",desc:!1}],ne=e=>{let{setSelected:t}=e;const n=(0,Z.Gi)(),a=(0,q.lb)(),i=(0,l.useMemo)((()=>K()(n,a)),[n,a]),s=(0,l.useCallback)((e=>{t(e.map((e=>e.id)))}),[]),o=(0,Q.Uv)(i);return(0,f.jsx)(d.Flex,{alignItems:"start",padding:[1],overflow:{horizontal:"hidden",vertical:"auto"},children:(0,f.jsx)(d.Table,{dataColumns:ee,data:o,autoResetSelectedRows:!0,sortableBy:te,onSearch:z(),onRowSelected:s,enableSelection:!0,enableSorting:!0})})};var ae=a(94404);const ie=(0,ae.A)(d.Button),se=e=>{let{onAdd:t,onClose:n,selected:a,error:i,name:s}=e;return(0,f.jsxs)(d.Flex,{alignItems:"center",justifyContent:"between",children:[i?(0,f.jsxs)(d.Text,{color:"error",children:["Select at least 1 user to add to ",s]}):(0,f.jsx)("div",{}),(0,f.jsxs)(d.Flex,{gap:2,children:[(0,f.jsx)(d.Button,{neutral:!0,flavour:"hollow",onClick:n,label:"Cancel"}),(0,f.jsx)(ie,{disabled:!a.length,label:`Add ${a.length} members`,onClick:t})]})]})};var le=a(76238),oe=a(80269),re=a(64091),de=a(40298),ce=a(12724),ue=a(51900),me=a(63872),ge=a(63936),he=a(79748),xe=a(33821);const pe=e=>{let{email:t}=e;return(0,re.B9)(t)},be={header:"Invitations",text:"Invitations successfully sent!"},je=e=>{const{id:t,slug:n}=(0,s.ap)(),a=(0,A.ID)(),i=(0,A.wz)(a,"name"),[o,r]=(0,l.useState)([]),[,,c,u]=(0,de.gg)(t),[,m]=(0,me.A)(),[g,x]=(0,l.useState)(),[p,b]=(0,l.useState)(),j=e=>{const{header:t,text:n}=e||be,a=(0,ce.UI)({header:t,text:n,success:!0});ue.A.success(a,{context:"manageInvitations"}),r([]),x(Math.random())},v=(0,l.useCallback)((()=>{const e=o.filter(pe).map((e=>({email:e.email,name:e.name,role:p,roomIDs:[a]}))),t=`${window.envSettings.cloudUrl}/spaces/${n}/join-space`;c(e,t,{onSuccess:j,onError:m})}),[o,a,p]),C=(0,h._s)();return(0,f.jsxs)(d.Flex,{column:!0,...e,children:[(0,f.jsxs)(d.H4,{children:["Send invitations to ",i," room"]}),(0,f.jsx)(le.BZ,{children:"TIP: You can send more invitations at once, separate each with a comma."}),(0,f.jsx)(oe.y,{invitations:o,setInvitations:r},g),(0,f.jsx)(d.H5,{margin:[4,0,0],children:"Role"}),(0,f.jsxs)(le.BZ,{children:["Choose a role for invited user."," ",(0,f.jsx)(he.A,{href:xe.S0,target:"_blank",rel:"noopener noreferrer",Component:d.TextSmall,children:"Learn more"})]}),(0,f.jsx)(ge.A,{availableRoles:C,dataGA:"invite-to-room",dataTestId:"invite-selectRole",onChange:e=>{b(e.target.value)},value:p}),(0,f.jsx)(d.Box,{alignSelf:"end",margin:[4,0,0],children:(0,f.jsx)(d.Button,{label:"Send",onClick:v,disabled:0===o.length||!p,flavour:"hollow",isLoading:u})})]})},fe=e=>{let{onClose:t,room:n}=e;const[a,i]=(0,l.useState)([]),[s,o]=(0,l.useState)(!1),r=(0,q.n)(n.spaceId,n.id),c=(0,l.useCallback)((()=>{if(!a.length)return o(!0);o(!1),r(a),t()}),[a,r]);return(0,f.jsxs)(u.GO,{onClose:t,children:[(0,f.jsx)(m.z,{onClose:t,isSubmodal:!0,title:(0,f.jsxs)(f.Fragment,{children:["Manage room",(0,f.jsx)(d.TextBig,{color:"textLite",children:"\xa0/ Add Users"})]})}),(0,f.jsxs)(Y.U,{children:["Add users to room\xa0",n.name]}),(0,f.jsxs)(u.Yv,{children:[(0,f.jsx)(je,{margin:[0,0,4]}),(0,f.jsx)(d.Flex,{column:!0,flex:!0,overflow:"hidden",padding:[0,0,2,0],children:(0,f.jsx)(ne,{setSelected:i})}),(0,f.jsx)(se,{onClose:t,onAdd:c,selected:a,error:s,name:n.name})]})]})};var ve=a(96600),Ce=a(46587);const ye=e=>`Remove ${e}`,we=e=>{let{name:t,usersLength:n}=e;return n?1===n&&t?ye(t):`Remove ${a=n} ${1===a?"user":"users"}`:"";var a},Te=e=>{let{name:t,roomName:n}=e;return(0,f.jsxs)(f.Fragment,{children:["You are about to remove ",(0,f.jsx)("strong",{children:t})," from room ",(0,f.jsx)("strong",{children:n}),".",(0,f.jsx)("br",{}),"Are you sure you want to continue?"]})},Ae=e=>{let{roomName:t,usersLength:n}=e;const a=1===n?`${n} user`:`${n} users`;return(0,f.jsxs)(f.Fragment,{children:["You are about to remove ",(0,f.jsx)("strong",{children:a})," from room ",(0,f.jsx)("strong",{children:t}),".",(0,f.jsx)("br",{}),"Are you sure you want to continue?"]})},Se=e=>{let{name:t,roomName:n,usersLength:a}=e;return a?1===a&&t?(0,f.jsx)(Te,{name:t,roomName:n}):(0,f.jsx)(Ae,{roomName:n,usersLength:a}):""};var Ie=a(3319);const ke=e=>{let{spaceId:t,roomId:n,startIsInviting:a,canRemoveUser:i,untouchable:s}=e;const o=(0,q.zC)(t,n),r=(0,A.XA)("name"),{sendButtonClickedLog:d,isReady:c}=(0,Ie.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,l.useCallback)((()=>{a(),c&&d({label:"Invite users"},!0)}),[c,d]);return{rowActions:(0,l.useMemo)((()=>({remove:{confirmLabel:"Yes, remove",confirmationMessage:e=>(0,f.jsx)(Te,{name:e.name,roomName:r}),confirmationTitle:e=>ye(e.name),declineLabel:"Cancel",disabledTooltipText:e=>s?"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.":i?"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"}})),[ye,u,Te,r]),bulkActions:(0,l.useMemo)((()=>({addEntry:{handleAction:m,tooltipText:"Invite users"},remove:{confirmLabel:"Yes, remove",confirmationMessage:(e,t)=>(0,f.jsx)(Se,{name:t[0].name,roomName:r,usersLength:t.length}),confirmationTitle:(e,t)=>we({name:t[0].name,usersLength:t.length}),declineLabel:"Cancel",disabledTooltipText:e=>s?"It's not allowed to remove users from this room. Try removing them from the space.":e.length?i?"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,Se,r,a,we])}},Fe=e=>{let{untouchable:t}=e;const n=(0,l.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:i}=t();return(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(X.A,{src:a,title:`${n} - ${i||"email not set"}`}),(0,f.jsx)(d.TextSmall,{children:n})]})}},{id:"email",accessor:"email",header:"Email",width:300,align:"center",cell:e=>{let{getValue:t}=e;return(0,f.jsx)(d.TextSmall,{children:t()})}}]),[]),a=(0,q.di)(),i=(0,Ce.uW)("id"),o=(0,h.JT)("space:RemoveUser"),[r,c]=(0,l.useState)([]),[u,m]=(0,l.useState)(""),[g,,x,b]=(0,p.A)(),j=(0,s.ap)("id"),v=(0,A.ID)(),{rowActions:C,bulkActions:y}=ke({selectedRows:r,spaceId:j,roomId:v,startIsInviting:x,canRemoveUser:o,untouchable:t});return{columns:n,data:(0,l.useMemo)((()=>(0,ve.L)({data:a,currentUserId:i,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:i,data:s,columnVisibility:l,members:o,rowActions:r,bulkActions:c,isInviting:u,stopIsInviting:m,onRowSelected:g,setGlobalFilter:h,canRemoveUser:x}=Fe({untouchable:a});return(0,f.jsx)($.Ay,{tab:"Room::User",children:(0,f.jsxs)(d.Flex,{column:!0,height:"100%",overflow:"hidden",gap:3,...n,children:[(0,f.jsxs)(d.H3,{children:["Users in this room (",o.length,")"]}),(0,f.jsx)(d.Table,{enableSelection:!0,enableSorting:!0,columnVisibility:l,data:s,dataColumns:i,rowActions:r,bulkActions:c,onRowSelected:g,onSearch:h,testPrefixCallback:e=>e.name}),u&&(0,f.jsx)(fe,{onClose:m,room:t})]})})},Me={room:0,nodes:1,users:2},$e=(0,r.default)(d.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,i.Zp)(),t=(0,s.vt)(),{roomSlug:n,spaceSlug:a,settingsTab:o}=(0,i.g)(),r=(0,A.J_)(t,n),[c,u]=(0,l.useState)(Le.default);(0,N.A)({spaceId:t,id:r,...c}),(0,D.A)(t,r);const m=(0,h.JT)("room:ReadUsers"),g=(0,A.wz)(r),[x,p]=(0,l.useState)(g.name),{search:b}=(0,i.zy)(),{tab:j="room"}=_.parse(b),v=Me[j],[C,y]=(0,l.useState)(v),[w,T,S]=(0,d.useInputValue)({maxChars:255,value:g.description}),I=(0,l.useCallback)((()=>{e((0,i.tW)(B.bq,{spaceSlug:a,settingsTab:o}))}),[a,o]),k=(0,A.a8)(g.id,{shouldPersist:!0,onSuccess:I}),F=(0,l.useCallback)((()=>k({name:x,description:w})),[x,w,k]),P=(0,l.useCallback)((e=>{y(e),u(Le[e]||Le.default)}),[y,u]);return(0,f.jsxs)(d.Flex,{column:!0,justifyContent:"between",overflow:"hidden","data-testid":"manageRoom",flex:"1",height:"100%",children:[(0,f.jsxs)(d.Tabs,{"data-testid":"manageRoom-tabs",selected:C,onChange:P,TabContent:$e,height:"100%",position:"relative",overflow:"hidden",width:"100%",children:[(0,f.jsx)(d.Tab,{"data-testid":"manageRoom-roomTab",label:(0,f.jsx)(d.H5,{children:"Room"}),children:(0,f.jsx)(R.U,{roomName:x,setRoomName:p,roomDescription:w,setRoomDescription:T,charsDescIndicator:S,"data-testid":"manageRoom-roomTabContent",id:g.id,navigateToParent:I,onSaveClick:F})}),(0,f.jsx)(d.Tab,{"data-testid":"manageRoom-nodesTab",label:(0,f.jsx)(d.H5,{children:"Nodes"}),children:(0,f.jsx)(W,{roomUntouchable:g.untouchable,"data-testid":"manageRoom-nodesTabContent"})}),m&&(0,f.jsx)(d.Tab,{"data-testid":"manageRoom-usersTab",label:(0,f.jsx)(d.H5,{children:"Users"}),children:(0,f.jsx)(Pe,{"data-testid":"manageRoom-usersTabContent",room:g})})]}),C===Me.room&&(0,f.jsx)(d.Flex,{justifyContent:"end"})]})};var Ne=a(61841);const De=e=>{let{children:t}=e;return(0,Ne.TP)(),t},Be=e=>{let{children:t}=e;return(0,A.XA)().loaded?t:null},_e=()=>(0,f.jsxs)(i.BV,{children:[(0,f.jsx)(i.qh,{path:"/",element:(0,f.jsx)(L,{})}),(0,f.jsx)(i.qh,{path:":roomSlug",element:(0,f.jsx)(De,{children:(0,f.jsx)(Be,{children:(0,f.jsx)(Re,{})})})})]});var Ee=a(89942),Ue=a(39175),Ve=a(83864),He=a(41395),Oe=a(45087),We=a(74891);const Ye=(0,We.A)(d.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:i}=t();return(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(X.A,{src:a,title:`${n} - ${i||"email not set"}`}),(0,f.jsx)(d.TextSmall,{children:n})]})}},{id:"email",accessor:"email",header:"Email",width:300,align:"center",cell:e=>{let{getValue:t}=e;return(0,f.jsx)(d.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,f.jsxs)(d.Flex,{alignItems:"center",gap:1,children:[(0,f.jsx)(d.TextSmall,{strong:!0,children:(0,He.Zr)(t())}),n&&(0,f.jsx)(Oe.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,f.jsx)(d.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:i}=(0,l.useMemo)((()=>qe[n]||qe.default),[n]);return(0,f.jsx)(Ye,{flavour:"neutral",hollow:!0,tooltip:i,children:(0,f.jsx)(d.TextSmall,{children:a})})}}];a(8872);var ze=a(77389),Ge=a(95201),Ke=a(72884),Ze=a(31035);const Qe=t=>{const n=(0,Ke.t)();return(0,C.yF)((0,l.useCallback)((async function(a,i,s){let{onSuccess:l,onError:o}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=await a((0,Z.kd)({id:t,key:"ids"})),d=r.filter((e=>!e.includes(s)));i((0,Z.kd)({id:t,key:"ids"}),d);try{await(0,ze.XY)(t,s),(async e=>{let{cacheKeyPrefix:t,memberIds:n,spaceId:a}=e;const i=`${t}${(0,Ze.$)(a)}`;await(0,Ge.y)({key:i,handleResults:e=>e.results.filter((e=>!n.includes(e.id)))})})({cacheKeyPrefix:n,spaceId:t,memberIds:s}),l&&l()}catch(e){i((0,Z.kd)({id:t,key:"ids"}),r),o&&o()}}),[t]))},Xe=t=>(0,C.yF)((0,l.useCallback)((async function(n,a,i,s){let{onSuccess:l,onError:o}=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=await n((0,Q.Z6)(i)),d=await Promise.all(i.map((async e=>({mId:e,role:await n((0,Z.K2)({id:e,spaceId:t}))})))),{role:c,...u}=s;i.forEach((e=>{a((0,Q.m)({id:e}),(e=>({...e,...u})))})),c&&i.forEach((e=>{a((0,Z.K2)({id:e,spaceId:t}),c)}));try{await(async(e,t,n)=>Promise.all(t.map((async t=>await(0,ze.w5)(e,t,n)))))(t,i,s),l&&l()}catch(e){r.forEach((e=>{let{id:t,...n}=e;return a((0,Q.m)({id:t}),{id:t,...n})})),c&&d.forEach((e=>{let{mId:n,role:i}=e;return a((0,Z.K2)({id:n,spaceId:t}),i)})),o&&o()}}),[t])),et="change-user-role",tt="changeUserRole",nt=e=>{let{handleAction:t,ids:n,onClose:a}=e;const i=(0,Z.$D)(n),s=1===i.length?i[0]:null,o=(0,h._s)(),[r,c]=(0,l.useState)(s);return(0,f.jsx)(d.ConfirmationDialog,{confirmLabel:"Save","data-ga":et,"data-testid":tt,handleConfirm:()=>{t(r),a()},handleDecline:a,isConfirmDisabled:!r,isConfirmPositive:!0,message:(0,f.jsxs)(d.Flex,{gap:2,column:!0,children:[(0,f.jsxs)(d.TextSmall,{children:["Learn more about Netdata role-based access model on"," ",(0,f.jsx)(he.A,{href:xe.S0,target:"_blank",rel:"noopener noreferrer",Component:d.TextSmall,children:"our documentation"})]}),(0,f.jsx)(ge.A,{availableRoles:o,dataGA:et,dataTestId:tt,onChange:e=>{c(e.target.value)},value:r})]}),title:"Change roles"})},at=[{id:"id",accessor:"id"},{id:"name",accessor:"name",header:"Room"}];var it=a(55093);const st=e=>{let{loaded:t,rooms:n,error:a,setRoomIds:i}=e;const s=(0,l.useCallback)((e=>{const t=Object.entries(e).reduce(((e,t)=>{let[n,a]=t;return[...e,...a?[n]:[]]}),[]);i(t)}),[i]),o=(0,l.useMemo)((()=>t?n.reduce(((e,t)=>({...e,[t.id]:t.isMember})),{}):{}),[t,n]);return(0,l.useEffect)((()=>{if(t&&!a){const e=n.reduce(((e,t)=>[...e,...t.isMember?[t.id]:[]]),[]);i(e)}}),[t,n,a,i]),t?a?(0,f.jsx)(d.Flex,{alignItems:"center",justifyContent:"center",height:"200px",children:(0,f.jsx)(d.TextSmall,{children:a})}):(0,f.jsxs)(d.Flex,{column:!0,gap:2,height:{max:"300px"},children:[(0,f.jsx)(d.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,f.jsx)(d.Table,{data:n,dataColumns:at,columnVisibility:{id:!1},enableSorting:!0,enableSelection:!0,rowSelection:o,getRowId:e=>{let{id:t}=e;return t},onRowSelectionChange:s})]}):(0,f.jsx)(it.A,{background:"dropdown",title:"Loading rooms...",height:"200px"})};var lt=a(35800),ot=a(32052);const rt=e=>{let{memberId:t}=e;const n=(0,s.vt)(),[,a]=(0,Q.ZN)({memberId:t}),i=(0,l.useCallback)((e=>{a((t=>({...t,loaded:!0,value:e})))}),[a]),o=(0,l.useCallback)((e=>{a({...lt.yW,loaded:!0,error:e?.message||"Something went wrong"})}),[a]);(0,ot.A)((()=>({enabled:!!t,fetch:()=>(0,ze.Hw)(n,t),onSuccess:i,onFail:o})),[n,t])};var dt=a(30811);const ct=e=>{let{data:t,onClose:n}=e;const[a,i]=(0,l.useState)([]),s=t?.user?.id,[o,r]=(0,me.A)(),c=(0,dt.l)();rt({memberId:s});const[u]=(0,Q.ZN)({memberId:s}),{loaded:m,value:g,error:h}=u,{rooms:x=[]}=g,p=(0,Q.Vj)({memberId:s}),b=(0,l.useCallback)((()=>{o({header:"Success",text:"Successfully updated user's rooms"}),c(),p()}),[o,p,c]),j=(0,Q.Pb)({memberId:s,onSuccess:b,onError:()=>r}),v=(0,l.useCallback)((()=>{j(a)}),[a,j]);return(0,f.jsx)(d.ConfirmationDialog,{confirmLabel:"Assign","data-testid":"user-rooms-assignment-dialog",handleConfirm:v,handleDecline:n,iconName:"space_new",isConfirmPositive:!0,message:(0,f.jsx)(st,{loaded:m,rooms:x,error:h,setRoomIds:i}),title:"Assign rooms"})},ut=e=>{let{spaceId:t,startIsInviting:n}=e;const a=Qe(t),i=Xe(t),s=(0,h.JT)("space:InviteUser"),o=(0,dt.l)(),r=(0,l.useCallback)((e=>{let{role:t,members:n}=e;i(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,l.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,l.useCallback)((e=>(0,f.jsxs)(f.Fragment,{children:["Are you sure you want remove ",(0,f.jsx)("strong",{children:e.name})," from this space?"]})),[]),g=(0,l.useCallback)(((e,t)=>{const n=t.length;return n?1===n?"Delete User":"Delete Users":""}),[]),x=(0,l.useCallback)(((e,t)=>{const n=t.length;return n?(0,f.jsxs)(f.Fragment,{children:["Are you sure you want remove"," ",(0,f.jsx)("strong",{children:1===n?t[0].name:`${t.length} users`})," ","from this space?"]}):""}),[]);return{rowActions:(0,l.useMemo)((()=>({userSettings:{CustomUIAction:e=>{let{data:t,...n}=e;return(0,f.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,l.useMemo)((()=>({addEntry:{handleAction:n,tooltipText:"Invite user",isDisabled:()=>!s,disabledTooltipText:"You don't have the required permissions to invite new users"},userSettings:{CustomUIAction:e=>{let{data:t,...n}=e;return(0,f.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"}})),[s,g,x])}},mt=()=>{const e=(0,s.vt)(),t=(0,s.ns)(e,"name"),n=(0,Z.bj)(),a=(0,Ce.uW)("id"),[i,,o,r]=(0,p.A)(),[d,c]=(0,l.useState)(""),[u,m]=(0,l.useState)([]),{rowActions:g,bulkActions:x}=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,l.useMemo)((()=>(e=>{let{fromRolePermissions:t,userList:n,canModifyUser:a,currentUserId:i}=e;return n.reduce(((e,n)=>{const s=i===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||s,isSelf:s,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:i,globalFilter:d,rowActions:g,bulkActions:x,columnVisibility:{name:!1},onRowSelected:m,setGlobalFilter:c,startIsInviting:o,stopIsInviting:r,canModifyUser:v}},gt=e=>{const{columns:t,data:n,isInviting:a,rowActions:i,bulkActions:s,columnVisibility:l,stopIsInviting:o,setGlobalFilter:r,onRowSelected:c}=mt();return(0,f.jsxs)($.Ay,{tab:"Users",children:[(0,f.jsxs)(d.Flex,{column:!0,height:"100%",overflow:"hidden",flex:"grow",padding:[2,4,0,4],...e,children:[(0,f.jsxs)(d.TextBig,{margin:[1,0,3],children:["Learn more about Netdata role-based access model on"," ",(0,f.jsx)(he.A,{href:xe.S0,target:"_blank",rel:"noopener noreferrer",Component:d.TextBig,children:"our documentation"})]}),(0,f.jsx)(d.Table,{onSearch:r,data:n,dataColumns:t,enableSorting:!0,enableSelection:!0,onRowSelected:c,bulkActions:s,rowActions:i,columnVisibility:l,testPrefixCallback:e=>e.name})]}),a&&(0,f.jsx)(Ve.d,{onClose:o,isSubmodal:!0})]})},ht=(0,o.A)((()=>a.e(9883).then(a.bind(a,49883))),"ManageAuth"),xt=(0,o.A)((()=>a.e(2248).then(a.bind(a,52248))),"ManageScimGroups"),pt={side:"top",type:"solid",size:"1px",color:"border"},bt=e=>{const t=(0,s.ap)("id"),n=(0,Ue.ES)(t),{userManagementActiveTab:a=0}=(0,Ee.PP)(),i=(0,l.useCallback)((e=>{const t=(0,Ee.PP)();(0,Ee.Z8)({...t,userManagementActiveTab:e})}),[]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Flex,{padding:[0,0,0,4],...e,children:(0,f.jsx)(d.H3,{children:"User Management"})}),(0,f.jsxs)(d.Tabs,{selected:parseInt(a,10),onChange:i,height:"calc(100% - 110px)",margin:[4,0,0,0],children:[(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-user-management-users-tab",label:(0,f.jsx)(d.Text,{children:"Users"}),children:(0,f.jsx)(gt,{border:pt})}),n?null:(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-user-management-aaa-tab",label:(0,f.jsx)(d.Text,{children:"Authentication & Authorization"}),children:(0,f.jsx)(l.Suspense,{fallback:"",children:(0,f.jsx)(ht,{border:pt})})}),n?null:(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-user-management-scim-groups-tab",label:(0,f.jsx)(d.Text,{children:"Groups"}),children:(0,f.jsx)(l.Suspense,{fallback:"",children:(0,f.jsx)(xt,{border:pt})})})]})]})};var jt=a(55429),ft=a(28688),vt=a(51262);const Ct=(0,l.memo)((e=>{const t=(0,s.vt)(),n=(0,s.ap)("name"),{nodeIds:a,nodes:i}=(0,ft.A)(),{preferredNodes:o}=(0,vt.A)(),[r,c]=(0,l.useState)([]),[u,,m,g]=(0,p.A)();return(0,jt.A)(t),(0,l.useEffect)((()=>{a.length&&c(o.filter((e=>a.includes(e))))}),[a,o]),(0,f.jsx)($.Ay,{tab:"Nodes",children:(0,f.jsxs)(d.Flex,{column:!0,"data-testid":"manageClaimedNodes",height:"100%",overflow:"hidden",gap:3,...e,children:[(0,f.jsx)(d.H3,{"data-testid":"manageClaimedNodes-header",children:`Connect Nodes to ${n}`}),(0,f.jsx)(H.A,{showClaimNodeOnEmptySpace:!0,showClaimModalWithRoomSelection:!0,enableSelection:!0,customNodes:i,isSpace:!0,tempPreferredNodes:r,setTempPreferredNodes:c,loading:u,startLoading:m,stopLoading:g})]})})})),yt=Ct;var wt=a(3458),Tt=a(76571),At=a(49635);const St=e=>{let{name:t,spaceName:n}=e;return(0,f.jsxs)(f.Fragment,{children:["You are about to delete ",(0,f.jsx)("strong",{children:t})," channel from ",(0,f.jsx)("strong",{children:n})," space.",(0,f.jsx)("br",{}),"This cannot be undone. Are you sure you want to continue?"]})};var It=a(52838),kt=(a(37550),a(98563));const Ft=e=>{let{integration:t={},testId:n,...a}=e;const i=a.checked?"disable":"enable";return(0,f.jsx)(d.Toggle,{colored:!0,"data-testid":`${n}-toggle`,"data-ga":`manage-channels::toggle-${t.slug}-${i}::notifications-tab`,...a})},Pt=e=>{let{testId:t,tooltipContent:n="plan",...a}=e;return a.disabled?(0,f.jsx)(Oe.A,{align:"top",content:At.r7[n],"data-testid":`${t}-warning`,plain:!0,children:(0,f.jsxs)(d.Flex,{padding:[2,2,0,0],position:"relative",children:[(0,f.jsx)(kt.id,{"data-testid":`${t}-warningIcon`}),(0,f.jsx)(Ft,{testId:t,...a})]})}):(0,f.jsx)(Ft,{testId:t,...a})},Mt=e=>{let{"data-testid":t="cellName",enabled:n,id:a,integration:i,isAvailable:s,name:l,spaceId:o,tooltipContent:r,...c}=e;const u=(0,Tt.t5)(o,"channels"),m=(0,Tt.vq)(o,"channels");return(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":t,gap:4,...c,children:[(0,f.jsx)(Pt,{checked:n,disabled:!s,integration:i,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:r}),(0,f.jsx)(d.Text,{"data-testid":`${t}-label`,children:l})]})},$t=e=>{let{"data-testid":t="cellService",integration:n={},kindLabel:a,...i}=e;const s=At.a$[n.slug]||{};return(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":t,gap:2,justifyContent:"between",width:"100%",...i,children:[(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":`${t}-integration`,gap:2,children:[(0,f.jsx)(d.Icon,{"data-testid":`${t}-icon`,...s}),(0,f.jsx)(d.Text,{"data-testid":`${t}-label`,children:n.title})]}),(0,f.jsx)(Oe.A,{content:a,"data-testid":`${t}-kind`,plain:!0,children:(0,f.jsx)(d.Icon,{color:"textLite",height:"16px",name:At.HA[n.kind]?.icon,width:"16px"})})]})};var Lt=a(15679);const Rt=e=>{let{getValue:t}=e;const n=(t()||[]).map((e=>(0,He.Zr)(e.toLowerCase())));return n?.length?(0,f.jsx)(d.Flex,{"data-testid":"channelNotificationsCell",flexWrap:!0,gap:1,children:n.map((e=>(0,f.jsx)(d.Flex,{padding:[.5,0],children:(0,f.jsx)(Lt.A,{noTooltip:!0,value:e})},e)))}):(0,f.jsx)(d.Text,{children:"*"})},Nt=e=>{let{canManageChannels:t,roomOptions:n,notificationOptions:a,spaceId:i}=e;return[{accessor:"name",cell:e=>{let{getValue:n,row:a}=e;return(0,f.jsx)(Mt,{enabled:a.original.enabled,id:a.original.id,integration:a.original.integration,isAvailable:t&&a.original.available,name:n(),spaceId:i,tooltipContent:t?"plan":"role"})},header:"Name",id:"name"},{accessor:"integration",cell:e=>{let{getValue:t,row:n}=e;return(0,f.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,f.jsxs)(d.Flex,{column:!0,width:{max:"200px"},gap:2,children:[(0,f.jsx)(d.TextMicro,{children:"Services are distinguished in two categories."}),(0,f.jsxs)(d.TextMicro,{children:[(0,f.jsx)(kt.Jg,{name:At.HA.PERSONAL.icon})," ",(0,f.jsx)(d.TextMicro,{strong:!0,children:"Personal:"})," ",At.HA.PERSONAL.tooltip]}),(0,f.jsxs)(d.TextMicro,{children:[(0,f.jsx)(kt.Jg,{name:At.HA.SYSTEM.icon})," ",(0,f.jsx)(d.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 i={"data-testid":"channelRoomsCell"};if(a.original.internal)return(0,f.jsx)(d.Text,{...i,children:At.Oh.label});if(!a.original.rooms&&!a.original.rooms?.length)return(0,f.jsx)(d.Text,{...i,children:At.PT.label});const s=(0,It.Pl)({roomIds:t(),roomOptions:n});return(0,f.jsx)(d.Text,{"data-testid":"channelRoomsCell",children:s})},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 i=e.original.rooms||[];return i.length?i.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=a(42340),Bt=a(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 Et=a(41258),Ut=a(71819);const Vt=["MobileApp","Email"],Ht=()=>{const e=(0,i.Zp)(),t=(0,h.JT)("channel:Manage"),n=(0,s.vt)(),a=(0,s.ap)("name"),o=(0,s.bq)(),[r,d]=(0,me.A)(),[c,u]=(0,l.useState)(""),m=(0,Tt.bY)();(0,Et.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"),j=(0,Bt.A)({all:!0,internal:!0}),v=(0,Ut.A)(),{alerts:C,name:y,rooms:w,secrets:T}=(0,Tt.g4)(x);_t(n,x);const A=(0,l.useCallback)((e=>{b(e)}),[]),S=(0,l.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,l.useCallback)((()=>{e((0,i.tW)(B.uX,{spaceSlug:o,settingsTab:B.A8,settingsSubTab:B.G0}))}),[o]),k=(0,l.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,l.useCallback)((e=>{e&&m({id:e})}),[m]),P=(0,l.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 Vt.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:Oe.A,tooltipText:"Edit setting"},delete:{confirmLabel:"Yes, delete",confirmationMessage:e=>{let{integration:t={}}=e;return(0,f.jsx)(St,{name:t.name,spaceName:a})},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:Oe.A,tooltipText:"Delete setting"}})),[t,S,I]),M=(0,l.useMemo)((()=>Nt({canManageChannels:t,roomOptions:j,notificationOptions:v,spaceId:n})),[t,j,v,n]);return{bulkActions:k,channelData:g,currentChannelId:x,columns:M,dataGa:"manage-channels",onFilter:(e,t,n)=>{const a=e.original,i=n.toLowerCase();if(a.name?.toLowerCase()?.includes(i))return!0;if(a.integration?.slug?.toLowerCase()?.includes(i))return!0;if(a.notificationLabel?.toLowerCase()?.includes(i))return!0;if(a.internal)return At.Oh.label?.toLowerCase()?.includes(i);const s=a.rooms||[];if(!s.length)return At.PT.label?.toLowerCase()?.includes(i);return(0,It.Pl)({roomIds:s,roomOptions:j}).toLowerCase().includes(i)},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}};a(23215);var Ot=a(10444),Wt=a(80320),Yt=a(95263),qt=a(64903);const Jt={hours:0,minutes:30},zt=e=>{let{title:t,value:n,onChange:a}=e;const i=(0,l.useMemo)((()=>{const e=60*parseInt(n,10);return isNaN(e)?null:60*parseInt(n,10)}),[n]),s=(0,l.useCallback)((e=>{a(e/60)}),[a]);return(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.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,f.jsx)(qt.A,{testId:"notifications-repeat-interval",value:i,onChange:s,applyOnChange:!0,minValues:Jt,hideSeconds:!0})]})},Gt=(0,ae.A)((0,We.A)(d.Button)),Kt="modal",Zt=e=>{let{id:t="new",integrationId:n,onClose:a,isSubmitEnabled:o,isTestEnabled:r,hasValidVerificationToken:d}=e;const{notificationOptions:c,name:u,repeatNotificationMin:m,rooms:g,slug:h,integration:x,secrets:p,verificationToken:b}=(0,Tt.g4)(t),j=(0,dt.l)(),v=(0,i.Zp)(),[C,y]=(0,me.A)(),w=(0,s.vt)(),T=(0,s.bq)(),A=(0,Tt.bY)(),S=(0,l.useCallback)((()=>{(h||x)&&A({slug:h||x,secrets:p})}),[h,p,A]),I=(0,i.tW)(B.bq,{spaceSlug:T,settingsTab:B.A8}),k=parseInt(m,10),F=(0,l.useCallback)((async()=>{try{const e={notification_options:c,integrationID:n,...u?{name:u}:{},...g?.length?{Rooms:g}:{},...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!"}),j(),a(),v(I)}catch(e){y(e)}}),[c,n,u,b,g,k,p,C,j,a,v,y]);return(0,f.jsxs)(kt.fn,{column:!1,gap:2,"data-testid":`${Kt}-footer`,justifyContent:"end",children:[(0,f.jsx)(Gt,{feature:"IntegrationNotification",integrationId:n,label:"Test",flavour:"hollow",onClick:S,disabled:!r,tooltipProps:{content:"Test your notification settings",align:"bottom"}}),(0,f.jsx)(Gt,{feature:"IntegrationNotification",integrationId:n,"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:i,...s}=e;const{notificationOptions:o,title:r,description:c,docsLink:u,fields:m,integration:g,loaded:h,name:p,verificationToken:b,required:j,roomSelections:v,repeatNotificationMin:C,secrets:y,error:w,settings:T}=(0,Tt.g4)(t),A=(0,Ot.J)(),S=e=>`manage-${g}-channel::${e}::notification-${n?"integrations":"channels"}-tab`,I=(0,Bt.A)({all:!0}),k=(0,x.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,l.useState)({}),_=(0,Ut.A)(),E=(0,l.useMemo)((()=>o?_.filter((e=>o.includes(e.value))):[]),[_,o]),U=(0,l.useMemo)((()=>Object.keys(D)),[D]),V=(0,l.useMemo)((()=>j.every((e=>(0,It.ct)(e,y[e],m[e])))),[j,y,m]),H=a||T,{tokenRequired:O}=H||{},W=(0,l.useMemo)((()=>!U.length||U.every((e=>{const t=y[e].selection;return D[e].every((n=>(0,It.ct)(n,y[e][n],m[e].fields[t][n])))}))),[U,y,m,D]),Y=(0,l.useMemo)((()=>V&&W&&!!o?.length),[V,W,o?.length]),q=!O||!!b,J=(0,l.useMemo)((()=>!!Y&&!(O&&!b)),[Y,O,b]),z=(0,l.useCallback)((e=>{F(e.map((e=>{let{value:t}=e;return t})))}),[F]),G=(0,l.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 h?(0,f.jsx)(d.Modal,{backdropProps:{backdropBlur:!0},onEsc:i,children:(0,f.jsxs)(kt.$m,{width:{max:A?"90vw":"500px"},height:{max:"95vh"},"data-testid":s["data-testid"]||Qt,...w?{height:"auto"}:{},children:[(0,f.jsx)(d.ModalHeader,{column:!0,"data-testid":`${Qt}-header`,gap:2,padding:[4],children:w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.H4,{children:"Error"}),i&&(0,f.jsx)(kt.Oj,{"data-ga":S("close-modal"),"data-testid":`${Qt}-close`,onClose:i})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":`${Qt}-headerMain`,children:[(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,"data-testid":`${Qt}-titleContainer`,children:[(0,f.jsx)(d.Icon,{"data-testid":`${Qt}-titleIcon`,...At.a$[g]||{}}),(0,f.jsx)(d.H4,{"data-testid":`${Qt}-title`,children:r})]}),i&&(0,f.jsx)(kt.Oj,{"data-ga":S("close-modal"),"data-testid":`${Qt}-close`,onClose:i})]}),(0,f.jsxs)(d.Text,{as:d.Box,color:"menuItem","data-testid":`${Qt}-description`,children:[c,"\xa0",(0,f.jsx)(he.A,{Component:d.Text,"data-ga":S("click-docs"),"data-testid":`${Qt}-docsLink`,href:u,target:"_blank",whiteSpace:"nowrap",children:"Learn how to configure it."})]})]})}),w?(0,f.jsx)(d.ModalBody,{alignItems:"center",justifyContent:"center",height:"180px",children:(0,f.jsx)(d.TextBig,{children:w})}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.ModalBody,{"data-testid":`${Qt}-body`,overflow:{vertical:"auto"},padding:[0],children:[(0,f.jsxs)(kt.fn,{gap:2,"data-testid":`${Qt}-standardFields`,hasBorder:!0,children:[(0,f.jsx)(d.Text,{"data-testid":`${Qt}-standardFields-header`,children:"Notification settings"}),(0,f.jsxs)(d.Flex,{column:!0,"data-testid":`${Qt}-standardFields-body`,gap:3,children:[(0,f.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,f.jsx)(Wt.A,{component:"select","data-ga":S("rooms-select"),"data-testid":`${Qt}-rooms`,isMulti:!0,closeMenuOnSelect:!1,onChange:G,options:I,placeholder:"Select rooms",title:"Rooms",value:v}),(0,f.jsx)(Wt.A,{component:"select","data-ga":S("notification-select"),"data-testid":`${Qt}-notifications`,isRequired:!0,isMulti:!0,closeMenuOnSelect:!1,onChange:z,options:_,placeholder:"Select notifications",title:"Notifications",value:E}),(0,f.jsx)(zt,{title:"Notifications repeat",value:C,onChange:N})]})]}),(0,f.jsxs)(kt.fn,{gap:2,"data-testid":`${Qt}-dynamicFields`,hasBorder:!0,children:[(0,f.jsx)(d.Text,{"data-testid":`${Qt}-dynamicFields-header`,children:"Integration configuration"}),(0,f.jsx)(d.Flex,{column:!0,"data-testid":`${Qt}-dynamicFields-body`,gap:3,children:Object.values(m).map((e=>{let{id:t,getValue:n,onChange:a,...i}=e;return(0,f.jsx)(Wt.A,{"data-ga":S(`${t}-${i.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}),...i},t)}))})]}),O?(0,f.jsxs)(kt.fn,{gap:2,"data-testid":`${Qt}-verificationFields`,hasBorder:!0,children:[(0,f.jsx)(d.Text,{"data-testid":`${Qt}-standardFields-header`,children:"Verification"}),(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(d.Flex,{width:"24px",children:(0,f.jsx)(d.Icon,{name:"warning_triangle",size:"small",color:"warning"})}),(0,f.jsx)(d.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,f.jsx)(d.Flex,{column:!0,"data-testid":`${Qt}-verificationFields-body`,gap:3,children:(0,f.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,f.jsx)(Zt,{id:t,integrationId:n,onClose:i,isSubmitEnabled:J,isTestEnabled:Y,hasValidVerificationToken:q})]})]})}):null},en=e=>{let{"data-testid":t="channelList",...n}=e;const{bulkActions:a,channelData:i,currentChannelId:s,columns:l,dataGa:o,onFilter:r,onModalClose:c,rowActions:u,search:m,setSearch:g}=Ht();return(0,f.jsx)($.Ay,{tab:"Notifications::Channels",children:(0,f.jsxs)(d.Flex,{column:!0,"data-testid":t,gap:4,width:"100%",height:"100%",overflow:"hidden",padding:[2,4],flex:"1",...n,children:[(0,f.jsx)(d.Table,{bulkActions:a,data:i,dataColumns:l,dataGa:o,globalFilter:m,globalFilterFn:r,onSearch:g,rowActions:u,testPrefix:"channelList",testPrefixCallback:e=>e.name}),!!s&&(0,f.jsx)(Xt,{"data-testid":"editChannelModal",id:s,onClose:c})]})})},tn=0,nn=(0,o.A)((()=>a.e(9961).then(a.bind(a,19961))),"SilencingRules"),an=(0,o.A)((()=>a.e(2948).then(a.bind(a,22948))),"Reachability"),sn=()=>{const{notificationsActiveTab:e=tn}=(0,Ee.PP)(),t=(0,l.useCallback)((e=>{const t=(0,Ee.PP)();(0,Ee.Z8)({...t,notificationsActiveTab:e})}),[]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Flex,{padding:[0,0,4,4],children:(0,f.jsx)(d.H3,{children:"Alerts & Notifications"})}),(0,f.jsxs)(d.Tabs,{selected:parseInt(e,10),onChange:t,height:"100%",overflow:"hidden",children:[(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-notifications-methods-tab","data-ga":"manage-space::click-tab::notifications-methods-tab",label:(0,f.jsx)(d.Text,{children:"Notification Methods"}),children:(0,f.jsx)(en,{})}),(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-notifications-silencing-rules-tab","data-ga":"manage-space::click-tab::notifications-silencing-rules-tab",label:(0,f.jsx)(d.Text,{children:"Silencing Rules"}),children:(0,f.jsx)(l.Suspense,{children:(0,f.jsx)(nn,{})})}),(0,f.jsx)(d.Tab,{"data-testid":"spaceSettings-reachability-notifications-tab","data-ga":"manage-space::click-tab::reachability-notifications-tab",label:(0,f.jsx)(d.Text,{children:"Reachability"}),children:(0,f.jsx)(l.Suspense,{children:(0,f.jsx)(an,{})})})]})]})};var ln=a(93926),on=a(39651);const rn=(0,We.A)(d.Button),dn=(0,We.A)(d.Flex),cn=e=>{let{available:t,"data-testid":n="card",description:a,docsLink:i,fields:s,id:o,internal:r,kind:c,kindLabel:u,slug:m,required:g,title:x,settings:b,...j}=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,p.A)(!1),I=(0,l.useCallback)((()=>{y({...Dt.V,title:x,description:a,docsLink:i,fields:s,integration:m,loading:!1,loaded:!0,required:g,secrets:(0,It.s7)(s,g)}),A()}),[a,i,s,m,g]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.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,...j,children:[(0,f.jsx)(kt.MU,{"data-testid":`${n}-blurredIcon`,...v}),(0,f.jsxs)(d.Flex,{column:!0,"data-testid":`${n}-details`,gap:3,margin:[0,0,3,0],children:[(0,f.jsxs)(d.Flex,{"data-testid":`${n}-header`,justifyContent:"between",children:[(0,f.jsxs)(d.Flex,{alignItems:"center","data-testid":`${n}-titleContainer`,gap:1,children:[(0,f.jsx)(d.Icon,{"data-testid":`${n}-icon`,...v}),(0,f.jsx)(d.Text,{"data-testid":`${n}-title`,children:x})]}),!r&&t&&(0,f.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}),!r&&!t&&(0,f.jsx)(on.A,{"data-ga":`manage-integration-${m}::click-plan-badge::notification-integrations-tab`})]}),(0,f.jsxs)(d.TextSmall,{color:"textDescription","data-testid":`${n}-description`,children:[a," ",i&&(0,f.jsx)(he.A,{Component:kt.W6,"data-ga":`manage-integration-${m}::click-docs::notification-integrations-tab`,"data-testid":`${n}-docsLink`,href:i,target:"_blank",whiteSpace:"nowrap",children:"Learn more."})]})]}),(0,f.jsx)(d.Flex,{justifyContent:"end",children:(0,f.jsxs)(dn,{alignItems:"end",alignSelf:"end",gap:1,"data-testid":`${n}-kindContainer`,tooltip:At.HA[c].tooltip,children:[(0,f.jsx)(d.Icon,{color:"textLite","data-testid":`${n}-kindIcon`,height:"16px",name:At.HA[c].icon,width:"16px"}),(0,f.jsx)(d.TextSmall,{color:"textLite","data-testid":`${n}-kind`,children:u})]})})]}),T&&(0,f.jsx)(Xt,{"data-testid":"createChannelModal",integrationId:o,settings:b,onClose:()=>{S(),C()}})]})},un=e=>{let{"data-testid":t="group",integrations:n,title:a,...i}=e;return n.length?(0,f.jsxs)(d.Flex,{column:!0,"data-testid":t,gap:2,position:"relative",...i,children:[(0,f.jsx)(d.TextBig,{color:"textDescription","data-testid":`${t}-title`,children:a}),(0,f.jsx)(d.Flex,{flexWrap:!0,"data-testid":`${t}-integrations`,gap:4,children:n.map((e=>(0,f.jsx)(cn,{"data-testid":`${e.slug}Card`,...e},e.slug)))})]}):null};var mn=a(65746);const gn=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])},hn=e=>{let{"data-testid":t="integrations",...n}=e;const a=(0,s.vt)(),o=(0,s.bq)();gn(a);const{available:r,error:c,loaded:u,unavailable:m}=(0,Tt.m$)(a),[g,h]=(0,l.useState)([]),[x,p]=(0,l.useState)([]),[b,j]=(0,l.useState)("");if(!u)return(0,f.jsx)(it.A,{"data-testid":`${t}-loader`,title:"Loading services..."});if(c)return(0,f.jsx)(ln.A,{"data-testid":`${t}-error`,message:c,title:`Services of ${o} are currently unavailable`});const v=(0,i.tW)(B.bq,{spaceSlug:o,settingsTab:B.A8});return(0,f.jsx)($.Ay,{tab:"Notifications::Integrations",children:(0,f.jsxs)(d.Flex,{column:!0,"data-testid":t,...n,padding:[0,3,3],gap:3,overflow:"hidden",children:[(0,f.jsx)(d.Flex,{border:{side:"bottom",color:"placeholder"},"data-testid":`${t}-header`,width:"100%",children:(0,f.jsxs)(he.A,{as:i.N_,Component:kt.He,"data-ga":"manage-integrations::click-back::notification-integrations-tab","data-testid":`${t}-backLink`,to:v,children:[(0,f.jsx)(d.Icon,{"data-testid":`${t}-backIcon`,name:"arrow_left"}),(0,f.jsx)(d.H3,{"data-testid":`${t}-title`,children:B.ys[B.G0]})]})}),(0,f.jsxs)(d.Flex,{column:!0,"data-testid":`${t}-content`,gap:2,height:"100%",overflow:"hidden",children:[(0,f.jsx)(d.Box,{as:d.SearchInput,"data-ga":"manage-integrations::search::notification-integrations-tab","data-testid":`${t}-search`,iconLeft:(0,f.jsx)(d.Icon,{name:"magnify",color:"textLite"}),onChange:e=>{j(e),h((0,It.Zv)(r,e)),p((0,It.Zv)(m,e))},placeholder:"Search service",size:"small",width:{max:49.5}}),(0,f.jsxs)(d.Flex,{column:!0,"data-testid":`${t}-groups`,overflow:"auto",height:"100%",children:[(0,f.jsx)(un,{"data-testid":"integrationGroupAvailable",integrations:b?g:r,title:"Available"}),(0,f.jsx)(un,{"data-testid":"integrationGroupUnavailable",integrations:b?x:m,title:"Unavailable"})]})]})]})})},xn=()=>(0,f.jsxs)(i.BV,{children:[(0,f.jsx)(i.qh,{path:"/",element:(0,f.jsx)(sn,{})}),(0,f.jsx)(i.qh,{path:`/${B.G0}`,element:(0,f.jsx)(hn,{})})]});var pn=a(99236);const bn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[(0,d.useInputValue)({maxChars:20,value:e.name||""})||{},(0,d.useInputValue)({maxChars:30,value:e.slug||""})||{},(0,d.useInputValue)({maxChars:50,value:e.description||""})||{}]};var jn=a(36348),fn=a(52353),vn=a(1174),Cn=a(27965),yn=a(68531);const wn={loading:!1,isAvailable:!1,isValid:!0,error:null},Tn=e=>{const t=(0,s.ap)(),[n,a]=(0,l.useState)(wn);return(0,l.useEffect)((()=>{if(t.slug==e)a(wn);else{const t=(0,fn.ni)(e);a({...wn,isValid:!1,error:t})}}),[t.slug,e]),(0,yn.A)((()=>{(0,fn.ni)(e)||t.slug==e||(a((e=>({...e,loading:!0}))),(0,Cn.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},An=e=>{let{nameInput:t,slugInput:n,descriptionInput:a,onStartSlugValidation:i,onStopSlugValidation:s,onSlugValidationError:o,...r}=e;const[c,u,m,g]=t,[h,x,p,b]=n,[j,v,C,y]=a,{loading:w,error:T}=Tn(h);(0,l.useEffect)((()=>{(w?i:s)()}),[w]),(0,l.useEffect)((()=>{o(T)}),[T]);const A=(0,l.useMemo)((()=>(0,fn.fc)(c)),[c]),S=(0,l.useMemo)((()=>(0,fn.e_)(j)),[j]);return(0,f.jsxs)(d.Flex,{column:!0,gap:4,...r,children:[(0,f.jsx)(vn.A,{Component:d.TextInput,permission:"space:UpdateMeta",label:"Name",value:c,onChange:u,error:fn.xc[A],isDirty:g,instantFeedback:"all",fieldIndicator:m,"data-testid":"textInputs-spaceName",containerStyles:{width:{base:150}}}),(0,f.jsx)(vn.A,{Component:d.TextInput,permission:"space:UpdateMeta",label:"Slug",value:h,onChange:x,error:fn.xc[T]||T,isDirty:b,instantFeedback:"all",fieldIndicator:p,"data-testid":"textInputs-spaceSlug",containerStyles:{width:{base:150}}}),(0,f.jsx)(vn.A,{Component:d.TextInput,permission:"space:UpdateMeta",label:"Description",value:j,onChange:v,error:fn.xc[S],isDirty:y,instantFeedback:"all",fieldIndicator:C,"data-testid":"textInputs-spaceDescription",containerStyles:{width:{base:150}}})]})};var Sn=a(30005);const In=e=>{let{id:t,...n}=e;return(0,f.jsxs)(d.Flex,{column:!0,gap:1,...n,children:[(0,f.jsx)(d.Text,{strong:!0,children:"Space Id"}),(0,f.jsx)(Sn.Ay,{confirmationText:"Space ID copied to your clipboard.",children:t})]})};var kn=a(6818);const Fn=()=>(0,f.jsxs)(d.Text,{lineHeight:1.5,children:["With the change of the Space Slug, previous ",(0,f.jsx)(d.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."]}),Pn=e=>{let{handleConfirm:t,handleDecline:n}=e;return(0,f.jsx)(d.ConfirmationDialog,{confirmLabel:"Continue","data-testid":"changeSpaceSlugDialog",handleConfirm:t,handleDecline:n,message:(0,f.jsx)(Fn,{}),title:"Space slug change"})};var Mn=a(3561);const $n=(0,ae.A)(d.Button),Ln=e=>{let{nameInput:t,slugInput:n,descriptionInput:a,onClose:i,isValidatingSlug:o,slugError:r,...d}=e;const c=(0,s.ap)(),u=(0,Mn.A)(c.id),[m,g]=(0,l.useState)(!1),[h]=t,[x]=n,[b]=a,j=(0,l.useMemo)((()=>c.slug!==x),[c.slug,x]),[v,,C,y]=(0,p.A)(),w=()=>{i(j?x:null),g(!1)},T=()=>g(!1),A=(0,l.useCallback)((e=>{!e&&j?C():(g(!0),u({name:h,description:b,...j?{slug:x}:{}},{onSuccess:w,onFail:T}))}),[h,x,b,c.slug]),S=(0,l.useCallback)((()=>A(!0)),[A]),I=(0,l.useMemo)((()=>{const e=(0,fn.fc)(h),t=(0,fn.e_)(b);return!!(m||o||e||r||t)||c.name===h&&c.slug===x&&(c.description===b||!c.description&&!b)}),[c,h,x,b,m,o]);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)($n,{label:"Save",onClick:A,isLoading:m||o,disabled:I,"data-testid":"saveSpace-button",feature:"SpaceSettings",...d}),v?(0,f.jsx)(Pn,{handleConfirm:S,handleDecline:y}):null]})},Rn=(0,l.memo)((e=>{let{onClose:t,...n}=e;const a=(0,s.ap)(),i=(0,s.UV)("ids"),[o,,r,c]=(0,p.A)(),[u,,m,g]=(0,p.A)(),[h,x]=(0,l.useState)(),[b,j,v]=bn({name:a.name,slug:a.slug,description:a.description});if(!a.id)return null;const C=1===i.filter((e=>!(0,Ue.ES)(e))).length;return(0,f.jsxs)($.Ay,{tab:"Info",children:[(0,f.jsxs)(d.Flex,{column:!0,gap:6,"data-testid":"manageSpace",padding:[0,0,6,0],width:{max:150},...n,children:[(0,f.jsxs)(d.Flex,{column:!0,"data-testid":"manageSpace-settings",children:[(0,f.jsx)(d.H3,{margin:[0,0,4,0],children:"Info"}),(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[(0,f.jsx)(An,{"data-testid":"manageSpace-nameInputs",nameInput:b,slugInput:j,descriptionInput:v,onStartSlugValidation:m,onStopSlugValidation:g,onSlugValidationError:x}),(0,f.jsx)(In,{"data-testid":"manageSpace-spaceIdInput",id:a.id,width:{base:150}}),(0,f.jsx)(d.TextInput,{label:"Your role in space",value:(0,He.Zr)(a.roleInSpace),disabled:!0,containerStyles:{width:{base:150}}}),(0,f.jsx)(d.TextInput,{label:"Plan",value:(0,He.Vn)(a?.planName||""),disabled:!0,containerStyles:{width:{base:150}}})]})]}),(0,f.jsxs)(d.Flex,{"data-testid":"manageSpace-actions",justifyContent:"between",alignItems:"center",children:[(0,f.jsxs)(d.Flex,{"data-testid":"manageSpace-deleteLeaveActions",gap:4,children:[(0,f.jsx)(Oe.A,{align:"top",content:C&&pn.sh.leave,isBasic:!0,stretch:"align",children:(0,f.jsx)(d.Flex,{alignItems:"center",children:(0,f.jsx)(d.Button,{"data-ga":"manage-space-tab::click-leave-space::manage-space-modal","data-testid":"manageSpace-leave",disabled:C,icon:"switch_off",flavour:"borderless",label:"Leave space",neutral:!0,padding:[0],width:"fit-content",onClick:r})})}),(0,f.jsx)(kn.A,{"data-testid":"manageSpace-delete",id:a.id,isLastSpace:C,name:a.name,onClose:t})]}),(0,f.jsx)(Ln,{"data-testid":"manageSpace-save",nameInput:b,slugInput:j,descriptionInput:v,onClose:t,isValidatingSlug:u,slugError:h})]})]}),o&&(0,f.jsx)(jn.A,{id:a.id,name:a.name,onClose:c})]})}),(()=>!0));var Nn=a(36229);const Dn=()=>{const e=(0,i.Zp)(),t=(0,s.vt)(),n=(0,i.RQ)(B.uX),a=(0,i.RQ)(B.bq),{params:o}=n||a||{},{spaceSlug:r="",settingsTab:d="",settingsSubTab:c=""}=o,u=(0,s.ap)("name"),m=(0,A.J_)(t,c),g=(0,A.wz)(m,"name"),h=B.ys[d],x=(0,l.useCallback)((()=>{e((0,i.tW)(B.bq,{spaceSlug:r,settingsTab:d}))}),[r,d]),p=(0,l.useMemo)((()=>{const e=[{name:"Manage Space",isDisabled:!0},{name:u,isDisabled:!0},{name:h,...!!c&&{onClick:x}}];return c&&e.push({name:h===B.ys[B.aj]?g:B.ys[c]||c}),e}),[x,g,u,h,c]);return(0,f.jsx)(Nn.A,{isBig:!0,items:p,showBackButton:!1,testid:"manageSpace"})};var Bn=a(18739),_n=a(62718),En=a(3941);const Un=e=>(0,f.jsx)(d.Box,{as:"hr",height:"100%",sx:{borderWidth:"0px 0px 0px 1px",borderColor:"borderSecondary",borderStyle:"solid"},...e}),Vn=()=>(0,f.jsx)(Un,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}});var Hn=a(18387);const On=e=>{let{currentPlan:t,billingEmail:n,paymentMethod:a,businessName:i,vatNo:s,billingAddress:l}=e;const[o,r]=(0,Bn.Qh)(),c=!!t.billingEmail&&!r,u=n||"",m=u?"":"Email is required",g=a?.id?`**** ${a?.id}`:"",h=g?"":"Payment method is required",x=l?"":"Billing address is required";return(0,f.jsxs)(d.Flex,{column:!0,gap:3,children:[(0,f.jsxs)(d.Flex,{gap:4,children:[(0,f.jsx)(d.TextInput,{value:u,label:"Billing email",placeholder:"Not specified",instantFeedback:"all",isDirty:!!m,error:m,disabled:!0}),(0,f.jsx)(d.TextInput,{value:g,label:"Default payment method",placeholder:"Not specified",instantFeedback:"all",isDirty:!!h,error:h,disabled:!0})]}),s&&(0,f.jsxs)(d.Flex,{gap:4,children:[(0,f.jsx)(d.TextInput,{value:i||"",label:"Business name",placeholder:"Not specified",disabled:!0}),(0,f.jsx)(d.TextInput,{value:s,label:"VAT number",placeholder:"Not specified",disabled:!0})]}),(0,f.jsx)(d.Flex,{children:(0,f.jsx)(d.TextInput,{value:(0,Hn.qN)(l)||"",label:"Billing address",placeholder:"Not specified",isDirty:!!x,error:x,disabled:!0})}),(0,f.jsxs)(he.A,{Component:d.Flex,cursor:c?"pointer":"default",disabled:!c,onClick:o,alignItems:"center",gap:1,"data-ga":"billing-options::click::billing",children:[(0,f.jsx)("span",{children:"Change billing information and payment method"}),(0,f.jsx)(d.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]})]})},Wn=e=>{let{onReset:t}=e;return(0,f.jsx)(d.Box,{as:d.Icon,name:"close_circle",onClick:t,cursor:"pointer",width:3,height:3,color:"border",position:"absolute",left:"2px"})},Yn=e=>{let{promotionCode:t,onReset:n}=e;return(0,f.jsx)(d.Flex,{width:"100%",children:(0,f.jsx)(d.Pill,{padding:[0],flavour:"neutral",hollow:!0,children:(0,f.jsxs)(d.Flex,{position:"relative",gap:2,alignItems:"center",padding:[1,2,1,5],children:[(0,f.jsx)(Wn,{onReset:n}),(0,f.jsx)(d.Text,{children:t})]})})})},qn=e=>{let{promotionCode:t,onApply:n,error:a}=e;const[i,s]=(0,l.useState)(t||""),o=()=>{s(""),n("")};return(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsx)(d.Text,{strong:!0,children:"Promotion code"}),t&&!a?(0,f.jsx)(Yn,{promotionCode:t,onReset:o}):(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsxs)(d.Flex,{gap:2,alignItems:"baseline",children:[(0,f.jsx)(d.TextInput,{value:i,onChange:e=>s(e.target.value),placeholder:"Promotion code"}),!a&&(0,f.jsx)(d.Button,{label:"Apply",onClick:()=>n(i),padding:[3,4],disabled:!i}),!!i&&(0,f.jsx)(d.Button,{label:"Clear",flavour:"hollow",onClick:o,padding:[3,4],disabled:!i})]}),a&&(0,f.jsx)(d.Text,{color:"error",children:a})]})]})},Jn=e=>{let{needsCommitment:t,commitment:n,handleCommitmentChange:a}=e;return t&&(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsxs)(d.Flex,{gap:4,alignItems:"baseline",children:[(0,f.jsx)(d.Text,{strong:!0,style:{whiteSpace:"nowrap"},children:"Committed Nodes"}),(0,f.jsx)(d.TextInput,{onChange:a,value:n,placeholder:"i.e. 14",type:"number",min:1})]}),(0,f.jsx)(d.TextSmall,{children:"25% discount applied to the per-node cost of each committed node."})]})},zn=()=>(0,f.jsx)(d.Flex,{gap:4,alignItems:"baseline",children:(0,f.jsx)(d.Text,{strong:!0,style:{whiteSpace:"nowrap"},children:"Reports"})});var Gn=a(63950),Kn=a.n(Gn),Zn=a(88325);const Qn={earlyBird:()=>(0,f.jsxs)(d.Text,{children:["You are moving from ",(0,f.jsx)(d.Text,{strong:!0,children:"Early Bird"})," plan to another plan, you won't be able to come back to this. The ",(0,f.jsx)(d.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=Kn()}=e;const{url:n}=(0,Zn.A)();return(0,f.jsxs)(d.Text,{children:["You are moving from ",(0,f.jsx)(d.Text,{strong:!0,children:"Community (2023.02)"})," plan to another plan, you won't be able to come back to this. The new ",(0,f.jsx)(d.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,f.jsx)(he.A,{as:i.N_,onClick:t,to:n,disabled:!n,children:(0,f.jsx)(d.Text,{color:"primary",children:"View plans page"})}),"."]})},pro:()=>(0,f.jsxs)(d.Text,{children:["You are moving from ",(0,f.jsx)(d.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."]})},Xn=e=>{let{currentPlan:t,...n}=e;const a=Qn[(e=>"earlyBird"==e.slug?"earlyBird":"free"==e.slug&&"2023.02"==e.version?"communityV1":"pro"==e.slug?"pro":null)(t)]||null;return a&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Un,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,f.jsxs)(d.Flex,{gap:3,children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsx)(a,{...n})]})]})};var ea=a(68534),ta=a(43581);const na=["STRIPE_INVOICE_UNPAID"],aa=()=>{const{warnings:e}=(0,ea.A)(),t=(0,l.useMemo)((()=>e.filter((e=>{let{warningKey:t}=e;return na.includes(t)}),[e])));return t.length?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Un,{height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,f.jsxs)(d.Flex,{gap:3,children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsx)(d.Flex,{column:!0,gap:1,children:t.map((e=>{let{warningKey:t,text:n}=e;return(0,f.jsx)(ta.A,{children:n},t)}))})]})]}):null},ia=e=>"earlyBird"===e?.slug?"earlyBird":e&&e.slug&&"free"!==e.slug?`${e.slug}-${e.interval}`:"free",sa=r.default.div.withConfig({displayName:"withTableWrapper__TableWrapper",componentId:"sc-drcfxi-0"})(["margin-top:30px;"]);var la=a(25457);const oa={size:50,minSize:50,maxSize:100},ra=e=>()=>(0,f.jsx)(d.Flex,{width:"100%",justifyContent:"end",children:e}),da=e=>{let{getValue:t}=e;return(0,f.jsx)(d.Flex,{width:"100%",justifyContent:"end",children:t()})},ca=[{id:"name",accessor:"name",header:"",...oa,fullWidth:!0},{id:"price",accessor:"price",header:ra("Price"),cell:da,...oa},{id:"qty",accessor:"qty",header:ra("Qty"),cell:da,...oa},{id:"month",accessor:"month",header:ra("Month"),cell:da,...oa},{id:"total",accessor:"total",header:ra("Total"),cell:da,...oa}],ua=e=>(0,f.jsxs)(d.Flex,{gap:3,...e,children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsx)(d.Text,{children:"No immediate charges are applicable to this plan subscription. On-demand usage charges will be applied based on your node period count."})]}),ma=(ga=d.Table,e=>(0,f.jsx)(sa,{children:(0,f.jsx)(ga,{...e})}));var ga;const ha=e=>{let{lineItems:t}=e;return(0,f.jsx)(f.Fragment,{children:t.map((e=>{const t=(n=e).description?n.description.startsWith("Discount")?{color:"primary"}:n.description.startsWith("VAT")?{color:"textLite"}:{}:{};var n;const a=e.isInfo?d.TextSmall:d.Text;return(0,f.jsxs)(d.Flex,{justifyContent:"between",children:[(0,f.jsx)(a,{...t,children:e.description}),(0,f.jsx)(a,{...t,children:la.A.format(e.total?.amount)})]},e.description)}))})},xa=(e=>t=>t.lineItems.totalPayable?t.lineItems.info?.length?(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsx)(e,{...t}),(0,f.jsx)(ha,{lineItems:t.lineItems.info})]}):(0,f.jsx)(e,{...t}):null)((e=>{let{lineItems:t}=e;return(0,f.jsxs)(d.Flex,{justifyContent:"between",margin:[4,0,0,0],children:[(0,f.jsx)(d.H0,{strong:!0,children:"Total payable"}),(0,f.jsx)(d.H0,{strong:!0,"data-testid":"totalPayableAmountPreview",children:la.A.format(t.totalPayable.total.amount)})]})})),pa=e=>{let{previewData:t,lineItems:n,agree:a,toggleAgree:i,zeroPreviewSubscriptionTotal:s,isUpdate:l}=e;const o=!l||!!t?.paymentMethod&&!!t?.billingAddress;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Vn,{}),s&&(0,f.jsx)(ua,{padding:[0,0,2,0]}),(0,f.jsxs)(d.Flex,{gap:3,children:[(0,f.jsx)(d.Checkbox,{checked:a,onChange:i,disabled:!o}),(0,f.jsxs)(d.Text,{children:["I agree to Netdata Inc's"," ",(0,f.jsx)(he.A,{href:"https://www.netdata.cloud/service-terms/",rel:"noopener noreferrer",target:"_blank",children:"Terms of Service"})," ","and"," ",(0,f.jsx)(he.A,{href:"https://netdata.cloud/privacy",rel:"noopener noreferer",target:"_blank",children:"Privacy Policy"})]})]}),(0,f.jsx)(xa,{lineItems:n})]})},ba=e=>{let{lineItems:t}=e;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ma,{dataColumns:ca,data:t.table}),(0,f.jsx)(Vn,{}),(0,f.jsx)(ha,{lineItems:t.footer})]})};var ja=a(43891),fa=a(71282),va=a(10853);const Ca="initial",ya=[{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}],wa=e=>{let{reason:t,setReason:n,text:a,setText:i}=e;const s=ya.map((e=>({...e,value:e.label}))),o=!!t.specify,r=(0,l.useCallback)((e=>{i(e?.target?.value)}),[i]);return(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[(0,f.jsx)(d.Text,{children:"We're sorry to see you go. To help us improve, please tell us your main reason for downgrading:"}),(0,f.jsx)(d.Select,{options:s,value:t,onChange:n,placeholder:"Please select a reason"}),o?(0,f.jsx)(d.TextInput,{value:a,onChange:r,placeholder:"Please specify"}):null]})},Ta=()=>(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsx)(d.Text,{children:"Are you sure you want to downgrade to the Community plan?"}),(0,f.jsx)(d.Text,{children:"Downgrading will:"}),(0,f.jsxs)(ja.K,{children:[(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Occur when your current subscription expires"})}),(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Affect all users on this Space"})}),(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Remove your access to premium features"})}),(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Restrict non-admin users' access to your Space"})}),(0,f.jsx)("li",{children:(0,f.jsx)(d.Text,{children:"Limit any business notification options after 24 hours"})})]}),(0,f.jsxs)(d.Text,{children:["We'd love to keep you on the Business plan."," ",(0,f.jsx)(he.A,{href:"mailto:support@netdata.com",as:"a",cursor:"pointer",textDecoration:"underline",children:"Can we help address any concerns"}),"?"]})]}),Aa=e=>{let{onConfirm:t,onClose:n}=e;const{sendButtonClickedLog:a}=(0,Ie.A)(),{onTrial:i}=(0,va.A)(),[s,o]=(0,l.useState)(),[r,c]=(0,l.useState)(""),[u,m]=(0,l.useState)(""),g=s==Ca,h=g&&(!r||r.specify&&!u),x=(0,l.useCallback)((()=>{o(Ca)}),[o]),p=(0,l.useCallback)((()=>{h||(t(),n(),a({feature:"DowngradeToCommunity",reason:r?.label,details:u},!0))}),[h,a,r,u]),b=g?p:x,j=g?"Submit and Continue Downgrade":"Proceed with Downgrade",v=(0,l.useCallback)((()=>{n(),a({description:"close-billing-plan-change-confirmation-dialog"},!0)}),[a]);return i?(0,f.jsx)(fa.A,{onDecline:v}):(0,f.jsx)(d.ConfirmationDialog,{confirmLabel:j,declineLabel:"Stay on Business Plan","data-ga":"downgrade-dialog","data-testid":"downgradeDialog",handleConfirm:b,handleDecline:v,isConfirmDisabled:h,message:g?(0,f.jsx)(wa,{reason:r,setReason:c,text:u,setText:m}):(0,f.jsx)(Ta,{}),title:"Downgrade to Community?"})};var Sa=a(50979);const Ia=e=>{let{isUpdate:t,currentPlan:n={},billingEmail:a,paymentMethod:i,...s}=e;const[l,o]=(0,Bn.Qh)(),r=!!n.billingEmail&&!o;return t&&a&&i?null:(0,f.jsxs)(d.Flex,{gap:3,alignItems:"center",...s,children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsxs)(d.Flex,{column:!0,gap:1,children:[(0,f.jsxs)(d.Text,{children:["You can't proceed to checkout without having provided a"," ",(0,f.jsx)(d.Text,{strong:!0,children:"payment method"})," and a ",(0,f.jsx)(d.Text,{strong:!0,children:"billing address"}),"."]}),(0,f.jsx)(he.A,{cursor:r?"pointer":"default",disabled:!r,onClick:l,gap:1,"data-ga":"billing-options::click::billing",children:"Please go to the billing portal and fill a payment method"})]})]})},ka=()=>(0,f.jsxs)(d.Flex,{gap:2,alignItems:"center",justifyContent:"center",children:[(0,f.jsx)(d.Icon,{size:"large",color:"warning",name:"warning_triangle"}),(0,f.jsx)(d.Text,{children:"Your space cannot be upgraded, please contact billing@netdata.cloud to resolve the issue."})]});var Fa=a(47090),Pa=a(45187);const Ma=e=>e?`::commited-${e}`:"",$a=(0,r.default)(d.Flex).withConfig({displayName:"checkoutTotals__CheckoutButtonWrapper",componentId:"sc-1q0h6ca-0"})(["background:",";padding:16px 0;position:sticky;bottom:0;z-index:20;"],(0,d.getColor)("mainBackground")),La=(0,ae.A)(d.Button),Ra=(e=>t=>{let{title:n,isDowngrade:a,isUpdate:i,checkoutOrUpdate:s,...l}=t;const[o,,r,d]=(0,p.A)();return i&&a?(0,f.jsxs)(f.Fragment,{children:[o&&(0,f.jsx)(Aa,{title:n,onConfirm:s,onClose:d}),(0,f.jsx)(e,{onClick:r,...l})]}):(0,f.jsx)(e,{onClick:s,...l})})((0,r.default)(La).withConfig({displayName:"checkoutTotals__CheckoutButton",componentId:"sc-1q0h6ca-1"})(["flex:auto;"])),Na=e=>{let{title:t,slug:n,onClose:a,currentPlan:i,price:s,commitment:o,currentCommitment:r=0,email:c,needsCommitment:u,previewData:m,loadingPreview:g,isUpdate:h,promotionCode:x}=e;const{isBanned:b}=s||{},j=(v=i.slug,C=n,(Sa.FJ[C]?.level||0)<(Sa.FJ[v]?.level||0));var v,C;const[y,w]=(0,p.A)(!1),T=b||h&&!y||!h&&!c||u&&(r===o||!o||o<1),[A,S]=(0,p.A)(),I=(0,Bn.L_)(),k=(0,Bn.M4)(),F=h||i.billingEmail,P=F?k:I,{sendLog:M,isReady:$}=(0,Ie.A)(),[L,R]=(0,me.A)(),{activate:N}=(0,Pa.H)(),D=(0,l.useCallback)((()=>{S(),P({productId:s.id,email:m?.billingEmail||c,...u&&{commitment:o},...x&&{promotionCode:x}}).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,Fa.o)(t?.errorMsgKey,t?.errorMessage)||t?.errorMessage||"Something went wrong"})})).finally((()=>{S(),j||N()}))}),[M,$]),B=(_=m?.invoiceLineItems,(0,l.useMemo)((()=>{if(!_?.length)return null;let e=!1;return _.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:la.A.format(n.unitPrice.amount),qty:n.quantity,month:n.month,total:la.A.format(n.total?.amount)}]:e?t.info=[...t.info,{...n,isInfo:!0}]:t.footer=[...t.footer,n],t)),{table:[],footer:[],info:[]})}),[_]));var _;const E=(B?.footer||[]).some((e=>{let{description:t,total:n}=e;return"Subscription Total"===t&&0===n?.amount}));return(0,f.jsxs)(d.Flex,{column:!0,gap:3,children:[g||!B||E?null:(0,f.jsx)(ba,{lineItems:B}),(0,f.jsxs)($a,{column:!0,gap:2,children:[h&&!g&&B&&(0,f.jsx)(pa,{isUpdate:h,previewData:m,lineItems:B,agree:y,toggleAgree:w,zeroPreviewSubscriptionTotal:E}),h&&!g&&(0,f.jsx)(Ia,{currentPlan:i,billingEmail:m?.billingEmail,paymentMethod:m?.paymentMethod,padding:[0,0,4,0],isUpdate:h}),b?(0,f.jsx)(ka,{}):null,(0,f.jsx)(Ra,{title:t,isDowngrade:j,label:h?"Checkout":"Proceed to checkout",disabled:!!T||A,checkoutOrUpdate:D,isLoading:A,"data-ga":`proceedTocheckoutButton::click-${ia(s)}${Ma(o)}::billing`,"data-testid":"billingCheckoutTotals-proceedToCheckoutButton",isUpdate:h})]})]})},Da=e=>{let{prices:t,currentPlan:n}=e;const[a,i]=(0,l.useState)(0),s=t[a],o=s?.commitment,r=(0,Bt.n)("id"),d=(0,E.gr)(r,"ids"),c=(0,U.BU)(d),u=Math.max(5,c.length),[m,g]=(0,l.useState)(n.committedNodes||u);return{recurringIndex:a,setRecurringIndex:i,price:s,needsCommitment:o,commitment:m,handleCommitmentChange:e=>g(e.target.value?parseInt(e.target.value,10):"")}},Ba=e=>t=>{let{modalHeader:n="Checkout",...a}=t;return(0,f.jsx)(d.Modal,{"data-testid":"billing-modal",onEsc:a.onClose,onClickOutside:a.onClose,backdropProps:{backdropBlur:!0},children:(0,f.jsxs)(d.ModalContent,{width:{min:100,base:160},height:"90vh",children:[(0,f.jsxs)(d.ModalHeader,{children:[(0,f.jsx)(d.H4,{children:n}),(0,f.jsx)(d.ModalCloseButton,{onClose:a.onClose,testId:"close-button"})]}),(0,f.jsx)(d.ModalBody,{height:"100%",justifyContent:"between",overflow:{vertical:"auto"},children:(0,f.jsx)(e,{...a})})]})})},_a=3e5,Ea=Ba((e=>{let{title:t,onClose:n,prices:a,currentPlan:s={},children:o}=e;const{recurringIndex:r,setRecurringIndex:c,price:u,needsCommitment:m,commitment:g,handleCommitmentChange:x}=Da({prices:a,currentPlan:s}),{state:p}=(0,i.zy)(),[b,j]=(0,l.useState)(p?.coupon||""),[v,C]=(0,l.useState)(0),[y,w]=(0,l.useState)(_a),T=(0,h.JT)("billing:Manage"),A=(0,Hn.di)({price:u,promotionCode:b,commitment:g}),S=(0,Bn.qW)(A,v),{loading:I,value:k,promoCodeError:F}=S;return(0,En.A)((()=>{I||C((e=>e+1))}),y),(0,l.useEffect)((()=>{w(I?null:_a)}),[I]),(0,f.jsx)($.Ay,{feature:"Billing::UpdateModal",children:T?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[l.Children.map(o,(e=>(0,l.cloneElement)(e,{recurringIndex:r,setRecurringIndex:c,priceLoadable:S}))),(0,f.jsx)(Jn,{needsCommitment:m,commitment:g,handleCommitmentChange:x}),(0,f.jsx)(zn,{}),(0,f.jsx)(Vn,{}),I?(0,f.jsx)(it.A,{title:"Loading billing info...",height:"auto"}):k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(On,{currentPlan:s,...k}),(0,f.jsx)(Vn,{}),(0,f.jsx)(qn,{promotionCode:b,onApply:j,error:F})]}):(0,f.jsx)("div",{children:"No data available"}),(0,f.jsx)(Xn,{currentPlan:s,onCtaClick:n}),(0,f.jsx)(aa,{})]}),(0,f.jsx)(Na,{title:t,slug:u.slug,currentPlan:s,onClose:n,price:u,balance:s.balance,commitment:g,needsCommitment:m,previewData:k,loadingPreview:I,isUpdate:!0,promotionCode:b})]}):(0,f.jsx)(d.Flex,{children:(0,f.jsx)(d.TextBigger,{children:"You don't have permissions to change the plan."})})})}));var Ua=a(67012);const Va=Ba((e=>{let{onClose:t,prices:n,currentPlan:a={},children:s}=e;const{recurringIndex:o,setRecurringIndex:r,price:c,needsCommitment:u,commitment:m,handleCommitmentChange:g}=Da({prices:n,currentPlan:a}),x=(0,Ce.uW)("email"),[p,b]=(0,l.useState)(a.billingEmail||x||""),j=(0,h.JT)("billing:Manage"),{state:v}=(0,i.zy)(),[C,y]=(0,l.useState)(v?.coupon||""),{discount:w,promoCodeError:T}=(0,Bn.D)({productId:c.id,promotionCode:C,...u&&m&&{commitment:m}}),[A,S]=(0,l.useState)(0),I=(0,Hn.Lf)({price:c,promotionCode:C,commitment:m}),k=(0,Bn.Tr)(I,A),{loading:F,value:P}=k;return(0,Ua.A)((()=>()=>S((e=>e+1))),[w,!C]),(0,f.jsx)($.Ay,{feature:"Billing::CheckoutModal",children:j?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[l.Children.map(s,(e=>(0,l.cloneElement)(e,{recurringIndex:o,setRecurringIndex:r,priceLoadable:k}))),(0,f.jsx)(Jn,{needsCommitment:u,commitment:m,handleCommitmentChange:g}),(0,f.jsx)(zn,{}),(0,f.jsx)(Vn,{}),(0,f.jsx)(d.TextInput,{onChange:e=>b(e.target.value),value:p,label:"Billing email",placeholder:"jsmith@example.com"}),(0,f.jsx)(Vn,{}),(0,f.jsx)(qn,{promotionCode:C,onApply:y,error:T}),(0,f.jsx)(Xn,{currentPlan:a,onCtaClick:t})]}),(0,f.jsx)(Na,{currentPlan:a,onClose:t,price:c,balance:a.balance,commitment:m,email:p,needsCommitment:u,previewData:P,loadingPreview:F,promotionCode:C})]}):(0,f.jsx)(d.Flex,{children:(0,f.jsx)(d.TextBigger,{children:"You don't have permissions to change the plan."})})})}));a(72577);var Ha=a(64587);const Oa=e=>{let{text:t,iconProps:n={},iconRight:a,testId:i="billing-feature-item"}=e;return a?(0,f.jsxs)(d.Flex,{"data-test-id":i,width:"100%",gap:2,justifyContent:"between",children:[(0,f.jsx)(d.TextBig,{children:t}),(0,f.jsx)(d.Box,{width:5,children:(0,f.jsx)(d.Icon,{width:"20px",height:"20px",name:"check",color:"primary",...n})})]}):(0,f.jsxs)(d.Flex,{"data-test-id":i,gap:2,children:[(0,f.jsx)(d.Box,{width:5,children:(0,f.jsx)(d.Icon,{width:"20px",height:"20px",name:"check",color:"primary",...n})}),(0,f.jsx)(d.TextSmall,{children:t})]})},Wa=e=>{let{features:t,showViewDetails:n,iconRight:a}=e;return(0,f.jsxs)(d.Flex,{"data-testid":"billing-features-container",column:!0,gap:1,margin:[a?6:0,0,0,0],children:[t.map((e=>{let{text:t,icon:n,iconColor:i}=e;return(0,f.jsx)(Oa,{text:t,iconProps:{...n?{name:n}:{},...i?{color:i}:{}},iconRight:a},t)})),n&&(0,f.jsxs)(d.Flex,{gap:2,children:[(0,f.jsx)(d.Box,{width:5}),(0,f.jsxs)(he.A,{Component:d.Flex,as:i.N_,cursor:"pointer",alignItems:"center",gap:1,color:"text",hoverColor:"textFocus",to:"all-plans",children:[(0,f.jsx)(d.Text,{strong:!0,children:"View full details"}),(0,f.jsx)(d.Icon,{name:"chevron_right",width:"16px",height:"16px"})]})]})]})};var Ya=a(95565),qa=a(67462);const Ja=(0,We.A)(d.TextSmall),za=e=>{let{priceLoadable:t}=e;const{loading:n,amount:a,error:i}=t||{};return n?(0,f.jsx)(d.Text,{lineHeight:"24px",children:"Getting price..."}):i?null:a?(0,f.jsxs)(d.H3,{children:[new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(a),(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):null},Ga=e=>{let{recurringIndex:t,slug:n,version:a,priceLoadable:i}=e;const{loading:s,value:o,hasError:r}=i||{};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,l.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,f.jsx)(d.H3,{children:"Free forever"}),homelab:(0,f.jsxs)(d.H3,{children:["$90.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/year"})]}),"business_2023.02":a?(0,f.jsxs)(d.H3,{children:["$3.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):(0,f.jsx)(za,{priceLoadable:e}),"business_2024.03":a?(0,f.jsxs)(d.H3,{children:["$4.50",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month (billed yearly)"})]}):(0,f.jsx)(za,{priceLoadable:e}),business:(0,f.jsx)(za,{priceLoadable:e})},{free:(0,f.jsx)(d.H3,{children:"Free forever"}),homelab:(0,f.jsxs)(d.H3,{children:["$10.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/month"})]}),"business_2023.02":(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(d.H3,{children:["$4.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month"})]})}),"business_2024.03":(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(d.H3,{children:["$6.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month"})]})}),business:(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(d.H3,{children:["$6.00",(0,f.jsx)(d.TextSmall,{color:"textLite",children:"/Node/month"})]})})}]}({loading:s,amount:c,error:r})),[s,c,r]);return(0,f.jsx)(d.Flex,{"data-testid":"billing-price-container",column:!0,gap:2,children:m[t][`${n}_${a}`]||m[t][n]})},Ka=r.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,i=a>0;return 0==a?(0,f.jsx)(d.TextSmall,{children:"You are using all your committed nodes."}):i?(0,f.jsxs)(d.TextSmall,{children:["You are using"," ",(0,f.jsxs)(d.TextSmall,{strong:!0,color:"error",children:[a," ",(0,qa.su)(a).toLowerCase()," more"]})," ","than your committed nodes."]}):(0,f.jsxs)(d.TextSmall,{children:["You are using"," ",(0,f.jsxs)(d.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:i,nodesLastPeriod:s,showAllPlans:o,showPromotion:r,cancelling:c,onCancelPlan:u,commitment:m}=e;const{localeDateString:g}=(0,Ha.$j)(),h=(0,l.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,l.useMemo)((()=>({column:!0,gap:1,...o?{alignItems:"center"}:{}})),[o]);return(0,f.jsxs)(d.Flex,{...x,children:[!!n&&(0,f.jsxs)(d.TextSmall,{children:[(0,f.jsx)(d.TextSmall,{strong:!0,"data-testid":"billingPricingDetails-interval",children:`Billing ${Sa.rY[t]}`})," ",(0,f.jsxs)(Ja,{color:h.color,tooltip:h.tooltip,noWrapper:!0,children:["(",h.action," ",g(new Date(n),{long:!1}),")"]})]}),r&&"month"===t&&(0,f.jsx)(he.A,{onClick:u,disabled:c,children:(0,f.jsx)(Ka,{children:"Save 25% by changing your billing frequency to yearly"})}),m?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.TextSmall,{children:["Committed Nodes:"," ",(0,f.jsx)(d.Text,{strong:!0,"data-testid":"billingPricingDetails-committedNodesNumber",children:i})]}),"number"===typeof s?(0,f.jsx)(Za,{nodesLastPeriod:s,committedNodes:i}):null]}):null]})},Xa=(e=>t=>{let{inModal:n,recurringIndex:a,setRecurringIndex:i,...s}=t;return n?(0,f.jsxs)(d.Flex,{"data-testid":"billing-recurring-index-container",width:"100%",justifyContent:"between",alignItems:"center",children:[(0,f.jsx)(e,{...s}),(0,f.jsx)(d.Flex,{gap:3,padding:[0,10],children:Sa.HR.map(((e,t)=>(0,f.jsx)(d.RadioButton,{checked:a===t,onChange:()=>i(t),"data-testid":`billingPaidPlans-${e}-radioButton`,children:(0,f.jsx)(d.Text,{color:"textDescription",children:(0,He.Zr)(Sa.rY[e])})},e)))})]}):(0,f.jsx)(e,{...s})})((e=>{let{children:t}=e;return(0,f.jsx)(d.H3,{"data-testid":"billingPricingDetails-activePlanName",children:t})})),ei=e=>{let{slug:t,version:n,prices:a,recurringIndex:i=0,setRecurringIndex:s,currentPlan:o={},isActive:r,showAllPlans:c,showTeaserDetails:u,cancelling:m,onCancelPlan:g,title:h,features:x,nodesLastPeriod:p,inModal:b,priceLoadable:j}=e;const{onTrial:v}=(0,va.A)(),C=r?o.pricing:a[i]?.pricing||{},y=(0,Hn.Kj)(t),w=(0,l.useMemo)((()=>({column:!0,gap:2,...c?{height:"140px",alignItems:"center"}:{}})),[c]),T=(0,l.useMemo)((()=>({column:!0,...c?{alignItems:"center"}:{}})),[c]);return(0,f.jsxs)(d.Flex,{"data-testid":"billing-pricing-details",...w,children:[(0,f.jsxs)(d.Flex,{...T,children:[(0,f.jsxs)(d.Flex,{alignItems:"center",gap:2,children:[(0,f.jsx)(Xa,{inModal:b,recurringIndex:i,setRecurringIndex:s,children:h}),r&&!c&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Pill,{flavour:"success","data-testid":"active-plan",icon:"checkmark_s",children:v?"Trial":"Active"}),v&&(0,f.jsx)(Ya.A,{children:(0,f.jsx)(d.TextBig,{color:"primary",children:"Upgrade Now!"})})]})]}),n&&(0,f.jsxs)(d.TextBig,{children:["(",n,")"]})]}),c||!r||"free"===t?(0,f.jsx)(Ga,{inModal:b,isActive:r,currentPlan:o,recurringIndex:i,slug:t,version:n,priceLoadable:j,...C}):null,!c&&u&&x?.[n]?(0,f.jsx)(Wa,{features:x[n],showViewDetails:!y}):null,r&&!(0,Hn.Kj)(t)&&!v&&(0,f.jsx)(Qa,{...o,showAllPlans:c,showPromotion:!0,cancelling:m,onCancelPlan:g,nodesLastPeriod:p})]})},ti=e=>{let{onConfirm:t,onDecline:n}=e;const{sendButtonClickedLog:a}=(0,Ie.A)(),[i,s]=(0,p.A)(),o=(0,l.useCallback)((()=>{a({feature:"HomelabAcceptTerms"}),t()}),[a]);return(0,f.jsx)(d.ConfirmationDialog,{title:"Terms of usage",confirmLabel:"I agree",declineLabel:"Close",handleConfirm:o,handleDecline:n,isConfirmPositive:!0,isConfirmDisabled:!i,message:(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsx)(d.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,f.jsxs)(d.Text,{children:["For more details on conditions please check our"," ",(0,f.jsx)(he.A,{href:"https://www.netdata.cloud/fair-usage-policy",rel:"noopener noreferrer",strong:!0,target:"_blank",children:"Fair Usage Policy"}),"."]}),(0,f.jsx)(d.Flex,{children:(0,f.jsx)(d.Checkbox,{checked:i,onChange:s,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 ni=a(81691),ai=a(52950);const ii=()=>{const{reseller:e}=(0,s.ap)();return{isReseller:!!e?.ID}},si=()=>{const{isReseller:e}=ii();return e?(0,f.jsxs)(d.Flex,{"data-testid":"billing-reseller-warning",column:!0,gap:1,children:[(0,f.jsxs)(d.Text,{children:["This subscription is managed through a ",(0,f.jsx)(d.Text,{strong:!0,children:"Partner / Reseller"}),"."]}),(0,f.jsxs)(d.Text,{children:["To make any changes to your subscription, please contact your Partner / Reseller or reach out to"," ",(0,f.jsx)(he.A,{href:"mailto:sales@netdata.cloud",as:"a",cursor:"pointer",children:"sales@netdata.cloud"}),"."]})]}):null};var li=a(77058),oi=a(42711),ri=a(37785);const di=(0,r.default)(d.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"})),ci=e=>{let{slug:t,version:n,prices:a=[],isSmall:o,isActive:r,currentPlan:c,showAllPlans:u,showTeaserDetails:m,allPlansView:g=!1,nodesLastPeriod:x,asAnchor:b,anchorText:j,...v}=e;const C=(0,Ce.NJ)(),y=(0,s.vt)(),{isReseller:w}=ii(),{title:T,features:A}=Sa.FJ[t]||Sa.FJ.free,S=(0,h.JT)("billing:Manage"),{sendLog:I,sendButtonClickedLog:k,isReady:F}=(0,Ie.A)(),{onTrial:P}=(0,va.A)(),{cancelling:M,startCancelling:$,stopCancelling:L}=(0,Bn.og)(),R="AWS"==c.paymentProvider,N=(0,l.useCallback)((function(){let{label:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k({label:e},!0)}),[k,F]),D=(0,Hn.z_)({currentPlan:c,slug:t,version:n,onTrial:P}),B=M||r&&(0,Hn.Kj)(t)||c.slug==Sa.VH.earlyBird&&t==Sa.VH.free||c.slug==Sa.VH.free&&"2023.02"==c.version&&t==Sa.VH.free&&"2023.11"==n,[_,E]=(0,l.useState)({}),[U,,V,H]=(0,p.A)(),[O,W]=(0,me.A)(),Y=(0,Bn.M4)(),q="cancel"===_.type&&!(0,Hn.Kj)(c.slug)&&!U,J="cancel"===_.type&&t==Sa.VH.free&&"2023.11"==n,{id:z}=(0,ri.A)(),G=(0,dt.l)(),K=(0,l.useCallback)((()=>{V(),$(),Y({productId:z}).then((()=>{O({header:"Successfully canceled subscription",text:"You are now on Community plan"}),I({isSuccess:!0,description:"cancel-subscription"})})).catch((()=>{W({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(),G()}))}),[I,F]),Z=(0,l.useMemo)((()=>`user-${C}-space-${y}-accept-homelab-terms`),[C,y]),Q=(0,l.useCallback)((()=>{localStorage.setItem(Z,!0)}),[Z]),X=(0,l.useCallback)((()=>"true"==localStorage.getItem(Z)),[Z]),ee=(0,l.useCallback)((e=>{if(!M&&!B)if(t!=Sa.VH.homelab||c.slug==Sa.VH.homelab||X()){if((0,Hn.Kj)(t))return E({type:"cancel"}),void I(e,!0);if((0,Hn.Kj)(c.slug))return oe("checkout"),void I(e,!0);oe("update"),I(e,!0)}else E({type:"homelab"})}),[I,F,_,E]),te=(0,l.useCallback)((()=>{E({}),Q(),setTimeout((()=>{ee({action:ni.o1.buttonClicked},!0)}),200)}),[E,Q,ee]),ne=!!c.billingEmail,ae=ne?Ea:Va,{billingModalType:ie,billingModalSlug:se}=(0,Ee.PP)(),le=["checkout","update"].includes(ie)&&t==se,oe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const n=(0,Ee.PP)();(0,Ee.Z8)({...n,billingModalType:e,billingModalSlug:""==e?e:t})},[re,,de,ce]=(0,p.A)(),ue=(0,l.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,f.jsxs)(f.Fragment,{children:[b?(0,f.jsx)(he.A,{"data-testid":"billing-plan-as-anchor",onClick:()=>{ee({action:ni.o1.buttonClicked,label:D,dataGa:`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`})},children:j}):(0,f.jsxs)(di,{"data-testid":"billing-plan",...ue,children:[(0,f.jsx)(ei,{slug:t,prices:a,isActive:r,currentPlan:c,cancelling:M,showAllPlans:u,showTeaserDetails:m,title:T,version:n,features:A,nodesLastPeriod:x,onCancelPlan:()=>ee({action:ni.o1.buttonClicked,label:T})}),(0,f.jsx)(si,{}),!g&&(0,f.jsx)(vn.A,{Component:d.Button,permission:"billing:Manage","data-ga":`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`,"data-testid":`billingPlan-${t}-${r?"currentPlan":"upgradeButton"}`,label:D,flavour:(0,Hn.Dy)(c?.slug,t),disabled:B,width:"100%",onClick:()=>ee({action:ni.o1.buttonClicked,label:D,dataGa:`upgrade-button::click-${ia({slug:t})}::current-${ia(c)}::billing`}),isLoading:M&&r,loadingLabel:"Cancelling"}),u&&!!A[n]?.length&&(0,f.jsx)(Wa,{features:A[n],iconRight:!0}),!u&&!w&&(0,f.jsxs)(f.Fragment,{children:[P&&(0,f.jsx)(li.A,{flavour:"billing"}),(P||!(0,Hn.Kj)(c.slug))&&(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[(0,f.jsxs)(d.Flex,{gap:6,alignItems:"baseline",children:[P&&(0,f.jsx)(ai.A,{}),!(0,Hn.Kj)(c.slug)&&!R&&(0,f.jsxs)(he.A,{Component:d.Flex,as:i.N_,cursor:"pointer",alignItems:"center",gap:1,color:"text",hoverColor:"textFocus",to:"all-plans",padding:[4,0,0],disabled:M,onClick:()=>N({label:S?"Change plan":"View plans"}),"data-testid":"billingPlan-viewMorePlansLink","data-ga":"change-plan::click::billing",children:[(0,f.jsx)("span",{children:S?"Change plan":"View plans"}),(0,f.jsx)(d.Icon,{name:"chevron_right",width:"16px",height:"16px"})]})]}),P&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(oi.A,{flavour:"billing",color:"textLite",onOptOutClick:de}),re&&(0,f.jsx)(fa.A,{onDecline:ce,onCancellingEnd:()=>{}})]})]})]})]}),(q||J)&&(0,f.jsx)(Aa,{title:T,onConfirm:K,onClose:()=>{H(),E({})}}),"homelab"==_.type?(0,f.jsx)(ti,{onConfirm:te,onDecline:()=>E({})}):null,le&&(0,f.jsx)(ae,{title:T,onClose:()=>{H(),oe()},prices:a,currentPlan:c,showProrations:ne,...ne?{modalHeader:"Update plan"}:{},children:(0,f.jsx)(ei,{slug:t,prices:a,currentPlan:c,title:T,version:n,inModal:!0})})]})},ui=e=>{let{plans:t,isSmall:n,currentPlan:a,showAllPlans:i,showTeaserDetails:s,...l}=e;return(0,f.jsx)(f.Fragment,{children:Sa.tD.map((e=>(Object.entries(t[e]||{})||[]).map((t=>{let[o,r]=t;return(0,f.jsx)(ci,{slug:e,version:o,prices:r,isActive:a.slug==e&&a.version==o,isSmall:n,currentPlan:a,showAllPlans:i,showTeaserDetails:s,...l},`${e}-${o}`)}))))})},mi=e=>{let{isSmall:t,plans:n,currentPlan:a,showAllPlans:i=!1,showTeaserDetails:s=!1}=e;const{version:l}=(0,ri.A)(),o=(n.free?.[a?.version]||n.free?.[l])?.[0];return(0,f.jsxs)(d.Flex,{gap:6,children:[(0,f.jsx)(ci,{slug:"free",version:o?.version,prices:o?.prices,isSmall:t,isActive:"free"===a.slug&&a.version==o?.version,currentPlan:a,showAllPlans:i,showTeaserDetails:s,...i?{background:"panelBg"}:{}}),(0,f.jsx)(ui,{plans:n,isSmall:t,currentPlan:a,showAllPlans:i,showTeaserDetails:s,...i?{background:"panelBg"}:{}})]})},gi=(0,r.default)(d.Flex).attrs((e=>({alignItems:"center",gap:4,...e}))).withConfig({displayName:"headerInfo__HeaderInfo",componentId:"sc-xr03n9-0"})([""]),hi=()=>(0,f.jsxs)(d.Flex,{column:!0,gap:2,width:65,children:[(0,f.jsxs)(d.TextMicro,{children:[(0,f.jsx)(d.TextMicro,{strong:!0,children:"Available credit"})," for you to use on any plan subscriptions with us."]}),(0,f.jsx)(d.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 xi=a(55024);const pi=(0,We.A)(he.A),bi=e=>{let{currentPlan:t}=e;const[n,a]=(0,Bn.Qh)(),i=!!t.billingEmail&&!a,s=(0,h.JT)("billing:ReadAll"),o=t?.marketplaceUrl,r="AWS"===t?.paymentProvider,c=(0,l.useCallback)((()=>{o&&(location.href=o)}),[o]);return(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsx)(d.H3,{children:"Plan & Billing"}),(0,f.jsx)(gi,{children:s?(0,f.jsxs)(f.Fragment,{children:[r?null:(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Credit:"}),(0,f.jsx)(d.Text,{"data-testid":"billingHeader-credits",strong:!0,children:la.A.format(t.balance.amount||0)}),(0,f.jsx)(Oe.A,{content:hi,align:"bottom",isBasic:!0,children:(0,f.jsx)(d.Icon,{name:"information",width:"16px",height:"16px",color:"textLite"})})]}),(0,f.jsxs)(d.Text,{children:["Billing email:"," ",(0,f.jsx)(d.Text,{strong:!0,"data-testid":"billingHeader-email",children:t.billingEmail||"-"})]}),(0,f.jsx)(xi.A,{}),o?(0,f.jsxs)(pi,{Component:d.Flex,cursor:"pointer",onClick:c,alignItems:"center",gap:1,tooltip:"Manage your subscription on the AWS Marketplace","data-ga":"billing-options::click::billing","data-testid":"billingHeader-goToMarketplace",children:[(0,f.jsx)("span",{children:"Manage your Subscription"}),(0,f.jsx)(d.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]}):(0,f.jsxs)(he.A,{Component:d.Flex,cursor:i?"pointer":"default",disabled:!i,onClick:n,alignItems:"center",gap:1,"data-ga":"billing-options::click::billing","data-testid":"billingHeader-goToPortal",children:[(0,f.jsx)(d.Text,{color:"link",children:"Billing options and Invoices"}),(0,f.jsx)(d.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]})]}):(0,f.jsx)(xi.A,{})}),(0,f.jsx)(Un,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}})]})};a(78898);var ji=a(43329),fi=a(52365);function vi(e){const t=(0,fi.A)(e?.in),n=(0,ji.w)(e?.in,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()-1),n.setHours(23,59,59,999),n}var Ci=a(6463),yi=a(69821),wi=a(60125);function Ti(e,t,n){const{years:a=0,months:i=0,weeks:s=0,days:l=0,hours:o=0,minutes:r=0,seconds:d=0}=t,c=(0,wi.a)(e,i+12*a,n),u=(0,yi.e)(c,l+7*s,n),m=1e3*(d+60*(r+60*o));return(0,ji.w)(n?.in||e,+u-m)}var Ai=a(63537),Si=a(66118),Ii=a(5638),ki=a(44731),Fi=a(54803),Pi=a(55164),Mi=a(42790),$i=a(47809);const Li={nodes:1,p90:2,committed_nodes:3},Ri={"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."};Si.t1.register(Si.kc,Si.PP,Si.E8,Si.FN,Si.No,Si.s$,Si.m_,Si.ZT,Si.A6,Ii.A),Si.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 Ni=e=>({nodes:{label:"Daily count",type:"bar",color:(0,d.getColor)("text")({theme:e}),backgroundColor:(0,d.getColor)("primary")({theme:e}),borderColor:(0,d.getColor)("primary")({theme:e}),borderWidth:2,pointStyle:"rectangle",usePointStyle:!0},p90:{label:"Period count",type:"line",color:(0,d.getColor)("text")({theme:e}),borderColor:(0,d.getColor)(["purple","lilac"])({theme:e}),borderWidth:2,fill:!1,stepped:!0},committed_nodes:{label:"Committed nodes",type:"line",color:(0,d.getColor)("text")({theme:e}),borderColor:(0,d.getColor)(["blue","aquamarine"])({theme:e}),borderWidth:2,fill:!1,borderDash:[1,2],borderDashOffset:1,pointStyle:!1}}),Di={border:{side:"all",color:"inputBorder",padding:[3]},round:!0},Bi=vi(),_i=(0,Ci.o)(Ti(Bi,{months:1})),Ei=e=>{let{onNodesLastPeriodFetch:t}=e;const n=(0,Mi.rW)("offset"),a=(0,s.vt)(),[i,o]=(0,l.useState)((()=>({start:_i,end:Bi}))),[c,u,m]=(0,ot.A)((()=>({enabled:!!a&&!!i.start&&!!i.end,fetch:()=>(0,$i.U2)(a,{after:Math.floor((0,Ai.W)((0,Ha.ii)(i.start,n))/1e3),before:Math.floor((0,Ai.W)((0,Ha.ii)(i.end,n))/1e3)}),initialValue:{labels:[],data:[]},onSuccess:e=>{let{data:n,labels:a}=e;if(!n.length)return;const i=n.at(-1),s=i[a.indexOf("nodes")],l=i[a.indexOf("timestamp")];t((e=>e.timestamp>l?e:{timestamp:l,value:s}))}})),[a,i,t]),g=(0,l.useContext)(r.ThemeContext),h=(0,l.useMemo)((()=>{const e=c.data.map((e=>{let[t]=e;return t})),t=c.labels.reduce(((t,n,a)=>a?[{...Ni(g)[n],data:e.map(((e,t)=>c.data[t][a])),order:Li[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,Ha.$j)(),i=(0,l.useRef)(!1),s=(0,l.useRef)(),o=(0,l.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){!i.current&&s.current&&(i.current=!0,s.current.innerHTML=Ri[t.text],s.current.style.left=e.x+"px",s.current.style.top=e.y+"px",s.current.style.visibility="visible",s.current.style.transform="translateY(-100%)")},onLeave:function(){s.current&&(i.current=!1,s.current.innerHTML="",s.current.style.visibility="hidden")}},tooltip:{enabled:!0,mode:"nearest",intersect:!1,yAlign:"bottom",usePointStyle:!0,position:"follow",backgroundColor:(0,d.getColor)("tooltip")({theme:e}),color:(0,d.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,i)=>({...n,[`annotation${i}`]:{type:"line",value:t.findIndex((e=>e[0]===a.timestamp)),borderColor:(0,d.getRgbColor)("attention",.3)({theme:e}),borderDashOffset:0,borderWidth:10,drawTime:"afterDatasetsDraw",label:{drawTime:"afterDatasetsDraw",display:!1,backgroundColor:(0,d.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${i}`];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${i}`].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,d.getColor)("textLite")({theme:e})}},y:{beginAtZero:!0,ticks:{color:(0,d.getColor)("textLite")({theme:e})}}}})),[e,t]);return[o,s]}(g,c);return(0,f.jsxs)(d.Flex,{column:!0,gap:4,children:[(0,f.jsxs)(d.Flex,{alignItems:"center",justifyContent:"between",children:[(0,f.jsx)(d.H3,{children:"Usage"}),(0,f.jsx)(Fi.A,{values:i,utc:n,onChange:o,tagging:"billing-usage",isPlaying:!1,onlyDates:!0,accessorProps:Di,padding:[4,0],width:"auto",maxDate:Bi})]}),(0,f.jsxs)(d.Flex,{position:"relative",height:90,children:[u?(0,f.jsx)(it.A,{height:"calculate(100vh-375px)",title:"Loading billing data..."}):m?(0,f.jsx)(Pi.H4,{title:"Chart couldn't be loaded"}):(0,f.jsx)(ki.t1,{type:"bar",data:h,options:x}),(0,f.jsx)(d.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"})]})]})},Ui=e=>{let{isSmall:t,currentPlan:n,loaded:a,currentLoaded:i,plans:s}=e;const[o,r]=(0,l.useState)({timestamp:null,value:null}),d=s[n.slug]?s[n.slug][n.version]:[];return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(bi,{currentPlan:n}),a&&i?(0,f.jsxs)(f.Fragment,{children:[(0,Hn.Kj)(n.slug)?(0,f.jsx)(mi,{isSmall:t,plans:s,currentPlan:n,showTeaserDetails:!0}):(0,f.jsx)(ci,{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,f.jsx)(Un,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,f.jsx)(Ei,{onNodesLastPeriodFetch:r})]}):(0,f.jsx)(_n.Jr,{})]})};var Vi=a(41514);const Hi={year:"Yearly",month:"Monthly"},Oi=e=>{let{currentPlan:t}=e;const n=(0,s.bq)(),[a,l]=(0,Bn.Qh)(),{cancelling:o,startCancelling:r,stopCancelling:c}=(0,Bn.og)(),u=!!t.billingEmail&&!l,[m,g]=(0,p.A)(),[x,b]=(0,me.A)(),j=(0,Bn.M4)(),{title:v}=Sa.FJ[t.slug]||Sa.FJ.free,{id:C}=(0,ri.A)(),y=(0,h.JT)("billing:Manage"),w=(0,h.JT)("billing:ReadAll"),{title:T}=Sa.FJ[t?.slug]||Sa.FJ.free,A=Hi[t?.interval];return(0,f.jsxs)(d.Flex,{column:!0,gap:2,children:[(0,f.jsxs)(d.Flex,{gap:2,alignItems:"center",children:[(0,f.jsx)(he.A,{as:i.N_,to:`/spaces/${n}/settings/billing`,disabled:o,color:"text",hoverColor:"textLite",showToolTip:!0,content:"Back to Plan & Billing",align:"bottom",isBasic:!0,children:(0,f.jsx)(d.Icon,{name:"arrow_left",width:"20px",height:"20px",margin:[1.5,0,0]})}),(0,f.jsx)(d.H3,{children:"All Plans"})]}),(0,f.jsxs)(gi,{children:[(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Active plan:"}),(0,f.jsx)(d.Text,{strong:!0,children:T})]}),A&&(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Billing frequency:"}),(0,f.jsx)(d.Text,{strong:!0,children:A})]}),t.commitment?(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Committed Nodes:"}),(0,f.jsx)(d.Text,{strong:!0,children:t?.committedNodes||0})]}):null,w&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Credit:"}),(0,f.jsx)(d.Text,{strong:!0,children:la.A.format(t?.balance?.amount||0)}),(0,f.jsx)(Oe.A,{content:hi,align:"bottom",isBasic:!0,children:(0,f.jsx)(d.Icon,{name:"information",width:"16px",height:"16px",color:"textLite"})})]}),(0,f.jsxs)(d.Flex,{gap:1,alignItems:"center",children:[(0,f.jsx)(d.Text,{children:"Billing email:"}),(0,f.jsx)(d.Text,{strong:!0,children:t?.billingEmail||"-"})]})]}),(0,f.jsx)(xi.A,{}),(0,f.jsxs)(he.A,{Component:d.Flex,cursor:u?"pointer":"default",disabled:!u,onClick:a,alignItems:"center",gap:1,children:[(0,f.jsx)(d.Text,{color:"link",children:"Billing options and Invoices"}),(0,f.jsx)(d.Icon,{name:"nav_arrow_goto",width:"12px",height:"12px"})]}),!(0,Hn.Kj)(t?.slug)&&(0,f.jsx)(he.A,{Component:d.Flex,cursor:"pointer",onClick:g,alignItems:"center",gap:1,disabled:o||!y,"data-ga":"cancel-plan::click::billing",children:(0,f.jsx)(d.Text,{textDecoration:"underline",children:o?"Canceling plan...":"Cancel plan"})})]}),(0,f.jsx)(Un,{height:1,width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),m&&(0,f.jsx)(Aa,{title:"Community",onConfirm:()=>{r(),j({productId:C}).then((()=>((0,Vi.H)("billing","cancel-plan","global-view",{slug:t?.slug,interval:t?.interval,success:!0}),x({header:"Successfully requested subscription cancellation",text:"When your current subscription expires you will be moved to the Community Plan"})))).catch((()=>((0,Vi.H)("billing","cancel-plan","global-view",{slug:t?.slug,interval:t?.interval,success:!1}),b({header:"Failed to cancel the subscription",text:`Remained on ${v} plan`})))).finally((()=>{c()}))},onClose:g})]})},Wi=e=>{let{plans:t,currentPlan:n}=e;const{sendButtonClickedLog:a}=(0,Ie.A)(),{version:i}=(0,ri.s)(),s=t[Sa.VH.homelab]?.[i],o=(0,l.useCallback)((()=>{window.open("https://www.netdata.cloud/request-enterprise/","_blank","noopener,noreferrer"),a({feature:"OnPremContact"})}),[a]),r=(0,l.useCallback)((()=>{window.open("https://www.netdata.cloud/pricing/","_blank","noopener,noreferrer"),a({feature:"OnPlanComparison"})}),[a]);return(0,f.jsxs)(d.Flex,{column:!0,gap:2,alignItems:"center",children:[(0,f.jsxs)(d.Text,{children:["Check our"," ",(0,f.jsx)(ci,{asAnchor:!0,anchorText:"Homelab Plan",slug:Sa.VH.homelab,plans:t,version:i,prices:s,currentPlan:n})," ","for home-based projects and our ",(0,f.jsx)(he.A,{onClick:o,children:"On-prem Plan"})," for full onsite deployment!"]}),(0,f.jsx)(he.A,{onClick:r,children:"Check the full plan comparison on our website."})]})};var Yi=a(29022);const qi=()=>(0,f.jsx)(Yi.A,{title:"No access",children:(0,f.jsx)(d.Text,{children:"You don't have permissions to view this page."})}),Ji=e=>{let{plans:t,plansLoaded:n,currentPlan:a}=e;const{isReseller:i}=ii();return i?(0,f.jsx)(qi,{}):n?(0,f.jsxs)(d.Flex,{column:!0,gap:8,height:"100%",overflow:{vertical:"auto"},children:[(0,f.jsx)(Oi,{currentPlan:a}),(0,f.jsxs)(d.Flex,{column:!0,gap:8,alignItems:"center",children:[(0,f.jsx)(mi,{plans:t,currentPlan:a,showAllPlans:!0,showTeaserDetails:!0}),(0,f.jsx)(Wi,{plans:t,currentPlan:a})]})]}):(0,f.jsx)(_n.Jr,{})},zi={month:"Monthly",year:"Yearly"},Gi=()=>{const[e,t]=(0,i.ok)(),[n,a]=(0,me.A)(),{activate:s}=(0,Pa.H)();(0,l.useEffect)((()=>{const a=e.get("from"),i=e.get("from_committed_nodes"),l=e.get("interval"),o=e.get("result"),r=e.get("to"),d=e.get("to_committed_nodes"),c=e.get("from_trial"),u=e.get("bundle_quantity"),m=(0,Hn.JR)(a,r);if(o){const g="success"===o,h={from:a,fromNodes:i,interval:l,to:r,toNodes:d,fromTrial:c,bundleQuantity:u,success:g};g&&n((e=>{let{from:t,to:n,fromNodes:a,toNodes:i,interval:s,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=zi[s]||s;if(t===n&&a===i)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<i?"increased":"decreased"} from ${a} to ${i} 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`}})(h)),(0,Vi.H)("billing","callback","global-view",h),m&&s(),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,a,s])},Ki=()=>{const[e]=(0,Ne.Ay)();return(0,f.jsx)(i.C5,{replace:!0,to:`/spaces/${e}`})},Zi=e=>{let{title:t,message:n}=e;return(0,f.jsx)(Yi.A,{title:t,children:(0,f.jsx)(d.TextBig,{children:n})})},Qi=()=>{Gi();const{loaded:e,value:t,hasError:n}=(0,Bn.lU)(),{loaded:a,value:s,error:o}=(0,Bn.JN)(),r="AWS"===s?.paymentProvider,c=(0,Ot.J)(),u=(0,l.useMemo)((()=>n?"Something went wrong while trying to fetch billing plans.":o),[n,o]);return e&&a?o||n?(0,f.jsx)(Zi,{title:"Error",message:u}):(0,f.jsx)($.Ay,{feature:"Billing",children:(0,f.jsx)(d.Flex,{column:!0,height:"calc(100% - 30px)",gap:3,children:(0,f.jsxs)(i.BV,{children:[(0,f.jsx)(i.qh,{path:"/all-plans",element:r?(0,f.jsx)(Ki,{}):(0,f.jsx)(Ji,{plans:t,plansLoaded:e,currentPlan:s})}),(0,f.jsx)(i.qh,{path:"/",element:(0,f.jsx)(Ui,{isSmall:c,currentPlan:s,loaded:e,currentLoaded:a,plans:t})})]})})}):(0,f.jsx)(_n.Jr,{})};var Xi=a(14815),es=a(4204);const ts=(0,o.A)((()=>Promise.all([a.e(8791),a.e(3185)]).then(a.bind(a,53185)))),ns=(0,o.A)((()=>Promise.all([a.e(6394),a.e(7044)]).then(a.bind(a,97044)))),as=(0,r.default)(c.t).withConfig({displayName:"manageWorkspace__ColumnHeader",componentId:"sc-1q2o0yg-0"})(["width:180px;padding:16px;"]),is=e=>t=>(0,f.jsx)(l.Suspense,{fallback:(0,f.jsx)(_n.aW,{}),children:(0,f.jsx)(e,{...t})}),ss=e=>t=>(0,f.jsx)(u.Yv,{flex:"1",overflow:"hidden",children:(0,f.jsx)(e,{...t})}),ls=e=>t=>{let{containerProps:n={},...a}=t;return(0,f.jsx)(u.Yv,{flex:"1",overflow:"hidden",height:"100%",padding:[4,0,0],...n,children:(0,f.jsx)(e,{...a})})},os=ss(Rn),rs=ss(_e),ds=ss(yt),cs=ls(bt),us=ls(xn),ms=ss(Qi),gs=ls(is(ts)),hs=ss(is(ns)),xs=(0,l.memo)((()=>{const e=(0,i.Zp)(),{state:t={},pathname:n}=(0,i.zy)(),{settingsTab:a,...o}=(0,i.g)(),[r]=(0,l.useState)(t?.previousUrlPath||null),c=(0,s.ap)("name"),g=(0,s.ap)("id"),x=(e=>{const t=B.IV.indexOf(e);return-1!==t?t:B.Wk})(a),p=(0,l.useCallback)((t=>{const a=((e,t)=>{const n=e.split("/"),a=n.indexOf("settings")+1-n.length;return`${n.slice(0,a).join("/")}/${B.IV[t]||B.Wk}`})(n,t);e(a)}),[a]);(0,l.useEffect)((()=>{B.ys[a]||e((0,i.tW)(n,{...o,settingsTab:B.Wk}))}),[]);const b=(0,h.JT)("billing:ReadBasic"),j=(0,h.JT)("room:AddNode"),v=(0,h.JT)("user:ReadAll"),C=(0,h.JT)("channel:ReadAll"),y=(0,A.At)(),w=(0,Ue.ES)(g);(0,l.useEffect)((()=>{b||a===B.bO&&e((0,i.tW)(n,{...o,settingsTab:B.Wk}))}),[b,a]);const T=(0,s.bq)(),S=(0,l.useCallback)((t=>{e(t?`/spaces/${t}`:r||`/spaces/${T}`)}),[r,T]);return c?(0,f.jsx)($.Ay,{feature:"SpaceSettings",children:(0,f.jsxs)(u.GO,{full:!0,"data-testid":"manageWorkspaceModal",closeOnClickOutside:!1,closeOnEsc:!1,onClose:S,width:"100%",children:[(0,f.jsx)(m.z,{"data-testid":"manageWorkspaceModal-header",onClose:S,title:(0,f.jsx)(Dn,{})}),(0,f.jsxs)(d.Tabs,{row:!0,column:!1,"data-testid":"manageWorkspaceModal-tabs",selected:x,onChange:p,TabsHeader:as,tabsProps:{column:!0},height:"100%",noDefaultBorder:!0,position:"relative",overflow:"hidden",width:"100%",children:[w?null:(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-spaceTab",label:B.ys[B.mm],"data-ga":"manage-space::click-tab::space-tab",isMenuItem:!0,children:(0,f.jsx)(os,{"data-testid":"manageWorkspaceModal-spaceTabContent",onClose:S,small:!0})}),!w&&j?(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-warRoomsTab","data-ga":"manage-space::click-tab::rooms-tab",label:"Rooms",isMenuItem:!0,children:(0,f.jsx)(rs,{"data-testid":"manageWorkspaceModal-warRoomsTabContent"})}):null,j||y?(0,f.jsx)(d.Tab,{basis:0,label:"Nodes","data-testid":"manageWorkspaceModal-nodesTab","data-ga":"manage-space::click-tab::nodes-tab",isMenuItem:!0,children:(0,f.jsx)(ds,{"data-testid":"manageWorkspaceModal-nodesTabContent"})}):null,!w&&v?(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-usersTab","data-ga":"manage-space::click-tab::users-tab",label:"User Management",isMenuItem:!0,children:(0,f.jsx)(cs,{"data-testid":"manageWorkspaceModal-usersTabContent"})}):null,!w&&C?(0,f.jsx)(d.Tab,{basis:0,label:"Alerts & Notifications","data-testid":"manageWorkspaceModal-notificationsTab","data-ga":"manage-space::click-tab::notifications-tab",isMenuItem:!0,children:(0,f.jsx)(us,{})}):null,w||!b||es.ei?null:(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-billingTab","data-ga":"manage-space::click-tab::billing-tab",label:"Plan & Billing",isMenuItem:!0,children:(0,f.jsx)(ms,{"data-testid":"manageWorkspaceModal-billingTabContent"})}),!w&&j?(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-integrationsTab","data-ga":"manage-space::click-tab::integrations-tab",label:"Integrations",isMenuItem:!0,children:(0,f.jsx)(gs,{flavour:Xi.D_.settingsPage,containerProps:{padding:[0]},"data-testid":"manageWorkspaceModal-integrationsTabContent"})}):null,(0,f.jsx)(d.Tab,{basis:0,"data-testid":"manageWorkspaceModal-configurationsTab","data-ga":"manage-space::click-tab::configurations-tab",label:B.ys[B.$d],isMenuItem:!0,children:(0,f.jsx)(hs,{})})]})]})}):null})),ps=()=>{const e=(0,s.ap)("id"),t=(0,Ue.ES)(e)?"virtual":"default",n=B.DT[t],{pathname:a,state:l}=(0,i.zy)();return(0,f.jsxs)(i.BV,{children:[(0,f.jsx)(i.qh,{path:"/",element:(0,f.jsx)(i.C5,{state:l,to:{pathname:`${a}/${n}`}})}),(0,f.jsx)(i.qh,{path:":settingsTab/*",element:(0,f.jsx)(xs,{})})]})}},93926:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var a=n(92415),i=n(74848);const s=e=>{let{message:t,title:n,footer:s,...l}=e;const o=l?.["data-testid"]||"functionError";return(0,i.jsxs)(a.Flex,{alignItems:"center",column:!0,"data-testid":o,flex:!0,gap:3,justifyContent:"center",padding:[0,20],...l,children:[(0,i.jsx)(a.H3,{"data-testid":`${o}-title`,children:n}),(0,i.jsx)(a.TextBig,{color:"textDescription","data-testid":`${o}-message`,children:t}),s]})}},95263:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var a=n(92415),i=n(45087),s=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,s.jsxs)(a.Flex,{"data-testid":`${r}-container`,gap:1,children:[(0,s.jsxs)(a.TextSmall,{color:"textLite","data-testid":r,children:[l,n&&" *"]}),t&&(0,s.jsx)(i.A,{align:"top",content:t,"data-testid":`${r}-info`,plain:!0,children:(0,s.jsx)(a.Icon,{color:"textLite",name:"information",size:"small"})})]})}},97200:(e,t,n)=>{var a=n(13222),i=0;e.exports=function(e){var t=++i;return a(e)+t}},98563:(e,t,n)=>{"use strict";n.d(t,{$m:()=>r,He:()=>s,Jg:()=>m,MU:()=>l,Oj:()=>d,W6:()=>o,fn:()=>c,id:()=>u});var a=n(33185),i=n(92415);const s=(0,a.default)(i.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)(i.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)(i.TextSmall).withConfig({displayName:"styled__LearnMoreTest",componentId:"sc-wc4x41-2"})(["position:relative;"]),r=(0,a.default)(i.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)(i.ModalCloseButton).attrs({color:"text",height:"16px",width:"16px"}).withConfig({displayName:"styled__ModalClose",componentId:"sc-wc4x41-4"})(["&:hover{fill:",";}"],(0,i.getColor)("selected")),c=(0,a.default)(i.Flex).attrs((e=>{let{hasBorder:t,...n}=e;return{...t?{border:{side:"bottom",color:"disabled"}}:{},column:!0,padding:[3,4],...n}})).withConfig({displayName:"styled__ModalSection",componentId:"sc-wc4x41-5"})([""]),u=(0,a.default)(i.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)(i.Icon).attrs({height:"12px",width:"12px",color:"white"}).withConfig({displayName:"styled__SystemIcon",componentId:"sc-wc4x41-7"})(["position:relative;top:2px;"])},99243:(e,t,n)=>{"use strict";n.d(t,{PL:()=>o,Te:()=>r,bg:()=>l});var a=n(33185),i=n(92415),s=n(68399);const l=(0,a.default)(i.Flex).attrs({position:"relative"}).withConfig({displayName:"styled__TrialWarningSidebar",componentId:"sc-66x250-0"})(["background-color:",";border-width:1px;border-style:dashed;border-color:",";border-radius:2px;"],(e=>{let{type:t}=e;return(0,i.getColor)(s.W1[t]?.background)}),(e=>{let{type:t}=e;return(0,i.getColor)(s.W1[t]?.border)})),o=(0,a.default)(i.Button).withConfig({displayName:"styled__TrialUpgradeButton",componentId:"sc-66x250-1"})(["flex:auto;"]),r=(0,a.default)(i.Text).attrs({strong:!0,lineHeight:.8}).withConfig({displayName:"styled__PromoText",componentId:"sc-66x250-2"})(["background-color:",";background-image:linear-gradient( 43deg,"," 0%,"," 46%,"," 100% );-webkit-background-clip:text;-webkit-text-fill-color:transparent;"],(0,i.getColor)("primary"),(0,i.getColor)(["blue","aquamarine"]),(0,i.getColor)(["purple","mauve"]),(0,i.getColor)("primary"))}}]);
.
Edit
..
Edit
.well-known
Edit
1220.b5030d4f6c19cff18b5d.chunk.js
Edit
1526.2e0da49c8b248f8838e5.chunk.js
Edit
1608.f70ccf0a50f362fa3fa0.chunk.js
Edit
1658.c2588099b7f89218fee2.chunk.js
Edit
1688.af50b49f458d38b886e7.chunk.js
Edit
1736.59d594b818941f2ce47b.chunk.js
Edit
180.0071e77183ba4cd7c960.chunk.js
Edit
1861.93004b622a5d661c1ce5.chunk.js
Edit
1878.e8ad0341fa952dcaa69d.chunk.js
Edit
1910.5dac3ccbf770c5a8782f.chunk.js
Edit
1975.1d9f35e792f95113a77c.js
Edit
1975.1d9f35e792f95113a77c.js.LICENSE.txt
Edit
2003.901eefb4549f4624f25a.chunk.js
Edit
2117.89fd5b63f4702229fd3d.chunk.js
Edit
2143.a2fb8829f543bfdff7e7.chunk.js
Edit
2177.47053592985906c16af1.chunk.js
Edit
2201.56f3a296a42477f3afca.chunk.js
Edit
2248.e47532a26e1fddb5877d.chunk.js
Edit
2436.c182329f750b53c90d5d.chunk.js
Edit
2439.75f198fe237869a75b33.chunk.js
Edit
2558.9dba3bb153ce5927ce12.chunk.js
Edit
2573.f3a5355fdf81ccd151b4.chunk.js
Edit
2576.4273c3f785077a71832c.chunk.js
Edit
2576.eaad527ad5b2c56e97a0.css
Edit
2599.45a1299278c35e33f4ed.chunk.js
Edit
2599.45a1299278c35e33f4ed.chunk.js.LICENSE.txt
Edit
2603.17957f20f02087caab19.chunk.js
Edit
2634.a1442815ba1010be1d98.chunk.js
Edit
271.d3eff36499f41f5bb9da.chunk.js
Edit
2904.9157df1583f1c9002ca5.chunk.js
Edit
2948.09dd3c53f41c380dceb7.chunk.js
Edit
3083.28efa80f64f62260d9eb.chunk.js
Edit
3185.923759cdd74fb418589c.chunk.js
Edit
3427.f55ad12960d277af2264.chunk.js
Edit
3427.f55ad12960d277af2264.chunk.js.LICENSE.txt
Edit
3439.1bcf58ac033ded28f2b5.chunk.js
Edit
3457.123522e362abe866dad6.chunk.js
Edit
35.21a034547342fa3bcc2a.chunk.js
Edit
3545.1ec3f11f61ec4e2494a9.chunk.js
Edit
3600.7bec358eae402302d657.chunk.js
Edit
363.997c8d2af179d92d05e5.chunk.js
Edit
3677.0c357c060b24c45a53e8.chunk.js
Edit
3718.a7eae94d5724f3dde3b7.chunk.js
Edit
3808.bc30c23a679864055e04.chunk.js
Edit
3864.f2934207abce02209e4c.chunk.js
Edit
3961.ca0c46bfd51f47a2cda8.chunk.js
Edit
3961.ca0c46bfd51f47a2cda8.chunk.js.LICENSE.txt
Edit
399.a9226671ac721fab9d9e.chunk.js
Edit
3D_PARTY_LICENSES.txt
Edit
4142.aaa6e2800c5240c05b17.chunk.js
Edit
4211.40307badf88a9dbf63d4.chunk.js
Edit
4265.3f3234be7c8a55251ac8.chunk.js
Edit
4277.631373c91eb811e8c932.chunk.js
Edit
4301.aaf9c1c63bebee61d7fc.chunk.js
Edit
4424.7698b89fcfe6e38b42e0.chunk.js
Edit
4484.a4db9992788ab985a7aa.chunk.js
Edit
4557.ea26e3d63ac1b182fce6.chunk.js
Edit
4606.848d4fe91809baf5893d.chunk.js
Edit
4606.848d4fe91809baf5893d.chunk.js.LICENSE.txt
Edit
4651.adacb7e41df32061bba0.chunk.js
Edit
4837.51dad8530d2f2a14c1cf.chunk.js
Edit
4913.c37fec249a3641575201.chunk.js
Edit
5178.90e3e6cd1d3667d98d6f.chunk.js
Edit
5187.723d0f5d1df655f1b3fc.chunk.js
Edit
5295.edb733a5ee6333846fdf.chunk.js
Edit
5297.798316bd9db8fedce2bb.chunk.js
Edit
5302.4b47d5439ed08d55e3f5.chunk.js
Edit
5476.5c5f9ae76a8c2f0877cf.chunk.js
Edit
5566.f78a96c7ef9848c399f4.chunk.js
Edit
5883.b4c449e9bb7308fad2dc.chunk.js
Edit
6003.841d58f503bf499c060e.chunk.js
Edit
6025.f49fac3d56960a2805c1.chunk.js
Edit
6141.dfbfb08c01ed04c2169d.chunk.js
Edit
6238.a8fb4aa9fc891cfb51f3.chunk.js
Edit
6238.a8fb4aa9fc891cfb51f3.chunk.js.LICENSE.txt
Edit
6333.e77a934eb04b0eb0f5be.chunk.js
Edit
6394.a9d4a03cab766efdc356.chunk.js
Edit
6403.fbabb959f60c4542aae7.chunk.js
Edit
6497.894ffabaed935f4b342f.chunk.js
Edit
6554.3c63c01686962f7d1c0f.chunk.js
Edit
6554.3c63c01686962f7d1c0f.chunk.js.LICENSE.txt
Edit
6601.3f61ad288763eb2383b9.chunk.js
Edit
6839.3ec36ce8f056cfddbcf1.chunk.js
Edit
7044.46c256fbc513b6eed54f.chunk.js
Edit
7214.b6fd11f96b3ffeaa6816.chunk.js
Edit
7281.462683cb947093631ff5.chunk.js
Edit
7493.ec49dc27716b35770a5b.chunk.js
Edit
7530.596a9e04a8215d608bc9.chunk.js
Edit
7543.b2ec9a59729685233c38.chunk.js
Edit
7799.a778555137b174b0b456.chunk.js
Edit
7877.f78c39db5d2ce9e1b1d5.chunk.js
Edit
7931.9cd898618ba69caff6bb.chunk.js
Edit
8399.a5150eb9c97aa708656c.chunk.js
Edit
8496.835203ace1654a8ccca0.chunk.js
Edit
8496.835203ace1654a8ccca0.chunk.js.LICENSE.txt
Edit
8554.52a000357fb7e14ecde5.chunk.js
Edit
8643.3c3f45d5e7addf0e57d5.chunk.js
Edit
8761.38500967ddaccc13f5bb.chunk.js
Edit
8791.cf1fbe47e364597c440d.chunk.js
Edit
8800.a223b58afba045f3c97a.chunk.js
Edit
884.b54aa151f26b6843c204.chunk.js
Edit
8904.6cc4eb24511e77506623.chunk.js
Edit
8904.6cc4eb24511e77506623.chunk.js.LICENSE.txt
Edit
8904.d489f3f6dbbebd1b75d7.css
Edit
8938.a2497ed93de337ddbb0f.chunk.js
Edit
9244.29e85b5c3a17abcc5af9.chunk.js
Edit
9341.5576fb15ed6e5ed17379.chunk.js
Edit
9418.b9106ab8be57b55c0f9e.chunk.js
Edit
9418.b9106ab8be57b55c0f9e.chunk.js.LICENSE.txt
Edit
953.fc05c7ea38f22d41f9e4.chunk.js
Edit
9707.92db7d8fda6d4753e130.chunk.js
Edit
9822.e18427b743ec095b7398.chunk.js
Edit
9856.d027b2340b4472a77570.chunk.js
Edit
9883.94277bc993ddb8cda3a6.chunk.js
Edit
9961.104c008a01728aa02f5a.chunk.js
Edit
LICENSE.md
Edit
LICENSE.txt
Edit
agent.html
Edit
allFiles.7.74.1.json
Edit
allFiles.7.json
Edit
app.4ad9430fc3fa0253ec85.js
Edit
app.4da0883c6ce016bf3d81.css
Edit
apple-app-site-association
Edit
bundlesManifest.7.json
Edit
favicon.ico
Edit
index.html
Edit
local-agent.html
Edit
netdata.charts.38c5a9e170db41ee4aba.js
Edit
netdata.charts.38c5a9e170db41ee4aba.js.LICENSE.txt
Edit
netdata.ui.86f6f0522844ad164ef6.js
Edit
netdata.ui.86f6f0522844ad164ef6.js.LICENSE.txt
Edit
npm.react.dom.bbfab54c35c150f7c4f6.js
Edit
npm.react.dom.bbfab54c35c150f7c4f6.js.LICENSE.txt
Edit
registry-access.html
Edit
registry-alert-redirect.html
Edit
registry-hello.html
Edit
runtime.2b31130f7ec6d7d8f47c.js
Edit
static
Edit
sw.js
Edit