treege 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
1
  # [Versions](https://github.com/Tracktor/treege/releases)
2
2
 
3
- ## v1.0.7
4
- - **[fix]** : remove tree node and its children only if is a decision node. Now you can remove a tree node without removing its children.
3
+ ## v1.0.8
4
+ - **[fix]** : autocomplete - required search key
package/dist/main.js CHANGED
@@ -7280,7 +7280,7 @@ const E1 = (e) => {
7280
7280
  /* @__PURE__ */ i.jsx(
7281
7281
  Pe,
7282
7282
  {
7283
- sx: { flex: 4 },
7283
+ sx: { flex: 3 },
7284
7284
  InputProps: {
7285
7285
  startAdornment: /* @__PURE__ */ i.jsx(Ns, { position: "start", children: /* @__PURE__ */ i.jsx(bo, {}) })
7286
7286
  },
@@ -7293,7 +7293,18 @@ const E1 = (e) => {
7293
7293
  }
7294
7294
  ),
7295
7295
  /* @__PURE__ */ i.jsx(ll, {}),
7296
- /* @__PURE__ */ i.jsx(Pe, { sx: { flex: 1 }, placeholder: "q", type: "text", onChange: V, value: He, required: !0 })
7296
+ /* @__PURE__ */ i.jsx(
7297
+ Pe,
7298
+ {
7299
+ InputLabelProps: { shrink: !0 },
7300
+ sx: { flex: 1 },
7301
+ placeholder: t("form:searchKeyPlaceholder"),
7302
+ type: "text",
7303
+ label: t("form:key"),
7304
+ onChange: V,
7305
+ value: He
7306
+ }
7307
+ )
7297
7308
  ] }) }),
7298
7309
  S && /* @__PURE__ */ i.jsxs(pe, { spacing: 1, paddingY: 1, children: [
7299
7310
  /* @__PURE__ */ i.jsx("h4", { children: t("form:urlConstruction") }),
@@ -7875,7 +7886,7 @@ const ze = {
7875
7886
  /* @__PURE__ */ i.jsx(Va, { open: d, onClose: a, title: l(), children: /* @__PURE__ */ i.jsx(Zp, { onClose: a }) }),
7876
7887
  /* @__PURE__ */ i.jsx(zp, { open: t, onClose: o, title: y, children: /* @__PURE__ */ i.jsx(zs, { data: b, renderCustomNodeElement: Wa }) })
7877
7888
  ] });
7878
- }, bm = "1.0.7", ym = ({ children: e, initialTree: t, initialTreeId: n, backendConfig: r }) => {
7889
+ }, bm = "1.0.8", ym = ({ children: e, initialTree: t, initialTreeId: n, backendConfig: r }) => {
7879
7890
  const [o, s] = be(Qe.currentHierarchyPointNode), [a, l] = be(Qe.modalOpen), [c, d] = be(Qe.treeModalOpen), [f, p] = be(Qe.treePath), [h, y] = Ja(kp, t || Qe.tree), [b, g] = be(
7880
7891
  n ? { ...Qe.currentTree, id: n } : Qe.currentTree
7881
7892
  ), v = kr(
@@ -7977,6 +7988,7 @@ const ze = {
7977
7988
  decisionField: "Champs de décision",
7978
7989
  helperText: "Texte d'information",
7979
7990
  hiddenValue: "Valeur caché",
7991
+ key: "Clé",
7980
7992
  label: "Label",
7981
7993
  message: "Message",
7982
7994
  mustBeUnique: "Doit être unique",
@@ -7985,6 +7997,7 @@ const ze = {
7985
7997
  offMessage: "Message (désactiver)",
7986
7998
  onMessage: "Message (activer)",
7987
7999
  repeatable: "Répétable",
8000
+ searchKeyPlaceholder: "text",
7988
8001
  staticFields: "Champs statiques",
7989
8002
  step: "Étape",
7990
8003
  tree: "Arbre",
package/dist/main.umd.cjs CHANGED
@@ -121,4 +121,4 @@ const theme2 = createTheme({ palette: {
121
121
  `))}b[y]={}}}};Object.keys(d.components).forEach(b=>{const x=d.components[b].styleOverrides;x&&b.indexOf("Mui")===0&&h(x,b)})}return d.unstable_sxConfig=ae({},ar,s==null?void 0:s.unstable_sxConfig),d.unstable_sx=function(h){return Vr({sx:h,theme:this})},d}const $s=Wd(),ks="$$material";function Yd({props:e,name:t}){return Qu({props:e,name:t,defaultTheme:$s,themeId:ks})}var pr={},co={exports:{}},As;function Gd(){return As||(As=1,function(e){function t(n,r){if(n==null)return{};var o={},a=Object.keys(n),s,l;for(l=0;l<a.length;l++)s=a[l],!(r.indexOf(s)>=0)&&(o[s]=n[s]);return o}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(co)),co.exports}const Kd=ut(Ku),Jd=ut(Nl),Xd=ut(Ml),Hd=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function Ms(e){const t=`${e}`.match(Hd);return t&&t[1]||""}function Ps(e,t=""){return e.displayName||e.name||Ms(e)||t}function Ds(e,t,n){const r=Ps(t);return e.displayName||(r!==""?`${n}(${r})`:n)}function Zd(e){if(e!=null){if(typeof e=="string")return e;if(typeof e=="function")return Ps(e,"Component");if(typeof e=="object")switch(e.$$typeof){case ga.ForwardRef:return Ds(e,e.render,"ForwardRef");case ga.Memo:return Ds(e,e.type,"memo");default:return}}}const Qd=ut(Object.freeze(Object.defineProperty({__proto__:null,default:Zd,getFunctionName:Ms},Symbol.toStringTag,{value:"Module"}))),ef=ut(kc),tf=ut(nd);var Yt=ye;Object.defineProperty(pr,"__esModule",{value:!0});var rf=pr.default=vf;pr.shouldForwardProp=en,pr.systemDefaultTheme=void 0;var tt=Yt(os()),uo=Yt(Gd()),Is=ff(Kd),nf=Jd,of=Yt(Xd),af=Yt(Qd),sf=Yt(ef),lf=Yt(tf);const cf=["ownerState"],uf=["variants"],df=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Fs(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Fs=function(r){return r?n:t})(e)}function ff(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Fs(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}function pf(e){return Object.keys(e).length===0}function hf(e){return typeof e=="string"&&e.charCodeAt(0)>96}function en(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const mf=pr.systemDefaultTheme=(0,sf.default)(),Ns=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function tn({defaultTheme:e,theme:t,themeId:n}){return pf(t)?e:t[n]||t}function bf(e){return e?(t,n)=>n[e]:null}function rn(e,t){let{ownerState:n}=t,r=(0,uo.default)(t,cf);const o=typeof e=="function"?e((0,tt.default)({ownerState:n},r)):e;if(Array.isArray(o))return o.flatMap(a=>rn(a,(0,tt.default)({ownerState:n},r)));if(o&&typeof o=="object"&&Array.isArray(o.variants)){const{variants:a=[]}=o;let l=(0,uo.default)(o,uf);return a.forEach(c=>{let d=!0;typeof c.props=="function"?d=c.props((0,tt.default)({ownerState:n},r,n)):Object.keys(c.props).forEach(f=>{(n==null?void 0:n[f])!==c.props[f]&&r[f]!==c.props[f]&&(d=!1)}),d&&(Array.isArray(l)||(l=[l]),l.push(typeof c.style=="function"?c.style((0,tt.default)({ownerState:n},r,n)):c.style))}),l}return o}function vf(e={}){const{themeId:t,defaultTheme:n=mf,rootShouldForwardProp:r=en,slotShouldForwardProp:o=en}=e,a=s=>(0,lf.default)((0,tt.default)({},s,{theme:tn((0,tt.default)({},s,{defaultTheme:n,themeId:t}))}));return a.__mui_systemSx=!0,(s,l={})=>{(0,Is.internal_processStyles)(s,m=>m.filter(I=>!(I!=null&&I.__mui_systemSx)));const{name:c,slot:d,skipVariantsResolver:f,skipSx:h,overridesResolver:b=bf(Ns(d))}=l,x=(0,uo.default)(l,df),y=f!==void 0?f:d&&d!=="Root"&&d!=="root"||!1,v=h||!1;let g;process.env.NODE_ENV!=="production"&&c&&(g=`${c}-${Ns(d||"Root")}`);let T=en;d==="Root"||d==="root"?T=r:d?T=o:hf(s)&&(T=void 0);const O=(0,Is.default)(s,(0,tt.default)({shouldForwardProp:T,label:g},x)),S=m=>typeof m=="function"&&m.__emotion_real!==m||(0,nf.isPlainObject)(m)?I=>rn(m,(0,tt.default)({},I,{theme:tn({theme:I.theme,defaultTheme:n,themeId:t})})):m,A=(m,...I)=>{let F=S(m);const Z=I?I.map(S):[];c&&b&&Z.push(ee=>{const ne=tn((0,tt.default)({},ee,{defaultTheme:n,themeId:t}));if(!ne.components||!ne.components[c]||!ne.components[c].styleOverrides)return null;const me=ne.components[c].styleOverrides,fe={};return Object.entries(me).forEach(([oe,be])=>{fe[oe]=rn(be,(0,tt.default)({},ee,{theme:ne}))}),b(ee,fe)}),c&&!y&&Z.push(ee=>{var ne;const me=tn((0,tt.default)({},ee,{defaultTheme:n,themeId:t})),fe=me==null||(ne=me.components)==null||(ne=ne[c])==null?void 0:ne.variants;return rn({variants:fe},(0,tt.default)({},ee,{theme:me}))}),v||Z.push(a);const Te=Z.length-I.length;if(Array.isArray(m)&&Te>0){const ee=new Array(Te).fill("");F=[...m,...ee],F.raw=[...m.raw,...ee]}const ge=O(F,...Z);if(process.env.NODE_ENV!=="production"){let ee;c&&(ee=`${c}${(0,of.default)(d||"")}`),ee===void 0&&(ee=`Styled(${(0,af.default)(s)})`),ge.displayName=ee}return s.muiName&&(ge.muiName=s.muiName),ge};return O.withConfig&&(A.withConfig=O.withConfig),A}}function gf(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const yf=rf({themeId:ks,defaultTheme:$s,rootShouldForwardProp:e=>gf(e)&&e!=="classes"});function xf(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=oo(e,o,n)}),r}function Cf(e){return oo("MuiSvgIcon",e)}xf("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Tf=["children","className","color","component","fontSize","htmlColor","inheritViewBox","titleAccess","viewBox"],_f=e=>{const{color:t,fontSize:n,classes:r}=e,o={root:["root",t!=="inherit"&&`color${xt(t)}`,`fontSize${xt(n)}`]};return Il(o,Cf,r)},Ef=yf("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${xt(n.color)}`],t[`fontSize${xt(n.fontSize)}`]]}})(({theme:e,ownerState:t})=>{var n,r,o,a,s,l,c,d,f,h,b,x,y;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:t.hasSvgAsChild?void 0:"currentColor",flexShrink:0,transition:(n=e.transitions)==null||(r=n.create)==null?void 0:r.call(n,"fill",{duration:(o=e.transitions)==null||(o=o.duration)==null?void 0:o.shorter}),fontSize:{inherit:"inherit",small:((a=e.typography)==null||(s=a.pxToRem)==null?void 0:s.call(a,20))||"1.25rem",medium:((l=e.typography)==null||(c=l.pxToRem)==null?void 0:c.call(l,24))||"1.5rem",large:((d=e.typography)==null||(f=d.pxToRem)==null?void 0:f.call(d,35))||"2.1875rem"}[t.fontSize],color:(h=(b=(e.vars||e).palette)==null||(b=b[t.color])==null?void 0:b.main)!=null?h:{action:(x=(e.vars||e).palette)==null||(x=x.action)==null?void 0:x.active,disabled:(y=(e.vars||e).palette)==null||(y=y.action)==null?void 0:y.disabled,inherit:void 0}[t.color]}}),nn=G.forwardRef(function(t,n){const r=Yd({props:t,name:"MuiSvgIcon"}),{children:o,className:a,color:s="inherit",component:l="svg",fontSize:c="medium",htmlColor:d,inheritViewBox:f=!1,titleAccess:h,viewBox:b="0 0 24 24"}=r,x=Ct(r,Tf),y=G.isValidElement(o)&&o.type==="svg",v=ae({},r,{color:s,component:l,fontSize:c,instanceFontSize:t.fontSize,inheritViewBox:f,viewBox:b,hasSvgAsChild:y}),g={};f||(g.viewBox=b);const T=_f(v);return i.jsxs(Ef,ae({as:l,className:Dl(T.root,a),focusable:"false",color:d,"aria-hidden":h?void 0:!0,role:h?"img":void 0,ref:n},g,x,y&&o.props,{ownerState:v,children:[y?o.props.children:o,h?i.jsx("title",{children:h}):null]}))});process.env.NODE_ENV!=="production"&&(nn.propTypes={children:H.node,classes:H.object,className:H.string,color:H.oneOfType([H.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),H.string]),component:H.elementType,fontSize:H.oneOfType([H.oneOf(["inherit","large","medium","small"]),H.string]),htmlColor:H.string,inheritViewBox:H.bool,shapeRendering:H.string,sx:H.oneOfType([H.arrayOf(H.oneOfType([H.func,H.object,H.bool])),H.func,H.object]),titleAccess:H.string,viewBox:H.string}),nn.muiName="SvgIcon";function wf(e,t){function n(r,o){return i.jsx(nn,ae({"data-testid":`${t}Icon`,ref:o},r,{children:e}))}return process.env.NODE_ENV!=="production"&&(n.displayName=`${t}Icon`),n.muiName=nn.muiName,G.memo(G.forwardRef(n))}function jf(e,t=166){let n;function r(...o){const a=()=>{e.apply(this,o)};clearTimeout(n),n=setTimeout(a,t)}return r.clear=()=>{clearTimeout(n)},r}function Of(e,t){return process.env.NODE_ENV==="production"?()=>null:(n,r,o,a,s)=>{const l=o||"<<anonymous>>",c=s||r;return typeof n[r]<"u"?new Error(`The ${a} \`${c}\` of \`${l}\` is deprecated. ${t}`):null}}function Sf(e,t){var n,r;return G.isValidElement(e)&&t.indexOf((n=e.type.muiName)!=null?n:(r=e.type)==null||(r=r._payload)==null||(r=r.value)==null?void 0:r.muiName)!==-1}function Ls(e){return e&&e.ownerDocument||document}function Rf(e){return Ls(e).defaultView||window}function $f(e,t){if(process.env.NODE_ENV==="production")return()=>null;const n=t?ae({},t.propTypes):null;return o=>(a,s,l,c,d,...f)=>{const h=d||s,b=n==null?void 0:n[h];if(b){const x=b(a,s,l,c,d,...f);if(x)return x}return typeof a[s]<"u"&&!a[o]?new Error(`The prop \`${h}\` of \`${e}\` can only be used together with the \`${o}\` prop.`):null}}function Vs(e,t){typeof e=="function"?e(t):e&&(e.current=t)}const Bs=typeof window<"u"?G.useLayoutEffect:G.useEffect;let qs=0;function kf(e){const[t,n]=G.useState(e),r=e||t;return G.useEffect(()=>{t==null&&(qs+=1,n(`mui-${qs}`))},[t]),r}const zs=G.useId;function Af(e){if(zs!==void 0){const t=zs();return e??t}return kf(e)}function Mf(e,t,n,r,o){if(process.env.NODE_ENV==="production")return null;const a=o||t;return typeof e[t]<"u"?new Error(`The prop \`${a}\` is not supported. Please remove it.`):null}function Pf({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=G.useRef(e!==void 0),[a,s]=G.useState(t),l=o?e:a;if(process.env.NODE_ENV!=="production"){G.useEffect(()=>{o!==(e!==void 0)&&console.error([`MUI: A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
122
122
  `))},[r,n,e]);const{current:d}=G.useRef(t);G.useEffect(()=>{!o&&!Object.is(d,t)&&console.error([`MUI: A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
123
123
  `))},[JSON.stringify(t)])}const c=G.useCallback(d=>{o||s(d)},[]);return[l,c]}function Df(e){const t=G.useRef(e);return Bs(()=>{t.current=e}),G.useRef((...n)=>(0,t.current)(...n)).current}function If(...e){return G.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{Vs(n,t)})},e)}class fo{constructor(){this.currentId=null,this.clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)},this.disposeEffect=()=>this.clear}static create(){return new fo}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}}let on=!0,po=!1;const Ff=new fo,Nf={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function Lf(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&Nf[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Vf(e){e.metaKey||e.altKey||e.ctrlKey||(on=!0)}function ho(){on=!1}function Bf(){this.visibilityState==="hidden"&&po&&(on=!0)}function qf(e){e.addEventListener("keydown",Vf,!0),e.addEventListener("mousedown",ho,!0),e.addEventListener("pointerdown",ho,!0),e.addEventListener("touchstart",ho,!0),e.addEventListener("visibilitychange",Bf,!0)}function zf(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return on||Lf(t)}function Uf(){const e=G.useCallback(o=>{o!=null&&qf(o.ownerDocument)},[]),t=G.useRef(!1);function n(){return t.current?(po=!0,Ff.start(100,()=>{po=!1}),t.current=!1,!0):!1}function r(o){return zf(o)?(t.current=!0,!0):!1}return{isFocusVisibleRef:t,onFocus:r,onBlur:n,ref:e}}const Wf=ut(Object.freeze(Object.defineProperty({__proto__:null,capitalize:xt,createChainedFunction:Pl,createSvgIcon:wf,debounce:jf,deprecatedPropType:Of,isMuiElement:Sf,ownerDocument:Ls,ownerWindow:Rf,requirePropFactory:$f,setRef:Vs,unstable_ClassNameGenerator:{configure:e=>{process.env.NODE_ENV!=="production"&&console.warn(["MUI: `ClassNameGenerator` import from `@mui/material/utils` is outdated and might cause unexpected issues.","","You should use `import { unstable_ClassNameGenerator } from '@mui/material/className'` instead","","The detail of the issue: https://github.com/mui/material-ui/issues/30011#issuecomment-1024993401","","The updated documentation: https://mui.com/guides/classname-generator/"].join(`
124
- `))}},unstable_useEnhancedEffect:Bs,unstable_useId:Af,unsupportedProp:Mf,useControlled:Pf,useEventCallback:Df,useForkRef:If,useIsFocusVisible:Uf},Symbol.toStringTag,{value:"Module"})));var Us;function Se(){return Us||(Us=1,function(e){"use client";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=Wf}($n)),$n}var Yf=ye;Object.defineProperty(Rn,"__esModule",{value:!0});var Ws=Rn.default=void 0,Gf=Yf(Se()),Kf=i;Ws=Rn.default=(0,Gf.default)((0,Kf.jsx)("path",{d:"M15 1H4c-1.1 0-2 .9-2 2v13c0 .55.45 1 1 1s1-.45 1-1V4c0-.55.45-1 1-1h10c.55 0 1-.45 1-1s-.45-1-1-1m.59 4.59 4.83 4.83c.37.37.58.88.58 1.41V21c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h6.17c.53 0 1.04.21 1.42.59M15 12h4.5L14 6.5V11c0 .55.45 1 1 1"}),"FileCopyRounded");var mo={},Jf=ye;Object.defineProperty(mo,"__esModule",{value:!0});var Ys=mo.default=void 0,Xf=Jf(Se()),Hf=i;Ys=mo.default=(0,Xf.default)((0,Hf.jsx)("path",{d:"M6.56 7.98C6.1 7.52 5.31 7.6 5 8.17c-.28.51-.5 1.03-.67 1.58-.19.63.31 1.25.96 1.25h.01c.43 0 .82-.28.94-.7.12-.4.28-.79.48-1.17.22-.37.15-.84-.16-1.15M5.31 13h-.02c-.65 0-1.15.62-.96 1.25.16.54.38 1.07.66 1.58.31.57 1.11.66 1.57.2.3-.31.38-.77.17-1.15-.2-.37-.36-.76-.48-1.16-.12-.44-.51-.72-.94-.72m2.85 6.02c.51.28 1.04.5 1.59.66.62.18 1.24-.32 1.24-.96v-.03c0-.43-.28-.82-.7-.94-.4-.12-.78-.28-1.15-.48-.38-.21-.86-.14-1.16.17l-.03.03c-.45.45-.36 1.24.21 1.55M13 4.07v-.66c0-.89-1.08-1.34-1.71-.71L9.17 4.83c-.4.4-.4 1.04 0 1.43l2.13 2.08c.63.62 1.7.17 1.7-.72V6.09c2.84.48 5 2.94 5 5.91 0 2.73-1.82 5.02-4.32 5.75-.41.12-.68.51-.68.94v.02c0 .65.61 1.14 1.23.96C17.57 18.71 20 15.64 20 12c0-4.08-3.05-7.44-7-7.93"}),"RotateLeftRounded");var bo={},Zf=ye;Object.defineProperty(bo,"__esModule",{value:!0});var Gs=bo.default=void 0,Qf=Zf(Se()),e0=i;Gs=bo.default=(0,Qf.default)((0,e0.jsx)("path",{d:"M17.59 3.59c-.38-.38-.89-.59-1.42-.59H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7.83c0-.53-.21-1.04-.59-1.41zM12 19c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m1-10H7c-1.1 0-2-.9-2-2s.9-2 2-2h6c1.1 0 2 .9 2 2s-.9 2-2 2"}),"SaveRounded");var vo={},t0=ye;Object.defineProperty(vo,"__esModule",{value:!0});var Ks=vo.default=void 0,r0=t0(Se()),n0=i;Ks=vo.default=(0,r0.default)((0,n0.jsx)("path",{d:"M18 2h-7.17c-.53 0-1.04.21-1.42.59L4.59 7.41C4.21 7.79 4 8.3 4 8.83V20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-6.35 14.65-2.79-2.79c-.32-.32-.1-.86.35-.86H11v-2.99c0-.55.44-.99.99-1 .56-.01 1.01.44 1.01 1V13h1.79c.45 0 .67.54.35.85l-2.79 2.79c-.19.2-.51.2-.7.01"}),"SimCardDownloadRounded");const Js=(e,t)=>{if(!e)return null;if(e.uuid===t)return e;const n=e.children||[];for(let r=0;r<n.length;r+=1){const o=n[r],a=Js(o,t);if(a)return a}return null},Gt=(e,t)=>{var a,s,l,c,d;if(!e)return null;if(!t)return e;if(((a=e.attributes)==null?void 0:a.treePath)===t)return((s=e.attributes)==null?void 0:s.tree)||null;let n=null;const r=(l=e.attributes)==null?void 0:l.tree,o=(c=e.children)==null?void 0:c.length;if(r&&(n=Gt((d=e.attributes)==null?void 0:d.tree,t)),o){const{children:f}=e;for(let h=0;h<f.length;h+=1){const b=f[h];if(n!==null)return n;n=Gt(b,t)}}return n},an=(e,t,n)=>{const r=Gt(e,t);return Js(r,n)},o0=(e,t)=>{if(!e)return null;const{attributes:n}=t,r=n.isDecision;return Object.defineProperty(e,"attributes",{value:{...e.attributes,isLeaf:!1}}),r?(Object.defineProperty(e,"children",{value:[{...t,attributes:{...n,isLeaf:!1}}]}),null):(Object.defineProperty(e,"children",{value:[{...t,attributes:{...n,isLeaf:!e.children.length}}]}),null)},a0=({tree:e,path:t,uuid:n,child:r})=>{var c;const{attributes:o,children:a}=r;if(!e)return a.length?{...r}:{...r,attributes:{...o,isLeaf:!0,isRoot:!0}};const s=structuredClone(e),l=an(s,t,n);return o0(l,{...r,...!o.isDecision&&{children:[...((c=an(e,t,n))==null?void 0:c.children)||[]]}}),s},Xs=(e,t,n=null)=>{if(!e)return null;if(e.uuid===t)return n;const r=e.children||[];for(let o=0;o<r.length;o+=1){const a=r[o],s=Xs(a,t,e);if(s!==null)return s}return null},s0=(e,t)=>!e||!t?null:e.attributes.isDecision||t.attributes.isDecision?(Object.defineProperty(e,"children",{value:[...e.children.filter(n=>n.uuid!==t.uuid)]}),Object.defineProperty(e,"attributes",{value:{...e.attributes,isLeaf:!e.children.length}}),null):(Object.defineProperty(e,"children",{value:[...e.children.filter(n=>n.uuid!==t.uuid),...t.children]}),Object.defineProperty(e,"attributes",{value:{...e.attributes,isLeaf:!t.children.length}}),null),i0=(e,t,n)=>{const r=Gt(e,t);return Xs(r,n)},l0=({tree:e,path:t,uuid:n})=>{const r=structuredClone(e),o=an(r,t,n),a=i0(r,t,n);return s0(a,o),r},c0=(e,t)=>{if(!e)return null;const n=t.attributes.isDecision,r=e.attributes.isDecision,o=e.attributes.depth===0,a={value:t.uuid},s=r||n,l=s?{value:[...t.children]}:{value:[...e.children]},c=s?{value:{...t.attributes,...o&&{isRoot:!0},isLeaf:!t.children.length||!n}}:{value:{...t.attributes,...o&&{isRoot:!0},isLeaf:!e.children.length}};return Object.defineProperties(e,{attributes:c,children:l,uuid:a}),null},u0=({tree:e,path:t,uuid:n,children:r})=>{const o=structuredClone(e),a=an(o,t,n);return c0(a,r),o},d0=(e,t)=>{if(!e)return[];const n=[],r=o=>{var a,s;if((a=o.attributes)!=null&&a.name&&n.push((s=o==null?void 0:o.attributes)==null?void 0:s.name),(o==null?void 0:o.uuid)!==t&&o.children.length){const{children:l}=o;for(let c=0;c<l.length;c+=1)r(l[c])}};return r(e),[...new Set(n)]},lt={appendTreeCard:"appendTreeCard",deleteTreeCard:"deleteTreeCard",replaceTreeCard:"replaceTreeCard",resetTree:"resetTree",setTree:"setTree"},f0=(e,t,n)=>({children:n,path:e,type:lt.appendTreeCard,uuid:t}),p0=(e,t,n)=>({children:n,path:e,type:lt.replaceTreeCard,uuid:t}),h0=(e,t)=>({path:e,type:lt.deleteTreeCard,uuid:t}),Hs=()=>({type:lt.resetTree}),go=e=>({tree:e,type:lt.setTree}),m0=(e,t)=>{switch(t.type){case lt.appendTreeCard:{const{uuid:n,path:r,children:o}=t;return a0({child:o,path:r,tree:e,uuid:n})}case lt.deleteTreeCard:{const{path:n,uuid:r}=t;return l0({path:n,tree:e,uuid:r})}case lt.replaceTreeCard:{const{uuid:n,path:r,children:o}=t;return u0({children:o,path:r,tree:e,uuid:n})}case lt.resetTree:return null;case lt.setTree:return t.tree;default:throw new Error}},yo=()=>{const{dispatchSnackbar:e}=j.useContext(Ho);return{close:()=>e(Zo()),open:(r,o="success")=>e(cl(r,o))}},b0=e=>{const{backendConfig:t}=Me(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return Mt.useMutation(["patchWorkflow"],async o=>{const{data:a}=await Pt.patch(r,o);return a},e)},v0=e=>{const{backendConfig:t}=Me(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return Mt.useMutation(["postWorkflow"],async o=>{const{data:a}=await Pt.post(r,o);return a},e)},g0=()=>{const{t:e}=Ne.useTranslation(["snackMessage"]),{open:t}=yo(),{setCurrentTree:n,currentTree:r,tree:o,dispatchTree:a}=Me(),[s,l]=j.useState(!1),{version:c}=Me(),{mutate:d}=v0({onError:()=>{t(e("error.saveTree",{ns:"snackMessage"}),"error")},onSuccess:O=>{t(e("success.saveTree",{ns:"snackMessage"})),n(S=>({...S,id:O.workflow_id}))}}),{mutate:f}=b0({onError:()=>{t(e("error.updateTree",{ns:"snackMessage"}),"error")},onSuccess:()=>{t(e("success.updateTree",{ns:"snackMessage"}))}}),h=O=>JSON.stringify(O,null,2),b=O=>`data:text/json;charset=utf-8,${encodeURIComponent(h(O))}`,x=O=>()=>{navigator.clipboard.writeText(h(O)).then(),t(e("success.copyToClipboard",{ns:"snackMessage"}))},y=()=>{l(!1)};return{copyToClipboard:x,formatJSON:h,getDownloadLink:b,handleClose:y,handleOpen:()=>{l(!0)},handleResetTree:()=>{a(Hs()),y()},handleSubmit:()=>{const{name:O,id:S}=r;if(!O){n(A=>({...A,errorName:"Champs Requis"}));return}if(o){if(S){f({id:S,label:O,version:c,workflow:o});return}d({label:O,version:c,workflow:o})}},openModal:s}},y0=({downloadedFileName:e="export",value:t})=>{const{t:n}=Ne.useTranslation(),{getDownloadLink:r,handleSubmit:o,handleClose:a,handleOpen:s,handleResetTree:l,copyToClipboard:c,openModal:d}=g0(),{currentTree:f,backendConfig:h,tree:b}=Me(),{id:x}=f;return i.jsxs(p.Stack,{direction:"row",spacing:1,justifyContent:"center",children:[i.jsx(p.Tooltip,{title:n("resetTree",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.IconButton,{disabled:!b,onClick:s,color:"warning",children:i.jsx(Ys,{})})})}),i.jsx(p.Divider,{orientation:"vertical",flexItem:!0}),i.jsx(p.Tooltip,{title:n("copyToClipboard",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.IconButton,{href:"",download:`${e}.json`,disabled:!t,onClick:c(t),children:i.jsx(Ws,{})})})}),i.jsx(p.Tooltip,{title:n("downloadJSONFile",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.IconButton,{href:r(t),download:`${e}.json`,disabled:!t,children:i.jsx(Ks,{})})})}),i.jsx(p.Tooltip,{title:x?n("update",{ns:"button"}):n("save",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.IconButton,{onClick:o,disabled:!t||!(h!=null&&h.baseUrl),children:i.jsx(Gs,{})})})}),i.jsxs(p.Dialog,{maxWidth:"xs",fullWidth:!0,open:d,onClose:a,children:[i.jsx(p.DialogTitle,{variant:"h3",children:n("resetTree",{ns:"button"})}),i.jsx(p.DialogContent,{children:i.jsx(p.DialogContentText,{children:n("resetTreeContent",{ns:"modal"})})}),i.jsxs(p.DialogActions,{children:[i.jsx(p.Button,{onClick:a,children:n("close",{ns:"button"})}),i.jsx(p.Button,{variant:"contained",color:"warning",onClick:l,children:n("reset",{ns:"button"})})]})]})]})},x0={box:{backgroundColor:he.background,border:`solid 1px ${he.borderBlue}`}},Zs=({children:e,description:t,open:n,onClose:r,title:o})=>i.jsx(p.Dialog,{open:n,onClose:r,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",scroll:"body",maxWidth:"sm",fullWidth:!0,children:i.jsxs(p.Box,{sx:x0.box,p:4,children:[i.jsx("h3",{children:o}),i.jsx("p",{children:t}),e]})});var xo={},C0=ye;Object.defineProperty(xo,"__esModule",{value:!0});var Qs=xo.default=void 0,T0=C0(Se()),_0=i;Qs=xo.default=(0,T0.default)((0,_0.jsx)("path",{d:"M18.3 5.71a.9959.9959 0 0 0-1.41 0L12 10.59 7.11 5.7a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4"}),"CloseRounded");const sn={container:{display:"flex",flexDirection:"column",height:"100%",margin:1},main:{border:`solid 1px ${he.borderBlue}`,height:" 100%",margin:1},toolbar:{backgroundColor:he.background,boxShadow:"none",display:"flex",padding:"0 ! important"},toolbarBox:{backgroundColor:he.tertiary,border:`solid 1px ${he.primary}`,margin:1,paddingX:2,paddingY:1,width:"100%"}},E0=({children:e,appear:t,in:n,onEnter:r,onExited:o,onFocus:a,role:s,tabIndex:l,timeout:c},d)=>i.jsx(p.Slide,{direction:"up",ref:d,appear:t,in:n,onEnter:r,onExited:o,onFocus:a,role:s,tabIndex:l,timeout:c,children:e}),w0=j.forwardRef(E0),j0=({children:e,open:t,onClose:n,title:r})=>i.jsx(p.Dialog,{PaperProps:{sx:{backgroundColor:he.background,backgroundImage:"none"}},open:t,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",fullScreen:!0,TransitionComponent:w0,children:i.jsxs(p.Box,{sx:sn.container,children:[i.jsx(p.AppBar,{position:"sticky",elevation:0,children:i.jsx(p.Toolbar,{sx:sn.toolbar,children:i.jsxs(p.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:sn.toolbarBox,children:[i.jsx(p.Typography,{variant:"h5",children:i.jsx("strong",{children:r})}),i.jsx(p.IconButton,{edge:"end",color:"inherit",onClick:n,"aria-label":"close",children:i.jsx(Qs,{})})]})})}),i.jsx(p.Box,{sx:sn.main,children:e})]})}),O0={box:{border:`solid 1px ${he.borderBlue}`,flexGrow:0}},S0=({children:e})=>i.jsx(p.Box,{p:2,role:"group",sx:O0.box,children:e}),R0={box:{border:`solid 1px ${he.borderBlue}`,flexGrow:0}},$0=({children:e})=>i.jsx(p.Box,{sx:R0.box,padding:2,component:"header",children:e}),k0={box:{border:`solid 1px ${he.borderBlue}`,flexGrow:1}},A0=({children:e})=>i.jsx(p.Box,{sx:k0.box,component:"main",role:"tree",children:e}),ei={stack:{width:"100%"}},M0=({children:e})=>{const t=j.Children.toArray(e);return i.jsxs(p.Grid,{container:!0,padding:1,flexWrap:"nowrap",height:"100%",role:"treegrid",children:[i.jsx(p.Grid,{item:!0,xs:9,padding:1,display:"flex",children:i.jsxs(p.Stack,{sx:ei.stack,spacing:2,children:[t[0],t[1]]})}),i.jsx(p.Grid,{item:!0,xs:3,padding:1,display:"flex",children:i.jsxs(p.Stack,{sx:ei.stack,spacing:2,children:[t[2],t[3]]})})]})},P0={box:{border:`solid 1px ${he.borderBlue}`,flexGrow:1,overflow:"auto"}},D0=({children:e})=>i.jsx(p.Box,{sx:P0.box,component:"aside",children:e}),I0=()=>{const{dispatchTree:e,setModalOpen:t,currentHierarchyPointNode:n,treePath:r}=Me();return{handleSubmit:a=>{var c,d;a.preventDefault();const s=((c=n==null?void 0:n.data)==null?void 0:c.uuid)||"",l=((d=r==null?void 0:r.at(-1))==null?void 0:d.path)||"";e(h0(l,s)),t(null)}}},F0=({onClose:e})=>{const{t}=Ne.useTranslation(),{handleSubmit:n}=I0();return i.jsx("form",{onSubmit:n,children:i.jsxs(p.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:[i.jsx(p.Button,{variant:"text",onClick:e,children:t("cancel")}),i.jsx(p.Button,{variant:"contained",color:"error",type:"submit",children:t("remove")})]})})};var Co={},N0=ye;Object.defineProperty(Co,"__esModule",{value:!0});var To=Co.default=void 0,L0=N0(Se()),V0=i;To=Co.default=(0,L0.default)((0,V0.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 11h-3v3c0 .55-.45 1-1 1s-1-.45-1-1v-3H8c-.55 0-1-.45-1-1s.45-1 1-1h3V8c0-.55.45-1 1-1s1 .45 1 1v3h3c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddCircleRounded");var _o={},B0=ye;Object.defineProperty(_o,"__esModule",{value:!0});var ti=_o.default=void 0,q0=B0(Se()),z0=i;ti=_o.default=(0,q0.default)((0,z0.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward");var Eo={},U0=ye;Object.defineProperty(Eo,"__esModule",{value:!0});var ri=Eo.default=void 0,W0=U0(Se()),Y0=i;ri=Eo.default=(0,W0.default)((0,Y0.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var wo={},G0=ye;Object.defineProperty(wo,"__esModule",{value:!0});var jo=wo.default=void 0,K0=G0(Se()),J0=i;jo=wo.default=(0,K0.default)((0,J0.jsx)("path",{d:"M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5m-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1m2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1"}),"LinkRounded");var Oo={},X0=ye;Object.defineProperty(Oo,"__esModule",{value:!0});var ni=Oo.default=void 0,H0=X0(Se()),Z0=i;ni=Oo.default=(0,H0.default)((0,Z0.jsx)("path",{d:"M7.92 7.54c-.8-.34-1.14-1.33-.66-2.05C8.23 4.05 9.85 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.15.27-.24.49-.3.94-.09.73-.69 1.3-1.43 1.3-.87 0-1.58-.75-1.48-1.62.06-.51.18-1.04.46-1.54.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.17 0-1.93.61-2.4 1.34-.35.57-1.08.75-1.69.5M14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2"}),"QuestionMarkRounded");var So={},Q0=ye;Object.defineProperty(So,"__esModule",{value:!0});var Ro=So.default=void 0,ep=Q0(Se()),tp=i;Ro=So.default=(0,ep.default)((0,tp.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 11H8c-.55 0-1-.45-1-1s.45-1 1-1h8c.55 0 1 .45 1 1s-.45 1-1 1"}),"RemoveCircleRounded");const ln={container:{backgroundColor:"#282c34",borderRadius:.5,color:"#abb2bf",display:"inline-block",lineHeight:1.5,marginBottom:.2,paddingX:.5,paddingY:.2,width:"fit-content"},property:{color:"#56b6c2"},type:{color:"#c678dd"}},rp=({value:e})=>{const{t}=Ne.useTranslation(["translation","form"]);return i.jsx(p.Alert,{severity:"warning",variant:"outlined",children:i.jsxs(p.Typography,{component:"div",variant:"body2",gutterBottom:!0,sx:{lineHeight:2},children:[t("form:warningApiSelect.url")," ",t("form:warningApiSelect.warning")," ",t("form:warningApiSelect.response"),i.jsxs(p.Box,{sx:ln.container,children:["https://api.example.com/","{{",i.jsx(p.Box,{component:"span",sx:ln.type,children:e||"value"}),i.jsx(p.Box,{component:"span",sx:ln.property,children:": string"}),"}}","/endpoint ",i.jsx(p.Box,{component:"span",sx:ln.property})]})]})})},Et={container:{backgroundColor:"#282c34",borderRadius:.5,color:"#abb2bf",display:"inline-block",lineHeight:1.5,marginBottom:.2,paddingX:.5,paddingY:.2,width:"fit-content"},property:{color:"#56b6c2"},type:{color:"#c678dd"}},np=({endPoint:e})=>{const{t}=Ne.useTranslation(["translation","form"]),{url:n,searchKey:r}=e,o=`${n}?${r}`;return i.jsx(p.Alert,{severity:"warning",variant:"outlined",children:i.jsxs(p.Typography,{component:"div",variant:"body2",gutterBottom:!0,sx:{lineHeight:2},children:[t("form:warningApiAutocomplete.url")," ",n&&i.jsxs(i.Fragment,{children:[i.jsx(p.Box,{component:"span",sx:Et.container,children:o})," "]}),t("form:warningApiAutocomplete.response"),i.jsxs(p.Box,{sx:Et.container,children:["{ ",i.jsx(p.Box,{component:"span",sx:Et.property,children:"label"}),":"," ",i.jsx(p.Box,{component:"span",sx:Et.type,children:"string"}),";"," ",i.jsx(p.Box,{component:"span",sx:Et.property,children:"value"}),":"," ",i.jsx(p.Box,{component:"span",sx:Et.type,children:"string"}),";"," ",i.jsx(p.Box,{component:"span",sx:Et.property,children:"img"}),i.jsx(p.Box,{component:"span",className:"semicolon",children:"?"}),":"," ",i.jsx(p.Box,{component:"span",sx:Et.type,children:"string"}),"; }"]})]})})};var $o={},op=ye;Object.defineProperty($o,"__esModule",{value:!0});var oi=$o.default=void 0,ap=op(Se()),sp=i;oi=$o.default=(0,ap.default)((0,sp.jsx)("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddRounded");const ip=e=>{const{backendConfig:t}=Me(),{endpoints:n}=t||{},{workflows:r=""}=n||{};return Mt.useQuery(["workflows"],async({signal:o})=>{const{data:a}=await Pt.get(r,{signal:o});return a},e)},lp=({isControlled:e,fetchWorkflowsOnOpen:t})=>{const{t:n}=Ne.useTranslation("snackMessage"),{open:r}=yo(),{currentTree:o,setCurrentTree:a,dispatchTree:s}=Me(),[l,c]=j.useState(""),d=!!l&&!e&&l!==o.id,{data:f,isError:h}=Rr(l,{enabled:d}),{data:b,isLoading:x,refetch:y}=ip({enabled:!t}),v=j.useCallback(async({target:T})=>{var S;const{value:O}=T;if(O==="add-new-tree"){c(""),a({name:""}),s(Hs());return}c(O),a({id:O,name:(S=b==null?void 0:b.find(A=>A.id===O))==null?void 0:S.label})},[s,a,b]),g=j.useCallback(async()=>{if(t)try{await y(),o.id&&!l&&c(o.id)}catch{r(n("error.fetchTree",{ns:"snackMessage"}),"error")}},[t,y,o.id,l,r,n]);return j.useEffect(()=>{if(f&&l!==o.id){const{id:T,label:O,workflow:S}=f;a({id:T,name:O}),s(go(S))}},[o.id,s,e,a,l,f]),j.useEffect(()=>{h&&r(n("error.fetchTree",{ns:"snackMessage"}),"error")},[h,r,n]),{currentTree:o,fetchWorkflowSuggestions:y,handleChangeTree:v,handleOnOpen:g,setTreeSelected:c,treeSelected:l,workflowsSuggestions:b,workflowsSuggestionsLoading:x}},ai={formControl:{flex:1},select:{".MuiOutlinedInput-notchedOutline":{border:0,paddingLeft:5},".MuiSelect-select":{opacity:0,width:0},boxShadow:"none"}},si=({arrowOnly:e,required:t,size:n,showBtnAddNewTree:r,onChange:o,value:a,fetchWorkflowsOnOpen:s})=>{const{t:l}=Ne.useTranslation("form"),c=j.useMemo(()=>!!o,[o]),{handleChangeTree:d,handleOnOpen:f,workflowsSuggestions:h,workflowsSuggestionsLoading:b,treeSelected:x}=lp({fetchWorkflowsOnOpen:s,isControlled:c});return i.jsxs(p.FormControl,{size:n,required:t,sx:ai.formControl,children:[!e&&i.jsx(p.InputLabel,{children:l("tree",{ns:"form"})}),i.jsxs(p.Select,{value:c?a:x,id:"tree-select",onChange:y=>c?o==null?void 0:o(y):d(y),sx:e?ai.select:void 0,label:l("tree",{ns:"form"}),onOpen:f,children:[(a&&b||b)&&i.jsx(p.MenuItem,{value:a,children:i.jsx(p.Skeleton,{width:"100%"})}),h==null?void 0:h.map(({label:y,id:v})=>i.jsx(p.MenuItem,{value:v,children:y},v)),r&&i.jsx(p.MenuItem,{disabled:!0,children:i.jsx(p.Box,{sx:{height:1,width:"100%"},children:i.jsx(p.Divider,{})})}),r&&i.jsxs(p.MenuItem,{value:"add-new-tree",children:[i.jsx(p.Typography,{mr:1,children:l("newTree",{ns:"form"})}),i.jsx(oi,{color:"primary"})]})]})]})},cp=({helperText:e,hiddenValue:t,isHiddenField:n,isTreeField:r,treeSelected:o,handleChangeTreeSelect:a,handleChangeHelperText:s,handleChangeHiddenValue:l})=>{const{t:c}=Ne.useTranslation(["translation","form"]);return r?i.jsx(si,{required:!0,value:o,onChange:a}):n?i.jsx(p.TextField,{required:!0,sx:{flex:1},label:c("hiddenValue",{ns:"form"}),onChange:l,value:t}):i.jsx(p.TextField,{sx:{flex:1},label:c("helperText",{ns:"form"}),onChange:s,value:e})},Kt=[{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"text"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"number"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"email"},{isBooleanField:!1,isDecisionField:!1,isMultiple:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"file"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"password"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"tel"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"address"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"url"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"date"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"dateRange"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"time"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"timeRange"},{isBooleanField:!0,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"switch"},{isBooleanField:!0,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"checkbox"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"hidden"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"tree"},{isBooleanField:!1,isDecisionField:!0,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"radio"},{isBooleanField:!1,isDecisionField:!0,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"select"},{initialQueryEnable:!0,isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"autocomplete"},{isBooleanField:!1,isDecisionField:!1,isMultiple:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"dynamicSelect"}],up=()=>{const e=Date.now(),t=performance.now();return`${e}${Math.random().toString(36).substring(2,9)}${t}`},dp=()=>{var gn,yn,u,w,R,V,Q,pe,J,K,Be,Ce,Ee,We,vt,Cr,rt,Ei,wi,ji,Oi,Si,Ri,$i,ki,Ai,Mi,Pi,Di,Ii,Fi,Ni;const e=up(),t=j.useMemo(()=>[{id:"0",label:"",message:"",value:""}],[]),{dispatchTree:n,currentHierarchyPointNode:r,modalOpen:o,treePath:a,setModalOpen:s}=Me(),{open:l}=yo(),{t:c}=Ne.useTranslation(),d=r!=null&&r.data&&((gn=r==null?void 0:r.data)!=null&&gn.attributes)&&"isMultiple"in r.data.attributes?!!r.data.attributes.isMultiple:null,[f,h]=j.useState(t),[b,x]=j.useState(""),[y,v]=j.useState(""),[g,T]=j.useState(""),[O,S]=j.useState(!1),[A,m]=j.useState(!1),[I,F]=j.useState(!1),[Z,Te]=j.useState("text"),[ge,ee]=j.useState(null),[ne,me]=j.useState(null),[fe,oe]=j.useState({url:""}),[be,Pe]=j.useState(""),[Ae,Ue]=j.useState(""),[E,$]=j.useState(""),[N,B]=j.useState({off:"",on:""}),[P,W]=j.useState(!1),[D,L]=j.useState(!1),U=o==="edit",Y=Z==="tree",q=Z==="hidden",ve=Z==="autocomplete",C=Z==="dynamicSelect",_e=Kt.some(_=>_.type===Z&&(_==null?void 0:_.isBooleanField)),k=Kt.some(_=>_.type===Z&&(_==null?void 0:_.isDecisionField)),Ve=Kt.some(_=>_.type===Z&&(_==null?void 0:_.isRequiredDisabled)),Xe=Kt.some(_=>_.type===Z&&(_==null?void 0:_.isRepeatableDisabled)),ft=((u=(yn=r==null?void 0:r.data)==null?void 0:yn.attributes)==null?void 0:u.isLeaf)??!0,ct=Kt.some(_=>_.type===Z&&"isMultiple"in _),{refetch:pt,isInitialLoading:hr}=Rr(be,{enabled:!1}),$t=j.useCallback(_=>!k&&_>0,[k]),He=j.useCallback((_,M)=>{h(z=>z.map(X=>{const{id:we}=X;return _.target.dataset.id===we?{...X,id:we,[M]:_.target.value}:{...X}}))},[]),wt=j.useCallback((_,M)=>{typeof M=="string"?ee(M):M&&M.inputValue?ee(M.inputValue):ee(null)},[]),mr=j.useCallback((_,M)=>{oe(z=>({...z,url:z.url?z.url.replace(/{{[^{}]+}}/,`{{${M||""}}}`):`https://example.com/{{${M||""}}}`})),me(M??null)},[]),ht=j.useCallback(_=>{x(_.target.value)},[]),Jt=j.useCallback(_=>{v(_.target.value)},[]),mt=j.useCallback(_=>{T(_.target.value)},[]),br=j.useCallback(_=>{He(_,"label")},[He]),Xt=j.useCallback(_=>{He(_,"value")},[He]),De=j.useCallback(_=>{He(_,"message")},[He]),bt=j.useCallback(_=>{oe(M=>({...M,url:_.target.value}))},[]),ot=j.useCallback(_=>{const M=_.target.value;if(M.includes("{{}}")){const z=M.replace("{{}}",`{{${ne||""}}}`);oe(X=>({...X,url:z}))}else if(M.includes("{{")){const z=M.replace(/{{[^{}]+}}/,`{{${ne||""}}}`);oe(X=>({...X,url:z}))}else oe(z=>({...z,url:M}))},[ne]),jt=j.useCallback(_=>{oe(M=>({...M,searchKey:_.target.value}))},[]),kt=j.useCallback((_,M)=>{oe(z=>{const X={...z.pathKey,[_]:M.target.value};if(M.target.value===""&&_ in X){const{pathKey:we,...Ie}=z;return{...Ie}}return{...z,pathKey:X}})},[oe]),Bo=j.useCallback((_,M,z)=>{oe(X=>{const we=[...X.params??[]];return we[_]={...we[_],[M]:z.target.value},{...X,params:we}})},[oe]),qo=j.useCallback(_=>{$(_.target.value)},[]),zo=j.useCallback(_=>{F(_.target.checked)},[]),Uo=j.useCallback(_=>{S(_.target.checked)},[]),vr=j.useCallback(_=>{L(_.target.checked)},[]),un=j.useCallback(_=>{m(_.target.checked)},[]),Ot=j.useCallback(_=>{W(_.target.checked)},[]),gr=j.useCallback(_=>{Te(_.target.value),m(!1),S(!1),W(!1)},[]),yr=j.useCallback(_=>{Pe(_.target.value)},[]),dn=j.useCallback(_=>M=>{B(z=>({...z,[_]:M.target.value}))},[]),Wo=j.useCallback(_=>{Ue(_.target.value)},[]),fn=j.useCallback(()=>{h(_=>{const M=Number(_[_.length-1].id),z=String(M+1);return[..._,{...t[0],id:z}]})},[t]),Yo=j.useCallback(()=>{oe(_=>{var we,Ie;const M=Number(((Ie=(we=_.params)==null?void 0:we[_.params.length-1])==null?void 0:Ie.id)||0),z=String(M+1),X=[..._.params||[],{id:z,key:"",value:""}];return{..._,params:X}})},[]),pn=j.useCallback(_=>{h(M=>M.filter(({id:z})=>_.currentTarget.value!==z))},[]),hn=j.useCallback(_=>{const M=_.currentTarget.value;oe(z=>{const X=(z.params??[]).filter(({id:Ie})=>Ie!==M),we=X.length>0?X:void 0;return{...z,params:we}})},[]),mn=j.useCallback((_,M)=>{var X,we,Ie;const z=(Ie=(we=(X=_==null?void 0:_.children)==null?void 0:X[M])==null?void 0:we.data)==null?void 0:Ie.children;return z?z.map(({uuid:gt,attributes:yt,children:St})=>({attributes:yt,children:St,uuid:gt})):[]},[]),bn=j.useCallback(_=>{var M;return A?(M=f==null?void 0:f.filter((z,X)=>!$t(X)))==null?void 0:M.map(({message:z,value:X,label:we},Ie)=>{const gt=`${e}:${X}`,yt=mn(r,Ie);return{attributes:{depth:_+1,label:we,name:`${g}:${X}`,value:X,...z&&{message:z},...yt.length===0&&{isLeaf:!0}},children:yt,uuid:gt}}):[]},[r,$t,mn,A,g,e,f]),xr=j.useCallback(_=>_.map(({message:M,...z})=>({...z,...M&&{message:M}})),[]),vn=j.useCallback((_,M,z)=>{var X;if(_&&(!M||z))try{return pt()}catch{l(c("error.fetchTree",{ns:"snackMessage"}),"error")}return _&&M&&!z?{data:{workflow:(X=r==null?void 0:r.data.attributes)==null?void 0:X.tree},isError:null}:{data:null,isError:null}},[(w=r==null?void 0:r.data.attributes)==null?void 0:w.tree,pt,l,c]),Go=j.useCallback(async _=>{var _r,Er,wr,jr;_.preventDefault();const{on:M,off:z}=N,X=((_r=r==null?void 0:r.data)==null?void 0:_r.uuid)||"",we=(r==null?void 0:r.depth)||0,Ie=o==="edit",gt=we+(Ie||r===null?0:1),yt=bn(gt),St=(Er=a==null?void 0:a.at(-1))==null?void 0:Er.path,xn=a.length?`${St}/${e}`:`/${e}`,Cn=((jr=(wr=r==null?void 0:r.data.attributes)==null?void 0:wr.tree)==null?void 0:jr.treeId)!==be,{data:Ht,isError:Tn}=await vn(Y,Ie,Cn);if(Tn)return;const Tr={attributes:{depth:gt,name:g,type:Z,...y&&{label:y},...ve&&{route:fe},...C&&{route:fe},...Ae&&{helperText:Ae},...A&&{isDecision:A},...O&&{required:O},...E&&{step:E},...P&&{repeatable:P},...q&&{hiddenValue:b},...ge&&{tag:ge},...ne&&{parentRef:ne},...I&&ct&&{isMultiple:I},...D&&{initialQuery:D},...k&&!A&&{values:xr(f)},...(z||M)&&{messages:{...z&&{off:z},...M&&{on:M}}},...Y&&{tree:{...Ht==null?void 0:Ht.workflow,treeId:be},treePath:xn}},children:yt,uuid:Ie?X:e};n(Ie?p0(St||"",X,Tr):f0(St||null,X,Tr)),s(null)},[N,r,o,bn,a,e,be,vn,Y,y,g,Z,ve,fe,C,Ae,A,k,xr,f,O,E,P,q,b,ge,ne,I,ct,D,s,n]);return j.useEffect(()=>{var _,M,z,X,we,Ie,gt,yt,St,xn,Cn,Ht,Tn,Tr,_r,Er,wr,jr,Li,Vi,Bi,qi,zi;if(o==="edit"){const _n=((M=(_=r==null?void 0:r.data)==null?void 0:_.attributes)==null?void 0:M.values)||((we=(X=(z=r==null?void 0:r.data)==null?void 0:z.children)==null?void 0:X.filter(({attributes:At})=>!(At!=null&&At.type)))==null?void 0:we.map(({attributes:At},En)=>{const{label:wn,value:jn,message:Or}=At||{};return{id:String(En),label:String(wn),value:String(jn),...Or&&{message:String(Or)}}}));ee(((Ie=r==null?void 0:r.data.attributes)==null?void 0:Ie.tag)||null),Te(((gt=r==null?void 0:r.data.attributes)==null?void 0:gt.type)||"text"),Ue(((yt=r==null?void 0:r.data.attributes)==null?void 0:yt.helperText)||""),S(((St=r==null?void 0:r.data.attributes)==null?void 0:St.required)||!1),$(((xn=r==null?void 0:r.data.attributes)==null?void 0:xn.step)||""),v(((Cn=r==null?void 0:r.data.attributes)==null?void 0:Cn.label)||""),T(((Ht=r==null?void 0:r.data.attributes)==null?void 0:Ht.name)||""),m(((Tn=r==null?void 0:r.data.attributes)==null?void 0:Tn.isDecision)||!1),h(_n!=null&&_n.length?_n:t),Pe(((_r=(Tr=r==null?void 0:r.data.attributes)==null?void 0:Tr.tree)==null?void 0:_r.treeId)||""),W(((Er=r==null?void 0:r.data.attributes)==null?void 0:Er.repeatable)||!1),x(((wr=r==null?void 0:r.data.attributes)==null?void 0:wr.hiddenValue)||""),me(((jr=r==null?void 0:r.data.attributes)==null?void 0:jr.parentRef)||null),B({off:((Vi=(Li=r==null?void 0:r.data.attributes)==null?void 0:Li.messages)==null?void 0:Vi.off)||"",on:((qi=(Bi=r==null?void 0:r.data.attributes)==null?void 0:Bi.messages)==null?void 0:qi.on)||""}),oe(At=>{var En,wn,jn,Or,Ui,Wi,Yi,Gi;return{...At,params:(wn=(En=r==null?void 0:r.data.attributes)==null?void 0:En.route)==null?void 0:wn.params,pathKey:(Or=(jn=r==null?void 0:r.data.attributes)==null?void 0:jn.route)==null?void 0:Or.pathKey,searchKey:(Wi=(Ui=r==null?void 0:r.data.attributes)==null?void 0:Ui.route)==null?void 0:Wi.searchKey,url:((Gi=(Yi=r==null?void 0:r.data.attributes)==null?void 0:Yi.route)==null?void 0:Gi.url)||""}}),F(d||!1),L(((zi=r==null?void 0:r.data.attributes)==null?void 0:zi.initialQuery)||!1)}},[(R=r==null?void 0:r.data.attributes)==null?void 0:R.helperText,(V=r==null?void 0:r.data.attributes)==null?void 0:V.hiddenValue,(Q=r==null?void 0:r.data.attributes)==null?void 0:Q.initialQuery,(pe=r==null?void 0:r.data.attributes)==null?void 0:pe.isDecision,(J=r==null?void 0:r.data.attributes)==null?void 0:J.label,(Be=(K=r==null?void 0:r.data.attributes)==null?void 0:K.messages)==null?void 0:Be.off,(Ee=(Ce=r==null?void 0:r.data.attributes)==null?void 0:Ce.messages)==null?void 0:Ee.on,(We=r==null?void 0:r.data.attributes)==null?void 0:We.name,(vt=r==null?void 0:r.data.attributes)==null?void 0:vt.parentRef,(Cr=r==null?void 0:r.data.attributes)==null?void 0:Cr.repeatable,(rt=r==null?void 0:r.data.attributes)==null?void 0:rt.required,(wi=(Ei=r==null?void 0:r.data.attributes)==null?void 0:Ei.route)==null?void 0:wi.params,(Oi=(ji=r==null?void 0:r.data.attributes)==null?void 0:ji.route)==null?void 0:Oi.pathKey,(Ri=(Si=r==null?void 0:r.data.attributes)==null?void 0:Si.route)==null?void 0:Ri.searchKey,(ki=($i=r==null?void 0:r.data.attributes)==null?void 0:$i.route)==null?void 0:ki.url,(Ai=r==null?void 0:r.data.attributes)==null?void 0:Ai.step,(Mi=r==null?void 0:r.data.attributes)==null?void 0:Mi.tag,(Di=(Pi=r==null?void 0:r.data.attributes)==null?void 0:Pi.tree)==null?void 0:Di.treeId,(Ii=r==null?void 0:r.data.attributes)==null?void 0:Ii.type,(Fi=r==null?void 0:r.data.attributes)==null?void 0:Fi.values,(Ni=r==null?void 0:r.data)==null?void 0:Ni.children,r==null?void 0:r.data.uuid,t,d,o]),{getDisabledValueField:$t,handleAddParams:Yo,handleAddValue:fn,handleChangeHelperText:Wo,handleChangeHiddenValue:ht,handleChangeInitialQuery:vr,handleChangeIsDecisionField:un,handleChangeLabel:Jt,handleChangeMessage:dn,handleChangeMultiple:zo,handleChangeName:mt,handleChangeOptionLabel:br,handleChangeOptionMessage:De,handleChangeOptionValue:Xt,handleChangeParam:Bo,handleChangeParentRef:mr,handleChangePath:kt,handleChangeRepeatable:Ot,handleChangeRequired:Uo,handleChangeSearchKey:jt,handleChangeStep:qo,handleChangeTag:wt,handleChangeTreeSelect:yr,handleChangeType:gr,handleChangeUrl:bt,handleChangeUrlSelect:ot,handleDeleteParam:hn,handleDeleteValue:pn,handleSubmit:Go,helperText:Ae,hiddenValue:b,initialQuery:D,isAutocomplete:ve,isBooleanField:_e,isDecision:A,isDecisionField:k,isDynamicSelect:C,isEditModal:U,isHiddenField:q,isLeaf:ft,isMultiple:I,isMultiplePossible:ct,isRepeatableDisabled:Xe,isRequiredDisabled:Ve,isTreeField:Y,isWorkflowLoading:hr,label:y,messages:N,name:g,parentRef:ne,repeatable:P,required:O,route:fe,step:E,tag:ge,treeSelected:be,type:Z,uuid:e,values:f}},fp=({value:e,onChange:t})=>{var b;const[n,r]=j.useState(e||""),{t:o}=Ne.useTranslation(["form"]),{tree:a,treePath:s,currentHierarchyPointNode:l}=Me(),{uuid:c}=(l==null?void 0:l.data)||{},d=Gt(a,(b=s==null?void 0:s.at(-1))==null?void 0:b.path),f=d0(d,c),h=x=>{const y=x.target.value;r(y),t==null||t(x,y)};return i.jsxs(p.FormControl,{sx:{flex:1.5},required:!0,children:[i.jsx(p.InputLabel,{children:o("form:ancestor")}),i.jsx(p.Select,{sx:{flex:2},value:n,label:o("form:ancestor"),onChange:h,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:f.length?f.map((x,y)=>{const v=`${x}-${y}`;return i.jsx(p.MenuItem,{value:x,children:x},v)}):i.jsx(p.MenuItem,{disabled:!0,value:"",children:o("form:noAncestorFound")})})]})},pp=()=>{const{backendConfig:e}=Me();return{fields:j.useCallback(()=>Kt.filter(n=>!(n.type==="tree"&&!(e!=null&&e.baseUrl))),[e==null?void 0:e.baseUrl])()}},hp=({onChange:e,value:t})=>{const{t:n}=Ne.useTranslation(["translation","form"]),{fields:r}=pp();return i.jsxs(p.FormControl,{sx:{flex:1},required:!0,fullWidth:!0,children:[i.jsx(p.InputLabel,{children:n("type")}),i.jsx(p.Select,{value:t,label:n("type"),onChange:e,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:r.map(({type:o,isDecisionField:a})=>i.jsxs(p.MenuItem,{value:o,children:[n(`type.${o}`,{ns:"form"}),a&&i.jsx(p.Chip,{label:n("decisionField",{ns:"form"}),size:"small",color:"info",sx:{marginLeft:1}})]},o))})]})},mp=e=>{if(!e)return[];const t=new Set,n=r=>{var o,a;if((o=r==null?void 0:r.attributes)!=null&&o.tag&&t.add(r.attributes.tag),(a=r==null?void 0:r.children)!=null&&a.length){const{children:s}=r;for(let l=0;l<s.length;l+=1)n(s[l])}};return n(e),[...t]},bp=p.createFilterOptions(),vp=({value:e,onChange:t})=>{const{t:n}=Ne.useTranslation(["translation","form"]),{tree:r}=Me(),o=mp(r).reduce((a,s)=>[...a,{inputValue:s,label:s}],[]);return i.jsx(p.Autocomplete,{sx:{flex:1},freeSolo:!0,fullWidth:!0,value:e,onChange:t,filterOptions:(a,s)=>{const l=bp(a,s),{inputValue:c}=s,d=a.some(f=>typeof f!="string"&&c===f.label);return c!==""&&!d&&l.push({inputValue:c,label:`${n("add")} "${c}"`}),l},getOptionLabel:a=>typeof a=="string"?a:a.inputValue?a.inputValue:a.label,renderOption:(a,s)=>i.jsx("li",{...a,children:typeof s!="string"&&s.label}),renderInput:a=>i.jsx(p.TextField,{...a,label:n("tag")}),options:o})},ii={marginRight:"-20px !important",minWidth:"auto !important"},cn={iconButton:ii,iconButtonDelete:{...ii,"&:before":{borderRadius:"50%",content:'""',height:20,position:"absolute",width:20,zIndex:-1},backgroundColor:he.background,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)"}},gp=({onClose:e})=>{const{t}=Ne.useTranslation(["translation","form"]),{values:n,required:r,tag:o,type:a,helperText:s,label:l,name:c,hiddenValue:d,isBooleanField:f,isDecision:h,isEditModal:b,isDecisionField:x,isHiddenField:y,isRequiredDisabled:v,isRepeatableDisabled:g,isAutocomplete:T,isDynamicSelect:O,isTreeField:S,treeSelected:A,isWorkflowLoading:m,repeatable:I,isLeaf:F,isMultiplePossible:Z,isMultiple:Te,initialQuery:ge,handleChangeTreeSelect:ee,handleChangeHelperText:ne,handleChangeOptionMessage:me,handleChangeRequired:fe,handleChangeName:oe,handleChangeType:be,handleChangeIsDecisionField:Pe,handleChangeOptionLabel:Ae,handleDeleteValue:Ue,handleDeleteParam:E,handleChangeOptionValue:$,handleChangeMessage:N,handleSubmit:B,handleAddValue:P,handleAddParams:W,handleChangeLabel:D,handleChangeRepeatable:L,handleChangeHiddenValue:U,handleChangeTag:Y,handleChangeSearchKey:q,handleChangeUrl:ve,handleChangeUrlSelect:C,handleChangeParam:_e,handleChangePath:k,handleChangeMultiple:Ve,handleChangeParentRef:Xe,handleChangeInitialQuery:ft,parentRef:ct,route:pt,messages:{on:hr,off:$t}}=dp(),{searchKey:He,url:wt,pathKey:mr,params:ht}=pt||{},{object:Jt="",label:mt="",value:br="",image:Xt=""}=mr||{};return i.jsxs("form",{onSubmit:B,children:[i.jsx(p.Box,{marginBottom:1,children:i.jsx(hp,{value:a,onChange:be})}),i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(p.TextField,{label:t("name"),sx:{flex:1},onChange:oe,value:c,required:!0}),i.jsx(p.TextField,{sx:{flex:1},label:t("label",{ns:"form"}),onChange:D,value:l})]}),i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(vp,{value:o,onChange:Y}),i.jsx(cp,{helperText:s,hiddenValue:d,isHiddenField:y,isTreeField:S,treeSelected:A,handleChangeTreeSelect:ee,handleChangeHelperText:ne,handleChangeHiddenValue:U})]}),T&&i.jsx(p.Stack,{spacing:1,paddingY:1,children:i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:4},InputProps:{startAdornment:i.jsx(p.InputAdornment,{position:"start",children:i.jsx(jo,{})})},placeholder:"https://api.fr/enpoint",type:"url",label:t("form:apiRoute"),onChange:ve,value:wt,required:!0}),i.jsx(ni,{}),i.jsx(p.TextField,{sx:{flex:1},placeholder:"q",type:"text",onChange:q,value:He,required:!0})]})}),O&&i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsx("h4",{children:t("form:urlConstruction")}),i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(fp,{value:ct,onChange:Xe}),i.jsx(ti,{}),i.jsx(p.TextField,{sx:{flex:3},InputProps:{startAdornment:i.jsx(p.InputAdornment,{position:"start",children:i.jsx(jo,{})})},placeholder:`https://api.fr/{{${ct||""}}}/enpoint`,type:"url",label:t("form:apiRoute"),onChange:C,value:wt})]}),wt&&i.jsx(rp,{value:ct})]}),(T||O)&&i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsxs(p.Accordion,{elevation:0,square:!0,children:[i.jsx(p.AccordionSummary,{expandIcon:i.jsx(ri,{}),"aria-controls":"panel-content",sx:{"& .MuiAccordionSummary-content":{flexGrow:0},display:"inline-flex",justifyContent:"flex-start",padding:0},children:i.jsx(p.Typography,{sx:{textDecoration:"underline"},children:t("form:dataMapping")})}),i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsxs(p.Stack,{spacing:1,sx:{pb:1},direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Object Array Path",value:Jt,onChange:De=>k("object",De),placeholder:"elements.features[]",type:"text"}),i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Label Path",value:mt,onChange:De=>k("label",De),placeholder:"client.name",type:"text"})]}),i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Value Path",value:br,onChange:De=>k("value",De),placeholder:"client.id",type:"text"}),i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Image Path",value:Xt,onChange:De=>k("image",De),placeholder:"client.src.profile",type:"text"})]}),i.jsx(np,{endPoint:{searchKey:He||"",url:wt}})]})]}),i.jsxs(p.Stack,{children:[i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},position:"relative",alignItems:{sm:"center",xs:"flex-start"},children:[i.jsx("h4",{children:t("form:additionalParams")}),i.jsx(p.Box,{justifyContent:"flex-end",children:i.jsx(p.IconButton,{color:"success",sx:cn.iconButton,onClick:W,children:i.jsx(To,{})})})]}),ht==null?void 0:ht.map(({id:De,key:bt,value:ot},jt)=>i.jsxs(p.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[i.jsx(p.TextField,{label:"Key",sx:{flex:1},onChange:kt=>_e(jt,"key",kt),value:bt,inputProps:{"data-id":De}}),i.jsx(p.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:kt=>_e(jt,"value",kt),value:ot,inputProps:{"data-id":De}}),ht.length>0&&i.jsx(p.IconButton,{color:"warning",sx:cn.iconButtonDelete,value:De,onClick:E,children:i.jsx(Ro,{})})]},De))]})]}),f&&i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(p.TextField,{sx:{flex:1},label:t("onMessage",{ns:"form"}),onChange:N("on"),value:hr}),i.jsx(p.TextField,{sx:{flex:1},label:t("offMessage",{ns:"form"}),onChange:N("off"),value:$t})]}),i.jsx(p.Stack,{paddingY:1,children:i.jsxs(p.FormGroup,{children:[Z&&i.jsx(p.FormControlLabel,{control:i.jsx(p.Checkbox,{checked:Te,onChange:Ve}),label:t("multiple")}),T&&i.jsx(p.FormControlLabel,{control:i.jsx(p.Checkbox,{checked:ge,onChange:ft}),label:t("initialQueryEnable")}),i.jsx(p.FormControlLabel,{disabled:v,control:i.jsx(p.Checkbox,{checked:r,onChange:fe}),label:t("required")}),i.jsx(p.FormControlLabel,{disabled:g,control:i.jsx(p.Checkbox,{checked:I,onChange:L}),label:t("repeatable",{ns:"form"})}),(F||b)&&i.jsx(p.FormControlLabel,{disabled:!x,control:i.jsx(p.Checkbox,{checked:h,onChange:Pe}),label:t("decisionField",{ns:"form"})})]})}),x&&i.jsxs(i.Fragment,{children:[i.jsx("h4",{children:t("values")}),n==null?void 0:n.map(({value:De,label:bt,id:ot,message:jt})=>i.jsxs(p.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[i.jsx(p.TextField,{label:t("label",{ns:"form"}),sx:{flex:1},onChange:Ae,value:bt,inputProps:{"data-id":ot},required:!0}),i.jsx(p.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:$,value:De,inputProps:{"data-id":ot},required:!0}),i.jsx(p.TextField,{label:t("message",{ns:"form"}),sx:{flex:1},onChange:me,value:jt,inputProps:{"data-id":ot}}),n.length>1&&i.jsx(p.IconButton,{color:"warning",sx:cn.iconButtonDelete,value:ot,onClick:Ue,children:i.jsx(Ro,{})})]},ot))]}),x&&i.jsx(p.Box,{justifyContent:"flex-end",display:"flex",children:i.jsx(p.IconButton,{color:"success",sx:cn.iconButton,onClick:P,children:i.jsx(To,{})})}),i.jsxs(p.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",paddingTop:3,children:[i.jsx(p.Button,{variant:"text",onClick:e,children:t("cancel")}),i.jsx(p.Button,{variant:"contained",type:"submit",disabled:m,isLoading:m,loadingIndicator:i.jsx(p.CircularProgress,{size:14}),children:t("validate")})]})]})};var ko={},yp=ye;Object.defineProperty(ko,"__esModule",{value:!0});var li=ko.default=void 0,xp=yp(Se()),Cp=i;li=ko.default=(0,xp.default)((0,Cp.jsx)("path",{d:"M17 11h3c1.11 0 2-.9 2-2V5c0-1.11-.9-2-2-2h-3c-1.11 0-2 .9-2 2v1H9.01V5c0-1.11-.9-2-2-2H4c-1.1 0-2 .9-2 2v4c0 1.11.9 2 2 2h3c1.11 0 2-.9 2-2V8h2v7.01c0 1.65 1.34 2.99 2.99 2.99H15v1c0 1.11.9 2 2 2h3c1.11 0 2-.9 2-2v-4c0-1.11-.9-2-2-2h-3c-1.11 0-2 .9-2 2v1h-1.01c-.54 0-.99-.45-.99-.99V8h2v1c0 1.1.9 2 2 2"}),"AccountTreeRounded");var Ao={},Tp=ye;Object.defineProperty(Ao,"__esModule",{value:!0});var ci=Ao.default=void 0,_p=Tp(Se()),Ep=i;ci=Ao.default=(0,_p.default)((0,Ep.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-3 10h-3v3c0 .55-.45 1-1 1s-1-.45-1-1v-3H8c-.55 0-1-.45-1-1s.45-1 1-1h3V8c0-.55.45-1 1-1s1 .45 1 1v3h3c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddBoxRounded");var Mo={},wp=ye;Object.defineProperty(Mo,"__esModule",{value:!0});var ui=Mo.default=void 0,jp=wp(Se()),Op=i;ui=Mo.default=(0,jp.default)((0,Op.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2zM9 9h6c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-8c0-.55.45-1 1-1m6.5-5-.71-.71c-.18-.18-.44-.29-.7-.29H9.91c-.26 0-.52.11-.7.29L8.5 4H6c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1z"}),"DeleteOutlineRounded");var Po={},Sp=ye;Object.defineProperty(Po,"__esModule",{value:!0});var di=Po.default=void 0,Rp=Sp(Se()),$p=i;di=Po.default=(0,Rp.default)((0,$p.jsx)("path",{d:"M3 17.46v3.04c0 .28.22.5.5.5h3.04c.13 0 .26-.05.35-.15L17.81 9.94l-3.75-3.75L3.15 17.1c-.1.1-.15.22-.15.36M20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"EditRounded");var Do={},kp=ye;Object.defineProperty(Do,"__esModule",{value:!0});var fi=Do.default=void 0,Ap=kp(Se()),Mp=i;fi=Do.default=(0,Ap.default)((0,Mp.jsx)("path",{d:"M12 3c-4.8 0-9 3.86-9 9 0 2.12.74 4.07 1.97 5.61l-1.68 1.68c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l1.68-1.68C7.93 20.26 9.88 21 12 21c2.3 0 4.61-.88 6.36-2.64C20.12 16.61 21 14.3 21 12V5c0-1.1-.9-2-2-2zm3.83 9.26-5.16 4.63c-.16.15-.41.14-.56-.01-.14-.14-.16-.36-.04-.52l2.44-3.33-4.05-.4c-.44-.04-.63-.59-.3-.89l5.16-4.63c.16-.15.41-.14.56.01.14.14.16.36.04.52l-2.44 3.33 4.05.4c.45.04.63.59.3.89"}),"EnergySavingsLeafRounded");var Io={},Pp=ye;Object.defineProperty(Io,"__esModule",{value:!0});var pi=Io.default=void 0,Dp=Pp(Se()),hi=i;pi=Io.default=(0,Dp.default)([(0,hi.jsx)("path",{d:"M14.14 12h-.06c.81 0 1.28-.91.82-1.57L9.82 3.17c-.4-.57-1.24-.57-1.64 0L3.1 10.43c-.46.66.01 1.57.82 1.57h-.06L.99 16.46c-.43.66.05 1.54.84 1.54H7v2c0 1.1.9 2 2 2s2-.9 2-2v-2h5.17c.79 0 1.27-.88.84-1.54z"},"0"),(0,hi.jsx)("path",{d:"M23.01 16.46 20.14 12h-.06c.81 0 1.28-.91.82-1.57l-5.08-7.26c-.4-.57-1.24-.57-1.64 0l-1.57 2.24 3.11 4.44c.43.61.48 1.41.14 2.07-.08.16-.18.3-.3.43l2.29 3.57c.4.62.42 1.4.07 2.04-.01.02-.02.03-.03.04h4.28c.79 0 1.27-.88.84-1.54M13 20c0 1.1.9 2 2 2s2-.9 2-2v-1h-4z"},"1")],"ForestRounded");var Fo={},Ip=ye;Object.defineProperty(Fo,"__esModule",{value:!0});var mi=Fo.default=void 0,Fp=Ip(Se()),Np=i;mi=Fo.default=(0,Fp.default)((0,Np.jsx)("path",{d:"M12 4V2.21c0-.45-.54-.67-.85-.35l-2.8 2.79c-.2.2-.2.51 0 .71l2.79 2.79c.32.31.86.09.86-.36V6c3.31 0 6 2.69 6 6 0 .79-.15 1.56-.44 2.25-.15.36-.04.77.23 1.04.51.51 1.37.33 1.64-.34.37-.91.57-1.91.57-2.95 0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-.79.15-1.56.44-2.25.15-.36.04-.77-.23-1.04-.51-.51-1.37-.33-1.64.34C4.2 9.96 4 10.96 4 12c0 4.42 3.58 8 8 8v1.79c0 .45.54.67.85.35l2.79-2.79c.2-.2.2-.51 0-.71l-2.79-2.79c-.31-.31-.85-.09-.85.36z"}),"LoopRounded");var No={},Lp=ye;Object.defineProperty(No,"__esModule",{value:!0});var bi=No.default=void 0,Vp=Lp(Se()),Bp=i;bi=No.default=(0,Vp.default)((0,Bp.jsx)("path",{d:"M16.96 12h.08c.81 0 1.28-.91.82-1.57l-5.08-7.25c-.4-.57-1.24-.57-1.64 0L6.1 10.43c-.46.66.02 1.57.83 1.57h.04l-2.9 4.46c-.44.66.04 1.54.84 1.54h5.08v2.02c0 1.09.89 1.98 1.98 1.98 1.09 0 1.98-.89 1.98-1.98V18h5.15c.8 0 1.28-.89.83-1.55z"}),"ParkRounded");var Lo={},qp=ye;Object.defineProperty(Lo,"__esModule",{value:!0});var gi=Lo.default=void 0,zp=qp(Se()),Up=i;gi=Lo.default=(0,zp.default)((0,Up.jsx)("path",{d:"M12 6.5c2.76 0 5 2.24 5 5 0 .51-.1 1-.24 1.46l3.06 3.06c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l2.17 2.17c.47-.14.96-.24 1.47-.24M2.71 3.16c-.39.39-.39 1.02 0 1.41l1.97 1.97C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.97-.3 4.31-.82l2.72 2.72c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L4.13 3.16c-.39-.39-1.03-.39-1.42 0M12 16.5c-2.76 0-5-2.24-5-5 0-.77.18-1.5.49-2.14l1.57 1.57c-.03.18-.06.37-.06.57 0 1.66 1.34 3 3 3 .2 0 .38-.03.57-.07L14.14 16c-.65.32-1.37.5-2.14.5m2.97-5.33c-.15-1.4-1.25-2.49-2.64-2.64z"}),"VisibilityOffRounded");var Vo={},Wp=ye;Object.defineProperty(Vo,"__esModule",{value:!0});var yi=Vo.default=void 0,Yp=Wp(Se()),Gp=i;yi=Vo.default=(0,Yp.default)((0,Gp.jsx)("path",{d:"M12 4C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4m0 12.5c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"VisibilityRounded");const Le={actionButton:{minWidth:"auto !important"},container:{background:he.background,borderRadius:"1rem"},containerField:{background:he.background,border:`solid 1px ${he.primary}`,borderRadius:"1rem"},containerHidden:{background:he.background,border:`solid 1px ${he.borderGrey}`,borderRadius:"1rem"},containerTree:{background:he.tertiary,border:`solid 1px ${he.primary}`,borderRadius:"1rem"},containerValue:{background:he.background,border:`solid 1px ${he.secondary}`,borderRadius:"1rem"},icon:{color:he.grey500},nodeSvg:{stroke:"transparent !important"},stepChip:{fontSize:".7rem !important",fontWeight:"bold",height:"20px !important"},title:{display:"-webkit-box",margin:0,overflow:"hidden",textAlign:"right",textOverflow:"ellipsis",webkitBoxOrient:"vertical",webkitLineClamp:2}},Kp=e=>{const t=!!e,n=e==="tree";return e==="hidden"?Le.containerHidden:n?Le.containerTree:t?Le.containerField:Le.containerValue},Jp=({nodeDatum:e,onAddChildren:t,onEditChildren:n,onDeleteChildren:r,onOpenTreeModal:o,hierarchyPointNode:a,size:s=220})=>{var F;const{t:l}=Ne.useTranslation(["translation","form"]),{attributes:c}=e||{},{isRoot:d,isLeaf:f,required:h,isDecision:b,step:x,type:y,label:v,repeatable:g,tag:T}=c||{},O=!!y,S=y==="tree",A=y==="hidden",m=!O,I=!d&&!f;return i.jsxs("g",{children:[i.jsx(p.GlobalStyles,{styles:{".rd3t-node svg":Le.nodeSvg}}),i.jsx(p.Box,{component:"foreignObject",height:s,width:s,x:`-${s/2}`,y:`-${s/2}`,sx:Kp(y),children:i.jsxs(p.Box,{flex:1,display:"flex",p:2,height:"100%",flexDirection:"column",justifyContent:"space-between",children:[i.jsxs(p.Stack,{alignItems:"flex-end",spacing:.5,children:[O&&i.jsxs(p.Stack,{direction:"row",spacing:1,alignItems:"center",children:[x&&i.jsx(p.Tooltip,{title:`${l("step",{ns:"form"})} ${(F=e==null?void 0:e.attributes)==null?void 0:F.step}`,placement:"left",arrow:!0,children:i.jsx(p.Chip,{color:"primary",size:"small",label:x,sx:Le.stepChip})}),i.jsx(p.Typography,{variant:"subtitle2",sx:Le.title,children:i.jsx("strong",{children:v})})]}),O&&i.jsx(p.Chip,{color:"info",size:"small",label:l(`type.${y}`,{ns:"form"})}),T&&i.jsx(p.Chip,{variant:"outlined",color:"warning",size:"small",label:T}),h&&i.jsx(p.Stack,{direction:"row",spacing:.5,children:h&&i.jsx(p.Typography,{variant:"body2",sx:{color:({palette:Z})=>Z.error.main},children:l("required")})}),i.jsx(p.Stack,{spacing:.5,alignItems:"flex-end",children:m&&i.jsx(p.Typography,{variant:"subtitle2",sx:Le.title,children:i.jsx("strong",{children:v})})}),i.jsxs(p.Stack,{paddingTop:.5,spacing:.5,direction:"row",children:[g&&i.jsx(p.Tooltip,{title:l("isARepeatable"),placement:"bottom",arrow:!0,children:i.jsx(mi,{style:Le.icon})}),f&&i.jsx(p.Tooltip,{title:l("isALeaf"),placement:"bottom",arrow:!0,children:i.jsx(fi,{style:Le.icon})}),A&&i.jsx(p.Tooltip,{title:l("isAHidden"),placement:"bottom",arrow:!0,children:i.jsx(gi,{style:Le.icon})}),d&&i.jsx(p.Tooltip,{title:l("isTheRoot"),placement:"bottom",arrow:!0,children:i.jsx(bi,{style:Le.icon})}),I&&i.jsx(p.Tooltip,{title:l("isABranch"),placement:"bottom",arrow:!0,children:i.jsx(li,{style:Le.icon})}),S&&i.jsx(p.Tooltip,{title:l("isATree"),placement:"bottom",arrow:!0,children:i.jsx(pi,{style:Le.icon})})]})]}),i.jsxs(p.Stack,{direction:"row",justifyContent:"flex-end",spacing:0,alignSelf:"flex-end",children:[!d&&i.jsx(p.Tooltip,{title:l("remove"),arrow:!0,children:i.jsx(p.Button,{variant:"text",sx:Le.actionButton,size:"small",color:"error",onClick:()=>r==null?void 0:r(a),children:i.jsx(ui,{})})}),!m&&i.jsx(p.Tooltip,{title:l("edit"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"secondary",sx:Le.actionButton,size:"small",onClick:()=>n==null?void 0:n(a),children:i.jsx(di,{})})}),!b&&i.jsx(p.Tooltip,{title:l("add"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"success",sx:Le.actionButton,size:"small",onClick:()=>t==null?void 0:t(a),children:i.jsx(ci,{})})}),S&&i.jsx(p.Tooltip,{title:l("show"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"info",sx:Le.actionButton,size:"small",onClick:()=>o==null?void 0:o(a),children:i.jsx(yi,{})})})]})]})})]})},Xp=j.memo(Jp),xi=()=>{const{setModalOpen:e,setCurrentHierarchyPointNode:t,setTreeModalOpen:n,setTreePath:r}=Me();return{handleAddChildren:d=>{t(d),e("add")},handleCloseTreeModal:()=>{r([]),n(!1)},handleDeleteChildren:d=>{t(d),e("delete")},handleEditChildren:d=>{t(d),e("edit")},handleOpenTreeModal:d=>{var h,b,x;const f={label:((h=d==null?void 0:d.data.attributes)==null?void 0:h.label)||"",path:((x=(b=d==null?void 0:d.data)==null?void 0:b.attributes)==null?void 0:x.treePath)||""};r(y=>[...y,f]),n(!0)}}},Hp=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,addChildren:s})=>{const{handleDeleteChildren:l,handleEditChildren:c,handleAddChildren:d,handleOpenTreeModal:f}=xi();return i.jsx(Xp,{addChildren:s,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,onAddChildren:d,onOpenTreeModal:f,onDeleteChildren:l,onEditChildren:c})},Ci=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,addChildren:s})=>i.jsx(Hp,{addChildren:s,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a}),Zp=()=>{const{t:e}=Ne.useTranslation(["modal","snackMessage"]),{currentHierarchyPointNode:t,modalOpen:n,setModalOpen:r,dispatchTree:o}=Me(),a=n==="edit";return{closeModal:()=>{r(null)},getTitleModalDelete:()=>{var v;const{label:x,name:y}=((v=t==null?void 0:t.data)==null?void 0:v.attributes)||{};return e("deleteTitle",{name:x||y,ns:"modal"})},getTitleModalMutation:()=>{var g;const{label:x,name:y}=((g=t==null?void 0:t.data)==null?void 0:g.attributes)||{};return a?e(a?"editTitle":"addTitle",{name:x||y,ns:"modal"}):e("addFirstTitle",{ns:"modal"})},handleChangeTree:x=>{try{o(go(JSON.parse(x)))}catch{return!1}},isDeleteModal:n==="delete",isModalMutationOpen:a||n==="add"}},Qp=()=>{const{currentTree:e,setCurrentTree:t,tree:n}=Me(),{name:r,errorName:o,id:a}=e;return{disabled:!!e.id&&!n,errorName:o,handleChangeName:c=>{const{value:d}=c.target;if(!d){t(f=>({...f,errorName:"Champs requis",name:c.target.value}));return}t(f=>({...f,errorName:"",name:c.target.value}))},id:a,name:r}},e1=()=>{const{t:e}=Ne.useTranslation("form"),{name:t,handleChangeName:n,errorName:r,disabled:o}=Qp();return i.jsx(p.TextField,{required:!0,label:e("treeName",{ns:"form"}),size:"small",onChange:n,value:t,error:!!r,disabled:o})},t1=()=>{const{tree:e,treeModalOpen:t,treePath:n,backendConfig:r}=Me(),{handleCloseTreeModal:o}=xi(),{getTitleModalMutation:a,closeModal:s,getTitleModalDelete:l,isModalMutationOpen:c,isDeleteModal:d,handleChangeTree:f}=Zp(),h=n==null?void 0:n.at(-1),b=h==null?void 0:h.path,x=h==null?void 0:h.label,y=Gt(e,b);return i.jsxs(i.Fragment,{children:[i.jsxs(M0,{children:[i.jsx($0,{children:i.jsxs(p.Stack,{justifyContent:"space-between",direction:"row",alignItems:"center",children:[i.jsx(hl,{}),!!(r!=null&&r.baseUrl)&&i.jsxs(p.Stack,{direction:"row",alignItems:"center",spacing:2,children:[i.jsx(e1,{}),i.jsx(si,{size:"small",arrowOnly:!0,showBtnAddNewTree:!0,fetchWorkflowsOnOpen:!0})]})]})}),i.jsx(A0,{children:i.jsx(ra,{data:e,renderCustomNodeElement:Ci})}),i.jsx(D0,{children:i.jsx(xl,{value:e,onChange:f})}),i.jsx(S0,{children:i.jsx(y0,{value:e})})]}),i.jsx(Zs,{open:c,onClose:s,title:a(),children:i.jsx(gp,{onClose:s})}),i.jsx(Zs,{open:d,onClose:s,title:l(),children:i.jsx(F0,{onClose:s})}),i.jsx(j0,{open:t,onClose:o,title:x,children:i.jsx(ra,{data:y,renderCustomNodeElement:Ci})})]})},r1="1.0.7",n1=({children:e,initialTree:t,initialTreeId:n,backendConfig:r})=>{const[o,a]=j.useState(Ge.currentHierarchyPointNode),[s,l]=j.useState(Ge.modalOpen),[c,d]=j.useState(Ge.treeModalOpen),[f,h]=j.useState(Ge.treePath),[b,x]=j.useReducer(m0,t||Ge.tree),[y,v]=j.useState(n?{...Ge.currentTree,id:n}:Ge.currentTree),g=j.useMemo(()=>{var T,O;return{backendConfig:{baseUrl:((T=Ge==null?void 0:Ge.backendConfig)==null?void 0:T.baseUrl)||"",...Ge.backendConfig,...r,endpoints:{...(O=Ge.backendConfig)==null?void 0:O.endpoints,...r==null?void 0:r.endpoints}},currentHierarchyPointNode:o,currentTree:y,dispatchTree:x,modalOpen:s,setCurrentHierarchyPointNode:a,setCurrentTree:v,setModalOpen:l,setTreeModalOpen:d,setTreePath:h,tree:b,treeModalOpen:c,treePath:f,version:r1}},[r,o,y,s,b,c,f]);return Rr(y.id,{enabled:!!n,onSuccess:async T=>{T&&(v({id:T==null?void 0:T.id,name:T==null?void 0:T.label}),x(go((T==null?void 0:T.workflow)||null)))}}),i.jsx(ea.Provider,{value:g,children:e})},o1={close:"Close",copyToClipboard:"Copy tree to clipboard",createTree:"Create Tree",downloadJSONFile:"Download JSON File",reset:"Reset",resetTree:"Reset tree",save:"Save",update:"Update"},a1={error:{fetchTree:"An error has occurred. Please try again",saveTree:"An error has occurred. Please try again",updateTree:"An error has occurred. Please try again"},success:{copyToClipboard:"Copied to clipboard",saveTree:"Tree registered",updateTree:"Tree updated"}},s1={add:"Add",cancel:"Cancel",disabled:"Disabled",edit:"Edit",initialQueryEnable:"Enable initial API call",isABranch:"Is a branch",isAHidden:"Is a hidden field",isALeaf:"Is a leaf",isARepeatable:"Is a repeatable",isATree:"Is a tree",isTheRoot:"Is the root",label:"Label",multiple:"Multiple",name:"Name",parentRef:"Parent element",remove:"Remove",required:"Required",save:"Save",show:"Show",tag:"Tag",type:"Type",uuid:"UUID",validate:"Validate",value:"Value",values:"Values"},i1={close:"Fermer",copyToClipboard:"Copier l'arbre dans le presse-papiers",createTree:"Créer un arbre",downloadJSONFile:"Télécharger le fichier JSON",reset:"Réinitialiser",resetTree:"Réinitialiser l'arbre",save:"Enregistrer",update:"Modifier"},Ti={additionalParams:"Paramètres additionnels",ancestor:"Ancêtre",apiRoute:"Api route",dataMapping:"Mapping de données",decisionField:"Champs de décision",helperText:"Texte d'information",hiddenValue:"Valeur caché",label:"Label",message:"Message",mustBeUnique:"Doit être unique",newTree:"Nouvel arbre",noAncestorFound:"Aucun parent trouvé",offMessage:"Message (désactiver)",onMessage:"Message (activer)",repeatable:"Répétable",staticFields:"Champs statiques",step:"Étape",tree:"Arbre",treeName:"Nom de l'arbre",type:{address:"Adresse",autocomplete:"Autocomplétion",checkbox:"Case à cocher",date:"Date",dateRange:"Plage de dates",dynamicSelect:"Sélection dynamique",email:"Email",file:"Fichier",hidden:"Champs caché",number:"Nombre",password:"Mot de passe",radio:"Radio",select:"Select",switch:"Switch",tel:"Téléphone",text:"Texte",time:"Temps",timeRange:"Plage de temps",tree:"Arbre",url:"URL"},urlConstruction:"Construction de l'URL",value:"Valeur",values:"Valeurs",warningApiAutocomplete:{response:"dois avoir comme réponse",url:"La route de l'API"},warningApiSelect:{response:"à l'emplacement de votre variable.",url:"Pour intégrer automatiquement la valeur du parent dans l'URL",warning:"placez {{}}"}},_i={addFirstTitle:"Ajouter un champ",addTitle:"Ajouter un champ à « {{name}} »",deleteTitle:"Voulez vraiment supprimer « {{name}} »",editTitle:"Éditer le champ « {{name}} »",resetTreeContent:"Êtes-vous sûr de vouloir réinitialiser l'arbre ?",saveTree:"Enregistrer l'arbre"},l1={error:{fetchTree:"Une erreur est survenue veuillez réessayer",saveTree:"Une erreur est survenue veuillez réessayer",updateTree:"Une erreur est survenue veuillez réessayer"},success:{copyToClipboard:"Copié dans le presse-papiers",saveTree:"Arbre enregistré",updateTree:"Arbre mis à jour"}},c1={add:"Ajouter",cancel:"Annuler",disabled:"Désactivé",edit:"Éditer",initialQueryEnable:"Activer un appel API intiale",isABranch:"Est une branche",isAHidden:"Est un champs caché",isALeaf:"Est une feuille",isARepeatable:"Est répétable",isATree:"Est un arbre",isTheRoot:"Est la racine",label:"Label",multiple:"Multiple",name:"Nom",parentRef:"Element parent",remove:"Supprimer",required:"Requis",save:"Enregistrer",show:"Afficher",tag:"Tag",type:"Type",uuid:"UUID",validate:"Valider",value:"Valeur",values:"Valeurs"};Zt.use(Zi).use(Ne.initReactI18next).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{useSuspense:!0},resources:{en:{button:o1,form:Ti,modal:_i,snackMessage:a1,translation:s1},fr:{button:i1,form:Ti,modal:_i,snackMessage:l1,translation:c1}},returnNull:!1}).then(()=>{document.documentElement.lang!==Zt.resolvedLanguage&&Zt.resolvedLanguage&&document.documentElement.setAttribute("lang",Zt.resolvedLanguage)}),Zt.on("languageChanged",e=>{document.documentElement.setAttribute("lang",e)});const u1=({initialTree:e,initialTreeId:t,backendConfig:n})=>(j.useLayoutEffect(()=>{Pt.defaults.baseURL=n==null?void 0:n.baseUrl,n!=null&&n.authToken&&(Pt.defaults.headers.common.Authorization=`Bearer ${n==null?void 0:n.authToken}`)},[n==null?void 0:n.authToken,n==null?void 0:n.baseUrl]),i.jsx(Mt.QueryClientProvider,{client:al,children:i.jsx(ll,{authToken:n==null?void 0:n.authToken,children:i.jsx(n1,{backendConfig:n,initialTree:e,initialTreeId:t,children:i.jsx(ol,{children:i.jsx(fl,{children:i.jsx(t1,{})})})})})}));Fe.TreePlusIcon=Qo,Fe.Treege=u1,Object.defineProperty(Fe,Symbol.toStringTag,{value:"Module"})});
124
+ `))}},unstable_useEnhancedEffect:Bs,unstable_useId:Af,unsupportedProp:Mf,useControlled:Pf,useEventCallback:Df,useForkRef:If,useIsFocusVisible:Uf},Symbol.toStringTag,{value:"Module"})));var Us;function Se(){return Us||(Us=1,function(e){"use client";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=Wf}($n)),$n}var Yf=ye;Object.defineProperty(Rn,"__esModule",{value:!0});var Ws=Rn.default=void 0,Gf=Yf(Se()),Kf=i;Ws=Rn.default=(0,Gf.default)((0,Kf.jsx)("path",{d:"M15 1H4c-1.1 0-2 .9-2 2v13c0 .55.45 1 1 1s1-.45 1-1V4c0-.55.45-1 1-1h10c.55 0 1-.45 1-1s-.45-1-1-1m.59 4.59 4.83 4.83c.37.37.58.88.58 1.41V21c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h6.17c.53 0 1.04.21 1.42.59M15 12h4.5L14 6.5V11c0 .55.45 1 1 1"}),"FileCopyRounded");var mo={},Jf=ye;Object.defineProperty(mo,"__esModule",{value:!0});var Ys=mo.default=void 0,Xf=Jf(Se()),Hf=i;Ys=mo.default=(0,Xf.default)((0,Hf.jsx)("path",{d:"M6.56 7.98C6.1 7.52 5.31 7.6 5 8.17c-.28.51-.5 1.03-.67 1.58-.19.63.31 1.25.96 1.25h.01c.43 0 .82-.28.94-.7.12-.4.28-.79.48-1.17.22-.37.15-.84-.16-1.15M5.31 13h-.02c-.65 0-1.15.62-.96 1.25.16.54.38 1.07.66 1.58.31.57 1.11.66 1.57.2.3-.31.38-.77.17-1.15-.2-.37-.36-.76-.48-1.16-.12-.44-.51-.72-.94-.72m2.85 6.02c.51.28 1.04.5 1.59.66.62.18 1.24-.32 1.24-.96v-.03c0-.43-.28-.82-.7-.94-.4-.12-.78-.28-1.15-.48-.38-.21-.86-.14-1.16.17l-.03.03c-.45.45-.36 1.24.21 1.55M13 4.07v-.66c0-.89-1.08-1.34-1.71-.71L9.17 4.83c-.4.4-.4 1.04 0 1.43l2.13 2.08c.63.62 1.7.17 1.7-.72V6.09c2.84.48 5 2.94 5 5.91 0 2.73-1.82 5.02-4.32 5.75-.41.12-.68.51-.68.94v.02c0 .65.61 1.14 1.23.96C17.57 18.71 20 15.64 20 12c0-4.08-3.05-7.44-7-7.93"}),"RotateLeftRounded");var bo={},Zf=ye;Object.defineProperty(bo,"__esModule",{value:!0});var Gs=bo.default=void 0,Qf=Zf(Se()),e0=i;Gs=bo.default=(0,Qf.default)((0,e0.jsx)("path",{d:"M17.59 3.59c-.38-.38-.89-.59-1.42-.59H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7.83c0-.53-.21-1.04-.59-1.41zM12 19c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m1-10H7c-1.1 0-2-.9-2-2s.9-2 2-2h6c1.1 0 2 .9 2 2s-.9 2-2 2"}),"SaveRounded");var vo={},t0=ye;Object.defineProperty(vo,"__esModule",{value:!0});var Ks=vo.default=void 0,r0=t0(Se()),n0=i;Ks=vo.default=(0,r0.default)((0,n0.jsx)("path",{d:"M18 2h-7.17c-.53 0-1.04.21-1.42.59L4.59 7.41C4.21 7.79 4 8.3 4 8.83V20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-6.35 14.65-2.79-2.79c-.32-.32-.1-.86.35-.86H11v-2.99c0-.55.44-.99.99-1 .56-.01 1.01.44 1.01 1V13h1.79c.45 0 .67.54.35.85l-2.79 2.79c-.19.2-.51.2-.7.01"}),"SimCardDownloadRounded");const Js=(e,t)=>{if(!e)return null;if(e.uuid===t)return e;const n=e.children||[];for(let r=0;r<n.length;r+=1){const o=n[r],a=Js(o,t);if(a)return a}return null},Gt=(e,t)=>{var a,s,l,c,d;if(!e)return null;if(!t)return e;if(((a=e.attributes)==null?void 0:a.treePath)===t)return((s=e.attributes)==null?void 0:s.tree)||null;let n=null;const r=(l=e.attributes)==null?void 0:l.tree,o=(c=e.children)==null?void 0:c.length;if(r&&(n=Gt((d=e.attributes)==null?void 0:d.tree,t)),o){const{children:f}=e;for(let h=0;h<f.length;h+=1){const b=f[h];if(n!==null)return n;n=Gt(b,t)}}return n},an=(e,t,n)=>{const r=Gt(e,t);return Js(r,n)},o0=(e,t)=>{if(!e)return null;const{attributes:n}=t,r=n.isDecision;return Object.defineProperty(e,"attributes",{value:{...e.attributes,isLeaf:!1}}),r?(Object.defineProperty(e,"children",{value:[{...t,attributes:{...n,isLeaf:!1}}]}),null):(Object.defineProperty(e,"children",{value:[{...t,attributes:{...n,isLeaf:!e.children.length}}]}),null)},a0=({tree:e,path:t,uuid:n,child:r})=>{var c;const{attributes:o,children:a}=r;if(!e)return a.length?{...r}:{...r,attributes:{...o,isLeaf:!0,isRoot:!0}};const s=structuredClone(e),l=an(s,t,n);return o0(l,{...r,...!o.isDecision&&{children:[...((c=an(e,t,n))==null?void 0:c.children)||[]]}}),s},Xs=(e,t,n=null)=>{if(!e)return null;if(e.uuid===t)return n;const r=e.children||[];for(let o=0;o<r.length;o+=1){const a=r[o],s=Xs(a,t,e);if(s!==null)return s}return null},s0=(e,t)=>!e||!t?null:e.attributes.isDecision||t.attributes.isDecision?(Object.defineProperty(e,"children",{value:[...e.children.filter(n=>n.uuid!==t.uuid)]}),Object.defineProperty(e,"attributes",{value:{...e.attributes,isLeaf:!e.children.length}}),null):(Object.defineProperty(e,"children",{value:[...e.children.filter(n=>n.uuid!==t.uuid),...t.children]}),Object.defineProperty(e,"attributes",{value:{...e.attributes,isLeaf:!t.children.length}}),null),i0=(e,t,n)=>{const r=Gt(e,t);return Xs(r,n)},l0=({tree:e,path:t,uuid:n})=>{const r=structuredClone(e),o=an(r,t,n),a=i0(r,t,n);return s0(a,o),r},c0=(e,t)=>{if(!e)return null;const n=t.attributes.isDecision,r=e.attributes.isDecision,o=e.attributes.depth===0,a={value:t.uuid},s=r||n,l=s?{value:[...t.children]}:{value:[...e.children]},c=s?{value:{...t.attributes,...o&&{isRoot:!0},isLeaf:!t.children.length||!n}}:{value:{...t.attributes,...o&&{isRoot:!0},isLeaf:!e.children.length}};return Object.defineProperties(e,{attributes:c,children:l,uuid:a}),null},u0=({tree:e,path:t,uuid:n,children:r})=>{const o=structuredClone(e),a=an(o,t,n);return c0(a,r),o},d0=(e,t)=>{if(!e)return[];const n=[],r=o=>{var a,s;if((a=o.attributes)!=null&&a.name&&n.push((s=o==null?void 0:o.attributes)==null?void 0:s.name),(o==null?void 0:o.uuid)!==t&&o.children.length){const{children:l}=o;for(let c=0;c<l.length;c+=1)r(l[c])}};return r(e),[...new Set(n)]},lt={appendTreeCard:"appendTreeCard",deleteTreeCard:"deleteTreeCard",replaceTreeCard:"replaceTreeCard",resetTree:"resetTree",setTree:"setTree"},f0=(e,t,n)=>({children:n,path:e,type:lt.appendTreeCard,uuid:t}),p0=(e,t,n)=>({children:n,path:e,type:lt.replaceTreeCard,uuid:t}),h0=(e,t)=>({path:e,type:lt.deleteTreeCard,uuid:t}),Hs=()=>({type:lt.resetTree}),go=e=>({tree:e,type:lt.setTree}),m0=(e,t)=>{switch(t.type){case lt.appendTreeCard:{const{uuid:n,path:r,children:o}=t;return a0({child:o,path:r,tree:e,uuid:n})}case lt.deleteTreeCard:{const{path:n,uuid:r}=t;return l0({path:n,tree:e,uuid:r})}case lt.replaceTreeCard:{const{uuid:n,path:r,children:o}=t;return u0({children:o,path:r,tree:e,uuid:n})}case lt.resetTree:return null;case lt.setTree:return t.tree;default:throw new Error}},yo=()=>{const{dispatchSnackbar:e}=j.useContext(Ho);return{close:()=>e(Zo()),open:(r,o="success")=>e(cl(r,o))}},b0=e=>{const{backendConfig:t}=Me(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return Mt.useMutation(["patchWorkflow"],async o=>{const{data:a}=await Pt.patch(r,o);return a},e)},v0=e=>{const{backendConfig:t}=Me(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return Mt.useMutation(["postWorkflow"],async o=>{const{data:a}=await Pt.post(r,o);return a},e)},g0=()=>{const{t:e}=Ne.useTranslation(["snackMessage"]),{open:t}=yo(),{setCurrentTree:n,currentTree:r,tree:o,dispatchTree:a}=Me(),[s,l]=j.useState(!1),{version:c}=Me(),{mutate:d}=v0({onError:()=>{t(e("error.saveTree",{ns:"snackMessage"}),"error")},onSuccess:O=>{t(e("success.saveTree",{ns:"snackMessage"})),n(S=>({...S,id:O.workflow_id}))}}),{mutate:f}=b0({onError:()=>{t(e("error.updateTree",{ns:"snackMessage"}),"error")},onSuccess:()=>{t(e("success.updateTree",{ns:"snackMessage"}))}}),h=O=>JSON.stringify(O,null,2),b=O=>`data:text/json;charset=utf-8,${encodeURIComponent(h(O))}`,x=O=>()=>{navigator.clipboard.writeText(h(O)).then(),t(e("success.copyToClipboard",{ns:"snackMessage"}))},y=()=>{l(!1)};return{copyToClipboard:x,formatJSON:h,getDownloadLink:b,handleClose:y,handleOpen:()=>{l(!0)},handleResetTree:()=>{a(Hs()),y()},handleSubmit:()=>{const{name:O,id:S}=r;if(!O){n(A=>({...A,errorName:"Champs Requis"}));return}if(o){if(S){f({id:S,label:O,version:c,workflow:o});return}d({label:O,version:c,workflow:o})}},openModal:s}},y0=({downloadedFileName:e="export",value:t})=>{const{t:n}=Ne.useTranslation(),{getDownloadLink:r,handleSubmit:o,handleClose:a,handleOpen:s,handleResetTree:l,copyToClipboard:c,openModal:d}=g0(),{currentTree:f,backendConfig:h,tree:b}=Me(),{id:x}=f;return i.jsxs(p.Stack,{direction:"row",spacing:1,justifyContent:"center",children:[i.jsx(p.Tooltip,{title:n("resetTree",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.IconButton,{disabled:!b,onClick:s,color:"warning",children:i.jsx(Ys,{})})})}),i.jsx(p.Divider,{orientation:"vertical",flexItem:!0}),i.jsx(p.Tooltip,{title:n("copyToClipboard",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.IconButton,{href:"",download:`${e}.json`,disabled:!t,onClick:c(t),children:i.jsx(Ws,{})})})}),i.jsx(p.Tooltip,{title:n("downloadJSONFile",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.IconButton,{href:r(t),download:`${e}.json`,disabled:!t,children:i.jsx(Ks,{})})})}),i.jsx(p.Tooltip,{title:x?n("update",{ns:"button"}):n("save",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.IconButton,{onClick:o,disabled:!t||!(h!=null&&h.baseUrl),children:i.jsx(Gs,{})})})}),i.jsxs(p.Dialog,{maxWidth:"xs",fullWidth:!0,open:d,onClose:a,children:[i.jsx(p.DialogTitle,{variant:"h3",children:n("resetTree",{ns:"button"})}),i.jsx(p.DialogContent,{children:i.jsx(p.DialogContentText,{children:n("resetTreeContent",{ns:"modal"})})}),i.jsxs(p.DialogActions,{children:[i.jsx(p.Button,{onClick:a,children:n("close",{ns:"button"})}),i.jsx(p.Button,{variant:"contained",color:"warning",onClick:l,children:n("reset",{ns:"button"})})]})]})]})},x0={box:{backgroundColor:he.background,border:`solid 1px ${he.borderBlue}`}},Zs=({children:e,description:t,open:n,onClose:r,title:o})=>i.jsx(p.Dialog,{open:n,onClose:r,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",scroll:"body",maxWidth:"sm",fullWidth:!0,children:i.jsxs(p.Box,{sx:x0.box,p:4,children:[i.jsx("h3",{children:o}),i.jsx("p",{children:t}),e]})});var xo={},C0=ye;Object.defineProperty(xo,"__esModule",{value:!0});var Qs=xo.default=void 0,T0=C0(Se()),_0=i;Qs=xo.default=(0,T0.default)((0,_0.jsx)("path",{d:"M18.3 5.71a.9959.9959 0 0 0-1.41 0L12 10.59 7.11 5.7a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4"}),"CloseRounded");const sn={container:{display:"flex",flexDirection:"column",height:"100%",margin:1},main:{border:`solid 1px ${he.borderBlue}`,height:" 100%",margin:1},toolbar:{backgroundColor:he.background,boxShadow:"none",display:"flex",padding:"0 ! important"},toolbarBox:{backgroundColor:he.tertiary,border:`solid 1px ${he.primary}`,margin:1,paddingX:2,paddingY:1,width:"100%"}},E0=({children:e,appear:t,in:n,onEnter:r,onExited:o,onFocus:a,role:s,tabIndex:l,timeout:c},d)=>i.jsx(p.Slide,{direction:"up",ref:d,appear:t,in:n,onEnter:r,onExited:o,onFocus:a,role:s,tabIndex:l,timeout:c,children:e}),w0=j.forwardRef(E0),j0=({children:e,open:t,onClose:n,title:r})=>i.jsx(p.Dialog,{PaperProps:{sx:{backgroundColor:he.background,backgroundImage:"none"}},open:t,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",fullScreen:!0,TransitionComponent:w0,children:i.jsxs(p.Box,{sx:sn.container,children:[i.jsx(p.AppBar,{position:"sticky",elevation:0,children:i.jsx(p.Toolbar,{sx:sn.toolbar,children:i.jsxs(p.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:sn.toolbarBox,children:[i.jsx(p.Typography,{variant:"h5",children:i.jsx("strong",{children:r})}),i.jsx(p.IconButton,{edge:"end",color:"inherit",onClick:n,"aria-label":"close",children:i.jsx(Qs,{})})]})})}),i.jsx(p.Box,{sx:sn.main,children:e})]})}),O0={box:{border:`solid 1px ${he.borderBlue}`,flexGrow:0}},S0=({children:e})=>i.jsx(p.Box,{p:2,role:"group",sx:O0.box,children:e}),R0={box:{border:`solid 1px ${he.borderBlue}`,flexGrow:0}},$0=({children:e})=>i.jsx(p.Box,{sx:R0.box,padding:2,component:"header",children:e}),k0={box:{border:`solid 1px ${he.borderBlue}`,flexGrow:1}},A0=({children:e})=>i.jsx(p.Box,{sx:k0.box,component:"main",role:"tree",children:e}),ei={stack:{width:"100%"}},M0=({children:e})=>{const t=j.Children.toArray(e);return i.jsxs(p.Grid,{container:!0,padding:1,flexWrap:"nowrap",height:"100%",role:"treegrid",children:[i.jsx(p.Grid,{item:!0,xs:9,padding:1,display:"flex",children:i.jsxs(p.Stack,{sx:ei.stack,spacing:2,children:[t[0],t[1]]})}),i.jsx(p.Grid,{item:!0,xs:3,padding:1,display:"flex",children:i.jsxs(p.Stack,{sx:ei.stack,spacing:2,children:[t[2],t[3]]})})]})},P0={box:{border:`solid 1px ${he.borderBlue}`,flexGrow:1,overflow:"auto"}},D0=({children:e})=>i.jsx(p.Box,{sx:P0.box,component:"aside",children:e}),I0=()=>{const{dispatchTree:e,setModalOpen:t,currentHierarchyPointNode:n,treePath:r}=Me();return{handleSubmit:a=>{var c,d;a.preventDefault();const s=((c=n==null?void 0:n.data)==null?void 0:c.uuid)||"",l=((d=r==null?void 0:r.at(-1))==null?void 0:d.path)||"";e(h0(l,s)),t(null)}}},F0=({onClose:e})=>{const{t}=Ne.useTranslation(),{handleSubmit:n}=I0();return i.jsx("form",{onSubmit:n,children:i.jsxs(p.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:[i.jsx(p.Button,{variant:"text",onClick:e,children:t("cancel")}),i.jsx(p.Button,{variant:"contained",color:"error",type:"submit",children:t("remove")})]})})};var Co={},N0=ye;Object.defineProperty(Co,"__esModule",{value:!0});var To=Co.default=void 0,L0=N0(Se()),V0=i;To=Co.default=(0,L0.default)((0,V0.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 11h-3v3c0 .55-.45 1-1 1s-1-.45-1-1v-3H8c-.55 0-1-.45-1-1s.45-1 1-1h3V8c0-.55.45-1 1-1s1 .45 1 1v3h3c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddCircleRounded");var _o={},B0=ye;Object.defineProperty(_o,"__esModule",{value:!0});var ti=_o.default=void 0,q0=B0(Se()),z0=i;ti=_o.default=(0,q0.default)((0,z0.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward");var Eo={},U0=ye;Object.defineProperty(Eo,"__esModule",{value:!0});var ri=Eo.default=void 0,W0=U0(Se()),Y0=i;ri=Eo.default=(0,W0.default)((0,Y0.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var wo={},G0=ye;Object.defineProperty(wo,"__esModule",{value:!0});var jo=wo.default=void 0,K0=G0(Se()),J0=i;jo=wo.default=(0,K0.default)((0,J0.jsx)("path",{d:"M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5m-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1m2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1"}),"LinkRounded");var Oo={},X0=ye;Object.defineProperty(Oo,"__esModule",{value:!0});var ni=Oo.default=void 0,H0=X0(Se()),Z0=i;ni=Oo.default=(0,H0.default)((0,Z0.jsx)("path",{d:"M7.92 7.54c-.8-.34-1.14-1.33-.66-2.05C8.23 4.05 9.85 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.15.27-.24.49-.3.94-.09.73-.69 1.3-1.43 1.3-.87 0-1.58-.75-1.48-1.62.06-.51.18-1.04.46-1.54.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.17 0-1.93.61-2.4 1.34-.35.57-1.08.75-1.69.5M14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2"}),"QuestionMarkRounded");var So={},Q0=ye;Object.defineProperty(So,"__esModule",{value:!0});var Ro=So.default=void 0,ep=Q0(Se()),tp=i;Ro=So.default=(0,ep.default)((0,tp.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 11H8c-.55 0-1-.45-1-1s.45-1 1-1h8c.55 0 1 .45 1 1s-.45 1-1 1"}),"RemoveCircleRounded");const ln={container:{backgroundColor:"#282c34",borderRadius:.5,color:"#abb2bf",display:"inline-block",lineHeight:1.5,marginBottom:.2,paddingX:.5,paddingY:.2,width:"fit-content"},property:{color:"#56b6c2"},type:{color:"#c678dd"}},rp=({value:e})=>{const{t}=Ne.useTranslation(["translation","form"]);return i.jsx(p.Alert,{severity:"warning",variant:"outlined",children:i.jsxs(p.Typography,{component:"div",variant:"body2",gutterBottom:!0,sx:{lineHeight:2},children:[t("form:warningApiSelect.url")," ",t("form:warningApiSelect.warning")," ",t("form:warningApiSelect.response"),i.jsxs(p.Box,{sx:ln.container,children:["https://api.example.com/","{{",i.jsx(p.Box,{component:"span",sx:ln.type,children:e||"value"}),i.jsx(p.Box,{component:"span",sx:ln.property,children:": string"}),"}}","/endpoint ",i.jsx(p.Box,{component:"span",sx:ln.property})]})]})})},Et={container:{backgroundColor:"#282c34",borderRadius:.5,color:"#abb2bf",display:"inline-block",lineHeight:1.5,marginBottom:.2,paddingX:.5,paddingY:.2,width:"fit-content"},property:{color:"#56b6c2"},type:{color:"#c678dd"}},np=({endPoint:e})=>{const{t}=Ne.useTranslation(["translation","form"]),{url:n,searchKey:r}=e,o=`${n}?${r}`;return i.jsx(p.Alert,{severity:"warning",variant:"outlined",children:i.jsxs(p.Typography,{component:"div",variant:"body2",gutterBottom:!0,sx:{lineHeight:2},children:[t("form:warningApiAutocomplete.url")," ",n&&i.jsxs(i.Fragment,{children:[i.jsx(p.Box,{component:"span",sx:Et.container,children:o})," "]}),t("form:warningApiAutocomplete.response"),i.jsxs(p.Box,{sx:Et.container,children:["{ ",i.jsx(p.Box,{component:"span",sx:Et.property,children:"label"}),":"," ",i.jsx(p.Box,{component:"span",sx:Et.type,children:"string"}),";"," ",i.jsx(p.Box,{component:"span",sx:Et.property,children:"value"}),":"," ",i.jsx(p.Box,{component:"span",sx:Et.type,children:"string"}),";"," ",i.jsx(p.Box,{component:"span",sx:Et.property,children:"img"}),i.jsx(p.Box,{component:"span",className:"semicolon",children:"?"}),":"," ",i.jsx(p.Box,{component:"span",sx:Et.type,children:"string"}),"; }"]})]})})};var $o={},op=ye;Object.defineProperty($o,"__esModule",{value:!0});var oi=$o.default=void 0,ap=op(Se()),sp=i;oi=$o.default=(0,ap.default)((0,sp.jsx)("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddRounded");const ip=e=>{const{backendConfig:t}=Me(),{endpoints:n}=t||{},{workflows:r=""}=n||{};return Mt.useQuery(["workflows"],async({signal:o})=>{const{data:a}=await Pt.get(r,{signal:o});return a},e)},lp=({isControlled:e,fetchWorkflowsOnOpen:t})=>{const{t:n}=Ne.useTranslation("snackMessage"),{open:r}=yo(),{currentTree:o,setCurrentTree:a,dispatchTree:s}=Me(),[l,c]=j.useState(""),d=!!l&&!e&&l!==o.id,{data:f,isError:h}=Rr(l,{enabled:d}),{data:b,isLoading:x,refetch:y}=ip({enabled:!t}),v=j.useCallback(async({target:T})=>{var S;const{value:O}=T;if(O==="add-new-tree"){c(""),a({name:""}),s(Hs());return}c(O),a({id:O,name:(S=b==null?void 0:b.find(A=>A.id===O))==null?void 0:S.label})},[s,a,b]),g=j.useCallback(async()=>{if(t)try{await y(),o.id&&!l&&c(o.id)}catch{r(n("error.fetchTree",{ns:"snackMessage"}),"error")}},[t,y,o.id,l,r,n]);return j.useEffect(()=>{if(f&&l!==o.id){const{id:T,label:O,workflow:S}=f;a({id:T,name:O}),s(go(S))}},[o.id,s,e,a,l,f]),j.useEffect(()=>{h&&r(n("error.fetchTree",{ns:"snackMessage"}),"error")},[h,r,n]),{currentTree:o,fetchWorkflowSuggestions:y,handleChangeTree:v,handleOnOpen:g,setTreeSelected:c,treeSelected:l,workflowsSuggestions:b,workflowsSuggestionsLoading:x}},ai={formControl:{flex:1},select:{".MuiOutlinedInput-notchedOutline":{border:0,paddingLeft:5},".MuiSelect-select":{opacity:0,width:0},boxShadow:"none"}},si=({arrowOnly:e,required:t,size:n,showBtnAddNewTree:r,onChange:o,value:a,fetchWorkflowsOnOpen:s})=>{const{t:l}=Ne.useTranslation("form"),c=j.useMemo(()=>!!o,[o]),{handleChangeTree:d,handleOnOpen:f,workflowsSuggestions:h,workflowsSuggestionsLoading:b,treeSelected:x}=lp({fetchWorkflowsOnOpen:s,isControlled:c});return i.jsxs(p.FormControl,{size:n,required:t,sx:ai.formControl,children:[!e&&i.jsx(p.InputLabel,{children:l("tree",{ns:"form"})}),i.jsxs(p.Select,{value:c?a:x,id:"tree-select",onChange:y=>c?o==null?void 0:o(y):d(y),sx:e?ai.select:void 0,label:l("tree",{ns:"form"}),onOpen:f,children:[(a&&b||b)&&i.jsx(p.MenuItem,{value:a,children:i.jsx(p.Skeleton,{width:"100%"})}),h==null?void 0:h.map(({label:y,id:v})=>i.jsx(p.MenuItem,{value:v,children:y},v)),r&&i.jsx(p.MenuItem,{disabled:!0,children:i.jsx(p.Box,{sx:{height:1,width:"100%"},children:i.jsx(p.Divider,{})})}),r&&i.jsxs(p.MenuItem,{value:"add-new-tree",children:[i.jsx(p.Typography,{mr:1,children:l("newTree",{ns:"form"})}),i.jsx(oi,{color:"primary"})]})]})]})},cp=({helperText:e,hiddenValue:t,isHiddenField:n,isTreeField:r,treeSelected:o,handleChangeTreeSelect:a,handleChangeHelperText:s,handleChangeHiddenValue:l})=>{const{t:c}=Ne.useTranslation(["translation","form"]);return r?i.jsx(si,{required:!0,value:o,onChange:a}):n?i.jsx(p.TextField,{required:!0,sx:{flex:1},label:c("hiddenValue",{ns:"form"}),onChange:l,value:t}):i.jsx(p.TextField,{sx:{flex:1},label:c("helperText",{ns:"form"}),onChange:s,value:e})},Kt=[{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"text"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"number"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"email"},{isBooleanField:!1,isDecisionField:!1,isMultiple:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"file"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"password"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"tel"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"address"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"url"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"date"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"dateRange"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"time"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"timeRange"},{isBooleanField:!0,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"switch"},{isBooleanField:!0,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"checkbox"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"hidden"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"tree"},{isBooleanField:!1,isDecisionField:!0,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"radio"},{isBooleanField:!1,isDecisionField:!0,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"select"},{initialQueryEnable:!0,isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"autocomplete"},{isBooleanField:!1,isDecisionField:!1,isMultiple:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"dynamicSelect"}],up=()=>{const e=Date.now(),t=performance.now();return`${e}${Math.random().toString(36).substring(2,9)}${t}`},dp=()=>{var gn,yn,u,w,R,V,Q,pe,J,K,Be,Ce,Ee,We,vt,Cr,rt,Ei,wi,ji,Oi,Si,Ri,$i,ki,Ai,Mi,Pi,Di,Ii,Fi,Ni;const e=up(),t=j.useMemo(()=>[{id:"0",label:"",message:"",value:""}],[]),{dispatchTree:n,currentHierarchyPointNode:r,modalOpen:o,treePath:a,setModalOpen:s}=Me(),{open:l}=yo(),{t:c}=Ne.useTranslation(),d=r!=null&&r.data&&((gn=r==null?void 0:r.data)!=null&&gn.attributes)&&"isMultiple"in r.data.attributes?!!r.data.attributes.isMultiple:null,[f,h]=j.useState(t),[b,x]=j.useState(""),[y,v]=j.useState(""),[g,T]=j.useState(""),[O,S]=j.useState(!1),[A,m]=j.useState(!1),[I,F]=j.useState(!1),[Z,Te]=j.useState("text"),[ge,ee]=j.useState(null),[ne,me]=j.useState(null),[fe,oe]=j.useState({url:""}),[be,Pe]=j.useState(""),[Ae,Ue]=j.useState(""),[E,$]=j.useState(""),[N,B]=j.useState({off:"",on:""}),[P,W]=j.useState(!1),[D,L]=j.useState(!1),U=o==="edit",Y=Z==="tree",q=Z==="hidden",ve=Z==="autocomplete",C=Z==="dynamicSelect",_e=Kt.some(_=>_.type===Z&&(_==null?void 0:_.isBooleanField)),k=Kt.some(_=>_.type===Z&&(_==null?void 0:_.isDecisionField)),Ve=Kt.some(_=>_.type===Z&&(_==null?void 0:_.isRequiredDisabled)),Xe=Kt.some(_=>_.type===Z&&(_==null?void 0:_.isRepeatableDisabled)),ft=((u=(yn=r==null?void 0:r.data)==null?void 0:yn.attributes)==null?void 0:u.isLeaf)??!0,ct=Kt.some(_=>_.type===Z&&"isMultiple"in _),{refetch:pt,isInitialLoading:hr}=Rr(be,{enabled:!1}),$t=j.useCallback(_=>!k&&_>0,[k]),He=j.useCallback((_,M)=>{h(z=>z.map(X=>{const{id:we}=X;return _.target.dataset.id===we?{...X,id:we,[M]:_.target.value}:{...X}}))},[]),wt=j.useCallback((_,M)=>{typeof M=="string"?ee(M):M&&M.inputValue?ee(M.inputValue):ee(null)},[]),mr=j.useCallback((_,M)=>{oe(z=>({...z,url:z.url?z.url.replace(/{{[^{}]+}}/,`{{${M||""}}}`):`https://example.com/{{${M||""}}}`})),me(M??null)},[]),ht=j.useCallback(_=>{x(_.target.value)},[]),Jt=j.useCallback(_=>{v(_.target.value)},[]),mt=j.useCallback(_=>{T(_.target.value)},[]),br=j.useCallback(_=>{He(_,"label")},[He]),Xt=j.useCallback(_=>{He(_,"value")},[He]),De=j.useCallback(_=>{He(_,"message")},[He]),bt=j.useCallback(_=>{oe(M=>({...M,url:_.target.value}))},[]),ot=j.useCallback(_=>{const M=_.target.value;if(M.includes("{{}}")){const z=M.replace("{{}}",`{{${ne||""}}}`);oe(X=>({...X,url:z}))}else if(M.includes("{{")){const z=M.replace(/{{[^{}]+}}/,`{{${ne||""}}}`);oe(X=>({...X,url:z}))}else oe(z=>({...z,url:M}))},[ne]),jt=j.useCallback(_=>{oe(M=>({...M,searchKey:_.target.value}))},[]),kt=j.useCallback((_,M)=>{oe(z=>{const X={...z.pathKey,[_]:M.target.value};if(M.target.value===""&&_ in X){const{pathKey:we,...Ie}=z;return{...Ie}}return{...z,pathKey:X}})},[oe]),Bo=j.useCallback((_,M,z)=>{oe(X=>{const we=[...X.params??[]];return we[_]={...we[_],[M]:z.target.value},{...X,params:we}})},[oe]),qo=j.useCallback(_=>{$(_.target.value)},[]),zo=j.useCallback(_=>{F(_.target.checked)},[]),Uo=j.useCallback(_=>{S(_.target.checked)},[]),vr=j.useCallback(_=>{L(_.target.checked)},[]),un=j.useCallback(_=>{m(_.target.checked)},[]),Ot=j.useCallback(_=>{W(_.target.checked)},[]),gr=j.useCallback(_=>{Te(_.target.value),m(!1),S(!1),W(!1)},[]),yr=j.useCallback(_=>{Pe(_.target.value)},[]),dn=j.useCallback(_=>M=>{B(z=>({...z,[_]:M.target.value}))},[]),Wo=j.useCallback(_=>{Ue(_.target.value)},[]),fn=j.useCallback(()=>{h(_=>{const M=Number(_[_.length-1].id),z=String(M+1);return[..._,{...t[0],id:z}]})},[t]),Yo=j.useCallback(()=>{oe(_=>{var we,Ie;const M=Number(((Ie=(we=_.params)==null?void 0:we[_.params.length-1])==null?void 0:Ie.id)||0),z=String(M+1),X=[..._.params||[],{id:z,key:"",value:""}];return{..._,params:X}})},[]),pn=j.useCallback(_=>{h(M=>M.filter(({id:z})=>_.currentTarget.value!==z))},[]),hn=j.useCallback(_=>{const M=_.currentTarget.value;oe(z=>{const X=(z.params??[]).filter(({id:Ie})=>Ie!==M),we=X.length>0?X:void 0;return{...z,params:we}})},[]),mn=j.useCallback((_,M)=>{var X,we,Ie;const z=(Ie=(we=(X=_==null?void 0:_.children)==null?void 0:X[M])==null?void 0:we.data)==null?void 0:Ie.children;return z?z.map(({uuid:gt,attributes:yt,children:St})=>({attributes:yt,children:St,uuid:gt})):[]},[]),bn=j.useCallback(_=>{var M;return A?(M=f==null?void 0:f.filter((z,X)=>!$t(X)))==null?void 0:M.map(({message:z,value:X,label:we},Ie)=>{const gt=`${e}:${X}`,yt=mn(r,Ie);return{attributes:{depth:_+1,label:we,name:`${g}:${X}`,value:X,...z&&{message:z},...yt.length===0&&{isLeaf:!0}},children:yt,uuid:gt}}):[]},[r,$t,mn,A,g,e,f]),xr=j.useCallback(_=>_.map(({message:M,...z})=>({...z,...M&&{message:M}})),[]),vn=j.useCallback((_,M,z)=>{var X;if(_&&(!M||z))try{return pt()}catch{l(c("error.fetchTree",{ns:"snackMessage"}),"error")}return _&&M&&!z?{data:{workflow:(X=r==null?void 0:r.data.attributes)==null?void 0:X.tree},isError:null}:{data:null,isError:null}},[(w=r==null?void 0:r.data.attributes)==null?void 0:w.tree,pt,l,c]),Go=j.useCallback(async _=>{var _r,Er,wr,jr;_.preventDefault();const{on:M,off:z}=N,X=((_r=r==null?void 0:r.data)==null?void 0:_r.uuid)||"",we=(r==null?void 0:r.depth)||0,Ie=o==="edit",gt=we+(Ie||r===null?0:1),yt=bn(gt),St=(Er=a==null?void 0:a.at(-1))==null?void 0:Er.path,xn=a.length?`${St}/${e}`:`/${e}`,Cn=((jr=(wr=r==null?void 0:r.data.attributes)==null?void 0:wr.tree)==null?void 0:jr.treeId)!==be,{data:Ht,isError:Tn}=await vn(Y,Ie,Cn);if(Tn)return;const Tr={attributes:{depth:gt,name:g,type:Z,...y&&{label:y},...ve&&{route:fe},...C&&{route:fe},...Ae&&{helperText:Ae},...A&&{isDecision:A},...O&&{required:O},...E&&{step:E},...P&&{repeatable:P},...q&&{hiddenValue:b},...ge&&{tag:ge},...ne&&{parentRef:ne},...I&&ct&&{isMultiple:I},...D&&{initialQuery:D},...k&&!A&&{values:xr(f)},...(z||M)&&{messages:{...z&&{off:z},...M&&{on:M}}},...Y&&{tree:{...Ht==null?void 0:Ht.workflow,treeId:be},treePath:xn}},children:yt,uuid:Ie?X:e};n(Ie?p0(St||"",X,Tr):f0(St||null,X,Tr)),s(null)},[N,r,o,bn,a,e,be,vn,Y,y,g,Z,ve,fe,C,Ae,A,k,xr,f,O,E,P,q,b,ge,ne,I,ct,D,s,n]);return j.useEffect(()=>{var _,M,z,X,we,Ie,gt,yt,St,xn,Cn,Ht,Tn,Tr,_r,Er,wr,jr,Li,Vi,Bi,qi,zi;if(o==="edit"){const _n=((M=(_=r==null?void 0:r.data)==null?void 0:_.attributes)==null?void 0:M.values)||((we=(X=(z=r==null?void 0:r.data)==null?void 0:z.children)==null?void 0:X.filter(({attributes:At})=>!(At!=null&&At.type)))==null?void 0:we.map(({attributes:At},En)=>{const{label:wn,value:jn,message:Or}=At||{};return{id:String(En),label:String(wn),value:String(jn),...Or&&{message:String(Or)}}}));ee(((Ie=r==null?void 0:r.data.attributes)==null?void 0:Ie.tag)||null),Te(((gt=r==null?void 0:r.data.attributes)==null?void 0:gt.type)||"text"),Ue(((yt=r==null?void 0:r.data.attributes)==null?void 0:yt.helperText)||""),S(((St=r==null?void 0:r.data.attributes)==null?void 0:St.required)||!1),$(((xn=r==null?void 0:r.data.attributes)==null?void 0:xn.step)||""),v(((Cn=r==null?void 0:r.data.attributes)==null?void 0:Cn.label)||""),T(((Ht=r==null?void 0:r.data.attributes)==null?void 0:Ht.name)||""),m(((Tn=r==null?void 0:r.data.attributes)==null?void 0:Tn.isDecision)||!1),h(_n!=null&&_n.length?_n:t),Pe(((_r=(Tr=r==null?void 0:r.data.attributes)==null?void 0:Tr.tree)==null?void 0:_r.treeId)||""),W(((Er=r==null?void 0:r.data.attributes)==null?void 0:Er.repeatable)||!1),x(((wr=r==null?void 0:r.data.attributes)==null?void 0:wr.hiddenValue)||""),me(((jr=r==null?void 0:r.data.attributes)==null?void 0:jr.parentRef)||null),B({off:((Vi=(Li=r==null?void 0:r.data.attributes)==null?void 0:Li.messages)==null?void 0:Vi.off)||"",on:((qi=(Bi=r==null?void 0:r.data.attributes)==null?void 0:Bi.messages)==null?void 0:qi.on)||""}),oe(At=>{var En,wn,jn,Or,Ui,Wi,Yi,Gi;return{...At,params:(wn=(En=r==null?void 0:r.data.attributes)==null?void 0:En.route)==null?void 0:wn.params,pathKey:(Or=(jn=r==null?void 0:r.data.attributes)==null?void 0:jn.route)==null?void 0:Or.pathKey,searchKey:(Wi=(Ui=r==null?void 0:r.data.attributes)==null?void 0:Ui.route)==null?void 0:Wi.searchKey,url:((Gi=(Yi=r==null?void 0:r.data.attributes)==null?void 0:Yi.route)==null?void 0:Gi.url)||""}}),F(d||!1),L(((zi=r==null?void 0:r.data.attributes)==null?void 0:zi.initialQuery)||!1)}},[(R=r==null?void 0:r.data.attributes)==null?void 0:R.helperText,(V=r==null?void 0:r.data.attributes)==null?void 0:V.hiddenValue,(Q=r==null?void 0:r.data.attributes)==null?void 0:Q.initialQuery,(pe=r==null?void 0:r.data.attributes)==null?void 0:pe.isDecision,(J=r==null?void 0:r.data.attributes)==null?void 0:J.label,(Be=(K=r==null?void 0:r.data.attributes)==null?void 0:K.messages)==null?void 0:Be.off,(Ee=(Ce=r==null?void 0:r.data.attributes)==null?void 0:Ce.messages)==null?void 0:Ee.on,(We=r==null?void 0:r.data.attributes)==null?void 0:We.name,(vt=r==null?void 0:r.data.attributes)==null?void 0:vt.parentRef,(Cr=r==null?void 0:r.data.attributes)==null?void 0:Cr.repeatable,(rt=r==null?void 0:r.data.attributes)==null?void 0:rt.required,(wi=(Ei=r==null?void 0:r.data.attributes)==null?void 0:Ei.route)==null?void 0:wi.params,(Oi=(ji=r==null?void 0:r.data.attributes)==null?void 0:ji.route)==null?void 0:Oi.pathKey,(Ri=(Si=r==null?void 0:r.data.attributes)==null?void 0:Si.route)==null?void 0:Ri.searchKey,(ki=($i=r==null?void 0:r.data.attributes)==null?void 0:$i.route)==null?void 0:ki.url,(Ai=r==null?void 0:r.data.attributes)==null?void 0:Ai.step,(Mi=r==null?void 0:r.data.attributes)==null?void 0:Mi.tag,(Di=(Pi=r==null?void 0:r.data.attributes)==null?void 0:Pi.tree)==null?void 0:Di.treeId,(Ii=r==null?void 0:r.data.attributes)==null?void 0:Ii.type,(Fi=r==null?void 0:r.data.attributes)==null?void 0:Fi.values,(Ni=r==null?void 0:r.data)==null?void 0:Ni.children,r==null?void 0:r.data.uuid,t,d,o]),{getDisabledValueField:$t,handleAddParams:Yo,handleAddValue:fn,handleChangeHelperText:Wo,handleChangeHiddenValue:ht,handleChangeInitialQuery:vr,handleChangeIsDecisionField:un,handleChangeLabel:Jt,handleChangeMessage:dn,handleChangeMultiple:zo,handleChangeName:mt,handleChangeOptionLabel:br,handleChangeOptionMessage:De,handleChangeOptionValue:Xt,handleChangeParam:Bo,handleChangeParentRef:mr,handleChangePath:kt,handleChangeRepeatable:Ot,handleChangeRequired:Uo,handleChangeSearchKey:jt,handleChangeStep:qo,handleChangeTag:wt,handleChangeTreeSelect:yr,handleChangeType:gr,handleChangeUrl:bt,handleChangeUrlSelect:ot,handleDeleteParam:hn,handleDeleteValue:pn,handleSubmit:Go,helperText:Ae,hiddenValue:b,initialQuery:D,isAutocomplete:ve,isBooleanField:_e,isDecision:A,isDecisionField:k,isDynamicSelect:C,isEditModal:U,isHiddenField:q,isLeaf:ft,isMultiple:I,isMultiplePossible:ct,isRepeatableDisabled:Xe,isRequiredDisabled:Ve,isTreeField:Y,isWorkflowLoading:hr,label:y,messages:N,name:g,parentRef:ne,repeatable:P,required:O,route:fe,step:E,tag:ge,treeSelected:be,type:Z,uuid:e,values:f}},fp=({value:e,onChange:t})=>{var b;const[n,r]=j.useState(e||""),{t:o}=Ne.useTranslation(["form"]),{tree:a,treePath:s,currentHierarchyPointNode:l}=Me(),{uuid:c}=(l==null?void 0:l.data)||{},d=Gt(a,(b=s==null?void 0:s.at(-1))==null?void 0:b.path),f=d0(d,c),h=x=>{const y=x.target.value;r(y),t==null||t(x,y)};return i.jsxs(p.FormControl,{sx:{flex:1.5},required:!0,children:[i.jsx(p.InputLabel,{children:o("form:ancestor")}),i.jsx(p.Select,{sx:{flex:2},value:n,label:o("form:ancestor"),onChange:h,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:f.length?f.map((x,y)=>{const v=`${x}-${y}`;return i.jsx(p.MenuItem,{value:x,children:x},v)}):i.jsx(p.MenuItem,{disabled:!0,value:"",children:o("form:noAncestorFound")})})]})},pp=()=>{const{backendConfig:e}=Me();return{fields:j.useCallback(()=>Kt.filter(n=>!(n.type==="tree"&&!(e!=null&&e.baseUrl))),[e==null?void 0:e.baseUrl])()}},hp=({onChange:e,value:t})=>{const{t:n}=Ne.useTranslation(["translation","form"]),{fields:r}=pp();return i.jsxs(p.FormControl,{sx:{flex:1},required:!0,fullWidth:!0,children:[i.jsx(p.InputLabel,{children:n("type")}),i.jsx(p.Select,{value:t,label:n("type"),onChange:e,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:r.map(({type:o,isDecisionField:a})=>i.jsxs(p.MenuItem,{value:o,children:[n(`type.${o}`,{ns:"form"}),a&&i.jsx(p.Chip,{label:n("decisionField",{ns:"form"}),size:"small",color:"info",sx:{marginLeft:1}})]},o))})]})},mp=e=>{if(!e)return[];const t=new Set,n=r=>{var o,a;if((o=r==null?void 0:r.attributes)!=null&&o.tag&&t.add(r.attributes.tag),(a=r==null?void 0:r.children)!=null&&a.length){const{children:s}=r;for(let l=0;l<s.length;l+=1)n(s[l])}};return n(e),[...t]},bp=p.createFilterOptions(),vp=({value:e,onChange:t})=>{const{t:n}=Ne.useTranslation(["translation","form"]),{tree:r}=Me(),o=mp(r).reduce((a,s)=>[...a,{inputValue:s,label:s}],[]);return i.jsx(p.Autocomplete,{sx:{flex:1},freeSolo:!0,fullWidth:!0,value:e,onChange:t,filterOptions:(a,s)=>{const l=bp(a,s),{inputValue:c}=s,d=a.some(f=>typeof f!="string"&&c===f.label);return c!==""&&!d&&l.push({inputValue:c,label:`${n("add")} "${c}"`}),l},getOptionLabel:a=>typeof a=="string"?a:a.inputValue?a.inputValue:a.label,renderOption:(a,s)=>i.jsx("li",{...a,children:typeof s!="string"&&s.label}),renderInput:a=>i.jsx(p.TextField,{...a,label:n("tag")}),options:o})},ii={marginRight:"-20px !important",minWidth:"auto !important"},cn={iconButton:ii,iconButtonDelete:{...ii,"&:before":{borderRadius:"50%",content:'""',height:20,position:"absolute",width:20,zIndex:-1},backgroundColor:he.background,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)"}},gp=({onClose:e})=>{const{t}=Ne.useTranslation(["translation","form"]),{values:n,required:r,tag:o,type:a,helperText:s,label:l,name:c,hiddenValue:d,isBooleanField:f,isDecision:h,isEditModal:b,isDecisionField:x,isHiddenField:y,isRequiredDisabled:v,isRepeatableDisabled:g,isAutocomplete:T,isDynamicSelect:O,isTreeField:S,treeSelected:A,isWorkflowLoading:m,repeatable:I,isLeaf:F,isMultiplePossible:Z,isMultiple:Te,initialQuery:ge,handleChangeTreeSelect:ee,handleChangeHelperText:ne,handleChangeOptionMessage:me,handleChangeRequired:fe,handleChangeName:oe,handleChangeType:be,handleChangeIsDecisionField:Pe,handleChangeOptionLabel:Ae,handleDeleteValue:Ue,handleDeleteParam:E,handleChangeOptionValue:$,handleChangeMessage:N,handleSubmit:B,handleAddValue:P,handleAddParams:W,handleChangeLabel:D,handleChangeRepeatable:L,handleChangeHiddenValue:U,handleChangeTag:Y,handleChangeSearchKey:q,handleChangeUrl:ve,handleChangeUrlSelect:C,handleChangeParam:_e,handleChangePath:k,handleChangeMultiple:Ve,handleChangeParentRef:Xe,handleChangeInitialQuery:ft,parentRef:ct,route:pt,messages:{on:hr,off:$t}}=dp(),{searchKey:He,url:wt,pathKey:mr,params:ht}=pt||{},{object:Jt="",label:mt="",value:br="",image:Xt=""}=mr||{};return i.jsxs("form",{onSubmit:B,children:[i.jsx(p.Box,{marginBottom:1,children:i.jsx(hp,{value:a,onChange:be})}),i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(p.TextField,{label:t("name"),sx:{flex:1},onChange:oe,value:c,required:!0}),i.jsx(p.TextField,{sx:{flex:1},label:t("label",{ns:"form"}),onChange:D,value:l})]}),i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(vp,{value:o,onChange:Y}),i.jsx(cp,{helperText:s,hiddenValue:d,isHiddenField:y,isTreeField:S,treeSelected:A,handleChangeTreeSelect:ee,handleChangeHelperText:ne,handleChangeHiddenValue:U})]}),T&&i.jsx(p.Stack,{spacing:1,paddingY:1,children:i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputProps:{startAdornment:i.jsx(p.InputAdornment,{position:"start",children:i.jsx(jo,{})})},placeholder:"https://api.fr/enpoint",type:"url",label:t("form:apiRoute"),onChange:ve,value:wt,required:!0}),i.jsx(ni,{}),i.jsx(p.TextField,{InputLabelProps:{shrink:!0},sx:{flex:1},placeholder:t("form:searchKeyPlaceholder"),type:"text",label:t("form:key"),onChange:q,value:He})]})}),O&&i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsx("h4",{children:t("form:urlConstruction")}),i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(fp,{value:ct,onChange:Xe}),i.jsx(ti,{}),i.jsx(p.TextField,{sx:{flex:3},InputProps:{startAdornment:i.jsx(p.InputAdornment,{position:"start",children:i.jsx(jo,{})})},placeholder:`https://api.fr/{{${ct||""}}}/enpoint`,type:"url",label:t("form:apiRoute"),onChange:C,value:wt})]}),wt&&i.jsx(rp,{value:ct})]}),(T||O)&&i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsxs(p.Accordion,{elevation:0,square:!0,children:[i.jsx(p.AccordionSummary,{expandIcon:i.jsx(ri,{}),"aria-controls":"panel-content",sx:{"& .MuiAccordionSummary-content":{flexGrow:0},display:"inline-flex",justifyContent:"flex-start",padding:0},children:i.jsx(p.Typography,{sx:{textDecoration:"underline"},children:t("form:dataMapping")})}),i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsxs(p.Stack,{spacing:1,sx:{pb:1},direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Object Array Path",value:Jt,onChange:De=>k("object",De),placeholder:"elements.features[]",type:"text"}),i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Label Path",value:mt,onChange:De=>k("label",De),placeholder:"client.name",type:"text"})]}),i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Value Path",value:br,onChange:De=>k("value",De),placeholder:"client.id",type:"text"}),i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Image Path",value:Xt,onChange:De=>k("image",De),placeholder:"client.src.profile",type:"text"})]}),i.jsx(np,{endPoint:{searchKey:He||"",url:wt}})]})]}),i.jsxs(p.Stack,{children:[i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},position:"relative",alignItems:{sm:"center",xs:"flex-start"},children:[i.jsx("h4",{children:t("form:additionalParams")}),i.jsx(p.Box,{justifyContent:"flex-end",children:i.jsx(p.IconButton,{color:"success",sx:cn.iconButton,onClick:W,children:i.jsx(To,{})})})]}),ht==null?void 0:ht.map(({id:De,key:bt,value:ot},jt)=>i.jsxs(p.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[i.jsx(p.TextField,{label:"Key",sx:{flex:1},onChange:kt=>_e(jt,"key",kt),value:bt,inputProps:{"data-id":De}}),i.jsx(p.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:kt=>_e(jt,"value",kt),value:ot,inputProps:{"data-id":De}}),ht.length>0&&i.jsx(p.IconButton,{color:"warning",sx:cn.iconButtonDelete,value:De,onClick:E,children:i.jsx(Ro,{})})]},De))]})]}),f&&i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(p.TextField,{sx:{flex:1},label:t("onMessage",{ns:"form"}),onChange:N("on"),value:hr}),i.jsx(p.TextField,{sx:{flex:1},label:t("offMessage",{ns:"form"}),onChange:N("off"),value:$t})]}),i.jsx(p.Stack,{paddingY:1,children:i.jsxs(p.FormGroup,{children:[Z&&i.jsx(p.FormControlLabel,{control:i.jsx(p.Checkbox,{checked:Te,onChange:Ve}),label:t("multiple")}),T&&i.jsx(p.FormControlLabel,{control:i.jsx(p.Checkbox,{checked:ge,onChange:ft}),label:t("initialQueryEnable")}),i.jsx(p.FormControlLabel,{disabled:v,control:i.jsx(p.Checkbox,{checked:r,onChange:fe}),label:t("required")}),i.jsx(p.FormControlLabel,{disabled:g,control:i.jsx(p.Checkbox,{checked:I,onChange:L}),label:t("repeatable",{ns:"form"})}),(F||b)&&i.jsx(p.FormControlLabel,{disabled:!x,control:i.jsx(p.Checkbox,{checked:h,onChange:Pe}),label:t("decisionField",{ns:"form"})})]})}),x&&i.jsxs(i.Fragment,{children:[i.jsx("h4",{children:t("values")}),n==null?void 0:n.map(({value:De,label:bt,id:ot,message:jt})=>i.jsxs(p.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[i.jsx(p.TextField,{label:t("label",{ns:"form"}),sx:{flex:1},onChange:Ae,value:bt,inputProps:{"data-id":ot},required:!0}),i.jsx(p.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:$,value:De,inputProps:{"data-id":ot},required:!0}),i.jsx(p.TextField,{label:t("message",{ns:"form"}),sx:{flex:1},onChange:me,value:jt,inputProps:{"data-id":ot}}),n.length>1&&i.jsx(p.IconButton,{color:"warning",sx:cn.iconButtonDelete,value:ot,onClick:Ue,children:i.jsx(Ro,{})})]},ot))]}),x&&i.jsx(p.Box,{justifyContent:"flex-end",display:"flex",children:i.jsx(p.IconButton,{color:"success",sx:cn.iconButton,onClick:P,children:i.jsx(To,{})})}),i.jsxs(p.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",paddingTop:3,children:[i.jsx(p.Button,{variant:"text",onClick:e,children:t("cancel")}),i.jsx(p.Button,{variant:"contained",type:"submit",disabled:m,isLoading:m,loadingIndicator:i.jsx(p.CircularProgress,{size:14}),children:t("validate")})]})]})};var ko={},yp=ye;Object.defineProperty(ko,"__esModule",{value:!0});var li=ko.default=void 0,xp=yp(Se()),Cp=i;li=ko.default=(0,xp.default)((0,Cp.jsx)("path",{d:"M17 11h3c1.11 0 2-.9 2-2V5c0-1.11-.9-2-2-2h-3c-1.11 0-2 .9-2 2v1H9.01V5c0-1.11-.9-2-2-2H4c-1.1 0-2 .9-2 2v4c0 1.11.9 2 2 2h3c1.11 0 2-.9 2-2V8h2v7.01c0 1.65 1.34 2.99 2.99 2.99H15v1c0 1.11.9 2 2 2h3c1.11 0 2-.9 2-2v-4c0-1.11-.9-2-2-2h-3c-1.11 0-2 .9-2 2v1h-1.01c-.54 0-.99-.45-.99-.99V8h2v1c0 1.1.9 2 2 2"}),"AccountTreeRounded");var Ao={},Tp=ye;Object.defineProperty(Ao,"__esModule",{value:!0});var ci=Ao.default=void 0,_p=Tp(Se()),Ep=i;ci=Ao.default=(0,_p.default)((0,Ep.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-3 10h-3v3c0 .55-.45 1-1 1s-1-.45-1-1v-3H8c-.55 0-1-.45-1-1s.45-1 1-1h3V8c0-.55.45-1 1-1s1 .45 1 1v3h3c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddBoxRounded");var Mo={},wp=ye;Object.defineProperty(Mo,"__esModule",{value:!0});var ui=Mo.default=void 0,jp=wp(Se()),Op=i;ui=Mo.default=(0,jp.default)((0,Op.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2zM9 9h6c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-8c0-.55.45-1 1-1m6.5-5-.71-.71c-.18-.18-.44-.29-.7-.29H9.91c-.26 0-.52.11-.7.29L8.5 4H6c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1z"}),"DeleteOutlineRounded");var Po={},Sp=ye;Object.defineProperty(Po,"__esModule",{value:!0});var di=Po.default=void 0,Rp=Sp(Se()),$p=i;di=Po.default=(0,Rp.default)((0,$p.jsx)("path",{d:"M3 17.46v3.04c0 .28.22.5.5.5h3.04c.13 0 .26-.05.35-.15L17.81 9.94l-3.75-3.75L3.15 17.1c-.1.1-.15.22-.15.36M20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"EditRounded");var Do={},kp=ye;Object.defineProperty(Do,"__esModule",{value:!0});var fi=Do.default=void 0,Ap=kp(Se()),Mp=i;fi=Do.default=(0,Ap.default)((0,Mp.jsx)("path",{d:"M12 3c-4.8 0-9 3.86-9 9 0 2.12.74 4.07 1.97 5.61l-1.68 1.68c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l1.68-1.68C7.93 20.26 9.88 21 12 21c2.3 0 4.61-.88 6.36-2.64C20.12 16.61 21 14.3 21 12V5c0-1.1-.9-2-2-2zm3.83 9.26-5.16 4.63c-.16.15-.41.14-.56-.01-.14-.14-.16-.36-.04-.52l2.44-3.33-4.05-.4c-.44-.04-.63-.59-.3-.89l5.16-4.63c.16-.15.41-.14.56.01.14.14.16.36.04.52l-2.44 3.33 4.05.4c.45.04.63.59.3.89"}),"EnergySavingsLeafRounded");var Io={},Pp=ye;Object.defineProperty(Io,"__esModule",{value:!0});var pi=Io.default=void 0,Dp=Pp(Se()),hi=i;pi=Io.default=(0,Dp.default)([(0,hi.jsx)("path",{d:"M14.14 12h-.06c.81 0 1.28-.91.82-1.57L9.82 3.17c-.4-.57-1.24-.57-1.64 0L3.1 10.43c-.46.66.01 1.57.82 1.57h-.06L.99 16.46c-.43.66.05 1.54.84 1.54H7v2c0 1.1.9 2 2 2s2-.9 2-2v-2h5.17c.79 0 1.27-.88.84-1.54z"},"0"),(0,hi.jsx)("path",{d:"M23.01 16.46 20.14 12h-.06c.81 0 1.28-.91.82-1.57l-5.08-7.26c-.4-.57-1.24-.57-1.64 0l-1.57 2.24 3.11 4.44c.43.61.48 1.41.14 2.07-.08.16-.18.3-.3.43l2.29 3.57c.4.62.42 1.4.07 2.04-.01.02-.02.03-.03.04h4.28c.79 0 1.27-.88.84-1.54M13 20c0 1.1.9 2 2 2s2-.9 2-2v-1h-4z"},"1")],"ForestRounded");var Fo={},Ip=ye;Object.defineProperty(Fo,"__esModule",{value:!0});var mi=Fo.default=void 0,Fp=Ip(Se()),Np=i;mi=Fo.default=(0,Fp.default)((0,Np.jsx)("path",{d:"M12 4V2.21c0-.45-.54-.67-.85-.35l-2.8 2.79c-.2.2-.2.51 0 .71l2.79 2.79c.32.31.86.09.86-.36V6c3.31 0 6 2.69 6 6 0 .79-.15 1.56-.44 2.25-.15.36-.04.77.23 1.04.51.51 1.37.33 1.64-.34.37-.91.57-1.91.57-2.95 0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-.79.15-1.56.44-2.25.15-.36.04-.77-.23-1.04-.51-.51-1.37-.33-1.64.34C4.2 9.96 4 10.96 4 12c0 4.42 3.58 8 8 8v1.79c0 .45.54.67.85.35l2.79-2.79c.2-.2.2-.51 0-.71l-2.79-2.79c-.31-.31-.85-.09-.85.36z"}),"LoopRounded");var No={},Lp=ye;Object.defineProperty(No,"__esModule",{value:!0});var bi=No.default=void 0,Vp=Lp(Se()),Bp=i;bi=No.default=(0,Vp.default)((0,Bp.jsx)("path",{d:"M16.96 12h.08c.81 0 1.28-.91.82-1.57l-5.08-7.25c-.4-.57-1.24-.57-1.64 0L6.1 10.43c-.46.66.02 1.57.83 1.57h.04l-2.9 4.46c-.44.66.04 1.54.84 1.54h5.08v2.02c0 1.09.89 1.98 1.98 1.98 1.09 0 1.98-.89 1.98-1.98V18h5.15c.8 0 1.28-.89.83-1.55z"}),"ParkRounded");var Lo={},qp=ye;Object.defineProperty(Lo,"__esModule",{value:!0});var gi=Lo.default=void 0,zp=qp(Se()),Up=i;gi=Lo.default=(0,zp.default)((0,Up.jsx)("path",{d:"M12 6.5c2.76 0 5 2.24 5 5 0 .51-.1 1-.24 1.46l3.06 3.06c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l2.17 2.17c.47-.14.96-.24 1.47-.24M2.71 3.16c-.39.39-.39 1.02 0 1.41l1.97 1.97C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.97-.3 4.31-.82l2.72 2.72c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L4.13 3.16c-.39-.39-1.03-.39-1.42 0M12 16.5c-2.76 0-5-2.24-5-5 0-.77.18-1.5.49-2.14l1.57 1.57c-.03.18-.06.37-.06.57 0 1.66 1.34 3 3 3 .2 0 .38-.03.57-.07L14.14 16c-.65.32-1.37.5-2.14.5m2.97-5.33c-.15-1.4-1.25-2.49-2.64-2.64z"}),"VisibilityOffRounded");var Vo={},Wp=ye;Object.defineProperty(Vo,"__esModule",{value:!0});var yi=Vo.default=void 0,Yp=Wp(Se()),Gp=i;yi=Vo.default=(0,Yp.default)((0,Gp.jsx)("path",{d:"M12 4C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4m0 12.5c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"VisibilityRounded");const Le={actionButton:{minWidth:"auto !important"},container:{background:he.background,borderRadius:"1rem"},containerField:{background:he.background,border:`solid 1px ${he.primary}`,borderRadius:"1rem"},containerHidden:{background:he.background,border:`solid 1px ${he.borderGrey}`,borderRadius:"1rem"},containerTree:{background:he.tertiary,border:`solid 1px ${he.primary}`,borderRadius:"1rem"},containerValue:{background:he.background,border:`solid 1px ${he.secondary}`,borderRadius:"1rem"},icon:{color:he.grey500},nodeSvg:{stroke:"transparent !important"},stepChip:{fontSize:".7rem !important",fontWeight:"bold",height:"20px !important"},title:{display:"-webkit-box",margin:0,overflow:"hidden",textAlign:"right",textOverflow:"ellipsis",webkitBoxOrient:"vertical",webkitLineClamp:2}},Kp=e=>{const t=!!e,n=e==="tree";return e==="hidden"?Le.containerHidden:n?Le.containerTree:t?Le.containerField:Le.containerValue},Jp=({nodeDatum:e,onAddChildren:t,onEditChildren:n,onDeleteChildren:r,onOpenTreeModal:o,hierarchyPointNode:a,size:s=220})=>{var F;const{t:l}=Ne.useTranslation(["translation","form"]),{attributes:c}=e||{},{isRoot:d,isLeaf:f,required:h,isDecision:b,step:x,type:y,label:v,repeatable:g,tag:T}=c||{},O=!!y,S=y==="tree",A=y==="hidden",m=!O,I=!d&&!f;return i.jsxs("g",{children:[i.jsx(p.GlobalStyles,{styles:{".rd3t-node svg":Le.nodeSvg}}),i.jsx(p.Box,{component:"foreignObject",height:s,width:s,x:`-${s/2}`,y:`-${s/2}`,sx:Kp(y),children:i.jsxs(p.Box,{flex:1,display:"flex",p:2,height:"100%",flexDirection:"column",justifyContent:"space-between",children:[i.jsxs(p.Stack,{alignItems:"flex-end",spacing:.5,children:[O&&i.jsxs(p.Stack,{direction:"row",spacing:1,alignItems:"center",children:[x&&i.jsx(p.Tooltip,{title:`${l("step",{ns:"form"})} ${(F=e==null?void 0:e.attributes)==null?void 0:F.step}`,placement:"left",arrow:!0,children:i.jsx(p.Chip,{color:"primary",size:"small",label:x,sx:Le.stepChip})}),i.jsx(p.Typography,{variant:"subtitle2",sx:Le.title,children:i.jsx("strong",{children:v})})]}),O&&i.jsx(p.Chip,{color:"info",size:"small",label:l(`type.${y}`,{ns:"form"})}),T&&i.jsx(p.Chip,{variant:"outlined",color:"warning",size:"small",label:T}),h&&i.jsx(p.Stack,{direction:"row",spacing:.5,children:h&&i.jsx(p.Typography,{variant:"body2",sx:{color:({palette:Z})=>Z.error.main},children:l("required")})}),i.jsx(p.Stack,{spacing:.5,alignItems:"flex-end",children:m&&i.jsx(p.Typography,{variant:"subtitle2",sx:Le.title,children:i.jsx("strong",{children:v})})}),i.jsxs(p.Stack,{paddingTop:.5,spacing:.5,direction:"row",children:[g&&i.jsx(p.Tooltip,{title:l("isARepeatable"),placement:"bottom",arrow:!0,children:i.jsx(mi,{style:Le.icon})}),f&&i.jsx(p.Tooltip,{title:l("isALeaf"),placement:"bottom",arrow:!0,children:i.jsx(fi,{style:Le.icon})}),A&&i.jsx(p.Tooltip,{title:l("isAHidden"),placement:"bottom",arrow:!0,children:i.jsx(gi,{style:Le.icon})}),d&&i.jsx(p.Tooltip,{title:l("isTheRoot"),placement:"bottom",arrow:!0,children:i.jsx(bi,{style:Le.icon})}),I&&i.jsx(p.Tooltip,{title:l("isABranch"),placement:"bottom",arrow:!0,children:i.jsx(li,{style:Le.icon})}),S&&i.jsx(p.Tooltip,{title:l("isATree"),placement:"bottom",arrow:!0,children:i.jsx(pi,{style:Le.icon})})]})]}),i.jsxs(p.Stack,{direction:"row",justifyContent:"flex-end",spacing:0,alignSelf:"flex-end",children:[!d&&i.jsx(p.Tooltip,{title:l("remove"),arrow:!0,children:i.jsx(p.Button,{variant:"text",sx:Le.actionButton,size:"small",color:"error",onClick:()=>r==null?void 0:r(a),children:i.jsx(ui,{})})}),!m&&i.jsx(p.Tooltip,{title:l("edit"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"secondary",sx:Le.actionButton,size:"small",onClick:()=>n==null?void 0:n(a),children:i.jsx(di,{})})}),!b&&i.jsx(p.Tooltip,{title:l("add"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"success",sx:Le.actionButton,size:"small",onClick:()=>t==null?void 0:t(a),children:i.jsx(ci,{})})}),S&&i.jsx(p.Tooltip,{title:l("show"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"info",sx:Le.actionButton,size:"small",onClick:()=>o==null?void 0:o(a),children:i.jsx(yi,{})})})]})]})})]})},Xp=j.memo(Jp),xi=()=>{const{setModalOpen:e,setCurrentHierarchyPointNode:t,setTreeModalOpen:n,setTreePath:r}=Me();return{handleAddChildren:d=>{t(d),e("add")},handleCloseTreeModal:()=>{r([]),n(!1)},handleDeleteChildren:d=>{t(d),e("delete")},handleEditChildren:d=>{t(d),e("edit")},handleOpenTreeModal:d=>{var h,b,x;const f={label:((h=d==null?void 0:d.data.attributes)==null?void 0:h.label)||"",path:((x=(b=d==null?void 0:d.data)==null?void 0:b.attributes)==null?void 0:x.treePath)||""};r(y=>[...y,f]),n(!0)}}},Hp=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,addChildren:s})=>{const{handleDeleteChildren:l,handleEditChildren:c,handleAddChildren:d,handleOpenTreeModal:f}=xi();return i.jsx(Xp,{addChildren:s,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,onAddChildren:d,onOpenTreeModal:f,onDeleteChildren:l,onEditChildren:c})},Ci=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,addChildren:s})=>i.jsx(Hp,{addChildren:s,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a}),Zp=()=>{const{t:e}=Ne.useTranslation(["modal","snackMessage"]),{currentHierarchyPointNode:t,modalOpen:n,setModalOpen:r,dispatchTree:o}=Me(),a=n==="edit";return{closeModal:()=>{r(null)},getTitleModalDelete:()=>{var v;const{label:x,name:y}=((v=t==null?void 0:t.data)==null?void 0:v.attributes)||{};return e("deleteTitle",{name:x||y,ns:"modal"})},getTitleModalMutation:()=>{var g;const{label:x,name:y}=((g=t==null?void 0:t.data)==null?void 0:g.attributes)||{};return a?e(a?"editTitle":"addTitle",{name:x||y,ns:"modal"}):e("addFirstTitle",{ns:"modal"})},handleChangeTree:x=>{try{o(go(JSON.parse(x)))}catch{return!1}},isDeleteModal:n==="delete",isModalMutationOpen:a||n==="add"}},Qp=()=>{const{currentTree:e,setCurrentTree:t,tree:n}=Me(),{name:r,errorName:o,id:a}=e;return{disabled:!!e.id&&!n,errorName:o,handleChangeName:c=>{const{value:d}=c.target;if(!d){t(f=>({...f,errorName:"Champs requis",name:c.target.value}));return}t(f=>({...f,errorName:"",name:c.target.value}))},id:a,name:r}},e1=()=>{const{t:e}=Ne.useTranslation("form"),{name:t,handleChangeName:n,errorName:r,disabled:o}=Qp();return i.jsx(p.TextField,{required:!0,label:e("treeName",{ns:"form"}),size:"small",onChange:n,value:t,error:!!r,disabled:o})},t1=()=>{const{tree:e,treeModalOpen:t,treePath:n,backendConfig:r}=Me(),{handleCloseTreeModal:o}=xi(),{getTitleModalMutation:a,closeModal:s,getTitleModalDelete:l,isModalMutationOpen:c,isDeleteModal:d,handleChangeTree:f}=Zp(),h=n==null?void 0:n.at(-1),b=h==null?void 0:h.path,x=h==null?void 0:h.label,y=Gt(e,b);return i.jsxs(i.Fragment,{children:[i.jsxs(M0,{children:[i.jsx($0,{children:i.jsxs(p.Stack,{justifyContent:"space-between",direction:"row",alignItems:"center",children:[i.jsx(hl,{}),!!(r!=null&&r.baseUrl)&&i.jsxs(p.Stack,{direction:"row",alignItems:"center",spacing:2,children:[i.jsx(e1,{}),i.jsx(si,{size:"small",arrowOnly:!0,showBtnAddNewTree:!0,fetchWorkflowsOnOpen:!0})]})]})}),i.jsx(A0,{children:i.jsx(ra,{data:e,renderCustomNodeElement:Ci})}),i.jsx(D0,{children:i.jsx(xl,{value:e,onChange:f})}),i.jsx(S0,{children:i.jsx(y0,{value:e})})]}),i.jsx(Zs,{open:c,onClose:s,title:a(),children:i.jsx(gp,{onClose:s})}),i.jsx(Zs,{open:d,onClose:s,title:l(),children:i.jsx(F0,{onClose:s})}),i.jsx(j0,{open:t,onClose:o,title:x,children:i.jsx(ra,{data:y,renderCustomNodeElement:Ci})})]})},r1="1.0.8",n1=({children:e,initialTree:t,initialTreeId:n,backendConfig:r})=>{const[o,a]=j.useState(Ge.currentHierarchyPointNode),[s,l]=j.useState(Ge.modalOpen),[c,d]=j.useState(Ge.treeModalOpen),[f,h]=j.useState(Ge.treePath),[b,x]=j.useReducer(m0,t||Ge.tree),[y,v]=j.useState(n?{...Ge.currentTree,id:n}:Ge.currentTree),g=j.useMemo(()=>{var T,O;return{backendConfig:{baseUrl:((T=Ge==null?void 0:Ge.backendConfig)==null?void 0:T.baseUrl)||"",...Ge.backendConfig,...r,endpoints:{...(O=Ge.backendConfig)==null?void 0:O.endpoints,...r==null?void 0:r.endpoints}},currentHierarchyPointNode:o,currentTree:y,dispatchTree:x,modalOpen:s,setCurrentHierarchyPointNode:a,setCurrentTree:v,setModalOpen:l,setTreeModalOpen:d,setTreePath:h,tree:b,treeModalOpen:c,treePath:f,version:r1}},[r,o,y,s,b,c,f]);return Rr(y.id,{enabled:!!n,onSuccess:async T=>{T&&(v({id:T==null?void 0:T.id,name:T==null?void 0:T.label}),x(go((T==null?void 0:T.workflow)||null)))}}),i.jsx(ea.Provider,{value:g,children:e})},o1={close:"Close",copyToClipboard:"Copy tree to clipboard",createTree:"Create Tree",downloadJSONFile:"Download JSON File",reset:"Reset",resetTree:"Reset tree",save:"Save",update:"Update"},a1={error:{fetchTree:"An error has occurred. Please try again",saveTree:"An error has occurred. Please try again",updateTree:"An error has occurred. Please try again"},success:{copyToClipboard:"Copied to clipboard",saveTree:"Tree registered",updateTree:"Tree updated"}},s1={add:"Add",cancel:"Cancel",disabled:"Disabled",edit:"Edit",initialQueryEnable:"Enable initial API call",isABranch:"Is a branch",isAHidden:"Is a hidden field",isALeaf:"Is a leaf",isARepeatable:"Is a repeatable",isATree:"Is a tree",isTheRoot:"Is the root",label:"Label",multiple:"Multiple",name:"Name",parentRef:"Parent element",remove:"Remove",required:"Required",save:"Save",show:"Show",tag:"Tag",type:"Type",uuid:"UUID",validate:"Validate",value:"Value",values:"Values"},i1={close:"Fermer",copyToClipboard:"Copier l'arbre dans le presse-papiers",createTree:"Créer un arbre",downloadJSONFile:"Télécharger le fichier JSON",reset:"Réinitialiser",resetTree:"Réinitialiser l'arbre",save:"Enregistrer",update:"Modifier"},Ti={additionalParams:"Paramètres additionnels",ancestor:"Ancêtre",apiRoute:"Api route",dataMapping:"Mapping de données",decisionField:"Champs de décision",helperText:"Texte d'information",hiddenValue:"Valeur caché",key:"Clé",label:"Label",message:"Message",mustBeUnique:"Doit être unique",newTree:"Nouvel arbre",noAncestorFound:"Aucun parent trouvé",offMessage:"Message (désactiver)",onMessage:"Message (activer)",repeatable:"Répétable",searchKeyPlaceholder:"text",staticFields:"Champs statiques",step:"Étape",tree:"Arbre",treeName:"Nom de l'arbre",type:{address:"Adresse",autocomplete:"Autocomplétion",checkbox:"Case à cocher",date:"Date",dateRange:"Plage de dates",dynamicSelect:"Sélection dynamique",email:"Email",file:"Fichier",hidden:"Champs caché",number:"Nombre",password:"Mot de passe",radio:"Radio",select:"Select",switch:"Switch",tel:"Téléphone",text:"Texte",time:"Temps",timeRange:"Plage de temps",tree:"Arbre",url:"URL"},urlConstruction:"Construction de l'URL",value:"Valeur",values:"Valeurs",warningApiAutocomplete:{response:"dois avoir comme réponse",url:"La route de l'API"},warningApiSelect:{response:"à l'emplacement de votre variable.",url:"Pour intégrer automatiquement la valeur du parent dans l'URL",warning:"placez {{}}"}},_i={addFirstTitle:"Ajouter un champ",addTitle:"Ajouter un champ à « {{name}} »",deleteTitle:"Voulez vraiment supprimer « {{name}} »",editTitle:"Éditer le champ « {{name}} »",resetTreeContent:"Êtes-vous sûr de vouloir réinitialiser l'arbre ?",saveTree:"Enregistrer l'arbre"},l1={error:{fetchTree:"Une erreur est survenue veuillez réessayer",saveTree:"Une erreur est survenue veuillez réessayer",updateTree:"Une erreur est survenue veuillez réessayer"},success:{copyToClipboard:"Copié dans le presse-papiers",saveTree:"Arbre enregistré",updateTree:"Arbre mis à jour"}},c1={add:"Ajouter",cancel:"Annuler",disabled:"Désactivé",edit:"Éditer",initialQueryEnable:"Activer un appel API intiale",isABranch:"Est une branche",isAHidden:"Est un champs caché",isALeaf:"Est une feuille",isARepeatable:"Est répétable",isATree:"Est un arbre",isTheRoot:"Est la racine",label:"Label",multiple:"Multiple",name:"Nom",parentRef:"Element parent",remove:"Supprimer",required:"Requis",save:"Enregistrer",show:"Afficher",tag:"Tag",type:"Type",uuid:"UUID",validate:"Valider",value:"Valeur",values:"Valeurs"};Zt.use(Zi).use(Ne.initReactI18next).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{useSuspense:!0},resources:{en:{button:o1,form:Ti,modal:_i,snackMessage:a1,translation:s1},fr:{button:i1,form:Ti,modal:_i,snackMessage:l1,translation:c1}},returnNull:!1}).then(()=>{document.documentElement.lang!==Zt.resolvedLanguage&&Zt.resolvedLanguage&&document.documentElement.setAttribute("lang",Zt.resolvedLanguage)}),Zt.on("languageChanged",e=>{document.documentElement.setAttribute("lang",e)});const u1=({initialTree:e,initialTreeId:t,backendConfig:n})=>(j.useLayoutEffect(()=>{Pt.defaults.baseURL=n==null?void 0:n.baseUrl,n!=null&&n.authToken&&(Pt.defaults.headers.common.Authorization=`Bearer ${n==null?void 0:n.authToken}`)},[n==null?void 0:n.authToken,n==null?void 0:n.baseUrl]),i.jsx(Mt.QueryClientProvider,{client:al,children:i.jsx(ll,{authToken:n==null?void 0:n.authToken,children:i.jsx(n1,{backendConfig:n,initialTree:e,initialTreeId:t,children:i.jsx(ol,{children:i.jsx(fl,{children:i.jsx(t1,{})})})})})}));Fe.TreePlusIcon=Qo,Fe.Treege=u1,Object.defineProperty(Fe,Symbol.toStringTag,{value:"Module"})});
@@ -6,6 +6,7 @@ declare const FORM_EN: {
6
6
  readonly decisionField: "Decision field";
7
7
  readonly helperText: "Helper text";
8
8
  readonly hiddenValue: "Hidden value";
9
+ readonly key: "Key";
9
10
  readonly label: "Label";
10
11
  readonly message: "Message";
11
12
  readonly mustBeUnique: "Must be unique";
@@ -14,6 +15,7 @@ declare const FORM_EN: {
14
15
  readonly offMessage: "Message (disable)";
15
16
  readonly onMessage: "Message (enable)";
16
17
  readonly repeatable: "Repeatable";
18
+ readonly searchKeyPlaceholder: "text";
17
19
  readonly staticFields: "Static fields";
18
20
  readonly step: "Step";
19
21
  readonly tree: "Tree";
@@ -6,6 +6,7 @@ declare const FORM_FR: {
6
6
  readonly decisionField: "Champs de décision";
7
7
  readonly helperText: "Texte d'information";
8
8
  readonly hiddenValue: "Valeur caché";
9
+ readonly key: "Clé";
9
10
  readonly label: "Label";
10
11
  readonly message: "Message";
11
12
  readonly mustBeUnique: "Doit être unique";
@@ -14,6 +15,7 @@ declare const FORM_FR: {
14
15
  readonly offMessage: "Message (désactiver)";
15
16
  readonly onMessage: "Message (activer)";
16
17
  readonly repeatable: "Répétable";
18
+ readonly searchKeyPlaceholder: "text";
17
19
  readonly staticFields: "Champs statiques";
18
20
  readonly step: "Étape";
19
21
  readonly tree: "Arbre";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "treege",
3
3
  "description": "Form decision tree generator",
4
4
  "license": "ISC",
5
- "version": "1.0.7",
5
+ "version": "1.0.8",
6
6
  "type": "module",
7
7
  "types": "./dist/main.d.ts",
8
8
  "main": "./dist/main.umd.cjs",