import{g as y,i as C,aH as w,H as A,a as S,r as f,j as e,M as L,_ as u,b,e3 as _,f as x,bG as j,h as d,R as z}from"./main-634.js";import"./bf-535-182.js";import{_ as M}from"./bf-432-274.js";import{F as K}from"./bf-767-388.js";import{S as T}from"./bf-982-242.js";import"./bf-25-81.js";import"./bf-497-246.js";import"./bf-641-107.js";import"./bf-400-72.js";import"./bf-438-114.js";function O({labelModal:i,setLabelModal:s}){var p,g;const{fieldKey:n}=y(),[l,a]=C(w),t=A(l[n]),{css:r}=S(),m=(p=t==null?void 0:t.config)==null?void 0:p.advancedConfig,[F,H]=f.useState(m);f.useEffect(()=>{i&&H(m)},[i]);const N=o=>{const c=_(o),v=x(l,k=>{k[n].config.advancedConfig=c});a(v),j({event:`Modify Type : ${t.lbl||n}`,type:"advancedConfig",state:{fldKey:n,fields:v}})},h=()=>{const o=x(l,c=>{c[n].config.advancedConfig=F});a(o),s(!1),j({event:"Cancel Advanced Config",type:"cancel_advancedConfig",state:{fields:o,fldKey:n}})};return e.jsxs(L,{md:!0,show:i,setModal:h,title:u("Advanced Configuration"),children:[e.jsx(M,{placeholder:"Write your custom configuration here",mode:"javascript",theme:"twilight",name:"blah2",value:((g=t==null?void 0:t.config)==null?void 0:g.advancedConfig)||"",onChange:o=>N(o),fontSize:14,lineHeight:19,height:"400px",width:"100%",showPrintMargin:!0,showGutter:!1,highlightActiveLine:!0,setOptions:{enableBasicAutocompletion:!1,enableLiveAutocompletion:!1,enableSnippets:!1,enableMobileMenu:!0,showLineNumbers:!0,tabSize:2}}),e.jsxs("div",{className:"mt-2 f-right",children:[e.jsx("button",{type:"button",className:`${r(b.btn)} mr-2`,onClick:h,children:"Cancel"}),e.jsx("button",{type:"button",className:`${r(b.btn)} blue`,onClick:()=>s(!1),children:"Save"})]})]})}function q(){var r;const{css:i}=S(),{fieldKey:s}=y(),[n]=C(w),[l,a]=f.useState(!1);if(!s)return null;const t=A(n[s]);return e.jsxs(e.Fragment,{children:[e.jsx(T,{id:"advanced-stng",title:u("Advanced Configuration"),className:i(K.fieldSection),open:!0,isPro:!0,children:e.jsxs("div",{role:"button",tabIndex:-1,"data-testid":"advanced-config-editor",className:i(d.p2),onClick:()=>a(!0),onKeyDown:()=>a(!0),children:[e.jsx(M,{placeholder:"Write your custom configuration here",mode:"javascript",theme:"twilight",name:"advanced-datetime-config",value:((r=t==null?void 0:t.config)==null?void 0:r.advancedConfig)||"",fontSize:14,lineHeight:19,height:"200px",width:"100%",showPrintMargin:!0,showGutter:!1,highlightActiveLine:!0,readOnly:!0,setOptions:{enableBasicAutocompletion:!1,enableLiveAutocompletion:!1,enableSnippets:!1,enableMobileMenu:!0,showLineNumbers:!0,tabSize:2}}),e.jsx("p",{className:i(d.mt1,d.fw500,{cr:"var(--white-0-50)"}),children:e.jsx(z,{html:u('Only valid JS object will work. for more details please check<a target="_blank" href="https://flatpickr.js.org/options/" rel="noreferrer"> the documentation for available configuration options</a>')})})]})}),e.jsx(O,{labelModal:l,setLabelModal:a})]})}export{q as default};
