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