treege 0.12.0 → 0.12.1
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 +1 -1
- package/dist/main.js +1 -1
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -1
- package/dist/src/components/DataDisplay/Logo/Logo.test.d.ts +0 -1
- package/dist/src/components/Layouts/Action/Action.test.d.ts +0 -1
- package/dist/src/components/Layouts/Header/Header.test.d.ts +0 -1
- package/dist/src/components/Layouts/Main/Main.test.d.ts +0 -1
- package/dist/src/components/Layouts/MosaicLayout/MosaicLayout.test.d.ts +0 -1
- package/dist/src/components/Layouts/Sidebar/Sidebar.test.d.ts +0 -1
- package/dist/src/utils/array/isUniqueArrayItem/test/isUniqueArrayItem.test.d.ts +0 -1
- package/dist/src/utils/array/isUniqueArrayItemWithNewEntry/test/isUniqueArrayItemWithNewEntry.test.d.ts +0 -1
- package/dist/src/utils/object/removeObjectProperty/test/removeObjectProperty.test.d.ts +0 -1
- package/dist/src/utils/tree/appendNode/test/appendNode.test.d.ts +0 -1
- package/dist/src/utils/tree/findNodeByNameInTree/test/findNodeByNameInTree.test.d.ts +0 -1
- package/dist/src/utils/tree/findParentNodeByNameInTree/test/findParentNodeByNameInTree.test.d.ts +0 -1
- package/dist/src/utils/tree/getNode/test/getNode.test.d.ts +0 -1
- package/dist/src/utils/tree/getTree/test/getTree.test.d.ts +0 -1
- package/dist/src/utils/tree/removeNode/test/removeNode.test.d.ts +0 -1
- package/dist/src/utils/tree/updateNodeInTree/test/updateNodeInTree.test.d.ts +0 -1
package/CHANGELOG.md
CHANGED
package/dist/main.js
CHANGED
|
@@ -6673,7 +6673,7 @@ const Ie = {
|
|
|
6673
6673
|
/* @__PURE__ */ l.jsx(sa, { open: d, onClose: s, title: c(), children: /* @__PURE__ */ l.jsx(xf, { onClose: s }) }),
|
|
6674
6674
|
/* @__PURE__ */ l.jsx(uf, { open: t, onClose: o, title: p, children: g && /* @__PURE__ */ l.jsx(go, { data: g, renderCustomNodeElement: pa }) })
|
|
6675
6675
|
] });
|
|
6676
|
-
}, $p = "0.12.
|
|
6676
|
+
}, $p = "0.12.1", Pp = ({ children: e, initialTree: t, initialTreeId: n, backendConfig: r }) => {
|
|
6677
6677
|
const [o, a] = ye(Be.currentHierarchyPointNode), [s, c] = ye(Be.modalOpen), [u, d] = ye(Be.treeModalOpen), [f, p] = ye(Be.treePath), [g, b] = ya(Zd, t || Be.tree), [y, h] = ye(
|
|
6678
6678
|
n ? { ...Be.currentTree, id: n } : Be.currentTree
|
|
6679
6679
|
), m = Xt(
|
package/dist/main.umd.cjs
CHANGED
|
@@ -107,4 +107,4 @@ const theme2 = createTheme({ palette: {
|
|
|
107
107
|
} });`:ut(12,m?` (${m})`:"",JSON.stringify(g.main)));return va(g,"light",O,r),va(g,"dark",I,r),g.contrastText||(g.contrastText=p(g.main)),g},M={dark:xn,light:ya};return process.env.NODE_ENV!=="production"&&(M[t]||console.error(`MUI: The palette mode \`${t}\` is not supported.`)),We(Z({common:Z({},$t),mode:t,primary:h({color:a,name:"primary"}),secondary:h({color:i,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:h({color:l,name:"error"}),warning:h({color:f,name:"warning"}),info:h({color:u,name:"info"}),success:h({color:d,name:"success"}),grey:_c,contrastThreshold:n,getContrastText:p,augmentColor:h,tonalOffset:r},M[t]),o)}const Qc=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];function Bc(e){return Math.round(e*1e5)/1e5}const ba={textTransform:"uppercase"},Ma='"Roboto", "Helvetica", "Arial", sans-serif';function qc(e,t){const n=typeof t=="function"?t(e):t,{fontFamily:r=Ma,fontSize:o=14,fontWeightLight:a=300,fontWeightRegular:i=400,fontWeightMedium:l=500,fontWeightBold:u=700,htmlFontSize:d=16,allVariants:f,pxToRem:p}=n,h=tt(n,Qc);process.env.NODE_ENV!=="production"&&(typeof o!="number"&&console.error("MUI: `fontSize` is required to be a number."),typeof d!="number"&&console.error("MUI: `htmlFontSize` is required to be a number."));const M=o/14,v=p||(x=>`${x/d*M}rem`),g=(x,O,I,A,b)=>Z({fontFamily:r,fontWeight:x,fontSize:v(O),lineHeight:I},r===Ma?{letterSpacing:`${Bc(A/O)}em`}:{},b,f),m={h1:g(a,96,1.167,-1.5),h2:g(a,60,1.2,-.5),h3:g(i,48,1.167,0),h4:g(i,34,1.235,.25),h5:g(i,24,1.334,0),h6:g(l,20,1.6,.15),subtitle1:g(i,16,1.75,.15),subtitle2:g(l,14,1.57,.1),body1:g(i,16,1.5,.15),body2:g(i,14,1.43,.15),button:g(l,14,1.75,.4,ba),caption:g(i,12,1.66,.4),overline:g(i,12,2.66,1,ba),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return We(Z({htmlFontSize:d,pxToRem:v,fontFamily:r,fontSize:o,fontWeightLight:a,fontWeightRegular:i,fontWeightMedium:l,fontWeightBold:u},m),h,{clone:!1})}const Wc=.2,Gc=.14,Kc=.12;function ge(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Wc})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Gc})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Kc})`].join(",")}const Jc=["none",ge(0,2,1,-1,0,1,1,0,0,1,3,0),ge(0,3,1,-2,0,2,2,0,0,1,5,0),ge(0,3,3,-2,0,3,4,0,0,1,8,0),ge(0,2,4,-1,0,4,5,0,0,1,10,0),ge(0,3,5,-1,0,5,8,0,0,1,14,0),ge(0,3,5,-1,0,6,10,0,0,1,18,0),ge(0,4,5,-2,0,7,10,1,0,2,16,1),ge(0,5,5,-3,0,8,10,1,0,3,14,2),ge(0,5,6,-3,0,9,12,1,0,3,16,2),ge(0,6,6,-3,0,10,14,1,0,4,18,3),ge(0,6,7,-4,0,11,15,1,0,4,20,3),ge(0,7,8,-4,0,12,17,2,0,5,22,4),ge(0,7,8,-4,0,13,19,2,0,5,24,4),ge(0,7,9,-4,0,14,21,2,0,5,26,4),ge(0,8,9,-5,0,15,22,2,0,6,28,5),ge(0,8,10,-5,0,16,24,2,0,6,30,5),ge(0,8,11,-5,0,17,26,2,0,6,32,5),ge(0,9,11,-5,0,18,28,2,0,7,34,6),ge(0,9,12,-6,0,19,29,2,0,7,36,6),ge(0,10,13,-6,0,20,31,3,0,8,38,7),ge(0,10,13,-6,0,21,33,3,0,8,40,7),ge(0,10,14,-6,0,22,35,3,0,8,42,7),ge(0,11,14,-7,0,23,36,3,0,9,44,8),ge(0,11,15,-7,0,24,38,3,0,9,46,8)],Zc=["duration","easing","delay"],Xc={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Hc={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function xa(e){return`${Math.round(e)}ms`}function eu(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function tu(e){const t=Z({},Xc,e.easing),n=Z({},Hc,e.duration);return Z({getAutoHeightDuration:eu,create:(o=["all"],a={})=>{const{duration:i=n.standard,easing:l=t.easeInOut,delay:u=0}=a,d=tt(a,Zc);if(process.env.NODE_ENV!=="production"){const f=h=>typeof h=="string",p=h=>!isNaN(parseFloat(h));!f(o)&&!Array.isArray(o)&&console.error('MUI: Argument "props" must be a string or Array.'),!p(i)&&!f(i)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${i}.`),f(l)||console.error('MUI: Argument "easing" must be a string.'),!p(u)&&!f(u)&&console.error('MUI: Argument "delay" must be a number or a string.'),typeof a!="object"&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join(`
|
|
108
108
|
`)),Object.keys(d).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(d).join(",")}].`)}return(Array.isArray(o)?o:[o]).map(f=>`${f} ${typeof i=="string"?i:xa(i)} ${l} ${typeof u=="string"?u:xa(u)}`).join(",")}},e,{easing:t,duration:n})}const ru={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},nu=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function ou(e={},...t){const{mixins:n={},palette:r={},transitions:o={},typography:a={}}=e,i=tt(e,nu);if(e.vars)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name.":ut(18));const l=Vc(r),u=bn(e);let d=We(u,{mixins:zc(u.breakpoints,n),palette:l,shadows:Jc.slice(),typography:qc(l,a),transitions:tu(o),zIndex:Z({},ru)});if(d=We(d,i),d=t.reduce((f,p)=>We(f,p),d),process.env.NODE_ENV!=="production"){const f=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],p=(h,M)=>{let v;for(v in h){const g=h[v];if(f.indexOf(v)!==-1&&Object.keys(g).length>0){if(process.env.NODE_ENV!=="production"){const m=tn("",v);console.error([`MUI: The \`${M}\` component increases the CSS specificity of the \`${v}\` internal state.`,"You can not override it like this: ",JSON.stringify(h,null,2),"",`Instead, you need to use the '&.${m}' syntax:`,JSON.stringify({root:{[`&.${m}`]:g}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
109
109
|
`))}h[v]={}}}};Object.keys(d.components).forEach(h=>{const M=d.components[h].styleOverrides;M&&h.indexOf("Mui")===0&&p(M,h)})}return d.unstable_sxConfig=Z({},yn,i==null?void 0:i.unstable_sxConfig),d.unstable_sx=function(p){return vn({sx:p,theme:this})},d}const Ta=ou(),ja="$$material";function au({props:e,name:t}){return wc({props:e,name:t,defaultTheme:Ta,themeId:ja})}const iu=Oc({themeId:ja,defaultTheme:Ta,rootShouldForwardProp:e=>xr(e)&&e!=="classes"});function su(e){return tn("MuiSvgIcon",e)}gs("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const lu=["children","className","color","component","fontSize","htmlColor","inheritViewBox","titleAccess","viewBox"],cu=e=>{const{color:t,fontSize:n,classes:r}=e,o={root:["root",t!=="inherit"&&`color${Ge(t)}`,`fontSize${Ge(n)}`]};return ps(o,su,r)},uu=iu("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${Ge(n.color)}`],t[`fontSize${Ge(n.fontSize)}`]]}})(({theme:e,ownerState:t})=>{var n,r,o,a,i,l,u,d,f,p,h,M,v;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||(i=a.pxToRem)==null?void 0:i.call(a,20))||"1.25rem",medium:((l=e.typography)==null||(u=l.pxToRem)==null?void 0:u.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:(p=(h=(e.vars||e).palette)==null||(h=h[t.color])==null?void 0:h.main)!=null?p:{action:(M=(e.vars||e).palette)==null||(M=M.action)==null?void 0:M.active,disabled:(v=(e.vars||e).palette)==null||(v=v.action)==null?void 0:v.disabled,inherit:void 0}[t.color]}}),Tn=G.forwardRef(function(t,n){const r=au({props:t,name:"MuiSvgIcon"}),{children:o,className:a,color:i="inherit",component:l="svg",fontSize:u="medium",htmlColor:d,inheritViewBox:f=!1,titleAccess:p,viewBox:h="0 0 24 24"}=r,M=tt(r,lu),v=G.isValidElement(o)&&o.type==="svg",g=Z({},r,{color:i,component:l,fontSize:u,instanceFontSize:t.fontSize,inheritViewBox:f,viewBox:h,hasSvgAsChild:v}),m={};f||(m.viewBox=h);const x=cu(g);return c.jsxs(uu,Z({as:l,className:ms(x.root,a),focusable:"false",color:d,"aria-hidden":p?void 0:!0,role:p?"img":void 0,ref:n},m,M,v&&o.props,{ownerState:g,children:[v?o.props.children:o,p?c.jsx("title",{children:p}):null]}))});process.env.NODE_ENV!=="production"&&(Tn.propTypes={children:ue.node,classes:ue.object,className:ue.string,color:ue.oneOfType([ue.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),ue.string]),component:ue.elementType,fontSize:ue.oneOfType([ue.oneOf(["inherit","large","medium","small"]),ue.string]),htmlColor:ue.string,inheritViewBox:ue.bool,shapeRendering:ue.string,sx:ue.oneOfType([ue.arrayOf(ue.oneOfType([ue.func,ue.object,ue.bool])),ue.func,ue.object]),titleAccess:ue.string,viewBox:ue.string}),Tn.muiName="SvgIcon";const Da=Tn;function du(e,t){function n(r,o){return c.jsx(Da,Z({"data-testid":`${t}Icon`,ref:o},r,{children:e}))}return process.env.NODE_ENV!=="production"&&(n.displayName=`${t}Icon`),n.muiName=Da.muiName,G.memo(G.forwardRef(n))}const fu=pi(Object.freeze(Object.defineProperty({__proto__:null,capitalize:Ge,createChainedFunction:Gi,createSvgIcon:du,debounce:Ki,deprecatedPropType:Ji,isMuiElement:Zi,ownerDocument:xo,ownerWindow:Xi,requirePropFactory:Hi,setRef:To,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(`
|
|
110
|
-
`)),wo.configure(e)}},unstable_useEnhancedEffect:jo,unstable_useId:ts,unsupportedProp:rs,useControlled:ns,useEventCallback:os,useForkRef:as,useIsFocusVisible:fs},Symbol.toStringTag,{value:"Module"})));var Na;function ke(){return Na||(Na=1,function(e){"use client";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=fu}(Vr)),Vr}var pu=Ae;Object.defineProperty(Ur,"__esModule",{value:!0});var Ea=Ur.default=void 0,hu=pu(ke()),gu=c,mu=(0,hu.default)((0,gu.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.15zM5.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-.72zm2.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.55zM13 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.93z"}),"RotateLeftRounded");Ea=Ur.default=mu;var jn={},yu=Ae;Object.defineProperty(jn,"__esModule",{value:!0});var Oa=jn.default=void 0,vu=yu(ke()),bu=c,Mu=(0,vu.default)((0,bu.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.41l-2.82-2.83zM12 19c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm1-10H7c-1.1 0-2-.9-2-2s.9-2 2-2h6c1.1 0 2 .9 2 2s-.9 2-2 2z"}),"SaveRounded");Oa=jn.default=Mu;var Dn={},xu=Ae;Object.defineProperty(Dn,"__esModule",{value:!0});var Ca=Dn.default=void 0,Tu=xu(ke()),ju=c,Du=(0,Tu.default)((0,ju.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-2zm-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.01z"}),"SimCardDownloadRounded");Ca=Dn.default=Du;const wa=(e,t)=>{if(!e)return null;if(e.name===t)return e;const n=e.children||[];for(let r=0;r<n.length;r+=1){const o=n[r],a=wa(o,t);if(a)return a}return null},xt=(e,t)=>{var a,i,l,u,d;if(!e)return null;if(!t)return e;if(((a=e.attributes)==null?void 0:a.treePath)===t)return((i=e.attributes)==null?void 0:i.tree)||null;let n=null;const r=(l=e.attributes)==null?void 0:l.tree,o=(u=e.children)==null?void 0:u.length;if(r&&(n=xt((d=e.attributes)==null?void 0:d.tree,t)),o){const{children:f}=e;for(let p=0;p<f.length;p+=1){const h=f[p];if(n!==null)return n;n=xt(h,t)}}return n},jr=(e,t,n)=>{const r=xt(e,t);return wa(r,n)},Nu=(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)},Eu=({tree:e,path:t,name:n,child:r})=>{var u;const{attributes:o,children:a}=r;if(!e)return a.length?{...r}:{...r,attributes:{...o,isLeaf:!0,isRoot:!0}};const i=structuredClone(e),l=jr(i,t,n);return Nu(l,{...r,...!o.isDecision&&{children:[...((u=jr(e,t,n))==null?void 0:u.children)||[]]}}),i},Ia=(e,t,n=null)=>{if(!e)return null;if(e.name===t)return n;const r=e.children||[];for(let o=0;o<r.length;o+=1){const a=r[o],i=Ia(a,t,e);if(i!==null)return i}return null},Ou=(e,t)=>(!e||!t||(Object.defineProperty(e,"children",{value:e.children.filter(n=>n.name!==t.name)}),Object.defineProperty(e,"attributes",{value:{...e.attributes,isLeaf:!0}})),null),Cu=(e,t,n)=>{const r=xt(e,t);return Ia(r,n)},wu=({tree:e,path:t,name:n})=>{const r=structuredClone(e),o=jr(r,t,n),a=Cu(r,t,n);return Ou(a,o),r},Iu=e=>{if(!e)return[];const t=[],n=r=>{if(r.name&&t.push(r.name),r.children.length){const{children:o}=r;for(let a=0;a<o.length;a+=1)n(o[a])}};return n(e),t},Au=(e,t)=>{if(!e)return null;const n=t.attributes.isDecision,r=e.attributes.isDecision,o=e.attributes.depth===0,a={value:t.name},i=r||n,l=i?{value:[...t.children]}:{value:[...e.children]},u=i?{value:{...t.attributes,isLeaf:!t.children.length||!n,isRoot:o}}:{value:{...t.attributes,isLeaf:!e.children.length,isRoot:o}};return Object.defineProperties(e,{attributes:u,children:l,name:a}),null},Su=({tree:e,path:t,name:n,child:r})=>{const o=structuredClone(e),a=jr(o,t,n);return Au(a,r),o},et={appendTreeCard:"appendTreeCard",deleteTreeCard:"deleteTreeCard",replaceTreeCard:"replaceTreeCard",resetTree:"resetTree",setTree:"setTree"},ku=(e,t,n)=>({children:n,name:t,path:e,type:et.appendTreeCard}),zu=(e,t,n)=>({children:n,name:t,path:e,type:et.replaceTreeCard}),_u=(e,t)=>({name:t,path:e,type:et.deleteTreeCard}),Aa=()=>({type:et.resetTree}),Sa=e=>({tree:e,type:et.setTree}),Ru=(e,t)=>{switch(t.type){case et.appendTreeCard:{const{name:n,path:r,children:o}=t;return Eu({child:o,name:n,path:r,tree:e})}case et.deleteTreeCard:{const{path:n,name:r}=t;return wu({name:r,path:n,tree:e})}case et.replaceTreeCard:{const{name:n,path:r,children:o}=t;return Su({child:o,name:n,path:r,tree:e})}case et.resetTree:return null;case et.setTree:return t.tree;default:throw new Error}},Nn=()=>{const{dispatchSnackbar:e}=N.useContext(Kn);return{close:()=>e(Jn()),open:(r,o="success")=>e(Ti(r,o))}},Lu=e=>{const{backendConfig:t}=Ce(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return lt.useMutation(["patchWorkflow"],async o=>{const{data:a}=await ct.patch(r,o);return a},e)},$u=e=>{const{backendConfig:t}=Ce(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return lt.useMutation(["postWorkflow"],async o=>{const{data:a}=await ct.post(r,o);return a},e)},Pu=()=>{const{t:e}=$e.useTranslation(["snackMessage"]),{open:t}=Nn(),{setCurrentTree:n,currentTree:r,tree:o,dispatchTree:a}=Ce(),[i,l]=N.useState(!1),{version:u}=Ce(),{mutate:d}=$u({onError:()=>{t(e("error.saveTree",{ns:"snackMessage"}),"error")},onSuccess:x=>{t(e("success.saveTree",{ns:"snackMessage"})),n(O=>({...O,id:x.workflow_id}))}}),{mutate:f}=Lu({onError:()=>{t(e("error.updateTree",{ns:"snackMessage"}),"error")},onSuccess:()=>{t(e("success.updateTree",{ns:"snackMessage"}))}}),p=x=>JSON.stringify(x,null,2),h=x=>`data:text/json;charset=utf-8,${encodeURIComponent(p(x))}`,M=()=>{l(!1)};return{formatJSON:p,getDownloadLink:h,handleClose:M,handleOpen:()=>{l(!0)},handleResetTree:()=>{a(Aa()),M()},handleSubmit:()=>{const{name:x,id:O}=r;if(!x){n(I=>({...I,errorName:"Champs Requis"}));return}if(o){if(O){f({id:O,label:x,version:u,workflow:o});return}d({label:x,version:u,workflow:o})}},openModal:i}},Yu=({downloadedFileName:e="export",value:t})=>{const{t:n}=$e.useTranslation(),{getDownloadLink:r,handleSubmit:o,handleClose:a,handleOpen:i,handleResetTree:l,openModal:u}=Pu(),{currentTree:d,backendConfig:f,tree:p}=Ce(),{id:h}=d;return c.jsxs(y.Stack,{direction:"row",spacing:2,justifyContent:"center",children:[c.jsx(y.Tooltip,{title:n("resetTree",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:c.jsx(y.Box,{children:c.jsx(y.Button,{disabled:!p,onClick:i,variant:"outlined",color:"warning",children:c.jsx(Ea,{})})})}),c.jsx(y.Divider,{orientation:"vertical",flexItem:!0}),c.jsx(y.Tooltip,{title:n("downloadJSONFile",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:c.jsx(y.Box,{children:c.jsx(y.Button,{variant:"outlined",href:r(t),download:`${e}.json`,disabled:!t,children:c.jsx(Ca,{})})})}),c.jsx(y.Tooltip,{title:h?n("update",{ns:"button"}):n("save",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:c.jsx(y.Box,{children:c.jsx(y.Button,{variant:"outlined",onClick:o,disabled:!t||!(f!=null&&f.baseUrl),children:c.jsx(Oa,{})})})}),c.jsxs(y.Dialog,{maxWidth:"xs",fullWidth:!0,open:u,onClose:a,children:[c.jsx(y.DialogTitle,{variant:"h3",children:n("resetTree",{ns:"button"})}),c.jsx(y.DialogContent,{children:c.jsx(y.DialogContentText,{children:n("resetTreeContent",{ns:"modal"})})}),c.jsxs(y.DialogActions,{children:[c.jsx(y.Button,{onClick:a,children:n("close",{ns:"button"})}),c.jsx(y.Button,{variant:"contained",color:"warning",onClick:l,children:n("reset",{ns:"button"})})]})]})]})},Fu={box:{backgroundColor:ce.background,border:`solid 1px ${ce.borderBlue}`}},ka=({children:e,description:t,open:n,onClose:r,title:o})=>c.jsx(y.Dialog,{open:n,onClose:r,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",scroll:"body",maxWidth:"sm",fullWidth:!0,children:c.jsxs(y.Box,{sx:Fu.box,p:4,children:[c.jsx("h3",{children:o}),c.jsx("p",{children:t}),e]})});var En={},Uu=Ae;Object.defineProperty(En,"__esModule",{value:!0});var za=En.default=void 0,Vu=Uu(ke()),Qu=c,Bu=(0,Vu.default)((0,Qu.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.4z"}),"CloseRounded");za=En.default=Bu;const Dr={container:{display:"flex",flexDirection:"column",height:"100%",margin:1},main:{border:`solid 1px ${ce.borderBlue}`,height:" 100%",margin:1},toolbar:{backgroundColor:ce.background,boxShadow:"none",display:"flex",padding:"0 ! important"},toolbarBox:{backgroundColor:ce.tertiary,border:`solid 1px ${ce.primary}`,margin:1,paddingX:2,paddingY:1,width:"100%"}},qu=({children:e,appear:t,in:n,onEnter:r,onExited:o,onFocus:a,role:i,tabIndex:l,timeout:u},d)=>c.jsx(y.Slide,{direction:"up",ref:d,appear:t,in:n,onEnter:r,onExited:o,onFocus:a,role:i,tabIndex:l,timeout:u,children:e}),Wu=N.forwardRef(qu),Gu=({children:e,open:t,onClose:n,title:r})=>c.jsx(y.Dialog,{PaperProps:{sx:{backgroundColor:ce.background,backgroundImage:"none"}},open:t,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",fullScreen:!0,TransitionComponent:Wu,children:c.jsxs(y.Box,{sx:Dr.container,children:[c.jsx(y.AppBar,{position:"sticky",elevation:0,children:c.jsx(y.Toolbar,{sx:Dr.toolbar,children:c.jsxs(y.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:Dr.toolbarBox,children:[c.jsx(y.Typography,{variant:"h5",children:c.jsx("strong",{children:r})}),c.jsx(y.IconButton,{edge:"end",color:"inherit",onClick:n,"aria-label":"close",children:c.jsx(za,{})})]})})}),c.jsx(y.Box,{sx:Dr.main,children:e})]})}),Ku={box:{border:`solid 1px ${ce.borderBlue}`,flexGrow:0}},Ju=({children:e})=>c.jsx(y.Box,{p:2,role:"group",sx:Ku.box,children:e}),Zu={box:{border:`solid 1px ${ce.borderBlue}`,flexGrow:0}},Xu=({children:e})=>c.jsx(y.Box,{sx:Zu.box,padding:2,component:"header",children:e}),Hu={box:{border:`solid 1px ${ce.borderBlue}`,flexGrow:1}},ed=({children:e})=>c.jsx(y.Box,{sx:Hu.box,component:"main",role:"tree",children:e}),_a={stack:{width:"100%"}},td=({children:e})=>{const t=N.Children.toArray(e);return c.jsxs(y.Grid,{container:!0,padding:1,flexWrap:"nowrap",height:"100%",role:"treegrid",children:[c.jsx(y.Grid,{item:!0,xs:9,padding:1,display:"flex",children:c.jsxs(y.Stack,{sx:_a.stack,spacing:2,children:[t[0],t[1]]})}),c.jsx(y.Grid,{item:!0,xs:3,padding:1,display:"flex",children:c.jsxs(y.Stack,{sx:_a.stack,spacing:2,children:[t[2],t[3]]})})]})},rd={box:{border:`solid 1px ${ce.borderBlue}`,flexGrow:1,overflow:"auto"}},nd=({children:e})=>c.jsx(y.Box,{sx:rd.box,component:"aside",children:e}),od=()=>{const{dispatchTree:e,setModalOpen:t,currentHierarchyPointNode:n,treePath:r}=Ce();return{handleSubmit:a=>{var u,d;a.preventDefault();const i=((u=n==null?void 0:n.data)==null?void 0:u.name)||"",l=((d=r==null?void 0:r.at(-1))==null?void 0:d.path)||"";e(_u(l,i)),t(null)}}},ad=({onClose:e})=>{const{t}=$e.useTranslation(),{handleSubmit:n}=od();return c.jsx("form",{onSubmit:n,children:c.jsxs(y.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:[c.jsx(y.Button,{variant:"text",onClick:e,children:t("cancel")}),c.jsx(y.Button,{variant:"contained",color:"error",type:"submit",children:t("remove")})]})})};var On={},id=Ae;Object.defineProperty(On,"__esModule",{value:!0});var Ra=On.default=void 0,sd=id(ke()),ld=c,cd=(0,sd.default)((0,ld.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4 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 1z"}),"AddCircleRounded");Ra=On.default=cd;var Cn={},ud=Ae;Object.defineProperty(Cn,"__esModule",{value:!0});var La=Cn.default=void 0,dd=ud(ke()),fd=c,pd=(0,dd.default)((0,fd.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4 11H8c-.55 0-1-.45-1-1s.45-1 1-1h8c.55 0 1 .45 1 1s-.45 1-1 1z"}),"RemoveCircleRounded");La=Cn.default=pd;const Yt=[{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,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:"time"},{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"}],hd=()=>{const{backendConfig:e}=Ce();return{fields:N.useCallback(()=>Yt.filter(n=>!(n.type==="tree"&&!(e!=null&&e.baseUrl))),[e==null?void 0:e.baseUrl])()}},gd=({onChange:e,value:t})=>{const{t:n}=$e.useTranslation(["translation","form"]),{fields:r}=hd();return c.jsxs(y.FormControl,{sx:{flex:1},required:!0,children:[c.jsx(y.InputLabel,{children:n("type")}),c.jsx(y.Select,{value:t,label:n("type"),onChange:e,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:r.map(({type:o,isDecisionField:a})=>c.jsxs(y.MenuItem,{value:o,children:[n(`type.${o}`,{ns:"form"}),a&&c.jsx(y.Chip,{label:n("decisionField",{ns:"form"}),size:"small",color:"info",sx:{marginLeft:1}})]},o))})]})},md=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:i}=r;for(let l=0;l<i.length;l+=1)n(i[l])}};return n(e),[...t]},yd=y.createFilterOptions(),vd=({value:e,onChange:t})=>{const{t:n}=$e.useTranslation(["translation","form"]),{tree:r}=Ce(),o=md(r).reduce((a,i)=>[...a,{inputValue:i,label:i}],[]);return c.jsx(y.Autocomplete,{freeSolo:!0,fullWidth:!0,value:e,onChange:t,filterOptions:(a,i)=>{const l=yd(a,i),{inputValue:u}=i,d=a.some(f=>typeof f!="string"&&u===f.label);return u!==""&&!d&&l.push({inputValue:u,label:`${n("add")} "${u}"`}),l},getOptionLabel:a=>typeof a=="string"?a:a.inputValue?a.inputValue:a.label,renderOption:(a,i)=>c.jsx("li",{...a,children:typeof i!="string"&&i.label}),renderInput:a=>c.jsx(y.TextField,{...a,label:n("tag")}),options:o})};var wn={},bd=Ae;Object.defineProperty(wn,"__esModule",{value:!0});var $a=wn.default=void 0,Md=bd(ke()),xd=c,Td=(0,Md.default)((0,xd.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 1z"}),"AddRounded");$a=wn.default=Td;const jd=e=>{const{backendConfig:t}=Ce(),{endpoints:n}=t||{},{workflows:r=""}=n||{};return lt.useQuery(["workflows"],async({signal:o})=>{const{data:a}=await ct.get(r,{signal:o});return a},e)},Dd=({isControlled:e,fetchWorkflowsOnOpen:t})=>{const{t:n}=$e.useTranslation("snackMessage"),{open:r}=Nn(),{currentTree:o,setCurrentTree:a,dispatchTree:i}=Ce(),[l,u]=N.useState(""),d=!!l&&!e&&l!==o.id,{data:f,isError:p}=Zt(l,{enabled:d}),{data:h,isLoading:M,refetch:v}=jd({enabled:!t}),g=N.useCallback(async({target:x})=>{var I;const{value:O}=x;if(O==="add-new-tree"){u(""),a({name:""}),i(Aa());return}u(O),a({id:O,name:(I=h==null?void 0:h.find(A=>A.id===O))==null?void 0:I.label})},[i,a,h]),m=N.useCallback(async()=>{if(t)try{await v(),o.id&&!l&&u(o.id)}catch{r(n("error.fetchTree",{ns:"snackMessage"}),"error")}},[t,v,o.id,l,r,n]);return N.useEffect(()=>{if(f&&l!==o.id){const{id:x,label:O,workflow:I}=f;a({id:x,name:O}),i(Sa(I))}},[o.id,i,e,a,l,f]),N.useEffect(()=>{p&&r(n("error.fetchTree",{ns:"snackMessage"}),"error")},[p,r,n]),{currentTree:o,fetchWorkflowSuggestions:v,handleChangeTree:g,handleOnOpen:m,setTreeSelected:u,treeSelected:l,workflowsSuggestions:h,workflowsSuggestionsLoading:M}},Pa={formControl:{flex:1},select:{".MuiOutlinedInput-notchedOutline":{border:0,paddingLeft:5},".MuiSelect-select":{opacity:0,width:0},boxShadow:"none"}},Ya=({arrowOnly:e,required:t,size:n,showBtnAddNewTree:r,onChange:o,value:a,fetchWorkflowsOnOpen:i})=>{const{t:l}=$e.useTranslation("form"),u=N.useMemo(()=>!!o,[o]),{handleChangeTree:d,handleOnOpen:f,workflowsSuggestions:p,workflowsSuggestionsLoading:h,treeSelected:M}=Dd({fetchWorkflowsOnOpen:i,isControlled:u});return c.jsxs(y.FormControl,{size:n,required:t,sx:Pa.formControl,children:[!e&&c.jsx(y.InputLabel,{children:l("tree",{ns:"form"})}),c.jsxs(y.Select,{value:u?a:M,id:"tree-select",onChange:v=>u?o==null?void 0:o(v):d(v),sx:e?Pa.select:void 0,label:l("tree",{ns:"form"}),onOpen:f,children:[(a&&h||h)&&c.jsx(y.MenuItem,{value:a,children:c.jsx(y.Skeleton,{width:"100%"})}),p==null?void 0:p.map(({label:v,id:g})=>c.jsx(y.MenuItem,{value:g,children:v},g)),r&&c.jsx(y.MenuItem,{disabled:!0,children:c.jsx(y.Box,{sx:{height:1,width:"100%"},children:c.jsx(y.Divider,{})})}),r&&c.jsxs(y.MenuItem,{value:"add-new-tree",children:[c.jsx(y.Typography,{mr:1,children:l("newTree",{ns:"form"})}),c.jsx($a,{color:"primary"})]})]})]})},Nd=({helperText:e,hiddenValue:t,isHiddenField:n,isTreeField:r,treeSelected:o,handleChangeTreeSelect:a,handleChangeHelperText:i,handleChangeHiddenValue:l})=>{const{t:u}=$e.useTranslation(["translation","form"]);return r?c.jsx(Ya,{required:!0,value:o,onChange:a}):n?c.jsx(y.TextField,{required:!0,sx:{flex:1},label:u("hiddenValue",{ns:"form"}),onChange:l,value:t}):c.jsx(y.TextField,{sx:{flex:1},label:u("helperText",{ns:"form"}),onChange:i,value:e})},Fa=e=>new Set([...e]).size===e.length,Ed=(e,t,n)=>{const r=[...e,t];return Fa(n?r.filter(o=>o!==n):r)},Od=()=>{var Ar,Sr,kr,zr,Dt,Vt,nt,Nt,Et,Qt,_r,Bt,Rr,qt,Wt,Lr,$r;const e=N.useMemo(()=>[{id:"0",label:"",message:"",value:""}],[]),{tree:t,dispatchTree:n,currentHierarchyPointNode:r,modalOpen:o,treePath:a,setModalOpen:i}=Ce(),{open:l}=Nn(),{t:u}=$e.useTranslation(),[d,f]=N.useState(e),[p,h]=N.useState(""),[M,v]=N.useState(""),[g,m]=N.useState(""),[x,O]=N.useState(!1),[I,A]=N.useState(!1),[b,W]=N.useState("text"),[z,Te]=N.useState(null),[he,_]=N.useState(""),[se,me]=N.useState(""),[de,le]=N.useState(""),[Me,xe]=N.useState({off:"",on:""}),[Ee,_e]=N.useState(!1),[Ye,j]=N.useState(""),w=o==="edit",L=b==="tree",$=b==="hidden",R=Yt.some(C=>C.type===b&&(C==null?void 0:C.isBooleanField)),U=Yt.some(C=>C.type===b&&(C==null?void 0:C.isDecisionField)),P=Yt.some(C=>C.type===b&&(C==null?void 0:C.isRequiredDisabled)),F=Yt.some(C=>C.type===b&&(C==null?void 0:C.isRepeatableDisabled)),Y=((Sr=(Ar=r==null?void 0:r.data)==null?void 0:Ar.attributes)==null?void 0:Sr.isLeaf)??!0,Q=N.useCallback(C=>!U&&C>0,[U]),{refetch:V,isInitialLoading:Ne}=Zt(he,{enabled:!1,onError:()=>{l(u("error.fetchTree",{ns:"snackMessage"}),"error")}}),E=N.useCallback((C,K)=>{f(ie=>ie.map(ye=>{const{id:Le}=ye;return C.target.dataset.id===Le?{...ye,id:Le,[K]:C.target.value}:{...ye}}))},[]),Re=N.useCallback((C,K)=>{typeof K=="string"?Te(K):K&&K.inputValue?Te(K.inputValue):Te(null)},[]),S=N.useCallback(C=>{v(C.target.value)},[]),Qe=N.useCallback(C=>{m(C.target.value)},[]),Je=N.useCallback(C=>{E(C,"label")},[E]),it=N.useCallback(C=>{E(C,"value")},[E]),Nr=N.useCallback(C=>{E(C,"message")},[E]),Tt=N.useCallback(C=>{le(C.target.value)},[]),Yn=N.useCallback(C=>{var D;const{value:K}=C.target;if(h(C.target.value),!t||!K){j("");return}const ie=w&&(r==null?void 0:r.data.name),ye=(D=a==null?void 0:a.at(-1))==null?void 0:D.path,Le=xt(t,ye),s=Iu(Le);if(Ed(s,K,ie)){j("");return}j(u("mustBeUnique",{ns:"form"}))},[r==null?void 0:r.data.name,w,u,t,a]),Fn=N.useCallback(C=>{O(C.target.checked)},[]),Ft=N.useCallback(C=>{A(C.target.checked)},[]),Un=N.useCallback(C=>{_e(C.target.checked)},[]),Vn=N.useCallback(C=>{W(C.target.value),A(!1),O(!1),_e(!1)},[]),Er=N.useCallback(C=>{_(C.target.value)},[]),Or=N.useCallback(C=>K=>{xe(ie=>({...ie,[C]:K.target.value}))},[]),st=N.useCallback(C=>{me(C.target.value)},[]),Qn=N.useCallback(()=>{f(C=>{const K=Number(C[C.length-1].id),ie=String(K+1);return[...C,{...e[0],id:ie}]})},[e]),Cr=N.useCallback(C=>{f(K=>K.filter(({id:ie})=>C.currentTarget.value!==ie))},[]),Ut=N.useCallback((C,K)=>{var ye,Le,s;const ie=(s=(Le=(ye=C==null?void 0:C.children)==null?void 0:ye[K])==null?void 0:Le.data)==null?void 0:s.children;return ie?ie.map(({name:T,attributes:D,children:k})=>({attributes:D,children:k,name:T})):[]},[]),jt=N.useCallback(C=>{var K;return I?(K=d==null?void 0:d.filter((ie,ye)=>!Q(ye)))==null?void 0:K.map(({message:ie,value:ye,label:Le},s)=>{const T=`${p}:${ye}`,D=Ut(r,s);return{attributes:{depth:C+1,label:Le,value:ye,...ie&&{message:ie},...D.length===0&&{isLeaf:!0}},children:D,name:T}}):[]},[r,Q,Ut,I,p,d]),wr=N.useCallback(C=>C.map(({message:K,...ie})=>({...ie,...K&&{message:K}})),[]),Ir=N.useCallback((C,K,ie)=>{var ye;return C&&(!K||ie)?V():C&&K&&!ie?{data:{workflow:(ye=r==null?void 0:r.data.attributes)==null?void 0:ye.tree},isError:null}:{data:null,isError:null}},[(kr=r==null?void 0:r.data.attributes)==null?void 0:kr.tree,V]),Bn=N.useCallback(async C=>{var fe,pe,Ie,Be;C.preventDefault();const{on:K,off:ie}=Me,ye=((fe=r==null?void 0:r.data)==null?void 0:fe.name)||"",Le=(r==null?void 0:r.depth)||0,s=o==="edit",T=Le+(s||r===null?0:1),D=jt(T),k=(pe=a==null?void 0:a.at(-1))==null?void 0:pe.path,J=a.length?`${k}/${p}`:`/${p}`,X=((Be=(Ie=r==null?void 0:r.data.attributes)==null?void 0:Ie.tree)==null?void 0:Be.treeId)!==he,{data:B,isError:q}=await Ir(L,s,X);if(q)return;const je={attributes:{depth:T,label:g,type:b,...se&&{helperText:se},...(ie||K)&&{messages:{...ie&&{off:ie},...K&&{on:K}}},...L&&{tree:{...B==null?void 0:B.workflow,treeId:he},treePath:J},...I&&{isDecision:I},...U&&!I&&{values:wr(d)},...x&&{required:x},...de&&{step:de},...Ee&&{repeatable:Ee},...$&&{hiddenValue:M},...z&&{tag:z}},children:D,name:p};n(s?zu(k||"",ye,je):ku(k||null,ye,je)),i(null)},[r,n,jt,wr,Ir,se,M,I,U,$,L,g,Me,o,p,Ee,x,i,de,z,a,he,b,d]);return N.useEffect(()=>{var C,K,ie,ye,Le,s,T,D,k,J,X,B,q,je,fe,pe,Ie,Be,Gt,qe;if(o==="edit"){const Pr=((K=(C=r==null?void 0:r.data)==null?void 0:C.attributes)==null?void 0:K.values)||((Le=(ye=(ie=r==null?void 0:r.data)==null?void 0:ie.children)==null?void 0:ye.filter(({attributes:Kt})=>!(Kt!=null&&Kt.type)))==null?void 0:Le.map(({attributes:Kt},Sf)=>{const{label:kf,value:zf,message:ai}=Kt||{};return{id:String(Sf),label:String(kf),value:String(zf),...ai&&{message:String(ai)}}}));h((r==null?void 0:r.data.name)||""),Te(((s=r==null?void 0:r.data.attributes)==null?void 0:s.tag)||null),W(((T=r==null?void 0:r.data.attributes)==null?void 0:T.type)||"text"),me(((D=r==null?void 0:r.data.attributes)==null?void 0:D.helperText)||""),O(((k=r==null?void 0:r.data.attributes)==null?void 0:k.required)||!1),le(((J=r==null?void 0:r.data.attributes)==null?void 0:J.step)||""),m(((X=r==null?void 0:r.data.attributes)==null?void 0:X.label)||""),A(((B=r==null?void 0:r.data.attributes)==null?void 0:B.isDecision)||!1),f(Pr!=null&&Pr.length?Pr:e),xe({off:((je=(q=r==null?void 0:r.data.attributes)==null?void 0:q.messages)==null?void 0:je.off)||"",on:((pe=(fe=r==null?void 0:r.data.attributes)==null?void 0:fe.messages)==null?void 0:pe.on)||""}),_(((Be=(Ie=r==null?void 0:r.data.attributes)==null?void 0:Ie.tree)==null?void 0:Be.treeId)||""),_e(((Gt=r==null?void 0:r.data.attributes)==null?void 0:Gt.repeatable)||!1),v(((qe=r==null?void 0:r.data.attributes)==null?void 0:qe.hiddenValue)||"")}},[(Dt=(zr=r==null?void 0:r.data.attributes)==null?void 0:zr.tree)==null?void 0:Dt.treeId,(Vt=r==null?void 0:r.data.attributes)==null?void 0:Vt.messages,(nt=r==null?void 0:r.data.attributes)==null?void 0:nt.helperText,(Nt=r==null?void 0:r.data.attributes)==null?void 0:Nt.isDecision,(Et=r==null?void 0:r.data.attributes)==null?void 0:Et.label,(Qt=r==null?void 0:r.data.attributes)==null?void 0:Qt.required,(_r=r==null?void 0:r.data.attributes)==null?void 0:_r.step,(Bt=r==null?void 0:r.data.attributes)==null?void 0:Bt.type,(Rr=r==null?void 0:r.data.attributes)==null?void 0:Rr.values,(qt=r==null?void 0:r.data)==null?void 0:qt.children,r==null?void 0:r.data.name,(Wt=r==null?void 0:r.data.attributes)==null?void 0:Wt.tag,(Lr=r==null?void 0:r.data.attributes)==null?void 0:Lr.repeatable,($r=r==null?void 0:r.data.attributes)==null?void 0:$r.hiddenValue,e,o]),{getDisabledValueField:Q,handleAddValue:Qn,handleChangeHelperText:st,handleChangeHiddenValue:S,handleChangeIsDecisionField:Ft,handleChangeLabel:Qe,handleChangeMessage:Or,handleChangeName:Yn,handleChangeOptionLabel:Je,handleChangeOptionMessage:Nr,handleChangeOptionValue:it,handleChangeRepeatable:Un,handleChangeRequired:Fn,handleChangeStep:Tt,handleChangeTag:Re,handleChangeTreeSelect:Er,handleChangeType:Vn,handleDeleteValue:Cr,handleSubmit:Bn,helperText:se,hiddenValue:M,isBooleanField:R,isDecision:I,isDecisionField:U,isEditModal:w,isHiddenField:$,isLeaf:Y,isRepeatableDisabled:F,isRequiredDisabled:P,isTreeField:L,isWorkflowLoading:Ne,label:g,messages:Me,name:p,repeatable:Ee,required:x,step:de,tag:z,treeSelected:he,type:b,uniqueNameErrorMessage:Ye,values:d}},Ua={marginRight:"-20px !important",minWidth:"auto !important"},Va={iconButton:Ua,iconButtonDelete:{...Ua,"&:before":{borderRadius:"50%",content:'""',height:20,position:"absolute",width:20,zIndex:-1},backgroundColor:ce.background,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)"}},Cd=({onClose:e})=>{const{t}=$e.useTranslation(["translation","form"]),{values:n,required:r,name:o,tag:a,uniqueNameErrorMessage:i,type:l,helperText:u,label:d,hiddenValue:f,isBooleanField:p,isDecision:h,isEditModal:M,isDecisionField:v,isHiddenField:g,isRequiredDisabled:m,isRepeatableDisabled:x,isTreeField:O,treeSelected:I,isWorkflowLoading:A,repeatable:b,isLeaf:W,messages:{on:z,off:Te},handleChangeTreeSelect:he,handleChangeHelperText:_,handleChangeOptionMessage:se,handleChangeRequired:me,handleChangeName:de,handleChangeType:le,handleChangeIsDecisionField:Me,handleChangeOptionLabel:xe,handleDeleteValue:Ee,handleChangeOptionValue:_e,handleChangeMessage:Ye,handleSubmit:j,handleAddValue:w,handleChangeLabel:L,handleChangeRepeatable:$,handleChangeHiddenValue:R,handleChangeTag:U}=Od();return c.jsxs("form",{onSubmit:j,children:[c.jsxs(y.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[c.jsx(y.TextField,{sx:{flex:1},label:t("label",{ns:"form"}),onChange:L,value:d,required:!0}),c.jsx(y.TextField,{label:t("name"),sx:{flex:1},onChange:de,value:o,error:!!i,helperText:i,required:!0})]}),c.jsxs(y.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[c.jsx(gd,{value:l,onChange:le}),c.jsx(Nd,{helperText:u,hiddenValue:f,isHiddenField:g,isTreeField:O,treeSelected:I,handleChangeTreeSelect:he,handleChangeHelperText:_,handleChangeHiddenValue:R})]}),c.jsx(y.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:c.jsx(vd,{value:a,onChange:U})}),p&&c.jsxs(y.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[c.jsx(y.TextField,{sx:{flex:1},label:t("onMessage",{ns:"form"}),onChange:Ye("on"),value:z}),c.jsx(y.TextField,{sx:{flex:1},label:t("offMessage",{ns:"form"}),onChange:Ye("off"),value:Te})]}),c.jsxs(y.Stack,{paddingY:1,children:[c.jsx(y.FormGroup,{children:c.jsx(y.FormControlLabel,{disabled:x,control:c.jsx(y.Checkbox,{checked:b,onChange:$}),label:t("repeatable",{ns:"form"})})}),c.jsx(y.FormGroup,{children:c.jsx(y.FormControlLabel,{disabled:m,control:c.jsx(y.Checkbox,{checked:r,onChange:me}),label:t("required")})}),(W||M)&&c.jsx(y.FormGroup,{children:c.jsx(y.FormControlLabel,{disabled:!v,control:c.jsx(y.Checkbox,{checked:h,onChange:Me}),label:t("decisionField",{ns:"form"})})})]}),v&&c.jsxs(c.Fragment,{children:[c.jsx("h4",{children:t("values")}),n==null?void 0:n.map(({value:P,label:F,id:Y,message:Q})=>c.jsxs(y.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[c.jsx(y.TextField,{label:t("label",{ns:"form"}),sx:{flex:1},onChange:xe,value:F,inputProps:{"data-id":Y},required:!0}),c.jsx(y.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:_e,value:P,inputProps:{"data-id":Y},required:!0}),c.jsx(y.TextField,{label:"Message",sx:{flex:1},onChange:se,value:Q,inputProps:{"data-id":Y}}),n.length>1&&c.jsx(y.IconButton,{color:"warning",sx:Va.iconButtonDelete,value:Y,onClick:Ee,children:c.jsx(La,{})})]},Y))]}),v&&c.jsx(y.Box,{justifyContent:"flex-end",display:"flex",children:c.jsx(y.IconButton,{color:"success",sx:Va.iconButton,onClick:w,children:c.jsx(Ra,{})})}),c.jsxs(y.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",paddingTop:3,children:[c.jsx(y.Button,{variant:"text",onClick:e,children:t("cancel")}),c.jsx(y.Button,{variant:"contained",type:"submit",disabled:!!i||A,isLoading:A,loadingIndicator:c.jsx(y.CircularProgress,{size:14}),children:t("validate")})]})]})};var In={},wd=Ae;Object.defineProperty(In,"__esModule",{value:!0});var Qa=In.default=void 0,Id=wd(ke()),Ad=c,Sd=(0,Id.default)((0,Ad.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 2z"}),"AccountTreeRounded");Qa=In.default=Sd;var An={},kd=Ae;Object.defineProperty(An,"__esModule",{value:!0});var Ba=An.default=void 0,zd=kd(ke()),_d=c,Rd=(0,zd.default)((0,_d.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-2zm-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 1z"}),"AddBoxRounded");Ba=An.default=Rd;var Sn={},Ld=Ae;Object.defineProperty(Sn,"__esModule",{value:!0});var qa=Sn.default=void 0,$d=Ld(ke()),Pd=c,Yd=(0,$d.default)((0,Pd.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 2v10zM9 9h6c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-8c0-.55.45-1 1-1zm6.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-1h-2.5z"}),"DeleteOutlineRounded");qa=Sn.default=Yd;var kn={},Fd=Ae;Object.defineProperty(kn,"__esModule",{value:!0});var Wa=kn.default=void 0,Ud=Fd(ke()),Vd=c,Qd=(0,Ud.default)((0,Vd.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.36zM20.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.75 1.83-1.83z"}),"EditRounded");Wa=kn.default=Qd;var zn={},Bd=Ae;Object.defineProperty(zn,"__esModule",{value:!0});var Ga=zn.default=void 0,qd=Bd(ke()),Wd=c,Gd=(0,qd.default)((0,Wd.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-2h-7zm3.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.89z"}),"EnergySavingsLeafRounded");Ga=zn.default=Gd;var _n={},Kd=Ae;Object.defineProperty(_n,"__esModule",{value:!0});var Ka=_n.default=void 0,Jd=Kd(ke()),Ja=c,Zd=(0,Jd.default)([(0,Ja.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.54L14.14 12z"},"0"),(0,Ja.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.54zM13 20c0 1.1.9 2 2 2s2-.9 2-2v-1h-4v1z"},"1")],"ForestRounded");Ka=_n.default=Zd;var Rn={},Xd=Ae;Object.defineProperty(Rn,"__esModule",{value:!0});var Za=Rn.default=void 0,Hd=Xd(ke()),ef=c,tf=(0,Hd.default)((0,ef.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-8zm0 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.36V18z"}),"LoopRounded");Za=Rn.default=tf;var Ln={},rf=Ae;Object.defineProperty(Ln,"__esModule",{value:!0});var Xa=Ln.default=void 0,nf=rf(ke()),of=c,af=(0,nf.default)((0,of.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.55L16.96 12z"}),"ParkRounded");Xa=Ln.default=af;var $n={},sf=Ae;Object.defineProperty($n,"__esModule",{value:!0});var Ha=$n.default=void 0,lf=sf(ke()),cf=c,uf=(0,lf.default)((0,cf.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-.24zM2.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 0zM12 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.5zm2.97-5.33c-.15-1.4-1.25-2.49-2.64-2.64l2.64 2.64z"}),"VisibilityOffRounded");Ha=$n.default=uf;var Pn={},df=Ae;Object.defineProperty(Pn,"__esModule",{value:!0});var ei=Pn.default=void 0,ff=df(ke()),pf=c,hf=(0,ff.default)((0,pf.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 4zm0 12.5c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}),"VisibilityRounded");ei=Pn.default=hf;const we={actionButton:{minWidth:"auto !important"},container:{background:ce.background,borderRadius:"1rem"},containerField:{background:ce.background,border:`solid 1px ${ce.primary}`,borderRadius:"1rem"},containerHidden:{background:ce.background,border:`solid 1px ${ce.borderGrey}`,borderRadius:"1rem"},containerTree:{background:ce.tertiary,border:`solid 1px ${ce.primary}`,borderRadius:"1rem"},containerValue:{background:ce.background,border:`solid 1px ${ce.secondary}`,borderRadius:"1rem"},icon:{color:ce.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}},gf=e=>{const t=!!e,n=e==="tree";return e==="hidden"?we.containerHidden:n?we.containerTree:t?we.containerField:we.containerValue},mf=({nodeDatum:e,onAddChildren:t,onEditChildren:n,onDeleteChildren:r,onOpenTreeModal:o,hierarchyPointNode:a,size:i=220})=>{var z;const{t:l}=$e.useTranslation(["translation","form"]),{attributes:u}=e||{},{isRoot:d,isLeaf:f,required:p,isDecision:h,step:M,type:v,label:g,repeatable:m,tag:x}=u||{},O=!!v,I=v==="tree",A=v==="hidden",b=!O,W=!d&&!f;return c.jsxs("g",{children:[c.jsx(y.GlobalStyles,{styles:{".rd3t-node svg":we.nodeSvg}}),c.jsx(y.Box,{component:"foreignObject",height:i,width:i,x:`-${i/2}`,y:`-${i/2}`,sx:gf(v),children:c.jsxs(y.Box,{flex:1,display:"flex",p:2,height:"100%",flexDirection:"column",justifyContent:"space-between",children:[c.jsxs(y.Stack,{alignItems:"flex-end",spacing:.5,children:[O&&c.jsxs(y.Stack,{direction:"row",spacing:1,alignItems:"center",children:[M&&c.jsx(y.Tooltip,{title:`${l("step",{ns:"form"})} ${(z=e==null?void 0:e.attributes)==null?void 0:z.step}`,placement:"left",arrow:!0,children:c.jsx(y.Chip,{color:"primary",size:"small",label:M,sx:we.stepChip})}),c.jsx(y.Typography,{variant:"subtitle2",sx:we.title,children:c.jsx("strong",{children:g})})]}),O&&c.jsx(y.Chip,{color:"info",size:"small",label:l(`type.${v}`,{ns:"form"})}),x&&c.jsx(y.Chip,{variant:"outlined",color:"warning",size:"small",label:x}),p&&c.jsx(y.Stack,{direction:"row",spacing:.5,children:p&&c.jsx(y.Typography,{variant:"body2",sx:{color:({palette:Te})=>Te.error.main},children:l("required")})}),c.jsx(y.Stack,{spacing:.5,alignItems:"flex-end",children:b&&c.jsx(y.Typography,{variant:"subtitle2",sx:we.title,children:c.jsx("strong",{children:g})})}),c.jsxs(y.Stack,{paddingTop:.5,spacing:.5,direction:"row",children:[m&&c.jsx(y.Tooltip,{title:l("isARepeatable"),placement:"bottom",arrow:!0,children:c.jsx(Za,{style:we.icon})}),f&&c.jsx(y.Tooltip,{title:l("isALeaf"),placement:"bottom",arrow:!0,children:c.jsx(Ga,{style:we.icon})}),A&&c.jsx(y.Tooltip,{title:l("isAHidden"),placement:"bottom",arrow:!0,children:c.jsx(Ha,{style:we.icon})}),d&&c.jsx(y.Tooltip,{title:l("isTheRoot"),placement:"bottom",arrow:!0,children:c.jsx(Xa,{style:we.icon})}),W&&c.jsx(y.Tooltip,{title:l("isABranch"),placement:"bottom",arrow:!0,children:c.jsx(Qa,{style:we.icon})}),I&&c.jsx(y.Tooltip,{title:l("isATree"),placement:"bottom",arrow:!0,children:c.jsx(Ka,{style:we.icon})})]})]}),c.jsxs(y.Stack,{direction:"row",justifyContent:"flex-end",spacing:0,alignSelf:"flex-end",children:[!d&&c.jsx(y.Tooltip,{title:l("remove"),arrow:!0,children:c.jsx(y.Button,{variant:"text",sx:we.actionButton,size:"small",color:"error",onClick:()=>r==null?void 0:r(a),children:c.jsx(qa,{})})}),!b&&c.jsx(y.Tooltip,{title:l("edit"),arrow:!0,children:c.jsx(y.Button,{variant:"text",color:"secondary",sx:we.actionButton,size:"small",onClick:()=>n==null?void 0:n(a),children:c.jsx(Wa,{})})}),!h&&c.jsx(y.Tooltip,{title:l("add"),arrow:!0,children:c.jsx(y.Button,{variant:"text",color:"success",sx:we.actionButton,size:"small",onClick:()=>t==null?void 0:t(a),children:c.jsx(Ba,{})})}),I&&c.jsx(y.Tooltip,{title:l("show"),arrow:!0,children:c.jsx(y.Button,{variant:"text",color:"info",sx:we.actionButton,size:"small",onClick:()=>o==null?void 0:o(a),children:c.jsx(ei,{})})})]})]})})]})},yf=N.memo(mf),ti=()=>{const{setModalOpen:e,setCurrentHierarchyPointNode:t,setTreeModalOpen:n,setTreePath:r}=Ce();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 p,h;const f={label:d==null?void 0:d.data.attributes.label,path:((h=(p=d==null?void 0:d.data)==null?void 0:p.attributes)==null?void 0:h.treePath)||""};r(M=>[...M,f]),n(!0)}}},vf=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,addChildren:i})=>{const{handleDeleteChildren:l,handleEditChildren:u,handleAddChildren:d,handleOpenTreeModal:f}=ti();return c.jsx(yf,{addChildren:i,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,onAddChildren:d,onOpenTreeModal:f,onDeleteChildren:l,onEditChildren:u})},ri=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,addChildren:i})=>c.jsx(vf,{addChildren:i,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a}),bf=()=>{const{t:e}=$e.useTranslation(["modal","snackMessage"]),{currentHierarchyPointNode:t,modalOpen:n,setModalOpen:r}=Ce(),o=n==="edit";return{closeModal:()=>r(null),getTitleModalDelete:()=>{var h,M;const p=(M=(h=t==null?void 0:t.data)==null?void 0:h.attributes)==null?void 0:M.label;return e("deleteTitle",{name:p,ns:"modal"})},getTitleModalMutation:()=>{var M;const p=(M=t==null?void 0:t.data)==null?void 0:M.attributes.label;return p?e(o?"editTitle":"addTitle",{name:p,ns:"modal"}):e("addFirstTitle",{name:p,ns:"modal"})},isDeleteModal:n==="delete",isModalMutationOpen:o||n==="add"}},Mf=()=>{const{currentTree:e,setCurrentTree:t,tree:n}=Ce(),{name:r,errorName:o,id:a}=e;return{disabled:!!e.id&&!n,errorName:o,handleChangeName:u=>{const{value:d}=u.target;if(!d){t(f=>({...f,errorName:"Champs requis",name:u.target.value}));return}t(f=>({...f,errorName:"",name:u.target.value}))},id:a,name:r}},xf=()=>{const{t:e}=$e.useTranslation("form"),{name:t,handleChangeName:n,errorName:r,disabled:o}=Mf();return c.jsx(y.TextField,{required:!0,label:e("treeName",{ns:"form"}),size:"small",onChange:n,value:t,error:!!r,disabled:o})},Tf=()=>{var M,v;const{tree:e,treeModalOpen:t,treePath:n,backendConfig:r}=Ce(),{handleCloseTreeModal:o}=ti(),{getTitleModalMutation:a,closeModal:i,getTitleModalDelete:l,isModalMutationOpen:u,isDeleteModal:d}=bf(),f=(M=n==null?void 0:n.at(-1))==null?void 0:M.path,p=(v=n==null?void 0:n.at(-1))==null?void 0:v.label,h=e&&xt(e,f);return c.jsxs(c.Fragment,{children:[c.jsxs(td,{children:[c.jsx(Xu,{children:c.jsxs(y.Stack,{justifyContent:"space-between",direction:"row",alignItems:"center",children:[c.jsx(Oi,{}),!!(r!=null&&r.baseUrl)&&c.jsxs(y.Stack,{direction:"row",alignItems:"center",spacing:2,children:[c.jsx(xf,{}),c.jsx(Ya,{size:"small",arrowOnly:!0,showBtnAddNewTree:!0,fetchWorkflowsOnOpen:!0})]})]})}),c.jsx(ed,{children:c.jsx(eo,{data:e,renderCustomNodeElement:ri})}),c.jsx(nd,{children:c.jsx(ki,{value:e})}),c.jsx(Ju,{children:c.jsx(Yu,{value:e})})]}),c.jsx(ka,{open:u,onClose:i,title:a(),children:c.jsx(Cd,{onClose:i})}),c.jsx(ka,{open:d,onClose:i,title:l(),children:c.jsx(ad,{onClose:i})}),c.jsx(Gu,{open:t,onClose:o,title:p,children:h&&c.jsx(eo,{data:h,renderCustomNodeElement:ri})})]})},jf="0.12.0",Df=({children:e,initialTree:t,initialTreeId:n,backendConfig:r})=>{const[o,a]=N.useState(Fe.currentHierarchyPointNode),[i,l]=N.useState(Fe.modalOpen),[u,d]=N.useState(Fe.treeModalOpen),[f,p]=N.useState(Fe.treePath),[h,M]=N.useReducer(Ru,t||Fe.tree),[v,g]=N.useState(n?{...Fe.currentTree,id:n}:Fe.currentTree),m=N.useMemo(()=>{var x,O;return{backendConfig:{baseUrl:((x=Fe==null?void 0:Fe.backendConfig)==null?void 0:x.baseUrl)||"",...Fe.backendConfig,...r,endpoints:{...(O=Fe.backendConfig)==null?void 0:O.endpoints,...r==null?void 0:r.endpoints}},currentHierarchyPointNode:o,currentTree:v,dispatchTree:M,modalOpen:i,setCurrentHierarchyPointNode:a,setCurrentTree:g,setModalOpen:l,setTreeModalOpen:d,setTreePath:p,tree:h,treeModalOpen:u,treePath:f,version:jf}},[r,o,v,i,h,u,f]);return Zt(v.id,{enabled:!!n,onSuccess:async x=>{x&&(g({id:x==null?void 0:x.id,name:x==null?void 0:x.label}),M(Sa((x==null?void 0:x.workflow)||null)))}}),c.jsx(Xn.Provider,{value:m,children:e})},Nf={close:"Close",createTree:"Create Tree",downloadJSONFile:"Download JSON File",reset:"Reset",resetTree:"Reset tree",save:"Save",update:"Update"},Ef={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:{saveTree:"Tree registered",updateTree:"Tree updated"}},Of={add:"Add",cancel:"Cancel",disabled:"Disabled",edit:"Edit",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",name:"Name",remove:"Remove",required:"Required",save:"Save",show:"Show",tag:"Tag",type:"Type",validate:"Validate",value:"Value",values:"Values"},Cf={close:"Fermer",createTree:"Créer un arbre",downloadJSONFile:"Télécharger le fichier JSON",reset:"Réinitialiser",resetTree:"Réinitialiser l'arbre",save:"Enregistrer",update:"Modifier"},ni={decisionField:"Champs de décision",helperText:"Texte d'information",hiddenValue:"Valeur caché",label:"Label",mustBeUnique:"Doit être unique",newTree:"Nouvel arbre",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",checkbox:"Case à cocher",date:"Date",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",tree:"Arbre",url:"URL"},value:"Valeur",values:"Valeurs"},oi={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"},wf={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:{saveTree:"Arbre enregistré",updateTree:"Arbre mis à jour"}},If={add:"Ajouter",cancel:"Annuler",disabled:"Désactivé",edit:"Éditer",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",name:"Nom",remove:"Supprimer",required:"Requis",save:"Enregistrer",show:"Afficher",tag:"Tag",type:"Type",validate:"Valider",value:"Valeur",values:"Valeurs"};Ot.use(ui).use($e.initReactI18next).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{useSuspense:!0},resources:{en:{button:Nf,form:ni,modal:oi,snackMessage:Ef,translation:Of},fr:{button:Cf,form:ni,modal:oi,snackMessage:wf,translation:If}},returnNull:!1}).then(()=>{document.documentElement.lang!==Ot.resolvedLanguage&&Ot.resolvedLanguage&&document.documentElement.setAttribute("lang",Ot.resolvedLanguage)}),Ot.on("languageChanged",e=>{document.documentElement.setAttribute("lang",e)});const Af=({initialTree:e,initialTreeId:t,backendConfig:n})=>(N.useLayoutEffect(()=>{ct.defaults.baseURL=n==null?void 0:n.baseUrl,n!=null&&n.authToken&&(ct.defaults.headers.common.Authorization=`Bearer ${n==null?void 0:n.authToken}`)},[n==null?void 0:n.authToken,n==null?void 0:n.baseUrl]),c.jsx(lt.QueryClientProvider,{client:vi,children:c.jsx(xi,{authToken:n==null?void 0:n.authToken,children:c.jsx(Df,{backendConfig:n,initialTree:e,initialTreeId:t,children:c.jsx(yi,{children:c.jsx(Ni,{children:c.jsx(Tf,{})})})})})}));Oe.TreePlusIcon=Zn,Oe.Treege=Af,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})});
|
|
110
|
+
`)),wo.configure(e)}},unstable_useEnhancedEffect:jo,unstable_useId:ts,unsupportedProp:rs,useControlled:ns,useEventCallback:os,useForkRef:as,useIsFocusVisible:fs},Symbol.toStringTag,{value:"Module"})));var Na;function ke(){return Na||(Na=1,function(e){"use client";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=fu}(Vr)),Vr}var pu=Ae;Object.defineProperty(Ur,"__esModule",{value:!0});var Ea=Ur.default=void 0,hu=pu(ke()),gu=c,mu=(0,hu.default)((0,gu.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.15zM5.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-.72zm2.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.55zM13 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.93z"}),"RotateLeftRounded");Ea=Ur.default=mu;var jn={},yu=Ae;Object.defineProperty(jn,"__esModule",{value:!0});var Oa=jn.default=void 0,vu=yu(ke()),bu=c,Mu=(0,vu.default)((0,bu.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.41l-2.82-2.83zM12 19c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm1-10H7c-1.1 0-2-.9-2-2s.9-2 2-2h6c1.1 0 2 .9 2 2s-.9 2-2 2z"}),"SaveRounded");Oa=jn.default=Mu;var Dn={},xu=Ae;Object.defineProperty(Dn,"__esModule",{value:!0});var Ca=Dn.default=void 0,Tu=xu(ke()),ju=c,Du=(0,Tu.default)((0,ju.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-2zm-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.01z"}),"SimCardDownloadRounded");Ca=Dn.default=Du;const wa=(e,t)=>{if(!e)return null;if(e.name===t)return e;const n=e.children||[];for(let r=0;r<n.length;r+=1){const o=n[r],a=wa(o,t);if(a)return a}return null},xt=(e,t)=>{var a,i,l,u,d;if(!e)return null;if(!t)return e;if(((a=e.attributes)==null?void 0:a.treePath)===t)return((i=e.attributes)==null?void 0:i.tree)||null;let n=null;const r=(l=e.attributes)==null?void 0:l.tree,o=(u=e.children)==null?void 0:u.length;if(r&&(n=xt((d=e.attributes)==null?void 0:d.tree,t)),o){const{children:f}=e;for(let p=0;p<f.length;p+=1){const h=f[p];if(n!==null)return n;n=xt(h,t)}}return n},jr=(e,t,n)=>{const r=xt(e,t);return wa(r,n)},Nu=(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)},Eu=({tree:e,path:t,name:n,child:r})=>{var u;const{attributes:o,children:a}=r;if(!e)return a.length?{...r}:{...r,attributes:{...o,isLeaf:!0,isRoot:!0}};const i=structuredClone(e),l=jr(i,t,n);return Nu(l,{...r,...!o.isDecision&&{children:[...((u=jr(e,t,n))==null?void 0:u.children)||[]]}}),i},Ia=(e,t,n=null)=>{if(!e)return null;if(e.name===t)return n;const r=e.children||[];for(let o=0;o<r.length;o+=1){const a=r[o],i=Ia(a,t,e);if(i!==null)return i}return null},Ou=(e,t)=>(!e||!t||(Object.defineProperty(e,"children",{value:e.children.filter(n=>n.name!==t.name)}),Object.defineProperty(e,"attributes",{value:{...e.attributes,isLeaf:!0}})),null),Cu=(e,t,n)=>{const r=xt(e,t);return Ia(r,n)},wu=({tree:e,path:t,name:n})=>{const r=structuredClone(e),o=jr(r,t,n),a=Cu(r,t,n);return Ou(a,o),r},Iu=e=>{if(!e)return[];const t=[],n=r=>{if(r.name&&t.push(r.name),r.children.length){const{children:o}=r;for(let a=0;a<o.length;a+=1)n(o[a])}};return n(e),t},Au=(e,t)=>{if(!e)return null;const n=t.attributes.isDecision,r=e.attributes.isDecision,o=e.attributes.depth===0,a={value:t.name},i=r||n,l=i?{value:[...t.children]}:{value:[...e.children]},u=i?{value:{...t.attributes,isLeaf:!t.children.length||!n,isRoot:o}}:{value:{...t.attributes,isLeaf:!e.children.length,isRoot:o}};return Object.defineProperties(e,{attributes:u,children:l,name:a}),null},Su=({tree:e,path:t,name:n,child:r})=>{const o=structuredClone(e),a=jr(o,t,n);return Au(a,r),o},et={appendTreeCard:"appendTreeCard",deleteTreeCard:"deleteTreeCard",replaceTreeCard:"replaceTreeCard",resetTree:"resetTree",setTree:"setTree"},ku=(e,t,n)=>({children:n,name:t,path:e,type:et.appendTreeCard}),zu=(e,t,n)=>({children:n,name:t,path:e,type:et.replaceTreeCard}),_u=(e,t)=>({name:t,path:e,type:et.deleteTreeCard}),Aa=()=>({type:et.resetTree}),Sa=e=>({tree:e,type:et.setTree}),Ru=(e,t)=>{switch(t.type){case et.appendTreeCard:{const{name:n,path:r,children:o}=t;return Eu({child:o,name:n,path:r,tree:e})}case et.deleteTreeCard:{const{path:n,name:r}=t;return wu({name:r,path:n,tree:e})}case et.replaceTreeCard:{const{name:n,path:r,children:o}=t;return Su({child:o,name:n,path:r,tree:e})}case et.resetTree:return null;case et.setTree:return t.tree;default:throw new Error}},Nn=()=>{const{dispatchSnackbar:e}=N.useContext(Kn);return{close:()=>e(Jn()),open:(r,o="success")=>e(Ti(r,o))}},Lu=e=>{const{backendConfig:t}=Ce(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return lt.useMutation(["patchWorkflow"],async o=>{const{data:a}=await ct.patch(r,o);return a},e)},$u=e=>{const{backendConfig:t}=Ce(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return lt.useMutation(["postWorkflow"],async o=>{const{data:a}=await ct.post(r,o);return a},e)},Pu=()=>{const{t:e}=$e.useTranslation(["snackMessage"]),{open:t}=Nn(),{setCurrentTree:n,currentTree:r,tree:o,dispatchTree:a}=Ce(),[i,l]=N.useState(!1),{version:u}=Ce(),{mutate:d}=$u({onError:()=>{t(e("error.saveTree",{ns:"snackMessage"}),"error")},onSuccess:x=>{t(e("success.saveTree",{ns:"snackMessage"})),n(O=>({...O,id:x.workflow_id}))}}),{mutate:f}=Lu({onError:()=>{t(e("error.updateTree",{ns:"snackMessage"}),"error")},onSuccess:()=>{t(e("success.updateTree",{ns:"snackMessage"}))}}),p=x=>JSON.stringify(x,null,2),h=x=>`data:text/json;charset=utf-8,${encodeURIComponent(p(x))}`,M=()=>{l(!1)};return{formatJSON:p,getDownloadLink:h,handleClose:M,handleOpen:()=>{l(!0)},handleResetTree:()=>{a(Aa()),M()},handleSubmit:()=>{const{name:x,id:O}=r;if(!x){n(I=>({...I,errorName:"Champs Requis"}));return}if(o){if(O){f({id:O,label:x,version:u,workflow:o});return}d({label:x,version:u,workflow:o})}},openModal:i}},Yu=({downloadedFileName:e="export",value:t})=>{const{t:n}=$e.useTranslation(),{getDownloadLink:r,handleSubmit:o,handleClose:a,handleOpen:i,handleResetTree:l,openModal:u}=Pu(),{currentTree:d,backendConfig:f,tree:p}=Ce(),{id:h}=d;return c.jsxs(y.Stack,{direction:"row",spacing:2,justifyContent:"center",children:[c.jsx(y.Tooltip,{title:n("resetTree",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:c.jsx(y.Box,{children:c.jsx(y.Button,{disabled:!p,onClick:i,variant:"outlined",color:"warning",children:c.jsx(Ea,{})})})}),c.jsx(y.Divider,{orientation:"vertical",flexItem:!0}),c.jsx(y.Tooltip,{title:n("downloadJSONFile",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:c.jsx(y.Box,{children:c.jsx(y.Button,{variant:"outlined",href:r(t),download:`${e}.json`,disabled:!t,children:c.jsx(Ca,{})})})}),c.jsx(y.Tooltip,{title:h?n("update",{ns:"button"}):n("save",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:c.jsx(y.Box,{children:c.jsx(y.Button,{variant:"outlined",onClick:o,disabled:!t||!(f!=null&&f.baseUrl),children:c.jsx(Oa,{})})})}),c.jsxs(y.Dialog,{maxWidth:"xs",fullWidth:!0,open:u,onClose:a,children:[c.jsx(y.DialogTitle,{variant:"h3",children:n("resetTree",{ns:"button"})}),c.jsx(y.DialogContent,{children:c.jsx(y.DialogContentText,{children:n("resetTreeContent",{ns:"modal"})})}),c.jsxs(y.DialogActions,{children:[c.jsx(y.Button,{onClick:a,children:n("close",{ns:"button"})}),c.jsx(y.Button,{variant:"contained",color:"warning",onClick:l,children:n("reset",{ns:"button"})})]})]})]})},Fu={box:{backgroundColor:ce.background,border:`solid 1px ${ce.borderBlue}`}},ka=({children:e,description:t,open:n,onClose:r,title:o})=>c.jsx(y.Dialog,{open:n,onClose:r,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",scroll:"body",maxWidth:"sm",fullWidth:!0,children:c.jsxs(y.Box,{sx:Fu.box,p:4,children:[c.jsx("h3",{children:o}),c.jsx("p",{children:t}),e]})});var En={},Uu=Ae;Object.defineProperty(En,"__esModule",{value:!0});var za=En.default=void 0,Vu=Uu(ke()),Qu=c,Bu=(0,Vu.default)((0,Qu.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.4z"}),"CloseRounded");za=En.default=Bu;const Dr={container:{display:"flex",flexDirection:"column",height:"100%",margin:1},main:{border:`solid 1px ${ce.borderBlue}`,height:" 100%",margin:1},toolbar:{backgroundColor:ce.background,boxShadow:"none",display:"flex",padding:"0 ! important"},toolbarBox:{backgroundColor:ce.tertiary,border:`solid 1px ${ce.primary}`,margin:1,paddingX:2,paddingY:1,width:"100%"}},qu=({children:e,appear:t,in:n,onEnter:r,onExited:o,onFocus:a,role:i,tabIndex:l,timeout:u},d)=>c.jsx(y.Slide,{direction:"up",ref:d,appear:t,in:n,onEnter:r,onExited:o,onFocus:a,role:i,tabIndex:l,timeout:u,children:e}),Wu=N.forwardRef(qu),Gu=({children:e,open:t,onClose:n,title:r})=>c.jsx(y.Dialog,{PaperProps:{sx:{backgroundColor:ce.background,backgroundImage:"none"}},open:t,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",fullScreen:!0,TransitionComponent:Wu,children:c.jsxs(y.Box,{sx:Dr.container,children:[c.jsx(y.AppBar,{position:"sticky",elevation:0,children:c.jsx(y.Toolbar,{sx:Dr.toolbar,children:c.jsxs(y.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:Dr.toolbarBox,children:[c.jsx(y.Typography,{variant:"h5",children:c.jsx("strong",{children:r})}),c.jsx(y.IconButton,{edge:"end",color:"inherit",onClick:n,"aria-label":"close",children:c.jsx(za,{})})]})})}),c.jsx(y.Box,{sx:Dr.main,children:e})]})}),Ku={box:{border:`solid 1px ${ce.borderBlue}`,flexGrow:0}},Ju=({children:e})=>c.jsx(y.Box,{p:2,role:"group",sx:Ku.box,children:e}),Zu={box:{border:`solid 1px ${ce.borderBlue}`,flexGrow:0}},Xu=({children:e})=>c.jsx(y.Box,{sx:Zu.box,padding:2,component:"header",children:e}),Hu={box:{border:`solid 1px ${ce.borderBlue}`,flexGrow:1}},ed=({children:e})=>c.jsx(y.Box,{sx:Hu.box,component:"main",role:"tree",children:e}),_a={stack:{width:"100%"}},td=({children:e})=>{const t=N.Children.toArray(e);return c.jsxs(y.Grid,{container:!0,padding:1,flexWrap:"nowrap",height:"100%",role:"treegrid",children:[c.jsx(y.Grid,{item:!0,xs:9,padding:1,display:"flex",children:c.jsxs(y.Stack,{sx:_a.stack,spacing:2,children:[t[0],t[1]]})}),c.jsx(y.Grid,{item:!0,xs:3,padding:1,display:"flex",children:c.jsxs(y.Stack,{sx:_a.stack,spacing:2,children:[t[2],t[3]]})})]})},rd={box:{border:`solid 1px ${ce.borderBlue}`,flexGrow:1,overflow:"auto"}},nd=({children:e})=>c.jsx(y.Box,{sx:rd.box,component:"aside",children:e}),od=()=>{const{dispatchTree:e,setModalOpen:t,currentHierarchyPointNode:n,treePath:r}=Ce();return{handleSubmit:a=>{var u,d;a.preventDefault();const i=((u=n==null?void 0:n.data)==null?void 0:u.name)||"",l=((d=r==null?void 0:r.at(-1))==null?void 0:d.path)||"";e(_u(l,i)),t(null)}}},ad=({onClose:e})=>{const{t}=$e.useTranslation(),{handleSubmit:n}=od();return c.jsx("form",{onSubmit:n,children:c.jsxs(y.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:[c.jsx(y.Button,{variant:"text",onClick:e,children:t("cancel")}),c.jsx(y.Button,{variant:"contained",color:"error",type:"submit",children:t("remove")})]})})};var On={},id=Ae;Object.defineProperty(On,"__esModule",{value:!0});var Ra=On.default=void 0,sd=id(ke()),ld=c,cd=(0,sd.default)((0,ld.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4 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 1z"}),"AddCircleRounded");Ra=On.default=cd;var Cn={},ud=Ae;Object.defineProperty(Cn,"__esModule",{value:!0});var La=Cn.default=void 0,dd=ud(ke()),fd=c,pd=(0,dd.default)((0,fd.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4 11H8c-.55 0-1-.45-1-1s.45-1 1-1h8c.55 0 1 .45 1 1s-.45 1-1 1z"}),"RemoveCircleRounded");La=Cn.default=pd;const Yt=[{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,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:"time"},{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"}],hd=()=>{const{backendConfig:e}=Ce();return{fields:N.useCallback(()=>Yt.filter(n=>!(n.type==="tree"&&!(e!=null&&e.baseUrl))),[e==null?void 0:e.baseUrl])()}},gd=({onChange:e,value:t})=>{const{t:n}=$e.useTranslation(["translation","form"]),{fields:r}=hd();return c.jsxs(y.FormControl,{sx:{flex:1},required:!0,children:[c.jsx(y.InputLabel,{children:n("type")}),c.jsx(y.Select,{value:t,label:n("type"),onChange:e,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:r.map(({type:o,isDecisionField:a})=>c.jsxs(y.MenuItem,{value:o,children:[n(`type.${o}`,{ns:"form"}),a&&c.jsx(y.Chip,{label:n("decisionField",{ns:"form"}),size:"small",color:"info",sx:{marginLeft:1}})]},o))})]})},md=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:i}=r;for(let l=0;l<i.length;l+=1)n(i[l])}};return n(e),[...t]},yd=y.createFilterOptions(),vd=({value:e,onChange:t})=>{const{t:n}=$e.useTranslation(["translation","form"]),{tree:r}=Ce(),o=md(r).reduce((a,i)=>[...a,{inputValue:i,label:i}],[]);return c.jsx(y.Autocomplete,{freeSolo:!0,fullWidth:!0,value:e,onChange:t,filterOptions:(a,i)=>{const l=yd(a,i),{inputValue:u}=i,d=a.some(f=>typeof f!="string"&&u===f.label);return u!==""&&!d&&l.push({inputValue:u,label:`${n("add")} "${u}"`}),l},getOptionLabel:a=>typeof a=="string"?a:a.inputValue?a.inputValue:a.label,renderOption:(a,i)=>c.jsx("li",{...a,children:typeof i!="string"&&i.label}),renderInput:a=>c.jsx(y.TextField,{...a,label:n("tag")}),options:o})};var wn={},bd=Ae;Object.defineProperty(wn,"__esModule",{value:!0});var $a=wn.default=void 0,Md=bd(ke()),xd=c,Td=(0,Md.default)((0,xd.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 1z"}),"AddRounded");$a=wn.default=Td;const jd=e=>{const{backendConfig:t}=Ce(),{endpoints:n}=t||{},{workflows:r=""}=n||{};return lt.useQuery(["workflows"],async({signal:o})=>{const{data:a}=await ct.get(r,{signal:o});return a},e)},Dd=({isControlled:e,fetchWorkflowsOnOpen:t})=>{const{t:n}=$e.useTranslation("snackMessage"),{open:r}=Nn(),{currentTree:o,setCurrentTree:a,dispatchTree:i}=Ce(),[l,u]=N.useState(""),d=!!l&&!e&&l!==o.id,{data:f,isError:p}=Zt(l,{enabled:d}),{data:h,isLoading:M,refetch:v}=jd({enabled:!t}),g=N.useCallback(async({target:x})=>{var I;const{value:O}=x;if(O==="add-new-tree"){u(""),a({name:""}),i(Aa());return}u(O),a({id:O,name:(I=h==null?void 0:h.find(A=>A.id===O))==null?void 0:I.label})},[i,a,h]),m=N.useCallback(async()=>{if(t)try{await v(),o.id&&!l&&u(o.id)}catch{r(n("error.fetchTree",{ns:"snackMessage"}),"error")}},[t,v,o.id,l,r,n]);return N.useEffect(()=>{if(f&&l!==o.id){const{id:x,label:O,workflow:I}=f;a({id:x,name:O}),i(Sa(I))}},[o.id,i,e,a,l,f]),N.useEffect(()=>{p&&r(n("error.fetchTree",{ns:"snackMessage"}),"error")},[p,r,n]),{currentTree:o,fetchWorkflowSuggestions:v,handleChangeTree:g,handleOnOpen:m,setTreeSelected:u,treeSelected:l,workflowsSuggestions:h,workflowsSuggestionsLoading:M}},Pa={formControl:{flex:1},select:{".MuiOutlinedInput-notchedOutline":{border:0,paddingLeft:5},".MuiSelect-select":{opacity:0,width:0},boxShadow:"none"}},Ya=({arrowOnly:e,required:t,size:n,showBtnAddNewTree:r,onChange:o,value:a,fetchWorkflowsOnOpen:i})=>{const{t:l}=$e.useTranslation("form"),u=N.useMemo(()=>!!o,[o]),{handleChangeTree:d,handleOnOpen:f,workflowsSuggestions:p,workflowsSuggestionsLoading:h,treeSelected:M}=Dd({fetchWorkflowsOnOpen:i,isControlled:u});return c.jsxs(y.FormControl,{size:n,required:t,sx:Pa.formControl,children:[!e&&c.jsx(y.InputLabel,{children:l("tree",{ns:"form"})}),c.jsxs(y.Select,{value:u?a:M,id:"tree-select",onChange:v=>u?o==null?void 0:o(v):d(v),sx:e?Pa.select:void 0,label:l("tree",{ns:"form"}),onOpen:f,children:[(a&&h||h)&&c.jsx(y.MenuItem,{value:a,children:c.jsx(y.Skeleton,{width:"100%"})}),p==null?void 0:p.map(({label:v,id:g})=>c.jsx(y.MenuItem,{value:g,children:v},g)),r&&c.jsx(y.MenuItem,{disabled:!0,children:c.jsx(y.Box,{sx:{height:1,width:"100%"},children:c.jsx(y.Divider,{})})}),r&&c.jsxs(y.MenuItem,{value:"add-new-tree",children:[c.jsx(y.Typography,{mr:1,children:l("newTree",{ns:"form"})}),c.jsx($a,{color:"primary"})]})]})]})},Nd=({helperText:e,hiddenValue:t,isHiddenField:n,isTreeField:r,treeSelected:o,handleChangeTreeSelect:a,handleChangeHelperText:i,handleChangeHiddenValue:l})=>{const{t:u}=$e.useTranslation(["translation","form"]);return r?c.jsx(Ya,{required:!0,value:o,onChange:a}):n?c.jsx(y.TextField,{required:!0,sx:{flex:1},label:u("hiddenValue",{ns:"form"}),onChange:l,value:t}):c.jsx(y.TextField,{sx:{flex:1},label:u("helperText",{ns:"form"}),onChange:i,value:e})},Fa=e=>new Set([...e]).size===e.length,Ed=(e,t,n)=>{const r=[...e,t];return Fa(n?r.filter(o=>o!==n):r)},Od=()=>{var Ar,Sr,kr,zr,Dt,Vt,nt,Nt,Et,Qt,_r,Bt,Rr,qt,Wt,Lr,$r;const e=N.useMemo(()=>[{id:"0",label:"",message:"",value:""}],[]),{tree:t,dispatchTree:n,currentHierarchyPointNode:r,modalOpen:o,treePath:a,setModalOpen:i}=Ce(),{open:l}=Nn(),{t:u}=$e.useTranslation(),[d,f]=N.useState(e),[p,h]=N.useState(""),[M,v]=N.useState(""),[g,m]=N.useState(""),[x,O]=N.useState(!1),[I,A]=N.useState(!1),[b,W]=N.useState("text"),[z,Te]=N.useState(null),[he,_]=N.useState(""),[se,me]=N.useState(""),[de,le]=N.useState(""),[Me,xe]=N.useState({off:"",on:""}),[Ee,_e]=N.useState(!1),[Ye,j]=N.useState(""),w=o==="edit",L=b==="tree",$=b==="hidden",R=Yt.some(C=>C.type===b&&(C==null?void 0:C.isBooleanField)),U=Yt.some(C=>C.type===b&&(C==null?void 0:C.isDecisionField)),P=Yt.some(C=>C.type===b&&(C==null?void 0:C.isRequiredDisabled)),F=Yt.some(C=>C.type===b&&(C==null?void 0:C.isRepeatableDisabled)),Y=((Sr=(Ar=r==null?void 0:r.data)==null?void 0:Ar.attributes)==null?void 0:Sr.isLeaf)??!0,Q=N.useCallback(C=>!U&&C>0,[U]),{refetch:V,isInitialLoading:Ne}=Zt(he,{enabled:!1,onError:()=>{l(u("error.fetchTree",{ns:"snackMessage"}),"error")}}),E=N.useCallback((C,K)=>{f(ie=>ie.map(ye=>{const{id:Le}=ye;return C.target.dataset.id===Le?{...ye,id:Le,[K]:C.target.value}:{...ye}}))},[]),Re=N.useCallback((C,K)=>{typeof K=="string"?Te(K):K&&K.inputValue?Te(K.inputValue):Te(null)},[]),S=N.useCallback(C=>{v(C.target.value)},[]),Qe=N.useCallback(C=>{m(C.target.value)},[]),Je=N.useCallback(C=>{E(C,"label")},[E]),it=N.useCallback(C=>{E(C,"value")},[E]),Nr=N.useCallback(C=>{E(C,"message")},[E]),Tt=N.useCallback(C=>{le(C.target.value)},[]),Yn=N.useCallback(C=>{var D;const{value:K}=C.target;if(h(C.target.value),!t||!K){j("");return}const ie=w&&(r==null?void 0:r.data.name),ye=(D=a==null?void 0:a.at(-1))==null?void 0:D.path,Le=xt(t,ye),s=Iu(Le);if(Ed(s,K,ie)){j("");return}j(u("mustBeUnique",{ns:"form"}))},[r==null?void 0:r.data.name,w,u,t,a]),Fn=N.useCallback(C=>{O(C.target.checked)},[]),Ft=N.useCallback(C=>{A(C.target.checked)},[]),Un=N.useCallback(C=>{_e(C.target.checked)},[]),Vn=N.useCallback(C=>{W(C.target.value),A(!1),O(!1),_e(!1)},[]),Er=N.useCallback(C=>{_(C.target.value)},[]),Or=N.useCallback(C=>K=>{xe(ie=>({...ie,[C]:K.target.value}))},[]),st=N.useCallback(C=>{me(C.target.value)},[]),Qn=N.useCallback(()=>{f(C=>{const K=Number(C[C.length-1].id),ie=String(K+1);return[...C,{...e[0],id:ie}]})},[e]),Cr=N.useCallback(C=>{f(K=>K.filter(({id:ie})=>C.currentTarget.value!==ie))},[]),Ut=N.useCallback((C,K)=>{var ye,Le,s;const ie=(s=(Le=(ye=C==null?void 0:C.children)==null?void 0:ye[K])==null?void 0:Le.data)==null?void 0:s.children;return ie?ie.map(({name:T,attributes:D,children:k})=>({attributes:D,children:k,name:T})):[]},[]),jt=N.useCallback(C=>{var K;return I?(K=d==null?void 0:d.filter((ie,ye)=>!Q(ye)))==null?void 0:K.map(({message:ie,value:ye,label:Le},s)=>{const T=`${p}:${ye}`,D=Ut(r,s);return{attributes:{depth:C+1,label:Le,value:ye,...ie&&{message:ie},...D.length===0&&{isLeaf:!0}},children:D,name:T}}):[]},[r,Q,Ut,I,p,d]),wr=N.useCallback(C=>C.map(({message:K,...ie})=>({...ie,...K&&{message:K}})),[]),Ir=N.useCallback((C,K,ie)=>{var ye;return C&&(!K||ie)?V():C&&K&&!ie?{data:{workflow:(ye=r==null?void 0:r.data.attributes)==null?void 0:ye.tree},isError:null}:{data:null,isError:null}},[(kr=r==null?void 0:r.data.attributes)==null?void 0:kr.tree,V]),Bn=N.useCallback(async C=>{var fe,pe,Ie,Be;C.preventDefault();const{on:K,off:ie}=Me,ye=((fe=r==null?void 0:r.data)==null?void 0:fe.name)||"",Le=(r==null?void 0:r.depth)||0,s=o==="edit",T=Le+(s||r===null?0:1),D=jt(T),k=(pe=a==null?void 0:a.at(-1))==null?void 0:pe.path,J=a.length?`${k}/${p}`:`/${p}`,X=((Be=(Ie=r==null?void 0:r.data.attributes)==null?void 0:Ie.tree)==null?void 0:Be.treeId)!==he,{data:B,isError:q}=await Ir(L,s,X);if(q)return;const je={attributes:{depth:T,label:g,type:b,...se&&{helperText:se},...(ie||K)&&{messages:{...ie&&{off:ie},...K&&{on:K}}},...L&&{tree:{...B==null?void 0:B.workflow,treeId:he},treePath:J},...I&&{isDecision:I},...U&&!I&&{values:wr(d)},...x&&{required:x},...de&&{step:de},...Ee&&{repeatable:Ee},...$&&{hiddenValue:M},...z&&{tag:z}},children:D,name:p};n(s?zu(k||"",ye,je):ku(k||null,ye,je)),i(null)},[r,n,jt,wr,Ir,se,M,I,U,$,L,g,Me,o,p,Ee,x,i,de,z,a,he,b,d]);return N.useEffect(()=>{var C,K,ie,ye,Le,s,T,D,k,J,X,B,q,je,fe,pe,Ie,Be,Gt,qe;if(o==="edit"){const Pr=((K=(C=r==null?void 0:r.data)==null?void 0:C.attributes)==null?void 0:K.values)||((Le=(ye=(ie=r==null?void 0:r.data)==null?void 0:ie.children)==null?void 0:ye.filter(({attributes:Kt})=>!(Kt!=null&&Kt.type)))==null?void 0:Le.map(({attributes:Kt},Sf)=>{const{label:kf,value:zf,message:ai}=Kt||{};return{id:String(Sf),label:String(kf),value:String(zf),...ai&&{message:String(ai)}}}));h((r==null?void 0:r.data.name)||""),Te(((s=r==null?void 0:r.data.attributes)==null?void 0:s.tag)||null),W(((T=r==null?void 0:r.data.attributes)==null?void 0:T.type)||"text"),me(((D=r==null?void 0:r.data.attributes)==null?void 0:D.helperText)||""),O(((k=r==null?void 0:r.data.attributes)==null?void 0:k.required)||!1),le(((J=r==null?void 0:r.data.attributes)==null?void 0:J.step)||""),m(((X=r==null?void 0:r.data.attributes)==null?void 0:X.label)||""),A(((B=r==null?void 0:r.data.attributes)==null?void 0:B.isDecision)||!1),f(Pr!=null&&Pr.length?Pr:e),xe({off:((je=(q=r==null?void 0:r.data.attributes)==null?void 0:q.messages)==null?void 0:je.off)||"",on:((pe=(fe=r==null?void 0:r.data.attributes)==null?void 0:fe.messages)==null?void 0:pe.on)||""}),_(((Be=(Ie=r==null?void 0:r.data.attributes)==null?void 0:Ie.tree)==null?void 0:Be.treeId)||""),_e(((Gt=r==null?void 0:r.data.attributes)==null?void 0:Gt.repeatable)||!1),v(((qe=r==null?void 0:r.data.attributes)==null?void 0:qe.hiddenValue)||"")}},[(Dt=(zr=r==null?void 0:r.data.attributes)==null?void 0:zr.tree)==null?void 0:Dt.treeId,(Vt=r==null?void 0:r.data.attributes)==null?void 0:Vt.messages,(nt=r==null?void 0:r.data.attributes)==null?void 0:nt.helperText,(Nt=r==null?void 0:r.data.attributes)==null?void 0:Nt.isDecision,(Et=r==null?void 0:r.data.attributes)==null?void 0:Et.label,(Qt=r==null?void 0:r.data.attributes)==null?void 0:Qt.required,(_r=r==null?void 0:r.data.attributes)==null?void 0:_r.step,(Bt=r==null?void 0:r.data.attributes)==null?void 0:Bt.type,(Rr=r==null?void 0:r.data.attributes)==null?void 0:Rr.values,(qt=r==null?void 0:r.data)==null?void 0:qt.children,r==null?void 0:r.data.name,(Wt=r==null?void 0:r.data.attributes)==null?void 0:Wt.tag,(Lr=r==null?void 0:r.data.attributes)==null?void 0:Lr.repeatable,($r=r==null?void 0:r.data.attributes)==null?void 0:$r.hiddenValue,e,o]),{getDisabledValueField:Q,handleAddValue:Qn,handleChangeHelperText:st,handleChangeHiddenValue:S,handleChangeIsDecisionField:Ft,handleChangeLabel:Qe,handleChangeMessage:Or,handleChangeName:Yn,handleChangeOptionLabel:Je,handleChangeOptionMessage:Nr,handleChangeOptionValue:it,handleChangeRepeatable:Un,handleChangeRequired:Fn,handleChangeStep:Tt,handleChangeTag:Re,handleChangeTreeSelect:Er,handleChangeType:Vn,handleDeleteValue:Cr,handleSubmit:Bn,helperText:se,hiddenValue:M,isBooleanField:R,isDecision:I,isDecisionField:U,isEditModal:w,isHiddenField:$,isLeaf:Y,isRepeatableDisabled:F,isRequiredDisabled:P,isTreeField:L,isWorkflowLoading:Ne,label:g,messages:Me,name:p,repeatable:Ee,required:x,step:de,tag:z,treeSelected:he,type:b,uniqueNameErrorMessage:Ye,values:d}},Ua={marginRight:"-20px !important",minWidth:"auto !important"},Va={iconButton:Ua,iconButtonDelete:{...Ua,"&:before":{borderRadius:"50%",content:'""',height:20,position:"absolute",width:20,zIndex:-1},backgroundColor:ce.background,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)"}},Cd=({onClose:e})=>{const{t}=$e.useTranslation(["translation","form"]),{values:n,required:r,name:o,tag:a,uniqueNameErrorMessage:i,type:l,helperText:u,label:d,hiddenValue:f,isBooleanField:p,isDecision:h,isEditModal:M,isDecisionField:v,isHiddenField:g,isRequiredDisabled:m,isRepeatableDisabled:x,isTreeField:O,treeSelected:I,isWorkflowLoading:A,repeatable:b,isLeaf:W,messages:{on:z,off:Te},handleChangeTreeSelect:he,handleChangeHelperText:_,handleChangeOptionMessage:se,handleChangeRequired:me,handleChangeName:de,handleChangeType:le,handleChangeIsDecisionField:Me,handleChangeOptionLabel:xe,handleDeleteValue:Ee,handleChangeOptionValue:_e,handleChangeMessage:Ye,handleSubmit:j,handleAddValue:w,handleChangeLabel:L,handleChangeRepeatable:$,handleChangeHiddenValue:R,handleChangeTag:U}=Od();return c.jsxs("form",{onSubmit:j,children:[c.jsxs(y.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[c.jsx(y.TextField,{sx:{flex:1},label:t("label",{ns:"form"}),onChange:L,value:d,required:!0}),c.jsx(y.TextField,{label:t("name"),sx:{flex:1},onChange:de,value:o,error:!!i,helperText:i,required:!0})]}),c.jsxs(y.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[c.jsx(gd,{value:l,onChange:le}),c.jsx(Nd,{helperText:u,hiddenValue:f,isHiddenField:g,isTreeField:O,treeSelected:I,handleChangeTreeSelect:he,handleChangeHelperText:_,handleChangeHiddenValue:R})]}),c.jsx(y.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:c.jsx(vd,{value:a,onChange:U})}),p&&c.jsxs(y.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[c.jsx(y.TextField,{sx:{flex:1},label:t("onMessage",{ns:"form"}),onChange:Ye("on"),value:z}),c.jsx(y.TextField,{sx:{flex:1},label:t("offMessage",{ns:"form"}),onChange:Ye("off"),value:Te})]}),c.jsxs(y.Stack,{paddingY:1,children:[c.jsx(y.FormGroup,{children:c.jsx(y.FormControlLabel,{disabled:x,control:c.jsx(y.Checkbox,{checked:b,onChange:$}),label:t("repeatable",{ns:"form"})})}),c.jsx(y.FormGroup,{children:c.jsx(y.FormControlLabel,{disabled:m,control:c.jsx(y.Checkbox,{checked:r,onChange:me}),label:t("required")})}),(W||M)&&c.jsx(y.FormGroup,{children:c.jsx(y.FormControlLabel,{disabled:!v,control:c.jsx(y.Checkbox,{checked:h,onChange:Me}),label:t("decisionField",{ns:"form"})})})]}),v&&c.jsxs(c.Fragment,{children:[c.jsx("h4",{children:t("values")}),n==null?void 0:n.map(({value:P,label:F,id:Y,message:Q})=>c.jsxs(y.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[c.jsx(y.TextField,{label:t("label",{ns:"form"}),sx:{flex:1},onChange:xe,value:F,inputProps:{"data-id":Y},required:!0}),c.jsx(y.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:_e,value:P,inputProps:{"data-id":Y},required:!0}),c.jsx(y.TextField,{label:"Message",sx:{flex:1},onChange:se,value:Q,inputProps:{"data-id":Y}}),n.length>1&&c.jsx(y.IconButton,{color:"warning",sx:Va.iconButtonDelete,value:Y,onClick:Ee,children:c.jsx(La,{})})]},Y))]}),v&&c.jsx(y.Box,{justifyContent:"flex-end",display:"flex",children:c.jsx(y.IconButton,{color:"success",sx:Va.iconButton,onClick:w,children:c.jsx(Ra,{})})}),c.jsxs(y.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",paddingTop:3,children:[c.jsx(y.Button,{variant:"text",onClick:e,children:t("cancel")}),c.jsx(y.Button,{variant:"contained",type:"submit",disabled:!!i||A,isLoading:A,loadingIndicator:c.jsx(y.CircularProgress,{size:14}),children:t("validate")})]})]})};var In={},wd=Ae;Object.defineProperty(In,"__esModule",{value:!0});var Qa=In.default=void 0,Id=wd(ke()),Ad=c,Sd=(0,Id.default)((0,Ad.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 2z"}),"AccountTreeRounded");Qa=In.default=Sd;var An={},kd=Ae;Object.defineProperty(An,"__esModule",{value:!0});var Ba=An.default=void 0,zd=kd(ke()),_d=c,Rd=(0,zd.default)((0,_d.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-2zm-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 1z"}),"AddBoxRounded");Ba=An.default=Rd;var Sn={},Ld=Ae;Object.defineProperty(Sn,"__esModule",{value:!0});var qa=Sn.default=void 0,$d=Ld(ke()),Pd=c,Yd=(0,$d.default)((0,Pd.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 2v10zM9 9h6c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-8c0-.55.45-1 1-1zm6.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-1h-2.5z"}),"DeleteOutlineRounded");qa=Sn.default=Yd;var kn={},Fd=Ae;Object.defineProperty(kn,"__esModule",{value:!0});var Wa=kn.default=void 0,Ud=Fd(ke()),Vd=c,Qd=(0,Ud.default)((0,Vd.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.36zM20.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.75 1.83-1.83z"}),"EditRounded");Wa=kn.default=Qd;var zn={},Bd=Ae;Object.defineProperty(zn,"__esModule",{value:!0});var Ga=zn.default=void 0,qd=Bd(ke()),Wd=c,Gd=(0,qd.default)((0,Wd.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-2h-7zm3.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.89z"}),"EnergySavingsLeafRounded");Ga=zn.default=Gd;var _n={},Kd=Ae;Object.defineProperty(_n,"__esModule",{value:!0});var Ka=_n.default=void 0,Jd=Kd(ke()),Ja=c,Zd=(0,Jd.default)([(0,Ja.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.54L14.14 12z"},"0"),(0,Ja.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.54zM13 20c0 1.1.9 2 2 2s2-.9 2-2v-1h-4v1z"},"1")],"ForestRounded");Ka=_n.default=Zd;var Rn={},Xd=Ae;Object.defineProperty(Rn,"__esModule",{value:!0});var Za=Rn.default=void 0,Hd=Xd(ke()),ef=c,tf=(0,Hd.default)((0,ef.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-8zm0 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.36V18z"}),"LoopRounded");Za=Rn.default=tf;var Ln={},rf=Ae;Object.defineProperty(Ln,"__esModule",{value:!0});var Xa=Ln.default=void 0,nf=rf(ke()),of=c,af=(0,nf.default)((0,of.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.55L16.96 12z"}),"ParkRounded");Xa=Ln.default=af;var $n={},sf=Ae;Object.defineProperty($n,"__esModule",{value:!0});var Ha=$n.default=void 0,lf=sf(ke()),cf=c,uf=(0,lf.default)((0,cf.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-.24zM2.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 0zM12 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.5zm2.97-5.33c-.15-1.4-1.25-2.49-2.64-2.64l2.64 2.64z"}),"VisibilityOffRounded");Ha=$n.default=uf;var Pn={},df=Ae;Object.defineProperty(Pn,"__esModule",{value:!0});var ei=Pn.default=void 0,ff=df(ke()),pf=c,hf=(0,ff.default)((0,pf.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 4zm0 12.5c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}),"VisibilityRounded");ei=Pn.default=hf;const we={actionButton:{minWidth:"auto !important"},container:{background:ce.background,borderRadius:"1rem"},containerField:{background:ce.background,border:`solid 1px ${ce.primary}`,borderRadius:"1rem"},containerHidden:{background:ce.background,border:`solid 1px ${ce.borderGrey}`,borderRadius:"1rem"},containerTree:{background:ce.tertiary,border:`solid 1px ${ce.primary}`,borderRadius:"1rem"},containerValue:{background:ce.background,border:`solid 1px ${ce.secondary}`,borderRadius:"1rem"},icon:{color:ce.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}},gf=e=>{const t=!!e,n=e==="tree";return e==="hidden"?we.containerHidden:n?we.containerTree:t?we.containerField:we.containerValue},mf=({nodeDatum:e,onAddChildren:t,onEditChildren:n,onDeleteChildren:r,onOpenTreeModal:o,hierarchyPointNode:a,size:i=220})=>{var z;const{t:l}=$e.useTranslation(["translation","form"]),{attributes:u}=e||{},{isRoot:d,isLeaf:f,required:p,isDecision:h,step:M,type:v,label:g,repeatable:m,tag:x}=u||{},O=!!v,I=v==="tree",A=v==="hidden",b=!O,W=!d&&!f;return c.jsxs("g",{children:[c.jsx(y.GlobalStyles,{styles:{".rd3t-node svg":we.nodeSvg}}),c.jsx(y.Box,{component:"foreignObject",height:i,width:i,x:`-${i/2}`,y:`-${i/2}`,sx:gf(v),children:c.jsxs(y.Box,{flex:1,display:"flex",p:2,height:"100%",flexDirection:"column",justifyContent:"space-between",children:[c.jsxs(y.Stack,{alignItems:"flex-end",spacing:.5,children:[O&&c.jsxs(y.Stack,{direction:"row",spacing:1,alignItems:"center",children:[M&&c.jsx(y.Tooltip,{title:`${l("step",{ns:"form"})} ${(z=e==null?void 0:e.attributes)==null?void 0:z.step}`,placement:"left",arrow:!0,children:c.jsx(y.Chip,{color:"primary",size:"small",label:M,sx:we.stepChip})}),c.jsx(y.Typography,{variant:"subtitle2",sx:we.title,children:c.jsx("strong",{children:g})})]}),O&&c.jsx(y.Chip,{color:"info",size:"small",label:l(`type.${v}`,{ns:"form"})}),x&&c.jsx(y.Chip,{variant:"outlined",color:"warning",size:"small",label:x}),p&&c.jsx(y.Stack,{direction:"row",spacing:.5,children:p&&c.jsx(y.Typography,{variant:"body2",sx:{color:({palette:Te})=>Te.error.main},children:l("required")})}),c.jsx(y.Stack,{spacing:.5,alignItems:"flex-end",children:b&&c.jsx(y.Typography,{variant:"subtitle2",sx:we.title,children:c.jsx("strong",{children:g})})}),c.jsxs(y.Stack,{paddingTop:.5,spacing:.5,direction:"row",children:[m&&c.jsx(y.Tooltip,{title:l("isARepeatable"),placement:"bottom",arrow:!0,children:c.jsx(Za,{style:we.icon})}),f&&c.jsx(y.Tooltip,{title:l("isALeaf"),placement:"bottom",arrow:!0,children:c.jsx(Ga,{style:we.icon})}),A&&c.jsx(y.Tooltip,{title:l("isAHidden"),placement:"bottom",arrow:!0,children:c.jsx(Ha,{style:we.icon})}),d&&c.jsx(y.Tooltip,{title:l("isTheRoot"),placement:"bottom",arrow:!0,children:c.jsx(Xa,{style:we.icon})}),W&&c.jsx(y.Tooltip,{title:l("isABranch"),placement:"bottom",arrow:!0,children:c.jsx(Qa,{style:we.icon})}),I&&c.jsx(y.Tooltip,{title:l("isATree"),placement:"bottom",arrow:!0,children:c.jsx(Ka,{style:we.icon})})]})]}),c.jsxs(y.Stack,{direction:"row",justifyContent:"flex-end",spacing:0,alignSelf:"flex-end",children:[!d&&c.jsx(y.Tooltip,{title:l("remove"),arrow:!0,children:c.jsx(y.Button,{variant:"text",sx:we.actionButton,size:"small",color:"error",onClick:()=>r==null?void 0:r(a),children:c.jsx(qa,{})})}),!b&&c.jsx(y.Tooltip,{title:l("edit"),arrow:!0,children:c.jsx(y.Button,{variant:"text",color:"secondary",sx:we.actionButton,size:"small",onClick:()=>n==null?void 0:n(a),children:c.jsx(Wa,{})})}),!h&&c.jsx(y.Tooltip,{title:l("add"),arrow:!0,children:c.jsx(y.Button,{variant:"text",color:"success",sx:we.actionButton,size:"small",onClick:()=>t==null?void 0:t(a),children:c.jsx(Ba,{})})}),I&&c.jsx(y.Tooltip,{title:l("show"),arrow:!0,children:c.jsx(y.Button,{variant:"text",color:"info",sx:we.actionButton,size:"small",onClick:()=>o==null?void 0:o(a),children:c.jsx(ei,{})})})]})]})})]})},yf=N.memo(mf),ti=()=>{const{setModalOpen:e,setCurrentHierarchyPointNode:t,setTreeModalOpen:n,setTreePath:r}=Ce();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 p,h;const f={label:d==null?void 0:d.data.attributes.label,path:((h=(p=d==null?void 0:d.data)==null?void 0:p.attributes)==null?void 0:h.treePath)||""};r(M=>[...M,f]),n(!0)}}},vf=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,addChildren:i})=>{const{handleDeleteChildren:l,handleEditChildren:u,handleAddChildren:d,handleOpenTreeModal:f}=ti();return c.jsx(yf,{addChildren:i,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,onAddChildren:d,onOpenTreeModal:f,onDeleteChildren:l,onEditChildren:u})},ri=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a,addChildren:i})=>c.jsx(vf,{addChildren:i,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:o,onNodeMouseOut:a}),bf=()=>{const{t:e}=$e.useTranslation(["modal","snackMessage"]),{currentHierarchyPointNode:t,modalOpen:n,setModalOpen:r}=Ce(),o=n==="edit";return{closeModal:()=>r(null),getTitleModalDelete:()=>{var h,M;const p=(M=(h=t==null?void 0:t.data)==null?void 0:h.attributes)==null?void 0:M.label;return e("deleteTitle",{name:p,ns:"modal"})},getTitleModalMutation:()=>{var M;const p=(M=t==null?void 0:t.data)==null?void 0:M.attributes.label;return p?e(o?"editTitle":"addTitle",{name:p,ns:"modal"}):e("addFirstTitle",{name:p,ns:"modal"})},isDeleteModal:n==="delete",isModalMutationOpen:o||n==="add"}},Mf=()=>{const{currentTree:e,setCurrentTree:t,tree:n}=Ce(),{name:r,errorName:o,id:a}=e;return{disabled:!!e.id&&!n,errorName:o,handleChangeName:u=>{const{value:d}=u.target;if(!d){t(f=>({...f,errorName:"Champs requis",name:u.target.value}));return}t(f=>({...f,errorName:"",name:u.target.value}))},id:a,name:r}},xf=()=>{const{t:e}=$e.useTranslation("form"),{name:t,handleChangeName:n,errorName:r,disabled:o}=Mf();return c.jsx(y.TextField,{required:!0,label:e("treeName",{ns:"form"}),size:"small",onChange:n,value:t,error:!!r,disabled:o})},Tf=()=>{var M,v;const{tree:e,treeModalOpen:t,treePath:n,backendConfig:r}=Ce(),{handleCloseTreeModal:o}=ti(),{getTitleModalMutation:a,closeModal:i,getTitleModalDelete:l,isModalMutationOpen:u,isDeleteModal:d}=bf(),f=(M=n==null?void 0:n.at(-1))==null?void 0:M.path,p=(v=n==null?void 0:n.at(-1))==null?void 0:v.label,h=e&&xt(e,f);return c.jsxs(c.Fragment,{children:[c.jsxs(td,{children:[c.jsx(Xu,{children:c.jsxs(y.Stack,{justifyContent:"space-between",direction:"row",alignItems:"center",children:[c.jsx(Oi,{}),!!(r!=null&&r.baseUrl)&&c.jsxs(y.Stack,{direction:"row",alignItems:"center",spacing:2,children:[c.jsx(xf,{}),c.jsx(Ya,{size:"small",arrowOnly:!0,showBtnAddNewTree:!0,fetchWorkflowsOnOpen:!0})]})]})}),c.jsx(ed,{children:c.jsx(eo,{data:e,renderCustomNodeElement:ri})}),c.jsx(nd,{children:c.jsx(ki,{value:e})}),c.jsx(Ju,{children:c.jsx(Yu,{value:e})})]}),c.jsx(ka,{open:u,onClose:i,title:a(),children:c.jsx(Cd,{onClose:i})}),c.jsx(ka,{open:d,onClose:i,title:l(),children:c.jsx(ad,{onClose:i})}),c.jsx(Gu,{open:t,onClose:o,title:p,children:h&&c.jsx(eo,{data:h,renderCustomNodeElement:ri})})]})},jf="0.12.1",Df=({children:e,initialTree:t,initialTreeId:n,backendConfig:r})=>{const[o,a]=N.useState(Fe.currentHierarchyPointNode),[i,l]=N.useState(Fe.modalOpen),[u,d]=N.useState(Fe.treeModalOpen),[f,p]=N.useState(Fe.treePath),[h,M]=N.useReducer(Ru,t||Fe.tree),[v,g]=N.useState(n?{...Fe.currentTree,id:n}:Fe.currentTree),m=N.useMemo(()=>{var x,O;return{backendConfig:{baseUrl:((x=Fe==null?void 0:Fe.backendConfig)==null?void 0:x.baseUrl)||"",...Fe.backendConfig,...r,endpoints:{...(O=Fe.backendConfig)==null?void 0:O.endpoints,...r==null?void 0:r.endpoints}},currentHierarchyPointNode:o,currentTree:v,dispatchTree:M,modalOpen:i,setCurrentHierarchyPointNode:a,setCurrentTree:g,setModalOpen:l,setTreeModalOpen:d,setTreePath:p,tree:h,treeModalOpen:u,treePath:f,version:jf}},[r,o,v,i,h,u,f]);return Zt(v.id,{enabled:!!n,onSuccess:async x=>{x&&(g({id:x==null?void 0:x.id,name:x==null?void 0:x.label}),M(Sa((x==null?void 0:x.workflow)||null)))}}),c.jsx(Xn.Provider,{value:m,children:e})},Nf={close:"Close",createTree:"Create Tree",downloadJSONFile:"Download JSON File",reset:"Reset",resetTree:"Reset tree",save:"Save",update:"Update"},Ef={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:{saveTree:"Tree registered",updateTree:"Tree updated"}},Of={add:"Add",cancel:"Cancel",disabled:"Disabled",edit:"Edit",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",name:"Name",remove:"Remove",required:"Required",save:"Save",show:"Show",tag:"Tag",type:"Type",validate:"Validate",value:"Value",values:"Values"},Cf={close:"Fermer",createTree:"Créer un arbre",downloadJSONFile:"Télécharger le fichier JSON",reset:"Réinitialiser",resetTree:"Réinitialiser l'arbre",save:"Enregistrer",update:"Modifier"},ni={decisionField:"Champs de décision",helperText:"Texte d'information",hiddenValue:"Valeur caché",label:"Label",mustBeUnique:"Doit être unique",newTree:"Nouvel arbre",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",checkbox:"Case à cocher",date:"Date",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",tree:"Arbre",url:"URL"},value:"Valeur",values:"Valeurs"},oi={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"},wf={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:{saveTree:"Arbre enregistré",updateTree:"Arbre mis à jour"}},If={add:"Ajouter",cancel:"Annuler",disabled:"Désactivé",edit:"Éditer",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",name:"Nom",remove:"Supprimer",required:"Requis",save:"Enregistrer",show:"Afficher",tag:"Tag",type:"Type",validate:"Valider",value:"Valeur",values:"Valeurs"};Ot.use(ui).use($e.initReactI18next).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{useSuspense:!0},resources:{en:{button:Nf,form:ni,modal:oi,snackMessage:Ef,translation:Of},fr:{button:Cf,form:ni,modal:oi,snackMessage:wf,translation:If}},returnNull:!1}).then(()=>{document.documentElement.lang!==Ot.resolvedLanguage&&Ot.resolvedLanguage&&document.documentElement.setAttribute("lang",Ot.resolvedLanguage)}),Ot.on("languageChanged",e=>{document.documentElement.setAttribute("lang",e)});const Af=({initialTree:e,initialTreeId:t,backendConfig:n})=>(N.useLayoutEffect(()=>{ct.defaults.baseURL=n==null?void 0:n.baseUrl,n!=null&&n.authToken&&(ct.defaults.headers.common.Authorization=`Bearer ${n==null?void 0:n.authToken}`)},[n==null?void 0:n.authToken,n==null?void 0:n.baseUrl]),c.jsx(lt.QueryClientProvider,{client:vi,children:c.jsx(xi,{authToken:n==null?void 0:n.authToken,children:c.jsx(Df,{backendConfig:n,initialTree:e,initialTreeId:t,children:c.jsx(yi,{children:c.jsx(Ni,{children:c.jsx(Tf,{})})})})})}));Oe.TreePlusIcon=Zn,Oe.Treege=Af,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/utils/tree/findParentNodeByNameInTree/test/findParentNodeByNameInTree.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|