File: //opt/netdata/usr/local/share/netdata/web/v3/2420.5d0fcde2630d5ddc0c62.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="50b626c9-9b91-4581-a9d8-0775b5484e47",e._sentryDebugIdIdentifier="sentry-dbid-50b626c9-9b91-4581-a9d8-0775b5484e47")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"80efa4e79295d5662a1431f45bf656cf5a858580"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[2420],{4575:(e,t,n)=>{n.d(t,{Ay:()=>a,SU:()=>i});var o=n(96540),l=n(74848);const r=(0,o.createContext)(null),s={name:""},i=()=>{const e=(0,o.useContext)(r);if(!e)throw new Error("Attempt to use 'useConfigItemContext' outside of 'ConfigItemContext.Provider'");return e},a=e=>{let{children:t,formData:n,...i}=e;const[a,d]=(0,o.useState)(n||s);return(0,l.jsx)(r.Provider,{value:{...i,formData:a,setFormData:d},children:t})}},4797:(e,t,n)=>{n.d(t,{A:()=>a});var o=n(4575),l=n(73937),r=n(91421),s=n(65637),i=n(15505);const a=()=>{const{id:e,isNewItem:t,entityProps:n}=(0,o.SU)(),{node:a}=(0,l.Z)(),{path:d}=(0,s.A)(a),{template:c}=n,u=(0,r.SD)({node:a,path:d,isNewItem:t})(t?c:e),p=(0,r._O)({node:a,id:c});return p?(0,i.Jz)(p):u||{}}},8886:(e,t,n)=>{n.d(t,{A:()=>rn});var o=n(73937),l=n(91421),r=n(96540),s=n(4575),i=n(63766),a=n(12215),d=n(60908),c=n(74848);const u=function(){let{id:e,error:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n="string"===typeof t?{error_message:t}:"object"===typeof t?t:{};return(0,c.jsx)(d.DL,{feature:"DyncfgForm",id:e,error:JSON.stringify(t),children:(0,c.jsxs)(i.Flex,{column:!0,gap:2,children:[(0,c.jsxs)(i.Flex,{alignItems:"center",gap:2,children:[(0,c.jsx)(i.Icon,{name:"warning_triangle",color:"text"}),(0,c.jsx)(i.H3,{children:"Error"})]}),(0,c.jsx)(i.TextBig,{children:(0,a.x)(n)})]})})};var p=n(88255),m=n(21885),h=n(6304),g=n(99905),x=n(44030),f=n(63950),b=n.n(f),y=n(33185);n(98992),n(81454);const j=e=>{let{title:t="Error",children:n,...o}=e;return(0,c.jsxs)(i.Flex,{column:!0,gap:2,...o,children:[(0,c.jsxs)(i.Flex,{alignItems:"center",gap:2,children:[(0,c.jsx)(i.Icon,{name:"warning_triangle",color:"errorText"}),(0,c.jsx)(i.TextBigger,{color:"errorText",children:t})]}),n]})},C=e=>"string"===typeof e?e:e.stack||e.message||JSON.stringify(e),v=function(){let{remainingErrors:e=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[t,n]=(0,h.A)();return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(i.Collapsible,{open:t,duration:0,children:e.map((e=>{const t=C(e);return(0,c.jsx)(i.Text,{color:"errorText",children:t},t)}))}),(0,c.jsx)(i.Flex,{padding:[2,0,0,0],children:(0,c.jsx)(i.Button,{flavour:"hollow",neutral:!0,small:!0,label:t?"Hide":`Show ${e.length} more`,onClick:n})})]})},w=function(){let{id:e,errors:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.length?(0,c.jsx)(d.Ay,{feature:"DyncfgForm",id:e,validationErrors:!0,children:(0,c.jsx)(j,{children:(0,c.jsxs)(i.Flex,{"data-testid":"dyncfg-form-errors",alignItems:"start",column:!0,children:[(0,c.jsx)(i.Text,{color:"errorText",children:C(t[0])}),t.length>1?(0,c.jsx)(v,{remainingErrors:t.slice(1)}):null]})})}):null};var k=n(67200),S=n(74891),A=n(38800),I=n(69851),D=n(77057);const E={...D.Ii,Live:{...D.Ii.Live,head:{...D.Ii.Live.head,hasML:!1,hasParentNode:!0,hasFn:!1},node:{...D.Ii.Live.node,showMl:!1,showParentNode:!0,showFn:!1}}},T=e=>{let{extraKey:t=m.q4}=e;return(0,c.jsx)(i.Flex,{column:!0,height:{max:"60vh"},children:(0,c.jsxs)(i.Flex,{flex:"1",overflow:"hidden",children:[(0,c.jsx)(i.Flex,{column:!0,flex:!0,children:(0,c.jsx)(A.A,{flavour:m.q4,extraKey:t,statusProps:E,testIdPrefix:"node-ids",param:"selectedNodeIds",groupProps:{collapsible:!1,background:"modalBackground",padding:[3],flex:"1",overflow:"hidden"},height:"auto",width:"100%"})}),(0,c.jsx)(I.Ay,{flavour:m.q4,basis:60,baseWidth:60,flex:!1,title:"Dynamic filters",help:"Filter your nodes for this page. Count next to each item refer to the number of nodes that will be selected and used across the page.",includedTabs:["filters"],loaded:!0,onClose:()=>{},groupProps:{background:"modalBackground"},background:"modalBackground"})]})})};n(72577);const F=(0,y.default)(i.TextBig).withConfig({displayName:"styled__NodeName",componentId:"sc-1dfnbe3-0"})(["font-family:monospace;"]);var N=n(41395);const _={fulfilled:{text:"Success",color:"primary"},rejected:{text:"Failed",color:"error"},default:{text:"Processing...",color:"text"}},P=e=>{let{label:t,result:n={}}=e;const{status:o,reason:l}=n,s=l?.response?.data?.errorMessage||l?.message||"Something went wrong...",{text:a,color:d}=(0,r.useMemo)((()=>_[o]||_.default),[o]),[u,p]=(0,h.A)(!0);return(0,c.jsxs)(i.Flex,{column:!0,gap:1,children:[(0,c.jsxs)(i.Flex,{gap:2,alignItems:"center",children:[(0,c.jsx)(i.TextBig,{color:d,children:a}),(0,c.jsx)(F,{children:t}),l?(0,c.jsx)(i.Icon,{name:"chevron_down",width:"10px",height:"10px",color:"textLite",cursor:"pointer",onClick:p,rotate:u?2:null}):null]}),l?(0,c.jsx)(i.Collapsible,{open:u,padding:[0,0,0,2],children:(0,c.jsx)(i.Text,{color:"error",children:(0,N.Zr)(s)})}):null]})},L=e=>{let{selectedNodes:t,results:n=[]}=e;return(0,c.jsxs)(i.Flex,{column:!0,gap:4,padding:[4,0],children:[n.length?null:(0,c.jsx)(i.TextBig,{children:"Submitting to multiple nodes..."}),(0,c.jsx)(i.Flex,{column:!0,gap:3,children:t.map((e=>{let{value:t,label:o}=e;const l=n.find((e=>{let{nodeId:n}=e;return n===t}));return(0,c.jsx)(P,{label:o,result:l},t)}))})]})};n(54520),n(3949),n(37550);var B=n(87083),M=n(24609),O=n(63872),R=n(30569);const $=e=>{let{id:t,formRef:n,onClose:i,refreshData:a}=e;const d=(0,M.vt)(),{options:c}=(0,o.Z)(),u=(0,B.a7)({extraKey:m.q4,merge:!1}),p=c.filter((e=>{let{value:t}=e;return u.includes(t)})),{isNewItem:g,setIsDirty:x}=(0,s.SU)(),[f,b]=(0,r.useState)([]),[y,j]=(0,r.useState)(),C=(0,l.hp)({id:t,isNewItem:g}),[v,,w,k]=(0,h.A)(),[S,,A]=(0,h.A)(),[I,D,,E]=(0,O.A)(),T=(0,r.useCallback)((e=>{i?.(),(e||g)&&"success"===y&&a()}),[i,g,a,y]),F=(0,R.yF)((0,r.useCallback)(((e,o)=>{const r=n?.current?.state?.formData;b([]),w(),A(),C({nodes:p,payload:r}).then((e=>{x(!1);const n=e.map(((e,t)=>({...e,nodeId:p[t]?.value})));b(n);const r=e.map((e=>{let{status:t}=e;return t}));r.find((e=>"fulfilled"===e))?r.some((e=>"rejected"===e))?(j("partialFail"),E({text:"Some submissions have failed."})):(j("success"),I({text:"All nodes updated successfully."})):(j("fail"),D({text:"All submissions have failed."})),n.forEach((e=>{let{status:n,nodeId:r}=e;"fulfilled"===n&&o((0,l.KD)({spaceId:d,id:t,node:r}),!0)}))})).catch(D).finally((()=>{k()}))}),[d,n,p,C,w,k,A,b,x,j,D,E,I]));return{selectedNodes:p,onSubmit:F,onCloseButtonClick:T,loading:v,inProcess:S,results:f,submitStatus:y}},W=(0,S.A)(i.Button),U=e=>{let{id:t,formRef:n,onClose:o,refreshData:l}=e;const{selectedNodes:r,onSubmit:s,onCloseButtonClick:a,loading:d,inProcess:u,results:p,submitStatus:m}=$({id:t,formRef:n,onClose:o,refreshData:l});return(0,c.jsx)(i.Modal,{"data-testid":"dyncfg-nodes-selector-modal",backdropContainerProps:{zIndex:"120"},backdropProps:{backdropBlur:!0},children:(0,c.jsxs)(i.ModalContent,{width:{min:100,base:200},background:"modalBackground",round:2,overflow:"hidden",children:[(0,c.jsx)(i.ModalHeader,{background:"modalBackground",children:(0,c.jsx)(i.H4,{children:"Select nodes"})}),(0,c.jsx)(i.ModalBody,{children:u?(0,c.jsx)(L,{selectedNodes:r,results:p}):(0,c.jsx)(T,{})}),(0,c.jsxs)(i.ModalFooter,{gap:2,children:[(0,c.jsx)(W,{type:"button",flavour:"hollow",small:!0,label:"Close",onClick:()=>a(!0),tooltip:"Go to configuration form",disabled:d}),(0,c.jsx)(W,{type:"button",label:"Submit",small:!0,onClick:s,tooltip:r.length?null:"Select some nodes",disabled:d||!r.length||!!m})]})]})})};var z=n(46587),q=n(99728),H=n(4797),K=n(87680),G=n(2652),Z=n(93598),J=n(44913);const Y=(0,k.A)(i.Button),Q=e=>{let{id:t,formRef:n,loading:i,refreshData:a}=e;const[d,,u,p]=(0,h.A)(),{state:g}=(0,l.$h)(),{isAlert:x}=g||{},f=(0,B.a7)({extraKey:m.q4,merge:!1}),{node:b}=(0,o.Z)(),{isNewItem:y,entityProps:j={}}=(0,s.SU)(),{cmds:C=[]}=j,v=y||C.includes("update"),{user_disabled:w}=(0,H.A)(),k=(0,K.A)(),[S]=(0,J.useStaticCoupon)(),A=(0,G.A)(S),I=(0,z.uW)("isAnonymous"),D=(0,q.JT)("billing:Manage"),E=(0,r.useCallback)((e=>k?v?e||null:"You don't have permissions to save your changes":"Please provide a name first"),[k,v]),T=(0,r.useMemo)((()=>({submit:{label:"Submit",tooltip:E(`Submit your changes to ${b.label} node`),textTransform:""},multiple_submit:{type:"button",flavour:"hollow",label:"Multi-Node Submit",tooltip:E("Submit your changes to another node or to multiple nodes"),onClick:u,textTransform:""},multiple_submit_alert:{type:"button",flavour:"hollow",label:"Submit to nodes",tooltip:E("Verify the selected nodes"),onClick:u,textTransform:""},nonPaid:{type:"button",label:"Upgrade",tooltip:"Upgrade your plan to use this feature.",disabled:!D||I,onClick:A,textTransform:""}})),[k,u,v,D,I,A,E]),F=!v||i||w||!k,{hidden:N,isDisabled:_,tooltipText:P,showUpgradeButton:L}=(0,Z.j)({edit:!0,tooltip:T.submit.tooltip,disabled:F}),{isDisabled:M,tooltipText:O}=(0,Z.j)({edit:!0,tooltip:T[x?"multiple_submit_alert":"multiple_submit"]?.tooltip,disabled:F});return N?null:L?(0,c.jsx)(Y,{small:!0,disabled:F,isLoading:i,...T.nonPaid}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Y,{small:!0,disabled:M,isLoading:i,...T[x?"multiple_submit_alert":"multiple_submit"],tooltip:O}),x?null:(0,c.jsx)(Y,{small:!0,disabled:_,isLoading:i,...T.submit,tooltip:P}),d?(0,c.jsx)(U,{id:t,formRef:n,onClose:p,refreshData:a},JSON.stringify({id:t,selectedNodeIds:f,modalOpen:d})):null]})};const V=(0,n(94404).A)(Z.A),X=e=>{let{loading:t}=e;const{node:n}=(0,o.Z)(),{id:i,formData:d,entityProps:u={}}=(0,s.SU)(),{cmds:p=[]}=u,{user_disabled:m}=(0,H.A)(),h=p.includes("test"),g=(0,l.EZ)({id:i,node:n}),x=(0,K.A)({defaultName:"test"}),f=t||m,[b,y]=(0,a.A)(),j=b({successMessage:"Successfully tested configuration"}),C=y(),v=(0,r.useCallback)((()=>{g({name:x,payload:d}).then(j).catch(C)}),[x,g,d]);return h?(0,c.jsx)(V,{edit:!0,feature:"DyncfgItem",payload:{id:i,node:n?.value},label:"Test",small:!0,tooltip:"Test your configuration",flavour:"hollow",onClick:v,disabled:f,type:"button"}):null},ee=((0,k.A)(i.Button),e=>{let{id:t,formRef:n,loading:o,errors:l=[],openUserConfig:r,refreshData:s}=e;return(0,c.jsxs)(i.Flex,{"data-testid":"dyncfg-form-footer",background:"modalBackground",position:"sticky",bottom:0,gap:2,padding:[4,0,0,0],alignItems:"baseline",justifyContent:"between",zIndex:10,children:[l.length?(0,c.jsx)(w,{id:t,errors:l}):(0,c.jsx)(i.Flex,{}),(0,c.jsxs)(i.Flex,{gap:2,children:[null,(0,c.jsx)(X,{loading:o}),(0,c.jsx)(Q,{id:t,formRef:n,loading:o,refreshData:s})]})]})});var te=n(81683),ne=n(13473),oe=n(27784),le=n(88307),re=n(18739);const se={Business:!0,Pro:!0,Homelab:!0,Community:!1},ie=(0,S.A)(i.Button),ae=e=>{let{getShouldUpgrade:t,...n}=e;const{value:o}=(0,re.JN)(),l=(0,q.JT)("billing:Manage"),[s]=(0,J.useStaticCoupon)(),i=(0,G.A)(s),a=(0,r.useMemo)((()=>"function"===typeof t?t(o):!function(){return se[(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).class]}(o)),[t,o]),d=(0,r.useMemo)((()=>a?l?"Upgrade your plan to use this feature":"You don't have sufficient permissions to upgrade the plan":null),[l,a]),u=(0,r.useMemo)((()=>({label:"Upgrade now!",onClick:i,tooltip:d,disabled:!l,noWrapper:!0,...n})),[i,d,l,n]);return a?(0,c.jsx)(ie,{...u}):null},de=function(){let{getShouldUpgrade:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=(0,z.uW)("isAnonymous"),o=(0,M.dg)();return n||o?null:(0,c.jsx)(ae,{getShouldUpgrade:e,...t})};var ce=n(49165);const ue=y.default.div.withConfig({displayName:"styled__StyledTerminalCommand",componentId:"sc-1oflxul-0"})(["display:flex;position:relative;flex-direction:column;color:",";background:",";border:1px solid ",";border-radius:4px;overflow-wrap:anywhere;white-space:",";padding:16px 16px 24px;width:100%;height:100%;font-family:monospace;font-weight:bold;letter-spacing:0.09px;line-height:16px;font-size:12px;word-break:break-word;overflow-y:auto;"],(0,i.getColor)("primary"),(0,i.getColor)("terminalGreen"),(0,i.getColor)("primary"),(e=>{let{wrap:t}=e;return"true"===t?"pre-wrap":"pre"})),pe=(0,y.default)(i.Icon).withConfig({displayName:"styled__StyledIcon",componentId:"sc-1oflxul-1"})(["display:flex;align-self:flex-end;cursor:pointer;position:absolute;bottom:16px;right:16px;"]);n(8872);const me=(e,t)=>{if(!e||!t)return e;const n=(e=>Object.entries(e).reduce(((e,t)=>{let[n,o]=t;return[...e,..."password"===o?.["ui:widget"]?[n]:[]]}),[]))(t);if(!n.length)return e;const o=new RegExp(`\\b(${n.join("|")}):\\s*[^ \\n]*`,"gi");return e.replace(o,((e,t)=>`${t}: ****`))},he=e=>{let{error:t}=e;return(0,c.jsx)(i.Flex,{padding:[4],children:(0,c.jsx)(i.Text,{color:"error",children:t})})},ge=e=>(0,c.jsxs)(i.Flex,{column:!0,gap:2,...e,children:[(0,c.jsxs)(i.Flex,{gap:2,alignItems:"center",children:[(0,c.jsx)(i.Icon,{color:"warning",name:"warning_triangle"}),(0,c.jsx)(i.Text,{children:"This feature is only available to paid plans"})]}),(0,c.jsx)(de,{small:!0})]}),xe={configuration:{iconName:"gear",color:{active:"success",notActive:"textLite"},width:"14px",Content:e=>{let{id:t,node:n,canGetUserConfig:o,formData:s}=e;const{value:a,error:d}=(0,l.MQ)(),{value:u}=(0,l.t8)({id:t,node:n}),p=(0,ce.A)({id:t,node:n}),m=(0,r.useMemo)((()=>(e=>{if(!e)return e;const t=e.split(/\r?\n/),n=t[0].match(/^\s*/)[0]?.length;return n?t.map((e=>{const t=e.match(/^\s*/)[0]?.length;return e.slice(Math.min(t,n))})).join("\n"):e})(me(a,u?.uiSchema))),[a]),{hasPermission:g}=(0,Z.j)({edit:!0}),[x,f]=(0,h.A)(!0);return(0,r.useEffect)((()=>{o&&s&&g&&p(s)}),[s,o,g,p]),o?d?(0,c.jsx)(he,{error:d}):g?(0,c.jsxs)(i.Flex,{column:!0,width:70,height:"100%",gap:1,padding:[2,1,2,2],alignItems:"start",children:[(0,c.jsx)(i.Checkbox,{label:"Wrap text",checked:x,onChange:f}),(0,c.jsxs)(ue,{wrap:x?"true":"false",children:[m,(0,c.jsx)(pe,{name:"copy",size:"small",color:"textLite",onClick:(0,le.C)(a,{text:"Config copied to your clipboard."})})]})]}):(0,c.jsx)(ge,{}):(0,c.jsx)(i.Flex,{padding:[4],children:(0,c.jsx)(i.Text,{children:"Configuration text export is not supported by this node."})})},dataTestId:"configurationTab",label:"Config"}},fe=["configuration"],be=e=>{let{id:t,node:n,isOpen:o,toggleIsOpen:l,canGetUserConfig:r,formData:s}=e;const{Content:i}=xe.configuration;return(0,c.jsx)(te.Ay,{collapsedComponent:(0,c.jsx)(ne.A,{onClickTab:l,availableTabs:xe,tabsToShow:fe}),isOpen:o,header:(0,c.jsx)(oe.A,{isOpen:o,onToggle:l,title:"Configuration",icon:null}),children:o?(0,c.jsx)(i,{id:t,node:n,padding:[0,3,30],canGetUserConfig:r,formData:s}):null})};var ye=n(45087),je=n(54852),Ce=n(79748),ve=n(30005),we=n(92318);const ke=y.default.span.withConfig({displayName:"markdocSchema__Strong",componentId:"sc-1se2vza-0"})(["font-weight:bold;"]),Se=y.default.ol.withConfig({displayName:"markdocSchema__OrderedList",componentId:"sc-1se2vza-1"})(["list-style:roman;padding-left:14px;"]),Ae=y.default.ul.withConfig({displayName:"markdocSchema__UnorderedList",componentId:"sc-1se2vza-2"})(['list-style-image:url("','/img/list-style-image.svg");padding-left:14px;'],we.A.assetsBaseURL),Ie={heading:{render:e=>{let{level:t=1,...n}=e,o=i.H1;switch(t){case 2:o=i.H2;break;case 3:o=i.H3;break;case 4:o=i.H4;break;case 5:o=i.H5;break;case 6:o=i.H6}return(0,c.jsx)(o,{margin:[2,0],...n})},attributes:{id:{type:String},level:{type:Number}}},paragraph:{render:e=>{let{children:t,...n}=e;return(0,c.jsx)(i.Flex,{...n,children:(0,c.jsx)(i.Text,{children:t})})}},strong:{render:ke},link:{render:e=>{let{children:t,href:n,...o}=e;return(0,c.jsx)(Ce.A,{href:n,rel:"noopener noreferrer",target:"_blank",...o,children:t})},attributes:{href:{type:String}}},code:{render:e=>{let{content:t,...n}=e;return(0,c.jsx)(ve.R0,{...n,children:t})},attributes:{content:{type:String}}},fence:{render:e=>{let{content:t,...n}=e;return(0,c.jsx)(ve.Ay,{...n,children:t})},attributes:{content:{type:String}}},list:{render:e=>{let{ordered:t,children:n,...o}=e;const l=t?Se:Ae;return(0,c.jsx)(l,{...o,children:n})},attributes:{ordered:{type:Boolean}}}},De=e=>{let{children:t}=e;return(0,c.jsx)(je.A,{transformConfiguration:{nodes:Ie},children:t})},Ee=e=>{let{description:t}=e;return("string"===typeof t&&t?t:"object"===typeof t?t?.props?.description:null)?(0,c.jsx)(ye.A,{isBasic:!0,plain:!0,allowHoverOnTooltip:!0,content:(0,c.jsx)(i.Flex,{height:{max:70},width:{max:120},overflow:{vertical:"auto"},children:(0,c.jsx)(De,{children:t})}),contentProps:{width:{max:120}},children:(0,c.jsx)(i.Icon,{name:"information",color:"text",size:"small"})}):null},Te=e=>{let{description:t}=e;if(!t)return null;const n="string"===typeof t?t:t.props?.description;return(0,c.jsx)(De,{children:n})},Fe=e=>{let{title:t,required:n,description:o,help:l,isCollapsible:r,isExpanded:s,toggleExpanded:a}=e;return t?(0,c.jsxs)(i.Flex,{column:!0,gap:.5,children:[(0,c.jsxs)(i.Flex,{alignItems:"center",gap:1,children:[r?(0,c.jsx)(i.Icon,{name:"chevron_down",color:"text",onClick:a,cursor:"pointer",rotate:s?2:0}):null,(0,c.jsxs)(i.TextBig,{strong:!0,cursor:r?"pointer":"default",onClick:r?a:void 0,children:[t,n?"*":null]}),l?(0,c.jsx)(Ee,{description:l}):null]}),(0,c.jsx)(i.Flex,{...r?{padding:[0,0,0,5]}:{},children:(0,c.jsx)(Te,{description:o})})]}):null},Ne=(0,y.keyframes)(["from{opacity:0;transform:scale(0.8);}to{opacity:1;transform:scale(1);}"]),_e=(0,y.keyframes)(["from{transform:rotate(0deg);}to{transform:rotate(360deg);}"]),Pe=(0,y.default)(i.Flex).withConfig({displayName:"validationIcon__IconWrapper",componentId:"sc-5mqx0z-0"})(["animation:"," 0.2s ease-in-out;",""],Ne,(e=>e.isLoading&&(0,y.css)(["animation:"," 1s linear infinite;"],_e))),Le=e=>{let{status:t,size:n="small"}=e;if(!t)return null;const o={small:{name:"",color:"text",width:"14px",height:"14px"},medium:{name:"",color:"text",width:"16px",height:"16px"},large:{name:"",color:"text",width:"20px",height:"20px"}}[n]||o.small;switch(t){case"error":return(0,c.jsx)(Pe,{alignItems:"center",justifyContent:"center",children:(0,c.jsx)(i.Icon,{...o,name:"x",color:"error"})});case"warning":default:return null;case"loading":return(0,c.jsx)(Pe,{alignItems:"center",justifyContent:"center",isLoading:!0,children:(0,c.jsx)(i.Icon,{...o,name:"loading",color:"textLite"})})}},Be=(0,y.default)(i.Flex).withConfig({displayName:"fieldTemplate__ValidationIconWrapper",componentId:"sc-u7gsvl-0"})(["position:absolute;right:8px;top:8px;pointer-events:auto;z-index:2;cursor:help;"]),Me=(0,y.default)(i.Flex).withConfig({displayName:"fieldTemplate__FieldContentWrapper",componentId:"sc-u7gsvl-1"})(['position:relative;input:not([type="checkbox"]):not([type="radio"]),select,textarea{padding-right:32px !important;}']),Oe=e=>{let{id:t,displayLabel:n,label:o,required:l,description:r,schema:s,uiSchema:i={}}=e;const a=i["ui:title"]||o,d=i["ui:help"],u=["array","boolean"].includes(s.type)||Array.isArray(s.type)&&(s.type.includes("array")||s.type.includes("boolean"));return a&&(n||u)?(0,c.jsx)("label",{htmlFor:t,children:(0,c.jsx)(Fe,{title:a,required:l,description:r,help:d})}):null},Re=e=>{let{id:t,label:n,required:o,description:l,errors:s,children:a,displayLabel:d,schema:u,classNames:p,hidden:m,uiSchema:h,formData:g,rawErrors:x}=e;const[f,b]=(0,r.useState)(!1),[y,j]=(0,r.useState)(!1),[C,v]=(0,r.useState)(null),[w,k]=(0,r.useState)("");(0,r.useEffect)((()=>{void 0!==g&&null!==g&&""!==g&&b(!0)}),[g]);(0,r.useEffect)((()=>{if(s&&s.length>0||x&&x.length>0)return v("error"),void k("");if(f&&void 0!==g&&null!==g&&""!==g){const e=h?.["ui:validation"];if(e?.warning){const t=e.warning.condition;if(t&&((e,t)=>{try{return new Function("value",`return ${e}`)(t)}catch{return!1}})(t,g))return v("warning"),void k(e.warning.message||"This value may not be optimal")}}v(null),k("")}),[s,x,f,g,h,t]);const S="object"!==u.type&&"array"!==u.type&&!h?.["ui:widget"]?.includes("hidden");return m?null:(0,c.jsxs)(i.Flex,{width:"100%",className:`${p} dyncfg-field-container`,column:!0,gap:.5,children:[(0,c.jsx)(Oe,{id:t,displayLabel:d,label:n,required:o,description:l,schema:u,uiSchema:h}),(0,c.jsxs)(Me,{className:"dyncfg-field-content",column:!0,padding:[0,0,0,1],onBlur:()=>{j(!0)},onFocus:()=>{j(!1)},children:[a,S&&C&&(0,c.jsx)(Be,{children:(0,c.jsx)(Le,{status:C,size:"small"})}),s?(0,c.jsx)(i.TextMicro,{color:"errorText",children:s}):null,w&&"warning"===C?(0,c.jsx)(i.TextMicro,{color:y?"warning":"textLite",children:w}):null]})]})},$e=e=>{let{title:t,children:n,initiallyExpanded:o=!1,help:l=null}=e;const[r,s]=(0,h.A)(o);return(0,c.jsxs)(i.Flex,{className:"dyncfg-collapsible-group dyncfg-grid-col-span-1-6",width:"100%",column:!0,gap:2,children:[(0,c.jsx)(Fe,{title:t,required:!1,description:null,help:l,isCollapsible:!0,isExpanded:r,toggleExpanded:s}),(0,c.jsx)(i.Collapsible,{className:"dyncfg-group-collapsible",open:r,duration:200,children:(0,c.jsx)(i.Flex,{column:!0,gap:3,padding:[0,0,0,3],border:{side:"left",color:"border"},children:n})})]})};const We=(Ue=e=>{let{onAddClick:t,schema:n,registry:o,properties:l,uiSchema:r={},...s}=e;const{WrapIfAdditionalTemplate:a,ButtonTemplates:d}=o.templates,{AddButton:u}=d,p=r?.["ui:groups"],m=p?function(e){let{properties:t,groups:n,WrapIfAdditionalTemplate:o}=e;return Array.isArray(n)?n.map(((e,n)=>{if("string"===typeof e){const n=t.find((t=>t.name===e));return n?(0,c.jsx)(o,{elemKey:n.content.key,...n.content.props,children:n.content},n.content.key):null}if("object"===typeof e){const l=Object.keys(e).find((e=>!e.startsWith("ui:")));if(l){const r=e[l],s=e["ui:collapsible"],i=e["ui:initiallyExpanded"];if(Array.isArray(r)){const e=r.map((e=>t.find((t=>t.name===e)))).filter(Boolean).map((e=>(0,c.jsx)(o,{elemKey:e.content.key,...e.content.props,children:e.content},e.content.key)));return s?(0,c.jsx)($e,{title:l,initiallyExpanded:i,children:e},`group-${n}`):(0,c.jsxs)("div",{className:"dyncfg-field-group",children:[l&&(0,c.jsx)("div",{className:"dyncfg-group-title",children:l}),e]},`group-${n}`)}}return null}return null})).filter(Boolean):t.map((e=>(0,c.jsx)(o,{elemKey:e.content.key,...e.content.props,children:e.content},e.content.key)))}({properties:l,groups:p,registry:o,WrapIfAdditionalTemplate:a}):l.map((e=>(0,c.jsx)(a,{elemKey:e.content.key,...e.content.props,children:e.content},e.content.key)));return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(i.Flex,{className:"dyncfg-object-field-content",column:!0,gap:3,padding:[0,0,0,3],border:{side:"left",color:"border"},...s,children:m}),n.additionalProperties?(0,c.jsx)(i.Flex,{padding:[2],children:(0,c.jsx)(u,{onClick:t(n)})}):null]})},e=>{let{className:t,...n}=e;return t?.includes("dyncfg-grid")?(0,c.jsx)("div",{className:t,children:(0,c.jsx)(Ue,{...n})}):(0,c.jsx)(Ue,{...n})});var Ue;const ze=(0,r.createContext)(),qe=e=>{let{children:t}=e;const[n,o]=(0,r.useState)({});return(0,c.jsx)(ze.Provider,{value:{collapsibleItemsState:n,setCollapsibleItemsState:o},children:t})},He=e=>{const{properties:t,uiSchema:n}=e,{tabs:o,rest:l}=n["ui:options"]||{},[s,a]=(0,r.useState)(0),d=(0,r.useMemo)((()=>(e=>{let{properties:t=[],tabs:n=[]}=e;return n.map((e=>({...e,properties:t.filter((t=>e.fields.includes(t.name)))})))})({properties:t,tabs:o})),[t,o]);return(0,c.jsxs)(qe,{children:[(l||[]).length?(0,c.jsx)(We,{...e,properties:t.filter((e=>l.includes(e.name)))}):null,(0,c.jsx)(i.Tabs,{selected:s,onChange:a,height:"100%",children:d.map((t=>{let{title:n,...o}=t;return(0,c.jsx)(i.Tab,{label:n,children:(0,c.jsx)(We,{...e,...o,border:{side:"top",color:"border"},padding:[2,0,0,3]})},n)}))})]})},Ke={tabs:{Component:He},default:{Component:We}},Ge=e=>{let{title:t,...n}=e;const{description:o,required:l,uiSchema:s={},idSchema:a,formData:d}=n,u=a.$id,p=s["ui:flavour"],m=s["ui:help"],{Component:g}=Ke[p]||Ke.default,x=!!s?.["ui:collapsible"]||!!s?.["ui:options"]?.collapsible,{inContext:f,isItemDirty:y,isItemExpanded:j,setItemState:C}=(()=>{const e=(0,r.useContext)(ze),{collapsibleItemsState:t,setCollapsibleItemsState:n}=e||{},o=(0,r.useCallback)((e=>void 0!==t[e]),[t]),l=(0,r.useCallback)((e=>t[e]),[t]),s=(0,r.useCallback)(((e,t)=>{n((n=>({...n,[e]:t})))}),[n]);return{inContext:!!e,isItemDirty:e?o:b(),isItemExpanded:e?l:b(),setItemState:e?s:b()}})(),v=s["ui:initiallyExpanded"]||!!d,w=(0,r.useMemo)((()=>y(u)?j(u):v),[y,j]),[k,S]=(0,h.A)(w);return(0,r.useEffect)((()=>{f&&C(u,k)}),[f,k,C]),(0,c.jsxs)(i.Flex,{className:"dyncfg-object-field-container",width:"100%",column:!0,gap:2,children:[t?(0,c.jsx)(Fe,{title:t,required:l,description:o,help:m,isCollapsible:x,isExpanded:k,toggleExpanded:S}):null,(0,c.jsx)(i.Collapsible,{className:"dyncfg-object-field-collapsible",open:k||!x,duration:0,children:(0,c.jsx)(g,{...n})})]})},Ze=e=>{let{title:t,active:n,index:o,setActiveTab:l,reordering:s,setReordering:a,buttonsProps:d={},ref:u,...p}=e;const{onDropIndexClick:m,onReorderClick:h,hasMoveDown:g,hasMoveUp:x,hasRemove:f}=d,b=(0,r.useCallback)((e=>{f&&m(e)()}),[f,m]);return(0,r.useEffect)((()=>{if(2===s?.length&&s[0]===o){const e=s[1];h(o,e)(),l(e),a()}}),[s]),(0,c.jsx)(i.NavigationTab,{ref:u,...p,index:o,draggable:!(!g&&!x),active:n,icon:f?(0,c.jsx)(i.Icon,{name:"x",size:"small"}):null,onClick:()=>{l(o)},onRemove:b,fixed:!f,children:(0,c.jsx)(i.TextBig,{whiteSpace:"nowrap",children:t})})},Je=(0,y.default)(i.IconButton).attrs((e=>({small:!0,padding:[0,1],...e}))).withConfig({displayName:"styled__StyledIconButton",componentId:"sc-xc1c2v-0"})(["height:",";"],(e=>{let{inTabs:t}=e;return t?"auto":"24px"})),Ye=e=>{let{icon:t,iconType:n,...o}=e;return(0,c.jsx)(Je,{flavour:"default",icon:"plus",tooltip:"Add item",type:"button",neutral:!1,...o})},Qe=e=>{let{icon:t,iconType:n,...o}=e;return(0,c.jsx)(Je,{flavour:"hollow",icon:"copy",tooltip:"Copy current item into a new one",type:"button",neutral:!1,...o})};var Ve=n(85660);const Xe=e=>{let{items:t,onAddClick:n,onCopyClick:o,canAdd:l,...s}=e;const[a,{width:d}]=(0,Ve.A)(),[u,p]=(0,r.useState)(0),[m,h]=(0,r.useState)();(0,r.useEffect)((()=>{u>=t.length&&p(0)}),[t.length]);const g=l?`calc(${d}px - 80px)`:`${d}px`;return(0,c.jsxs)(i.Flex,{ref:a,column:!0,children:[(0,c.jsxs)(i.Flex,{width:`${d}px`,margin:[0,0,2,0],children:[(0,c.jsx)(i.NavigationTabs,{width:g,overflow:{horizontal:"auto"},children:(0,c.jsx)(i.DraggableTabs,{items:t.map(((e,t)=>({id:e.key,title:`Item ${t}`,active:u===t,setActiveTab:p,reordering:m,setReordering:h,...s,...e}))),Item:Ze,onDragEnd:(e,t)=>{h([e,t])}})}),l?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Qe,{onClick:()=>o(u),padding:[1,3],inTabs:!0,groupFirst:!0}),(0,c.jsx)(Ye,{onClick:n,padding:[1,3],inTabs:!0,groupLast:!0})]}):null]}),r.Children.map(t[u]?.children,(e=>(0,r.isValidElement)(e)?(0,r.cloneElement)(e,{title:""}):e))]})},et=(0,r.memo)(Xe),tt=(0,y.default)(i.Flex).attrs((e=>({open:!0,...e}))).withConfig({displayName:"collapsible__ContentWrapper",componentId:"sc-6ate9-0"})(["display:",";"],(e=>{let{open:t}=e;return t?"flex":"none"})),nt=(0,S.A)(i.Icon),ot=e=>{let{title:t="",isCollapsible:n,isOpen:o,onChange:l,children:s,...a}=e;const[d,u]=(0,h.A)(o);return(0,r.useEffect)((()=>{l(d)}),[d]),n?(0,c.jsxs)(i.Flex,{width:"100%",column:!0,padding:[3,0],children:[(0,c.jsxs)(i.Flex,{gap:2,children:[(0,c.jsx)(nt,{noWrapper:!0,name:"chevron_left",size:"small",color:"textLite",rotate:d?1:3,onClick:u,cursor:"pointer",tooltip:d?"Hide contents":"Show contents"}),t?(0,c.jsx)(i.Text,{strong:!0,children:t}):null]}),(0,c.jsx)(tt,{open:d,...a,children:s})]}):s},lt=e=>{let{icon:t,iconType:n,...o}=e;return(0,c.jsx)(Je,{flavour:"hollow",icon:"sort_descending",tooltip:"Move down",type:"button",...o})},rt=e=>{let{icon:t,iconType:n,...o}=e;return(0,c.jsx)(Je,{flavour:"hollow",icon:"sort_ascending",tooltip:"Move up",type:"button",...o})},st=e=>{let{icon:t,iconType:n,...o}=e;return(0,c.jsx)(Je,{flavour:"hollow",icon:"checkmark_partial_s",danger:!0,tooltip:"Remove item",type:"button",...o})},it=e=>{let{index:t,totalItems:n,buttonsProps:o={},uiSchema:l={},onCopyClick:s,children:a}=e;const{canAdd:d,onAddIndexClick:u,onDropIndexClick:p,onReorderClick:m,hasMoveDown:h,hasMoveUp:g,hasRemove:x}=o,[f,b]=(0,r.useState)(!0),y=g||h||x||d,j=m(t,t-1),C=m(t,t+1),v=p(t),w=u(t+1),k=!!l?.["ui:collapsible"]||!!l?.["ui:options"]?.collapsible,S=(0,r.useCallback)((e=>{b(e)}),[b]);return(0,c.jsxs)(i.Flex,{width:"100%",gap:2,alignItems:f?"start":"center",justifyContent:"between",border:{side:"all",color:"border"},padding:[2,4],children:[(0,c.jsx)(ot,{isCollapsible:k,title:a.props?.title,isOpen:f,onChange:S,children:a}),y?(0,c.jsxs)(i.Flex,{gap:2,padding:[2,0],children:[g?(0,c.jsx)(rt,{onClick:j}):null,h?(0,c.jsx)(lt,{onClick:C}):null,x?(0,c.jsx)(st,{onClick:v}):null,d?(0,c.jsx)(Qe,{onClick:()=>s(t)}):null,d&&t===n-1?(0,c.jsx)(Ye,{onClick:w}):null]}):null]})},at=e=>{let{onCopyClick:t,items:n}=e;return n.map((e=>{let{key:n,...o}=e;return(0,c.jsx)(it,{onCopyClick:t,...o},n)}))},dt=(0,r.memo)(at),ct=e=>{let{canAdd:t,onAddClick:n,openEmptyItem:o}=e;return(0,r.useEffect)((()=>{o&&n()}),[o,n]),(0,c.jsxs)(i.Flex,{gap:2,alignItems:"center",children:[(0,c.jsx)(i.TextBig,{children:"No items"}),t?(0,c.jsx)(Ye,{onClick:n}):null]})},ut=(0,S.A)(i.Toggle),pt=e=>{const{items:t,canAdd:n,onAddClick:o,idSchema:l,formContext:a}=e,d="list"===e?.uiSchema?.["ui:listFlavour"],u=!!e?.uiSchema?.["ui:openEmptyItem"],[p,m]=(0,h.A)(d),{formData:g}=(0,s.SU)(),x=p?dt:et,f=(0,r.useCallback)((e=>{const n=t[e]?.children?.props?.formData,{$id:o}=l,r=((e,t,n)=>{const o=e.replace(/^root_/,"").split("_");let l=n;for(let r=0;r<o.length;r++){const e=o[r];if(r===o.length-1){if(!Array.isArray(l[e]))throw new Error(`Expected an array at path ${o.slice(0,r+1).join("_")}`);l[e].push(t)}else l=l[e]}return n})(o,n,JSON.parse(JSON.stringify(g)));a.setFormData(r)}),[t,l,a.setFormData,g]);return(0,c.jsxs)(i.Flex,{width:"100%",column:!0,gap:2,padding:[1,0,0,0],children:[(0,c.jsx)(i.Flex,{children:(0,c.jsx)(ut,{labelRight:"List",labelLeft:"Tabs",onChange:m,checked:p,tooltip:"Switch between list and tabs layout"})}),t.length?(0,c.jsx)(x,{...e,onCopyClick:f}):(0,c.jsx)(ct,{canAdd:n,onAddClick:o,openEmptyItem:u})]})};var mt=n(63926);const ht=e=>{let{elemKey:t,onKeyChange:n,schema:o,onDropPropertyClick:l,registry:s,children:a}=e;const[d,u]=(0,r.useState)(a?.props?.name||""),{RemoveButton:p}=s.templates.ButtonTemplates,m=mt.Rr in o,h=(0,r.useCallback)((e=>{l(t)(e)}),[l,t]),g=(0,r.useCallback)((e=>u(e.target.value)),[u]);return m?(0,c.jsxs)(i.Flex,{width:"100%",gap:2,alignItems:"center",children:[(0,c.jsxs)(i.Flex,{column:!0,gap:1,flex:{grow:1,shrink:1},children:[(0,c.jsx)(i.TextBig,{strong:!0,children:"Key"}),(0,c.jsx)(i.TextInput,{value:d,onInput:g,onBlur:e=>n(e.target.value),border:"inputBorder",size:"small"})]}),(0,c.jsx)(i.Flex,{flex:{grow:2,shrink:1},children:a}),(0,c.jsxs)(i.Flex,{column:!0,gap:.5,children:[(0,c.jsx)(i.TextBig,{opacity:"0",children:"x"}),(0,c.jsx)(p,{onClick:h})]})]}):a},gt={FieldTemplate:Re,ArrayFieldTemplate:pt,ObjectFieldTemplate:Ge,WrapIfAdditionalTemplate:ht,ErrorListTemplate:()=>null,ButtonTemplates:{SubmitButton:()=>(0,c.jsx)(i.Button,{label:"Save"}),AddButton:Ye,RemoveButton:st,MoveUpButton:rt,MoveDownButton:lt}};n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215);var xt=n(3319);const ft=()=>{const[e,t]=(0,r.useState)([]),n=(0,r.useCallback)((e=>t(e)),[t]);return{errors:e,onError:n,resetErrors:(0,r.useCallback)((()=>t([])),[t])}},bt=e=>{let{id:t,node:n,formState:o,submitMethod:i,setIsDirty:d,setError:c,stripUnknownFields:u}=e;const{isNewItem:p,isDirty:m,formData:h,setFormData:g,isLoading:x,startLoading:f,stopLoading:b}=(0,s.SU)(),{refresh:y}=(0,l.$h)(),{sendLog:j}=(0,xt.A)(),[C,v]=(0,O.A)(),{loaded:w,value:k,error:S,refresh:A}=(0,l.t8)({id:t,node:n}),{loaded:I,value:D,hasError:E,refresh:T}=o,F=m||!D?h:Object.keys(D).length?D:h,N=(0,r.useMemo)((()=>u?((e,t)=>{if(!e||!t?.jsonSchema?.properties)return e;const n=new Set(["name",...Object.keys(t.jsonSchema.properties||{})]),o=Object.fromEntries(Object.entries(e||{}).filter((e=>{let[t]=e;return n.has(t)}))),l=Object.keys(e).filter((e=>!n.has(e)));return l.length&&(console.warn("[dyncfg] The following fields are not defined in the schema properties"),console.warn(l)),o})(F,k):F),[F,k,u]),_=w&&I,P=S||E,L=(0,l.Hj)(),B=(0,l.O_)({node:n,id:t}),{errors:M,onError:R,resetErrors:$}=ft();(0,r.useEffect)((()=>{c(P)}),[P,c]);const W=(0,r.useCallback)(((e,t)=>{const n={name:D.name,...e.formData};g(n),d(!t)}),[D?.name,g,d]),U=(0,r.useCallback)((e=>{W({formData:e})}),[W]),z=(0,r.useCallback)((e=>{$(),y();const n={...e.formData,...p&&h?.name?{name:h.name}:{}};f(),i(n).then((()=>{d(!1),p?L():(B(),A(),T()),C({header:"Success",text:"Successfully submitted configuration"}),j({feature:"DyncfgForm",description:"Submit success",id:t})})).catch((e=>{const n=(0,a.x)(e);v({header:"Error",text:n}),j({feature:"DyncfgForm",description:"Submit error",id:t,error:JSON.stringify(e.response?.data||{})})})).finally((()=>{b()}))}),[p,h?.name,i,f,b,d,L,B,A,T,a.x,R,$,y,C,v,j]);return{isLoading:x,loaded:_,defaultFormData:D,formData:N,setFormData:U,refreshData:T,schema:k,resourcesError:P,errors:M,onChange:W,onSubmit:z,onError:R}};var yt=n(21996);const jt=e=>{let{value:t,disabled:n,onChange:o}=e;const l=(0,r.useCallback)((e=>{o(e)}),[o]);return(0,c.jsx)(i.Flex,{children:(0,c.jsx)(i.Checkbox,{checked:t,onChange:l,disabled:n})})};var Ct=n(53749),vt=n(81391);const wt=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e)return null;if(Array.isArray(e)){return[...t.filter((t=>e.map((e=>"string"===typeof e?e:e.value)).includes(t.value))),...e.filter((e=>"object"===typeof e&&e.__isNew__))]}const n=t.find((t=>t.value===e));return n||("string"===typeof e&&""!==e.trim()?{value:e,label:e,__isNew__:!0}:null)},kt=e=>{let{value:t,options:n,disabled:o,multiple:l,isCreatable:s,onChange:a,uiSchema:d}=e;const{enumOptions:u}=n||{},p=d?.["ui:options"]?.enumOptions,m=u||p,h=d?.["ui:creatable"],g=(0,r.useCallback)((e=>{var t;a((t=e)?Array.isArray(t)?t.map((e=>e.value)):t.value||"":"")}),[]);return m?(0,c.jsx)(i.Select,{value:wt(t,m),isMulti:l,options:m,onChange:g,isDisabled:o,isCreatable:s||h,placeholder:"Select or type to create...",noOptionsMessage:e=>{let{inputValue:t}=e;return t?`Create "${t}"`:"Type to create new option"},formatCreateLabel:e=>`Create "${e}"`,createOptionPosition:"first",allowCreateWhileLoading:!1,isValidNewOption:e=>e&&e.trim().length>0}):null},St=e=>({value:e,label:e}),At=e=>{const t=(0,vt.n)("id"),n=(0,Ct.R7)(t),o=(0,r.useMemo)((()=>Object.keys(n).sort(((e,t)=>e.localeCompare(t,void 0,{sensitivity:"accent",ignorePunctuation:!0}))).map(St)),[n]);return(0,c.jsx)(kt,{...e,isCreatable:!0,options:{enumOptions:o}})},It=(e,t)=>{const n=parseFloat(e),{multiplier:o}=t||{};return{num:n,multiplier:parseFloat(o)}},Dt=e=>{let{value:t=0,onChange:n=b(),scale:o=[],defaultScale:l,min:s=0,step:a=1}=e;const d=o.find((e=>{let{value:t}=e;return t===l}))||o[0],[u,p]=(0,r.useState)(d),m=((e,t)=>{const{num:n,multiplier:o}=It(e,t);return o&&!isNaN(n)?Math.round(n/o*100)/100:0})(t,u),h=(0,r.useCallback)((e=>{const t=((e,t)=>{const{num:n,multiplier:o}=It(e,t);return o&&!isNaN(n)?n*o:0})(e.target.value,u);n(t)}),[u,n]);return(0,c.jsxs)(i.Flex,{gap:2,alignItems:"center",children:[(0,c.jsx)(i.TextInput,{value:m,onChange:h,type:"number",min:s,step:a,size:"small"}),(0,c.jsx)(i.Select,{value:u,options:o,onChange:p,styles:{minWidth:"80px"}})]})},Et=[{value:"sec",label:"Seconds",multiplier:1},{value:"min",label:"Minutes",multiplier:60},{value:"hour",label:"Hours",multiplier:3600},{value:"day",label:"Days",multiplier:86400},{value:"week",label:"Weeks",multiplier:604800},{value:"month",label:"Months",multiplier:2592e3},{value:"year",label:"Years",multiplier:31536e3}],Tt=e=>{const{schema:t={}}=e,{type:n}=t,o="number"==n?.1:1,{scales:l}=e.options||{},r=l?Et.filter((e=>{let{value:t}=e;return l.includes(t)})):Et;return(0,c.jsx)(Dt,{scale:r,step:o,...e})},Ft=e=>(0,c.jsx)(Tt,{...e,defaultScale:e.options?.scale}),Nt=(0,y.default)(i.Box).attrs({fontWeight:"bold",width:{min:"40px"}}).withConfig({displayName:"expressionBuilderWidget__Symbol",componentId:"sc-tuh4eq-0"})(["font-family:monospace !important;"]),_t={current:{symbol:"$this",description:"Current value of the chart"},timestamp:{symbol:"$now",description:"Current timestamp"},after:{symbol:"$after",description:"Start time of the evaluation window"},before:{symbol:"$before",description:"End time of the evaluation window"},status:{symbol:"$status",description:"Current alert status"},CLEAR:{symbol:"$CLEAR",description:"Alert status: Clear (0)"},WARNING:{symbol:"$WARNING",description:"Alert status: Warning (1)"},CRITICAL:{symbol:"$CRITICAL",description:"Alert status: Critical (2)"},operators:{comparison:[{symbol:"<",description:"Less than"},{symbol:">",description:"Greater than"},{symbol:"<=",description:"Less than or equal to"},{symbol:">=",description:"Greater than or equal to"},{symbol:"==",description:"Equal to"},{symbol:"!=",description:"Not equal to"}],logical:[{symbol:"&&",description:"Logical AND"},{symbol:"||",description:"Logical OR"},{symbol:"!",description:"Logical NOT"}],arithmetic:[{symbol:"+",description:"Addition"},{symbol:"-",description:"Subtraction"},{symbol:"*",description:"Multiplication"},{symbol:"/",description:"Division"},{symbol:"%",description:"Modulo"}],conditional:[{symbol:"?",description:"Ternary conditional (if)"},{symbol:":",description:"Ternary conditional (else)"}],grouping:[{symbol:"(",description:"Opening parenthesis"},{symbol:")",description:"Closing parenthesis"}]}},Pt=["status","CLEAR","WARNING","CRITICAL"],Lt={warning:[{symbol:"$this > threshold",description:"Basic threshold comparison",insertText:"$this > "}],critical:[{symbol:"$this > ($status >= $WARNING ? low : high)",description:"Dynamic threshold based on status",insertText:"$this > (($status >= $WARNING) ? () : ())"}]},Bt={variables:{title:"Variables",color:"primary"},comparison:{title:"Comparison",color:"warning"},logical:{title:"Logical",color:"accent"},arithmetic:{title:"Math",color:"success"},grouping:{title:"Grouping",color:"text"},templates:{title:"Templates",color:"info"},default:{color:"text"}},Mt=e=>{let{value:t="",onChange:n,disabled:o=!1,placeholder:l="Enter an expression",uiSchema:s={},isAlert:a=!1}=e;const[d,u,,p]=(0,h.A)(),[m,g]=(0,r.useState)([]),[x,f]=(0,r.useState)(0),[b,y]=(0,r.useState)(0),j=(0,r.useRef)(null),C=s["ui:alertStatus"]||"critical",v=(0,r.useCallback)((e=>{const t={variables:[],comparison:[],logical:[],arithmetic:[],grouping:[],templates:[]};if(Object.entries(_t).forEach((n=>{let[o,l]=n;"operators"!==o&&(!a&&Pt.includes(o)||l.symbol.toLowerCase().includes(e.toLowerCase())&&t.variables.push({symbol:l.symbol,description:l.description,insertText:` ${l.symbol} `}))})),Object.entries(_t.operators).forEach((n=>{let[o,l]=n;l.forEach((n=>{(0===e.length||n.symbol.includes(e))&&(t[o]||(t[o]=[]),t[o].push({symbol:n.symbol,description:n.description,insertText:` ${n.symbol} `}))}))})),a&&(0===e.length||"$this".includes(e.toLowerCase()))){(Lt[C]||Lt.critical).forEach((e=>{t.templates.push({symbol:e.symbol,description:e.description,insertText:` ${e.insertText} `})}))}return t}),[C,a]);return(0,c.jsxs)(i.Box,{position:"relative",width:"100%",children:[(0,c.jsx)(i.TextInput,{ref:j,value:t,onChange:e=>{const t=e.target?.value||"";n(t);const o=e.target?.selectionStart||0;f(o);const l=t.slice(0,o).split(/\s+/),r=l[l.length-1]||"",s=v(r);g(s);const i=Object.values(s).some((e=>e.length>0));u(i)},onKeyDown:e=>{"Escape"===e.key&&p(!1)},onFocus:()=>{const e=v("");g(e);const t=Object.values(e).some((e=>e.length>0));u(t),y(0)},disabled:o,placeholder:l,autoComplete:"off",spellCheck:!1,sx:{fontFamily:'Monaco, Menlo, "Ubuntu Mono", monospace',fontSize:"14px"},size:"small",border:"inputBorder"}),d&&Object.values(m).some((e=>e.length>0))&&j.current&&(0,c.jsx)(i.Drop,{target:j.current,align:{top:"bottom",left:"left"},background:"mainBackgroundSecondary",border:"borderSecondary",round:1,overflow:"auto",height:{min:50,max:160},onClickOutside:p,onEsc:p,stretch:"width",children:(0,c.jsx)(i.Tabs,{background:"dropdown",selected:b,onChange:y,padding:[2,0],children:Object.entries(m).filter((e=>{let[,t]=e;return t.length>0})).map((e=>{let[o,l]=e;const{title:r=o,color:s="text"}=Bt[o]||Bt.default;return(0,c.jsx)(i.Tab,{label:r,children:(0,c.jsx)(i.Box,{height:{min:50,max:160},overflow:"auto",padding:[2,0,0],children:(0,c.jsx)(i.Flex,{column:!0,gap:1,children:l.map(((e,l)=>(0,c.jsxs)(i.Flex,{alignItems:"center",gap:3,padding:[1,2],cursor:"pointer",onClick:()=>(e=>{const o=t.slice(0,x),l=t.slice(x),r=o.split(/\s+/);r[r.length-1]=e.insertText;const s=r.join(" "),i=(s+l).replace(/\s+/g," ").replace(/^\s+/,"");n(i),p(),setTimeout((()=>{if(j.current){j.current.focus();const e=s.length;j.current.setSelectionRange(e,e),f(j.current.selectionStart||0)}}),10)})(e),_hover:{background:"selected"},children:[(0,c.jsx)(Nt,{color:s,children:e.symbol}),(0,c.jsx)(i.TextSmall,{as:i.Box,color:"textDescription",children:e.description})]},`${o}-${e.symbol}-${l}`)))})})},o)}))})})]})};Mt.Alert=e=>(0,c.jsx)(Mt,{...e,isAlert:!0});const Ot=Mt,Rt=[{value:"B",label:"Bytes",multiplier:1},{value:"KiB",label:"KiB",multiplier:1024},{value:"MiB",label:"MiB",multiplier:Math.pow(1024,2)},{value:"GiB",label:"GiB",multiplier:Math.pow(1024,3)},{value:"TiB",label:"TiB",multiplier:Math.pow(1024,4)}],$t=e=>{const{scales:t}=e.options||{},n=t?Rt.filter((e=>{let{value:n}=e;return t.includes(n)})):Rt;return(0,c.jsx)(Dt,{scale:n,...e})},Wt=e=>(0,c.jsx)($t,{...e,defaultScale:e.options?.scale});var Ut=n(900),zt=n(56967),qt=n(20982);const Ht=["integer","number"],Kt=e=>{let{value:t,type:n,disabled:o,onChange:l,onBlur:r,placeholder:s,schema:a,rawErrors:d,containerStyles:u}=e;const p=n?{type:n}:(e=>{let t="text";const{minimum:n,maximum:o,multipleOf:l}=e;return(Ht.includes(e.type)||Array.isArray(e.type)&&e.type.some((e=>Ht.includes(e))))&&(t="number"),{type:t,...null===n||isNaN(n)?{}:{min:n},...null===o||isNaN(o)?{}:{max:o},...null===l||isNaN(l)?"number"===e.type?{step:"0.01"}:{}:{step:l}}})(a),m=((e,t)=>"number"===t?e??"":e||"")(t,p.type);return(0,c.jsx)(i.TextInput,{value:m,placeholder:s,onChange:e=>l(e.target?.value),onBlur:r,disabled:o,error:!!d?.length,hideErrorMessage:!0,border:"inputBorder",size:"small",containerStyles:u,...p})},Gt=(0,y.default)(qt.g).withConfig({displayName:"passwordWidget__StyledIcon",componentId:"sc-6o8r4r-0"})(["position:absolute;right:8px;top:50%;transform:translateY(-50%);cursor:pointer;"]),Zt=(0,S.A)(Gt),Jt=e=>{const[t,n]=(0,h.A)(),o=(0,r.useMemo)((()=>({type:t?"text":"password"})),[t]),l=(0,r.useMemo)((()=>({icon:t?zt.k6:Ut.pS,tooltip:t?"Hide password":"Show password"})),[t]);return(0,c.jsxs)(i.Flex,{position:"relative",children:[(0,c.jsx)(Kt,{containerStyles:{width:"100%"},...o,...e}),(0,c.jsx)(Zt,{color:"text",onClick:n,...l})]})},Yt=e=>(0,c.jsx)(Kt,{type:"url",...e}),Qt=e=>{let{id:t,value:n,formContext:o}=e;const l=(0,vt.n)("id"),s=(0,Ct.R7)(l),a=(e=>{if(!e)return 0;const t=e.match(/(?:^|_)rules_(\d+)(?=_|$)/);return t?parseInt(t[1],10):0})(t),d=o.formData?.rules[a]?.config?.match;d||console.warn("[dyncfg] UnitsPlaceholderWidget could not find context field. Check for schema changes.");const u=d?.on,p=(0,r.useMemo)((()=>u&&s[u]?.units||n),[s,u,n]);return(0,c.jsx)(i.Flex,{height:6,alignItems:"center",padding:[0,2],border:{side:"all",color:"border"},round:.5,children:(0,c.jsx)(i.Text,{"data-id":"dyncfg-punits-placeholder",children:p})})},Vt={TextWidget:Kt,CheckboxWidget:jt,SelectWidget:kt,RadioWidget:e=>{let{value:t,disabled:n,onChange:o,uiSchema:l,options:s}=e;const a=l[mt.ce],d=a?.enumOptions||s?.enumOptions,u=a?.inline,p=a?.flavour,m="buttonGroup"===p,h=(0,r.useMemo)((()=>({gap:2,...u?{alignItems:"center"}:{column:!0}})),[u]);if(m){const e=d.map((e=>({...e,title:e.schema?.description})));return(0,c.jsx)(i.ButtonGroup,{items:e,checked:t,onChange:o,buttonProps:{type:"button",small:!0}})}return d?(0,c.jsx)(i.Flex,{...h,children:d.map((e=>(0,c.jsx)(i.RadioButton,{checked:t===e.value,onChange:()=>o(e.value),disabled:n,children:(0,c.jsx)("label",{title:e?.schema?.description,children:e.label})},e.value)))}):null},TextareaWidget:yt.A,PasswordWidget:Jt,URLWidget:Yt,ContextWidget:At,alertExpressionWidget:Ot.Alert,expressionBuilderWidget:Ot,durationWidget:Ft,memorySizeWidget:Wt,unitsPlaceholder:Qt};var Xt=n(62718),en=n(9381);const tn=(0,y.default)(g.Ay).withConfig({displayName:"formItem__Form",componentId:"sc-2g4dwa-0"})(["display:flex;flex-direction:column;justify-content:space-between;height:100%;overflow-y:scroll;scrollbar-gutter:stable;padding-right:20px;"]),nn=function(){let{id:e,node:t,isNewItem:n,formState:o=m.bP,submitMethod:l,setIsDirty:i=b(),setError:a=b()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const g=(0,r.useRef)(0),f=(0,r.useRef)(),{entityProps:y={}}=(0,s.SU)(),{cmds:j=[]}=y,C=j.includes("userconfig"),[v,w,k]=(0,h.A)(C),{isLoading:S,loaded:A,formData:I,setFormData:D,refreshData:E,schema:T,resourcesError:F,errors:N,onChange:_,onSubmit:P,onError:L}=bt({id:e,node:t,formState:o,submitMethod:l,setIsDirty:i,setError:a,stripUnknownFields:!0}),{jsonSchema:B,uiSchema:M}=T||{};(0,r.useEffect)((()=>(g.current=Date.now(),()=>{g.current=0})),[]);const O=(0,r.useCallback)((e=>{const t=Date.now()-g.current,n=0===g.current||t<500;_(e,n)}),[_]);return A?F?(0,c.jsx)(u,{id:e,error:F}):(0,c.jsx)(d.Ay,{feature:"DyncfgForm",id:e,isNewItem:n,children:(0,c.jsx)(en.A,{children:(0,c.jsx)(p.A,{margin:[0,0,2],padding:[2,0,0,0],sidebar:(0,c.jsx)(r.Suspense,{fallback:(0,c.jsx)(Xt.qE,{}),children:(0,c.jsx)(be,{id:e,node:t,isOpen:v,toggleIsOpen:w,canGetUserConfig:C,formData:I})}),containerProps:{id:"dyncfg-form-layout",border:{side:"top",color:"border"}},children:(0,c.jsx)(r.Suspense,{fallback:(0,c.jsx)(Xt.qE,{}),children:(0,c.jsx)(tn,{ref:f,className:"dyncfg-form",liveValidate:!0,disabled:S,schema:B,uiSchema:M,formData:I,formContext:{setFormData:D,formData:I},templates:gt,widgets:Vt,validator:x.Ay,onError:L,onChange:O,onSubmit:P,experimental_defaultFormStateBehavior:{emptyObjectFields:"populateAllDefaults",allOf:"populateDefaults",mergeDefaultsIntoFormData:"useDefaultIfFormDataUndefined"},children:(0,c.jsx)(ee,{id:e,formRef:f,loading:S,errors:N,openUserConfig:k,refreshData:E})})})})})}):(0,c.jsx)(Xt.qE,{})},on=e=>{let{id:t,node:n,...o}=e;const{setFormData:i}=(0,s.SU)(),a=(0,l.SW)({id:t,node:n}),{loaded:d,value:p,hasError:m,error:h,refresh:g}=a,[x,f]=(0,l.Jb)({id:t,node:n});return(0,r.useEffect)((()=>{x&&(g(),f(!1))}),[x,g,f]),(0,r.useEffect)((()=>{d&&!m&&i(p)}),[d,m,i,p]),d?m?(0,c.jsx)(u,{id:t,error:h}):(0,c.jsx)(nn,{...o,id:t,node:n,formState:a}):null},ln=e=>{let{id:t,formData:n,isNewItem:r,...s}=e;const{node:i}=(0,o.Z)(),a=(0,l.Nj)({id:t,node:i}),d=(0,l.xS)({id:t,node:i});return r?(0,c.jsx)(nn,{...s,formData:n,id:t,node:i,isNewItem:r,submitMethod:a}):(0,c.jsx)(on,{...s,id:t,node:i,submitMethod:d})},rn=(0,r.memo)(ln)},9381:(e,t,n)=>{n.d(t,{A:()=>d});var o=n(96540),l=n(41514),r=n(63766),s=n(74848);class i extends o.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){(0,l.H)("configuration-error",{error:e.message,stack:t.componentStack,configId:this.props.configId})}handleRetry=()=>{this.setState({hasError:!1,error:null}),this.props.onRetry&&this.props.onRetry()};render(){return this.state.hasError?this.props.fallback||(0,s.jsx)(a,{onRetry:this.handleRetry,canRetry:!1!==this.props.canRetry,error:this.state.error}):this.props.children}}const a=e=>{let{onRetry:t,canRetry:n=!0,error:o}=e;return(0,s.jsxs)(r.Flex,{column:!0,alignItems:"center",justifyContent:"center",padding:[8],gap:4,children:[(0,s.jsx)(r.Icon,{name:"alert_triangle",size:"large",color:"error"}),(0,s.jsx)(r.Text,{size:"large",strong:!0,children:"Something went wrong"}),(0,s.jsx)(r.Text,{color:"textLite",children:"We're having trouble loading this configuration"}),(0,s.jsxs)(r.Flex,{gap:2,children:[(0,s.jsx)(r.Button,{onClick:t,disabled:!n,children:n?"Try Again":"Max Retries Reached"}),(0,s.jsx)(r.Button,{flavour:"borderless",onClick:()=>window.location.reload(),children:"Reload Page"})]})]})},d=i},10094:(e,t,n)=>{n.d(t,{r:()=>$,A:()=>z});var o=n(33185),l=n(63950),r=n.n(l),s=n(63766),i=n(96540),a=n(4575),d=n(93598),c=n(94404),u=n(74848);const p=(0,c.A)(d.A),m=function(){let{id:e,onClick:t,closeMenu:n=r(),buttonProps:o={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{open:l,isLoading:s,entityProps:d}=(0,a.SU)(),{cmds:c=[]}=d||{},m=s,h=c.includes("update")?"Edit configuration":"You have no permissions to edit the configuration",g=(0,i.useCallback)((()=>{t(),n()}),[t,n]);return(0,u.jsx)(p,{view:!0,forceAccess:l,feature:"DyncfgItem",payload:{id:e,label:l?"Close":"Edit"},tooltip:l?"Close":h,icon:l?"x":"pencilOutline",onClick:g,disabled:m,...o})};var h=n(91421),g=n(76661),x=n(67200),f=n(98289);const b=(0,x.A)(s.Button),y=function(){let{title:e,template:t={},onCollapseExpand:n=r(),buttonProps:o={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const l=(0,f.UE)(e),[,s]=(0,h.QH)(),{cmds:d,user_disabled:c}=t,{isLoading:p,open:m,formData:x,entityProps:y,isNewItem:j}=(0,a.SU)(),C=(0,g.A)(),v=(0,i.useCallback)((()=>{p||(s(C({template:l,formData:x,entityProps:y})),n())}),[p,l,x,y,s,C,n]);return m&&!j&&d?.includes("add")?(0,u.jsx)(b,{icon:"copy",onClick:v,disabled:p||c,...c?{}:{tooltip:"Copy this item and create a new one"},...o}):null};var j=n(73937),C=n(19148),v=n(6304),w=n(12215),k=n(3319);const S=(0,c.A)(d.A),A=e=>{let{id:t,open:n,onDecline:o,onConfirm:l}=e;return n?(0,u.jsx)(s.ConfirmationDialog,{title:"Delete item?",handleConfirm:l,handleDecline:o,confirmLabel:"Yes, delete",declineLabel:"No",backdropContainerProps:{zIndex:"120"},message:(0,u.jsxs)(s.Flex,{column:!0,gap:2,children:[(0,u.jsxs)(s.TextBig,{children:["You are going to completely remove ",(0,u.jsx)(C.QP,{strong:!0,children:t})," and this action cannot be reverted."]}),(0,u.jsx)(s.TextBig,{children:"Are you sure that you want to delete this item?"})]})}):null},I=function(){let{id:e,onOpenConfirmation:t=r(),onCloseConfirmation:n=r(),buttonProps:o={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{isLoading:l,entityProps:s,startLoading:d,stopLoading:c}=(0,a.SU)(),{type:p,cmds:m=[]}=s||{},{node:g}=(0,j.Z)(),x=(0,h.OU)({id:e,node:g}),[f,b]=(0,w.A)(),y=(0,h.Hj)(),[C,,I,D]=(0,v.A)(),{sendButtonClickedLog:E}=(0,k.A)(),T=l,F=(0,i.useCallback)((()=>{D(),n(),d(),x().then((t=>{f({successMessage:"Successfully deleted configuration"})(t),E({feature:"DyncfgItem",description:"Confirm deletion",id:e}),y()})).catch((e=>{b({header:"Couldn't delete configuration"})(e)})).finally((()=>{c()}))}),[x,D,n,d,c,y,E]),N=(0,i.useCallback)((()=>{l||(I(),t())}),[l,I,t]),_=(0,i.useCallback)((()=>{D(),n()}),[D,n]);return"job"===p&&m.includes("remove")?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{edit:!0,feature:"DyncfgItem",payload:{id:e,label:"Delete"},icon:"trashcan",onClick:N,disabled:T,tooltip:"Delete",...o}),(0,u.jsx)(A,{id:e,open:C,onDecline:_,onConfirm:F})]}):null},D=(0,c.A)(d.A),E=function(){let{id:e,template:t={},closeMenu:n=r(),buttonProps:o={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{node:l}=(0,j.Z)(),s=(0,h.ZN)({id:e,node:l}),[d,c]=(0,w.A)(),{isLoading:p,entityProps:m,startLoading:g,stopLoading:x}=(0,a.SU)(),{user_disabled:f}=t,{cmds:b=[]}=m||{},y=(0,h.O_)({node:l,id:e}),C=p||f,v=(0,i.useCallback)((()=>{n(),p||f||(g(),s().then((e=>{d({successMessage:"Successfully restarted configuration"})(e),y()})).catch((e=>{c({header:"Couldn't restart configuration"})(e)})).finally((()=>{x()})))}),[p,f,s,g,y,x,n]);return b.includes("restart")?(0,u.jsx)(D,{edit:!0,feature:"DyncfgItem",payload:{id:e,label:"Restart"},icon:"refresh",onClick:v,disabled:C,tooltip:"Restart",...o}):null},T=(0,c.A)(d.A),F=e=>{let{id:t,template:n={},closeMenu:o=r(),buttonProps:l}=e;const{isLoading:s,entityProps:c,startLoading:p,stopLoading:m}=(0,a.SU)(),{cmds:g=[],userDisabled:x}=c||{},[f,b]=(0,i.useState)(!x),{node:y}=(0,j.Z)(),{user_disabled:C}=n,v=(0,h.DP)({id:t,node:y}),S=(0,h.O_)({node:y,id:t}),[A,I]=(0,w.A)(),{sendButtonClickedLog:D}=(0,k.A)(),{hidden:E,isDisabled:F,tooltipText:N}=(0,d.j)({edit:!0,tooltip:f?"Disable":"Enable",disabled:s||C}),_=(0,i.useMemo)((()=>({...l,label:f?"Disable":"Enable",payload:{id:t,label:f?"Disable":"Enable"}})),[l,f]),P=(0,i.useCallback)((()=>{b((e=>!e)),o(),p(),v(!f).then((e=>{D({feature:"DyncfgItem",description:f?"Disable item":"Enable item",id:t}),A({successMessage:`Successfully ${f?"disabled":"enabled"} configuration`})(e),S()})).catch((e=>{D({feature:"DyncfgItem",description:`Failed to ${f?"disable":"enable"} item`,id:t}),b((e=>!e)),I({header:`Couldn't ${f?"disable":"enable"} configuration`})(e)})).finally((()=>{m()}))}),[C,f,v,p,b,S,D,o]),L=(0,i.useMemo)((()=>g.includes("enable")),[g]),B=(0,i.useMemo)((()=>g.includes("disable")),[g]);return!E&&L&&B?(0,u.jsx)(T,{edit:!0,feature:"DyncfgItem",icon:"switch_off",onClick:P,disabled:F,tooltip:N,..._}):null};n(98992),n(37550);const N=(0,n(74891).A)(s.Button),_={small:!0,neutral:!0,tooltip:null,iconHeight:"12px"},P=["restart","remove"],L=["enable","disable"],B=e=>{let{title:t,template:n,isOpenEntity:o,buttonProps:l={}}=e;const r=(0,i.useRef)(),[d,c,,p]=(0,v.A)(!1),[m,,h]=(0,v.A)(!1),{entityProps:g}=(0,a.SU)(),{cmds:x=[]}=g||{},f=(0,i.useMemo)((()=>!!x.some((e=>P.includes(e)))||!(o||!L.every((e=>x.includes(e))))),[x,o]),b=(0,i.useCallback)((()=>{m||p()}),[p,m]);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(s.Flex,{ref:r,children:(0,u.jsx)(N,{icon:"nav_dots",onClick:c,tooltip:f?"Item actions":null,disabled:!f,...l})}),d&&f&&r.current?(0,u.jsx)(s.Drop,{width:25,target:r.current,align:{top:"bottom",right:"right"},background:"modalTabsBackground",margin:[2,0,0],round:.5,close:p,onClickOutside:b,onEsc:p,children:(0,u.jsxs)(s.Flex,{column:!0,gap:1,padding:[2],children:[(0,u.jsx)(E,{id:t,template:n,closeMenu:p,buttonProps:{...l,..._,label:"Restart"}}),o?null:(0,u.jsx)(F,{id:t,template:n,closeMenu:p,buttonProps:{...l,..._}}),(0,u.jsx)(I,{id:t,onOpenConfirmation:h,onCloseConfirmation:p,buttonProps:{...l,..._,neutral:!1,danger:!0,iconColor:"error",label:"Delete"}})]})}):null]})};var M=n(4797);const O="text",R={iconColor:O,flavour:"borderless",color:O,type:"button"},$=(0,o.default)(s.Flex).attrs({alignItems:"center",border:{side:"all",color:"border"},round:!0}).withConfig({displayName:"itemActions__StyledContainer",componentId:"sc-1kpuq1a-0"})([""]),W=(U=m,e=>{let{open:t,...n}=e;return t?(0,u.jsx)($,{gap:1,children:(0,u.jsx)(U,{...n})}):(0,u.jsx)(U,{...n})});var U;const z=function(){let{title:e,open:t,isOpenEntity:n,isEditFromState:o,onEdit:l,onCollapseExpand:s=r()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i=(0,M.A)();return(0,u.jsxs)(u.Fragment,{children:[t?o?null:(0,u.jsxs)($,{gap:1,children:[(0,u.jsx)(y,{title:e,template:i,onCollapseExpand:s,buttonProps:R}),(0,u.jsx)(E,{id:e,template:i,buttonProps:R}),(0,u.jsx)(I,{id:e,buttonProps:R}),n?null:(0,u.jsx)(F,{id:e,template:i})]}):(0,u.jsx)(B,{title:e,template:i,isOpenEntity:n,buttonProps:R}),(0,u.jsx)(W,{id:e,onClick:l,open:t,buttonProps:R})]})}},12215:(t,n,o)=>{o.d(n,{A:()=>a,x:()=>i});o(96540);var l=o(63872),r=o(41395),s=o(21885);const i=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.Fn,o=t?.response?.data||t||{};try{o=JSON.parse(o)}catch(e){}const{message:l,errorMessage:i,error_message:a}=o;return(0,r.Zr)(l||i||a||n)},a=()=>{const[e,t,,n]=(0,l.A)();return[function(){let{successMessage:t="Successfully saved"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o=>{let{data:{message:l}}=o;(l?n:e)({header:l?"Warning":"Success",text:l||t})}},function(){let{header:e="Error",text:n=s.Fn}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o=>{const l=i(o,n);t({header:e,text:l})}}]}},19148:(e,t,n)=>{n.d(t,{QP:()=>s,RK:()=>i,gX:()=>u,h9:()=>a,l4:()=>c,qz:()=>d});var o=n(33185),l=n(63766),r=n(21885);const s=(0,o.default)(l.TextBig).withConfig({displayName:"styled__StyledTitle",componentId:"sc-16w9sl7-0"})(["font-family:monospace;"]),i=(0,o.default)(l.Icon).attrs((e=>({opacity:"1",cursor:"pointer",...e}))).withConfig({displayName:"styled__StyledTemplateArrow",componentId:"sc-16w9sl7-1"})(["pointer-events:",";opacity:",";cursor:",";"],(e=>{let{hasTemplateChildren:t}=e;return t?"auto":"none"}),(e=>{let{hasTemplateChildren:t}=e;return t?"1":"0"}),(e=>{let{hasTemplateChildren:t}=e;return t?"pointer":"default"})),a=(0,o.default)(l.Flex).withConfig({displayName:"styled__StyledHeader",componentId:"sc-16w9sl7-2"})(["height:","px;border-top:1px solid ",";border-left:1px solid ",";border-right:1px solid ",";border-bottom:1px solid ",";border-bottom-style:",";"],r.FL,(0,l.getColor)("border"),(0,l.getColor)("border"),(0,l.getColor)("border"),(0,l.getColor)("border"),(e=>{let{isOpenEntity:t}=e;return t?"none":"solid"})),d=(0,o.default)(l.Collapsible).withConfig({displayName:"styled__StyledCollapsible",componentId:"sc-16w9sl7-3"})(["height:",";max-height:",";overflow:auto;"],(e=>{let{open:t,fullPage:n}=e;return t&&n?"100%":"auto"}),(e=>{let{flavour:t,fullPage:n,isJob:o}=e;return"path"!==t?n?"calc(100% - 55px)":o?"500px":"unset":"unset"})),c=(0,o.default)(l.TextBig).withConfig({displayName:"styled__StyledNodeName",componentId:"sc-16w9sl7-4"})(["font-family:monospace;"]),u=(0,o.default)(l.Flex).attrs((e=>({position:"absolute",column:!0,gap:1,top:"50%",left:"50%",...e}))).withConfig({displayName:"styled__StyledLoaderContainer",componentId:"sc-16w9sl7-5"})(["transform:translate(-50%,-50%);"])},21785:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(24609),l=n(19186),r=n(25291),s=n(87083);const i=function(){let{roomId:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,o.vt)(),n=(0,l.ID)(),i=(0,s.w7)({extraKey:"nodesView",merge:!1,scoped:!0});(0,r.A)(e||n,i,{spaceId:t})}},45026:(e,t,n)=>{n.d(t,{A:()=>s});var o=n(91421),l=n(21885),r=n(87083);const s=()=>{const{state:e,refresh:t}=(0,o.$h)(),{alertName:n}=e||{},s=(0,r.a7)({extraKey:l.q4}),i=n?`${l.DR}${n}`:null,a=(0,o.hG)({nodeIds:s,id:i}),{nodeId:d,error:c}=a||{};return{alertName:n,nodeIds:s,title:i,nodeId:d,error:c,refresh:t}}},49165:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(87680),l=n(12215),r=n(91421),s=n(96540);const i=function(){let{id:e,node:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=(0,r.y8)({id:e,node:t}),i=(0,o.A)(),{setValue:a,setError:d}=(0,r.MQ)(),c=(0,s.useRef)();return(0,s.useCallback)(((e,t)=>{c.current&&(clearTimeout(c.current),c.current=null);const o=null===t?t:t||i;c.current=setTimeout((()=>{n({name:o,payload:e}).then((e=>a(e.data||""))).catch((e=>{d((0,l.x)(e))}))}),500)}),[n,i,a,d])}},65637:(e,t,n)=>{n.d(t,{A:()=>s});n(98992),n(72577),n(81454),n(8872);var o=n(96540),l=n(91421),r=n(41395);const s=e=>{const{state:t}=(0,l.$h)(),{isAlert:n}=t||{},{loaded:s,value:i,hasError:a}=(0,l.wd)({node:e}),d=(0,o.useMemo)((()=>!s||a?[]:Object.keys(i?.tree||{}).reduce(((e,t)=>{t.startsWith("/")||(t=`/${t}`);const n=t.match(/\/[^/]+/g);if(n.length){const t=n[0],o=(0,r.Zr)(t.replace(/^\/?/,""));e.find((e=>e.value===t))||e.push({value:t,label:o})}return e}),[])),[s,i,a]),[c,u]=(0,l.te)();(0,o.useEffect)((()=>{if(n&&d.length&&!c){const e=d.map((e=>{let{value:t}=e;return t})).indexOf("/health");u(e)}}),[n,d,u]);return{loaded:s&&(!!d||a),tabs:d,selectedTab:c,setSelectedTab:u,path:d[c]?.value,tree:i?.tree}}},73937:(e,t,n)=>{n.d(t,{A:()=>p,Z:()=>u});n(98992),n(72577),n(8872);var o=n(96540),l=n(24609),r=n(87083),s=n(91421),i=n(21885);const a=e=>e?e?.id&&e?.name?{id:e.id,label:e.name,value:e.id,isParent:0===e.ni||"true"===e.labels?._is_parent,capabilities:e.capabilities}:e:null,d=[],c=function(){let{selectedNode:e,nodes:t=d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[,n]=(0,s.T9)(),c=(0,l.dg)(),u=(0,o.useMemo)((()=>t.reduce(((e,t)=>t.isLive&&t.capabilities.dyncfg?.enabled&&(!c||t.isPreferred)?[...e,a(t)]:e),[])),[t,c]),[p,m]=(0,r.Oj)({extraKey:i.q4,merge:!1}),h=(0,o.useMemo)((()=>{let n=a(e);return n||(n=a(1===p.length?t.find((e=>e.id===p[0])):null),n||(u.length?u[0]:""))}),[u,p]),g=(0,o.useCallback)((e=>m([e.value])),[m]);return(0,o.useEffect)((()=>{h?.id&&n([h.id])}),[h?.id,n]),{options:u,node:h,setNode:g}},u=()=>{const[e]=(0,s.Gt)(),[t]=(0,s.T9)(),n=(0,o.useMemo)((()=>Array.isArray(t)&&t.length?e.find((e=>e.id===t[0])):null),[e,t]);return c({selectedNode:n,nodes:e})},p=c},73980:(e,t,n)=>{n.d(t,{A:()=>de});var o=n(73937),l=n(91421),r=n(63872),s=n(23226),i=n(6304),a=n(67012),d=n(63950),c=n.n(d),u=n(96540),p=n(40961),m=n(4575),h=n(62718),g=n(63766),x=(n(98992),n(54520),n(81454),n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215),n(45087)),f=n(74891),b=n(49165),y=n(21885),j=n(65637),C=n(98289),v=n(87083),w=n(19148),k=n(74848);const S=(0,f.A)(g.Flex),A=(0,f.A)(g.Checkbox),I=(0,f.A)(w.RK),D=(0,u.memo)((e=>{let{source:t="",sourceType:n}=e;const o=t.split(",");return(0,k.jsxs)(g.Flex,{column:!0,gap:2,children:[(0,k.jsxs)(g.Flex,{alignItems:"center",gap:1,children:[(0,k.jsx)(g.Text,{strong:!0,children:"Source type"}),(0,k.jsx)(g.Pill,{children:n})]}),(0,k.jsx)(g.Flex,{column:!0,gap:1,children:o.length?o.map((e=>(0,k.jsx)(g.TextSmall,{children:e},e))):null})]})})),E=(0,u.memo)((e=>{let{source:t,sourceType:n,...o}=e;const l=(0,u.useMemo)((()=>y.V6[n]),[n]);if(!l)return null;const{icon:r}=l;return(0,k.jsx)(x.A,{isBasic:!0,content:(0,k.jsx)(D,{source:t,sourceType:n}),children:(0,k.jsx)(g.Flex,{children:(0,k.jsx)(g.Icon,{name:r,...o})})})})),T=(0,u.memo)((e=>{let{type:t,status:n}=e;const o=(0,u.useMemo)((()=>y.bM[n]),[n]);if(!o)return null;const{label:l,color:r,icon:s}=o;return"template"!==t?(0,k.jsx)(S,{width:{min:6},gap:1,padding:[1],round:!0,alignItems:"center",justifyContent:"center",tooltip:l,children:(0,k.jsx)(g.Icon,{name:s,height:"16px",color:r})}):null})),F=(0,u.memo)((()=>(0,k.jsx)(g.Flex,{width:{max:100},children:(0,k.jsxs)(g.Text,{children:["You can submit your changes to another node, or to multiple nodes by selecting"," ",(0,k.jsx)(g.Text,{strong:!0,children:"Submit to multiple nodes"})," button."]})}))),N=()=>{const{options:e}=(0,o.Z)(),[t]=(0,v.Oj)({extraKey:y.q4,merge:!1}),n=t.length?e.filter((e=>{let{value:n}=e;return t.includes(n)})):e,l=n.length?n[0].label:"0",r=n.length>1?`and ${n.length-1} more`:"",s=n.length>1?"nodes":"node";return(0,k.jsxs)(g.Flex,{"data-testid":"dyncfg-on-node",gap:1,alignItems:"center",children:[(0,k.jsx)(g.TextBig,{children:"on"}),(0,k.jsxs)(S,{padding:[1],background:"mainBackground",tooltip:1===n.length?(0,k.jsx)(F,{}):null,tooltipProps:{isBasic:!0,plain:!1},children:[(0,k.jsx)(w.l4,{strong:!0,children:l})," "]}),(0,k.jsxs)(g.TextBig,{children:[(0,k.jsx)(g.TextBig,{strong:!0,children:`${r} `}),s]})]})},_=e=>{let{title:t,containerIsOpen:n,type:r,source:s,sourceType:i,status:a,templateChildren:d={},onCollapseExpand:c,userDisabled:p}=e;const h=(0,u.useRef)(),{color:x}=y.g7[r]||y.g7.default,f=(0,u.useMemo)((()=>p||"disabled"===a?"disabled":x),[p,a,x]),{node:v}=(0,o.Z)(),{path:S}=(0,j.A)(v),{open:D,isNewItem:F,formData:_,setFormData:P,entityProps:L={}}=(0,m.SU)(),{cmds:B=[]}=L,M=B.includes("userconfig"),{name:O}=_||{},R=(0,b.A)({id:t,node:v}),{items:$,toggle:W,isSelected:U,setItems:z}=(0,l.H2)({node:v,path:S}),q="template"===r,H=Object.keys(d||{}),K=!!Object.keys(d||{}).length,G=(0,u.useMemo)((()=>H.filter((e=>$.includes(e)))),[H,$]),Z=(0,u.useMemo)((()=>G.length===H.length),[G.length,H.length]),J=(0,u.useMemo)((()=>G.length>0&&G.length<H.length),[G.length,H.length]),Y=(0,u.useCallback)((e=>{const t=(e.target.value||"").replace(/ /g,"_");P((e=>({...e,name:t}))),M&&R(_,t||"test")}),[_,P,M,R]),Q=(0,u.useCallback)((()=>{q?z((e=>Z?e.filter((e=>!H.includes(e))):Array.from(new Set([...e,...H])))):W(t)}),[t,q,H,W,z]);return(0,u.useEffect)((()=>{h.current&&h.current.focus()}),[h.current]),(0,k.jsxs)(g.Flex,{gap:2,alignItems:"center",padding:[0,0,0,q?0:2],children:[!!q&&(0,k.jsx)(I,{noWrapper:!0,name:"chevron_right",color:"textLite",rotate:n?3:1,onClick:c,tooltip:n?"Hide children":"Show children",hasTemplateChildren:K}),D||F?null:(0,k.jsx)(g.Flex,{padding:[0,1,0,0],children:(0,k.jsx)(A,{checked:q?K&&Z:U(t),indeterminate:q&&!!J,onChange:Q,tooltip:q?K?"Select all":null:"Select",disabled:q&&!K})}),(0,k.jsx)(T,{type:r,status:a}),(0,k.jsx)(E,{source:s,sourceType:i,color:f}),F?null:(0,k.jsx)(w.QP,{color:f,children:(0,C.J3)(t)}),F&&D?(0,k.jsx)(g.TextInput,{inputRef:h,"data-testid":"dyncfg-config-item-name",width:65,value:O,onChange:Y,placeholder:"Add configuration name",error:F&&!_?.name,hideErrorMessage:!0}):null,"template"!==r&&D?(0,k.jsx)(N,{}):null]})},P=(0,u.memo)(_);var L=n(76661),B=n(93598),M=n(94404);const O=(0,M.A)(B.A),R=function(){let{title:e,buttonProps:t={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[,n]=(0,l.QH)(),o=(0,L.A)(),{isLoading:r,entityProps:s}=(0,m.SU)(),{cmds:i=[]}=s||{},a=r,d=(0,u.useCallback)((()=>{n(o({template:e,entityProps:s}))}),[e,s,o,n]);return i.includes("add")?(0,k.jsx)(O,{edit:!0,feature:"DyncfgTemplate",payload:{id:e,label:"Add job"},tooltip:"Add a new configuration item",icon:"plus",iconWidth:18,iconHeight:18,onClick:d,disabled:a,...t}):null};var $=n(12215),W=n(41395);const U=(0,M.A)(B.A),z=e=>{let{id:t,enable:n,open:o,onDecline:l,onConfirm:r}=e;const s=n?"enable":"disable";return o?(0,k.jsx)(g.ConfirmationDialog,{title:`${(0,W.Zr)(s)} item?`,handleConfirm:r,handleDecline:l,confirmLabel:`Yes ${s}`,declineLabel:"No",isConfirmPositive:!!n,message:(0,k.jsxs)(g.Flex,{column:!0,gap:2,children:[(0,k.jsxs)(g.TextBig,{children:["You are about to ",s," ",(0,k.jsx)(w.QP,{strong:!0,children:t})," module and all its configurations."]}),(0,k.jsx)(g.TextBig,{children:"Are you sure?"})]})}):null},q=e=>{let{id:t,userDisabled:n,buttonProps:r={},cmds:s=[]}=e;const{isLoading:a,startLoading:d,stopLoading:c}=(0,m.SU)(),{node:p}=(0,o.Z)(),h=(0,l.DP)({id:t,node:p}),g=(0,l.O_)({node:p,id:t}),[x,f]=(0,$.A)(),[b,y]=(0,u.useState)(!n),[j,,C,v]=(0,i.A)(),w=(0,u.useCallback)((()=>{v(),d(),h(b).then((e=>{g(),x({successMessage:`Successfully ${b?"enabled":"disabled"} module`})(e)})).catch((e=>{f({header:`Couldn't ${b?"enabled":"disabled"} module`})(e)})).finally((()=>{c()}))}),[b,v,d,h,g,c]),S=(0,u.useMemo)((()=>n?!s.includes("enable"):!s.includes("disable")),[n,s]),A=(0,u.useCallback)((e=>{a||S||(y(e),C())}),[a,S,C]),I=(0,u.useMemo)((()=>({edit:!0,feature:"DyncfgTemplate",payload:{id:t,label:n?"Enable":"Disable"},isLoading:a,disabled:a||S,...r,...n?{tooltip:S?"You cannot enable this module":"Enable this module",icon:"switch_off",iconColor:S?"textLite":"disabled",onClick:()=>A(!0)}:{tooltip:S?"You cannot disable this module":"Disable this module",icon:"switch_off",iconColor:S?"textLite":"success",onClick:()=>A(!1),danger:!0}})),[t,n,a,r,S,A]);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(U,{...I}),(0,k.jsx)(z,{id:t,enable:b,open:j,onDecline:v,onConfirm:w})]})},H="success",K={iconColor:H,flavour:"borderless",color:H},G=e=>{let{title:t,userDisabled:n,cmds:o}=e;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(R,{title:t,buttonProps:K}),(0,k.jsx)(q,{id:t,userDisabled:n,buttonProps:K,cmds:o})]})};var Z=n(10094);const J=e=>{let{title:t,open:n,onEdit:o,onCollapseExpand:l,type:r,userDisabled:s,isOpenEntity:i,isEditFromState:a,cmds:d}=e;return(0,k.jsx)(g.Flex,{gap:2,alignItems:"center",children:"template"===r?(0,k.jsx)(G,{title:t,userDisabled:s,cmds:d}):(0,k.jsx)(Z.A,{title:t,open:n,onEdit:o,onCollapseExpand:l,isOpenEntity:i,isEditFromState:a})})};var Y=n(3941);const Q=(0,f.A)(g.Icon),V={vertical:2,horizontal:4},X=e=>{let{path:t,containerIsOpen:n,onClick:o,...l}=e;return(0,k.jsxs)(g.Flex,{gap:2,alignItems:"center",onClick:o,cursor:"pointer",...l,children:[(0,k.jsx)(Q,{noWrapper:!0,name:"chevron_right",color:"textLite",rotate:n?3:1,tooltip:n?"Hide children":"Show children"}),(0,k.jsx)(w.QP,{strong:!0,children:t})]})},ee=e=>{let{frequency:t=20}=e;const[n,o]=(0,u.useState)(t),[l,r]=(0,u.useState)(0),s=(0,u.useCallback)((()=>{100!==l?r((e=>e+5)):o(void 0)}),[r,o]);return(0,Y.A)(s,n),(0,k.jsxs)(w.gX,{"data-testid":"dyncfg-header-loader-container",children:[(0,k.jsx)(g.Text,{children:"Loading schema..."}),(0,k.jsx)(g.ProgressBar,{background:"border",border:"none",color:["green","netdata"],containerWidth:"100%","data-testid":"dyncfg-schema-loading-progress-bar",height:1,width:`${l}%`})]})},te=e=>{let{flavour:t,title:n,open:o,toggleOpen:r,onEdit:s,level:i,fullPage:a,entityProps:d={},isOpenEntity:c,isEditFromState:p,schemaLoaded:m}=e;const{vertical:h,horizontal:g}=V,x=(0,u.useMemo)((()=>[h,g,h,o&&a?g:g*i]),[i,o,a]),f="path"===t,{ids:b,toggle:y}=(0,l.$K)(),j=(0,u.useMemo)((()=>!b.includes(n)),[b,n]),C=(0,u.useCallback)((()=>{y(n),"template"!==d?.type&&r()}),[n,y,r,d?.type]);return(0,k.jsx)(w.h9,{position:"relative",alignItems:"center",justifyContent:"between",padding:x,isOpenEntity:c,children:f?(0,k.jsx)(X,{path:n,containerIsOpen:j,onClick:C}):(0,k.jsx)(k.Fragment,{children:o&&!m?(0,k.jsx)(ee,{}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(P,{title:n,containerIsOpen:j,onCollapseExpand:C,...d}),(0,k.jsx)(J,{title:n,open:o,onEdit:s,onCollapseExpand:C,isOpenEntity:c,isEditFromState:p,...d})]})})})},ne=e=>{let{collapsibleProps:t,loaderProps:n,level:o,setIsDirty:l,setError:r,showLoader:s,renderChildren:i}=e;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(w.qz,{...t,children:i({level:o+1,setIsDirty:l,setError:r})}),s?(0,k.jsx)(g.Flex,{...n,children:(0,k.jsx)(h.tW,{})}):null]})},oe=e=>{let{title:t,isLoading:n,fullPage:o,entityProps:l,setIsDirty:r,flavour:s,handleEditClick:i,open:a,toggleOpen:d,level:p,isEditFromState:m,setError:h,schema:x,schemaLoaded:f,renderChildren:b=c(),...y}=e;const j="path"===s,C=["single","job"].includes(l?.type),v="job"===l?.type,w="path"!==s&&a&&n,{containerProps:S,collapsibleProps:A,loaderProps:I}=(0,u.useMemo)((()=>({containerProps:{...a&&o?{position:"fixed",zIndex:"45",top:"5vh",left:"5vw",width:"90vw",height:"90vh"}:{position:"relative"},...a&&C?{border:{side:"all",color:"border"}}:{},...o?{}:{height:"100%"},background:C&&a?"modalBackground":"mainBackground",round:!0},collapsibleProps:{level:p,open:a,duration:0,flavour:s,fullPage:o,isJob:v,...a&&C?{padding:[2,2,2,o?4:4*p]}:{}},loaderProps:{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:".9",zIndex:"100"}})),[a,o,C,p,s,v]),D={collapsibleProps:A,loaderProps:I,level:p,setIsDirty:r,setError:h,showLoader:w,renderChildren:b};return(0,k.jsxs)(g.Flex,{"data-testid":`dyncfg-config-item-container-${t}`,column:!0,...S,...y,children:[(0,k.jsx)(te,{flavour:s,open:a,toggleOpen:d,title:t,onEdit:i,level:p,fullPage:o,entityProps:l,isOpenEntity:a&&!!C,isEditFromState:m,schemaLoaded:f},a),!j&&f&&x?(0,k.jsx)(ne,{...D}):null]})},le=e=>{let{open:t,onDecline:n,onConfirm:o}=e;return t?(0,k.jsx)(g.ConfirmationDialog,{title:"Discard changes?",handleConfirm:o,handleDecline:n,confirmLabel:"Yes, discard",declineLabel:"No, keep editing",backdropContainerProps:{zIndex:"120"},message:(0,k.jsxs)(g.Flex,{column:!0,gap:2,children:[(0,k.jsx)(g.TextBig,{children:"If you exit Edit mode before submit, your changes will be lost."}),(0,k.jsx)(g.TextBig,{children:"Are you sure?"})]})}):null},re=e=>(0,u.useEffect)((()=>{if(!e)return;const t=t=>{"Escape"===t.code&&e(t)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)}),[e]),se=e=>{let{title:t,open:n,isLoading:o,isDirty:r,setIsDirty:s,toggle:a,refresh:d,refreshUserConfig:c,entityProps:p,error:m}=e;const h=p?.[y.D9],g=["single","job"].includes(p?.type),[,x]=(0,l.QH)(),[f,,b,j]=(0,i.A)(),C=(0,u.useCallback)((()=>{r&&(s(!1),a(),j()),d(),c(),x(null)}),[t,x,r,s,a,d,c,j]),v=(0,u.useCallback)((e=>{o||(r?m||e?C():b():(a(),h&&x(null)))}),[o,h,r,m,C,b,a]);return re((e=>{"Escape"===e.code&&n&&g&&(e.preventDefault(),v())})),{confirmationOpen:f,closeConfirmation:j,onConfirm:C,onClick:v}},ie=(e,t)=>{const n=["schema_update"].includes(e.lastAction);switch(t.type){case"expand":return{...e,expanded:!0,lastAction:"expand"};case"minimize":return{...e,expanded:!1,lastAction:"minimize"};case"schema_update":return{...e,expanded:n?t.schemaFullPage:e.expanded,...n?{lastAction:"schema_update"}:{}}}},ae=e=>{let{id:t,node:n}=e;const o=(0,l.K_)({id:t,node:n});return(0,u.useEffect)((()=>{o()}),[t,n]),null},de=(0,u.memo)((e=>{let{flavour:t="path",title:n="",level:d=1,entityProps:h={},isNewItem:g,isOpen:x,isEditFromState:f,renderChildren:b=c(),formData:y,...j}=e;const C=g?j.id:n,[v,w]=(0,i.A)(g||x),{node:S}=(0,o.Z)(),A=(0,l._O)({node:S,id:n})||h,[I,,D,E]=(0,i.A)(),[T,F]=(0,u.useReducer)(ie,{expanded:!!g||!!f,lastAction:"schema_update"}),[N,_]=(0,u.useState)(),[P,L]=(0,u.useState)(),{refresh:B}=(0,l.$h)(),{refresh:M}=(0,l.MQ)(),O=["single","job"].includes(A?.type),R=(0,u.useMemo)((()=>T.expanded),[T.expanded]),[,$]=(0,s.A)(),[,W]=(0,r.A)(),{loaded:U,value:z,error:q}=(0,l.t8)({id:C,node:S}),H=(0,u.useCallback)((e=>{F({type:e?"expand":"minimize"})}),[F]),K=(0,u.useCallback)((e=>{F({type:"schema_update",schemaFullPage:e})}),[F]),{confirmationOpen:G,closeConfirmation:Z,onConfirm:J,onClick:Y}=se({title:n,open:v,isLoading:I,isDirty:P,setIsDirty:L,refresh:B,refreshUserConfig:M,toggle:w,entityProps:A,error:N}),Q=(0,u.useCallback)((e=>{v&&B(),Y(e)}),[v,B,Y]);(0,u.useEffect)((()=>{v||M()}),[v,M]),(0,u.useEffect)((()=>{U&&z&&!q&&K(!0)}),[U,z,q,K]),(0,u.useEffect)((()=>{q&&(v?Q(!0):W({header:"Schema error",message:q}))}),[v,q,Q,W]),(0,a.A)((()=>{$(!!v)}),[v]);const V={title:n,isLoading:I,fullPage:R,entityProps:A,setIsDirty:L,flavour:t,handleEditClick:Q,open:v,toggleOpen:w,level:d,setError:_,isEditFromState:f,schema:z,schemaLoaded:U,renderChildren:b,...j};return(0,k.jsxs)(m.Ay,{id:n,open:v,isNewItem:g,isLoading:I,startLoading:D,stopLoading:E,fullPage:R,setFullPage:H,entityProps:A,isDirty:P,setIsDirty:L,error:N,formData:y,children:[v&&O&&C&&S?(0,k.jsx)(ae,{id:C,node:S}):null,v&&U&&!q?(0,p.createPortal)((0,k.jsx)(oe,{...V,"data-testid":"in-portal"}),document.body):(0,k.jsx)(oe,{...V}),(0,k.jsx)(le,{open:G,onDecline:Z,onConfirm:J})]})}))},76661:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(21885);const l=()=>e=>{let{template:t,formData:n={},entityProps:l}=e;return{[o.D9]:!0,template:t,name:"",sourceType:"user",type:"job",formData:n,entityProps:l}}},87680:(e,t,n)=>{n.d(t,{A:()=>s});var o=n(4575),l=n(98289),r=n(96540);const s=function(){let{defaultName:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,formData:n,isNewItem:s}=(0,o.SU)();return(0,r.useMemo)((()=>(s?n?.name:(0,l.J3)(t))||e),[s,n?.name,t,e])}}}]);