"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2012],{24256:(e,t,n)=>{n.d(t,{c:()=>i});var l=n(69060),a=n(58564),o=n.n(a),s=n(66152),c=n(82496);const i=e=>{let{elements:t,name:n,label:a,tooltip:i="",commonPlaceholder:r="",onChange:h,withBorder:d=!1}=e;const[u,m]=(0,l.useState)([""]),f=(0,l.createRef)();(0,l.useEffect)((()=>{if(1===u.length&&""===u[0]&&t&&""!==t){const e=t.split(",");e.push(""),m(e)}}),[t,u]),(0,l.useEffect)((()=>{if(u.length>1){const e=f.current;e&&e.scrollIntoView(!1)}}),[u,f]);const p=(0,l.useCallback)((e=>{h(e)}),[h]),v=(0,l.useRef)(!0);(0,l.useEffect)((()=>{if(v.current)return void(v.current=!1);const e=u.filter((e=>""!==e.trim())).join(",");p(e)}),[u]);const x=e=>{e.persist();let t=[...u];const n=o()(e.target,"dataset.index","0");t[parseInt(n)]=e.target.value,m(t)},g=u.map(((e,t)=>(0,c.jsx)(s.q22,{id:"".concat(n,"-").concat(t.toString()),label:"",name:"".concat(n,"-").concat(t.toString()),value:u[t],onChange:x,index:t,placeholder:r,overlayIcon:t===u.length-1?(0,c.jsx)(s.EgV,{}):null,overlayAction:()=>{(e=>{if(""!==e[e.length-1].trim()){const t=[...e];t.push(""),m(t)}})(u)}},"csv-multi-".concat(n,"-").concat(t.toString()))));return(0,c.jsx)(l.Fragment,{children:(0,c.jsxs)(s.kvh,{sx:{display:"flex"},className:"inputItem",children:[(0,c.jsxs)(s.mWW,{sx:{alignItems:"flex-start"},children:[(0,c.jsx)("span",{children:a}),""!==i&&(0,c.jsx)(s.kvh,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,c.jsx)(s.o5h,{tooltip:i,placement:"top",children:(0,c.jsx)(s.kvh,{className:i,children:(0,c.jsx)(s.OKz,{})})})})]}),(0,c.jsxs)(s.kvh,{withBorders:d,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[g,(0,c.jsx)("div",{ref:f})]})]})})}},22012:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i,valueDef:()=>c});var l=n(69060),a=n(66152),o=n(24256),s=n(82496);const c=(e,t,n)=>{let l="on|off"===t?"off":"";if(n.length>0){const t=n.find((t=>t.key===e));t&&(l=t.value||"")}return l},i=e=>{let{onChange:t,fields:n,defaultVals:i,overrideEnv:r}=e;const[h,d]=(0,l.useState)([]),u=n||[],m=i||[];(0,l.useEffect)((()=>{const e=n.map((e=>({key:e.name,value:c(e.name,e.type,m)})));d(e)}),[n,i]),(0,l.useEffect)((()=>{t(h)}),[h]);const f=(e,t,n)=>{const l=[...h];t=t.trim(),l[n]={key:e,value:t},d(l)},p=(e,t)=>{const n=h[t];if(n){const t=null===r||void 0===r?void 0:r["".concat(n.key)];if(t)return(0,s.jsx)(a.E$k,{label:e.label,actionButton:(0,s.jsx)(a.yeN,{item:!0,sx:{display:"flex",justifyContent:"flex-end",paddingRight:"10px"},children:(0,s.jsx)(a.o5h,{tooltip:"This value is set from the ".concat(t.overrideEnv," environment variable"),placement:"left",children:(0,s.jsx)(a.Mz0,{style:{width:20}})})}),sx:{width:"100%"},children:t.value})}switch(e.type){case"on|off":const l=n?n.value:"off";return(0,s.jsx)(a.Wkk,{onChange:n=>{const l=n.target.checked?"on":"off";f(e.name,l,t)},id:e.name,name:e.name,label:e.label,value:"switch_on",tooltip:e.tooltip,checked:"on"===l});case"csv":return(0,s.jsx)(o.c,{elements:n?n.value:"",label:e.label,name:e.name,onChange:n=>{let l="";l=Array.isArray(n)?n.join(","):n,f(e.name,l,t)},tooltip:e.tooltip,commonPlaceholder:e.placeholder,withBorder:!0});case"comment":return(0,s.jsx)(a.W_2,{id:e.name,name:e.name,label:e.label,tooltip:e.tooltip,value:n?n.value:"",onChange:n=>f(e.name,n.target.value,t),placeholder:e.placeholder});default:return(0,s.jsx)(a.q22,{id:e.name,name:e.name,label:e.label,tooltip:e.tooltip,value:n?n.value:"",onChange:n=>f(e.name,n.target.value,t),placeholder:e.placeholder})}};return(0,s.jsx)(a.yE_,{withBorders:!1,containerPadding:!1,children:u.map(((e,t)=>(0,s.jsx)(l.Fragment,{children:p(e,t)},e.name)))})}}}]);
//# sourceMappingURL=2012.7d122587.chunk.js.map