treege 0.18.0 → 0.19.0
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 +2 -2
- package/dist/main.js +545 -537
- package/dist/main.umd.cjs +1 -1
- package/dist/src/constants/fields.d.ts +6 -0
- package/dist/src/features/Treege/components/FieldSelect/useFieldSelect.d.ts +6 -0
- package/dist/src/features/Treege/components/Forms/FormTreeCardMutation/useFormTreeCardMutation.d.ts +1 -1
- package/dist/src/locales/en/form-en.d.ts +1 -0
- package/dist/src/locales/fr/form-fr.d.ts +1 -0
- package/dist/src/utils/tree/appendNode/appendNode.d.ts +1 -1
- package/package.json +1 -1
package/dist/main.umd.cjs
CHANGED
|
@@ -107,4 +107,4 @@ const theme2 = createTheme({ palette: {
|
|
|
107
107
|
} });`:Ot(12,b?` (${b})`:"",JSON.stringify(g.main)));return Jo(g,"light",N,r),Jo(g,"dark",A,r),g.contrastText||(g.contrastText=m(g.main)),g},y={dark:Bn,light:Ko};return process.env.NODE_ENV!=="production"&&(y[t]||console.error(`MUI: The palette mode \`${t}\` is not supported.`)),Ze(X({common:X({},nr),mode:t,primary:h({color:o,name:"primary"}),secondary:h({color:s,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:h({color:l,name:"error"}),warning:h({color:d,name:"warning"}),info:h({color:c,name:"info"}),success:h({color:f,name:"success"}),grey:Lc,contrastThreshold:n,getContrastText:m,augmentColor:h,tonalOffset:r},y[t]),a)}const qc=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];function Wc(e){return Math.round(e*1e5)/1e5}const Zo={textTransform:"uppercase"},Xo='"Roboto", "Helvetica", "Arial", sans-serif';function Gc(e,t){const n=typeof t=="function"?t(e):t,{fontFamily:r=Xo,fontSize:a=14,fontWeightLight:o=300,fontWeightRegular:s=400,fontWeightMedium:l=500,fontWeightBold:c=700,htmlFontSize:f=16,allVariants:d,pxToRem:m}=n,h=it(n,qc);process.env.NODE_ENV!=="production"&&(typeof a!="number"&&console.error("MUI: `fontSize` is required to be a number."),typeof f!="number"&&console.error("MUI: `htmlFontSize` is required to be a number."));const y=a/14,v=m||(x=>`${x/f*y}rem`),g=(x,N,A,k,M)=>X({fontFamily:r,fontWeight:x,fontSize:v(N),lineHeight:A},r===Xo?{letterSpacing:`${Wc(k/N)}em`}:{},M,d),b={h1:g(o,96,1.167,-1.5),h2:g(o,60,1.2,-.5),h3:g(s,48,1.167,0),h4:g(s,34,1.235,.25),h5:g(s,24,1.334,0),h6:g(l,20,1.6,.15),subtitle1:g(s,16,1.75,.15),subtitle2:g(l,14,1.57,.1),body1:g(s,16,1.5,.15),body2:g(s,14,1.43,.15),button:g(l,14,1.75,.4,Zo),caption:g(s,12,1.66,.4),overline:g(s,12,2.66,1,Zo),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return Ze(X({htmlFontSize:f,pxToRem:v,fontFamily:r,fontSize:a,fontWeightLight:o,fontWeightRegular:s,fontWeightMedium:l,fontWeightBold:c},b),h,{clone:!1})}const Kc=.2,Jc=.14,Zc=.12;function ye(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Kc})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Jc})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Zc})`].join(",")}const Xc=["none",ye(0,2,1,-1,0,1,1,0,0,1,3,0),ye(0,3,1,-2,0,2,2,0,0,1,5,0),ye(0,3,3,-2,0,3,4,0,0,1,8,0),ye(0,2,4,-1,0,4,5,0,0,1,10,0),ye(0,3,5,-1,0,5,8,0,0,1,14,0),ye(0,3,5,-1,0,6,10,0,0,1,18,0),ye(0,4,5,-2,0,7,10,1,0,2,16,1),ye(0,5,5,-3,0,8,10,1,0,3,14,2),ye(0,5,6,-3,0,9,12,1,0,3,16,2),ye(0,6,6,-3,0,10,14,1,0,4,18,3),ye(0,6,7,-4,0,11,15,1,0,4,20,3),ye(0,7,8,-4,0,12,17,2,0,5,22,4),ye(0,7,8,-4,0,13,19,2,0,5,24,4),ye(0,7,9,-4,0,14,21,2,0,5,26,4),ye(0,8,9,-5,0,15,22,2,0,6,28,5),ye(0,8,10,-5,0,16,24,2,0,6,30,5),ye(0,8,11,-5,0,17,26,2,0,6,32,5),ye(0,9,11,-5,0,18,28,2,0,7,34,6),ye(0,9,12,-6,0,19,29,2,0,7,36,6),ye(0,10,13,-6,0,20,31,3,0,8,38,7),ye(0,10,13,-6,0,21,33,3,0,8,40,7),ye(0,10,14,-6,0,22,35,3,0,8,42,7),ye(0,11,14,-7,0,23,36,3,0,9,44,8),ye(0,11,15,-7,0,24,38,3,0,9,46,8)],Hc=["duration","easing","delay"],ed={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)"},td={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Ho(e){return`${Math.round(e)}ms`}function rd(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function nd(e){const t=X({},ed,e.easing),n=X({},td,e.duration);return X({getAutoHeightDuration:rd,create:(a=["all"],o={})=>{const{duration:s=n.standard,easing:l=t.easeInOut,delay:c=0}=o,f=it(o,Hc);if(process.env.NODE_ENV!=="production"){const d=h=>typeof h=="string",m=h=>!isNaN(parseFloat(h));!d(a)&&!Array.isArray(a)&&console.error('MUI: Argument "props" must be a string or Array.'),!m(s)&&!d(s)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${s}.`),d(l)||console.error('MUI: Argument "easing" must be a string.'),!m(c)&&!d(c)&&console.error('MUI: Argument "delay" must be a number or a string.'),typeof o!="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(f).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(f).join(",")}].`)}return(Array.isArray(a)?a:[a]).map(d=>`${d} ${typeof s=="string"?s:Ho(s)} ${l} ${typeof c=="string"?c:Ho(c)}`).join(",")}},e,{easing:t,duration:n})}const ad={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},od=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function sd(e={},...t){const{mixins:n={},palette:r={},transitions:a={},typography:o={}}=e,s=it(e,od);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.":Ot(18));const l=Qc(r),c=Un(e);let f=Ze(c,{mixins:Rc(c.breakpoints,n),palette:l,shadows:Xc.slice(),typography:Gc(l,o),transitions:nd(a),zIndex:X({},ad)});if(f=Ze(f,s),f=t.reduce((d,m)=>Ze(d,m),f),process.env.NODE_ENV!=="production"){const d=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],m=(h,y)=>{let v;for(v in h){const g=h[v];if(d.indexOf(v)!==-1&&Object.keys(g).length>0){if(process.env.NODE_ENV!=="production"){const b=En("",v);console.error([`MUI: The \`${y}\` 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 '&.${b}' syntax:`,JSON.stringify({root:{[`&.${b}`]:g}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
109
109
|
`))}h[v]={}}}};Object.keys(f.components).forEach(h=>{const y=f.components[h].styleOverrides;y&&h.indexOf("Mui")===0&&m(y,h)})}return f.unstable_sxConfig=X({},Fn,s==null?void 0:s.unstable_sxConfig),f.unstable_sx=function(m){return Yn({sx:m,theme:this})},f}const es=sd(),ts="$$material";function id({props:e,name:t}){return Ac({props:e,name:t,defaultTheme:es,themeId:ts})}const ld=wc({themeId:ts,defaultTheme:es,rootShouldForwardProp:e=>Ur(e)&&e!=="classes"});function ud(e){return En("MuiSvgIcon",e)}bl("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const cd=["children","className","color","component","fontSize","htmlColor","inheritViewBox","titleAccess","viewBox"],dd=e=>{const{color:t,fontSize:n,classes:r}=e,a={root:["root",t!=="inherit"&&`color${Xe(t)}`,`fontSize${Xe(n)}`]};return ml(a,ud,r)},fd=ld("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${Xe(n.color)}`],t[`fontSize${Xe(n.fontSize)}`]]}})(({theme:e,ownerState:t})=>{var n,r,a,o,s,l,c,f,d,m,h,y,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:(a=e.transitions)==null||(a=a.duration)==null?void 0:a.shorter}),fontSize:{inherit:"inherit",small:((o=e.typography)==null||(s=o.pxToRem)==null?void 0:s.call(o,20))||"1.25rem",medium:((l=e.typography)==null||(c=l.pxToRem)==null?void 0:c.call(l,24))||"1.5rem",large:((f=e.typography)==null||(d=f.pxToRem)==null?void 0:d.call(f,35))||"2.1875rem"}[t.fontSize],color:(m=(h=(e.vars||e).palette)==null||(h=h[t.color])==null?void 0:h.main)!=null?m:{action:(y=(e.vars||e).palette)==null||(y=y.action)==null?void 0:y.active,disabled:(v=(e.vars||e).palette)==null||(v=v.action)==null?void 0:v.disabled,inherit:void 0}[t.color]}}),Qn=Z.forwardRef(function(t,n){const r=id({props:t,name:"MuiSvgIcon"}),{children:a,className:o,color:s="inherit",component:l="svg",fontSize:c="medium",htmlColor:f,inheritViewBox:d=!1,titleAccess:m,viewBox:h="0 0 24 24"}=r,y=it(r,cd),v=Z.isValidElement(a)&&a.type==="svg",g=X({},r,{color:s,component:l,fontSize:c,instanceFontSize:t.fontSize,inheritViewBox:d,viewBox:h,hasSvgAsChild:v}),b={};d||(b.viewBox=h);const x=dd(g);return i.jsxs(fd,X({as:l,className:vl(x.root,o),focusable:"false",color:f,"aria-hidden":m?void 0:!0,role:m?"img":void 0,ref:n},b,y,v&&a.props,{ownerState:g,children:[v?a.props.children:a,m?i.jsx("title",{children:m}):null]}))});process.env.NODE_ENV!=="production"&&(Qn.propTypes={children:he.node,classes:he.object,className:he.string,color:he.oneOfType([he.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),he.string]),component:he.elementType,fontSize:he.oneOfType([he.oneOf(["inherit","large","medium","small"]),he.string]),htmlColor:he.string,inheritViewBox:he.bool,shapeRendering:he.string,sx:he.oneOfType([he.arrayOf(he.oneOfType([he.func,he.object,he.bool])),he.func,he.object]),titleAccess:he.string,viewBox:he.string}),Qn.muiName="SvgIcon";const rs=Qn;function pd(e,t){function n(r,a){return i.jsx(rs,X({"data-testid":`${t}Icon`,ref:a},r,{children:e}))}return process.env.NODE_ENV!=="production"&&(n.displayName=`${t}Icon`),n.muiName=rs.muiName,Z.memo(Z.forwardRef(n))}const hd=mi(Object.freeze(Object.defineProperty({__proto__:null,capitalize:Xe,createChainedFunction:Ji,createSvgIcon:pd,debounce:Zi,deprecatedPropType:Xi,isMuiElement:Hi,ownerDocument:Xa,ownerWindow:el,requirePropFactory:tl,setRef:Ha,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
|
-
`)),so.configure(e)}},unstable_useEnhancedEffect:eo,unstable_useId:nl,unsupportedProp:al,useControlled:ol,useEventCallback:sl,useForkRef:il,useIsFocusVisible:hl},Symbol.toStringTag,{value:"Module"})));var ns;function Ne(){return ns||(ns=1,function(e){"use client";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=hd}(pn)),pn}var md=Ee;Object.defineProperty(fn,"__esModule",{value:!0});var as=fn.default=void 0,gd=md(Ne()),bd=i,vd=(0,gd.default)((0,bd.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");as=fn.default=vd;var qn={},yd=Ee;Object.defineProperty(qn,"__esModule",{value:!0});var os=qn.default=void 0,Md=yd(Ne()),xd=i,Td=(0,Md.default)((0,xd.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");os=qn.default=Td;var Wn={},jd=Ee;Object.defineProperty(Wn,"__esModule",{value:!0});var ss=Wn.default=void 0,Dd=jd(Ne()),Ed=i,Nd=(0,Dd.default)((0,Ed.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");ss=Wn.default=Nd;const is=(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 a=n[r],o=is(a,t);if(o)return o}return null},$t=(e,t)=>{var o,s,l,c,f;if(!e)return null;if(!t)return e;if(((o=e.attributes)==null?void 0:o.treePath)===t)return((s=e.attributes)==null?void 0:s.tree)||null;let n=null;const r=(l=e.attributes)==null?void 0:l.tree,a=(c=e.children)==null?void 0:c.length;if(r&&(n=$t((f=e.attributes)==null?void 0:f.tree,t)),a){const{children:d}=e;for(let m=0;m<d.length;m+=1){const h=d[m];if(n!==null)return n;n=$t(h,t)}}return n},Br=(e,t,n)=>{const r=$t(e,t);return is(r,n)},Od=(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)},Cd=({tree:e,path:t,name:n,child:r})=>{var c;const{attributes:a,children:o}=r;if(!e)return o.length?{...r}:{...r,attributes:{...a,isLeaf:!0,isRoot:!0}};const s=structuredClone(e),l=Br(s,t,n);return Od(l,{...r,...!a.isDecision&&{children:[...((c=Br(e,t,n))==null?void 0:c.children)||[]]}}),s},ls=(e,t,n=null)=>{if(!e)return null;if(e.name===t)return n;const r=e.children||[];for(let a=0;a<r.length;a+=1){const o=r[a],s=ls(o,t,e);if(s!==null)return s}return null},wd=(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),Id=(e,t,n)=>{const r=$t(e,t);return ls(r,n)},Ad=({tree:e,path:t,name:n})=>{const r=structuredClone(e),a=Br(r,t,n),o=Id(r,t,n);return wd(o,a),r},us=e=>{if(!e)return[];const t=[],n=r=>{if(r.name&&t.push(r.name),r.children.length){const{children:a}=r;for(let o=0;o<a.length;o+=1)n(a[o])}};return n(e),t},kd=(e,t)=>{if(!e)return null;const n=t.attributes.isDecision,r=e.attributes.isDecision,a=e.attributes.depth===0,o={value:t.name},s=r||n,l=s?{value:[...t.children]}:{value:[...e.children]},c=s?{value:{...t.attributes,isLeaf:!t.children.length||!n,isRoot:a}}:{value:{...t.attributes,isLeaf:!e.children.length,isRoot:a}};return Object.defineProperties(e,{attributes:c,children:l,name:o}),null},Sd=({tree:e,path:t,name:n,child:r})=>{const a=structuredClone(e),o=Br(a,t,n);return kd(o,r),a},at={appendTreeCard:"appendTreeCard",deleteTreeCard:"deleteTreeCard",replaceTreeCard:"replaceTreeCard",resetTree:"resetTree",setTree:"setTree"},_d=(e,t,n)=>({children:n,name:t,path:e,type:at.appendTreeCard}),zd=(e,t,n)=>({children:n,name:t,path:e,type:at.replaceTreeCard}),Rd=(e,t)=>({name:t,path:e,type:at.deleteTreeCard}),cs=()=>({type:at.resetTree}),ds=e=>({tree:e,type:at.setTree}),Ld=(e,t)=>{switch(t.type){case at.appendTreeCard:{const{name:n,path:r,children:a}=t;return Cd({child:a,name:n,path:r,tree:e})}case at.deleteTreeCard:{const{path:n,name:r}=t;return Ad({name:r,path:n,tree:e})}case at.replaceTreeCard:{const{name:n,path:r,children:a}=t;return Sd({child:a,name:n,path:r,tree:e})}case at.resetTree:return null;case at.setTree:return t.tree;default:throw new Error}},Gn=()=>{const{dispatchSnackbar:e}=E.useContext(Oa);return{close:()=>e(Ca()),open:(r,a="success")=>e(Di(r,a))}},$d=e=>{const{backendConfig:t}=Ae(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return Et.useMutation(["patchWorkflow"],async a=>{const{data:o}=await Nt.patch(r,a);return o},e)},Pd=e=>{const{backendConfig:t}=Ae(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return Et.useMutation(["postWorkflow"],async a=>{const{data:o}=await Nt.post(r,a);return o},e)},Fd=()=>{const{t:e}=Se.useTranslation(["snackMessage"]),{open:t}=Gn(),{setCurrentTree:n,currentTree:r,tree:a,dispatchTree:o}=Ae(),[s,l]=E.useState(!1),{version:c}=Ae(),{mutate:f}=Pd({onError:()=>{t(e("error.saveTree",{ns:"snackMessage"}),"error")},onSuccess:x=>{t(e("success.saveTree",{ns:"snackMessage"})),n(N=>({...N,id:x.workflow_id}))}}),{mutate:d}=$d({onError:()=>{t(e("error.updateTree",{ns:"snackMessage"}),"error")},onSuccess:()=>{t(e("success.updateTree",{ns:"snackMessage"}))}}),m=x=>JSON.stringify(x,null,2),h=x=>`data:text/json;charset=utf-8,${encodeURIComponent(m(x))}`,y=()=>{l(!1)};return{formatJSON:m,getDownloadLink:h,handleClose:y,handleOpen:()=>{l(!0)},handleResetTree:()=>{o(cs()),y()},handleSubmit:()=>{const{name:x,id:N}=r;if(!x){n(A=>({...A,errorName:"Champs Requis"}));return}if(a){if(N){d({id:N,label:x,version:c,workflow:a});return}f({label:x,version:c,workflow:a})}},openModal:s}},Yd=({downloadedFileName:e="export",value:t})=>{const{t:n}=Se.useTranslation(),{getDownloadLink:r,handleSubmit:a,handleClose:o,handleOpen:s,handleResetTree:l,openModal:c}=Fd(),{currentTree:f,backendConfig:d,tree:m}=Ae(),{id:h}=f;return i.jsxs(p.Stack,{direction:"row",spacing:2,justifyContent:"center",children:[i.jsx(p.Tooltip,{title:n("resetTree",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.Button,{disabled:!m,onClick:s,variant:"outlined",color:"warning",children:i.jsx(as,{})})})}),i.jsx(p.Divider,{orientation:"vertical",flexItem:!0}),i.jsx(p.Tooltip,{title:n("downloadJSONFile",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.Button,{variant:"outlined",href:r(t),download:`${e}.json`,disabled:!t,children:i.jsx(ss,{})})})}),i.jsx(p.Tooltip,{title:h?n("update",{ns:"button"}):n("save",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.Button,{variant:"outlined",onClick:a,disabled:!t||!(d!=null&&d.baseUrl),children:i.jsx(os,{})})})}),i.jsxs(p.Dialog,{maxWidth:"xs",fullWidth:!0,open:c,onClose:o,children:[i.jsx(p.DialogTitle,{variant:"h3",children:n("resetTree",{ns:"button"})}),i.jsx(p.DialogContent,{children:i.jsx(p.DialogContentText,{children:n("resetTreeContent",{ns:"modal"})})}),i.jsxs(p.DialogActions,{children:[i.jsx(p.Button,{onClick:o,children:n("close",{ns:"button"})}),i.jsx(p.Button,{variant:"contained",color:"warning",onClick:l,children:n("reset",{ns:"button"})})]})]})]})},Ud={box:{backgroundColor:pe.background,border:`solid 1px ${pe.borderBlue}`}},fs=({children:e,description:t,open:n,onClose:r,title:a})=>i.jsx(p.Dialog,{open:n,onClose:r,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",scroll:"body",maxWidth:"sm",fullWidth:!0,children:i.jsxs(p.Box,{sx:Ud.box,p:4,children:[i.jsx("h3",{children:a}),i.jsx("p",{children:t}),e]})});var Kn={},Vd=Ee;Object.defineProperty(Kn,"__esModule",{value:!0});var ps=Kn.default=void 0,Bd=Vd(Ne()),Qd=i,qd=(0,Bd.default)((0,Qd.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");ps=Kn.default=qd;const Qr={container:{display:"flex",flexDirection:"column",height:"100%",margin:1},main:{border:`solid 1px ${pe.borderBlue}`,height:" 100%",margin:1},toolbar:{backgroundColor:pe.background,boxShadow:"none",display:"flex",padding:"0 ! important"},toolbarBox:{backgroundColor:pe.tertiary,border:`solid 1px ${pe.primary}`,margin:1,paddingX:2,paddingY:1,width:"100%"}},Wd=({children:e,appear:t,in:n,onEnter:r,onExited:a,onFocus:o,role:s,tabIndex:l,timeout:c},f)=>i.jsx(p.Slide,{direction:"up",ref:f,appear:t,in:n,onEnter:r,onExited:a,onFocus:o,role:s,tabIndex:l,timeout:c,children:e}),Gd=E.forwardRef(Wd),Kd=({children:e,open:t,onClose:n,title:r})=>i.jsx(p.Dialog,{PaperProps:{sx:{backgroundColor:pe.background,backgroundImage:"none"}},open:t,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",fullScreen:!0,TransitionComponent:Gd,children:i.jsxs(p.Box,{sx:Qr.container,children:[i.jsx(p.AppBar,{position:"sticky",elevation:0,children:i.jsx(p.Toolbar,{sx:Qr.toolbar,children:i.jsxs(p.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:Qr.toolbarBox,children:[i.jsx(p.Typography,{variant:"h5",children:i.jsx("strong",{children:r})}),i.jsx(p.IconButton,{edge:"end",color:"inherit",onClick:n,"aria-label":"close",children:i.jsx(ps,{})})]})})}),i.jsx(p.Box,{sx:Qr.main,children:e})]})}),Jd={box:{border:`solid 1px ${pe.borderBlue}`,flexGrow:0}},Zd=({children:e})=>i.jsx(p.Box,{p:2,role:"group",sx:Jd.box,children:e}),Xd={box:{border:`solid 1px ${pe.borderBlue}`,flexGrow:0}},Hd=({children:e})=>i.jsx(p.Box,{sx:Xd.box,padding:2,component:"header",children:e}),ef={box:{border:`solid 1px ${pe.borderBlue}`,flexGrow:1}},tf=({children:e})=>i.jsx(p.Box,{sx:ef.box,component:"main",role:"tree",children:e}),hs={stack:{width:"100%"}},rf=({children:e})=>{const t=E.Children.toArray(e);return i.jsxs(p.Grid,{container:!0,padding:1,flexWrap:"nowrap",height:"100%",role:"treegrid",children:[i.jsx(p.Grid,{item:!0,xs:9,padding:1,display:"flex",children:i.jsxs(p.Stack,{sx:hs.stack,spacing:2,children:[t[0],t[1]]})}),i.jsx(p.Grid,{item:!0,xs:3,padding:1,display:"flex",children:i.jsxs(p.Stack,{sx:hs.stack,spacing:2,children:[t[2],t[3]]})})]})},nf={box:{border:`solid 1px ${pe.borderBlue}`,flexGrow:1,overflow:"auto"}},af=({children:e})=>i.jsx(p.Box,{sx:nf.box,component:"aside",children:e}),of=()=>{const{dispatchTree:e,setModalOpen:t,currentHierarchyPointNode:n,treePath:r}=Ae();return{handleSubmit:o=>{var c,f;o.preventDefault();const s=((c=n==null?void 0:n.data)==null?void 0:c.name)||"",l=((f=r==null?void 0:r.at(-1))==null?void 0:f.path)||"";e(Rd(l,s)),t(null)}}},sf=({onClose:e})=>{const{t}=Se.useTranslation(),{handleSubmit:n}=of();return i.jsx("form",{onSubmit:n,children:i.jsxs(p.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:[i.jsx(p.Button,{variant:"text",onClick:e,children:t("cancel")}),i.jsx(p.Button,{variant:"contained",color:"error",type:"submit",children:t("remove")})]})})};var Jn={},lf=Ee;Object.defineProperty(Jn,"__esModule",{value:!0});var Zn=Jn.default=void 0,uf=lf(Ne()),cf=i,df=(0,uf.default)((0,cf.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");Zn=Jn.default=df;var Xn={},ff=Ee;Object.defineProperty(Xn,"__esModule",{value:!0});var ms=Xn.default=void 0,pf=ff(Ne()),hf=i,mf=(0,pf.default)((0,hf.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward");ms=Xn.default=mf;var Hn={},gf=Ee;Object.defineProperty(Hn,"__esModule",{value:!0});var gs=Hn.default=void 0,bf=gf(Ne()),vf=i,yf=(0,bf.default)((0,vf.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown");gs=Hn.default=yf;var ea={},Mf=Ee;Object.defineProperty(ea,"__esModule",{value:!0});var ta=ea.default=void 0,xf=Mf(Ne()),Tf=i,jf=(0,xf.default)((0,Tf.jsx)("path",{d:"M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z"}),"LinkRounded");ta=ea.default=jf;var ra={},Df=Ee;Object.defineProperty(ra,"__esModule",{value:!0});var bs=ra.default=void 0,Ef=Df(Ne()),Nf=i,Of=(0,Ef.default)((0,Nf.jsx)("path",{d:"M7.92 7.54c-.8-.34-1.14-1.33-.66-2.05C8.23 4.05 9.85 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.15.27-.24.49-.3.94-.09.73-.69 1.3-1.43 1.3-.87 0-1.58-.75-1.48-1.62.06-.51.18-1.04.46-1.54.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.17 0-1.93.61-2.4 1.34-.35.57-1.08.75-1.69.5zM14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z"}),"QuestionMarkRounded");bs=ra.default=Of;var na={},Cf=Ee;Object.defineProperty(na,"__esModule",{value:!0});var aa=na.default=void 0,wf=Cf(Ne()),If=i,Af=(0,wf.default)((0,If.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");aa=na.default=Af;const kf=e=>e.filter(t=>!t.includes(":")),Sf=({value:e,onChange:t,currentName:n})=>{const{t:r}=Se.useTranslation(["form"]),{tree:a}=Ae(),[o,s]=E.useState(e||""),l=us(a),c=kf(l).filter(d=>d!==n),f=d=>{const m=d.target.value;s(m),t==null||t(d,m)};return i.jsxs(p.FormControl,{sx:{flex:1.5},required:!0,children:[i.jsx(p.InputLabel,{children:r("form:ancestor")}),i.jsx(p.Select,{sx:{flex:2},value:o,label:r("form:ancestor"),onChange:f,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:c.length?c.map((d,m)=>{const h=`${d}-${m}`;return i.jsx(p.MenuItem,{value:d,children:d},h)}):i.jsx(p.MenuItem,{disabled:!0,value:"",children:r("form:noAncestorFound")})})]})},qr={container:{backgroundColor:"#282c34",borderRadius:.5,color:"#abb2bf",display:"inline-block",lineHeight:1.5,marginBottom:.2,paddingX:.5,paddingY:.2,width:"fit-content"},property:{color:"#56b6c2"},type:{color:"#c678dd"}},_f=({value:e})=>{const{t}=Se.useTranslation(["translation","form"]);return i.jsx(p.Alert,{severity:"warning",variant:"outlined",children:i.jsxs(p.Typography,{component:"div",variant:"body2",gutterBottom:!0,sx:{lineHeight:2},children:[t("form:warningApiSelect.url")," ",t("form:warningApiSelect.warning")," ",t("form:warningApiSelect.response"),i.jsxs(p.Box,{sx:qr.container,children:["https://api.example.com/","{{",i.jsx(p.Box,{component:"span",sx:qr.type,children:e||"value"}),i.jsx(p.Box,{component:"span",sx:qr.property,children:": string"}),"}}","/endpoint ",i.jsx(p.Box,{component:"span",sx:qr.property})]})]})})},mt={container:{backgroundColor:"#282c34",borderRadius:.5,color:"#abb2bf",display:"inline-block",lineHeight:1.5,marginBottom:.2,paddingX:.5,paddingY:.2,width:"fit-content"},property:{color:"#56b6c2"},type:{color:"#c678dd"}},zf=({endPoint:e})=>{const{t}=Se.useTranslation(["translation","form"]),{url:n,searchKey:r}=e,a=`${n}?${r}`;return i.jsx(p.Alert,{severity:"warning",variant:"outlined",children:i.jsxs(p.Typography,{component:"div",variant:"body2",gutterBottom:!0,sx:{lineHeight:2},children:[t("form:warningApiAutocomplete.url")," ",n&&i.jsxs(i.Fragment,{children:[i.jsx(p.Box,{component:"span",sx:mt.container,children:a})," "]}),t("form:warningApiAutocomplete.response"),i.jsxs(p.Box,{sx:mt.container,children:["{ ",i.jsx(p.Box,{component:"span",sx:mt.property,children:"label"}),":"," ",i.jsx(p.Box,{component:"span",sx:mt.type,children:"string"}),";"," ",i.jsx(p.Box,{component:"span",sx:mt.property,children:"value"}),":"," ",i.jsx(p.Box,{component:"span",sx:mt.type,children:"string"}),";"," ",i.jsx(p.Box,{component:"span",sx:mt.property,children:"img"}),i.jsx(p.Box,{component:"span",className:"semicolon",children:"?"}),":"," ",i.jsx(p.Box,{component:"span",sx:mt.type,children:"string"}),"; }"]})]})})},Pt=[{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"text"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"number"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"email"},{isBooleanField:!1,isDecisionField:!1,isMultiple:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"file"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"password"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"tel"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"address"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"url"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"date"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"dateRange"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"time"},{isBooleanField:!0,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"switch"},{isBooleanField:!0,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"checkbox"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"hidden"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"tree"},{isBooleanField:!1,isDecisionField:!0,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"radio"},{isBooleanField:!1,isDecisionField:!0,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"select"},{initialQueryEnable:!0,isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"autocomplete"},{isBooleanField:!1,isDecisionField:!1,isMultiple:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"dynamicSelect"}],Rf=()=>{const{backendConfig:e}=Ae();return{fields:E.useCallback(()=>Pt.filter(n=>!(n.type==="tree"&&!(e!=null&&e.baseUrl))),[e==null?void 0:e.baseUrl])()}},Lf=({onChange:e,value:t})=>{const{t:n}=Se.useTranslation(["translation","form"]),{fields:r}=Rf();return i.jsxs(p.FormControl,{sx:{flex:1},required:!0,children:[i.jsx(p.InputLabel,{children:n("type")}),i.jsx(p.Select,{value:t,label:n("type"),onChange:e,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:r.map(({type:a,isDecisionField:o})=>i.jsxs(p.MenuItem,{value:a,children:[n(`type.${a}`,{ns:"form"}),o&&i.jsx(p.Chip,{label:n("decisionField",{ns:"form"}),size:"small",color:"info",sx:{marginLeft:1}})]},a))})]})},$f=e=>{if(!e)return[];const t=new Set,n=r=>{var a,o;if((a=r==null?void 0:r.attributes)!=null&&a.tag&&t.add(r.attributes.tag),(o=r==null?void 0:r.children)!=null&&o.length){const{children:s}=r;for(let l=0;l<s.length;l+=1)n(s[l])}};return n(e),[...t]},Pf=p.createFilterOptions(),Ff=({value:e,onChange:t})=>{const{t:n}=Se.useTranslation(["translation","form"]),{tree:r}=Ae(),a=$f(r).reduce((o,s)=>[...o,{inputValue:s,label:s}],[]);return i.jsx(p.Autocomplete,{freeSolo:!0,fullWidth:!0,value:e,onChange:t,filterOptions:(o,s)=>{const l=Pf(o,s),{inputValue:c}=s,f=o.some(d=>typeof d!="string"&&c===d.label);return c!==""&&!f&&l.push({inputValue:c,label:`${n("add")} "${c}"`}),l},getOptionLabel:o=>typeof o=="string"?o:o.inputValue?o.inputValue:o.label,renderOption:(o,s)=>i.jsx("li",{...o,children:typeof s!="string"&&s.label}),renderInput:o=>i.jsx(p.TextField,{...o,label:n("tag")}),options:a})};var oa={},Yf=Ee;Object.defineProperty(oa,"__esModule",{value:!0});var vs=oa.default=void 0,Uf=Yf(Ne()),Vf=i,Bf=(0,Uf.default)((0,Vf.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");vs=oa.default=Bf;const Qf=e=>{const{backendConfig:t}=Ae(),{endpoints:n}=t||{},{workflows:r=""}=n||{};return Et.useQuery(["workflows"],async({signal:a})=>{const{data:o}=await Nt.get(r,{signal:a});return o},e)},qf=({isControlled:e,fetchWorkflowsOnOpen:t})=>{const{t:n}=Se.useTranslation("snackMessage"),{open:r}=Gn(),{currentTree:a,setCurrentTree:o,dispatchTree:s}=Ae(),[l,c]=E.useState(""),f=!!l&&!e&&l!==a.id,{data:d,isError:m}=vr(l,{enabled:f}),{data:h,isLoading:y,refetch:v}=Qf({enabled:!t}),g=E.useCallback(async({target:x})=>{var A;const{value:N}=x;if(N==="add-new-tree"){c(""),o({name:""}),s(cs());return}c(N),o({id:N,name:(A=h==null?void 0:h.find(k=>k.id===N))==null?void 0:A.label})},[s,o,h]),b=E.useCallback(async()=>{if(t)try{await v(),a.id&&!l&&c(a.id)}catch{r(n("error.fetchTree",{ns:"snackMessage"}),"error")}},[t,v,a.id,l,r,n]);return E.useEffect(()=>{if(d&&l!==a.id){const{id:x,label:N,workflow:A}=d;o({id:x,name:N}),s(ds(A))}},[a.id,s,e,o,l,d]),E.useEffect(()=>{m&&r(n("error.fetchTree",{ns:"snackMessage"}),"error")},[m,r,n]),{currentTree:a,fetchWorkflowSuggestions:v,handleChangeTree:g,handleOnOpen:b,setTreeSelected:c,treeSelected:l,workflowsSuggestions:h,workflowsSuggestionsLoading:y}},ys={formControl:{flex:1},select:{".MuiOutlinedInput-notchedOutline":{border:0,paddingLeft:5},".MuiSelect-select":{opacity:0,width:0},boxShadow:"none"}},Ms=({arrowOnly:e,required:t,size:n,showBtnAddNewTree:r,onChange:a,value:o,fetchWorkflowsOnOpen:s})=>{const{t:l}=Se.useTranslation("form"),c=E.useMemo(()=>!!a,[a]),{handleChangeTree:f,handleOnOpen:d,workflowsSuggestions:m,workflowsSuggestionsLoading:h,treeSelected:y}=qf({fetchWorkflowsOnOpen:s,isControlled:c});return i.jsxs(p.FormControl,{size:n,required:t,sx:ys.formControl,children:[!e&&i.jsx(p.InputLabel,{children:l("tree",{ns:"form"})}),i.jsxs(p.Select,{value:c?o:y,id:"tree-select",onChange:v=>c?a==null?void 0:a(v):f(v),sx:e?ys.select:void 0,label:l("tree",{ns:"form"}),onOpen:d,children:[(o&&h||h)&&i.jsx(p.MenuItem,{value:o,children:i.jsx(p.Skeleton,{width:"100%"})}),m==null?void 0:m.map(({label:v,id:g})=>i.jsx(p.MenuItem,{value:g,children:v},g)),r&&i.jsx(p.MenuItem,{disabled:!0,children:i.jsx(p.Box,{sx:{height:1,width:"100%"},children:i.jsx(p.Divider,{})})}),r&&i.jsxs(p.MenuItem,{value:"add-new-tree",children:[i.jsx(p.Typography,{mr:1,children:l("newTree",{ns:"form"})}),i.jsx(vs,{color:"primary"})]})]})]})},Wf=({helperText:e,hiddenValue:t,isHiddenField:n,isTreeField:r,treeSelected:a,handleChangeTreeSelect:o,handleChangeHelperText:s,handleChangeHiddenValue:l})=>{const{t:c}=Se.useTranslation(["translation","form"]);return r?i.jsx(Ms,{required:!0,value:a,onChange:o}):n?i.jsx(p.TextField,{required:!0,sx:{flex:1},label:c("hiddenValue",{ns:"form"}),onChange:l,value:t}):i.jsx(p.TextField,{sx:{flex:1},label:c("helperText",{ns:"form"}),onChange:s,value:e})},xs=e=>new Set([...e]).size===e.length,Gf=(e,t,n)=>{const r=[...e,t];return xs(n?r.filter(a=>a!==n):r)},Kf=()=>{var u,j,C,$,H,ue,K,G,Re,Me,xe,Ue,ft,cr,Ke,$s,Ps,Fs,Ys,Us,Vs,Bs,Qs,qs,Ws,Gs,Ks,Js,Zs,Xs,Hs;const e=E.useMemo(()=>[{id:"0",label:"",message:"",value:""}],[]),{tree:t,dispatchTree:n,currentHierarchyPointNode:r,modalOpen:a,treePath:o,setModalOpen:s}=Ae(),{open:l}=Gn(),{t:c}=Se.useTranslation(),f=r!=null&&r.data&&((u=r==null?void 0:r.data)!=null&&u.attributes)&&"isMultiple"in r.data.attributes?!!r.data.attributes.isMultiple:null,[d,m]=E.useState(e),[h,y]=E.useState(""),[v,g]=E.useState(""),[b,x]=E.useState(""),[N,A]=E.useState(!1),[k,M]=E.useState(!1),[q,z]=E.useState(!1),[ce,De]=E.useState("text"),[_,de]=E.useState(null),[fe,me]=E.useState(null),[ne,ee]=E.useState({url:""}),[ge,$e]=E.useState(""),[Pe,Be]=E.useState(""),[D,w]=E.useState(""),[U,F]=E.useState({off:"",on:""}),[R,Q]=E.useState(!1),[L,Y]=E.useState(!1),[B,W]=E.useState(""),V=a==="edit",be=ce==="tree",O=ce==="hidden",Ce=ce==="autocomplete",I=ce==="dynamicSelect",ze=Pt.some(T=>T.type===ce&&(T==null?void 0:T.isBooleanField)),Fe=Pt.some(T=>T.type===ce&&(T==null?void 0:T.isDecisionField)),ut=Pt.some(T=>T.type===ce&&(T==null?void 0:T.isRequiredDisabled)),Ft=Pt.some(T=>T.type===ce&&(T==null?void 0:T.isRepeatableDisabled)),ot=((C=(j=r==null?void 0:r.data)==null?void 0:j.attributes)==null?void 0:C.isLeaf)??!0,Mt=Pt.some(T=>T.type===ce&&"isMultiple"in T),{refetch:Yt,isInitialLoading:xt}=vr(ge,{enabled:!1}),gt=E.useCallback(T=>!Fe&&T>0,[Fe]),Ge=E.useCallback((T,S)=>{m(P=>P.map(J=>{const{id:ve}=J;return T.target.dataset.id===ve?{...J,id:ve,[S]:T.target.value}:{...J}}))},[]),Ut=E.useCallback((T,S)=>{typeof S=="string"?de(S):S&&S.inputValue?de(S.inputValue):de(null)},[]),ct=E.useCallback((T,S)=>{ee(P=>({...P,url:P.url?P.url.replace(/{{[^{}]+}}/,`{{${S||""}}}`):`https://example.com/{{${S||""}}}`})),me(S??null)},[]),dt=E.useCallback(T=>{g(T.target.value)},[]),or=E.useCallback(T=>{x(T.target.value)},[]),Vt=E.useCallback(T=>{Ge(T,"label")},[Ge]),Bt=E.useCallback(T=>{Ge(T,"value")},[Ge]),we=E.useCallback(T=>{Ge(T,"message")},[Ge]),Tt=E.useCallback(T=>{ee(S=>({...S,url:T.target.value}))},[]),et=E.useCallback(T=>{const S=T.target.value;if(S.includes("{{}}")){const P=S.replace("{{}}",`{{${fe||""}}}`);ee(J=>({...J,url:P}))}else if(S.includes("{{")){const P=S.replace(/{{[^{}]+}}/,`{{${fe||""}}}`);ee(J=>({...J,url:P}))}else ee(P=>({...P,url:S}))},[fe]),bt=E.useCallback(T=>{ee(S=>({...S,searchKey:T.target.value}))},[]),jt=E.useCallback((T,S)=>{ee(P=>{const J={...P.pathKey,[T]:S.target.value};if(S.target.value===""&&T in J){const{pathKey:ve,...Ie}=P;return{...Ie}}return{...P,pathKey:J}})},[ee]),ga=E.useCallback((T,S,P)=>{ee(J=>{const ve=[...J.params??[]];return ve[T]={...ve[T],[S]:P.target.value},{...J,params:ve}})},[ee]),ba=E.useCallback(T=>{w(T.target.value)},[]),va=E.useCallback(T=>{var Je;const{value:S}=T.target;if(y(S),!t||!S){W("");return}const P=V&&(r==null?void 0:r.data.name),J=(Je=o==null?void 0:o.at(-1))==null?void 0:Je.path,ve=$t(t,J),Ie=us(ve);if(Gf(Ie,S,P)){W("");return}W(c("mustBeUnique",{ns:"form"}))},[r==null?void 0:r.data.name,V,c,t,o]),sr=E.useCallback(T=>{z(T.target.checked)},[]),Gr=E.useCallback(T=>{A(T.target.checked)},[]),vt=E.useCallback(T=>{Y(T.target.checked)},[]),ir=E.useCallback(T=>{M(T.target.checked)},[]),lr=E.useCallback(T=>{Q(T.target.checked)},[]),Kr=E.useCallback(T=>{De(T.target.value),M(!1),A(!1),Q(!1)},[]),ya=E.useCallback(T=>{$e(T.target.value)},[]),Jr=E.useCallback(T=>S=>{F(P=>({...P,[T]:S.target.value}))},[]),Ma=E.useCallback(T=>{Be(T.target.value)},[]),Zr=E.useCallback(()=>{m(T=>{const S=Number(T[T.length-1].id),P=String(S+1);return[...T,{...e[0],id:P}]})},[e]),Xr=E.useCallback(()=>{ee(T=>{var ve,Ie;const S=Number(((Ie=(ve=T.params)==null?void 0:ve[T.params.length-1])==null?void 0:Ie.id)||0),P=String(S+1),J=[...T.params||[],{id:P,key:"",value:""}];return{...T,params:J}})},[]),xa=E.useCallback(T=>{m(S=>S.filter(({id:P})=>T.currentTarget.value!==P))},[]),Ta=E.useCallback(T=>{const S=T.currentTarget.value;ee(P=>{const J=(P.params??[]).filter(({id:Ie})=>Ie!==S),ve=J.length>0?J:void 0;return{...P,params:ve}})},[]),ur=E.useCallback((T,S)=>{var J,ve,Ie;const P=(Ie=(ve=(J=T==null?void 0:T.children)==null?void 0:J[S])==null?void 0:ve.data)==null?void 0:Ie.children;return P?P.map(({name:st,attributes:Je,children:yt})=>({attributes:Je,children:yt,name:st})):[]},[]),Hr=E.useCallback(T=>{var S;return k?(S=d==null?void 0:d.filter((P,J)=>!gt(J)))==null?void 0:S.map(({message:P,value:J,label:ve},Ie)=>{const st=`${h}:${J}`,Je=ur(r,Ie);return{attributes:{depth:T+1,label:ve,value:J,...P&&{message:P},...Je.length===0&&{isLeaf:!0}},children:Je,name:st}}):[]},[r,gt,ur,k,h,d]),en=E.useCallback(T=>T.map(({message:S,...P})=>({...P,...S&&{message:S}})),[]),tn=E.useCallback((T,S,P)=>{var J;if(T&&(!S||P))try{return Yt()}catch{l(c("error.fetchTree",{ns:"snackMessage"}),"error")}return T&&S&&!P?{data:{workflow:(J=r==null?void 0:r.data.attributes)==null?void 0:J.tree},isError:null}:{data:null,isError:null}},[($=r==null?void 0:r.data.attributes)==null?void 0:$.tree,Yt,l,c]),ja=E.useCallback(async T=>{var fr,pr,hr,mr;T.preventDefault();const{on:S,off:P}=U,J=((fr=r==null?void 0:r.data)==null?void 0:fr.name)||"",ve=(r==null?void 0:r.depth)||0,Ie=a==="edit",st=ve+(Ie||r===null?0:1),Je=Hr(st),yt=(pr=o==null?void 0:o.at(-1))==null?void 0:pr.path,rn=o.length?`${yt}/${h}`:`/${h}`,nn=((mr=(hr=r==null?void 0:r.data.attributes)==null?void 0:hr.tree)==null?void 0:mr.treeId)!==ge,{data:Qt,isError:an}=await tn(be,Ie,nn);if(an)return;const dr={attributes:{depth:st,label:b,type:ce,...Ce&&{route:ne},...I&&{route:ne},...Pe&&{helperText:Pe},...(P||S)&&{messages:{...P&&{off:P},...S&&{on:S}}},...be&&{tree:{...Qt==null?void 0:Qt.workflow,treeId:ge},treePath:rn},...k&&{isDecision:k},...Fe&&!k&&{values:en(d)},...N&&{required:N},...D&&{step:D},...R&&{repeatable:R},...O&&{hiddenValue:v},..._&&{tag:_},...fe&&{parentRef:fe},...q&&Mt&&{isMultiple:q},...L&&{initialQuery:L}},children:Je,name:h};n(Ie?zd(yt||"",J,dr):_d(yt||null,J,dr)),s(null)},[r,n,Hr,en,tn,Pe,v,Ce,k,Fe,I,O,q,Mt,be,b,U,a,h,fe,R,N,ne,s,D,_,o,ge,ce,d,L]);return E.useEffect(()=>{var T,S,P,J,ve,Ie,st,Je,yt,rn,nn,Qt,an,dr,fr,pr,hr,mr,ei,ti,ri,ni;if(a==="edit"){const on=((S=(T=r==null?void 0:r.data)==null?void 0:T.attributes)==null?void 0:S.values)||((ve=(J=(P=r==null?void 0:r.data)==null?void 0:P.children)==null?void 0:J.filter(({attributes:Dt})=>!(Dt!=null&&Dt.type)))==null?void 0:ve.map(({attributes:Dt},sn)=>{const{label:ln,value:un,message:gr}=Dt||{};return{id:String(sn),label:String(ln),value:String(un),...gr&&{message:String(gr)}}}));y((r==null?void 0:r.data.name)||""),de(((Ie=r==null?void 0:r.data.attributes)==null?void 0:Ie.tag)||null),De(((st=r==null?void 0:r.data.attributes)==null?void 0:st.type)||"text"),Be(((Je=r==null?void 0:r.data.attributes)==null?void 0:Je.helperText)||""),A(((yt=r==null?void 0:r.data.attributes)==null?void 0:yt.required)||!1),w(((rn=r==null?void 0:r.data.attributes)==null?void 0:rn.step)||""),x(((nn=r==null?void 0:r.data.attributes)==null?void 0:nn.label)||""),M(((Qt=r==null?void 0:r.data.attributes)==null?void 0:Qt.isDecision)||!1),m(on!=null&&on.length?on:e),$e(((dr=(an=r==null?void 0:r.data.attributes)==null?void 0:an.tree)==null?void 0:dr.treeId)||""),Q(((fr=r==null?void 0:r.data.attributes)==null?void 0:fr.repeatable)||!1),g(((pr=r==null?void 0:r.data.attributes)==null?void 0:pr.hiddenValue)||""),me(((hr=r==null?void 0:r.data.attributes)==null?void 0:hr.parentRef)||null),F({off:((ei=(mr=r==null?void 0:r.data.attributes)==null?void 0:mr.messages)==null?void 0:ei.off)||"",on:((ri=(ti=r==null?void 0:r.data.attributes)==null?void 0:ti.messages)==null?void 0:ri.on)||""}),ee(Dt=>{var sn,ln,un,gr,ai,oi,si,ii;return{...Dt,params:(ln=(sn=r==null?void 0:r.data.attributes)==null?void 0:sn.route)==null?void 0:ln.params,pathKey:(gr=(un=r==null?void 0:r.data.attributes)==null?void 0:un.route)==null?void 0:gr.pathKey,searchKey:(oi=(ai=r==null?void 0:r.data.attributes)==null?void 0:ai.route)==null?void 0:oi.searchKey,url:((ii=(si=r==null?void 0:r.data.attributes)==null?void 0:si.route)==null?void 0:ii.url)||""}}),z(f||!1),Y(((ni=r==null?void 0:r.data.attributes)==null?void 0:ni.initialQuery)||!1)}},[(H=r==null?void 0:r.data.attributes)==null?void 0:H.initialQuery,(ue=r==null?void 0:r.data.attributes)==null?void 0:ue.helperText,(K=r==null?void 0:r.data.attributes)==null?void 0:K.hiddenValue,(G=r==null?void 0:r.data.attributes)==null?void 0:G.isDecision,(Re=r==null?void 0:r.data.attributes)==null?void 0:Re.label,(xe=(Me=r==null?void 0:r.data.attributes)==null?void 0:Me.messages)==null?void 0:xe.off,(ft=(Ue=r==null?void 0:r.data.attributes)==null?void 0:Ue.messages)==null?void 0:ft.on,(cr=r==null?void 0:r.data.attributes)==null?void 0:cr.parentRef,(Ke=r==null?void 0:r.data.attributes)==null?void 0:Ke.repeatable,($s=r==null?void 0:r.data.attributes)==null?void 0:$s.required,(Fs=(Ps=r==null?void 0:r.data.attributes)==null?void 0:Ps.route)==null?void 0:Fs.params,(Us=(Ys=r==null?void 0:r.data.attributes)==null?void 0:Ys.route)==null?void 0:Us.pathKey,(Bs=(Vs=r==null?void 0:r.data.attributes)==null?void 0:Vs.route)==null?void 0:Bs.searchKey,(qs=(Qs=r==null?void 0:r.data.attributes)==null?void 0:Qs.route)==null?void 0:qs.url,(Ws=r==null?void 0:r.data.attributes)==null?void 0:Ws.step,(Gs=r==null?void 0:r.data.attributes)==null?void 0:Gs.tag,(Js=(Ks=r==null?void 0:r.data.attributes)==null?void 0:Ks.tree)==null?void 0:Js.treeId,(Zs=r==null?void 0:r.data.attributes)==null?void 0:Zs.type,(Xs=r==null?void 0:r.data.attributes)==null?void 0:Xs.values,(Hs=r==null?void 0:r.data)==null?void 0:Hs.children,r==null?void 0:r.data.name,e,a,f]),{getDisabledValueField:gt,handleAddParams:Xr,handleAddValue:Zr,handleChangeHelperText:Ma,handleChangeHiddenValue:dt,handleChangeInitialQuery:vt,handleChangeIsDecisionField:ir,handleChangeLabel:or,handleChangeMessage:Jr,handleChangeMultiple:sr,handleChangeName:va,handleChangeOptionLabel:Vt,handleChangeOptionMessage:we,handleChangeOptionValue:Bt,handleChangeParam:ga,handleChangeParentRef:ct,handleChangePath:jt,handleChangeRepeatable:lr,handleChangeRequired:Gr,handleChangeSearchKey:bt,handleChangeStep:ba,handleChangeTag:Ut,handleChangeTreeSelect:ya,handleChangeType:Kr,handleChangeUrl:Tt,handleChangeUrlSelect:et,handleDeleteParam:Ta,handleDeleteValue:xa,handleSubmit:ja,helperText:Pe,hiddenValue:v,initialQuery:L,isAutocomplete:Ce,isBooleanField:ze,isDecision:k,isDecisionField:Fe,isDynamicSelect:I,isEditModal:V,isHiddenField:O,isLeaf:ot,isMultiple:q,isMultiplePossible:Mt,isRepeatableDisabled:Ft,isRequiredDisabled:ut,isTreeField:be,isWorkflowLoading:xt,label:b,messages:U,name:h,parentRef:fe,repeatable:R,required:N,route:ne,step:D,tag:_,treeSelected:ge,type:ce,uniqueNameErrorMessage:B,values:d}},Ts={marginRight:"-20px !important",minWidth:"auto !important"},Wr={iconButton:Ts,iconButtonDelete:{...Ts,"&:before":{borderRadius:"50%",content:'""',height:20,position:"absolute",width:20,zIndex:-1},backgroundColor:pe.background,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)"}},Jf=({onClose:e})=>{const{t}=Se.useTranslation(["translation","form"]),{values:n,required:r,name:a,tag:o,uniqueNameErrorMessage:s,type:l,helperText:c,label:f,hiddenValue:d,isBooleanField:m,isDecision:h,isEditModal:y,isDecisionField:v,isHiddenField:g,isRequiredDisabled:b,isRepeatableDisabled:x,isAutocomplete:N,isDynamicSelect:A,isTreeField:k,treeSelected:M,isWorkflowLoading:q,repeatable:z,isLeaf:ce,isMultiplePossible:De,isMultiple:_,initialQuery:de,handleChangeTreeSelect:fe,handleChangeHelperText:me,handleChangeOptionMessage:ne,handleChangeRequired:ee,handleChangeName:ge,handleChangeType:$e,handleChangeIsDecisionField:Pe,handleChangeOptionLabel:Be,handleDeleteValue:D,handleDeleteParam:w,handleChangeOptionValue:U,handleChangeMessage:F,handleSubmit:R,handleAddValue:Q,handleAddParams:L,handleChangeLabel:Y,handleChangeRepeatable:B,handleChangeHiddenValue:W,handleChangeTag:V,handleChangeSearchKey:be,handleChangeUrl:O,handleChangeUrlSelect:Ce,handleChangeParam:I,handleChangePath:ze,handleChangeMultiple:Fe,handleChangeParentRef:ut,handleChangeInitialQuery:Ft,parentRef:ot,route:Mt,messages:{on:Yt,off:xt}}=Kf(),{searchKey:gt,url:Ge,pathKey:Ut,params:ct}=Mt||{},{object:dt="",label:or="",value:Vt="",image:Bt=""}=Ut||{};return i.jsxs("form",{onSubmit:R,children:[i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(p.TextField,{sx:{flex:1},label:t("label",{ns:"form"}),onChange:Y,value:f,required:!0}),i.jsx(p.TextField,{label:t("name"),sx:{flex:1},onChange:ge,value:a,error:!!s,helperText:s,required:!0})]}),i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(Lf,{value:l,onChange:$e}),i.jsx(Wf,{helperText:c,hiddenValue:d,isHiddenField:g,isTreeField:k,treeSelected:M,handleChangeTreeSelect:fe,handleChangeHelperText:me,handleChangeHiddenValue:W})]}),N&&i.jsx(p.Stack,{spacing:1,paddingY:1,children:i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:4},InputProps:{startAdornment:i.jsx(p.InputAdornment,{position:"start",children:i.jsx(ta,{})})},placeholder:"https://api.fr/enpoint",type:"url",label:t("form:apiRoute"),onChange:O,value:Ge,required:!0}),i.jsx(bs,{}),i.jsx(p.TextField,{sx:{flex:1},placeholder:"q",type:"text",onChange:be,value:gt,required:!0})]})}),A&&i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsx("h4",{children:t("form:urlConstruction")}),i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(Sf,{value:ot,onChange:ut,currentName:a}),i.jsx(ms,{}),i.jsx(p.TextField,{sx:{flex:3},InputProps:{startAdornment:i.jsx(p.InputAdornment,{position:"start",children:i.jsx(ta,{})})},placeholder:`https://api.fr/{{${ot||""}}}/enpoint`,type:"url",label:t("form:apiRoute"),onChange:Ce,value:Ge})]}),Ge&&i.jsx(_f,{value:ot})]}),(N||A)&&i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsxs(p.Accordion,{elevation:0,square:!0,children:[i.jsx(p.AccordionSummary,{expandIcon:i.jsx(gs,{}),"aria-controls":"panel-content",sx:{"& .MuiAccordionSummary-content":{flexGrow:0},display:"inline-flex",justifyContent:"flex-start",padding:0},children:i.jsx(p.Typography,{sx:{textDecoration:"underline"},children:t("form:dataMapping")})}),i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsxs(p.Stack,{spacing:1,sx:{pb:1},direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Object Array Path",value:dt,onChange:we=>ze("object",we),placeholder:"elements.features[]",type:"text"}),i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Label Path",value:or,onChange:we=>ze("label",we),placeholder:"client.name",type:"text"})]}),i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Value Path",value:Vt,onChange:we=>ze("value",we),placeholder:"client.id",type:"text"}),i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Image Path",value:Bt,onChange:we=>ze("image",we),placeholder:"client.src.profile",type:"text"})]}),i.jsx(zf,{endPoint:{searchKey:gt||"",url:Ge}})]})]}),i.jsxs(p.Stack,{children:[i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},position:"relative",alignItems:{sm:"center",xs:"flex-start"},children:[i.jsx("h4",{children:t("form:additionalParams")}),i.jsx(p.Box,{justifyContent:"flex-end",children:i.jsx(p.IconButton,{color:"success",sx:Wr.iconButton,onClick:L,children:i.jsx(Zn,{})})})]}),ct==null?void 0:ct.map(({id:we,key:Tt,value:et},bt)=>i.jsxs(p.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[i.jsx(p.TextField,{label:"Key",sx:{flex:1},onChange:jt=>I(bt,"key",jt),value:Tt,inputProps:{"data-id":we}}),i.jsx(p.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:jt=>I(bt,"value",jt),value:et,inputProps:{"data-id":we}}),ct.length>0&&i.jsx(p.IconButton,{color:"warning",sx:Wr.iconButtonDelete,value:we,onClick:w,children:i.jsx(aa,{})})]},we))]})]}),i.jsx(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},children:i.jsx(Ff,{value:o,onChange:V})}),m&&i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(p.TextField,{sx:{flex:1},label:t("onMessage",{ns:"form"}),onChange:F("on"),value:Yt}),i.jsx(p.TextField,{sx:{flex:1},label:t("offMessage",{ns:"form"}),onChange:F("off"),value:xt})]}),i.jsx(p.Stack,{paddingY:1,children:i.jsxs(p.FormGroup,{children:[De&&i.jsx(p.FormControlLabel,{control:i.jsx(p.Checkbox,{checked:_,onChange:Fe}),label:t("multiple")}),N&&i.jsx(p.FormControlLabel,{control:i.jsx(p.Checkbox,{checked:de,onChange:Ft}),label:t("initialQueryEnable")}),i.jsx(p.FormControlLabel,{disabled:b,control:i.jsx(p.Checkbox,{checked:r,onChange:ee}),label:t("required")}),i.jsx(p.FormControlLabel,{disabled:x,control:i.jsx(p.Checkbox,{checked:z,onChange:B}),label:t("repeatable",{ns:"form"})}),(ce||y)&&i.jsx(p.FormControlLabel,{disabled:!v,control:i.jsx(p.Checkbox,{checked:h,onChange:Pe}),label:t("decisionField",{ns:"form"})})]})}),v&&i.jsxs(i.Fragment,{children:[i.jsx("h4",{children:t("values")}),n==null?void 0:n.map(({value:we,label:Tt,id:et,message:bt})=>i.jsxs(p.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[i.jsx(p.TextField,{label:t("label",{ns:"form"}),sx:{flex:1},onChange:Be,value:Tt,inputProps:{"data-id":et},required:!0}),i.jsx(p.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:U,value:we,inputProps:{"data-id":et},required:!0}),i.jsx(p.TextField,{label:"Message",sx:{flex:1},onChange:ne,value:bt,inputProps:{"data-id":et}}),n.length>1&&i.jsx(p.IconButton,{color:"warning",sx:Wr.iconButtonDelete,value:et,onClick:D,children:i.jsx(aa,{})})]},et))]}),v&&i.jsx(p.Box,{justifyContent:"flex-end",display:"flex",children:i.jsx(p.IconButton,{color:"success",sx:Wr.iconButton,onClick:Q,children:i.jsx(Zn,{})})}),i.jsxs(p.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",paddingTop:3,children:[i.jsx(p.Button,{variant:"text",onClick:e,children:t("cancel")}),i.jsx(p.Button,{variant:"contained",type:"submit",disabled:!!s||q,isLoading:q,loadingIndicator:i.jsx(p.CircularProgress,{size:14}),children:t("validate")})]})]})};var sa={},Zf=Ee;Object.defineProperty(sa,"__esModule",{value:!0});var js=sa.default=void 0,Xf=Zf(Ne()),Hf=i,ep=(0,Xf.default)((0,Hf.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");js=sa.default=ep;var ia={},tp=Ee;Object.defineProperty(ia,"__esModule",{value:!0});var Ds=ia.default=void 0,rp=tp(Ne()),np=i,ap=(0,rp.default)((0,np.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");Ds=ia.default=ap;var la={},op=Ee;Object.defineProperty(la,"__esModule",{value:!0});var Es=la.default=void 0,sp=op(Ne()),ip=i,lp=(0,sp.default)((0,ip.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");Es=la.default=lp;var ua={},up=Ee;Object.defineProperty(ua,"__esModule",{value:!0});var Ns=ua.default=void 0,cp=up(Ne()),dp=i,fp=(0,cp.default)((0,dp.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");Ns=ua.default=fp;var ca={},pp=Ee;Object.defineProperty(ca,"__esModule",{value:!0});var Os=ca.default=void 0,hp=pp(Ne()),mp=i,gp=(0,hp.default)((0,mp.jsx)("path",{d:"M12 3c-4.8 0-9 3.86-9 9 0 2.12.74 4.07 1.97 5.61l-1.68 1.68c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l1.68-1.68C7.93 20.26 9.88 21 12 21c2.3 0 4.61-.88 6.36-2.64C20.12 16.61 21 14.3 21 12V5c0-1.1-.9-2-2-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");Os=ca.default=gp;var da={},bp=Ee;Object.defineProperty(da,"__esModule",{value:!0});var Cs=da.default=void 0,vp=bp(Ne()),ws=i,yp=(0,vp.default)([(0,ws.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,ws.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");Cs=da.default=yp;var fa={},Mp=Ee;Object.defineProperty(fa,"__esModule",{value:!0});var Is=fa.default=void 0,xp=Mp(Ne()),Tp=i,jp=(0,xp.default)((0,Tp.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");Is=fa.default=jp;var pa={},Dp=Ee;Object.defineProperty(pa,"__esModule",{value:!0});var As=pa.default=void 0,Ep=Dp(Ne()),Np=i,Op=(0,Ep.default)((0,Np.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");As=pa.default=Op;var ha={},Cp=Ee;Object.defineProperty(ha,"__esModule",{value:!0});var ks=ha.default=void 0,wp=Cp(Ne()),Ip=i,Ap=(0,wp.default)((0,Ip.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");ks=ha.default=Ap;var ma={},kp=Ee;Object.defineProperty(ma,"__esModule",{value:!0});var Ss=ma.default=void 0,Sp=kp(Ne()),_p=i,zp=(0,Sp.default)((0,_p.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");Ss=ma.default=zp;const _e={actionButton:{minWidth:"auto !important"},container:{background:pe.background,borderRadius:"1rem"},containerField:{background:pe.background,border:`solid 1px ${pe.primary}`,borderRadius:"1rem"},containerHidden:{background:pe.background,border:`solid 1px ${pe.borderGrey}`,borderRadius:"1rem"},containerTree:{background:pe.tertiary,border:`solid 1px ${pe.primary}`,borderRadius:"1rem"},containerValue:{background:pe.background,border:`solid 1px ${pe.secondary}`,borderRadius:"1rem"},icon:{color:pe.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}},Rp=e=>{const t=!!e,n=e==="tree";return e==="hidden"?_e.containerHidden:n?_e.containerTree:t?_e.containerField:_e.containerValue},Lp=({nodeDatum:e,onAddChildren:t,onEditChildren:n,onDeleteChildren:r,onOpenTreeModal:a,hierarchyPointNode:o,size:s=220})=>{var z;const{t:l}=Se.useTranslation(["translation","form"]),{attributes:c}=e||{},{isRoot:f,isLeaf:d,required:m,isDecision:h,step:y,type:v,label:g,repeatable:b,tag:x}=c||{},N=!!v,A=v==="tree",k=v==="hidden",M=!N,q=!f&&!d;return i.jsxs("g",{children:[i.jsx(p.GlobalStyles,{styles:{".rd3t-node svg":_e.nodeSvg}}),i.jsx(p.Box,{component:"foreignObject",height:s,width:s,x:`-${s/2}`,y:`-${s/2}`,sx:Rp(v),children:i.jsxs(p.Box,{flex:1,display:"flex",p:2,height:"100%",flexDirection:"column",justifyContent:"space-between",children:[i.jsxs(p.Stack,{alignItems:"flex-end",spacing:.5,children:[N&&i.jsxs(p.Stack,{direction:"row",spacing:1,alignItems:"center",children:[y&&i.jsx(p.Tooltip,{title:`${l("step",{ns:"form"})} ${(z=e==null?void 0:e.attributes)==null?void 0:z.step}`,placement:"left",arrow:!0,children:i.jsx(p.Chip,{color:"primary",size:"small",label:y,sx:_e.stepChip})}),i.jsx(p.Typography,{variant:"subtitle2",sx:_e.title,children:i.jsx("strong",{children:g})})]}),N&&i.jsx(p.Chip,{color:"info",size:"small",label:l(`type.${v}`,{ns:"form"})}),x&&i.jsx(p.Chip,{variant:"outlined",color:"warning",size:"small",label:x}),m&&i.jsx(p.Stack,{direction:"row",spacing:.5,children:m&&i.jsx(p.Typography,{variant:"body2",sx:{color:({palette:ce})=>ce.error.main},children:l("required")})}),i.jsx(p.Stack,{spacing:.5,alignItems:"flex-end",children:M&&i.jsx(p.Typography,{variant:"subtitle2",sx:_e.title,children:i.jsx("strong",{children:g})})}),i.jsxs(p.Stack,{paddingTop:.5,spacing:.5,direction:"row",children:[b&&i.jsx(p.Tooltip,{title:l("isARepeatable"),placement:"bottom",arrow:!0,children:i.jsx(Is,{style:_e.icon})}),d&&i.jsx(p.Tooltip,{title:l("isALeaf"),placement:"bottom",arrow:!0,children:i.jsx(Os,{style:_e.icon})}),k&&i.jsx(p.Tooltip,{title:l("isAHidden"),placement:"bottom",arrow:!0,children:i.jsx(ks,{style:_e.icon})}),f&&i.jsx(p.Tooltip,{title:l("isTheRoot"),placement:"bottom",arrow:!0,children:i.jsx(As,{style:_e.icon})}),q&&i.jsx(p.Tooltip,{title:l("isABranch"),placement:"bottom",arrow:!0,children:i.jsx(js,{style:_e.icon})}),A&&i.jsx(p.Tooltip,{title:l("isATree"),placement:"bottom",arrow:!0,children:i.jsx(Cs,{style:_e.icon})})]})]}),i.jsxs(p.Stack,{direction:"row",justifyContent:"flex-end",spacing:0,alignSelf:"flex-end",children:[!f&&i.jsx(p.Tooltip,{title:l("remove"),arrow:!0,children:i.jsx(p.Button,{variant:"text",sx:_e.actionButton,size:"small",color:"error",onClick:()=>r==null?void 0:r(o),children:i.jsx(Es,{})})}),!M&&i.jsx(p.Tooltip,{title:l("edit"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"secondary",sx:_e.actionButton,size:"small",onClick:()=>n==null?void 0:n(o),children:i.jsx(Ns,{})})}),!h&&i.jsx(p.Tooltip,{title:l("add"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"success",sx:_e.actionButton,size:"small",onClick:()=>t==null?void 0:t(o),children:i.jsx(Ds,{})})}),A&&i.jsx(p.Tooltip,{title:l("show"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"info",sx:_e.actionButton,size:"small",onClick:()=>a==null?void 0:a(o),children:i.jsx(Ss,{})})})]})]})})]})},$p=E.memo(Lp),_s=()=>{const{setModalOpen:e,setCurrentHierarchyPointNode:t,setTreeModalOpen:n,setTreePath:r}=Ae();return{handleAddChildren:f=>{t(f),e("add")},handleCloseTreeModal:()=>{r([]),n(!1)},handleDeleteChildren:f=>{t(f),e("delete")},handleEditChildren:f=>{t(f),e("edit")},handleOpenTreeModal:f=>{var m,h;const d={label:f==null?void 0:f.data.attributes.label,path:((h=(m=f==null?void 0:f.data)==null?void 0:m.attributes)==null?void 0:h.treePath)||""};r(y=>[...y,d]),n(!0)}}},Pp=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:a,onNodeMouseOut:o,addChildren:s})=>{const{handleDeleteChildren:l,handleEditChildren:c,handleAddChildren:f,handleOpenTreeModal:d}=_s();return i.jsx($p,{addChildren:s,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:a,onNodeMouseOut:o,onAddChildren:f,onOpenTreeModal:d,onDeleteChildren:l,onEditChildren:c})},zs=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:a,onNodeMouseOut:o,addChildren:s})=>i.jsx(Pp,{addChildren:s,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:a,onNodeMouseOut:o}),Fp=()=>{const{t:e}=Se.useTranslation(["modal","snackMessage"]),{currentHierarchyPointNode:t,modalOpen:n,setModalOpen:r}=Ae(),a=n==="edit";return{closeModal:()=>{r(null)},getTitleModalDelete:()=>{var h,y;const m=(y=(h=t==null?void 0:t.data)==null?void 0:h.attributes)==null?void 0:y.label;return e("deleteTitle",{name:m,ns:"modal"})},getTitleModalMutation:()=>{var y;const m=(y=t==null?void 0:t.data)==null?void 0:y.attributes.label;return m?e(a?"editTitle":"addTitle",{name:m,ns:"modal"}):e("addFirstTitle",{name:m,ns:"modal"})},isDeleteModal:n==="delete",isModalMutationOpen:a||n==="add"}},Yp=()=>{const{currentTree:e,setCurrentTree:t,tree:n}=Ae(),{name:r,errorName:a,id:o}=e;return{disabled:!!e.id&&!n,errorName:a,handleChangeName:c=>{const{value:f}=c.target;if(!f){t(d=>({...d,errorName:"Champs requis",name:c.target.value}));return}t(d=>({...d,errorName:"",name:c.target.value}))},id:o,name:r}},Up=()=>{const{t:e}=Se.useTranslation("form"),{name:t,handleChangeName:n,errorName:r,disabled:a}=Yp();return i.jsx(p.TextField,{required:!0,label:e("treeName",{ns:"form"}),size:"small",onChange:n,value:t,error:!!r,disabled:a})},Vp=()=>{var y,v;const{tree:e,treeModalOpen:t,treePath:n,backendConfig:r}=Ae(),{handleCloseTreeModal:a}=_s(),{getTitleModalMutation:o,closeModal:s,getTitleModalDelete:l,isModalMutationOpen:c,isDeleteModal:f}=Fp(),d=(y=n==null?void 0:n.at(-1))==null?void 0:y.path,m=(v=n==null?void 0:n.at(-1))==null?void 0:v.label,h=e&&$t(e,d);return i.jsxs(i.Fragment,{children:[i.jsxs(rf,{children:[i.jsx(Hd,{children:i.jsxs(p.Stack,{justifyContent:"space-between",direction:"row",alignItems:"center",children:[i.jsx(wi,{}),!!(r!=null&&r.baseUrl)&&i.jsxs(p.Stack,{direction:"row",alignItems:"center",spacing:2,children:[i.jsx(Up,{}),i.jsx(Ms,{size:"small",arrowOnly:!0,showBtnAddNewTree:!0,fetchWorkflowsOnOpen:!0})]})]})}),i.jsx(tf,{children:i.jsx(ka,{data:e,renderCustomNodeElement:zs})}),i.jsx(af,{children:i.jsx(zi,{value:e})}),i.jsx(Zd,{children:i.jsx(Yd,{value:e})})]}),i.jsx(fs,{open:c,onClose:s,title:o(),children:i.jsx(Jf,{onClose:s})}),i.jsx(fs,{open:f,onClose:s,title:l(),children:i.jsx(sf,{onClose:s})}),i.jsx(Kd,{open:t,onClose:a,title:m,children:h&&i.jsx(ka,{data:h,renderCustomNodeElement:zs})})]})},Bp="0.18.0",Qp=({children:e,initialTree:t,initialTreeId:n,backendConfig:r})=>{const[a,o]=E.useState(Qe.currentHierarchyPointNode),[s,l]=E.useState(Qe.modalOpen),[c,f]=E.useState(Qe.treeModalOpen),[d,m]=E.useState(Qe.treePath),[h,y]=E.useReducer(Ld,t||Qe.tree),[v,g]=E.useState(n?{...Qe.currentTree,id:n}:Qe.currentTree),b=E.useMemo(()=>{var x,N;return{backendConfig:{baseUrl:((x=Qe==null?void 0:Qe.backendConfig)==null?void 0:x.baseUrl)||"",...Qe.backendConfig,...r,endpoints:{...(N=Qe.backendConfig)==null?void 0:N.endpoints,...r==null?void 0:r.endpoints}},currentHierarchyPointNode:a,currentTree:v,dispatchTree:y,modalOpen:s,setCurrentHierarchyPointNode:o,setCurrentTree:g,setModalOpen:l,setTreeModalOpen:f,setTreePath:m,tree:h,treeModalOpen:c,treePath:d,version:Bp}},[r,a,v,s,h,c,d]);return vr(v.id,{enabled:!!n,onSuccess:async x=>{x&&(g({id:x==null?void 0:x.id,name:x==null?void 0:x.label}),y(ds((x==null?void 0:x.workflow)||null)))}}),i.jsx(Ia.Provider,{value:b,children:e})},qp={close:"Close",createTree:"Create Tree",downloadJSONFile:"Download JSON File",reset:"Reset",resetTree:"Reset tree",save:"Save",update:"Update"},Wp={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"}},Gp={add:"Add",cancel:"Cancel",disabled:"Disabled",edit:"Edit",initialQueryEnable:"Enable initial API call",isABranch:"Is a branch",isAHidden:"Is a hidden field",isALeaf:"Is a leaf",isARepeatable:"Is a repeatable",isATree:"Is a tree",isTheRoot:"Is the root",label:"Label",multiple:"Multiple",name:"Name",parentRef:"Parent element",remove:"Remove",required:"Required",save:"Save",show:"Show",tag:"Tag",type:"Type",validate:"Validate",value:"Value",values:"Values"},Kp={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"},Rs={additionalParams:"Paramètres additionnels",ancestor:"Ancêtre",apiRoute:"Api route",dataMapping:"Mapping de données",decisionField:"Champs de décision",helperText:"Texte d'information",hiddenValue:"Valeur caché",label:"Label",mustBeUnique:"Doit être unique",newTree:"Nouvel arbre",noAncestorFound:"Aucun parent trouvé",offMessage:"Message (désactiver)",onMessage:"Message (activer)",repeatable:"Répétable",staticFields:"Champs statiques",step:"Étape",tree:"Arbre",treeName:"Nom de l'arbre",type:{address:"Adresse",autocomplete:"Autocomplétion",checkbox:"Case à cocher",date:"Date",dateRange:"Plage de dates",dynamicSelect:"Sélection dynamique",email:"Email",file:"Fichier",hidden:"Champs caché",number:"Nombre",password:"Mot de passe",radio:"Radio",select:"Select",switch:"Switch",tel:"Téléphone",text:"Texte",time:"Temps",tree:"Arbre",url:"URL"},urlConstruction:"Construction de l'URL",value:"Valeur",values:"Valeurs",warningApiAutocomplete:{response:"dois avoir comme réponse",url:"La route de l'API"},warningApiSelect:{response:"à l'emplacement de votre variable.",url:"Pour intégrer automatiquement la valeur du parent dans l'URL",warning:"placez {{}}"}},Ls={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"},Jp={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"}},Zp={add:"Ajouter",cancel:"Annuler",disabled:"Désactivé",edit:"Éditer",initialQueryEnable:"Activer un appel API intiale",isABranch:"Est une branche",isAHidden:"Est un champs caché",isALeaf:"Est une feuille",isARepeatable:"Est répétable",isATree:"Est un arbre",isTheRoot:"Est la racine",label:"Label",multiple:"Multiple",name:"Nom",parentRef:"Element parent",remove:"Supprimer",required:"Requis",save:"Enregistrer",show:"Afficher",tag:"Tag",type:"Type",validate:"Valider",value:"Valeur",values:"Valeurs"};qt.use(fi).use(Se.initReactI18next).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{useSuspense:!0},resources:{en:{button:qp,form:Rs,modal:Ls,snackMessage:Wp,translation:Gp},fr:{button:Kp,form:Rs,modal:Ls,snackMessage:Jp,translation:Zp}},returnNull:!1}).then(()=>{document.documentElement.lang!==qt.resolvedLanguage&&qt.resolvedLanguage&&document.documentElement.setAttribute("lang",qt.resolvedLanguage)}),qt.on("languageChanged",e=>{document.documentElement.setAttribute("lang",e)});const Xp=({initialTree:e,initialTreeId:t,backendConfig:n})=>(E.useLayoutEffect(()=>{Nt.defaults.baseURL=n==null?void 0:n.baseUrl,n!=null&&n.authToken&&(Nt.defaults.headers.common.Authorization=`Bearer ${n==null?void 0:n.authToken}`)},[n==null?void 0:n.authToken,n==null?void 0:n.baseUrl]),i.jsx(Et.QueryClientProvider,{client:Mi,children:i.jsx(ji,{authToken:n==null?void 0:n.authToken,children:i.jsx(Qp,{backendConfig:n,initialTree:e,initialTreeId:t,children:i.jsx(yi,{children:i.jsx(Oi,{children:i.jsx(Vp,{})})})})})}));ke.TreePlusIcon=wa,ke.Treege=Xp,Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"})});
|
|
110
|
+
`)),so.configure(e)}},unstable_useEnhancedEffect:eo,unstable_useId:nl,unsupportedProp:al,useControlled:ol,useEventCallback:sl,useForkRef:il,useIsFocusVisible:hl},Symbol.toStringTag,{value:"Module"})));var ns;function Ne(){return ns||(ns=1,function(e){"use client";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=hd}(pn)),pn}var md=Ee;Object.defineProperty(fn,"__esModule",{value:!0});var as=fn.default=void 0,gd=md(Ne()),bd=i,vd=(0,gd.default)((0,bd.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");as=fn.default=vd;var qn={},yd=Ee;Object.defineProperty(qn,"__esModule",{value:!0});var os=qn.default=void 0,Md=yd(Ne()),xd=i,Td=(0,Md.default)((0,xd.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");os=qn.default=Td;var Wn={},jd=Ee;Object.defineProperty(Wn,"__esModule",{value:!0});var ss=Wn.default=void 0,Dd=jd(Ne()),Ed=i,Nd=(0,Dd.default)((0,Ed.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");ss=Wn.default=Nd;const is=(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 a=n[r],o=is(a,t);if(o)return o}return null},$t=(e,t)=>{var o,s,l,c,f;if(!e)return null;if(!t)return e;if(((o=e.attributes)==null?void 0:o.treePath)===t)return((s=e.attributes)==null?void 0:s.tree)||null;let n=null;const r=(l=e.attributes)==null?void 0:l.tree,a=(c=e.children)==null?void 0:c.length;if(r&&(n=$t((f=e.attributes)==null?void 0:f.tree,t)),a){const{children:d}=e;for(let m=0;m<d.length;m+=1){const h=d[m];if(n!==null)return n;n=$t(h,t)}}return n},Br=(e,t,n)=>{const r=$t(e,t);return is(r,n)},Od=(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)},Cd=({tree:e,path:t,name:n,child:r})=>{var c;const{attributes:a,children:o}=r;if(!e)return o.length?{...r}:{...r,attributes:{...a,isLeaf:!0,isRoot:!0}};const s=structuredClone(e),l=Br(s,t,n);return Od(l,{...r,...!a.isDecision&&{children:[...((c=Br(e,t,n))==null?void 0:c.children)||[]]}}),s},ls=(e,t,n=null)=>{if(!e)return null;if(e.name===t)return n;const r=e.children||[];for(let a=0;a<r.length;a+=1){const o=r[a],s=ls(o,t,e);if(s!==null)return s}return null},wd=(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),Id=(e,t,n)=>{const r=$t(e,t);return ls(r,n)},Ad=({tree:e,path:t,name:n})=>{const r=structuredClone(e),a=Br(r,t,n),o=Id(r,t,n);return wd(o,a),r},us=e=>{if(!e)return[];const t=[],n=r=>{if(r.name&&t.push(r.name),r.children.length){const{children:a}=r;for(let o=0;o<a.length;o+=1)n(a[o])}};return n(e),t},kd=(e,t)=>{if(!e)return null;const n=t.attributes.isDecision,r=e.attributes.isDecision,a=e.attributes.depth===0,o={value:t.name},s=r||n,l=s?{value:[...t.children]}:{value:[...e.children]},c=s?{value:{...t.attributes,isLeaf:!t.children.length||!n,isRoot:a}}:{value:{...t.attributes,isLeaf:!e.children.length,isRoot:a}};return Object.defineProperties(e,{attributes:c,children:l,name:o}),null},Sd=({tree:e,path:t,name:n,child:r})=>{const a=structuredClone(e),o=Br(a,t,n);return kd(o,r),a},at={appendTreeCard:"appendTreeCard",deleteTreeCard:"deleteTreeCard",replaceTreeCard:"replaceTreeCard",resetTree:"resetTree",setTree:"setTree"},_d=(e,t,n)=>({children:n,name:t,path:e,type:at.appendTreeCard}),zd=(e,t,n)=>({children:n,name:t,path:e,type:at.replaceTreeCard}),Rd=(e,t)=>({name:t,path:e,type:at.deleteTreeCard}),cs=()=>({type:at.resetTree}),ds=e=>({tree:e,type:at.setTree}),Ld=(e,t)=>{switch(t.type){case at.appendTreeCard:{const{name:n,path:r,children:a}=t;return Cd({child:a,name:n,path:r,tree:e})}case at.deleteTreeCard:{const{path:n,name:r}=t;return Ad({name:r,path:n,tree:e})}case at.replaceTreeCard:{const{name:n,path:r,children:a}=t;return Sd({child:a,name:n,path:r,tree:e})}case at.resetTree:return null;case at.setTree:return t.tree;default:throw new Error}},Gn=()=>{const{dispatchSnackbar:e}=E.useContext(Oa);return{close:()=>e(Ca()),open:(r,a="success")=>e(Di(r,a))}},$d=e=>{const{backendConfig:t}=Ae(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return Et.useMutation(["patchWorkflow"],async a=>{const{data:o}=await Nt.patch(r,a);return o},e)},Pd=e=>{const{backendConfig:t}=Ae(),{endpoints:n}=t||{},{workflow:r=""}=n||{};return Et.useMutation(["postWorkflow"],async a=>{const{data:o}=await Nt.post(r,a);return o},e)},Fd=()=>{const{t:e}=Se.useTranslation(["snackMessage"]),{open:t}=Gn(),{setCurrentTree:n,currentTree:r,tree:a,dispatchTree:o}=Ae(),[s,l]=E.useState(!1),{version:c}=Ae(),{mutate:f}=Pd({onError:()=>{t(e("error.saveTree",{ns:"snackMessage"}),"error")},onSuccess:x=>{t(e("success.saveTree",{ns:"snackMessage"})),n(N=>({...N,id:x.workflow_id}))}}),{mutate:d}=$d({onError:()=>{t(e("error.updateTree",{ns:"snackMessage"}),"error")},onSuccess:()=>{t(e("success.updateTree",{ns:"snackMessage"}))}}),m=x=>JSON.stringify(x,null,2),h=x=>`data:text/json;charset=utf-8,${encodeURIComponent(m(x))}`,y=()=>{l(!1)};return{formatJSON:m,getDownloadLink:h,handleClose:y,handleOpen:()=>{l(!0)},handleResetTree:()=>{o(cs()),y()},handleSubmit:()=>{const{name:x,id:N}=r;if(!x){n(A=>({...A,errorName:"Champs Requis"}));return}if(a){if(N){d({id:N,label:x,version:c,workflow:a});return}f({label:x,version:c,workflow:a})}},openModal:s}},Yd=({downloadedFileName:e="export",value:t})=>{const{t:n}=Se.useTranslation(),{getDownloadLink:r,handleSubmit:a,handleClose:o,handleOpen:s,handleResetTree:l,openModal:c}=Fd(),{currentTree:f,backendConfig:d,tree:m}=Ae(),{id:h}=f;return i.jsxs(p.Stack,{direction:"row",spacing:2,justifyContent:"center",children:[i.jsx(p.Tooltip,{title:n("resetTree",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.Button,{disabled:!m,onClick:s,variant:"outlined",color:"warning",children:i.jsx(as,{})})})}),i.jsx(p.Divider,{orientation:"vertical",flexItem:!0}),i.jsx(p.Tooltip,{title:n("downloadJSONFile",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.Button,{variant:"outlined",href:r(t),download:`${e}.json`,disabled:!t,children:i.jsx(ss,{})})})}),i.jsx(p.Tooltip,{title:h?n("update",{ns:"button"}):n("save",{ns:"button"}),enterDelay:1500,disableHoverListener:!t,arrow:!0,children:i.jsx(p.Box,{children:i.jsx(p.Button,{variant:"outlined",onClick:a,disabled:!t||!(d!=null&&d.baseUrl),children:i.jsx(os,{})})})}),i.jsxs(p.Dialog,{maxWidth:"xs",fullWidth:!0,open:c,onClose:o,children:[i.jsx(p.DialogTitle,{variant:"h3",children:n("resetTree",{ns:"button"})}),i.jsx(p.DialogContent,{children:i.jsx(p.DialogContentText,{children:n("resetTreeContent",{ns:"modal"})})}),i.jsxs(p.DialogActions,{children:[i.jsx(p.Button,{onClick:o,children:n("close",{ns:"button"})}),i.jsx(p.Button,{variant:"contained",color:"warning",onClick:l,children:n("reset",{ns:"button"})})]})]})]})},Ud={box:{backgroundColor:pe.background,border:`solid 1px ${pe.borderBlue}`}},fs=({children:e,description:t,open:n,onClose:r,title:a})=>i.jsx(p.Dialog,{open:n,onClose:r,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",scroll:"body",maxWidth:"sm",fullWidth:!0,children:i.jsxs(p.Box,{sx:Ud.box,p:4,children:[i.jsx("h3",{children:a}),i.jsx("p",{children:t}),e]})});var Kn={},Vd=Ee;Object.defineProperty(Kn,"__esModule",{value:!0});var ps=Kn.default=void 0,Bd=Vd(Ne()),Qd=i,qd=(0,Bd.default)((0,Qd.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");ps=Kn.default=qd;const Qr={container:{display:"flex",flexDirection:"column",height:"100%",margin:1},main:{border:`solid 1px ${pe.borderBlue}`,height:" 100%",margin:1},toolbar:{backgroundColor:pe.background,boxShadow:"none",display:"flex",padding:"0 ! important"},toolbarBox:{backgroundColor:pe.tertiary,border:`solid 1px ${pe.primary}`,margin:1,paddingX:2,paddingY:1,width:"100%"}},Wd=({children:e,appear:t,in:n,onEnter:r,onExited:a,onFocus:o,role:s,tabIndex:l,timeout:c},f)=>i.jsx(p.Slide,{direction:"up",ref:f,appear:t,in:n,onEnter:r,onExited:a,onFocus:o,role:s,tabIndex:l,timeout:c,children:e}),Gd=E.forwardRef(Wd),Kd=({children:e,open:t,onClose:n,title:r})=>i.jsx(p.Dialog,{PaperProps:{sx:{backgroundColor:pe.background,backgroundImage:"none"}},open:t,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",fullScreen:!0,TransitionComponent:Gd,children:i.jsxs(p.Box,{sx:Qr.container,children:[i.jsx(p.AppBar,{position:"sticky",elevation:0,children:i.jsx(p.Toolbar,{sx:Qr.toolbar,children:i.jsxs(p.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:Qr.toolbarBox,children:[i.jsx(p.Typography,{variant:"h5",children:i.jsx("strong",{children:r})}),i.jsx(p.IconButton,{edge:"end",color:"inherit",onClick:n,"aria-label":"close",children:i.jsx(ps,{})})]})})}),i.jsx(p.Box,{sx:Qr.main,children:e})]})}),Jd={box:{border:`solid 1px ${pe.borderBlue}`,flexGrow:0}},Zd=({children:e})=>i.jsx(p.Box,{p:2,role:"group",sx:Jd.box,children:e}),Xd={box:{border:`solid 1px ${pe.borderBlue}`,flexGrow:0}},Hd=({children:e})=>i.jsx(p.Box,{sx:Xd.box,padding:2,component:"header",children:e}),ef={box:{border:`solid 1px ${pe.borderBlue}`,flexGrow:1}},tf=({children:e})=>i.jsx(p.Box,{sx:ef.box,component:"main",role:"tree",children:e}),hs={stack:{width:"100%"}},rf=({children:e})=>{const t=E.Children.toArray(e);return i.jsxs(p.Grid,{container:!0,padding:1,flexWrap:"nowrap",height:"100%",role:"treegrid",children:[i.jsx(p.Grid,{item:!0,xs:9,padding:1,display:"flex",children:i.jsxs(p.Stack,{sx:hs.stack,spacing:2,children:[t[0],t[1]]})}),i.jsx(p.Grid,{item:!0,xs:3,padding:1,display:"flex",children:i.jsxs(p.Stack,{sx:hs.stack,spacing:2,children:[t[2],t[3]]})})]})},nf={box:{border:`solid 1px ${pe.borderBlue}`,flexGrow:1,overflow:"auto"}},af=({children:e})=>i.jsx(p.Box,{sx:nf.box,component:"aside",children:e}),of=()=>{const{dispatchTree:e,setModalOpen:t,currentHierarchyPointNode:n,treePath:r}=Ae();return{handleSubmit:o=>{var c,f;o.preventDefault();const s=((c=n==null?void 0:n.data)==null?void 0:c.name)||"",l=((f=r==null?void 0:r.at(-1))==null?void 0:f.path)||"";e(Rd(l,s)),t(null)}}},sf=({onClose:e})=>{const{t}=Se.useTranslation(),{handleSubmit:n}=of();return i.jsx("form",{onSubmit:n,children:i.jsxs(p.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:[i.jsx(p.Button,{variant:"text",onClick:e,children:t("cancel")}),i.jsx(p.Button,{variant:"contained",color:"error",type:"submit",children:t("remove")})]})})};var Jn={},lf=Ee;Object.defineProperty(Jn,"__esModule",{value:!0});var Zn=Jn.default=void 0,uf=lf(Ne()),cf=i,df=(0,uf.default)((0,cf.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");Zn=Jn.default=df;var Xn={},ff=Ee;Object.defineProperty(Xn,"__esModule",{value:!0});var ms=Xn.default=void 0,pf=ff(Ne()),hf=i,mf=(0,pf.default)((0,hf.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward");ms=Xn.default=mf;var Hn={},gf=Ee;Object.defineProperty(Hn,"__esModule",{value:!0});var gs=Hn.default=void 0,bf=gf(Ne()),vf=i,yf=(0,bf.default)((0,vf.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown");gs=Hn.default=yf;var ea={},Mf=Ee;Object.defineProperty(ea,"__esModule",{value:!0});var ta=ea.default=void 0,xf=Mf(Ne()),Tf=i,jf=(0,xf.default)((0,Tf.jsx)("path",{d:"M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z"}),"LinkRounded");ta=ea.default=jf;var ra={},Df=Ee;Object.defineProperty(ra,"__esModule",{value:!0});var bs=ra.default=void 0,Ef=Df(Ne()),Nf=i,Of=(0,Ef.default)((0,Nf.jsx)("path",{d:"M7.92 7.54c-.8-.34-1.14-1.33-.66-2.05C8.23 4.05 9.85 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.15.27-.24.49-.3.94-.09.73-.69 1.3-1.43 1.3-.87 0-1.58-.75-1.48-1.62.06-.51.18-1.04.46-1.54.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.17 0-1.93.61-2.4 1.34-.35.57-1.08.75-1.69.5zM14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z"}),"QuestionMarkRounded");bs=ra.default=Of;var na={},Cf=Ee;Object.defineProperty(na,"__esModule",{value:!0});var aa=na.default=void 0,wf=Cf(Ne()),If=i,Af=(0,wf.default)((0,If.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");aa=na.default=Af;const kf=e=>e.filter(t=>!t.includes(":")),Sf=({value:e,onChange:t,currentName:n})=>{const{t:r}=Se.useTranslation(["form"]),{tree:a}=Ae(),[o,s]=E.useState(e||""),l=us(a),c=kf(l).filter(d=>d!==n),f=d=>{const m=d.target.value;s(m),t==null||t(d,m)};return i.jsxs(p.FormControl,{sx:{flex:1.5},required:!0,children:[i.jsx(p.InputLabel,{children:r("form:ancestor")}),i.jsx(p.Select,{sx:{flex:2},value:o,label:r("form:ancestor"),onChange:f,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:c.length?c.map((d,m)=>{const h=`${d}-${m}`;return i.jsx(p.MenuItem,{value:d,children:d},h)}):i.jsx(p.MenuItem,{disabled:!0,value:"",children:r("form:noAncestorFound")})})]})},qr={container:{backgroundColor:"#282c34",borderRadius:.5,color:"#abb2bf",display:"inline-block",lineHeight:1.5,marginBottom:.2,paddingX:.5,paddingY:.2,width:"fit-content"},property:{color:"#56b6c2"},type:{color:"#c678dd"}},_f=({value:e})=>{const{t}=Se.useTranslation(["translation","form"]);return i.jsx(p.Alert,{severity:"warning",variant:"outlined",children:i.jsxs(p.Typography,{component:"div",variant:"body2",gutterBottom:!0,sx:{lineHeight:2},children:[t("form:warningApiSelect.url")," ",t("form:warningApiSelect.warning")," ",t("form:warningApiSelect.response"),i.jsxs(p.Box,{sx:qr.container,children:["https://api.example.com/","{{",i.jsx(p.Box,{component:"span",sx:qr.type,children:e||"value"}),i.jsx(p.Box,{component:"span",sx:qr.property,children:": string"}),"}}","/endpoint ",i.jsx(p.Box,{component:"span",sx:qr.property})]})]})})},mt={container:{backgroundColor:"#282c34",borderRadius:.5,color:"#abb2bf",display:"inline-block",lineHeight:1.5,marginBottom:.2,paddingX:.5,paddingY:.2,width:"fit-content"},property:{color:"#56b6c2"},type:{color:"#c678dd"}},zf=({endPoint:e})=>{const{t}=Se.useTranslation(["translation","form"]),{url:n,searchKey:r}=e,a=`${n}?${r}`;return i.jsx(p.Alert,{severity:"warning",variant:"outlined",children:i.jsxs(p.Typography,{component:"div",variant:"body2",gutterBottom:!0,sx:{lineHeight:2},children:[t("form:warningApiAutocomplete.url")," ",n&&i.jsxs(i.Fragment,{children:[i.jsx(p.Box,{component:"span",sx:mt.container,children:a})," "]}),t("form:warningApiAutocomplete.response"),i.jsxs(p.Box,{sx:mt.container,children:["{ ",i.jsx(p.Box,{component:"span",sx:mt.property,children:"label"}),":"," ",i.jsx(p.Box,{component:"span",sx:mt.type,children:"string"}),";"," ",i.jsx(p.Box,{component:"span",sx:mt.property,children:"value"}),":"," ",i.jsx(p.Box,{component:"span",sx:mt.type,children:"string"}),";"," ",i.jsx(p.Box,{component:"span",sx:mt.property,children:"img"}),i.jsx(p.Box,{component:"span",className:"semicolon",children:"?"}),":"," ",i.jsx(p.Box,{component:"span",sx:mt.type,children:"string"}),"; }"]})]})})},Pt=[{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"text"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"number"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"email"},{isBooleanField:!1,isDecisionField:!1,isMultiple:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"file"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"password"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"tel"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"address"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"url"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"date"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"dateRange"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"time"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"timeRange"},{isBooleanField:!0,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"switch"},{isBooleanField:!0,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"checkbox"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"hidden"},{isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!0,type:"tree"},{isBooleanField:!1,isDecisionField:!0,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"radio"},{isBooleanField:!1,isDecisionField:!0,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"select"},{initialQueryEnable:!0,isBooleanField:!1,isDecisionField:!1,isRepeatableDisabled:!0,isRequiredDisabled:!1,type:"autocomplete"},{isBooleanField:!1,isDecisionField:!1,isMultiple:!1,isRepeatableDisabled:!1,isRequiredDisabled:!1,type:"dynamicSelect"}],Rf=()=>{const{backendConfig:e}=Ae();return{fields:E.useCallback(()=>Pt.filter(n=>!(n.type==="tree"&&!(e!=null&&e.baseUrl))),[e==null?void 0:e.baseUrl])()}},Lf=({onChange:e,value:t})=>{const{t:n}=Se.useTranslation(["translation","form"]),{fields:r}=Rf();return i.jsxs(p.FormControl,{sx:{flex:1},required:!0,children:[i.jsx(p.InputLabel,{children:n("type")}),i.jsx(p.Select,{value:t,label:n("type"),onChange:e,MenuProps:{PaperProps:{sx:{maxHeight:300}}},children:r.map(({type:a,isDecisionField:o})=>i.jsxs(p.MenuItem,{value:a,children:[n(`type.${a}`,{ns:"form"}),o&&i.jsx(p.Chip,{label:n("decisionField",{ns:"form"}),size:"small",color:"info",sx:{marginLeft:1}})]},a))})]})},$f=e=>{if(!e)return[];const t=new Set,n=r=>{var a,o;if((a=r==null?void 0:r.attributes)!=null&&a.tag&&t.add(r.attributes.tag),(o=r==null?void 0:r.children)!=null&&o.length){const{children:s}=r;for(let l=0;l<s.length;l+=1)n(s[l])}};return n(e),[...t]},Pf=p.createFilterOptions(),Ff=({value:e,onChange:t})=>{const{t:n}=Se.useTranslation(["translation","form"]),{tree:r}=Ae(),a=$f(r).reduce((o,s)=>[...o,{inputValue:s,label:s}],[]);return i.jsx(p.Autocomplete,{freeSolo:!0,fullWidth:!0,value:e,onChange:t,filterOptions:(o,s)=>{const l=Pf(o,s),{inputValue:c}=s,f=o.some(d=>typeof d!="string"&&c===d.label);return c!==""&&!f&&l.push({inputValue:c,label:`${n("add")} "${c}"`}),l},getOptionLabel:o=>typeof o=="string"?o:o.inputValue?o.inputValue:o.label,renderOption:(o,s)=>i.jsx("li",{...o,children:typeof s!="string"&&s.label}),renderInput:o=>i.jsx(p.TextField,{...o,label:n("tag")}),options:a})};var oa={},Yf=Ee;Object.defineProperty(oa,"__esModule",{value:!0});var vs=oa.default=void 0,Uf=Yf(Ne()),Vf=i,Bf=(0,Uf.default)((0,Vf.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");vs=oa.default=Bf;const Qf=e=>{const{backendConfig:t}=Ae(),{endpoints:n}=t||{},{workflows:r=""}=n||{};return Et.useQuery(["workflows"],async({signal:a})=>{const{data:o}=await Nt.get(r,{signal:a});return o},e)},qf=({isControlled:e,fetchWorkflowsOnOpen:t})=>{const{t:n}=Se.useTranslation("snackMessage"),{open:r}=Gn(),{currentTree:a,setCurrentTree:o,dispatchTree:s}=Ae(),[l,c]=E.useState(""),f=!!l&&!e&&l!==a.id,{data:d,isError:m}=vr(l,{enabled:f}),{data:h,isLoading:y,refetch:v}=Qf({enabled:!t}),g=E.useCallback(async({target:x})=>{var A;const{value:N}=x;if(N==="add-new-tree"){c(""),o({name:""}),s(cs());return}c(N),o({id:N,name:(A=h==null?void 0:h.find(k=>k.id===N))==null?void 0:A.label})},[s,o,h]),b=E.useCallback(async()=>{if(t)try{await v(),a.id&&!l&&c(a.id)}catch{r(n("error.fetchTree",{ns:"snackMessage"}),"error")}},[t,v,a.id,l,r,n]);return E.useEffect(()=>{if(d&&l!==a.id){const{id:x,label:N,workflow:A}=d;o({id:x,name:N}),s(ds(A))}},[a.id,s,e,o,l,d]),E.useEffect(()=>{m&&r(n("error.fetchTree",{ns:"snackMessage"}),"error")},[m,r,n]),{currentTree:a,fetchWorkflowSuggestions:v,handleChangeTree:g,handleOnOpen:b,setTreeSelected:c,treeSelected:l,workflowsSuggestions:h,workflowsSuggestionsLoading:y}},ys={formControl:{flex:1},select:{".MuiOutlinedInput-notchedOutline":{border:0,paddingLeft:5},".MuiSelect-select":{opacity:0,width:0},boxShadow:"none"}},Ms=({arrowOnly:e,required:t,size:n,showBtnAddNewTree:r,onChange:a,value:o,fetchWorkflowsOnOpen:s})=>{const{t:l}=Se.useTranslation("form"),c=E.useMemo(()=>!!a,[a]),{handleChangeTree:f,handleOnOpen:d,workflowsSuggestions:m,workflowsSuggestionsLoading:h,treeSelected:y}=qf({fetchWorkflowsOnOpen:s,isControlled:c});return i.jsxs(p.FormControl,{size:n,required:t,sx:ys.formControl,children:[!e&&i.jsx(p.InputLabel,{children:l("tree",{ns:"form"})}),i.jsxs(p.Select,{value:c?o:y,id:"tree-select",onChange:v=>c?a==null?void 0:a(v):f(v),sx:e?ys.select:void 0,label:l("tree",{ns:"form"}),onOpen:d,children:[(o&&h||h)&&i.jsx(p.MenuItem,{value:o,children:i.jsx(p.Skeleton,{width:"100%"})}),m==null?void 0:m.map(({label:v,id:g})=>i.jsx(p.MenuItem,{value:g,children:v},g)),r&&i.jsx(p.MenuItem,{disabled:!0,children:i.jsx(p.Box,{sx:{height:1,width:"100%"},children:i.jsx(p.Divider,{})})}),r&&i.jsxs(p.MenuItem,{value:"add-new-tree",children:[i.jsx(p.Typography,{mr:1,children:l("newTree",{ns:"form"})}),i.jsx(vs,{color:"primary"})]})]})]})},Wf=({helperText:e,hiddenValue:t,isHiddenField:n,isTreeField:r,treeSelected:a,handleChangeTreeSelect:o,handleChangeHelperText:s,handleChangeHiddenValue:l})=>{const{t:c}=Se.useTranslation(["translation","form"]);return r?i.jsx(Ms,{required:!0,value:a,onChange:o}):n?i.jsx(p.TextField,{required:!0,sx:{flex:1},label:c("hiddenValue",{ns:"form"}),onChange:l,value:t}):i.jsx(p.TextField,{sx:{flex:1},label:c("helperText",{ns:"form"}),onChange:s,value:e})},xs=e=>new Set([...e]).size===e.length,Gf=(e,t,n)=>{const r=[...e,t];return xs(n?r.filter(a=>a!==n):r)},Kf=()=>{var u,j,C,$,H,ue,K,G,Re,Me,xe,Ue,ft,cr,Ke,$s,Ps,Fs,Ys,Us,Vs,Bs,Qs,qs,Ws,Gs,Ks,Js,Zs,Xs,Hs;const e=E.useMemo(()=>[{id:"0",label:"",message:"",value:""}],[]),{tree:t,dispatchTree:n,currentHierarchyPointNode:r,modalOpen:a,treePath:o,setModalOpen:s}=Ae(),{open:l}=Gn(),{t:c}=Se.useTranslation(),f=r!=null&&r.data&&((u=r==null?void 0:r.data)!=null&&u.attributes)&&"isMultiple"in r.data.attributes?!!r.data.attributes.isMultiple:null,[d,m]=E.useState(e),[h,y]=E.useState(""),[v,g]=E.useState(""),[b,x]=E.useState(""),[N,A]=E.useState(!1),[k,M]=E.useState(!1),[q,z]=E.useState(!1),[ce,De]=E.useState("text"),[_,de]=E.useState(null),[fe,me]=E.useState(null),[ne,ee]=E.useState({url:""}),[ge,$e]=E.useState(""),[Pe,Be]=E.useState(""),[D,w]=E.useState(""),[U,F]=E.useState({off:"",on:""}),[R,Q]=E.useState(!1),[L,Y]=E.useState(!1),[B,W]=E.useState(""),V=a==="edit",be=ce==="tree",O=ce==="hidden",Ce=ce==="autocomplete",I=ce==="dynamicSelect",ze=Pt.some(T=>T.type===ce&&(T==null?void 0:T.isBooleanField)),Fe=Pt.some(T=>T.type===ce&&(T==null?void 0:T.isDecisionField)),ut=Pt.some(T=>T.type===ce&&(T==null?void 0:T.isRequiredDisabled)),Ft=Pt.some(T=>T.type===ce&&(T==null?void 0:T.isRepeatableDisabled)),ot=((C=(j=r==null?void 0:r.data)==null?void 0:j.attributes)==null?void 0:C.isLeaf)??!0,Mt=Pt.some(T=>T.type===ce&&"isMultiple"in T),{refetch:Yt,isInitialLoading:xt}=vr(ge,{enabled:!1}),gt=E.useCallback(T=>!Fe&&T>0,[Fe]),Ge=E.useCallback((T,S)=>{m(P=>P.map(J=>{const{id:ve}=J;return T.target.dataset.id===ve?{...J,id:ve,[S]:T.target.value}:{...J}}))},[]),Ut=E.useCallback((T,S)=>{typeof S=="string"?de(S):S&&S.inputValue?de(S.inputValue):de(null)},[]),ct=E.useCallback((T,S)=>{ee(P=>({...P,url:P.url?P.url.replace(/{{[^{}]+}}/,`{{${S||""}}}`):`https://example.com/{{${S||""}}}`})),me(S??null)},[]),dt=E.useCallback(T=>{g(T.target.value)},[]),or=E.useCallback(T=>{x(T.target.value)},[]),Vt=E.useCallback(T=>{Ge(T,"label")},[Ge]),Bt=E.useCallback(T=>{Ge(T,"value")},[Ge]),we=E.useCallback(T=>{Ge(T,"message")},[Ge]),Tt=E.useCallback(T=>{ee(S=>({...S,url:T.target.value}))},[]),et=E.useCallback(T=>{const S=T.target.value;if(S.includes("{{}}")){const P=S.replace("{{}}",`{{${fe||""}}}`);ee(J=>({...J,url:P}))}else if(S.includes("{{")){const P=S.replace(/{{[^{}]+}}/,`{{${fe||""}}}`);ee(J=>({...J,url:P}))}else ee(P=>({...P,url:S}))},[fe]),bt=E.useCallback(T=>{ee(S=>({...S,searchKey:T.target.value}))},[]),jt=E.useCallback((T,S)=>{ee(P=>{const J={...P.pathKey,[T]:S.target.value};if(S.target.value===""&&T in J){const{pathKey:ve,...Ie}=P;return{...Ie}}return{...P,pathKey:J}})},[ee]),ga=E.useCallback((T,S,P)=>{ee(J=>{const ve=[...J.params??[]];return ve[T]={...ve[T],[S]:P.target.value},{...J,params:ve}})},[ee]),ba=E.useCallback(T=>{w(T.target.value)},[]),va=E.useCallback(T=>{var Je;const{value:S}=T.target;if(y(S),!t||!S){W("");return}const P=V&&(r==null?void 0:r.data.name),J=(Je=o==null?void 0:o.at(-1))==null?void 0:Je.path,ve=$t(t,J),Ie=us(ve);if(Gf(Ie,S,P)){W("");return}W(c("mustBeUnique",{ns:"form"}))},[r==null?void 0:r.data.name,V,c,t,o]),sr=E.useCallback(T=>{z(T.target.checked)},[]),Gr=E.useCallback(T=>{A(T.target.checked)},[]),vt=E.useCallback(T=>{Y(T.target.checked)},[]),ir=E.useCallback(T=>{M(T.target.checked)},[]),lr=E.useCallback(T=>{Q(T.target.checked)},[]),Kr=E.useCallback(T=>{De(T.target.value),M(!1),A(!1),Q(!1)},[]),ya=E.useCallback(T=>{$e(T.target.value)},[]),Jr=E.useCallback(T=>S=>{F(P=>({...P,[T]:S.target.value}))},[]),Ma=E.useCallback(T=>{Be(T.target.value)},[]),Zr=E.useCallback(()=>{m(T=>{const S=Number(T[T.length-1].id),P=String(S+1);return[...T,{...e[0],id:P}]})},[e]),Xr=E.useCallback(()=>{ee(T=>{var ve,Ie;const S=Number(((Ie=(ve=T.params)==null?void 0:ve[T.params.length-1])==null?void 0:Ie.id)||0),P=String(S+1),J=[...T.params||[],{id:P,key:"",value:""}];return{...T,params:J}})},[]),xa=E.useCallback(T=>{m(S=>S.filter(({id:P})=>T.currentTarget.value!==P))},[]),Ta=E.useCallback(T=>{const S=T.currentTarget.value;ee(P=>{const J=(P.params??[]).filter(({id:Ie})=>Ie!==S),ve=J.length>0?J:void 0;return{...P,params:ve}})},[]),ur=E.useCallback((T,S)=>{var J,ve,Ie;const P=(Ie=(ve=(J=T==null?void 0:T.children)==null?void 0:J[S])==null?void 0:ve.data)==null?void 0:Ie.children;return P?P.map(({name:st,attributes:Je,children:yt})=>({attributes:Je,children:yt,name:st})):[]},[]),Hr=E.useCallback(T=>{var S;return k?(S=d==null?void 0:d.filter((P,J)=>!gt(J)))==null?void 0:S.map(({message:P,value:J,label:ve},Ie)=>{const st=`${h}:${J}`,Je=ur(r,Ie);return{attributes:{depth:T+1,label:ve,value:J,...P&&{message:P},...Je.length===0&&{isLeaf:!0}},children:Je,name:st}}):[]},[r,gt,ur,k,h,d]),en=E.useCallback(T=>T.map(({message:S,...P})=>({...P,...S&&{message:S}})),[]),tn=E.useCallback((T,S,P)=>{var J;if(T&&(!S||P))try{return Yt()}catch{l(c("error.fetchTree",{ns:"snackMessage"}),"error")}return T&&S&&!P?{data:{workflow:(J=r==null?void 0:r.data.attributes)==null?void 0:J.tree},isError:null}:{data:null,isError:null}},[($=r==null?void 0:r.data.attributes)==null?void 0:$.tree,Yt,l,c]),ja=E.useCallback(async T=>{var fr,pr,hr,mr;T.preventDefault();const{on:S,off:P}=U,J=((fr=r==null?void 0:r.data)==null?void 0:fr.name)||"",ve=(r==null?void 0:r.depth)||0,Ie=a==="edit",st=ve+(Ie||r===null?0:1),Je=Hr(st),yt=(pr=o==null?void 0:o.at(-1))==null?void 0:pr.path,rn=o.length?`${yt}/${h}`:`/${h}`,nn=((mr=(hr=r==null?void 0:r.data.attributes)==null?void 0:hr.tree)==null?void 0:mr.treeId)!==ge,{data:Qt,isError:an}=await tn(be,Ie,nn);if(an)return;const dr={attributes:{depth:st,label:b,type:ce,...Ce&&{route:ne},...I&&{route:ne},...Pe&&{helperText:Pe},...(P||S)&&{messages:{...P&&{off:P},...S&&{on:S}}},...be&&{tree:{...Qt==null?void 0:Qt.workflow,treeId:ge},treePath:rn},...k&&{isDecision:k},...Fe&&!k&&{values:en(d)},...N&&{required:N},...D&&{step:D},...R&&{repeatable:R},...O&&{hiddenValue:v},..._&&{tag:_},...fe&&{parentRef:fe},...q&&Mt&&{isMultiple:q},...L&&{initialQuery:L}},children:Je,name:h};n(Ie?zd(yt||"",J,dr):_d(yt||null,J,dr)),s(null)},[r,n,Hr,en,tn,Pe,v,Ce,k,Fe,I,O,q,Mt,be,b,U,a,h,fe,R,N,ne,s,D,_,o,ge,ce,d,L]);return E.useEffect(()=>{var T,S,P,J,ve,Ie,st,Je,yt,rn,nn,Qt,an,dr,fr,pr,hr,mr,ei,ti,ri,ni;if(a==="edit"){const on=((S=(T=r==null?void 0:r.data)==null?void 0:T.attributes)==null?void 0:S.values)||((ve=(J=(P=r==null?void 0:r.data)==null?void 0:P.children)==null?void 0:J.filter(({attributes:Dt})=>!(Dt!=null&&Dt.type)))==null?void 0:ve.map(({attributes:Dt},sn)=>{const{label:ln,value:un,message:gr}=Dt||{};return{id:String(sn),label:String(ln),value:String(un),...gr&&{message:String(gr)}}}));y((r==null?void 0:r.data.name)||""),de(((Ie=r==null?void 0:r.data.attributes)==null?void 0:Ie.tag)||null),De(((st=r==null?void 0:r.data.attributes)==null?void 0:st.type)||"text"),Be(((Je=r==null?void 0:r.data.attributes)==null?void 0:Je.helperText)||""),A(((yt=r==null?void 0:r.data.attributes)==null?void 0:yt.required)||!1),w(((rn=r==null?void 0:r.data.attributes)==null?void 0:rn.step)||""),x(((nn=r==null?void 0:r.data.attributes)==null?void 0:nn.label)||""),M(((Qt=r==null?void 0:r.data.attributes)==null?void 0:Qt.isDecision)||!1),m(on!=null&&on.length?on:e),$e(((dr=(an=r==null?void 0:r.data.attributes)==null?void 0:an.tree)==null?void 0:dr.treeId)||""),Q(((fr=r==null?void 0:r.data.attributes)==null?void 0:fr.repeatable)||!1),g(((pr=r==null?void 0:r.data.attributes)==null?void 0:pr.hiddenValue)||""),me(((hr=r==null?void 0:r.data.attributes)==null?void 0:hr.parentRef)||null),F({off:((ei=(mr=r==null?void 0:r.data.attributes)==null?void 0:mr.messages)==null?void 0:ei.off)||"",on:((ri=(ti=r==null?void 0:r.data.attributes)==null?void 0:ti.messages)==null?void 0:ri.on)||""}),ee(Dt=>{var sn,ln,un,gr,ai,oi,si,ii;return{...Dt,params:(ln=(sn=r==null?void 0:r.data.attributes)==null?void 0:sn.route)==null?void 0:ln.params,pathKey:(gr=(un=r==null?void 0:r.data.attributes)==null?void 0:un.route)==null?void 0:gr.pathKey,searchKey:(oi=(ai=r==null?void 0:r.data.attributes)==null?void 0:ai.route)==null?void 0:oi.searchKey,url:((ii=(si=r==null?void 0:r.data.attributes)==null?void 0:si.route)==null?void 0:ii.url)||""}}),z(f||!1),Y(((ni=r==null?void 0:r.data.attributes)==null?void 0:ni.initialQuery)||!1)}},[(H=r==null?void 0:r.data.attributes)==null?void 0:H.initialQuery,(ue=r==null?void 0:r.data.attributes)==null?void 0:ue.helperText,(K=r==null?void 0:r.data.attributes)==null?void 0:K.hiddenValue,(G=r==null?void 0:r.data.attributes)==null?void 0:G.isDecision,(Re=r==null?void 0:r.data.attributes)==null?void 0:Re.label,(xe=(Me=r==null?void 0:r.data.attributes)==null?void 0:Me.messages)==null?void 0:xe.off,(ft=(Ue=r==null?void 0:r.data.attributes)==null?void 0:Ue.messages)==null?void 0:ft.on,(cr=r==null?void 0:r.data.attributes)==null?void 0:cr.parentRef,(Ke=r==null?void 0:r.data.attributes)==null?void 0:Ke.repeatable,($s=r==null?void 0:r.data.attributes)==null?void 0:$s.required,(Fs=(Ps=r==null?void 0:r.data.attributes)==null?void 0:Ps.route)==null?void 0:Fs.params,(Us=(Ys=r==null?void 0:r.data.attributes)==null?void 0:Ys.route)==null?void 0:Us.pathKey,(Bs=(Vs=r==null?void 0:r.data.attributes)==null?void 0:Vs.route)==null?void 0:Bs.searchKey,(qs=(Qs=r==null?void 0:r.data.attributes)==null?void 0:Qs.route)==null?void 0:qs.url,(Ws=r==null?void 0:r.data.attributes)==null?void 0:Ws.step,(Gs=r==null?void 0:r.data.attributes)==null?void 0:Gs.tag,(Js=(Ks=r==null?void 0:r.data.attributes)==null?void 0:Ks.tree)==null?void 0:Js.treeId,(Zs=r==null?void 0:r.data.attributes)==null?void 0:Zs.type,(Xs=r==null?void 0:r.data.attributes)==null?void 0:Xs.values,(Hs=r==null?void 0:r.data)==null?void 0:Hs.children,r==null?void 0:r.data.name,e,a,f]),{getDisabledValueField:gt,handleAddParams:Xr,handleAddValue:Zr,handleChangeHelperText:Ma,handleChangeHiddenValue:dt,handleChangeInitialQuery:vt,handleChangeIsDecisionField:ir,handleChangeLabel:or,handleChangeMessage:Jr,handleChangeMultiple:sr,handleChangeName:va,handleChangeOptionLabel:Vt,handleChangeOptionMessage:we,handleChangeOptionValue:Bt,handleChangeParam:ga,handleChangeParentRef:ct,handleChangePath:jt,handleChangeRepeatable:lr,handleChangeRequired:Gr,handleChangeSearchKey:bt,handleChangeStep:ba,handleChangeTag:Ut,handleChangeTreeSelect:ya,handleChangeType:Kr,handleChangeUrl:Tt,handleChangeUrlSelect:et,handleDeleteParam:Ta,handleDeleteValue:xa,handleSubmit:ja,helperText:Pe,hiddenValue:v,initialQuery:L,isAutocomplete:Ce,isBooleanField:ze,isDecision:k,isDecisionField:Fe,isDynamicSelect:I,isEditModal:V,isHiddenField:O,isLeaf:ot,isMultiple:q,isMultiplePossible:Mt,isRepeatableDisabled:Ft,isRequiredDisabled:ut,isTreeField:be,isWorkflowLoading:xt,label:b,messages:U,name:h,parentRef:fe,repeatable:R,required:N,route:ne,step:D,tag:_,treeSelected:ge,type:ce,uniqueNameErrorMessage:B,values:d}},Ts={marginRight:"-20px !important",minWidth:"auto !important"},Wr={iconButton:Ts,iconButtonDelete:{...Ts,"&:before":{borderRadius:"50%",content:'""',height:20,position:"absolute",width:20,zIndex:-1},backgroundColor:pe.background,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)"}},Jf=({onClose:e})=>{const{t}=Se.useTranslation(["translation","form"]),{values:n,required:r,name:a,tag:o,uniqueNameErrorMessage:s,type:l,helperText:c,label:f,hiddenValue:d,isBooleanField:m,isDecision:h,isEditModal:y,isDecisionField:v,isHiddenField:g,isRequiredDisabled:b,isRepeatableDisabled:x,isAutocomplete:N,isDynamicSelect:A,isTreeField:k,treeSelected:M,isWorkflowLoading:q,repeatable:z,isLeaf:ce,isMultiplePossible:De,isMultiple:_,initialQuery:de,handleChangeTreeSelect:fe,handleChangeHelperText:me,handleChangeOptionMessage:ne,handleChangeRequired:ee,handleChangeName:ge,handleChangeType:$e,handleChangeIsDecisionField:Pe,handleChangeOptionLabel:Be,handleDeleteValue:D,handleDeleteParam:w,handleChangeOptionValue:U,handleChangeMessage:F,handleSubmit:R,handleAddValue:Q,handleAddParams:L,handleChangeLabel:Y,handleChangeRepeatable:B,handleChangeHiddenValue:W,handleChangeTag:V,handleChangeSearchKey:be,handleChangeUrl:O,handleChangeUrlSelect:Ce,handleChangeParam:I,handleChangePath:ze,handleChangeMultiple:Fe,handleChangeParentRef:ut,handleChangeInitialQuery:Ft,parentRef:ot,route:Mt,messages:{on:Yt,off:xt}}=Kf(),{searchKey:gt,url:Ge,pathKey:Ut,params:ct}=Mt||{},{object:dt="",label:or="",value:Vt="",image:Bt=""}=Ut||{};return i.jsxs("form",{onSubmit:R,children:[i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(p.TextField,{sx:{flex:1},label:t("label",{ns:"form"}),onChange:Y,value:f,required:!0}),i.jsx(p.TextField,{label:t("name"),sx:{flex:1},onChange:ge,value:a,error:!!s,helperText:s,required:!0})]}),i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(Lf,{value:l,onChange:$e}),i.jsx(Wf,{helperText:c,hiddenValue:d,isHiddenField:g,isTreeField:k,treeSelected:M,handleChangeTreeSelect:fe,handleChangeHelperText:me,handleChangeHiddenValue:W})]}),N&&i.jsx(p.Stack,{spacing:1,paddingY:1,children:i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:4},InputProps:{startAdornment:i.jsx(p.InputAdornment,{position:"start",children:i.jsx(ta,{})})},placeholder:"https://api.fr/enpoint",type:"url",label:t("form:apiRoute"),onChange:O,value:Ge,required:!0}),i.jsx(bs,{}),i.jsx(p.TextField,{sx:{flex:1},placeholder:"q",type:"text",onChange:be,value:gt,required:!0})]})}),A&&i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsx("h4",{children:t("form:urlConstruction")}),i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(Sf,{value:ot,onChange:ut,currentName:a}),i.jsx(ms,{}),i.jsx(p.TextField,{sx:{flex:3},InputProps:{startAdornment:i.jsx(p.InputAdornment,{position:"start",children:i.jsx(ta,{})})},placeholder:`https://api.fr/{{${ot||""}}}/enpoint`,type:"url",label:t("form:apiRoute"),onChange:Ce,value:Ge})]}),Ge&&i.jsx(_f,{value:ot})]}),(N||A)&&i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsxs(p.Accordion,{elevation:0,square:!0,children:[i.jsx(p.AccordionSummary,{expandIcon:i.jsx(gs,{}),"aria-controls":"panel-content",sx:{"& .MuiAccordionSummary-content":{flexGrow:0},display:"inline-flex",justifyContent:"flex-start",padding:0},children:i.jsx(p.Typography,{sx:{textDecoration:"underline"},children:t("form:dataMapping")})}),i.jsxs(p.Stack,{spacing:1,paddingY:1,children:[i.jsxs(p.Stack,{spacing:1,sx:{pb:1},direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Object Array Path",value:dt,onChange:we=>ze("object",we),placeholder:"elements.features[]",type:"text"}),i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Label Path",value:or,onChange:we=>ze("label",we),placeholder:"client.name",type:"text"})]}),i.jsxs(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},alignItems:"center",children:[i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Value Path",value:Vt,onChange:we=>ze("value",we),placeholder:"client.id",type:"text"}),i.jsx(p.TextField,{sx:{flex:3},InputLabelProps:{shrink:!0},label:"Image Path",value:Bt,onChange:we=>ze("image",we),placeholder:"client.src.profile",type:"text"})]}),i.jsx(zf,{endPoint:{searchKey:gt||"",url:Ge}})]})]}),i.jsxs(p.Stack,{children:[i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},position:"relative",alignItems:{sm:"center",xs:"flex-start"},children:[i.jsx("h4",{children:t("form:additionalParams")}),i.jsx(p.Box,{justifyContent:"flex-end",children:i.jsx(p.IconButton,{color:"success",sx:Wr.iconButton,onClick:L,children:i.jsx(Zn,{})})})]}),ct==null?void 0:ct.map(({id:we,key:Tt,value:et},bt)=>i.jsxs(p.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[i.jsx(p.TextField,{label:"Key",sx:{flex:1},onChange:jt=>I(bt,"key",jt),value:Tt,inputProps:{"data-id":we}}),i.jsx(p.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:jt=>I(bt,"value",jt),value:et,inputProps:{"data-id":we}}),ct.length>0&&i.jsx(p.IconButton,{color:"warning",sx:Wr.iconButtonDelete,value:we,onClick:w,children:i.jsx(aa,{})})]},we))]})]}),i.jsx(p.Stack,{spacing:1,direction:{sm:"row",xs:"column"},children:i.jsx(Ff,{value:o,onChange:V})}),m&&i.jsxs(p.Stack,{spacing:1,paddingY:1,direction:{sm:"row",xs:"column"},children:[i.jsx(p.TextField,{sx:{flex:1},label:t("onMessage",{ns:"form"}),onChange:F("on"),value:Yt}),i.jsx(p.TextField,{sx:{flex:1},label:t("offMessage",{ns:"form"}),onChange:F("off"),value:xt})]}),i.jsx(p.Stack,{paddingY:1,children:i.jsxs(p.FormGroup,{children:[De&&i.jsx(p.FormControlLabel,{control:i.jsx(p.Checkbox,{checked:_,onChange:Fe}),label:t("multiple")}),N&&i.jsx(p.FormControlLabel,{control:i.jsx(p.Checkbox,{checked:de,onChange:Ft}),label:t("initialQueryEnable")}),i.jsx(p.FormControlLabel,{disabled:b,control:i.jsx(p.Checkbox,{checked:r,onChange:ee}),label:t("required")}),i.jsx(p.FormControlLabel,{disabled:x,control:i.jsx(p.Checkbox,{checked:z,onChange:B}),label:t("repeatable",{ns:"form"})}),(ce||y)&&i.jsx(p.FormControlLabel,{disabled:!v,control:i.jsx(p.Checkbox,{checked:h,onChange:Pe}),label:t("decisionField",{ns:"form"})})]})}),v&&i.jsxs(i.Fragment,{children:[i.jsx("h4",{children:t("values")}),n==null?void 0:n.map(({value:we,label:Tt,id:et,message:bt})=>i.jsxs(p.Stack,{direction:{sm:"row",xs:"column"},spacing:1,paddingY:1,position:"relative",children:[i.jsx(p.TextField,{label:t("label",{ns:"form"}),sx:{flex:1},onChange:Be,value:Tt,inputProps:{"data-id":et},required:!0}),i.jsx(p.TextField,{label:t("value",{ns:"form"}),sx:{flex:1},onChange:U,value:we,inputProps:{"data-id":et},required:!0}),i.jsx(p.TextField,{label:"Message",sx:{flex:1},onChange:ne,value:bt,inputProps:{"data-id":et}}),n.length>1&&i.jsx(p.IconButton,{color:"warning",sx:Wr.iconButtonDelete,value:et,onClick:D,children:i.jsx(aa,{})})]},et))]}),v&&i.jsx(p.Box,{justifyContent:"flex-end",display:"flex",children:i.jsx(p.IconButton,{color:"success",sx:Wr.iconButton,onClick:Q,children:i.jsx(Zn,{})})}),i.jsxs(p.Stack,{spacing:2,direction:"row",justifyContent:"flex-end",paddingTop:3,children:[i.jsx(p.Button,{variant:"text",onClick:e,children:t("cancel")}),i.jsx(p.Button,{variant:"contained",type:"submit",disabled:!!s||q,isLoading:q,loadingIndicator:i.jsx(p.CircularProgress,{size:14}),children:t("validate")})]})]})};var sa={},Zf=Ee;Object.defineProperty(sa,"__esModule",{value:!0});var js=sa.default=void 0,Xf=Zf(Ne()),Hf=i,ep=(0,Xf.default)((0,Hf.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");js=sa.default=ep;var ia={},tp=Ee;Object.defineProperty(ia,"__esModule",{value:!0});var Ds=ia.default=void 0,rp=tp(Ne()),np=i,ap=(0,rp.default)((0,np.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");Ds=ia.default=ap;var la={},op=Ee;Object.defineProperty(la,"__esModule",{value:!0});var Es=la.default=void 0,sp=op(Ne()),ip=i,lp=(0,sp.default)((0,ip.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");Es=la.default=lp;var ua={},up=Ee;Object.defineProperty(ua,"__esModule",{value:!0});var Ns=ua.default=void 0,cp=up(Ne()),dp=i,fp=(0,cp.default)((0,dp.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");Ns=ua.default=fp;var ca={},pp=Ee;Object.defineProperty(ca,"__esModule",{value:!0});var Os=ca.default=void 0,hp=pp(Ne()),mp=i,gp=(0,hp.default)((0,mp.jsx)("path",{d:"M12 3c-4.8 0-9 3.86-9 9 0 2.12.74 4.07 1.97 5.61l-1.68 1.68c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l1.68-1.68C7.93 20.26 9.88 21 12 21c2.3 0 4.61-.88 6.36-2.64C20.12 16.61 21 14.3 21 12V5c0-1.1-.9-2-2-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");Os=ca.default=gp;var da={},bp=Ee;Object.defineProperty(da,"__esModule",{value:!0});var Cs=da.default=void 0,vp=bp(Ne()),ws=i,yp=(0,vp.default)([(0,ws.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,ws.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");Cs=da.default=yp;var fa={},Mp=Ee;Object.defineProperty(fa,"__esModule",{value:!0});var Is=fa.default=void 0,xp=Mp(Ne()),Tp=i,jp=(0,xp.default)((0,Tp.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");Is=fa.default=jp;var pa={},Dp=Ee;Object.defineProperty(pa,"__esModule",{value:!0});var As=pa.default=void 0,Ep=Dp(Ne()),Np=i,Op=(0,Ep.default)((0,Np.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");As=pa.default=Op;var ha={},Cp=Ee;Object.defineProperty(ha,"__esModule",{value:!0});var ks=ha.default=void 0,wp=Cp(Ne()),Ip=i,Ap=(0,wp.default)((0,Ip.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");ks=ha.default=Ap;var ma={},kp=Ee;Object.defineProperty(ma,"__esModule",{value:!0});var Ss=ma.default=void 0,Sp=kp(Ne()),_p=i,zp=(0,Sp.default)((0,_p.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");Ss=ma.default=zp;const _e={actionButton:{minWidth:"auto !important"},container:{background:pe.background,borderRadius:"1rem"},containerField:{background:pe.background,border:`solid 1px ${pe.primary}`,borderRadius:"1rem"},containerHidden:{background:pe.background,border:`solid 1px ${pe.borderGrey}`,borderRadius:"1rem"},containerTree:{background:pe.tertiary,border:`solid 1px ${pe.primary}`,borderRadius:"1rem"},containerValue:{background:pe.background,border:`solid 1px ${pe.secondary}`,borderRadius:"1rem"},icon:{color:pe.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}},Rp=e=>{const t=!!e,n=e==="tree";return e==="hidden"?_e.containerHidden:n?_e.containerTree:t?_e.containerField:_e.containerValue},Lp=({nodeDatum:e,onAddChildren:t,onEditChildren:n,onDeleteChildren:r,onOpenTreeModal:a,hierarchyPointNode:o,size:s=220})=>{var z;const{t:l}=Se.useTranslation(["translation","form"]),{attributes:c}=e||{},{isRoot:f,isLeaf:d,required:m,isDecision:h,step:y,type:v,label:g,repeatable:b,tag:x}=c||{},N=!!v,A=v==="tree",k=v==="hidden",M=!N,q=!f&&!d;return i.jsxs("g",{children:[i.jsx(p.GlobalStyles,{styles:{".rd3t-node svg":_e.nodeSvg}}),i.jsx(p.Box,{component:"foreignObject",height:s,width:s,x:`-${s/2}`,y:`-${s/2}`,sx:Rp(v),children:i.jsxs(p.Box,{flex:1,display:"flex",p:2,height:"100%",flexDirection:"column",justifyContent:"space-between",children:[i.jsxs(p.Stack,{alignItems:"flex-end",spacing:.5,children:[N&&i.jsxs(p.Stack,{direction:"row",spacing:1,alignItems:"center",children:[y&&i.jsx(p.Tooltip,{title:`${l("step",{ns:"form"})} ${(z=e==null?void 0:e.attributes)==null?void 0:z.step}`,placement:"left",arrow:!0,children:i.jsx(p.Chip,{color:"primary",size:"small",label:y,sx:_e.stepChip})}),i.jsx(p.Typography,{variant:"subtitle2",sx:_e.title,children:i.jsx("strong",{children:g})})]}),N&&i.jsx(p.Chip,{color:"info",size:"small",label:l(`type.${v}`,{ns:"form"})}),x&&i.jsx(p.Chip,{variant:"outlined",color:"warning",size:"small",label:x}),m&&i.jsx(p.Stack,{direction:"row",spacing:.5,children:m&&i.jsx(p.Typography,{variant:"body2",sx:{color:({palette:ce})=>ce.error.main},children:l("required")})}),i.jsx(p.Stack,{spacing:.5,alignItems:"flex-end",children:M&&i.jsx(p.Typography,{variant:"subtitle2",sx:_e.title,children:i.jsx("strong",{children:g})})}),i.jsxs(p.Stack,{paddingTop:.5,spacing:.5,direction:"row",children:[b&&i.jsx(p.Tooltip,{title:l("isARepeatable"),placement:"bottom",arrow:!0,children:i.jsx(Is,{style:_e.icon})}),d&&i.jsx(p.Tooltip,{title:l("isALeaf"),placement:"bottom",arrow:!0,children:i.jsx(Os,{style:_e.icon})}),k&&i.jsx(p.Tooltip,{title:l("isAHidden"),placement:"bottom",arrow:!0,children:i.jsx(ks,{style:_e.icon})}),f&&i.jsx(p.Tooltip,{title:l("isTheRoot"),placement:"bottom",arrow:!0,children:i.jsx(As,{style:_e.icon})}),q&&i.jsx(p.Tooltip,{title:l("isABranch"),placement:"bottom",arrow:!0,children:i.jsx(js,{style:_e.icon})}),A&&i.jsx(p.Tooltip,{title:l("isATree"),placement:"bottom",arrow:!0,children:i.jsx(Cs,{style:_e.icon})})]})]}),i.jsxs(p.Stack,{direction:"row",justifyContent:"flex-end",spacing:0,alignSelf:"flex-end",children:[!f&&i.jsx(p.Tooltip,{title:l("remove"),arrow:!0,children:i.jsx(p.Button,{variant:"text",sx:_e.actionButton,size:"small",color:"error",onClick:()=>r==null?void 0:r(o),children:i.jsx(Es,{})})}),!M&&i.jsx(p.Tooltip,{title:l("edit"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"secondary",sx:_e.actionButton,size:"small",onClick:()=>n==null?void 0:n(o),children:i.jsx(Ns,{})})}),!h&&i.jsx(p.Tooltip,{title:l("add"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"success",sx:_e.actionButton,size:"small",onClick:()=>t==null?void 0:t(o),children:i.jsx(Ds,{})})}),A&&i.jsx(p.Tooltip,{title:l("show"),arrow:!0,children:i.jsx(p.Button,{variant:"text",color:"info",sx:_e.actionButton,size:"small",onClick:()=>a==null?void 0:a(o),children:i.jsx(Ss,{})})})]})]})})]})},$p=E.memo(Lp),_s=()=>{const{setModalOpen:e,setCurrentHierarchyPointNode:t,setTreeModalOpen:n,setTreePath:r}=Ae();return{handleAddChildren:f=>{t(f),e("add")},handleCloseTreeModal:()=>{r([]),n(!1)},handleDeleteChildren:f=>{t(f),e("delete")},handleEditChildren:f=>{t(f),e("edit")},handleOpenTreeModal:f=>{var m,h;const d={label:f==null?void 0:f.data.attributes.label,path:((h=(m=f==null?void 0:f.data)==null?void 0:m.attributes)==null?void 0:h.treePath)||""};r(y=>[...y,d]),n(!0)}}},Pp=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:a,onNodeMouseOut:o,addChildren:s})=>{const{handleDeleteChildren:l,handleEditChildren:c,handleAddChildren:f,handleOpenTreeModal:d}=_s();return i.jsx($p,{addChildren:s,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:a,onNodeMouseOut:o,onAddChildren:f,onOpenTreeModal:d,onDeleteChildren:l,onEditChildren:c})},zs=({nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:a,onNodeMouseOut:o,addChildren:s})=>i.jsx(Pp,{addChildren:s,nodeDatum:e,hierarchyPointNode:t,toggleNode:n,onNodeClick:r,onNodeMouseOver:a,onNodeMouseOut:o}),Fp=()=>{const{t:e}=Se.useTranslation(["modal","snackMessage"]),{currentHierarchyPointNode:t,modalOpen:n,setModalOpen:r}=Ae(),a=n==="edit";return{closeModal:()=>{r(null)},getTitleModalDelete:()=>{var h,y;const m=(y=(h=t==null?void 0:t.data)==null?void 0:h.attributes)==null?void 0:y.label;return e("deleteTitle",{name:m,ns:"modal"})},getTitleModalMutation:()=>{var y;const m=(y=t==null?void 0:t.data)==null?void 0:y.attributes.label;return m?e(a?"editTitle":"addTitle",{name:m,ns:"modal"}):e("addFirstTitle",{name:m,ns:"modal"})},isDeleteModal:n==="delete",isModalMutationOpen:a||n==="add"}},Yp=()=>{const{currentTree:e,setCurrentTree:t,tree:n}=Ae(),{name:r,errorName:a,id:o}=e;return{disabled:!!e.id&&!n,errorName:a,handleChangeName:c=>{const{value:f}=c.target;if(!f){t(d=>({...d,errorName:"Champs requis",name:c.target.value}));return}t(d=>({...d,errorName:"",name:c.target.value}))},id:o,name:r}},Up=()=>{const{t:e}=Se.useTranslation("form"),{name:t,handleChangeName:n,errorName:r,disabled:a}=Yp();return i.jsx(p.TextField,{required:!0,label:e("treeName",{ns:"form"}),size:"small",onChange:n,value:t,error:!!r,disabled:a})},Vp=()=>{var y,v;const{tree:e,treeModalOpen:t,treePath:n,backendConfig:r}=Ae(),{handleCloseTreeModal:a}=_s(),{getTitleModalMutation:o,closeModal:s,getTitleModalDelete:l,isModalMutationOpen:c,isDeleteModal:f}=Fp(),d=(y=n==null?void 0:n.at(-1))==null?void 0:y.path,m=(v=n==null?void 0:n.at(-1))==null?void 0:v.label,h=e&&$t(e,d);return i.jsxs(i.Fragment,{children:[i.jsxs(rf,{children:[i.jsx(Hd,{children:i.jsxs(p.Stack,{justifyContent:"space-between",direction:"row",alignItems:"center",children:[i.jsx(wi,{}),!!(r!=null&&r.baseUrl)&&i.jsxs(p.Stack,{direction:"row",alignItems:"center",spacing:2,children:[i.jsx(Up,{}),i.jsx(Ms,{size:"small",arrowOnly:!0,showBtnAddNewTree:!0,fetchWorkflowsOnOpen:!0})]})]})}),i.jsx(tf,{children:i.jsx(ka,{data:e,renderCustomNodeElement:zs})}),i.jsx(af,{children:i.jsx(zi,{value:e})}),i.jsx(Zd,{children:i.jsx(Yd,{value:e})})]}),i.jsx(fs,{open:c,onClose:s,title:o(),children:i.jsx(Jf,{onClose:s})}),i.jsx(fs,{open:f,onClose:s,title:l(),children:i.jsx(sf,{onClose:s})}),i.jsx(Kd,{open:t,onClose:a,title:m,children:h&&i.jsx(ka,{data:h,renderCustomNodeElement:zs})})]})},Bp="0.19.0",Qp=({children:e,initialTree:t,initialTreeId:n,backendConfig:r})=>{const[a,o]=E.useState(Qe.currentHierarchyPointNode),[s,l]=E.useState(Qe.modalOpen),[c,f]=E.useState(Qe.treeModalOpen),[d,m]=E.useState(Qe.treePath),[h,y]=E.useReducer(Ld,t||Qe.tree),[v,g]=E.useState(n?{...Qe.currentTree,id:n}:Qe.currentTree),b=E.useMemo(()=>{var x,N;return{backendConfig:{baseUrl:((x=Qe==null?void 0:Qe.backendConfig)==null?void 0:x.baseUrl)||"",...Qe.backendConfig,...r,endpoints:{...(N=Qe.backendConfig)==null?void 0:N.endpoints,...r==null?void 0:r.endpoints}},currentHierarchyPointNode:a,currentTree:v,dispatchTree:y,modalOpen:s,setCurrentHierarchyPointNode:o,setCurrentTree:g,setModalOpen:l,setTreeModalOpen:f,setTreePath:m,tree:h,treeModalOpen:c,treePath:d,version:Bp}},[r,a,v,s,h,c,d]);return vr(v.id,{enabled:!!n,onSuccess:async x=>{x&&(g({id:x==null?void 0:x.id,name:x==null?void 0:x.label}),y(ds((x==null?void 0:x.workflow)||null)))}}),i.jsx(Ia.Provider,{value:b,children:e})},qp={close:"Close",createTree:"Create Tree",downloadJSONFile:"Download JSON File",reset:"Reset",resetTree:"Reset tree",save:"Save",update:"Update"},Wp={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"}},Gp={add:"Add",cancel:"Cancel",disabled:"Disabled",edit:"Edit",initialQueryEnable:"Enable initial API call",isABranch:"Is a branch",isAHidden:"Is a hidden field",isALeaf:"Is a leaf",isARepeatable:"Is a repeatable",isATree:"Is a tree",isTheRoot:"Is the root",label:"Label",multiple:"Multiple",name:"Name",parentRef:"Parent element",remove:"Remove",required:"Required",save:"Save",show:"Show",tag:"Tag",type:"Type",validate:"Validate",value:"Value",values:"Values"},Kp={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"},Rs={additionalParams:"Paramètres additionnels",ancestor:"Ancêtre",apiRoute:"Api route",dataMapping:"Mapping de données",decisionField:"Champs de décision",helperText:"Texte d'information",hiddenValue:"Valeur caché",label:"Label",mustBeUnique:"Doit être unique",newTree:"Nouvel arbre",noAncestorFound:"Aucun parent trouvé",offMessage:"Message (désactiver)",onMessage:"Message (activer)",repeatable:"Répétable",staticFields:"Champs statiques",step:"Étape",tree:"Arbre",treeName:"Nom de l'arbre",type:{address:"Adresse",autocomplete:"Autocomplétion",checkbox:"Case à cocher",date:"Date",dateRange:"Plage de dates",dynamicSelect:"Sélection dynamique",email:"Email",file:"Fichier",hidden:"Champs caché",number:"Nombre",password:"Mot de passe",radio:"Radio",select:"Select",switch:"Switch",tel:"Téléphone",text:"Texte",time:"Temps",timeRange:"Plage de temps",tree:"Arbre",url:"URL"},urlConstruction:"Construction de l'URL",value:"Valeur",values:"Valeurs",warningApiAutocomplete:{response:"dois avoir comme réponse",url:"La route de l'API"},warningApiSelect:{response:"à l'emplacement de votre variable.",url:"Pour intégrer automatiquement la valeur du parent dans l'URL",warning:"placez {{}}"}},Ls={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"},Jp={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"}},Zp={add:"Ajouter",cancel:"Annuler",disabled:"Désactivé",edit:"Éditer",initialQueryEnable:"Activer un appel API intiale",isABranch:"Est une branche",isAHidden:"Est un champs caché",isALeaf:"Est une feuille",isARepeatable:"Est répétable",isATree:"Est un arbre",isTheRoot:"Est la racine",label:"Label",multiple:"Multiple",name:"Nom",parentRef:"Element parent",remove:"Supprimer",required:"Requis",save:"Enregistrer",show:"Afficher",tag:"Tag",type:"Type",validate:"Valider",value:"Valeur",values:"Valeurs"};qt.use(fi).use(Se.initReactI18next).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{useSuspense:!0},resources:{en:{button:qp,form:Rs,modal:Ls,snackMessage:Wp,translation:Gp},fr:{button:Kp,form:Rs,modal:Ls,snackMessage:Jp,translation:Zp}},returnNull:!1}).then(()=>{document.documentElement.lang!==qt.resolvedLanguage&&qt.resolvedLanguage&&document.documentElement.setAttribute("lang",qt.resolvedLanguage)}),qt.on("languageChanged",e=>{document.documentElement.setAttribute("lang",e)});const Xp=({initialTree:e,initialTreeId:t,backendConfig:n})=>(E.useLayoutEffect(()=>{Nt.defaults.baseURL=n==null?void 0:n.baseUrl,n!=null&&n.authToken&&(Nt.defaults.headers.common.Authorization=`Bearer ${n==null?void 0:n.authToken}`)},[n==null?void 0:n.authToken,n==null?void 0:n.baseUrl]),i.jsx(Et.QueryClientProvider,{client:Mi,children:i.jsx(ji,{authToken:n==null?void 0:n.authToken,children:i.jsx(Qp,{backendConfig:n,initialTree:e,initialTreeId:t,children:i.jsx(yi,{children:i.jsx(Oi,{children:i.jsx(Vp,{})})})})})}));ke.TreePlusIcon=wa,ke.Treege=Xp,Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -65,6 +65,12 @@ declare const fields: readonly [{
|
|
|
65
65
|
readonly isRepeatableDisabled: false;
|
|
66
66
|
readonly isRequiredDisabled: false;
|
|
67
67
|
readonly type: "time";
|
|
68
|
+
}, {
|
|
69
|
+
readonly isBooleanField: false;
|
|
70
|
+
readonly isDecisionField: false;
|
|
71
|
+
readonly isRepeatableDisabled: false;
|
|
72
|
+
readonly isRequiredDisabled: false;
|
|
73
|
+
readonly type: "timeRange";
|
|
68
74
|
}, {
|
|
69
75
|
readonly isBooleanField: true;
|
|
70
76
|
readonly isDecisionField: false;
|
|
@@ -66,6 +66,12 @@ declare const useFieldSelect: () => {
|
|
|
66
66
|
readonly isRepeatableDisabled: false;
|
|
67
67
|
readonly isRequiredDisabled: false;
|
|
68
68
|
readonly type: "time";
|
|
69
|
+
} | {
|
|
70
|
+
readonly isBooleanField: false;
|
|
71
|
+
readonly isDecisionField: false;
|
|
72
|
+
readonly isRepeatableDisabled: false;
|
|
73
|
+
readonly isRequiredDisabled: false;
|
|
74
|
+
readonly type: "timeRange";
|
|
69
75
|
} | {
|
|
70
76
|
readonly isBooleanField: true;
|
|
71
77
|
readonly isDecisionField: false;
|
package/dist/src/features/Treege/components/Forms/FormTreeCardMutation/useFormTreeCardMutation.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ declare const useFormTreeCardMutation: () => {
|
|
|
64
64
|
step: string;
|
|
65
65
|
tag: string | null;
|
|
66
66
|
treeSelected: string;
|
|
67
|
-
type: "number" | "text" | "address" | "select" | "time" | "switch" | "hidden" | "email" | "file" | "password" | "tel" | "url" | "date" | "dateRange" | "checkbox" | "tree" | "radio" | "autocomplete" | "dynamicSelect";
|
|
67
|
+
type: "number" | "text" | "address" | "select" | "time" | "switch" | "hidden" | "email" | "file" | "password" | "tel" | "url" | "date" | "dateRange" | "timeRange" | "checkbox" | "tree" | "radio" | "autocomplete" | "dynamicSelect";
|
|
68
68
|
uniqueNameErrorMessage: string;
|
|
69
69
|
values: {
|
|
70
70
|
id: string;
|
|
@@ -27,7 +27,7 @@ declare const appendNode: ({ tree, path, name, child }: AppendChildParams) => Tr
|
|
|
27
27
|
label: string;
|
|
28
28
|
required?: boolean | undefined;
|
|
29
29
|
step?: string | undefined;
|
|
30
|
-
type: "number" | "text" | "address" | "select" | "time" | "switch" | "hidden" | "email" | "file" | "password" | "tel" | "url" | "date" | "dateRange" | "checkbox" | "tree" | "radio" | "autocomplete" | "dynamicSelect";
|
|
30
|
+
type: "number" | "text" | "address" | "select" | "time" | "switch" | "hidden" | "email" | "file" | "password" | "tel" | "url" | "date" | "dateRange" | "timeRange" | "checkbox" | "tree" | "radio" | "autocomplete" | "dynamicSelect";
|
|
31
31
|
value?: undefined;
|
|
32
32
|
values?: import('../../../features/Treege/type/TreeNode').TreeValues[] | undefined;
|
|
33
33
|
message?: undefined;
|