@buildocsdev/sdk 1.1.33 → 1.1.35
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/dist/{chunk-J24USUXK.js → chunk-L7HDEIGD.js} +1 -1
- package/dist/{chunk-3NYC3B7A.js → chunk-QQLP2GBO.js} +3 -3
- package/dist/form.css +1 -1
- package/dist/form.js +1 -1
- package/dist/{formeditor-G6KCPAWI.js → formeditor-3WG3WSUE.js} +1 -1
- package/dist/formeditor-DABXNXPF.css +1 -0
- package/dist/formeditor.css +1 -1
- package/dist/formeditor.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/ui/css/formeditor.css +1 -1
- package/package.json +1 -1
- package/dist/formeditor-PPMTEFD7.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-POE6K4NQ.js';import {g,i as i$1,l as l$1,k as k$1,d}from'./chunk-3UNAMWG4.js';import {b as b$1,f,e as e$1,g as g$2}from'./chunk-FRAOYRZD.js';import {b as b$2,a as a$3}from'./chunk-22LEYH6Q.js';import {y,z,B,T,U,x,A,k as k$2}from'./chunk-TYVVEP34.js';import {b}from'./chunk-LBMVBVXW.js';import {n,e,k,l,p,o,f as f$1,g as g$1,h,m as m$1}from'./chunk-PN26J77S.js';import {i,m,P,t,A as A$1,E,N,s}from'./chunk-AR42AC7J.js';import {a as a$2}from'./chunk-SDIZEEZP.js';import {a,c}from'./chunk-5TBO732O.js';import*as Pe from'react';import Pe__default,{memo,useRef,useState,useEffect,createElement,createContext,lazy,useCallback,startTransition,Suspense,useContext,useMemo}from'react';import {withTranslation,useTranslation}from'react-i18next';import {useLocation,useNavigate}from'react-router-dom';import {nanoid}from'@reduxjs/toolkit';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Qa from'@mui/material/Box';import Xr from'@mui/material/Button';import Yr from'@mui/material/Tooltip';import Vi from'axios';import $i from'@mui/material/CircularProgress';import qi from'@mui/material/LinearProgress';import lr from'@mui/material/IconButton';import Ll from'@mui/material/InputAdornment';import Al from'@mui/icons-material/Visibility';import Vl from'@mui/icons-material/VisibilityOff';import {animated,useSpring}from'@react-spring/web';import {styled,alpha}from'@mui/material/styles';import Ul from'@mui/material/Collapse';import Gl from'@mui/material/Typography';import zl from'@mui/icons-material/FolderRounded';import {RichTreeView}from'@mui/x-tree-view/RichTreeView';import {treeItemClasses}from'@mui/x-tree-view/TreeItem';import {unstable_useTreeItem2}from'@mui/x-tree-view/useTreeItem2';import {TreeItem2Root,TreeItem2Content,TreeItem2IconContainer,TreeItem2Checkbox,TreeItem2Label}from'@mui/x-tree-view/TreeItem2';import {TreeItem2Icon}from'@mui/x-tree-view/TreeItem2Icon';import {TreeItem2DragAndDropOverlay}from'@mui/x-tree-view/TreeItem2DragAndDropOverlay';import yt from'@mui/material/ListItemIcon';import wt from'@mui/material/ListItemText';import Zl from'@mui/material/Menu';import xt from'@mui/material/MenuItem';import Fd from'i18next';import vd from'@mui/material/Backdrop';var Vn=a((Ue,An)=>{Object.defineProperty(Ue,"__esModule",{value:true});function Ae(t){return typeof t=="object"&&!("toString"in t)?Object.prototype.toString.call(t).slice(8,-1):t}var Cr=typeof process=="object"&&true;function _e(t,e){if(!t)throw Cr?new Error("Invariant failed"):new Error(e())}Ue.invariant=_e;var Bt=Object.prototype.hasOwnProperty,Ir=Array.prototype.splice,Fr=Object.prototype.toString;function Ze(t){return Fr.call(t).slice(8,-1)}var bt=Object.assign||(function(t,e){return Nt(e).forEach(function(o){Bt.call(e,o)&&(t[o]=e[o]);}),t}),Nt=typeof Object.getOwnPropertySymbols=="function"?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.keys(t)};function je(t){return Array.isArray(t)?bt(t.constructor(t.length),t):Ze(t)==="Map"?new Map(t):Ze(t)==="Set"?new Set(t):t&&typeof t=="object"?bt(Object.create(Object.getPrototypeOf(t)),t):t}var _n=(function(){function t(){this.commands=bt({},Tr),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,o){return e===o},this.update.newContext=function(){return new t().update};}return Object.defineProperty(t.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(e){this.update.isEquals=e;},enumerable:true,configurable:true}),t.prototype.extend=function(e,o){this.commands[e]=o;},t.prototype.update=function(e,o){var i=this,a=typeof o=="function"?{$apply:o}:o;Array.isArray(e)&&Array.isArray(a)||_e(!Array.isArray(a),function(){return "update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),_e(typeof a=="object"&&a!==null,function(){return "update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(i.commands).join(", ")+".")});var d=e;return Nt(a).forEach(function(r){if(Bt.call(i.commands,r)){var m=e===d;d=i.commands[r](a[r],d,a,e),m&&i.isEquals(d,e)&&(d=e);}else {var s=Ze(e)==="Map"?i.update(e.get(r),a[r]):i.update(e[r],a[r]),c=Ze(d)==="Map"?d.get(r):d[r];(!i.isEquals(s,c)||typeof s=="undefined"&&!Bt.call(e,r))&&(d===e&&(d=je(e)),Ze(d)==="Map"?d.set(r,s):d[r]=s);}}),d},t})();Ue.Context=_n;var Tr={$push:function(t,e,o){return Bn(e,o,"$push"),t.length?e.concat(t):e},$unshift:function(t,e,o){return Bn(e,o,"$unshift"),t.length?t.concat(e):e},$splice:function(t,e,o,i){return Dr(e,o),t.forEach(function(a){Ln(a),e===i&&a.length&&(e=je(i)),Ir.apply(e,a);}),e},$set:function(t,e,o){return Rr(o),t},$toggle:function(t,e){dt(t,"$toggle");var o=t.length?je(e):e;return t.forEach(function(i){o[i]=!e[i];}),o},$unset:function(t,e,o,i){return dt(t,"$unset"),t.forEach(function(a){Object.hasOwnProperty.call(e,a)&&(e===i&&(e=je(i)),delete e[a]);}),e},$add:function(t,e,o,i){return Nn(e,"$add"),dt(t,"$add"),Ze(e)==="Map"?t.forEach(function(a){var d=a[0],r=a[1];e===i&&e.get(d)!==r&&(e=je(i)),e.set(d,r);}):t.forEach(function(a){e===i&&!e.has(a)&&(e=je(i)),e.add(a);}),e},$remove:function(t,e,o,i){return Nn(e,"$remove"),dt(t,"$remove"),t.forEach(function(a){e===i&&e.has(a)&&(e=je(i)),e.delete(a);}),e},$merge:function(t,e,o,i){return Sr(e,t),Nt(t).forEach(function(a){t[a]!==e[a]&&(e===i&&(e=je(i)),e[a]=t[a]);}),e},$apply:function(t,e){return Pr(t),t(e)}},_t=new _n;Ue.isEquals=_t.update.isEquals;Ue.extend=_t.extend;Ue.default=_t.update;Ue.default.default=An.exports=bt(Ue.default,Ue);function Bn(t,e,o){_e(Array.isArray(t),function(){return "update(): expected target of "+Ae(o)+" to be an array; got "+Ae(t)+"."}),dt(e[o],o);}function dt(t,e){_e(Array.isArray(t),function(){return "update(): expected spec of "+Ae(e)+" to be an array; got "+Ae(t)+". Did you forget to wrap your parameter in an array?"});}function Dr(t,e){_e(Array.isArray(t),function(){return "Expected $splice target to be an array; got "+Ae(t)}),Ln(e.$splice);}function Ln(t){_e(Array.isArray(t),function(){return "update(): expected spec of $splice to be an array of arrays; got "+Ae(t)+". Did you forget to wrap your parameters in an array?"});}function Pr(t){_e(typeof t=="function",function(){return "update(): expected spec of $apply to be a function; got "+Ae(t)+"."});}function Rr(t){_e(Object.keys(t).length===1,function(){return "Cannot have more than one key in an object with $set"});}function Sr(t,e){_e(e&&typeof e=="object",function(){return "update(): $merge expects a spec of type 'object'; got "+Ae(e)}),_e(t&&typeof t=="object",function(){return "update(): $merge expects a target of type 'object'; got "+Ae(t)});}function Nn(t,e){var o=Ze(t);_e(o==="Map"||o==="Set",function(){return "update(): "+Ae(e)+" expects a target of type Set or Map; got "+Ae(o)});}});var mr=c(Vn());var Wn=withTranslation()(memo(function(e){let{id:o,tabId:i,panelId:a,context:d,methodProvider:r,widgetsState:m}=e,s=r.findRowItem(i,a,o);return s?Pe__default.createElement("div",{className:"row-container"},(s.item._children||[]).map(({rowId:c,id:b,component:T,properties:p})=>Pe__default.createElement(Ve.getFormComponent(T,p),{key:"key_"+b,tabId:i,panelId:a,rowId:c,segmentId:b,properties:p,widgetsState:m,methodProvider:r,context:{...d},segmentsCount:s.item._children.length},null))):null}));Wn.displayName="_Rowcontainer";var Hn=Wn;var Gn=withTranslation()(memo(function(e){let{tabId:o,panelId:i,rowId:a,segmentId:d,segmentsCount:r,properties:m,methodProvider:s,context:c,widgetsState:b}=e,T=s.findSegmentItem(o,i,a,d),p={...m.style};return Pe__default.createElement("div",{className:"rowSegment",style:p},(T.item._children||[]).map(({id:f,component:u,properties:g})=>{let v=g.groupname?g.groupname:g.name;return Pe__default.createElement(Ve.getFormComponent(u,g),{key:"key_"+f,context:{params:c.params,displayButtonLoader:c.displayButtonLoader,doValidateForm:c.doValidateForm,redrawComponent:c.redrawComponent,formDimension:c.formDimension,segmentDimensions:{minWidth:parseInt(p.minWidth)},tabIndex:c.tabIndex,formData:u.displayName==="_Fileuploader"||u.displayName==="_Label"||u.displayName==="_View"||u.displayName==="_Textinput"&&g.inputtype==="currency"?c.formData:[]},id:f,methodProvider:s,panelId:i,properties:{...g,visible:b!==void 0&&b.visibility[v]!==void 0?b.visibility[v]:g.visible,readonly:b!==void 0&&b.readonly[v]!==void 0?b.readonly[v]:g.readonly},rowId:a,segmentId:d,segmentsCount:r,tabId:o,value:c.formData!==void 0?c.formData[v]:void 0,fieldAllowedValues:c!=null&&c.fieldAllowedValues?c.fieldAllowedValues[v]:void 0,validationMessage:c!=null&&c.formValidationData&&c.formValidationData[v]!==void 0?c.formValidationData[v]:null},null)}))}));Gn.displayName="_Rowsegment";var zn=Gn;function Hr(t,e){return {id:t,value:e}}var qn=withTranslation()(memo(function(e){var A;let o=useRef(null),{datalength:i,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:b$1,readonly:T$1,regex:p,searchbar:f,size:u,style:g,tabIndex:v,uppercasemode:w,variant:S,visible:x}=e.properties,E=useLocation(),{viewPort:W}=b(),{tabId:_}=e,[I,F]=useState(String((A=e.value)!=null?A:"")),[h,$]=Pe__default.useState([]),ee=!!(I.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var P;F(String((P=e.value)!=null?P:""));},[e.value]),useEffect(()=>{let P=[];if(e.fieldAllowedValues){for(let H in e.fieldAllowedValues)P.push(Hr(H,e.fieldAllowedValues[H]));$(P);}},[e.fieldAllowedValues]);let ne=P=>{var H;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:P,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:_,hasParentForm:T.hasParentForm(),originator:(H=e.context.params)==null?void 0:H.originator})});},D=P=>{F(P);};return jsx(n,{autoFocus:false,data:h,disabled:!!(T$1&&!r),error:ee,helperText:ee?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:v,style:{...g},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:i,name:s,onBlur:P=>{ne(P.target.value);},onInput:P=>{D(P.target.value),W.isMobileDevice&&ne(P.currentTarget.value);},onChange:P=>{I.trim()===""&&ne(P.target.value);},placeholder:b$1,readOnly:!!(T$1&&!r),regEx:p,searchBar:f,size:u!=null?u:"small",type:"text",inputtype:e.properties.inputType,toUpperCase:w,value:I,variant:S,visible:x})}));qn.displayName="_Input";var Jn=qn;var Qn=withTranslation()(memo(function(e){var P;let o=useRef(null),{datalength:i$1,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:b$1,readonly:T$1,regex:p,size:f,style:u,tabIndex:g,uppercasemode:v,variant:w,visible:S}=e.properties,x=useLocation(),{viewPort:E}=b(),{tabId:W}=e,[_,I]=useState(String((P=e.value)!=null?P:"")),F=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),[h,$]=useState(false),{t:ee}=useTranslation(),ne=()=>{navigator.clipboard.writeText(_).then(()=>{$(true),setTimeout(()=>$(false),2e4);});};useEffect(()=>{var H;I(String((H=e.value)!=null?H:""));},[e.value]);let D=H=>{var K;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:H,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:x.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(K=e.context.params)==null?void 0:K.originator})});},A=H=>{I(H);};return jsxs(Qa,{display:"flex",alignItems:"flex-start",gap:0,children:[jsx(n,{autoFocus:false,disabled:!!(T$1&&!r),error:F,helperText:F?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:g,style:{...u},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:i$1,name:s,onBlur:H=>{D(H.target.value);},onInput:H=>{A(H.target.value),E.isMobileDevice&&D(H.currentTarget.value);},onChange:H=>{_.trim()===""&&D(H.target.value);},placeholder:b$1,readOnly:!!(T$1&&!r),regEx:p,size:f,type:"text",inputtype:e.properties.inputType,toUpperCase:v,value:_,variant:w,visible:S}),S&&jsx(Yr,{title:ee(h?"copied!":"copy to clipboard"),children:jsx(Xr,{variant:"contained",style:{backgroundColor:"#C0C0C0",borderRadius:"0px 4px 4px 0px",boxShadow:"none",marginLeft:"-3px",border:"2px solid #C0C0C0",lineHeight:"24px",fontSize:"11px"},onClick:ne,startIcon:jsx(i,{}),children:ee("copy")})})]})}));Qn.displayName="_InputWCopy";var Kn=Qn;var Yn=withTranslation()(memo(function(e){useRef(null);let {tabId:i,id:a,context:d,widgetsState:r}=e,m=e.methodProvider.findWidgetItem(a),s=e.methodProvider.getActiveTabIndex(i,a),c=(p,f,u,g)=>{f||(p.target.style.background=g,p.target.style.color=u);},b=(p,f,u,g)=>{f||(p.target.style.background=g,p.target.style.color=u);},T=({children:p,...f})=>jsx(A,{onPointerUp:u=>u.stopPropagation(),onMouseOver:u=>c(u,f.selected,f.item_active_color,f.item_active_background_color),onMouseOut:u=>b(u,f.selected,f.item_default_color,f.item_default_background_color),style:{borderRadius:"5px 5px 0 0",marginRight:"1px",color:f.selected?f.item_active_color:f.item_default_color,background:f.selected?f.item_active_background_color:f.item_default_background_color,fontSize:f.item_fontsize,fontWeight:f.item_fontweight},selected:f.selected,children:p},f.id);return T.tabsRole="Tab",e.properties.visible?Pe__default.createElement("div",{className:"form-tab-widget"},jsxs(y,{selectedIndex:s,onSelect:p=>e.methodProvider.setActiveTabIndex(i,a,p),children:[jsx(z,{children:(m.item._children||[]).map(({properties:p},f)=>!p.item_visible||r&&r.visibility&&r.visibility[p.item_name]===false?null:createElement(T,{...m.item.properties.tabsetup,...p,key:"TabCaptionComponent_"+a+"_"+f},p.item_title))}),(m.item._children||[]).map(({_children:p},f)=>jsx(B,{children:(p||[]).map(({tabId:u,panelId:g,id:v,type:w,component:S,properties:x},E)=>Pe__default.createElement(Ve.getFormComponent(S,x),{key:"tabSubPanel_"+E,id:v,tabId:u,panelId:g,properties:{...x,visible:r!==void 0&&r.visibility[x.name]!==void 0?r.visibility[x.name]:x.visible,readonly:r!==void 0&&r.readonly[x.name]!==void 0?r.readonly[x.name]:x.readonly},className:w,widgetsState:r,methodProvider:e.methodProvider,context:{...d},segmentsCount:m.item._children.length,fieldAllowedValues:d!=null&&d.fieldAllowedValues?d.fieldAllowedValues[x.name]:void 0},null))},"TabPanel_"+a+"_"+f))]})):null}));Yn.displayName="_TabBox";var Zn=Yn;function li(t,e){if(!e||Array.isArray(e)&&e.length===0)return t;let o=e;return t.replace(/<b>@(\w+)<\/b>|@(\w+)/g,(i,a,d)=>{let r=(a||d).toLowerCase(),m=o[r];return typeof m=="string"?a?`<b>${m}</b>`:m:i})}var ta=withTranslation()(memo(function(e){let{title:o,style:i,verticalalign:a,visible:d}=e.properties,r={paddingTop:"0px"};if(a==="bottom"&&(r.paddingTop="10px"),!d)return null;let m=li(o,e.context.formData);return jsx("div",{style:{...i,...r},children:jsx("div",{style:{...i},dangerouslySetInnerHTML:{__html:m}})})}));ta.displayName="_Label";var oa=ta;var aa=withTranslation()(memo(function(e$1){let o=useRef(null),{defaultvalue:i,id:a,ignorereadonly:d,label:r,labelplacement:m,name:s,onchangehandler:c,readonly:b,style:T$1,tabIndex:p,visible:f}=e$1.properties,u=s,g=e$1.value||"",v=useLocation(),{tabId:w}=e$1,S=!!(!g&&e$1.validationMessage!=null&&e$1.context.doValidateForm);return useEffect(()=>{!e$1.value&&i&&e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:e$1.properties.value,widgetEvent:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:w,hasParentForm:T.hasParentForm()})});},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:T$1.textAlign,height:"100%"},children:jsx(e,{checkedIcon:void 0,defaultChecked:!!(e$1.value===void 0&&i),disabled:!!(b&&!d),error:S,helperText:S?e$1.validationMessage:"",icon:void 0,inputProps:{id:a,tabIndex:p},inputRef:o,labelText:r,labelPlacement:m,name:u,onChange:x=>{e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:x.target.checked?e$1.properties.value:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:w,hasParentForm:T.hasParentForm()})});},selectedValue:g,value:e$1.properties.value,visible:f})})}));aa.displayName="_Checkbox";var ra=aa;var la=withTranslation()(memo(function(e){let o=useRef(null),{defaultvalue:i,groupname:a,id:d,ignorereadonly:r,label:m,labelplacement:s,name:c,onchangehandler:b,readonly:T$1,style:p,tabIndex:f,visible:u}=e.properties,g=useLocation(),{tabId:v}=e,w=a||c;let x=e.value||"",E=!!(e.validationMessage!=null&&e.context.doValidateForm),W=_=>{var I;e.methodProvider.eventDispatcher({widgetName:w,widgetValue:_,widgetEvent:b?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(I=e.context.params)==null?void 0:I.originator})});};return useEffect(()=>{!x&&i&&W(e.properties.value);},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:p.textAlign,height:"100%"},children:jsx(k,{defaultValue:i?e.properties.value:"",disabled:!!(T$1&&!r),inputProps:{id:d,tabIndex:f,style:{...p}},error:E,helperText:E?e.validationMessage:"",inputRef:o,labelText:m,labelPlacement:s,name:w,onChange:_=>{x!==_.target.value.trim()&&W(_.target.value);},selectedValue:x,value:e.properties.value,visible:u})})}));la.displayName="_Radio";var da=la;var sa=withTranslation()(memo(function(e){var ne;let o=useRef(null),{runFormEvent:i,viewPort:a}=b(),{id:d,autocompleteTextArea:r,ignorereadonly:m,label:s,name:c,onchangehandler:b$1,placeholder:T$1,required:p,requiredmessage:f,readonly:u,size:g,style:v,tabIndex:w,variant:S,visible:x}=e.properties,E=useLocation(),{tabId:W}=e,[_,I]=useState(String((ne=e.value)!=null?ne:""));useEffect(()=>{var D;I(String((D=e.value)!=null?D:""));},[e.value]);let F=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),h=D=>{var A;e.methodProvider.eventDispatcher({widgetName:c,widgetValue:D,widgetEvent:b$1?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(A=e.context.params)==null?void 0:A.originator})});},$=async D=>{var A,P,H;try{let K=await i({pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,projectGuid:e.context.params.pGuid,pGuid:e.context.params.pGuid,formData:(A=e.context.formData)!=null?A:{},widgetContext:JSON.stringify({}),widgetEvent:U.onGetCustomResponse,widgetName:c,widgetValue:JSON.stringify({methodName:"getAutoCompleteData",value:D})});if(((P=K.meta)==null?void 0:P.requestStatus)==="fulfilled"){let N=K.payload,k=(H=N==null?void 0:N.FECommand)==null?void 0:H.CustomResponse;if(Array.isArray(k))return k.filter(J=>typeof J=="string").map(J=>({label:J}))}}catch(K){}return []},ee=D=>{I(D);};return jsx(n,{autocompleteTextArea:r,autoFocus:false,disabled:!!(u&&!m),id:d,inputProps:{id:d,tabIndex:w,readOnly:!!(u&&!m),style:{...v}},error:F,helperText:F?e.validationMessage:"",InputProps:{},inputRef:o,label:s,multiline:true,name:c,onAutoCompleteChange:r?D=>$(D):void 0,onBlur:D=>{h(D.target.value);},onInput:D=>{ee(D.target.value),a.isMobileDevice&&h(D.currentTarget.value);},onChange:D=>{_.trim()===""&&h(D.target.value);},placeholder:T$1,readOnly:!!(u&&!m),size:g,type:"text",value:_,variant:S,visible:x})}));sa.displayName="_Textarea";var ma=sa;function ca(t,e){return {id:t,value:e}}var Ot="\xA4",ua=withTranslation()(memo(function(e){var P,H;let o=useRef(null),[i,a]=Pe__default.useState(null),[d,r]=Pe__default.useState([]),m=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ot):[],[s,c]=Pe__default.useState(m),{id:b,ignorereadonly:T$1,label:p,multiple:f,name:u,onchangehandler:g,placeholder:v,readonly:w,rendertype:S,searchbar:x,size:E,tabIndex:W,variant:_,visible:I,dropvalues:F}=e.properties,h=useLocation(),{tabId:$}=e,{t:ee}=useTranslation();useEffect(()=>{let K=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ot):[];c(K);},[e.value]),useEffect(()=>{let K=S==="none"?[{id:"",value:""}]:[];if(e.fieldAllowedValues&&Object.keys(e.fieldAllowedValues).length>0){for(let N in e.fieldAllowedValues)K.push(ca(N,e.fieldAllowedValues[N]));r(K);}else if(F&&Array.isArray(F)&&F.length>0){for(let N of F)typeof N=="object"&&N!==null&&K.push(ca(N.id||"",N.value||""));r(K);}},[e.fieldAllowedValues,F]),useEffect(()=>{var K;if(i===false){let N=typeof e.value!="string"?e.value:[];(JSON.stringify(N)!==JSON.stringify(s)||s.length===0)&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:s.length>0?s.join(Ot):[],widgetEvent:g?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:$,hasParentForm:T.hasParentForm(),originator:(K=e.context.params)==null?void 0:K.originator,folderData:e.context.params.folderData})});}},[i]);let ne=K=>{let{target:{value:N}}=K,k;f?k=typeof N=="string"?N.split(","):N:k=typeof N=="string"?[N]:N,c(k);},D=e.context.formDimension.width/e.segmentsCount;D=D<e.context.segmentDimensions.minWidth?e.context.segmentDimensions.minWidth:D-60;let A=!!(s.length===0&&e.validationMessage!=null&&e.context.doValidateForm);return jsx(l,{darkMode:false,data:d,error:A,helperText:A?e.validationMessage:"",inputProps:{tabIndex:W,style:{maxWidth:`${D}px`}},inputRef:o,onOpen:()=>{a(true);},onClose:()=>{a(false);},onChange:ne,id:b,label:p,multiple:f,placeholder:v,readOnly:w&&!T$1,renderType:S,noOptionsText:(H=(P=e.properties)==null?void 0:P.noOptionsLabel)!=null?H:ee("No options"),searchBar:x,selectDisplayProps:{style:{maxWidth:"100%",whiteSpace:S==="chip"?"normal":"nowrap"}},selectedValue:s,size:E,variant:_,width:"auto",visible:I})}));ua.displayName="_SelectBox";var fa=ua;var pa=withTranslation()(memo(function(e){var m;let{style:o,visible:i}=(m=e.properties)!=null?m:{},[a,d]=useState(false);if(useEffect(()=>{d(true);},[]),!a)return null;let r="form-widget form-placeholder-widget";return i||(r+=" visibilityOff"),jsx("div",{className:r,style:{...o,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"}})}));pa.displayName="_Placeholder";var ga=pa;var ha=createContext({});function ba(){return useContext(ha)}var va=ha;var Ji=lazy(()=>import('./fileviewer-YMKT5J4T.js'));function ji(){let[,t]=useState(0);return ()=>t(e=>e+1)}var Ca=withTranslation()(memo(function(e){var Ce,ge;ji();let [i,a]=useState([]),[d,r]=useState(e.context.params),[m,s]=useState(false),[c,b$3]=useState(null),[T$1,p$1]=useState(false),[f$1,u]=useState(null),[g$1,v]=useState(0),{t:w}=useTranslation(),{iframeMode:S}=g(),x=ba(),E=Y=>{var G;return (G=x[Y])!=null?G:w(Y)},{UserDialog:W}=b$1(),_=f(),{style:I,readonly:F,visible:h}=e.properties,[$,ee]=useState({showDialog:false,dialogTitle:"",dialogContent:"",buttonAgree:"",buttonDisagree:"",callBackFunc:()=>{}}),{appSettings:ne,viewPort:D,runFormDeleteFileEvent:A,runFormDownloadFileEvent:P,runFormGetLinkedFileEvent:H,runFormGetLinkedFileMetaEvent:K,runFormUploadFiles:N}=b();useEffect(()=>{r(e.context.params);},[e.context.params]),useEffect(()=>{let Y=e.value?JSON.parse(e.value):[];return Y&&(a(k(Y,100)),s(true)),()=>{i&&(s(false),i.forEach(G=>{G.preview&&URL.revokeObjectURL(G.preview);}));}},[]);let k=(Y,G)=>{let M=[];return Y.forEach((te,O)=>{let n=new File([],te,{type:"image/jpeg"});Object.assign(n,{preview:null,uploadProgress:G}),M.push(n);}),M},J=useCallback(async Y=>{var U;let M=(await K({...d,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:Y,context:{action:"Preview"}})).payload,{linkedFileSize:te,linkedFileName:O,mimeType:n}=M;if(!te)throw new Error("File data or metadata is missing");let oe=(U=ne==null?void 0:ne.MAX_DOWNLOAD_NOCHUNK_FILESIZE)!=null?U:b$2.MAX_DOWNLOAD_NOCHUNK_FILESIZE;return te>oe?{type:"formbuilder/getlinkedfile",payload:{linkedFile:null,linkedFileSize:te,linkedFileName:O},meta:{requestStatus:"fulfilled"}}:await H({...d,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:Y,context:{action:"Load"}})},[d,e.context.params.pGuid,e.properties.name]),ie=Y=>{$.callBackFunc(Y);},pe=async(Y,G)=>{Y&&await A({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:G}).then(M=>{if(M.meta.requestStatus==="fulfilled"){let te={...M.payload};te.linkedFileDeleteSuccess&&(_({toastID:nanoid(11),msg:E("The file has been successfully deleted"),clearQueue:false,hideProgressBar:false}),a(O=>O.filter(n=>n.name!==G)),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(te.linkedFiles),widgetEvent:null,widgetContext:null}));}}),ee({...$,showDialog:false,callBackFunc:M=>{}});},xe=async Y=>{if(Y)try{let G=await P({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:Y}),M=new Blob([G]),te=window.URL.createObjectURL(M),O=document.createElement("a");O.href=te,O.setAttribute("download",Y.split("/").pop()||"downloadedFile"),document.body.appendChild(O),O.click(),document.body.removeChild(O),window.URL.revokeObjectURL(te);}catch(G){}},de=useCallback(async(Y,G)=>(G&&ee({showDialog:true,dialogTitle:E("Confirmation"),dialogContent:E("Are you sure you want to delete file?"),buttonAgree:E("Continue"),buttonDisagree:E("Close"),callBackFunc:M=>pe(M,G)}),null),[e.context.params,w]),V=useCallback(async(Y,G)=>(G&&xe(G),null),[e.context.params]),ce=useCallback((Y,G)=>{G&&startTransition(()=>{b$3(G);});},[]),X=()=>{b$3(null);},ue=useCallback(async(Y,G)=>{var M,te;if(Y){let O=new FormData;for(let U in e.context.params)e.context.params.hasOwnProperty(U)&&O.append(U,e.context.params[U]);O.append("fieldName",e.properties.name),Y.forEach(U=>{O.append("files",U);}),O.append("widgetContext",JSON.stringify({hasParentForm:T.hasParentForm(),originator:(M=e.context.params)==null?void 0:M.originator,folderData:(te=e.context.params)==null?void 0:te.folderData})),O.append("widgetEvent",U.onFileUploadEvent),O.append("widgetName",e.properties.name),O.append("formData",JSON.stringify({...e.context.formData}));let n=Vi.CancelToken.source(),oe=Y.map(U=>Object.assign(U,{preview:URL.createObjectURL(U),uploadProgress:0}));a(i.concat(oe)),u(0),await N({content:O,cancelTokenSource:n,onUploadProgress:U=>{let ke=U.total?Math.round(U.loaded*100/U.total):0;u(ke);}}).then(U=>{var ze,$e,Ke;let ke=[];if(U.meta.requestStatus==="fulfilled"){let ve={...U.payload};if((ze=ve.FECommand)!=null&&ze.FormValidationData&&Object.keys(ve.FECommand.FormValidationData).length>0){oe.forEach(Ie=>{Ie.preview&&URL.revokeObjectURL(Ie.preview);}),u(null),v(Ie=>Ie+1);let rt=i.filter(Ie=>Ie.uploadProgress===100);a(rt),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(i),widgetEvent:null,widgetContext:null,feCommand:ve.FECommand});}else if(ve.linkedFiles&&e.properties.name){ke=k(ve.linkedFiles,100);let rt=ke.map(Ie=>{let it=Ie;return it.uploadProgress=100,it.preview=null,it});oe.forEach(Ie=>{Ie.preview&&URL.revokeObjectURL(Ie.preview);}),u(null),v(Ie=>Ie+1),a(rt),r({...e.context.params,guid:(Ke=($e=ve.FECommand)==null?void 0:$e.ReplaceContextRecordGuid)==null?void 0:Ke.guid}),ve.FECommand={...ve.FECommand,UpdateFieldAllowedValues:ve.fieldAllowedValues,UpdateFormData:ve.data},e.methodProvider.execCommands(ve.FECommand);}}});}},[i,e.context.params,e.methodProvider,e.properties.name,e.value]);return !m||!h?null:jsxs("div",{style:{...I,lineHeight:"1.1em"},children:[jsx(W,{...$,handleDialogClose:ie}),jsxs("div",{style:{position:"relative",zIndex:1,isolation:"isolate"},children:[S&&jsx("div",{style:{position:"absolute",inset:0,zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.85)",borderRadius:4,padding:"8px 16px",textAlign:"center",fontSize:"0.875rem",color:"#555"},children:w("File upload is available only when using the SDK")}),jsx(p,{defaultText:(ge=(Ce=e.properties)==null?void 0:Ce.dragDropLabel)!=null?ge:E("Drag and Drop..."),tryGetLinkedFile:J,onDeleteButtonPress:de,onDownloadButtonPress:V,onDownloadText:E("Download"),onDeleteText:E("Delete"),filesData:i,onDragText:"On drop text",onFilesDrop:ue,onPreviewButtonPress:ce,isMobileDevice:D.isMobileDevice,isReadonly:F},g$1),f$1!==null&&jsx(qi,{variant:"determinate",value:f$1,style:{marginTop:6,borderRadius:3,height:8}})]}),c!=null&&jsx(Suspense,{fallback:jsx($i,{}),children:jsx(Ji,{fileId:c,fileBase64:null,fieldName:e.properties.name,params:{...e.context.params,modalCloseFn:X}},nanoid(11))})]})}));Ca.displayName="_Fileuploader";var Ia=Ca;var Fa=(t,e)=>"#"+t.replace(/^#/,"").replace(/../g,o=>("0"+Math.min(255,Math.max(0,parseInt(o,16)+e)).toString(16)).substring(-2)),Da=withTranslation()(memo(function(e){var w,S;let{buttontype:o$1,colorSchema:i,fullWidth:a,name:d,style:r,tabIndex:m,title:s,variant:c,visible:b}=e.properties,T$1=useLocation(),{tabId:p}=e,f=(S=(w=e.context)==null?void 0:w.displayButtonLoader)!=null?S:false;if(!b)return null;let u=r.backgroundColor,g=u?Fa(u,-50):"";i&&(u=i+".main",g=i+".hover");let v={};return c==="outlined"?(Object.assign(v,{"&.MuiButtonBase-root":{fontSize:r.fontSize,fontWeight:r.fontWeight,border:"1px solid"+u,cursor:"pointer"}}),Object.assign(v,{"&.MuiButtonBase-root:hover":{border:g?"1px solid"+Fa(g,-50):""}})):(Object.assign(v,{"&.MuiButtonBase-root":{fontSize:r.fontSize,fontWeight:r.fontWeight,backgroundColor:u,cursor:"pointer"}}),Object.assign(v,{"&.MuiButtonBase-root:hover":{backgroundColor:g}})),jsx("div",{children:jsx(o,{variant:c,label:s,loading:f,onPointerUp:()=>{var x,E;e.methodProvider.eventDispatcher({widgetName:d,widgetValue:null,widgetEvent:U.getFormButtonEvent(o$1),widgetContext:JSON.stringify({referer:T$1.pathname,parentWidgetId:p,hasParentForm:T.hasParentForm(),originator:(x=e.context.params)==null?void 0:x.originator,parent:{widgetName:d,params:{pGuid:e.context.params.pGuid,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid}},folderData:(E=e.context.params)==null?void 0:E.folderData})});},fullWidth:a,sx:v,tabIndex:m})})}));Da.displayName="_Button";var Pa=Da;var Ra=withTranslation()(memo(function(e){var E,W,_;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:b,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:v}=e,w=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),S=I=>{var F;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:I!=null?I:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(F=e.context.params)==null?void 0:F.originator})})};useEffect(()=>{!e.value&&d==="today"&&S(a$1().utc().format());},[]);let x=(W=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:W.substr(0,2);return jsx(f$1,{id:i,defaultvalue:d,disabled:!!(b&&!a),error:w,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:w?e.validationMessage:"",inputRef:o,label:m,locale:x,name:s,onBlur:I=>{S(I?a$1(I).utc().format():null);},size:T$1,type:"datepicker",value:(_=e.value)!=null?_:"",variant:f,visible:u})}));Ra.displayName="_Textinput";var Sa=Ra;var ka=withTranslation()(memo(function(e){var _,I,F;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:b,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:v}=e,[w,S]=useState(String((_=e.value)!=null?_:"")),x=!!(!w&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var h;S(String((h=e.value)!=null?h:""));},[e.value]);let E=h=>{var $;return S(h),e.methodProvider.eventDispatcher({widgetName:s,widgetValue:h!=null?h:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:($=e.context.params)==null?void 0:$.originator})})};useEffect(()=>{if(!e.value&&d){let h=d==="now"?a$1().utc().format():d==="start of day"?a$1().startOf("day").utc().format():null;h&&E(h);}},[]);let W=(F=(I=e==null?void 0:e.i18n)==null?void 0:I.language)==null?void 0:F.substr(0,2);return jsx(g$1,{autoFocus:false,defaultvalue:d,disabled:!!(b&&!a),error:x,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:x?e.validationMessage:"",id:i,inputRef:o,label:m,locale:W,name:s,onChange:h=>{E(h?a$1(h).utc().format():null);},size:T$1,value:w,variant:f,visible:u})}));ka.displayName="_Textinput";var Ma=ka;var Ba=withTranslation()(memo(function(e){var E,W,_;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:b,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:v}=e,w=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),S=I=>{var F;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:I!=null?I:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(F=e.context.params)==null?void 0:F.originator})})};useEffect(()=>{!e.value&&d==="now"&&S(a$1().utc().format());},[]);let x=(W=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:W.substr(0,2);return jsx(h,{id:i,defaultvalue:d,disabled:!!(b&&!a),error:w,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:w?e.validationMessage:"",inputRef:o,label:m,locale:x,name:s,onBlur:I=>{S(I?a$1(I).utc().format():null);},size:T$1,type:"datetimepicker",value:(_=e.value)!=null?_:"",variant:f,visible:u})}));Ba.displayName="_Textinput";var Na=Ba;var _a=withTranslation()(memo(function(e){var D;let o=useRef(null),{datalength:i,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:b$1,phoneformat:T$1,readonly:p,regex:f,size:u,style:g,tabIndex:v,uppercasemode:w,variant:S,visible:x}=e.properties,E=useLocation(),{i18n:W}=useTranslation(),{viewPort:_}=b(),{tabId:I}=e,[F,h]=useState(String((D=e.value)!=null?D:"")),$=!!(e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{e.value!==void 0&&e.value!==null&&h(String(e.value));},[e.value]);let ee=A=>{var P;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:A,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:I,hasParentForm:T.hasParentForm(),originator:(P=e.context.params)==null?void 0:P.originator})});},ne=A=>{h(A);};return jsx(n,{autoFocus:false,disabled:!!(p&&!r),error:$,helperText:$?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:v,style:{...g}},InputProps:{},inputRef:o,label:m,maxCharCount:i,name:s,onBlur:A=>{ee(A.target.value);},onInput:A=>{ne(A.target.value),_.isMobileDevice&&ee(A.currentTarget.value);},placeholder:b$1,locale:W==null?void 0:W.language,phoneFormat:T$1||void 0,readOnly:!!(p&&!r),regEx:f,size:u!=null?u:"small",type:T$1?"phone":"text",toUpperCase:w,value:F,variant:S,visible:x})}));_a.displayName="_PhoneInput";var La=_a;var Oa=withTranslation()(memo(function(e){var ce;let o=useRef(null),{t:i,i18n:a}=useTranslation(),d=a==null?void 0:a.language,{currency_format:r,currency_assymbol:m,currency_currencydisplay:s,currency_fixedlocale:c,datalength:b$1,id:T$1,ignorereadonly:p,label:f,name:u,onchangehandler:g,placeholder:v,readonly:w,regex:S,size:x,style:E,tabIndex:W,uppercasemode:_,variant:I,visible:F}=e.properties,h=useLocation(),{viewPort:$}=b(),{tabId:ee}=e,[ne,D]=useState(String((ce=e.value)!=null?ce:"0")),[A,P]=useState(false),[H,K]=useState(0),N=useRef(0);useEffect(()=>{var X;D(String((X=e.value)!=null?X:"0"));},[e.value]),useEffect(()=>{e.validationMessage!=null&&(N.current+=1,P(false));},[e.context.formValidationData]);let k=!!(!A&&e.validationMessage!=null&&e.context.doValidateForm),J=X=>{var ue;e.methodProvider.eventDispatcher({widgetName:u,widgetValue:X,widgetEvent:g?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:ee,hasParentForm:T.hasParentForm(),originator:(ue=e.context.params)==null?void 0:ue.originator})});},ie=X=>{D(X);},pe=r==="fixed-locale"&&c?c:d,xe=()=>{var Ce;if(s==="")return "";let X=e.context.formData,ue=e.properties.currency_inputfield;return ue&&(X!=null&&X[ue])?X[ue]:e.properties.currency_currency?e.properties.currency_currency:(r==="locale"||r==="fixed-locale")&&(Ce=k$2(pe!=null?pe:""))!=null?Ce:""},de=s==="symbol"?true:s==="code"?false:m!=null?m:false,V=r==="locale"||r==="fixed-locale"?"locale":r!=null?r:"";return jsx(n,{autoFocus:false,currency:xe(),disabled:!!(w&&!p),error:k,helperText:k?e.validationMessage:"",id:T$1,inputProps:{id:T$1,tabIndex:W,style:{...E,textAlign:"right"}},InputProps:{},inputRef:o,label:f,locale:pe,maxCharCount:b$1,name:u,onBlur:X=>{P(true);let ue=X.target.value;(ue==="0"||ue==="")&&K(Ce=>Ce+1),J(ue);},onInput:X=>{ie(X.target.value),$.isMobileDevice&&J(X.currentTarget.value);},onChange:X=>{ne.trim()===""&&J(X.target.value);},placeholder:v,readOnly:!!(w&&!p),regEx:S,size:x,type:"currency",toUpperCase:_,value:ne,variant:I,visible:F,format:V,assymbol:de},H)}));Oa.displayName="_CurrencyInput";var Wa=Oa;var Ua=withTranslation()(memo(function(e){var K,N;let o=useRef(null),{t:i,i18n:a}=useTranslation(),d=(K=a==null?void 0:a.language)==null?void 0:K.substring(0,2),{datalength:r,id:m,forcereadonly:s,ignorereadonly:c,label:b$1,name:T$1,onchangehandler:p,placeholder:f,readonly:u,regex:g,size:v,style:w,tabIndex:S,uppercasemode:x,variant:E,visible:W}=e.properties,[_,I]=useState(false),{viewPort:F}=b(),h=useLocation(),{tabId:$}=e,[ee,ne]=useState(String((N=e.value)!=null?N:"")),D=!!(ee.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var k;ne(String((k=e.value)!=null?k:""));},[e.value]);let A=()=>{I(k=>!k);},P=k=>{var J;e.methodProvider.eventDispatcher({widgetName:T$1,widgetValue:k,widgetEvent:p?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:$,hasParentForm:T.hasParentForm(),originator:(J=e.context.params)==null?void 0:J.originator})});},H=k=>{ne(k);};return jsx(n,{autoFocus:false,disabled:!!(u&&!c),error:D,helperText:D?e.validationMessage:"",id:m,inputProps:{id:m,tabIndex:S,style:{...w,textAlign:"center"}},InputProps:{endAdornment:jsx(Ll,{position:"end",children:jsx(lr,{onClick:A,edge:"end",children:_?jsx(Al,{}):jsx(Vl,{})})})},inputRef:o,label:b$1,locale:d,maxCharCount:r,name:T$1,onBlur:k=>{P(k.target.value);},onInput:k=>{H(k.target.value),F.isMobileDevice&&P(k.currentTarget.value);},onChange:k=>{ee.trim()===""&&P(k.target.value);},placeholder:f,readOnly:!!(u&&!c),regEx:g,size:v,type:"text",toUpperCase:x,value:ee,variant:E,visible:W,inputtype:_?"text":"password"})}));Ua.displayName="_PasswordInput";var Ga=Ua;var qa=styled(TreeItem2Root)(({theme:t})=>({color:t.palette.mode==="light"?t.palette.grey[800]:t.palette.grey[400],position:"relative",[`& .${treeItemClasses.groupTransition}`]:{marginLeft:t.spacing(3.5)}})),nd=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{color:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px",backgroundColor:t.palette.mode==="light"?t.palette.grey[300]:t.palette.grey[700]}},"&:hover":{backgroundColor:alpha(t.palette.primary.main,.1),color:t.palette.mode==="light"?t.palette.primary.main:"white"},"&.Mui-focused, &.Mui-selected, &.Mui-selected.Mui-focused":{backgroundColor:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark,color:t.palette.primary.contrastText,fontWeight:700}})),ad=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px"}}})),rd=animated(Ul);function Ja(t){let e=useSpring({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return jsx(rd,{style:e,...t})}var id=styled(Gl)({color:"inherit",fontWeight:500});function ja({icon:t,expandable:e,children:o,isFirstRootNode:i,...a}){return jsxs(TreeItem2Label,{...a,sx:{display:"flex",alignItems:"center",fontWeight:i?"700":"normal",backgroundColor:"transparent","&.Mui-focused, &.Mui-selected":{backgroundColor:"transparent"}},children:[t&&jsx(Qa,{component:t,className:"labelIcon",color:"inherit",sx:{mr:1,fontSize:"1.2rem"}}),jsx(id,{sx:{fontSize:i?"1rem":"0.9rem",fontWeight:i?"700":"normal"},children:o})]})}var Xa=t=>Array.isArray(t)?t.length>0&&t.some(Xa):!!t,Ct=t$1=>{let e=null,o=t$1.action,i=t$1.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return o==="add"?e=jsx(t,{style:i}):o==="edit"?e=jsx(A$1,{style:i}):o==="share"?e=jsx(E,{style:i}):o==="trash"&&(e=jsx(N,{style:i})),e},ld=Pe.forwardRef(function(e,o){let{id:i,itemId:a,label:d,disabled:r,children:m$1,item:s,index:c,mode:b$1,setSelectedItem:T$1,treeCheckedItems:p,properties:f,disableRootItem:u,userData:g,formData:v,deletePrompt:w,selectedItem:S,execCommands:x$1,eventDispatcher:E,...W}=e,{getRootProps:_,getContentProps:I,getIconContainerProps:F,getCheckboxProps:h,getLabelProps:$,getGroupTransitionProps:ee,getDragAndDropOverlayProps:ne,status:D}=unstable_useTreeItem2({id:i,itemId:a,children:m$1,label:d,disabled:r,rootRef:o}),A=useLocation(),{t:P}=useTranslation(),[H,K]=Pe.useState(null),N=!!H,k=Xa(m$1),J=c===0?void 0:zl,[ie,pe]=Pe.useState(D.expanded),{runFormEvent:xe}=b(),de=useCallback(async(M,te,O,n,oe,U$1)=>{var ke,ze,$e;M&&await xe({pluginCode:O.params.pluginCode,formCode:"FOLDER",guid:(ke=O.params.folderData)==null?void 0:ke.id,projectGuid:O.params.pGuid,pGuid:O.params.pGuid,widgetContext:JSON.stringify({referer:oe.pathname,parentWidgetId:U$1,hasParentForm:T.hasParentForm(),originator:(ze=O.params)==null?void 0:ze.originator,parent:O.params,folderData:($e=O.params)==null?void 0:$e.folderData}),widgetEvent:U.onDelete,widgetName:"delete",formData:O.formData}).then(Ke=>{if(Ke.meta.requestStatus==="fulfilled"){let ve={...Ke.payload};O.execCommands(ve.FECommand);}}),O.deletePrompt({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[e.params.pluginCode,e.params.folderData,e.params.pGuid,e.formData,e.deletePrompt,e.execCommands]),V=M=>{M.stopPropagation(),pe(te=>!te);},ce=M=>{M.stopPropagation(),K(M.currentTarget);},X=()=>{K(null);},ue=useCallback(()=>{X();let M="addbtn";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:A.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[X,A.pathname,e.params,e.eventDispatcher,T.hasParentForm]),Ce=useCallback(()=>{X();let M="share";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderShareRecordEvent,widgetContext:JSON.stringify({referer:A.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:{...e.params,guid:e.params.folderData.id},widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,A.pathname]),ge=useCallback(()=>{X();let M="edit";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderEditRecordEvent,widgetContext:JSON.stringify({referer:A.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,A.pathname]),Y=useCallback(async M=>{var te,O;await xe({pluginCode:e.params.pluginCode,formCode:e.params.formCode,guid:e.params.guid,projectGuid:e.params.pGuid,pGuid:e.params.pGuid,widgetContext:JSON.stringify({referer:A.pathname,parentWidgetId:null,hasParentForm:T.hasParentForm(),originator:(te=e.params)==null?void 0:te.originator,parent:e.params,folderData:(O=e.params)==null?void 0:O.folderData}),widgetEvent:U.onRefresh,widgetName:f==null?void 0:f.name,widgetValue:M,formData:v}).then(n=>{if(n.meta.requestStatus==="fulfilled"){let oe={...n.payload};oe.FECommand={...oe.FECommand,UpdateFormData:oe.data},e.execCommands(oe.FECommand);}});},[e,f==null?void 0:f.name,A.pathname]),G=useCallback(()=>{e.deletePrompt({delete:{showDialog:true,dialogTitle:P("Delete")+" ?",dialogContent:P("Are you certain that you wish to delete this folder?"),buttonAgree:P("Continue"),buttonDisagree:P("Close"),callBackFunc:M=>{M?de(M,"delete",e,{},A,""):de(false,"",e,{},A,"");}}});},[e,P,A,de]);if(b$1==="live"){let M=g.rightMode!=="Edit";return jsxs(qa,{..._(W),sx:{"& > ul":{paddingLeft:"0.2rem",paddingRight:"0.1rem"}},children:[jsxs(nd,{...I({className:x("content",{"Mui-expanded":ie,"Mui-selected":D.selected,"Mui-focused":D.focused,"Mui-disabled":D.disabled})}),children:[c!==0&&jsxs(Fragment,{children:[jsx(TreeItem2IconContainer,{...F({status:D,onPointerUp:V}),children:jsx(TreeItem2Icon,{status:D})}),jsx(TreeItem2Checkbox,{...h()})]}),jsx(ja,{...$({icon:J,expandable:k&&ie,isFirstRootNode:c===0,onClick:te=>{T$1&&T$1(te,a),te.stopPropagation();}}),children:d}),!M&&e.selectedItem===a&&c!==0&&jsx(lr,{size:"small",onClick:ce,"aria-controls":N?"menu":void 0,"aria-haspopup":"true","aria-expanded":N?"true":void 0,style:{marginLeft:"auto",color:"#FFF",fontSize:"14px"},children:jsx(m,{})}),jsxs(Zl,{anchorEl:H,open:N,onClose:X,onClick:te=>te.stopPropagation(),slotProps:{paper:{sx:{minWidth:"12em"}}},children:[jsxs(xt,{onClick:ue,children:[jsx(yt,{children:jsx(Ct,{action:"add",applyInternalStyle:true})}),jsx(wt,{primaryTypographyProps:{fontSize:"0.875rem"},children:P("New Folder")})]}),jsxs(xt,{onClick:ge,children:[jsx(yt,{children:jsx(Ct,{action:"edit",applyInternalStyle:true})}),jsx(wt,{children:P("Settings")})]}),jsxs(xt,{onClick:Ce,children:[jsx(yt,{children:jsx(Ct,{action:"share",applyInternalStyle:true})}),jsx(wt,{children:P("Share")})]}),jsxs(xt,{onClick:G,children:[jsx(yt,{children:jsx(Ct,{action:"trash",applyInternalStyle:true})}),jsx(wt,{children:P("Delete")})]})]}),jsx(TreeItem2DragAndDropOverlay,{...ne()})]}),m$1&&jsx(Ja,{...ee(),in:ie,children:m$1})]})}else {let M=false;return p&&p.length>0&&p.forEach((te,O)=>{if(te===a){M=true;return}}),jsxs(qa,{..._({...W,expandable:false}),sx:{"& > ul":{paddingLeft:"1rem",paddingRight:"0rem"}},children:[jsxs(ad,{...I({className:x("content",{"Mui-expanded":true,"Mui-selected":D.selected,"Mui-focused":D.focused,"Mui-disabled":D.disabled})}),children:[c!==0&&jsx(Fragment,{children:jsx(TreeItem2Checkbox,{id:a,visible:true,checked:M,onPointerUp:te=>Y(a),onResize:void 0,onResizeCapture:void 0,popover:void 0,popoverTargetAction:void 0,popoverTarget:void 0,inert:void 0,onToggle:void 0,onBeforeToggle:void 0,onTransitionCancel:void 0,onTransitionCancelCapture:void 0,onTransitionRun:void 0,onTransitionRunCapture:void 0,onTransitionStart:void 0,onTransitionStartCapture:void 0})}),jsx(ja,{...$({icon:J,expandable:k,isFirstRootNode:c===0}),children:d}),jsx(TreeItem2DragAndDropOverlay,{...ne()})]}),m$1&&jsx(Ja,{...ee(),in:true,children:m$1})]})}}),dd=t=>{let e=[],o=i=>{i.forEach(a=>{a.children&&a.children.length>0&&(e.push(a.id),o(a.children));});};return o(t),e},sd=(t,e)=>{let o=(i,a)=>{for(let d of i)if(d.id===a||d.children&&o(d.children,a))return d;return null};return o(t,e)},md=(t,e)=>{let o=[],i=(a,d,r=[])=>{for(let m of a){if(m.id===d)return o.push(...r),true;if(m.children&&i(m.children,d,[...r,m]))return true}return false};return i(t,e),o},Ht=(t,e)=>{for(let o of t){if(o.id===e)return o;if(o.children){let i=Ht(o.children,e);if(i)return i}}return null},It=(t,e)=>{for(let o of t){if(o.id===e)return [o.label];if(o.children){let i=It(o.children,e);if(i.length>0)return [o.label,...i]}}return []},cd=({eventDispatcher:t,execCommands:e,params:o,properties:i,redrawComponent:a,formlayout:d,onFolderSelected:r,onFolderAdded:m,formData:s,mode:c,checkedItems:b$2})=>{var H,K;let{runFormEvent:T$1}=b(),[p,f]=Pe.useState([]),[u,g]=Pe.useState(((H=o==null?void 0:o.folderData)==null?void 0:H.id)||null),[v,w]=Pe.useState([]),[S,x]=Pe.useState(b$2),[E,W]=Pe.useState(false),[_,I]=Pe.useState(),{UserDialog:F}=b$1();Pe.useEffect(()=>{x(b$2);},[b$2]);let h=useCallback(T.debounce(async()=>{var N,k,J,ie,pe,xe,de,V,ce,X,ue;try{let Ce=await T$1({pluginCode:((N=o.sourcePluginCode)==null?void 0:N.trim())!==""?o.sourcePluginCode:o.pluginCode,formCode:((k=o.sourceFormCode)==null?void 0:k.trim())!==""?o.sourceFormCode:o.formCode,guid:o.guid,projectGuid:o.pGuid,pGuid:o.pGuid,widgetEvent:U.onFoldersDataLoad,widgetContext:JSON.stringify({originator:(J=o.originator)!=null?J:null})});if(Ce.meta.requestStatus==="fulfilled"){let ge={...Ce.payload};ge!=null&&ge.userData&&I(ge==null?void 0:ge.userData),(ie=ge==null?void 0:ge.userData)!=null&&ie.isContributor&&W(!0);let Y=JSON.parse(ge.widgetData.treeData);if(f(Y),(pe=o==null?void 0:o.folderData)!=null&&pe.addedFolderId){let G=sd(Y,(xe=o==null?void 0:o.folderData)==null?void 0:xe.addedFolderId);if(G){let M=dd([G]);w(M),g((de=o==null?void 0:o.folderData)==null?void 0:de.addedFolderId);let te=It([G],(V=o==null?void 0:o.folderData)==null?void 0:V.addedFolderId);m(null,te);}}else if(v.length===0&&w([(ce=Y[0])==null?void 0:ce.id]),!u){let G=(X=Y[0])==null?void 0:X.id,M=(ue=Y[0])==null?void 0:ue.isroot;g(G||null),r(G||null,M);}}}catch(Ce){}},500),[o]);Pe.useEffect(()=>(h(),()=>{h.cancel();}),[h]),Pe.useEffect(()=>{var N,k,J,ie,pe,xe;if((N=o==null?void 0:o.folderData)!=null&&N.id){g(((k=o==null?void 0:o.folderData)==null?void 0:k.id)||null);let de=Ht(p,(J=o==null?void 0:o.folderData)==null?void 0:J.id),V=It(p,de==null?void 0:de.id),ce=[],X=md(p,(ie=o==null?void 0:o.folderData)==null?void 0:ie.id);X.length>0&&(X.forEach(ue=>{ce.push(ue.id);}),ce.push((pe=o==null?void 0:o.folderData)==null?void 0:pe.id),w(ce)),r((xe=o==null?void 0:o.folderData)==null?void 0:xe.id,de==null?void 0:de.isroot,V);}},[(K=o==null?void 0:o.folderData)==null?void 0:K.id]);let[$,ee]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),ne=N=>$.delete.callBackFunc(N),D=N=>{ee(N);},A=(N,k)=>{g(k);let J=Ht(p,k),ie=It(p,J==null?void 0:J.id);r(k,J==null?void 0:J.isroot,ie);};return jsxs(Fragment,{children:[jsx(Qa,{sx:{paddingTop:"5px"},children:jsx(RichTreeView,{items:p,selectedItems:u,expandedItems:v,sx:{height:"fit-content",flexGrow:1,maxWidth:250,overflowY:"auto"},slots:{item:N=>jsx(ld,{...N,mode:c,params:o,eventDispatcher:t,execCommands:e,deletePrompt:D,index:p.findIndex(k=>k.id===N.itemId),selectedItem:u,setSelectedItem:A,treeCheckedItems:S,disableRootItem:E,userData:_,formData:s,properties:i})},onSelectedItemsChange:A,onExpandedItemsChange:(N,k)=>{var ie;let J=(ie=p[0])==null?void 0:ie.id;J&&!k.includes(J)?w(pe=>pe.includes(J)?pe:[...pe,J]):w(k);}})}),jsx(F,{...$.delete,handleDialogClose:ne})]})},ct=cd;var Za=withTranslation()(memo(function(e){var c,b;let{style:o,verticalalign:i,plugincode:a,formcode:d,visible:r}=e.properties,m={paddingTop:"0px"};if(i==="bottom"&&(m.paddingTop="10px"),!r)return null;let s=(c=e.context.formData)!=null&&c[e.properties.name]?JSON.parse((b=e.context.formData)==null?void 0:b[e.properties.name]):{};return jsx("div",{style:{...o,...m,minHeight:"2rem"},children:jsx(ct,{params:{sourceFormCode:d,sourcePluginCode:a,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,pGuid:e.context.params.pGuid,originator:e.context.params.originator},properties:e.properties,checkedItems:s,redrawComponent:e.context.redrawComponent,eventDispatcher:e.methodProvider.eventDispatcher,execCommands:e.methodProvider.execCommands,formData:e.context.formData,formlayout:"folders",onFolderSelected:()=>{},onFolderAdded:()=>{},mode:"setup"})})}));Za.displayName="_View";var er=Za;var pd=lazy(()=>import('./tabulator-67R3BRXK.js').then(t=>({default:t.TabulatorTable}))),gd=lazy(()=>import('./datatable-UKX622UX.js').then(t=>({default:t.Datatable}))),Ve=class{static getFormComponent(e,o){if(e.displayName==="_Rowcontainer")return Hn;if(e.displayName==="_Rowsegment")return zn;if(e.displayName==="_Textinput"){if(o.inputtype==="input")return Jn;if(o.inputtype==="inputwcopy")return Kn;if(o.inputtype==="currency")return Wa;if(o.inputtype==="password")return Ga;if(o.inputtype==="date")return Sa;if(o.inputtype==="time")return Ma;if(o.inputtype==="datetime")return Na;if(o.inputtype==="phone")return La}else {if(e.displayName==="_TabBox")return Zn;if(e.displayName==="_Button")return Pa;if(e.displayName==="_Label")return oa;if(e.displayName==="_CheckBox")return ra;if(e.displayName==="_Radio")return da;if(e.displayName==="_Textarea")return ma;if(e.displayName==="_SelectBox")return fa;if(e.displayName==="_Placeholder")return ga;if(e.displayName==="_Fileuploader")return Ia;if(e.displayName==="_Table")return o.alloweditrow||o.tablemode!==void 0&&o.tablemode==="tabulator"?pd:gd;if(e.displayName==="_View")return er}return e}};function nr(t,e,o){var i=this,a=useRef(null),d=useRef(0),r=useRef(null),m=useRef([]),s=useRef(),c=useRef(),b=useRef(t),T=useRef(true);useEffect(function(){b.current=t;},[t]);var p=!e&&e!==0&&typeof window!="undefined";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var f=!!(o=o||{}).leading,u=!("trailing"in o)||!!o.trailing,g="maxWait"in o,v=g?Math.max(+o.maxWait||0,e):null;useEffect(function(){return T.current=true,function(){T.current=false;}},[]);var w=useMemo(function(){var S=function(F){var h=m.current,$=s.current;return m.current=s.current=null,d.current=F,c.current=b.current.apply($,h)},x=function(F,h){p&&cancelAnimationFrame(r.current),r.current=p?requestAnimationFrame(F):setTimeout(F,h);},E=function(F){if(!T.current)return false;var h=F-a.current;return !a.current||h>=e||h<0||g&&F-d.current>=v},W=function(F){return r.current=null,u&&m.current?S(F):(m.current=s.current=null,c.current)},_=function F(){var h=Date.now();if(E(h))return W(h);if(T.current){var $=e-(h-a.current),ee=g?Math.min($,v-(h-d.current)):$;x(F,ee);}},I=function(){var F=Date.now(),h=E(F);if(m.current=[].slice.call(arguments),s.current=i,a.current=F,h){if(!r.current&&T.current)return d.current=a.current,x(_,e),f?S(a.current):c.current;if(g)return x(_,e),S(a.current)}return r.current||x(_,e),c.current};return I.cancel=function(){r.current&&(p?cancelAnimationFrame(r.current):clearTimeout(r.current)),d.current=0,m.current=a.current=s.current=r.current=null;},I.isPending=function(){return !!r.current},I.flush=function(){return r.current?W(Date.now()):c.current},I},[f,g,e,v,u,p]);return w}var xd=Pe__default.createContext(void 0),rr=({children:t,eventDispatcher:e,redrawComponent:o,formlayout:i,params:a,onFolderSelected:d,onFolderAdded:r,formData:m,execCommands:s$1})=>{let[c,b$1]=useState(i),{viewPort:T}=b(),[p,f]=useState(false),{t:u}=useTranslation(),g=()=>f(x=>!x),v=()=>f(false),w={viewHolder:{display:"flex",position:"relative"},toggleButton:{position:"absolute",top:"1em",right:"1em",zIndex:1e3,background:"#FFF",color:"#3f86cc ",border:"1px solid #3f86cc",borderRadius:"50%",width:"35px",height:"35px",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},toggleButtonMenuActive:{background:"#3f86cc",color:"#FFF "},btreeContainerMobile:{position:"fixed",top:0,left:p?0:"-16rem",height:"100%",width:"16rem",backgroundColor:"#F8F8F8",borderRight:"1px solid #C0C0C0",transition:"left 0.3s ease",zIndex:999,padding:"0.5rem"},btreeContainerDesktop:{borderRight:"1px solid #C0C0C0"},mainContent:{flex:1,margin:"1em"}},S=()=>jsx(Gl,{variant:"h6",sx:{padding:"0.5em",fontWeight:"bold",borderBottom:"1px dashed #C0C0C0"},children:u("My Folders")});return jsxs(xd.Provider,{value:{layout:c,setLayout:b$1},children:[(!i||i==="regular")&&t,i==="folders"&&jsxs("div",{className:"viewHolder",style:w.viewHolder,children:[T.isMobileDevice?jsxs(Fragment,{children:[!p&&jsx("button",{onClick:g,style:{...w.toggleButton,...w.toggleButtonMenuActive},children:s({size:"1.3rem"})}),jsx(vd,{open:p,onClick:v,sx:{zIndex:998,backgroundColor:"rgba(0, 0, 0, 0.5)"}}),jsxs("div",{style:w.btreeContainerMobile,onClick:x=>x.stopPropagation(),children:[jsx("div",{style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:"0.5rem"}}),jsx(S,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:s$1,formData:m,formlayout:i,onFolderSelected:d,onFolderAdded:r,mode:"live"})]})]}):jsxs("div",{className:"foldersHolder",style:w.btreeContainerDesktop,children:[jsx(S,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:s$1,formData:m,formlayout:i,onFolderSelected:d,onFolderAdded:r,mode:"live"})]}),jsx("div",{style:w.mainContent,children:t})]})]})};var Rd=lazy(()=>import('./fileviewer-YMKT5J4T.js')),Sd=lazy(()=>import('./formeditor-G6KCPAWI.js').then(t=>({default:t.Formeditor}))),Tt=t=>new Promise(e=>setTimeout(e,t));function dr(t,e={}){let o={},i=d=>{let r=d==null?void 0:d.properties;if(!(r!=null&&r.name)||!(r!=null&&r.defaultvalue)||d.stricttype!=="_Textinput")return;let{name:m,inputtype:s}=r,c=String(r.defaultvalue).toLowerCase().trim();e[m]!=null&&e[m]!==""||(s==="date"&&c==="today"?o[m]=a$1().utc().format():s==="datetime"&&c==="now"?o[m]=a$1().utc().format():s==="time"&&c==="now"?o[m]=a$1().utc().format():s==="time"&&c==="start of day"&&(o[m]=a$1().startOf("day").utc().format()));},a=d=>{if(d.type==="formrow"||d.stricttype==="_Rowcontainer")for(let r of d._children||[])for(let m of r._children||[])i(m);else if(d._children)for(let r of d._children)a(r);};for(let d of t||[])a(d);return o}var $t={command:{},params:{id:null,parentId:null,guid:"",pGuid:"",formCode:"",pluginCode:"",modal:false,modalCloseFn:()=>{},modalCloseAndOpenFn:()=>{},originator:{params:{pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pluginCode:"",formCode:"",guid:""}},hasParentForm:false,folderData:{id:"",label:"",isRoot:"",captions:[]}},doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:0,height:0},formValidationData:{},enableEventHandlers:false,isModal:false,hasParentForm:false,formLayout:"regular"},sr={containerSetup:{properties:{style:{minHeight:0}}},selectedWidgetProps:{title:"",subtitle:"",style:{},tabsetup:null,_path:{type:null,stricttype:null,component:null,tabId:null,panelId:null,rowId:null,segmentId:null,widgetId:null},lastActiveTabId:null}},Ed={id:"",parentId:"",pluginCode:"",formCode:"",guid:null,pGuid:void 0,isFormEditorMode:false,originator:{params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},folderData:{id:"",addedFolderId:"",isRoot:"",captions:[]},prefillData:void 0},kd=memo(function({previewMode:e,className:o,maxWidth:i,setup:a,params:d$1,enableEventHandlers:r,modalCloseFn:m}){var Xt,Yt;let s={...d$1,modalCloseFn:m||(d$1==null?void 0:d$1.modalCloseFn)},c=useRef(null),[b$1,T$1]=useState(0),{registerFormSubmitEvent:p,checkFormAccess:f$1}=i$1(),{apiConfig:u,appSettings:g,viewPort:v,runLoadFormEvent:w,runServerPingEvent:S,runFormEvent:x,fetchUserMenu:E,signInUser:W,signOut:_}=b(),[I,F]=useState(null),h=useNavigate(),[$,ee]=useState(false),ne=useRef({}),[D,A]=useState({}),[P$1,H]=useState(null),[K,N]=useState(null),k=useLocation(),[J]=useState(v.width),[ie]=useState(s.modal||false),[pe]=useState(T.hasParentForm()||!!(u!=null&&u.token)),[xe,de]=useState([]),V=xe.length>0?xe[xe.length-1]:Ed,[ce,X]=useState(),[ue,Ce]=useState(true),{t:ge,i18n:Y}=useTranslation(),G=e$1(),M=f(),te=g$2(),O={command:{},params:s,doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:b$1,height:0},formValidationData:{},enableEventHandlers:r,isModal:ie,hasParentForm:pe,formLayout:"regular"},[n,oe]=useState(O),[U,ke]=useState({...sr,containerSetup:a}),ze=nr(()=>{c&&c.current&&T$1(c.current.offsetWidth);},200),$e=async(l,R)=>{await w({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.pGuid,pGuid:l.pGuid,originator:l.originator,parent:l.parent,previewMode:e,widgetContext:JSON.stringify({folderData:l.folderData,prefillData:l.prefillData})}).then(async C=>{var L,q,Z,ye,he,be,Te,z;if(C.meta.requestStatus==="fulfilled"){let B={...C.payload};if(Object.keys(B).length===0)return;try{let se=window.location.hostname;if(!b$2.SKIP_ACCESS_VALIDATION_DOMAINS.some(He=>se===He||se.endsWith(`.${He}`))){let He=await f$1(l.formCode);(He==null?void 0:He.subscriptionPlan)!=null&&H(He.subscriptionPlan);}}catch(se){N({title:(q=(L=se==null?void 0:se.data)==null?void 0:L.error)!=null?q:"Form Unavailable",message:(ye=(Z=se==null?void 0:se.data)==null?void 0:Z.message)!=null?ye:"This form is temporarily unavailable."});return}if(B.uiTranslations&&Object.keys(B.uiTranslations).length>0){ne.current=B.uiTranslations,A(B.uiTranslations);let se=Fd;se.addResourceBundle(se.language,"default",B.uiTranslations,true,true);}let Me={},le={visibility:{...n==null?void 0:n.widgetsState.visibility,...(he=B==null?void 0:B.widgetsState)==null?void 0:he.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(be=B==null?void 0:B.widgetsState)==null?void 0:be.readOnly}};if(R){oe(se=>({...se,formData:B.data,fieldAllowedValues:B.fieldAllowedValues,widgetsState:le,formLayout:B.layout,requiredFields:B.requiredFields}));return}let Re={},Be=[],Oe={},We=JSON.parse(B.definition);if(We==null){oe({...O,redrawComponent:false,doValidateForm:false,command:{...B.FECommand},formData:{},widgetsState:le,formLayout:B.layout,requiredFields:B.requiredFields,params:{...O.params,folderData:B.folderData}});return}T.mapComponents(We._children);let Xe=We.properties;Be=We._children,Oe=We,ke({...U,containerProps:Xe,selectedWidgetProps:{...U.containerProps},containerData:Be,containerSetup:Oe}),Me=B.fieldAllowedValues,Re={...B.data,...dr(Be,B.data)},oe({...O,formData:Re,formLayout:B.layout,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(Te=B==null?void 0:B.widgetsState)==null?void 0:Te.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(z=B==null?void 0:B.widgetsState)==null?void 0:z.readOnly}},requiredFields:B.requiredFields,command:{...B.FECommand},fieldAllowedValues:Me,params:{...O.params,folderData:B.folderData}}),ee(true);}});};if(useEffect(()=>(ze(),$e(s,false),window.addEventListener("resize",ze),()=>{oe(()=>({...$t})),ke(sr),ee(false),window.removeEventListener("resize",ze);}),[s.pGuid,s.guid,s.pluginCode,s.formCode]),useEffect(()=>{var C;if(!$||!((C=U.containerSetup)!=null&&C._children))return;let l=U.containerSetup._children,R=setTimeout(()=>{oe(L=>{let q=dr(l,L.formData);return Object.keys(q).length===0?L:{...L,formData:{...L.formData,...q}}});},0);return ()=>clearTimeout(R)},[Y.language,$]),useEffect(()=>{var q,Z,ye,he,be,Te,z,B,Me,le,Re,Be,Oe,We,Xe,se,Rt,He,Zt,eo,to,oo,no,ao,ro,io,lo,so,mo,co,uo,fo,po,go,ho,bo,vo,yo,wo,xo,Co,Io,Fo,To,Do,Po,Ro,So,Eo,ko,Mo,Bo,No,_o,Lo,Ao,Vo,Oo,Wo,Ho,Uo,Go,zo,$o,qo,Jo,jo,Qo,Ko,Xo,Yo,Zo,en,tn,on;let l=n,R=null,C=true,L=false;if((q=n.command)!=null&&q.Messages&&((Z=n.command)==null||Z.Messages.forEach(me=>{var we,Ye;let re=(we=ne.current[me.text])!=null?we:ge(me.text),Ee=(Ye=me.code)==null?void 0:Ye.toUpperCase();Ee==="NOTICE"?(L=true,te({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false})):Ee==="SUCCESS"?(L=true,M({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false})):Ee==="WARNING"&&(C=false,G({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false}));})),(ye=n.command)!=null&&ye.DisplayButtonLoader){oe({...n,displayButtonLoader:true});return}if((he=n.command)!=null&&he.DisplayErrorPage){h("/pagenotfound");return}if((be=n.command)!=null&&be.MoveToTab){let me=(z=(Te=n.command)==null?void 0:Te.MoveToTab)==null?void 0:z.widgetName;if(me){let re=T.getTabWidgetByFieldName(me,U.containerSetup);re!==null&&(re==null?void 0:re.tabId)!=null&&ve(re);}}if((B=n.command)!=null&&B.FormValidationData&&Object.keys(n.command.FormValidationData).length>0){let me=Object.keys(n.command.FormValidationData)[0];if(me){let re=T.getTabWidgetByFieldName(me,U.containerSetup);re!==null&&(re==null?void 0:re.tabId)!=null&&ve(re),setTimeout(()=>{let Ee=[`[name="${me}"]`,`[data-field-name="${me}"]`,`#${me}`,`[id*="${me}"]`],we=null;for(let Ye of Ee)try{if(we=document.querySelector(Ye),we)break}catch(St){}we&&(we.scrollIntoView({behavior:"smooth",block:"center"}),(we.tagName==="INPUT"||we.tagName==="TEXTAREA"||we.tagName==="SELECT")&&we.focus());},100);}oe({...n,doValidateForm:true,formValidationData:(Me=n.command)==null?void 0:Me.FormValidationData});return}else l={...l,formValidationData:{}};if((le=n.command)!=null&&le.FetchUserMenu&&E&&E({ProjectGuid:(Be=(Re=n.command)==null?void 0:Re.FetchUserMenu)==null?void 0:Be.projectGuid,pGuid:(We=(Oe=n.command)==null?void 0:Oe.FetchUserMenu)==null?void 0:We.projectGuid}),(Xe=n.command)!=null&&Xe.Redirect){s.modalCloseFn&&s.modalCloseFn(),h(`${(se=n.command)==null?void 0:se.Redirect.url}?ref=${(Zt=(He=(Rt=n.command)==null?void 0:Rt.Redirect)==null?void 0:He.context)==null?void 0:Zt.referer}`,{state:{from:(oo=(to=(eo=n.command)==null?void 0:eo.Redirect)==null?void 0:to.context)==null?void 0:oo.referer}});return}if((no=n.command)!=null&&no.BuildPlugin){h(`${(ao=n.command)==null?void 0:ao.BuildPlugin.url}?ref=${(io=(ro=n.command)==null?void 0:ro.BuildPlugin)==null?void 0:io.referer}`);return}if((lo=n.command)!=null&&lo.DisplayComponent&&F((so=n.command)==null?void 0:so.DisplayComponent),(mo=n.command)!=null&&mo.CloseDisplayComponent&&F(null),(co=n.command)!=null&&co.Login&&(async()=>{var me,re,Ee,we,Ye,St,nn;W&&await W((me=n.command)==null?void 0:me.Login),E&&await E({ProjectGuid:T.extractProjectGuid((Ee=(re=n.command)==null?void 0:re.Login)==null?void 0:Ee.url),pGuid:T.extractProjectGuid((Ye=(we=n.command)==null?void 0:we.Login)==null?void 0:Ye.url)}),h(((nn=(St=n.command)==null?void 0:St.Login)==null?void 0:nn.url)||"/");})(),(uo=n.command)!=null&&uo.Logout&&(async()=>{var re;(re=n.command)!=null&&re.Logout&&(_&&await _(),h("/"));})(),((fo=n.command)!=null&&fo.Cancel||(po=n.command)!=null&&po.CloseForm)&&(n.isModal&&s.modalCloseFn!==void 0?s.modalCloseFn(null,null,false,(go=n.command)==null?void 0:go.RedrawFolders):(R=T.getUrlParameter("ref"),R!=null&&h(R))),(ho=n.command)!=null&&ho.AfterRecordSave){let me=(bo=g==null?void 0:g.TOASTER_AUTOCLOSE)!=null?bo:b$2.TOASTER_AUTOCLOSE;if(R=T.getUrlParameter("ref"),((vo=n.command)==null?void 0:vo.AfterRecordSave.guid)==null)!((yo=n.command)!=null&&yo.OpenModal)&&s.modalCloseFn?s.modalCloseFn(null,null,false,null,null):(wo=n.command)!=null&&wo.OpenModal||(async()=>(await Tt(L?me:0),R!=null&&h(R)))();else if(n.isModal){let re;(xo=n.command)!=null&&xo.HotReloadEnabled&&(re=(Co=n.command)==null?void 0:Co.HotReloadEnabled),(Io=n.command)!=null&&Io.OpenModal||(async()=>{var Ee,we;await Tt(L?me:0),s.modalCloseFn&&s.modalCloseFn(re,n.formData,(Ee=n.command)==null?void 0:Ee.RedrawScreen,(we=n.command)==null?void 0:we.RedrawFolders,null);})();}else {let re=R!=null;if(!((Fo=n.command)!=null&&Fo.OpenModal)&&re&&C)(async()=>(await Tt(L?me:0),R!=null&&h(R)))();else if(!((To=n.command)!=null&&To.OpenModal)){let Ee=k.pathname.replace(/\/new/gi,"/"+((Do=n.command)==null?void 0:Do.AfterRecordSave.guid.replace(/#/g,"%23")));h(Ee,{state:{from:k.pathname}}),l={...l,params:{...n.params,guid:(Po=n.command)==null?void 0:Po.AfterRecordSave.guid}};}}}if((Ro=n.command)!=null&&Ro.UpdateWidgetsState&&(l={...l,widgetsState:{visibility:{...l==null?void 0:l.widgetsState.visibility,...(Eo=(So=n.command)==null?void 0:So.UpdateWidgetsState)==null?void 0:Eo.visibility},readonly:{...l==null?void 0:l.widgetsState.readonly,...(Mo=(ko=n.command)==null?void 0:ko.UpdateWidgetsState)==null?void 0:Mo.readonly}}}),(Bo=n.command)!=null&&Bo.UpdateFieldAllowedValues&&(l={...l,fieldAllowedValues:{...(No=n.command)==null?void 0:No.UpdateFieldAllowedValues}}),(_o=n.command)!=null&&_o.UpdateFormData&&(l={...l,formData:{...(Lo=n.command)==null?void 0:Lo.UpdateFormData}}),(Ao=n.command)!=null&&Ao.UpdateFormDataItem&&(l={...l,formData:{...l.formData,[(Vo=n.command)==null?void 0:Vo.UpdateFormDataItem.name]:(Oo=n.command)==null?void 0:Oo.UpdateFormDataItem.value}}),((Ho=(Wo=n.command)==null?void 0:Wo.ReplaceContextRecordGuid)==null?void 0:Ho.guid)!=null&&(l={...l,displayButtonLoader:false,params:{...n.params,guid:(Uo=n.command)==null?void 0:Uo.ReplaceContextRecordGuid.guid}}),(Go=n.command)!=null&&Go.OpenModal){let me={...(zo=n.command)==null?void 0:zo.OpenModal,parentId:s.id};de(re=>[...re,me]),l={...l,command:{}};}($o=n.command)!=null&&$o.PreviewDocument&&X((qo=n.command)==null?void 0:qo.PreviewDocument),(Jo=n.command)!=null&&Jo.RedrawScreen&&(l={...l,redrawComponent:!n.redrawComponent,redrawFoldersComponent:!n.redrawFoldersComponent}),(jo=n.command)!=null&&jo.RedrawFolders&&(l={...l,params:{...n.params,folderData:{id:(Ko=(Qo=n.command)==null?void 0:Qo.RedrawFolders)==null?void 0:Ko.folderId,addedFolderId:(Yo=(Xo=n.command)==null?void 0:Xo.RedrawFolders)==null?void 0:Yo.folderId,isRoot:(en=(Zo=n.command)==null?void 0:Zo.RedrawFolders)==null?void 0:en.isRoot,captions:(on=(tn=n.command)==null?void 0:tn.RedrawFolders)==null?void 0:on.captions}}}),Object.keys(n.command).length>0&&(l={...l,command:{}},oe(l));},[n.command]),K)return jsx(l$1,{title:K.title,message:K.message});if(!$)return Pe__default.createElement("div",{},jsx(a$2,{message:ge("Please wait...")}));let Ke=(l,R)=>{let C={};return Object.entries(l).forEach(([L,q])=>{let Z=R[L];(Z==null||Z===""||Z==="0"||Z===0||Array.isArray(Z)&&Z.length===0)&&(C[L]=q);}),C},ve=(l,R=false,C={})=>{let L=ft(null,l.tabId,l.index,R,C.containerSetup);if(L===void 0)return;let q=T.GetParentTabId(L.containerSetup,l.tabId);(q==null?void 0:q.tabId)!=null?(L=ft(null,q.tabId,q.index,false,L.containerSetup),L!==void 0&&ve(q,true,L)):R===false&&ft(null,l.tabId,l.index,true);},rt=async l=>(oe({...n,displayButtonLoader:true}),await x({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.projectGuid,pGuid:l.projectGuid,formData:{...l.formData,[l.fieldName]:l.value},widgetContext:JSON.stringify({referer:k.pathname,parentWidgetId:l.tabId,hasParentForm:T.hasParentForm(),originator:{widgetName:l.fieldName.toLowerCase(),params:n.params},parent:{widgetName:l.fieldName.toLowerCase(),params:n.params},parentOriginator:{params:n.params.originator?n.params.originator.params:{}},folderData:n.params.folderData}),widgetEvent:l.widgetEvent,widgetName:l.fieldName.toLowerCase(),widgetValue:l.widgetValue}).then(async R=>{var C,L,q,Z,ye,he,be,Te;if(R.meta.requestStatus==="fulfilled"){let z={...R.payload};((C=z.FECommand)==null?void 0:C.ReplaceContextRecordGuid)!==void 0?(z.FECommand={Messages:(q=(L=z.FECommand)==null?void 0:L.Messages)!=null?q:[],UpdateFormData:z.data,ReplaceContextRecordGuid:(Z=z.FECommand)==null?void 0:Z.ReplaceContextRecordGuid},ot(z.FECommand)):(ye=z.FECommand)!=null&&ye.Messages?(z.FECommand={UpdateFormData:z.data,Messages:(he=z.FECommand)==null?void 0:he.Messages},ot(z.FECommand)):(be=z.FECommand)!=null&&be.FormValidationData&&(z.FECommand={FormValidationData:(Te=z.FECommand)==null?void 0:Te.FormValidationData},ot(z.FECommand));}else oe({...n,displayButtonLoader:false});})),Ie=l=>{let R=l.widgetContext,C=l.widgetEvent,L=l.widgetName.toLowerCase(),q=l.widgetValue,Z=l.feCommand||{},ye=l.skipFormDataItem||false;if(C!==null&&n.enableEventHandlers){if(l.autoSave){rt(l.autoSave);return}let he=q!=null&&ye===false?{...n.formData,[L]:q}:n.formData;if((C==null?void 0:C.toUpperCase())==="ONSAVE"&&n.requiredFields!=null){let be=Ke(n.requiredFields,he),Te=Object.keys(n.formValidationData||{}).length>0,z=Object.keys(be).length>0;if((z||Te)&&(oe({...n,command:{...n.command,FormValidationData:be}}),z))return}(async()=>{var be,Te;if((C==null?void 0:C.toUpperCase())==="ONSAVE")try{await p(n.params.formCode);}catch(z){if((z==null?void 0:z.status)===429)return}Ce(false),await x({pluginCode:n.params.pluginCode,formCode:n.params.formCode,guid:n.params.guid,projectGuid:(be=n.params.pGuid)!=null?be:"",pGuid:(Te=n.params.pGuid)!=null?Te:"",widgetContext:R,widgetEvent:C,widgetName:L,widgetValue:typeof q=="string"?q:q!=null?JSON.stringify(q):null,formData:he,widgetsState:n.widgetsState}).then(z=>{var B,Me;if(z.meta.requestStatus==="fulfilled"){if(z.payload instanceof Blob){oe({...n,redrawComponent:!n.redrawComponent});return}let le={...z.payload};if(Object.keys(le).length===0)return;let Re=JSON.parse(le.definition);if(Re!=null){let Be=[],Oe={};T.mapComponents(Re._children);let We=Re.properties;Be=Re._children,Oe=Re,ke({...U,containerProps:We,selectedWidgetProps:{...U.selectedWidgetProps},containerData:Be,containerSetup:Oe});let Xe=L;if(Xe){let se=T.getTabWidgetByFieldName(Xe,Oe);se!==null&&(se==null?void 0:se.tabId)!=null&&ve(se,true,{containerSetup:Oe});}}ye||(n.redrawComponent=false),oe({...n,fieldAllowedValues:le.fieldAllowedValues,doValidateForm:true,command:{...le.FECommand},formData:{...n.formData,...le.data},widgetRelatedData:le.widgetRelatedData,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(B=le==null?void 0:le.widgetsState)==null?void 0:B.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(Me=le==null?void 0:le.widgetsState)==null?void 0:Me.readOnly}},tabIndex:l.tabIndex?Number(l.tabIndex+1):0});}}).finally(async()=>{var z;if(Ce(true),(C==null?void 0:C.toUpperCase())==="ONSAVE"&&u!=null&&u.iframeMode&&u!=null&&u.token){let B=(z=U.containerProps)==null?void 0:z.webhooks;if(Array.isArray(B)&&B.length>0){let Me={formCode:n.params.formCode,submittedAt:new Date().toISOString(),data:he};B.forEach(le=>{var Re;le.enabled&&((Re=le.url)!=null&&Re.startsWith("http"))&&fetch(le.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Me),mode:"cors"}).then(Be=>{Be.ok||G({toastID:nanoid(11),msg:`Webhook failed: ${le.url}`,clearQueue:false,hideProgressBar:false});}).catch(Be=>{G({toastID:nanoid(11),msg:`Webhook failed: ${le.url}`,clearQueue:false,hideProgressBar:false});});});}}});})();}if(q!=null){let he={...n.formData,[L]:q};oe({...n,command:Z,formData:he});}},it=(l,R,C)=>T.findRowItem(l,R,C,U.containerSetup._children),ur=(l,R,C,L)=>T.findSegmentItem(l,R,C,L,U.containerSetup._children),fr=l=>T.findWidgetByIdRecursive(U.containerSetup._children,l),pr=(l,R)=>T.getActiveTabIndex(U.containerSetup._children,R),ft=(l,R,C,L=true,q={})=>{let Z=Object.keys(q).length>0?q:U.containerSetup;if(!R)return;let ye=T.getTabContainer(Z._children,R),he=T.getTabContainerChildrens(Z._children,R);if(he===void 0)return;for(let B=0;B<he.data.length;B++)he.data[B].activeTab="0";let be=he.data.filter((B,Me)=>Me===C)[0];be.properties={...ye.item.properties.tabsetup,...be.properties};let Te=T.getNodeUpdatePath(he.path,{$splice:[[C,1,{...be,activeTab:"1"}]]});var z={containerSetup:{...Z,_children:(0, mr.default)(Z._children,Te)},selectedWidgetProps:{...U.selectedWidgetProps,tabsetup:{...be.properties},_path:{...U.selectedWidgetProps._path,panelId:be.id},lastActiveTabId:R}};return L&&ke(z),z},gr=(l=true)=>{let R=$t;l&&(R={...n,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{id:"",isRoot:"",captions:[]}}}),oe(R);},ot=l=>{oe({...n,redrawComponent:!n.redrawComponent,command:{...l}});},qt=(l,R)=>{(async()=>{if(!S){l();return}await S({cmd:"ping"}).then(async C=>{(C==null?void 0:C.type)==="formbuilder/ping/rejected"?(G({toastID:nanoid(11),msg:"Application is being restarted. Please wait until it finishes....",clearQueue:false,hideProgressBar:false}),await Tt(1e3),qt(l)):l();});})();},Pt=(l,R=false,C,L=null)=>{qt(()=>{if(de(Z=>Z.slice(0,-1)),L!=null){let Z={...L,parentId:s.id};de(ye=>[...ye,Z]);}else if(l!=null){let Z={id:nanoid(5),pluginCode:l==null?void 0:l.pluginCode,formCode:l==null?void 0:l.formCode,guid:null,isFormEditorMode:true,parentId:s.id};de(ye=>[...ye,Z]);}if($e(n.params,true),C){let Z=C==null?void 0:C.folderId;Jt(Z,[]);}else oe({...n,redrawComponent:!n.redrawComponent});}),R&&n.isModal&&$e(s,true);},hr=(l,R="",C)=>{let L={...n,redrawFoldersComponent:!n.redrawFoldersComponent,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:"",captions:C,id:l!==null?l:"",isRoot:R}}};oe(L);},Jt=(l,R)=>{let C=$t;l==null?C={...n,redrawFoldersComponent:!n.redrawFoldersComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:l!==null?l:"",captions:R}}}:C={...n,params:{...n.params,folderData:{...n.params.folderData,id:l!==null?l:"",addedFolderId:l!==null?l:"",isRoot:"",captions:R}}},oe(C);},jt=l=>{l&&de(R=>[...R.slice(0,-1),{...l,id:nanoid(5)}]);},br=()=>{X(void 0);},vr=()=>F(null),yr=l=>{let{title:R,subtitle:C}=l,L=R;return C!==void 0&&String(C).trim()!==""&&(L=R+" - "+C),n.enableEventHandlers&&Object.keys((n==null?void 0:n.formData)||{}).length>0&&Object.entries(n.formData).forEach(([q,Z])=>{L=L.replace(`#${q}`,Z);}),L},{properties:Fe}=U.containerSetup||{},{minHeight:Qt}=(Fe==null?void 0:Fe.style)||{},pt={};Qt&&(pt.minHeight=Qt),ie&&(pt={...pt,width:"100%",minWidth:J-J*.3,maxHeight:"calc(100dvh - 4rem)",overflow:"auto"});let Kt={};return e&&(Kt={overflowY:"scroll",height:"100vh",padding:"0px 10px 10px 10px"}),jsx(k$1.Provider,{value:P$1,children:jsx(va.Provider,{value:D,children:jsxs(rr,{execCommands:ot,eventDispatcher:Ie,redrawComponent:n.redrawFoldersComponent,formlayout:n.formLayout,params:n.params,onFolderSelected:hr,onFolderAdded:Jt,formData:n.formData,children:[jsxs("div",{id:"main-content-wrapper",className:o,children:[jsx("div",{className:"content",children:jsx("div",{className:"main-content on-scrollbar",style:Kt,children:jsxs("div",{id:"formCanvas",ref:c,style:{maxWidth:i,border:(Fe==null?void 0:Fe.border)===false?"none":void 0},children:[jsxs("form",{onSubmit:l=>{l.preventDefault();},style:{position:"relative"},children:[Fe&&!Fe.hideheader&&jsxs("div",{className:"form-header top-border-radius",style:{backgroundColor:(Fe==null?void 0:Fe.headerbackground)===false?"transparent":void 0},children:[jsx("div",{style:{flex:1,marginLeft:"0.5rem"},children:Fe&&yr(Fe)}),ie&&s.modalCloseFn!==void 0&&jsx("div",{style:{width:"2.5em"},children:jsx(lr,{onClick:()=>s.modalCloseFn(null),children:Pe__default.createElement(P)})})]}),Fe&&Fe.hideheader&&ie&&s.modalCloseFn!==void 0&&jsx("div",{style:{position:"absolute",top:"0.5rem",right:"0.5rem",zIndex:9999},children:jsx(lr,{size:"medium",onClick:l=>{l.stopPropagation(),s.modalCloseFn(null);},sx:{backgroundColor:"rgba(255, 255, 255, 0.95)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:Pe__default.createElement(P)})}),jsx("div",{style:pt,className:"form-container bottom-border-radius",children:jsx("div",{className:"form-container",children:jsx(m$1,{darkMode:false,noPadding:true,children:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Md,{eventDispatcher:Ie,context:n,formWidth:b$1,findRowItem:it,findSegmentItem:ur,findWidgetItem:fr,modal:ie,getActiveTabIndex:pr,setActiveTabIndex:ft,setRedrawComponent:gr,execCommands:ot,widgets:U.containerSetup})})})})})]}),I!==null&&jsx(d,{componentName:I.componentName,options:I.options,params:{params:(Xt=I.options)!=null&&Xt.contextParams?(Yt=I.options)==null?void 0:Yt.contextParams:n.params,formData:n.formData,execCommands:l=>ot(l),modalCloseFn:()=>vr(),modalCloseAndOpenFn:l=>jt(l)}})]})})}),(P$1==null?void 0:P$1.toLowerCase())==="free"&&!ie&&jsxs("div",{style:{textAlign:"center",padding:"12px 16px",fontSize:"13px",color:"#aaa"},children:["Powered by"," ",jsx("a",{href:"https://buildocs.com",target:"_blank",rel:"noopener noreferrer",style:{color:"#3498db",textDecoration:"none",fontWeight:500},children:"Buildocs"})]})]}),!ue&&jsx(a$2,{message:ge("Please wait...")}),!V.isFormEditorMode&&ce&&ce.fileId&&jsx(Suspense,{fallback:jsx(a$2,{message:ge("Loading viewer...")}),children:jsx(Rd,{fileId:ce.fileId,fileBase64:ce.data,fieldName:ce.fieldName,params:{...ce.context?ce.context:n.params,modalCloseFn:br}},nanoid(11))}),!V.isFormEditorMode&&(V==null?void 0:V.pluginCode)&&(V==null?void 0:V.formCode)&&jsx(a$3,{component:jsx(kd,{params:{id:V.id,parentId:V.parentId,pluginCode:V.pluginCode,formCode:V.formCode,guid:V.guid==null?"new":V.guid,pGuid:V.pGuid,modal:true,modalCloseFn:(l,R,C,L,q=null)=>Pt(l,C,L,q),modalCloseAndOpenFn:l=>jt(l),originator:V.originator,parent:V.parent,folderData:V.folderData,prefillData:V.prefillData},enableEventHandlers:true}),id:V.id,onCloseModal:Pt,parentId:V.parentId},V.id),V.isFormEditorMode&&(V==null?void 0:V.pluginCode)&&(V==null?void 0:V.formCode)&&jsx(a$3,{component:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Sd,{inPreviewMode:false,pluginCode:V.pluginCode,formCode:V.formCode,modal:true},nanoid(11))}),id:V.id,onCloseModal:()=>Pt(null,false,null),parentId:V.parentId,windowMode:"fullWindow"},V.id)]})})})}),Md=t=>{let e=0,o=i=>{for(var a in i)typeof i[a]=="object"&&i[a]!==null?o(i[a]):a==="tabIndex"&&(t.modal?i[a]=0:i[a]=++e);};return o(t.widgets._children),(t.widgets._children||[]).map(({id:i,tabId:a,panelId:d,type:r,component:m,properties:s})=>Pe__default.createElement(Ve.getFormComponent(m,s),{key:"key_"+i,id:i,tabId:a,panelId:d,className:r,context:{...t.context,formDimension:{width:t.formWidth,height:0}},properties:s,widgetsState:t.context.widgetsState,methodProvider:{eventDispatcher:t.eventDispatcher,findRowItem:t.findRowItem,findSegmentItem:t.findSegmentItem,findWidgetItem:t.findWidgetItem,getActiveTabIndex:t.getActiveTabIndex,setActiveTabIndex:t.setActiveTabIndex,setRedrawComponent:t.setRedrawComponent,execCommands:t.execCommands}},i))};
|
|
1
|
+
import {a as a$1}from'./chunk-POE6K4NQ.js';import {g,i as i$1,l as l$1,k as k$1,d}from'./chunk-3UNAMWG4.js';import {b as b$1,f,e as e$1,g as g$2}from'./chunk-FRAOYRZD.js';import {b as b$2,a as a$3}from'./chunk-22LEYH6Q.js';import {y,z,B,T,U,x,A,k as k$2}from'./chunk-TYVVEP34.js';import {b}from'./chunk-LBMVBVXW.js';import {n,e,k,l,p,o,f as f$1,g as g$1,h,m as m$1}from'./chunk-PN26J77S.js';import {i,m,P,t,A as A$1,E,N,s}from'./chunk-AR42AC7J.js';import {a as a$2}from'./chunk-SDIZEEZP.js';import {a,c}from'./chunk-5TBO732O.js';import*as Pe from'react';import Pe__default,{memo,useRef,useState,useEffect,createElement,createContext,lazy,useCallback,startTransition,Suspense,useContext,useMemo}from'react';import {withTranslation,useTranslation}from'react-i18next';import {useLocation,useNavigate}from'react-router-dom';import {nanoid}from'@reduxjs/toolkit';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Qa from'@mui/material/Box';import Xr from'@mui/material/Button';import Yr from'@mui/material/Tooltip';import Vi from'axios';import $i from'@mui/material/CircularProgress';import qi from'@mui/material/LinearProgress';import lr from'@mui/material/IconButton';import Ll from'@mui/material/InputAdornment';import Al from'@mui/icons-material/Visibility';import Vl from'@mui/icons-material/VisibilityOff';import {animated,useSpring}from'@react-spring/web';import {styled,alpha}from'@mui/material/styles';import Ul from'@mui/material/Collapse';import Gl from'@mui/material/Typography';import zl from'@mui/icons-material/FolderRounded';import {RichTreeView}from'@mui/x-tree-view/RichTreeView';import {treeItemClasses}from'@mui/x-tree-view/TreeItem';import {unstable_useTreeItem2}from'@mui/x-tree-view/useTreeItem2';import {TreeItem2Root,TreeItem2Content,TreeItem2IconContainer,TreeItem2Checkbox,TreeItem2Label}from'@mui/x-tree-view/TreeItem2';import {TreeItem2Icon}from'@mui/x-tree-view/TreeItem2Icon';import {TreeItem2DragAndDropOverlay}from'@mui/x-tree-view/TreeItem2DragAndDropOverlay';import yt from'@mui/material/ListItemIcon';import wt from'@mui/material/ListItemText';import Zl from'@mui/material/Menu';import xt from'@mui/material/MenuItem';import Fd from'i18next';import vd from'@mui/material/Backdrop';var Vn=a((Ue,An)=>{Object.defineProperty(Ue,"__esModule",{value:true});function Ae(t){return typeof t=="object"&&!("toString"in t)?Object.prototype.toString.call(t).slice(8,-1):t}var Cr=typeof process=="object"&&true;function _e(t,e){if(!t)throw Cr?new Error("Invariant failed"):new Error(e())}Ue.invariant=_e;var Bt=Object.prototype.hasOwnProperty,Ir=Array.prototype.splice,Fr=Object.prototype.toString;function Ze(t){return Fr.call(t).slice(8,-1)}var bt=Object.assign||(function(t,e){return Nt(e).forEach(function(o){Bt.call(e,o)&&(t[o]=e[o]);}),t}),Nt=typeof Object.getOwnPropertySymbols=="function"?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.keys(t)};function je(t){return Array.isArray(t)?bt(t.constructor(t.length),t):Ze(t)==="Map"?new Map(t):Ze(t)==="Set"?new Set(t):t&&typeof t=="object"?bt(Object.create(Object.getPrototypeOf(t)),t):t}var _n=(function(){function t(){this.commands=bt({},Tr),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,o){return e===o},this.update.newContext=function(){return new t().update};}return Object.defineProperty(t.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(e){this.update.isEquals=e;},enumerable:true,configurable:true}),t.prototype.extend=function(e,o){this.commands[e]=o;},t.prototype.update=function(e,o){var i=this,a=typeof o=="function"?{$apply:o}:o;Array.isArray(e)&&Array.isArray(a)||_e(!Array.isArray(a),function(){return "update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),_e(typeof a=="object"&&a!==null,function(){return "update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(i.commands).join(", ")+".")});var d=e;return Nt(a).forEach(function(r){if(Bt.call(i.commands,r)){var m=e===d;d=i.commands[r](a[r],d,a,e),m&&i.isEquals(d,e)&&(d=e);}else {var s=Ze(e)==="Map"?i.update(e.get(r),a[r]):i.update(e[r],a[r]),c=Ze(d)==="Map"?d.get(r):d[r];(!i.isEquals(s,c)||typeof s=="undefined"&&!Bt.call(e,r))&&(d===e&&(d=je(e)),Ze(d)==="Map"?d.set(r,s):d[r]=s);}}),d},t})();Ue.Context=_n;var Tr={$push:function(t,e,o){return Bn(e,o,"$push"),t.length?e.concat(t):e},$unshift:function(t,e,o){return Bn(e,o,"$unshift"),t.length?t.concat(e):e},$splice:function(t,e,o,i){return Dr(e,o),t.forEach(function(a){Ln(a),e===i&&a.length&&(e=je(i)),Ir.apply(e,a);}),e},$set:function(t,e,o){return Rr(o),t},$toggle:function(t,e){dt(t,"$toggle");var o=t.length?je(e):e;return t.forEach(function(i){o[i]=!e[i];}),o},$unset:function(t,e,o,i){return dt(t,"$unset"),t.forEach(function(a){Object.hasOwnProperty.call(e,a)&&(e===i&&(e=je(i)),delete e[a]);}),e},$add:function(t,e,o,i){return Nn(e,"$add"),dt(t,"$add"),Ze(e)==="Map"?t.forEach(function(a){var d=a[0],r=a[1];e===i&&e.get(d)!==r&&(e=je(i)),e.set(d,r);}):t.forEach(function(a){e===i&&!e.has(a)&&(e=je(i)),e.add(a);}),e},$remove:function(t,e,o,i){return Nn(e,"$remove"),dt(t,"$remove"),t.forEach(function(a){e===i&&e.has(a)&&(e=je(i)),e.delete(a);}),e},$merge:function(t,e,o,i){return Sr(e,t),Nt(t).forEach(function(a){t[a]!==e[a]&&(e===i&&(e=je(i)),e[a]=t[a]);}),e},$apply:function(t,e){return Pr(t),t(e)}},_t=new _n;Ue.isEquals=_t.update.isEquals;Ue.extend=_t.extend;Ue.default=_t.update;Ue.default.default=An.exports=bt(Ue.default,Ue);function Bn(t,e,o){_e(Array.isArray(t),function(){return "update(): expected target of "+Ae(o)+" to be an array; got "+Ae(t)+"."}),dt(e[o],o);}function dt(t,e){_e(Array.isArray(t),function(){return "update(): expected spec of "+Ae(e)+" to be an array; got "+Ae(t)+". Did you forget to wrap your parameter in an array?"});}function Dr(t,e){_e(Array.isArray(t),function(){return "Expected $splice target to be an array; got "+Ae(t)}),Ln(e.$splice);}function Ln(t){_e(Array.isArray(t),function(){return "update(): expected spec of $splice to be an array of arrays; got "+Ae(t)+". Did you forget to wrap your parameters in an array?"});}function Pr(t){_e(typeof t=="function",function(){return "update(): expected spec of $apply to be a function; got "+Ae(t)+"."});}function Rr(t){_e(Object.keys(t).length===1,function(){return "Cannot have more than one key in an object with $set"});}function Sr(t,e){_e(e&&typeof e=="object",function(){return "update(): $merge expects a spec of type 'object'; got "+Ae(e)}),_e(t&&typeof t=="object",function(){return "update(): $merge expects a target of type 'object'; got "+Ae(t)});}function Nn(t,e){var o=Ze(t);_e(o==="Map"||o==="Set",function(){return "update(): "+Ae(e)+" expects a target of type Set or Map; got "+Ae(o)});}});var mr=c(Vn());var Wn=withTranslation()(memo(function(e){let{id:o,tabId:i,panelId:a,context:d,methodProvider:r,widgetsState:m}=e,s=r.findRowItem(i,a,o);return s?Pe__default.createElement("div",{className:"row-container"},(s.item._children||[]).map(({rowId:c,id:b,component:T,properties:p})=>Pe__default.createElement(Ve.getFormComponent(T,p),{key:"key_"+b,tabId:i,panelId:a,rowId:c,segmentId:b,properties:p,widgetsState:m,methodProvider:r,context:{...d},segmentsCount:s.item._children.length},null))):null}));Wn.displayName="_Rowcontainer";var Hn=Wn;var Gn=withTranslation()(memo(function(e){let{tabId:o,panelId:i,rowId:a,segmentId:d,segmentsCount:r,properties:m,methodProvider:s,context:c,widgetsState:b}=e,T=s.findSegmentItem(o,i,a,d),p={...m.style};return Pe__default.createElement("div",{className:"rowSegment",style:p},(T.item._children||[]).map(({id:f,component:u,properties:g})=>{let v=g.groupname?g.groupname:g.name;return Pe__default.createElement(Ve.getFormComponent(u,g),{key:"key_"+f,context:{params:c.params,displayButtonLoader:c.displayButtonLoader,doValidateForm:c.doValidateForm,redrawComponent:c.redrawComponent,formDimension:c.formDimension,segmentDimensions:{minWidth:parseInt(p.minWidth)},tabIndex:c.tabIndex,formData:u.displayName==="_Fileuploader"||u.displayName==="_Label"||u.displayName==="_View"||u.displayName==="_Textinput"&&g.inputtype==="currency"?c.formData:[]},id:f,methodProvider:s,panelId:i,properties:{...g,visible:b!==void 0&&b.visibility[v]!==void 0?b.visibility[v]:g.visible,readonly:b!==void 0&&b.readonly[v]!==void 0?b.readonly[v]:g.readonly},rowId:a,segmentId:d,segmentsCount:r,tabId:o,value:c.formData!==void 0?c.formData[v]:void 0,fieldAllowedValues:c!=null&&c.fieldAllowedValues?c.fieldAllowedValues[v]:void 0,validationMessage:c!=null&&c.formValidationData&&c.formValidationData[v]!==void 0?c.formValidationData[v]:null},null)}))}));Gn.displayName="_Rowsegment";var zn=Gn;function Hr(t,e){return {id:t,value:e}}var qn=withTranslation()(memo(function(e){var A;let o=useRef(null),{datalength:i,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:b$1,readonly:T$1,regex:p,searchbar:f,size:u,style:g,tabIndex:v,uppercasemode:w,variant:S,visible:x}=e.properties,E=useLocation(),{viewPort:W}=b(),{tabId:_}=e,[I,F]=useState(String((A=e.value)!=null?A:"")),[h,$]=Pe__default.useState([]),ee=!!(I.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var P;F(String((P=e.value)!=null?P:""));},[e.value]),useEffect(()=>{let P=[];if(e.fieldAllowedValues){for(let H in e.fieldAllowedValues)P.push(Hr(H,e.fieldAllowedValues[H]));$(P);}},[e.fieldAllowedValues]);let ne=P=>{var H;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:P,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:_,hasParentForm:T.hasParentForm(),originator:(H=e.context.params)==null?void 0:H.originator})});},D=P=>{F(P);};return jsx(n,{autoFocus:false,data:h,disabled:!!(T$1&&!r),error:ee,helperText:ee?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:v,style:{...g},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:i,name:s,onBlur:P=>{ne(P.target.value);},onInput:P=>{D(P.target.value),W.isMobileDevice&&ne(P.currentTarget.value);},onChange:P=>{I.trim()===""&&ne(P.target.value);},placeholder:b$1,readOnly:!!(T$1&&!r),regEx:p,searchBar:f,size:u!=null?u:"small",type:"text",inputtype:e.properties.inputType,toUpperCase:w,value:I,variant:S,visible:x})}));qn.displayName="_Input";var Jn=qn;var Qn=withTranslation()(memo(function(e){var P;let o=useRef(null),{datalength:i$1,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:b$1,readonly:T$1,regex:p,size:f,style:u,tabIndex:g,uppercasemode:v,variant:w,visible:S}=e.properties,x=useLocation(),{viewPort:E}=b(),{tabId:W}=e,[_,I]=useState(String((P=e.value)!=null?P:"")),F=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),[h,$]=useState(false),{t:ee}=useTranslation(),ne=()=>{navigator.clipboard.writeText(_).then(()=>{$(true),setTimeout(()=>$(false),2e4);});};useEffect(()=>{var H;I(String((H=e.value)!=null?H:""));},[e.value]);let D=H=>{var K;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:H,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:x.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(K=e.context.params)==null?void 0:K.originator})});},A=H=>{I(H);};return jsxs(Qa,{display:"flex",alignItems:"flex-start",gap:0,children:[jsx(n,{autoFocus:false,disabled:!!(T$1&&!r),error:F,helperText:F?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:g,style:{...u},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:i$1,name:s,onBlur:H=>{D(H.target.value);},onInput:H=>{A(H.target.value),E.isMobileDevice&&D(H.currentTarget.value);},onChange:H=>{_.trim()===""&&D(H.target.value);},placeholder:b$1,readOnly:!!(T$1&&!r),regEx:p,size:f,type:"text",inputtype:e.properties.inputType,toUpperCase:v,value:_,variant:w,visible:S}),S&&jsx(Yr,{title:ee(h?"copied!":"copy to clipboard"),children:jsx(Xr,{variant:"contained",style:{backgroundColor:"#C0C0C0",borderRadius:"0px 4px 4px 0px",boxShadow:"none",marginLeft:"-3px",border:"2px solid #C0C0C0",lineHeight:"24px",fontSize:"11px"},onClick:ne,startIcon:jsx(i,{}),children:ee("copy")})})]})}));Qn.displayName="_InputWCopy";var Kn=Qn;var Yn=withTranslation()(memo(function(e){useRef(null);let {tabId:i,id:a,context:d,widgetsState:r}=e,m=e.methodProvider.findWidgetItem(a),s=e.methodProvider.getActiveTabIndex(i,a),c=(p,f,u,g)=>{f||(p.target.style.background=g,p.target.style.color=u);},b=(p,f,u,g)=>{f||(p.target.style.background=g,p.target.style.color=u);},T=({children:p,...f})=>jsx(A,{onPointerUp:u=>u.stopPropagation(),onMouseOver:u=>c(u,f.selected,f.item_active_color,f.item_active_background_color),onMouseOut:u=>b(u,f.selected,f.item_default_color,f.item_default_background_color),style:{borderRadius:"5px 5px 0 0",marginRight:"1px",color:f.selected?f.item_active_color:f.item_default_color,background:f.selected?f.item_active_background_color:f.item_default_background_color,fontSize:f.item_fontsize,fontWeight:f.item_fontweight},selected:f.selected,children:p},f.id);return T.tabsRole="Tab",e.properties.visible?Pe__default.createElement("div",{className:"form-tab-widget"},jsxs(y,{selectedIndex:s,onSelect:p=>e.methodProvider.setActiveTabIndex(i,a,p),children:[jsx(z,{children:(m.item._children||[]).map(({properties:p},f)=>!p.item_visible||r&&r.visibility&&r.visibility[p.item_name]===false?null:createElement(T,{...m.item.properties.tabsetup,...p,key:"TabCaptionComponent_"+a+"_"+f},p.item_title))}),(m.item._children||[]).map(({_children:p},f)=>jsx(B,{children:(p||[]).map(({tabId:u,panelId:g,id:v,type:w,component:S,properties:x},E)=>Pe__default.createElement(Ve.getFormComponent(S,x),{key:"tabSubPanel_"+E,id:v,tabId:u,panelId:g,properties:{...x,visible:r!==void 0&&r.visibility[x.name]!==void 0?r.visibility[x.name]:x.visible,readonly:r!==void 0&&r.readonly[x.name]!==void 0?r.readonly[x.name]:x.readonly},className:w,widgetsState:r,methodProvider:e.methodProvider,context:{...d},segmentsCount:m.item._children.length,fieldAllowedValues:d!=null&&d.fieldAllowedValues?d.fieldAllowedValues[x.name]:void 0},null))},"TabPanel_"+a+"_"+f))]})):null}));Yn.displayName="_TabBox";var Zn=Yn;function li(t,e){if(!e||Array.isArray(e)&&e.length===0)return t;let o=e;return t.replace(/<b>@(\w+)<\/b>|@(\w+)/g,(i,a,d)=>{let r=(a||d).toLowerCase(),m=o[r];return typeof m=="string"?a?`<b>${m}</b>`:m:i})}var ta=withTranslation()(memo(function(e){let{title:o,style:i,verticalalign:a,visible:d}=e.properties,r={paddingTop:"0px"};if(a==="bottom"&&(r.paddingTop="10px"),!d)return null;let m=li(o,e.context.formData);return jsx("div",{style:{...i,...r},children:jsx("div",{style:{...i},dangerouslySetInnerHTML:{__html:m}})})}));ta.displayName="_Label";var oa=ta;var aa=withTranslation()(memo(function(e$1){let o=useRef(null),{defaultvalue:i,id:a,ignorereadonly:d,label:r,labelplacement:m,name:s,onchangehandler:c,readonly:b,style:T$1,tabIndex:p,visible:f}=e$1.properties,u=s,g=e$1.value||"",v=useLocation(),{tabId:w}=e$1,S=!!(!g&&e$1.validationMessage!=null&&e$1.context.doValidateForm);return useEffect(()=>{!e$1.value&&i&&e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:e$1.properties.value,widgetEvent:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:w,hasParentForm:T.hasParentForm()})});},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:T$1.textAlign,height:"100%"},children:jsx(e,{checkedIcon:void 0,defaultChecked:!!(e$1.value===void 0&&i),disabled:!!(b&&!d),error:S,helperText:S?e$1.validationMessage:"",icon:void 0,inputProps:{id:a,tabIndex:p},inputRef:o,labelText:r,labelPlacement:m,name:u,onChange:x=>{e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:x.target.checked?e$1.properties.value:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:v.pathname,parentWidgetId:w,hasParentForm:T.hasParentForm()})});},selectedValue:g,value:e$1.properties.value,visible:f})})}));aa.displayName="_Checkbox";var ra=aa;var la=withTranslation()(memo(function(e){let o=useRef(null),{defaultvalue:i,groupname:a,id:d,ignorereadonly:r,label:m,labelplacement:s,name:c,onchangehandler:b,readonly:T$1,style:p,tabIndex:f,visible:u}=e.properties,g=useLocation(),{tabId:v}=e,w=a||c;let x=e.value||"",E=!!(e.validationMessage!=null&&e.context.doValidateForm),W=_=>{var I;e.methodProvider.eventDispatcher({widgetName:w,widgetValue:_,widgetEvent:b?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(I=e.context.params)==null?void 0:I.originator})});};return useEffect(()=>{!x&&i&&W(e.properties.value);},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:p.textAlign,height:"100%"},children:jsx(k,{defaultValue:i?e.properties.value:"",disabled:!!(T$1&&!r),inputProps:{id:d,tabIndex:f,style:{...p}},error:E,helperText:E?e.validationMessage:"",inputRef:o,labelText:m,labelPlacement:s,name:w,onChange:_=>{x!==_.target.value.trim()&&W(_.target.value);},selectedValue:x,value:e.properties.value,visible:u})})}));la.displayName="_Radio";var da=la;var sa=withTranslation()(memo(function(e){var ne;let o=useRef(null),{runFormEvent:i,viewPort:a}=b(),{id:d,autocompleteTextArea:r,ignorereadonly:m,label:s,name:c,onchangehandler:b$1,placeholder:T$1,required:p,requiredmessage:f,readonly:u,size:g,style:v,tabIndex:w,variant:S,visible:x}=e.properties,E=useLocation(),{tabId:W}=e,[_,I]=useState(String((ne=e.value)!=null?ne:""));useEffect(()=>{var D;I(String((D=e.value)!=null?D:""));},[e.value]);let F=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),h=D=>{var A;e.methodProvider.eventDispatcher({widgetName:c,widgetValue:D,widgetEvent:b$1?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(A=e.context.params)==null?void 0:A.originator})});},$=async D=>{var A,P,H;try{let K=await i({pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,projectGuid:e.context.params.pGuid,pGuid:e.context.params.pGuid,formData:(A=e.context.formData)!=null?A:{},widgetContext:JSON.stringify({}),widgetEvent:U.onGetCustomResponse,widgetName:c,widgetValue:JSON.stringify({methodName:"getAutoCompleteData",value:D})});if(((P=K.meta)==null?void 0:P.requestStatus)==="fulfilled"){let N=K.payload,k=(H=N==null?void 0:N.FECommand)==null?void 0:H.CustomResponse;if(Array.isArray(k))return k.filter(J=>typeof J=="string").map(J=>({label:J}))}}catch(K){}return []},ee=D=>{I(D);};return jsx(n,{autocompleteTextArea:r,autoFocus:false,disabled:!!(u&&!m),id:d,inputProps:{id:d,tabIndex:w,readOnly:!!(u&&!m),style:{...v}},error:F,helperText:F?e.validationMessage:"",InputProps:{},inputRef:o,label:s,multiline:true,name:c,onAutoCompleteChange:r?D=>$(D):void 0,onBlur:D=>{h(D.target.value);},onInput:D=>{ee(D.target.value),a.isMobileDevice&&h(D.currentTarget.value);},onChange:D=>{_.trim()===""&&h(D.target.value);},placeholder:T$1,readOnly:!!(u&&!m),size:g,type:"text",value:_,variant:S,visible:x})}));sa.displayName="_Textarea";var ma=sa;function ca(t,e){return {id:t,value:e}}var Ot="\xA4",ua=withTranslation()(memo(function(e){var P,H;let o=useRef(null),[i,a]=Pe__default.useState(null),[d,r]=Pe__default.useState([]),m=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ot):[],[s,c]=Pe__default.useState(m),{id:b,ignorereadonly:T$1,label:p,multiple:f,name:u,onchangehandler:g,placeholder:v,readonly:w,rendertype:S,searchbar:x,size:E,tabIndex:W,variant:_,visible:I,dropvalues:F}=e.properties,h=useLocation(),{tabId:$}=e,{t:ee}=useTranslation();useEffect(()=>{let K=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ot):[];c(K);},[e.value]),useEffect(()=>{let K=S==="none"?[{id:"",value:""}]:[];if(e.fieldAllowedValues&&Object.keys(e.fieldAllowedValues).length>0){for(let N in e.fieldAllowedValues)K.push(ca(N,e.fieldAllowedValues[N]));r(K);}else if(F&&Array.isArray(F)&&F.length>0){for(let N of F)typeof N=="object"&&N!==null&&K.push(ca(N.id||"",N.value||""));r(K);}},[e.fieldAllowedValues,F]),useEffect(()=>{var K;if(i===false){let N=typeof e.value!="string"?e.value:[];(JSON.stringify(N)!==JSON.stringify(s)||s.length===0)&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:s.length>0?s.join(Ot):[],widgetEvent:g?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:$,hasParentForm:T.hasParentForm(),originator:(K=e.context.params)==null?void 0:K.originator,folderData:e.context.params.folderData})});}},[i]);let ne=K=>{let{target:{value:N}}=K,k;f?k=typeof N=="string"?N.split(","):N:k=typeof N=="string"?[N]:N,c(k);},D=e.context.formDimension.width/e.segmentsCount;D=D<e.context.segmentDimensions.minWidth?e.context.segmentDimensions.minWidth:D-60;let A=!!(s.length===0&&e.validationMessage!=null&&e.context.doValidateForm);return jsx(l,{darkMode:false,data:d,error:A,helperText:A?e.validationMessage:"",inputProps:{tabIndex:W,style:{maxWidth:`${D}px`}},inputRef:o,onOpen:()=>{a(true);},onClose:()=>{a(false);},onChange:ne,id:b,label:p,multiple:f,placeholder:v,readOnly:w&&!T$1,renderType:S,noOptionsText:(H=(P=e.properties)==null?void 0:P.noOptionsLabel)!=null?H:ee("No options"),searchBar:x,selectDisplayProps:{style:{maxWidth:"100%",whiteSpace:S==="chip"?"normal":"nowrap"}},selectedValue:s,size:E,variant:_,width:"auto",visible:I})}));ua.displayName="_SelectBox";var fa=ua;var pa=withTranslation()(memo(function(e){var m;let{style:o,visible:i}=(m=e.properties)!=null?m:{},[a,d]=useState(false);if(useEffect(()=>{d(true);},[]),!a)return null;let r="form-widget form-placeholder-widget";return i||(r+=" visibilityOff"),jsx("div",{className:r,style:{...o,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"}})}));pa.displayName="_Placeholder";var ga=pa;var ha=createContext({});function ba(){return useContext(ha)}var va=ha;var Ji=lazy(()=>import('./fileviewer-YMKT5J4T.js'));function ji(){let[,t]=useState(0);return ()=>t(e=>e+1)}var Ca=withTranslation()(memo(function(e){var Ce,ge;ji();let [i,a]=useState([]),[d,r]=useState(e.context.params),[m,s]=useState(false),[c,b$3]=useState(null),[T$1,p$1]=useState(false),[f$1,u]=useState(null),[g$1,v]=useState(0),{t:w}=useTranslation(),{iframeMode:S}=g(),x=ba(),E=Y=>{var G;return (G=x[Y])!=null?G:w(Y)},{UserDialog:W}=b$1(),_=f(),{style:I,readonly:F,visible:h}=e.properties,[$,ee]=useState({showDialog:false,dialogTitle:"",dialogContent:"",buttonAgree:"",buttonDisagree:"",callBackFunc:()=>{}}),{appSettings:ne,viewPort:D,runFormDeleteFileEvent:A,runFormDownloadFileEvent:P,runFormGetLinkedFileEvent:H,runFormGetLinkedFileMetaEvent:K,runFormUploadFiles:N}=b();useEffect(()=>{r(e.context.params);},[e.context.params]),useEffect(()=>{let Y=e.value?JSON.parse(e.value):[];return Y&&(a(k(Y,100)),s(true)),()=>{i&&(s(false),i.forEach(G=>{G.preview&&URL.revokeObjectURL(G.preview);}));}},[]);let k=(Y,G)=>{let M=[];return Y.forEach((te,O)=>{let n=new File([],te,{type:"image/jpeg"});Object.assign(n,{preview:null,uploadProgress:G}),M.push(n);}),M},J=useCallback(async Y=>{var U;let M=(await K({...d,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:Y,context:{action:"Preview"}})).payload,{linkedFileSize:te,linkedFileName:O,mimeType:n}=M;if(!te)throw new Error("File data or metadata is missing");let oe=(U=ne==null?void 0:ne.MAX_DOWNLOAD_NOCHUNK_FILESIZE)!=null?U:b$2.MAX_DOWNLOAD_NOCHUNK_FILESIZE;return te>oe?{type:"formbuilder/getlinkedfile",payload:{linkedFile:null,linkedFileSize:te,linkedFileName:O},meta:{requestStatus:"fulfilled"}}:await H({...d,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:Y,context:{action:"Load"}})},[d,e.context.params.pGuid,e.properties.name]),ie=Y=>{$.callBackFunc(Y);},pe=async(Y,G)=>{Y&&await A({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:G}).then(M=>{if(M.meta.requestStatus==="fulfilled"){let te={...M.payload};te.linkedFileDeleteSuccess&&(_({toastID:nanoid(11),msg:E("The file has been successfully deleted"),clearQueue:false,hideProgressBar:false}),a(O=>O.filter(n=>n.name!==G)),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(te.linkedFiles),widgetEvent:null,widgetContext:null}));}}),ee({...$,showDialog:false,callBackFunc:M=>{}});},xe=async Y=>{if(Y)try{let G=await P({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:Y}),M=new Blob([G]),te=window.URL.createObjectURL(M),O=document.createElement("a");O.href=te,O.setAttribute("download",Y.split("/").pop()||"downloadedFile"),document.body.appendChild(O),O.click(),document.body.removeChild(O),window.URL.revokeObjectURL(te);}catch(G){}},de=useCallback(async(Y,G)=>(G&&ee({showDialog:true,dialogTitle:E("Confirmation"),dialogContent:E("Are you sure you want to delete file?"),buttonAgree:E("Continue"),buttonDisagree:E("Close"),callBackFunc:M=>pe(M,G)}),null),[e.context.params,w]),V=useCallback(async(Y,G)=>(G&&xe(G),null),[e.context.params]),ce=useCallback((Y,G)=>{G&&startTransition(()=>{b$3(G);});},[]),X=()=>{b$3(null);},ue=useCallback(async(Y,G)=>{var M,te;if(Y){let O=new FormData;for(let U in e.context.params)e.context.params.hasOwnProperty(U)&&O.append(U,e.context.params[U]);O.append("fieldName",e.properties.name),Y.forEach(U=>{O.append("files",U);}),O.append("widgetContext",JSON.stringify({hasParentForm:T.hasParentForm(),originator:(M=e.context.params)==null?void 0:M.originator,folderData:(te=e.context.params)==null?void 0:te.folderData})),O.append("widgetEvent",U.onFileUploadEvent),O.append("widgetName",e.properties.name),O.append("formData",JSON.stringify({...e.context.formData}));let n=Vi.CancelToken.source(),oe=Y.map(U=>Object.assign(U,{preview:URL.createObjectURL(U),uploadProgress:0}));a(i.concat(oe)),u(0),await N({content:O,cancelTokenSource:n,onUploadProgress:U=>{let ke=U.total?Math.round(U.loaded*100/U.total):0;u(ke);}}).then(U=>{var ze,$e,Ke;let ke=[];if(U.meta.requestStatus==="fulfilled"){let ve={...U.payload};if((ze=ve.FECommand)!=null&&ze.FormValidationData&&Object.keys(ve.FECommand.FormValidationData).length>0){oe.forEach(Ie=>{Ie.preview&&URL.revokeObjectURL(Ie.preview);}),u(null),v(Ie=>Ie+1);let rt=i.filter(Ie=>Ie.uploadProgress===100);a(rt),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(i),widgetEvent:null,widgetContext:null,feCommand:ve.FECommand});}else if(ve.linkedFiles&&e.properties.name){ke=k(ve.linkedFiles,100);let rt=ke.map(Ie=>{let it=Ie;return it.uploadProgress=100,it.preview=null,it});oe.forEach(Ie=>{Ie.preview&&URL.revokeObjectURL(Ie.preview);}),u(null),v(Ie=>Ie+1),a(rt),r({...e.context.params,guid:(Ke=($e=ve.FECommand)==null?void 0:$e.ReplaceContextRecordGuid)==null?void 0:Ke.guid}),ve.FECommand={...ve.FECommand,UpdateFieldAllowedValues:ve.fieldAllowedValues,UpdateFormData:ve.data},e.methodProvider.execCommands(ve.FECommand);}}});}},[i,e.context.params,e.methodProvider,e.properties.name,e.value]);return !m||!h?null:jsxs("div",{style:{...I,lineHeight:"1.1em"},children:[jsx(W,{...$,handleDialogClose:ie}),jsxs("div",{style:{position:"relative",zIndex:1,isolation:"isolate"},children:[S&&jsx("div",{style:{position:"absolute",inset:0,zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.85)",borderRadius:4,padding:"8px 16px",textAlign:"center",fontSize:"0.875rem",color:"#555"},children:w("File upload is available only when using the SDK")}),jsx(p,{defaultText:(ge=(Ce=e.properties)==null?void 0:Ce.dragDropLabel)!=null?ge:E("Drag and Drop..."),tryGetLinkedFile:J,onDeleteButtonPress:de,onDownloadButtonPress:V,onDownloadText:E("Download"),onDeleteText:E("Delete"),filesData:i,onDragText:"On drop text",onFilesDrop:ue,onPreviewButtonPress:ce,isMobileDevice:D.isMobileDevice,isReadonly:F},g$1),f$1!==null&&jsx(qi,{variant:"determinate",value:f$1,style:{marginTop:6,borderRadius:3,height:8}})]}),c!=null&&jsx(Suspense,{fallback:jsx($i,{}),children:jsx(Ji,{fileId:c,fileBase64:null,fieldName:e.properties.name,params:{...e.context.params,modalCloseFn:X}},nanoid(11))})]})}));Ca.displayName="_Fileuploader";var Ia=Ca;var Fa=(t,e)=>"#"+t.replace(/^#/,"").replace(/../g,o=>("0"+Math.min(255,Math.max(0,parseInt(o,16)+e)).toString(16)).substring(-2)),Da=withTranslation()(memo(function(e){var w,S;let{buttontype:o$1,colorSchema:i,fullWidth:a,name:d,style:r,tabIndex:m,title:s,variant:c,visible:b}=e.properties,T$1=useLocation(),{tabId:p}=e,f=(S=(w=e.context)==null?void 0:w.displayButtonLoader)!=null?S:false;if(!b)return null;let u=r.backgroundColor,g=u?Fa(u,-50):"";i&&(u=i+".main",g=i+".hover");let v={};return c==="outlined"?(Object.assign(v,{"&.MuiButtonBase-root":{fontSize:r.fontSize,fontWeight:r.fontWeight,border:"1px solid"+u,cursor:"pointer"}}),Object.assign(v,{"&.MuiButtonBase-root:hover":{border:g?"1px solid"+Fa(g,-50):""}})):(Object.assign(v,{"&.MuiButtonBase-root":{fontSize:r.fontSize,fontWeight:r.fontWeight,backgroundColor:u,cursor:"pointer"}}),Object.assign(v,{"&.MuiButtonBase-root:hover":{backgroundColor:g}})),jsx("div",{children:jsx(o,{variant:c,label:s,loading:f,onPointerUp:()=>{var x,E;e.methodProvider.eventDispatcher({widgetName:d,widgetValue:null,widgetEvent:U.getFormButtonEvent(o$1),widgetContext:JSON.stringify({referer:T$1.pathname,parentWidgetId:p,hasParentForm:T.hasParentForm(),originator:(x=e.context.params)==null?void 0:x.originator,parent:{widgetName:d,params:{pGuid:e.context.params.pGuid,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid}},folderData:(E=e.context.params)==null?void 0:E.folderData})});},fullWidth:a,sx:v,tabIndex:m})})}));Da.displayName="_Button";var Pa=Da;var Ra=withTranslation()(memo(function(e){var E,W,_;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:b,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:v}=e,w=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),S=I=>{var F;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:I!=null?I:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(F=e.context.params)==null?void 0:F.originator})})};useEffect(()=>{!e.value&&d==="today"&&S(a$1().utc().format());},[]);let x=(W=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:W.substr(0,2);return jsx(f$1,{id:i,defaultvalue:d,disabled:!!(b&&!a),error:w,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:w?e.validationMessage:"",inputRef:o,label:m,locale:x,name:s,onBlur:I=>{S(I?a$1(I).utc().format():null);},size:T$1,type:"datepicker",value:(_=e.value)!=null?_:"",variant:f,visible:u})}));Ra.displayName="_Textinput";var Sa=Ra;var ka=withTranslation()(memo(function(e){var _,I,F;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:b,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:v}=e,[w,S]=useState(String((_=e.value)!=null?_:"")),x=!!(!w&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var h;S(String((h=e.value)!=null?h:""));},[e.value]);let E=h=>{var $;return S(h),e.methodProvider.eventDispatcher({widgetName:s,widgetValue:h!=null?h:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:($=e.context.params)==null?void 0:$.originator})})};useEffect(()=>{if(!e.value&&d){let h=d==="now"?a$1().utc().format():d==="start of day"?a$1().startOf("day").utc().format():null;h&&E(h);}},[]);let W=(F=(I=e==null?void 0:e.i18n)==null?void 0:I.language)==null?void 0:F.substr(0,2);return jsx(g$1,{autoFocus:false,defaultvalue:d,disabled:!!(b&&!a),error:x,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:x?e.validationMessage:"",id:i,inputRef:o,label:m,locale:W,name:s,onChange:h=>{E(h?a$1(h).utc().format():null);},size:T$1,value:w,variant:f,visible:u})}));ka.displayName="_Textinput";var Ma=ka;var Ba=withTranslation()(memo(function(e){var E,W,_;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:b,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:v}=e,w=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),S=I=>{var F;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:I!=null?I:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(F=e.context.params)==null?void 0:F.originator})})};useEffect(()=>{!e.value&&d==="now"&&S(a$1().utc().format());},[]);let x=(W=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:W.substr(0,2);return jsx(h,{id:i,defaultvalue:d,disabled:!!(b&&!a),error:w,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:w?e.validationMessage:"",inputRef:o,label:m,locale:x,name:s,onBlur:I=>{S(I?a$1(I).utc().format():null);},size:T$1,type:"datetimepicker",value:(_=e.value)!=null?_:"",variant:f,visible:u})}));Ba.displayName="_Textinput";var Na=Ba;var _a=withTranslation()(memo(function(e){var D;let o=useRef(null),{datalength:i,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:b$1,phoneformat:T$1,readonly:p,regex:f,size:u,style:g,tabIndex:v,uppercasemode:w,variant:S,visible:x}=e.properties,E=useLocation(),{i18n:W}=useTranslation(),{viewPort:_}=b(),{tabId:I}=e,[F,h]=useState(String((D=e.value)!=null?D:"")),$=!!(e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{e.value!==void 0&&e.value!==null&&h(String(e.value));},[e.value]);let ee=A=>{var P;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:A,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:I,hasParentForm:T.hasParentForm(),originator:(P=e.context.params)==null?void 0:P.originator})});},ne=A=>{h(A);};return jsx(n,{autoFocus:false,disabled:!!(p&&!r),error:$,helperText:$?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:v,style:{...g}},InputProps:{},inputRef:o,label:m,maxCharCount:i,name:s,onBlur:A=>{ee(A.target.value);},onInput:A=>{ne(A.target.value),_.isMobileDevice&&ee(A.currentTarget.value);},placeholder:b$1,locale:W==null?void 0:W.language,phoneFormat:T$1||void 0,readOnly:!!(p&&!r),regEx:f,size:u!=null?u:"small",type:T$1?"phone":"text",toUpperCase:w,value:F,variant:S,visible:x})}));_a.displayName="_PhoneInput";var La=_a;var Oa=withTranslation()(memo(function(e){var ce;let o=useRef(null),{t:i,i18n:a}=useTranslation(),d=a==null?void 0:a.language,{currency_format:r,currency_assymbol:m,currency_currencydisplay:s,currency_fixedlocale:c,datalength:b$1,id:T$1,ignorereadonly:p,label:f,name:u,onchangehandler:g,placeholder:v,readonly:w,regex:S,size:x,style:E,tabIndex:W,uppercasemode:_,variant:I,visible:F}=e.properties,h=useLocation(),{viewPort:$}=b(),{tabId:ee}=e,[ne,D]=useState(String((ce=e.value)!=null?ce:"0")),[A,P]=useState(false),[H,K]=useState(0),N=useRef(0);useEffect(()=>{var X;D(String((X=e.value)!=null?X:"0"));},[e.value]),useEffect(()=>{e.validationMessage!=null&&(N.current+=1,P(false));},[e.context.formValidationData]);let k=!!(!A&&e.validationMessage!=null&&e.context.doValidateForm),J=X=>{var ue;e.methodProvider.eventDispatcher({widgetName:u,widgetValue:X,widgetEvent:g?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:ee,hasParentForm:T.hasParentForm(),originator:(ue=e.context.params)==null?void 0:ue.originator})});},ie=X=>{D(X);},pe=r==="fixed-locale"&&c?c:d,xe=()=>{var Ce;if(s==="")return "";let X=e.context.formData,ue=e.properties.currency_inputfield;return ue&&(X!=null&&X[ue])?X[ue]:e.properties.currency_currency?e.properties.currency_currency:(r==="locale"||r==="fixed-locale")&&(Ce=k$2(pe!=null?pe:""))!=null?Ce:""},de=s==="symbol"?true:s==="code"?false:m!=null?m:false,V=r==="locale"||r==="fixed-locale"?"locale":r!=null?r:"";return jsx(n,{autoFocus:false,currency:xe(),disabled:!!(w&&!p),error:k,helperText:k?e.validationMessage:"",id:T$1,inputProps:{id:T$1,tabIndex:W,style:{...E,textAlign:"right"}},InputProps:{},inputRef:o,label:f,locale:pe,maxCharCount:b$1,name:u,onBlur:X=>{P(true);let ue=X.target.value;(ue==="0"||ue==="")&&K(Ce=>Ce+1),J(ue);},onInput:X=>{ie(X.target.value),$.isMobileDevice&&J(X.currentTarget.value);},onChange:X=>{ne.trim()===""&&J(X.target.value);},placeholder:v,readOnly:!!(w&&!p),regEx:S,size:x,type:"currency",toUpperCase:_,value:ne,variant:I,visible:F,format:V,assymbol:de},H)}));Oa.displayName="_CurrencyInput";var Wa=Oa;var Ua=withTranslation()(memo(function(e){var K,N;let o=useRef(null),{t:i,i18n:a}=useTranslation(),d=(K=a==null?void 0:a.language)==null?void 0:K.substring(0,2),{datalength:r,id:m,forcereadonly:s,ignorereadonly:c,label:b$1,name:T$1,onchangehandler:p,placeholder:f,readonly:u,regex:g,size:v,style:w,tabIndex:S,uppercasemode:x,variant:E,visible:W}=e.properties,[_,I]=useState(false),{viewPort:F}=b(),h=useLocation(),{tabId:$}=e,[ee,ne]=useState(String((N=e.value)!=null?N:"")),D=!!(ee.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var k;ne(String((k=e.value)!=null?k:""));},[e.value]);let A=()=>{I(k=>!k);},P=k=>{var J;e.methodProvider.eventDispatcher({widgetName:T$1,widgetValue:k,widgetEvent:p?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:$,hasParentForm:T.hasParentForm(),originator:(J=e.context.params)==null?void 0:J.originator})});},H=k=>{ne(k);};return jsx(n,{autoFocus:false,disabled:!!(u&&!c),error:D,helperText:D?e.validationMessage:"",id:m,inputProps:{id:m,tabIndex:S,style:{...w,textAlign:"center"}},InputProps:{endAdornment:jsx(Ll,{position:"end",children:jsx(lr,{onClick:A,edge:"end",children:_?jsx(Al,{}):jsx(Vl,{})})})},inputRef:o,label:b$1,locale:d,maxCharCount:r,name:T$1,onBlur:k=>{P(k.target.value);},onInput:k=>{H(k.target.value),F.isMobileDevice&&P(k.currentTarget.value);},onChange:k=>{ee.trim()===""&&P(k.target.value);},placeholder:f,readOnly:!!(u&&!c),regEx:g,size:v,type:"text",toUpperCase:x,value:ee,variant:E,visible:W,inputtype:_?"text":"password"})}));Ua.displayName="_PasswordInput";var Ga=Ua;var qa=styled(TreeItem2Root)(({theme:t})=>({color:t.palette.mode==="light"?t.palette.grey[800]:t.palette.grey[400],position:"relative",[`& .${treeItemClasses.groupTransition}`]:{marginLeft:t.spacing(3.5)}})),nd=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{color:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px",backgroundColor:t.palette.mode==="light"?t.palette.grey[300]:t.palette.grey[700]}},"&:hover":{backgroundColor:alpha(t.palette.primary.main,.1),color:t.palette.mode==="light"?t.palette.primary.main:"white"},"&.Mui-focused, &.Mui-selected, &.Mui-selected.Mui-focused":{backgroundColor:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark,color:t.palette.primary.contrastText,fontWeight:700}})),ad=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px"}}})),rd=animated(Ul);function Ja(t){let e=useSpring({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return jsx(rd,{style:e,...t})}var id=styled(Gl)({color:"inherit",fontWeight:500});function ja({icon:t,expandable:e,children:o,isFirstRootNode:i,...a}){return jsxs(TreeItem2Label,{...a,sx:{display:"flex",alignItems:"center",fontWeight:i?"700":"normal",backgroundColor:"transparent","&.Mui-focused, &.Mui-selected":{backgroundColor:"transparent"}},children:[t&&jsx(Qa,{component:t,className:"labelIcon",color:"inherit",sx:{mr:1,fontSize:"1.2rem"}}),jsx(id,{sx:{fontSize:i?"1rem":"0.9rem",fontWeight:i?"700":"normal"},children:o})]})}var Xa=t=>Array.isArray(t)?t.length>0&&t.some(Xa):!!t,Ct=t$1=>{let e=null,o=t$1.action,i=t$1.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return o==="add"?e=jsx(t,{style:i}):o==="edit"?e=jsx(A$1,{style:i}):o==="share"?e=jsx(E,{style:i}):o==="trash"&&(e=jsx(N,{style:i})),e},ld=Pe.forwardRef(function(e,o){let{id:i,itemId:a,label:d,disabled:r,children:m$1,item:s,index:c,mode:b$1,setSelectedItem:T$1,treeCheckedItems:p,properties:f,disableRootItem:u,userData:g,formData:v,deletePrompt:w,selectedItem:S,execCommands:x$1,eventDispatcher:E,...W}=e,{getRootProps:_,getContentProps:I,getIconContainerProps:F,getCheckboxProps:h,getLabelProps:$,getGroupTransitionProps:ee,getDragAndDropOverlayProps:ne,status:D}=unstable_useTreeItem2({id:i,itemId:a,children:m$1,label:d,disabled:r,rootRef:o}),A=useLocation(),{t:P}=useTranslation(),[H,K]=Pe.useState(null),N=!!H,k=Xa(m$1),J=c===0?void 0:zl,[ie,pe]=Pe.useState(D.expanded),{runFormEvent:xe}=b(),de=useCallback(async(M,te,O,n,oe,U$1)=>{var ke,ze,$e;M&&await xe({pluginCode:O.params.pluginCode,formCode:"FOLDER",guid:(ke=O.params.folderData)==null?void 0:ke.id,projectGuid:O.params.pGuid,pGuid:O.params.pGuid,widgetContext:JSON.stringify({referer:oe.pathname,parentWidgetId:U$1,hasParentForm:T.hasParentForm(),originator:(ze=O.params)==null?void 0:ze.originator,parent:O.params,folderData:($e=O.params)==null?void 0:$e.folderData}),widgetEvent:U.onDelete,widgetName:"delete",formData:O.formData}).then(Ke=>{if(Ke.meta.requestStatus==="fulfilled"){let ve={...Ke.payload};O.execCommands(ve.FECommand);}}),O.deletePrompt({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[e.params.pluginCode,e.params.folderData,e.params.pGuid,e.formData,e.deletePrompt,e.execCommands]),V=M=>{M.stopPropagation(),pe(te=>!te);},ce=M=>{M.stopPropagation(),K(M.currentTarget);},X=()=>{K(null);},ue=useCallback(()=>{X();let M="addbtn";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:A.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[X,A.pathname,e.params,e.eventDispatcher,T.hasParentForm]),Ce=useCallback(()=>{X();let M="share";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderShareRecordEvent,widgetContext:JSON.stringify({referer:A.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:{...e.params,guid:e.params.folderData.id},widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,A.pathname]),ge=useCallback(()=>{X();let M="edit";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderEditRecordEvent,widgetContext:JSON.stringify({referer:A.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,A.pathname]),Y=useCallback(async M=>{var te,O;await xe({pluginCode:e.params.pluginCode,formCode:e.params.formCode,guid:e.params.guid,projectGuid:e.params.pGuid,pGuid:e.params.pGuid,widgetContext:JSON.stringify({referer:A.pathname,parentWidgetId:null,hasParentForm:T.hasParentForm(),originator:(te=e.params)==null?void 0:te.originator,parent:e.params,folderData:(O=e.params)==null?void 0:O.folderData}),widgetEvent:U.onRefresh,widgetName:f==null?void 0:f.name,widgetValue:M,formData:v}).then(n=>{if(n.meta.requestStatus==="fulfilled"){let oe={...n.payload};oe.FECommand={...oe.FECommand,UpdateFormData:oe.data},e.execCommands(oe.FECommand);}});},[e,f==null?void 0:f.name,A.pathname]),G=useCallback(()=>{e.deletePrompt({delete:{showDialog:true,dialogTitle:P("Delete")+" ?",dialogContent:P("Are you certain that you wish to delete this folder?"),buttonAgree:P("Continue"),buttonDisagree:P("Close"),callBackFunc:M=>{M?de(M,"delete",e,{},A,""):de(false,"",e,{},A,"");}}});},[e,P,A,de]);if(b$1==="live"){let M=g.rightMode!=="Edit";return jsxs(qa,{..._(W),sx:{"& > ul":{paddingLeft:"0.2rem",paddingRight:"0.1rem"}},children:[jsxs(nd,{...I({className:x("content",{"Mui-expanded":ie,"Mui-selected":D.selected,"Mui-focused":D.focused,"Mui-disabled":D.disabled})}),children:[c!==0&&jsxs(Fragment,{children:[jsx(TreeItem2IconContainer,{...F({status:D,onPointerUp:V}),children:jsx(TreeItem2Icon,{status:D})}),jsx(TreeItem2Checkbox,{...h()})]}),jsx(ja,{...$({icon:J,expandable:k&&ie,isFirstRootNode:c===0,onClick:te=>{T$1&&T$1(te,a),te.stopPropagation();}}),children:d}),!M&&e.selectedItem===a&&c!==0&&jsx(lr,{size:"small",onClick:ce,"aria-controls":N?"menu":void 0,"aria-haspopup":"true","aria-expanded":N?"true":void 0,style:{marginLeft:"auto",color:"#FFF",fontSize:"14px"},children:jsx(m,{})}),jsxs(Zl,{anchorEl:H,open:N,onClose:X,onClick:te=>te.stopPropagation(),slotProps:{paper:{sx:{minWidth:"12em"}}},children:[jsxs(xt,{onClick:ue,children:[jsx(yt,{children:jsx(Ct,{action:"add",applyInternalStyle:true})}),jsx(wt,{primaryTypographyProps:{fontSize:"0.875rem"},children:P("New Folder")})]}),jsxs(xt,{onClick:ge,children:[jsx(yt,{children:jsx(Ct,{action:"edit",applyInternalStyle:true})}),jsx(wt,{children:P("Settings")})]}),jsxs(xt,{onClick:Ce,children:[jsx(yt,{children:jsx(Ct,{action:"share",applyInternalStyle:true})}),jsx(wt,{children:P("Share")})]}),jsxs(xt,{onClick:G,children:[jsx(yt,{children:jsx(Ct,{action:"trash",applyInternalStyle:true})}),jsx(wt,{children:P("Delete")})]})]}),jsx(TreeItem2DragAndDropOverlay,{...ne()})]}),m$1&&jsx(Ja,{...ee(),in:ie,children:m$1})]})}else {let M=false;return p&&p.length>0&&p.forEach((te,O)=>{if(te===a){M=true;return}}),jsxs(qa,{..._({...W,expandable:false}),sx:{"& > ul":{paddingLeft:"1rem",paddingRight:"0rem"}},children:[jsxs(ad,{...I({className:x("content",{"Mui-expanded":true,"Mui-selected":D.selected,"Mui-focused":D.focused,"Mui-disabled":D.disabled})}),children:[c!==0&&jsx(Fragment,{children:jsx(TreeItem2Checkbox,{id:a,visible:true,checked:M,onPointerUp:te=>Y(a),onResize:void 0,onResizeCapture:void 0,popover:void 0,popoverTargetAction:void 0,popoverTarget:void 0,inert:void 0,onToggle:void 0,onBeforeToggle:void 0,onTransitionCancel:void 0,onTransitionCancelCapture:void 0,onTransitionRun:void 0,onTransitionRunCapture:void 0,onTransitionStart:void 0,onTransitionStartCapture:void 0})}),jsx(ja,{...$({icon:J,expandable:k,isFirstRootNode:c===0}),children:d}),jsx(TreeItem2DragAndDropOverlay,{...ne()})]}),m$1&&jsx(Ja,{...ee(),in:true,children:m$1})]})}}),dd=t=>{let e=[],o=i=>{i.forEach(a=>{a.children&&a.children.length>0&&(e.push(a.id),o(a.children));});};return o(t),e},sd=(t,e)=>{let o=(i,a)=>{for(let d of i)if(d.id===a||d.children&&o(d.children,a))return d;return null};return o(t,e)},md=(t,e)=>{let o=[],i=(a,d,r=[])=>{for(let m of a){if(m.id===d)return o.push(...r),true;if(m.children&&i(m.children,d,[...r,m]))return true}return false};return i(t,e),o},Ht=(t,e)=>{for(let o of t){if(o.id===e)return o;if(o.children){let i=Ht(o.children,e);if(i)return i}}return null},It=(t,e)=>{for(let o of t){if(o.id===e)return [o.label];if(o.children){let i=It(o.children,e);if(i.length>0)return [o.label,...i]}}return []},cd=({eventDispatcher:t,execCommands:e,params:o,properties:i,redrawComponent:a,formlayout:d,onFolderSelected:r,onFolderAdded:m,formData:s,mode:c,checkedItems:b$2})=>{var H,K;let{runFormEvent:T$1}=b(),[p,f]=Pe.useState([]),[u,g]=Pe.useState(((H=o==null?void 0:o.folderData)==null?void 0:H.id)||null),[v,w]=Pe.useState([]),[S,x]=Pe.useState(b$2),[E,W]=Pe.useState(false),[_,I]=Pe.useState(),{UserDialog:F}=b$1();Pe.useEffect(()=>{x(b$2);},[b$2]);let h=useCallback(T.debounce(async()=>{var N,k,J,ie,pe,xe,de,V,ce,X,ue;try{let Ce=await T$1({pluginCode:((N=o.sourcePluginCode)==null?void 0:N.trim())!==""?o.sourcePluginCode:o.pluginCode,formCode:((k=o.sourceFormCode)==null?void 0:k.trim())!==""?o.sourceFormCode:o.formCode,guid:o.guid,projectGuid:o.pGuid,pGuid:o.pGuid,widgetEvent:U.onFoldersDataLoad,widgetContext:JSON.stringify({originator:(J=o.originator)!=null?J:null})});if(Ce.meta.requestStatus==="fulfilled"){let ge={...Ce.payload};ge!=null&&ge.userData&&I(ge==null?void 0:ge.userData),(ie=ge==null?void 0:ge.userData)!=null&&ie.isContributor&&W(!0);let Y=JSON.parse(ge.widgetData.treeData);if(f(Y),(pe=o==null?void 0:o.folderData)!=null&&pe.addedFolderId){let G=sd(Y,(xe=o==null?void 0:o.folderData)==null?void 0:xe.addedFolderId);if(G){let M=dd([G]);w(M),g((de=o==null?void 0:o.folderData)==null?void 0:de.addedFolderId);let te=It([G],(V=o==null?void 0:o.folderData)==null?void 0:V.addedFolderId);m(null,te);}}else if(v.length===0&&w([(ce=Y[0])==null?void 0:ce.id]),!u){let G=(X=Y[0])==null?void 0:X.id,M=(ue=Y[0])==null?void 0:ue.isroot;g(G||null),r(G||null,M);}}}catch(Ce){}},500),[o]);Pe.useEffect(()=>(h(),()=>{h.cancel();}),[h]),Pe.useEffect(()=>{var N,k,J,ie,pe,xe;if((N=o==null?void 0:o.folderData)!=null&&N.id){g(((k=o==null?void 0:o.folderData)==null?void 0:k.id)||null);let de=Ht(p,(J=o==null?void 0:o.folderData)==null?void 0:J.id),V=It(p,de==null?void 0:de.id),ce=[],X=md(p,(ie=o==null?void 0:o.folderData)==null?void 0:ie.id);X.length>0&&(X.forEach(ue=>{ce.push(ue.id);}),ce.push((pe=o==null?void 0:o.folderData)==null?void 0:pe.id),w(ce)),r((xe=o==null?void 0:o.folderData)==null?void 0:xe.id,de==null?void 0:de.isroot,V);}},[(K=o==null?void 0:o.folderData)==null?void 0:K.id]);let[$,ee]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),ne=N=>$.delete.callBackFunc(N),D=N=>{ee(N);},A=(N,k)=>{g(k);let J=Ht(p,k),ie=It(p,J==null?void 0:J.id);r(k,J==null?void 0:J.isroot,ie);};return jsxs(Fragment,{children:[jsx(Qa,{sx:{paddingTop:"5px"},children:jsx(RichTreeView,{items:p,selectedItems:u,expandedItems:v,sx:{height:"fit-content",flexGrow:1,maxWidth:250,overflowY:"auto"},slots:{item:N=>jsx(ld,{...N,mode:c,params:o,eventDispatcher:t,execCommands:e,deletePrompt:D,index:p.findIndex(k=>k.id===N.itemId),selectedItem:u,setSelectedItem:A,treeCheckedItems:S,disableRootItem:E,userData:_,formData:s,properties:i})},onSelectedItemsChange:A,onExpandedItemsChange:(N,k)=>{var ie;let J=(ie=p[0])==null?void 0:ie.id;J&&!k.includes(J)?w(pe=>pe.includes(J)?pe:[...pe,J]):w(k);}})}),jsx(F,{...$.delete,handleDialogClose:ne})]})},ct=cd;var Za=withTranslation()(memo(function(e){var c,b;let{style:o,verticalalign:i,plugincode:a,formcode:d,visible:r}=e.properties,m={paddingTop:"0px"};if(i==="bottom"&&(m.paddingTop="10px"),!r)return null;let s=(c=e.context.formData)!=null&&c[e.properties.name]?JSON.parse((b=e.context.formData)==null?void 0:b[e.properties.name]):{};return jsx("div",{style:{...o,...m,minHeight:"2rem"},children:jsx(ct,{params:{sourceFormCode:d,sourcePluginCode:a,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,pGuid:e.context.params.pGuid,originator:e.context.params.originator},properties:e.properties,checkedItems:s,redrawComponent:e.context.redrawComponent,eventDispatcher:e.methodProvider.eventDispatcher,execCommands:e.methodProvider.execCommands,formData:e.context.formData,formlayout:"folders",onFolderSelected:()=>{},onFolderAdded:()=>{},mode:"setup"})})}));Za.displayName="_View";var er=Za;var pd=lazy(()=>import('./tabulator-67R3BRXK.js').then(t=>({default:t.TabulatorTable}))),gd=lazy(()=>import('./datatable-UKX622UX.js').then(t=>({default:t.Datatable}))),Ve=class{static getFormComponent(e,o){if(e.displayName==="_Rowcontainer")return Hn;if(e.displayName==="_Rowsegment")return zn;if(e.displayName==="_Textinput"){if(o.inputtype==="input")return Jn;if(o.inputtype==="inputwcopy")return Kn;if(o.inputtype==="currency")return Wa;if(o.inputtype==="password")return Ga;if(o.inputtype==="date")return Sa;if(o.inputtype==="time")return Ma;if(o.inputtype==="datetime")return Na;if(o.inputtype==="phone")return La}else {if(e.displayName==="_TabBox")return Zn;if(e.displayName==="_Button")return Pa;if(e.displayName==="_Label")return oa;if(e.displayName==="_CheckBox")return ra;if(e.displayName==="_Radio")return da;if(e.displayName==="_Textarea")return ma;if(e.displayName==="_SelectBox")return fa;if(e.displayName==="_Placeholder")return ga;if(e.displayName==="_Fileuploader")return Ia;if(e.displayName==="_Table")return o.alloweditrow||o.tablemode!==void 0&&o.tablemode==="tabulator"?pd:gd;if(e.displayName==="_View")return er}return e}};function nr(t,e,o){var i=this,a=useRef(null),d=useRef(0),r=useRef(null),m=useRef([]),s=useRef(),c=useRef(),b=useRef(t),T=useRef(true);useEffect(function(){b.current=t;},[t]);var p=!e&&e!==0&&typeof window!="undefined";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var f=!!(o=o||{}).leading,u=!("trailing"in o)||!!o.trailing,g="maxWait"in o,v=g?Math.max(+o.maxWait||0,e):null;useEffect(function(){return T.current=true,function(){T.current=false;}},[]);var w=useMemo(function(){var S=function(F){var h=m.current,$=s.current;return m.current=s.current=null,d.current=F,c.current=b.current.apply($,h)},x=function(F,h){p&&cancelAnimationFrame(r.current),r.current=p?requestAnimationFrame(F):setTimeout(F,h);},E=function(F){if(!T.current)return false;var h=F-a.current;return !a.current||h>=e||h<0||g&&F-d.current>=v},W=function(F){return r.current=null,u&&m.current?S(F):(m.current=s.current=null,c.current)},_=function F(){var h=Date.now();if(E(h))return W(h);if(T.current){var $=e-(h-a.current),ee=g?Math.min($,v-(h-d.current)):$;x(F,ee);}},I=function(){var F=Date.now(),h=E(F);if(m.current=[].slice.call(arguments),s.current=i,a.current=F,h){if(!r.current&&T.current)return d.current=a.current,x(_,e),f?S(a.current):c.current;if(g)return x(_,e),S(a.current)}return r.current||x(_,e),c.current};return I.cancel=function(){r.current&&(p?cancelAnimationFrame(r.current):clearTimeout(r.current)),d.current=0,m.current=a.current=s.current=r.current=null;},I.isPending=function(){return !!r.current},I.flush=function(){return r.current?W(Date.now()):c.current},I},[f,g,e,v,u,p]);return w}var xd=Pe__default.createContext(void 0),rr=({children:t,eventDispatcher:e,redrawComponent:o,formlayout:i,params:a,onFolderSelected:d,onFolderAdded:r,formData:m,execCommands:s$1})=>{let[c,b$1]=useState(i),{viewPort:T}=b(),[p,f]=useState(false),{t:u}=useTranslation(),g=()=>f(x=>!x),v=()=>f(false),w={viewHolder:{display:"flex",position:"relative"},toggleButton:{position:"absolute",top:"1em",right:"1em",zIndex:1e3,background:"#FFF",color:"#3f86cc ",border:"1px solid #3f86cc",borderRadius:"50%",width:"35px",height:"35px",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},toggleButtonMenuActive:{background:"#3f86cc",color:"#FFF "},btreeContainerMobile:{position:"fixed",top:0,left:p?0:"-16rem",height:"100%",width:"16rem",backgroundColor:"#F8F8F8",borderRight:"1px solid #C0C0C0",transition:"left 0.3s ease",zIndex:999,padding:"0.5rem"},btreeContainerDesktop:{borderRight:"1px solid #C0C0C0"},mainContent:{flex:1,margin:"1em"}},S=()=>jsx(Gl,{variant:"h6",sx:{padding:"0.5em",fontWeight:"bold",borderBottom:"1px dashed #C0C0C0"},children:u("My Folders")});return jsxs(xd.Provider,{value:{layout:c,setLayout:b$1},children:[(!i||i==="regular")&&t,i==="folders"&&jsxs("div",{className:"viewHolder",style:w.viewHolder,children:[T.isMobileDevice?jsxs(Fragment,{children:[!p&&jsx("button",{onClick:g,style:{...w.toggleButton,...w.toggleButtonMenuActive},children:s({size:"1.3rem"})}),jsx(vd,{open:p,onClick:v,sx:{zIndex:998,backgroundColor:"rgba(0, 0, 0, 0.5)"}}),jsxs("div",{style:w.btreeContainerMobile,onClick:x=>x.stopPropagation(),children:[jsx("div",{style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:"0.5rem"}}),jsx(S,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:s$1,formData:m,formlayout:i,onFolderSelected:d,onFolderAdded:r,mode:"live"})]})]}):jsxs("div",{className:"foldersHolder",style:w.btreeContainerDesktop,children:[jsx(S,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:s$1,formData:m,formlayout:i,onFolderSelected:d,onFolderAdded:r,mode:"live"})]}),jsx("div",{style:w.mainContent,children:t})]})]})};var Rd=lazy(()=>import('./fileviewer-YMKT5J4T.js')),Sd=lazy(()=>import('./formeditor-3WG3WSUE.js').then(t=>({default:t.Formeditor}))),Tt=t=>new Promise(e=>setTimeout(e,t));function dr(t,e={}){let o={},i=d=>{let r=d==null?void 0:d.properties;if(!(r!=null&&r.name)||!(r!=null&&r.defaultvalue)||d.stricttype!=="_Textinput")return;let{name:m,inputtype:s}=r,c=String(r.defaultvalue).toLowerCase().trim();e[m]!=null&&e[m]!==""||(s==="date"&&c==="today"?o[m]=a$1().utc().format():s==="datetime"&&c==="now"?o[m]=a$1().utc().format():s==="time"&&c==="now"?o[m]=a$1().utc().format():s==="time"&&c==="start of day"&&(o[m]=a$1().startOf("day").utc().format()));},a=d=>{if(d.type==="formrow"||d.stricttype==="_Rowcontainer")for(let r of d._children||[])for(let m of r._children||[])i(m);else if(d._children)for(let r of d._children)a(r);};for(let d of t||[])a(d);return o}var $t={command:{},params:{id:null,parentId:null,guid:"",pGuid:"",formCode:"",pluginCode:"",modal:false,modalCloseFn:()=>{},modalCloseAndOpenFn:()=>{},originator:{params:{pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pluginCode:"",formCode:"",guid:""}},hasParentForm:false,folderData:{id:"",label:"",isRoot:"",captions:[]}},doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:0,height:0},formValidationData:{},enableEventHandlers:false,isModal:false,hasParentForm:false,formLayout:"regular"},sr={containerSetup:{properties:{style:{minHeight:0}}},selectedWidgetProps:{title:"",subtitle:"",style:{},tabsetup:null,_path:{type:null,stricttype:null,component:null,tabId:null,panelId:null,rowId:null,segmentId:null,widgetId:null},lastActiveTabId:null}},Ed={id:"",parentId:"",pluginCode:"",formCode:"",guid:null,pGuid:void 0,isFormEditorMode:false,originator:{params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},folderData:{id:"",addedFolderId:"",isRoot:"",captions:[]},prefillData:void 0},kd=memo(function({previewMode:e,className:o,maxWidth:i,setup:a,params:d$1,enableEventHandlers:r,modalCloseFn:m}){var Xt,Yt;let s={...d$1,modalCloseFn:m||(d$1==null?void 0:d$1.modalCloseFn)},c=useRef(null),[b$1,T$1]=useState(0),{registerFormSubmitEvent:p,checkFormAccess:f$1}=i$1(),{apiConfig:u,appSettings:g,viewPort:v,runLoadFormEvent:w,runServerPingEvent:S,runFormEvent:x,fetchUserMenu:E,signInUser:W,signOut:_}=b(),[I,F]=useState(null),h=useNavigate(),[$,ee]=useState(false),ne=useRef({}),[D,A]=useState({}),[P$1,H]=useState(null),[K,N]=useState(null),k=useLocation(),[J]=useState(v.width),[ie]=useState(s.modal||false),[pe]=useState(T.hasParentForm()||!!(u!=null&&u.token)),[xe,de]=useState([]),V=xe.length>0?xe[xe.length-1]:Ed,[ce,X]=useState(),[ue,Ce]=useState(true),{t:ge,i18n:Y}=useTranslation(),G=e$1(),M=f(),te=g$2(),O={command:{},params:s,doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:b$1,height:0},formValidationData:{},enableEventHandlers:r,isModal:ie,hasParentForm:pe,formLayout:"regular"},[n,oe]=useState(O),[U,ke]=useState({...sr,containerSetup:a}),ze=nr(()=>{c&&c.current&&T$1(c.current.offsetWidth);},200),$e=async(l,R)=>{await w({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.pGuid,pGuid:l.pGuid,originator:l.originator,parent:l.parent,previewMode:e,widgetContext:JSON.stringify({folderData:l.folderData,prefillData:l.prefillData})}).then(async C=>{var L,q,Z,ye,he,be,Te,z;if(C.meta.requestStatus==="fulfilled"){let B={...C.payload};if(Object.keys(B).length===0)return;try{let se=window.location.hostname;if(!b$2.SKIP_ACCESS_VALIDATION_DOMAINS.some(He=>se===He||se.endsWith(`.${He}`))){let He=await f$1(l.formCode);(He==null?void 0:He.subscriptionPlan)!=null&&H(He.subscriptionPlan);}}catch(se){N({title:(q=(L=se==null?void 0:se.data)==null?void 0:L.error)!=null?q:"Form Unavailable",message:(ye=(Z=se==null?void 0:se.data)==null?void 0:Z.message)!=null?ye:"This form is temporarily unavailable."});return}if(B.uiTranslations&&Object.keys(B.uiTranslations).length>0){ne.current=B.uiTranslations,A(B.uiTranslations);let se=Fd;se.addResourceBundle(se.language,"default",B.uiTranslations,true,true);}let Me={},le={visibility:{...n==null?void 0:n.widgetsState.visibility,...(he=B==null?void 0:B.widgetsState)==null?void 0:he.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(be=B==null?void 0:B.widgetsState)==null?void 0:be.readOnly}};if(R){oe(se=>({...se,formData:B.data,fieldAllowedValues:B.fieldAllowedValues,widgetsState:le,formLayout:B.layout,requiredFields:B.requiredFields}));return}let Re={},Be=[],Oe={},We=JSON.parse(B.definition);if(We==null){oe({...O,redrawComponent:false,doValidateForm:false,command:{...B.FECommand},formData:{},widgetsState:le,formLayout:B.layout,requiredFields:B.requiredFields,params:{...O.params,folderData:B.folderData}});return}T.mapComponents(We._children);let Xe=We.properties;Be=We._children,Oe=We,ke({...U,containerProps:Xe,selectedWidgetProps:{...U.containerProps},containerData:Be,containerSetup:Oe}),Me=B.fieldAllowedValues,Re={...B.data,...dr(Be,B.data)},oe({...O,formData:Re,formLayout:B.layout,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(Te=B==null?void 0:B.widgetsState)==null?void 0:Te.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(z=B==null?void 0:B.widgetsState)==null?void 0:z.readOnly}},requiredFields:B.requiredFields,command:{...B.FECommand},fieldAllowedValues:Me,params:{...O.params,folderData:B.folderData}}),ee(true);}});};if(useEffect(()=>(ze(),$e(s,false),window.addEventListener("resize",ze),()=>{oe(()=>({...$t})),ke(sr),ee(false),window.removeEventListener("resize",ze);}),[s.pGuid,s.guid,s.pluginCode,s.formCode]),useEffect(()=>{var C;if(!$||!((C=U.containerSetup)!=null&&C._children))return;let l=U.containerSetup._children,R=setTimeout(()=>{oe(L=>{let q=dr(l,L.formData);return Object.keys(q).length===0?L:{...L,formData:{...L.formData,...q}}});},0);return ()=>clearTimeout(R)},[Y.language,$]),useEffect(()=>{var q,Z,ye,he,be,Te,z,B,Me,le,Re,Be,Oe,We,Xe,se,Rt,He,Zt,eo,to,oo,no,ao,ro,io,lo,so,mo,co,uo,fo,po,go,ho,bo,vo,yo,wo,xo,Co,Io,Fo,To,Do,Po,Ro,So,Eo,ko,Mo,Bo,No,_o,Lo,Ao,Vo,Oo,Wo,Ho,Uo,Go,zo,$o,qo,Jo,jo,Qo,Ko,Xo,Yo,Zo,en,tn,on;let l=n,R=null,C=true,L=false;if((q=n.command)!=null&&q.Messages&&((Z=n.command)==null||Z.Messages.forEach(me=>{var we,Ye;let re=(we=ne.current[me.text])!=null?we:ge(me.text),Ee=(Ye=me.code)==null?void 0:Ye.toUpperCase();Ee==="NOTICE"?(L=true,te({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false})):Ee==="SUCCESS"?(L=true,M({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false})):Ee==="WARNING"&&(C=false,G({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false}));})),(ye=n.command)!=null&&ye.DisplayButtonLoader){oe({...n,displayButtonLoader:true});return}if((he=n.command)!=null&&he.DisplayErrorPage){h("/pagenotfound");return}if((be=n.command)!=null&&be.MoveToTab){let me=(z=(Te=n.command)==null?void 0:Te.MoveToTab)==null?void 0:z.widgetName;if(me){let re=T.getTabWidgetByFieldName(me,U.containerSetup);re!==null&&(re==null?void 0:re.tabId)!=null&&ve(re);}}if((B=n.command)!=null&&B.FormValidationData&&Object.keys(n.command.FormValidationData).length>0){let me=Object.keys(n.command.FormValidationData)[0];if(me){let re=T.getTabWidgetByFieldName(me,U.containerSetup);re!==null&&(re==null?void 0:re.tabId)!=null&&ve(re),setTimeout(()=>{let Ee=[`[name="${me}"]`,`[data-field-name="${me}"]`,`#${me}`,`[id*="${me}"]`],we=null;for(let Ye of Ee)try{if(we=document.querySelector(Ye),we)break}catch(St){}we&&(we.scrollIntoView({behavior:"smooth",block:"center"}),(we.tagName==="INPUT"||we.tagName==="TEXTAREA"||we.tagName==="SELECT")&&we.focus());},100);}oe({...n,doValidateForm:true,formValidationData:(Me=n.command)==null?void 0:Me.FormValidationData});return}else l={...l,formValidationData:{}};if((le=n.command)!=null&&le.FetchUserMenu&&E&&E({ProjectGuid:(Be=(Re=n.command)==null?void 0:Re.FetchUserMenu)==null?void 0:Be.projectGuid,pGuid:(We=(Oe=n.command)==null?void 0:Oe.FetchUserMenu)==null?void 0:We.projectGuid}),(Xe=n.command)!=null&&Xe.Redirect){s.modalCloseFn&&s.modalCloseFn(),h(`${(se=n.command)==null?void 0:se.Redirect.url}?ref=${(Zt=(He=(Rt=n.command)==null?void 0:Rt.Redirect)==null?void 0:He.context)==null?void 0:Zt.referer}`,{state:{from:(oo=(to=(eo=n.command)==null?void 0:eo.Redirect)==null?void 0:to.context)==null?void 0:oo.referer}});return}if((no=n.command)!=null&&no.BuildPlugin){h(`${(ao=n.command)==null?void 0:ao.BuildPlugin.url}?ref=${(io=(ro=n.command)==null?void 0:ro.BuildPlugin)==null?void 0:io.referer}`);return}if((lo=n.command)!=null&&lo.DisplayComponent&&F((so=n.command)==null?void 0:so.DisplayComponent),(mo=n.command)!=null&&mo.CloseDisplayComponent&&F(null),(co=n.command)!=null&&co.Login&&(async()=>{var me,re,Ee,we,Ye,St,nn;W&&await W((me=n.command)==null?void 0:me.Login),E&&await E({ProjectGuid:T.extractProjectGuid((Ee=(re=n.command)==null?void 0:re.Login)==null?void 0:Ee.url),pGuid:T.extractProjectGuid((Ye=(we=n.command)==null?void 0:we.Login)==null?void 0:Ye.url)}),h(((nn=(St=n.command)==null?void 0:St.Login)==null?void 0:nn.url)||"/");})(),(uo=n.command)!=null&&uo.Logout&&(async()=>{var re;(re=n.command)!=null&&re.Logout&&(_&&await _(),h("/"));})(),((fo=n.command)!=null&&fo.Cancel||(po=n.command)!=null&&po.CloseForm)&&(n.isModal&&s.modalCloseFn!==void 0?s.modalCloseFn(null,null,false,(go=n.command)==null?void 0:go.RedrawFolders):(R=T.getUrlParameter("ref"),R!=null&&h(R))),(ho=n.command)!=null&&ho.AfterRecordSave){let me=(bo=g==null?void 0:g.TOASTER_AUTOCLOSE)!=null?bo:b$2.TOASTER_AUTOCLOSE;if(R=T.getUrlParameter("ref"),((vo=n.command)==null?void 0:vo.AfterRecordSave.guid)==null)!((yo=n.command)!=null&&yo.OpenModal)&&s.modalCloseFn?s.modalCloseFn(null,null,false,null,null):(wo=n.command)!=null&&wo.OpenModal||(async()=>(await Tt(L?me:0),R!=null&&h(R)))();else if(n.isModal){let re;(xo=n.command)!=null&&xo.HotReloadEnabled&&(re=(Co=n.command)==null?void 0:Co.HotReloadEnabled),(Io=n.command)!=null&&Io.OpenModal||(async()=>{var Ee,we;await Tt(L?me:0),s.modalCloseFn&&s.modalCloseFn(re,n.formData,(Ee=n.command)==null?void 0:Ee.RedrawScreen,(we=n.command)==null?void 0:we.RedrawFolders,null);})();}else {let re=R!=null;if(!((Fo=n.command)!=null&&Fo.OpenModal)&&re&&C)(async()=>(await Tt(L?me:0),R!=null&&h(R)))();else if(!((To=n.command)!=null&&To.OpenModal)){let Ee=k.pathname.replace(/\/new/gi,"/"+((Do=n.command)==null?void 0:Do.AfterRecordSave.guid.replace(/#/g,"%23")));h(Ee,{state:{from:k.pathname}}),l={...l,params:{...n.params,guid:(Po=n.command)==null?void 0:Po.AfterRecordSave.guid}};}}}if((Ro=n.command)!=null&&Ro.UpdateWidgetsState&&(l={...l,widgetsState:{visibility:{...l==null?void 0:l.widgetsState.visibility,...(Eo=(So=n.command)==null?void 0:So.UpdateWidgetsState)==null?void 0:Eo.visibility},readonly:{...l==null?void 0:l.widgetsState.readonly,...(Mo=(ko=n.command)==null?void 0:ko.UpdateWidgetsState)==null?void 0:Mo.readonly}}}),(Bo=n.command)!=null&&Bo.UpdateFieldAllowedValues&&(l={...l,fieldAllowedValues:{...(No=n.command)==null?void 0:No.UpdateFieldAllowedValues}}),(_o=n.command)!=null&&_o.UpdateFormData&&(l={...l,formData:{...(Lo=n.command)==null?void 0:Lo.UpdateFormData}}),(Ao=n.command)!=null&&Ao.UpdateFormDataItem&&(l={...l,formData:{...l.formData,[(Vo=n.command)==null?void 0:Vo.UpdateFormDataItem.name]:(Oo=n.command)==null?void 0:Oo.UpdateFormDataItem.value}}),((Ho=(Wo=n.command)==null?void 0:Wo.ReplaceContextRecordGuid)==null?void 0:Ho.guid)!=null&&(l={...l,displayButtonLoader:false,params:{...n.params,guid:(Uo=n.command)==null?void 0:Uo.ReplaceContextRecordGuid.guid}}),(Go=n.command)!=null&&Go.OpenModal){let me={...(zo=n.command)==null?void 0:zo.OpenModal,parentId:s.id};de(re=>[...re,me]),l={...l,command:{}};}($o=n.command)!=null&&$o.PreviewDocument&&X((qo=n.command)==null?void 0:qo.PreviewDocument),(Jo=n.command)!=null&&Jo.RedrawScreen&&(l={...l,redrawComponent:!n.redrawComponent,redrawFoldersComponent:!n.redrawFoldersComponent}),(jo=n.command)!=null&&jo.RedrawFolders&&(l={...l,params:{...n.params,folderData:{id:(Ko=(Qo=n.command)==null?void 0:Qo.RedrawFolders)==null?void 0:Ko.folderId,addedFolderId:(Yo=(Xo=n.command)==null?void 0:Xo.RedrawFolders)==null?void 0:Yo.folderId,isRoot:(en=(Zo=n.command)==null?void 0:Zo.RedrawFolders)==null?void 0:en.isRoot,captions:(on=(tn=n.command)==null?void 0:tn.RedrawFolders)==null?void 0:on.captions}}}),Object.keys(n.command).length>0&&(l={...l,command:{}},oe(l));},[n.command]),K)return jsx(l$1,{title:K.title,message:K.message});if(!$)return Pe__default.createElement("div",{},jsx(a$2,{message:ge("Please wait...")}));let Ke=(l,R)=>{let C={};return Object.entries(l).forEach(([L,q])=>{let Z=R[L];(Z==null||Z===""||Z==="0"||Z===0||Array.isArray(Z)&&Z.length===0)&&(C[L]=q);}),C},ve=(l,R=false,C={})=>{let L=ft(null,l.tabId,l.index,R,C.containerSetup);if(L===void 0)return;let q=T.GetParentTabId(L.containerSetup,l.tabId);(q==null?void 0:q.tabId)!=null?(L=ft(null,q.tabId,q.index,false,L.containerSetup),L!==void 0&&ve(q,true,L)):R===false&&ft(null,l.tabId,l.index,true);},rt=async l=>(oe({...n,displayButtonLoader:true}),await x({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.projectGuid,pGuid:l.projectGuid,formData:{...l.formData,[l.fieldName]:l.value},widgetContext:JSON.stringify({referer:k.pathname,parentWidgetId:l.tabId,hasParentForm:T.hasParentForm(),originator:{widgetName:l.fieldName.toLowerCase(),params:n.params},parent:{widgetName:l.fieldName.toLowerCase(),params:n.params},parentOriginator:{params:n.params.originator?n.params.originator.params:{}},folderData:n.params.folderData}),widgetEvent:l.widgetEvent,widgetName:l.fieldName.toLowerCase(),widgetValue:l.widgetValue}).then(async R=>{var C,L,q,Z,ye,he,be,Te;if(R.meta.requestStatus==="fulfilled"){let z={...R.payload};((C=z.FECommand)==null?void 0:C.ReplaceContextRecordGuid)!==void 0?(z.FECommand={Messages:(q=(L=z.FECommand)==null?void 0:L.Messages)!=null?q:[],UpdateFormData:z.data,ReplaceContextRecordGuid:(Z=z.FECommand)==null?void 0:Z.ReplaceContextRecordGuid},ot(z.FECommand)):(ye=z.FECommand)!=null&&ye.Messages?(z.FECommand={UpdateFormData:z.data,Messages:(he=z.FECommand)==null?void 0:he.Messages},ot(z.FECommand)):(be=z.FECommand)!=null&&be.FormValidationData&&(z.FECommand={FormValidationData:(Te=z.FECommand)==null?void 0:Te.FormValidationData},ot(z.FECommand));}else oe({...n,displayButtonLoader:false});})),Ie=l=>{let R=l.widgetContext,C=l.widgetEvent,L=l.widgetName.toLowerCase(),q=l.widgetValue,Z=l.feCommand||{},ye=l.skipFormDataItem||false;if(C!==null&&n.enableEventHandlers){if(l.autoSave){rt(l.autoSave);return}let he=q!=null&&ye===false?{...n.formData,[L]:q}:n.formData;if((C==null?void 0:C.toUpperCase())==="ONSAVE"&&n.requiredFields!=null){let be=Ke(n.requiredFields,he),Te=Object.keys(n.formValidationData||{}).length>0,z=Object.keys(be).length>0;if((z||Te)&&(oe({...n,command:{...n.command,FormValidationData:be}}),z))return}(async()=>{var be,Te;if((C==null?void 0:C.toUpperCase())==="ONSAVE")try{await p(n.params.formCode);}catch(z){if((z==null?void 0:z.status)===429)return}Ce(false),await x({pluginCode:n.params.pluginCode,formCode:n.params.formCode,guid:n.params.guid,projectGuid:(be=n.params.pGuid)!=null?be:"",pGuid:(Te=n.params.pGuid)!=null?Te:"",widgetContext:R,widgetEvent:C,widgetName:L,widgetValue:typeof q=="string"?q:q!=null?JSON.stringify(q):null,formData:he,widgetsState:n.widgetsState}).then(z=>{var B,Me;if(z.meta.requestStatus==="fulfilled"){if(z.payload instanceof Blob){oe({...n,redrawComponent:!n.redrawComponent});return}let le={...z.payload};if(Object.keys(le).length===0)return;let Re=JSON.parse(le.definition);if(Re!=null){let Be=[],Oe={};T.mapComponents(Re._children);let We=Re.properties;Be=Re._children,Oe=Re,ke({...U,containerProps:We,selectedWidgetProps:{...U.selectedWidgetProps},containerData:Be,containerSetup:Oe});let Xe=L;if(Xe){let se=T.getTabWidgetByFieldName(Xe,Oe);se!==null&&(se==null?void 0:se.tabId)!=null&&ve(se,true,{containerSetup:Oe});}}ye||(n.redrawComponent=false),oe({...n,fieldAllowedValues:le.fieldAllowedValues,doValidateForm:true,command:{...le.FECommand},formData:{...n.formData,...le.data},widgetRelatedData:le.widgetRelatedData,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(B=le==null?void 0:le.widgetsState)==null?void 0:B.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(Me=le==null?void 0:le.widgetsState)==null?void 0:Me.readOnly}},tabIndex:l.tabIndex?Number(l.tabIndex+1):0});}}).finally(async()=>{var z;if(Ce(true),(C==null?void 0:C.toUpperCase())==="ONSAVE"&&u!=null&&u.iframeMode&&u!=null&&u.token){let B=(z=U.containerProps)==null?void 0:z.webhooks;if(Array.isArray(B)&&B.length>0){let Me={formCode:n.params.formCode,submittedAt:new Date().toISOString(),data:he};B.forEach(le=>{var Re;le.enabled&&((Re=le.url)!=null&&Re.startsWith("http"))&&fetch(le.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Me),mode:"cors"}).then(Be=>{Be.ok||G({toastID:nanoid(11),msg:`Webhook failed: ${le.url}`,clearQueue:false,hideProgressBar:false});}).catch(Be=>{G({toastID:nanoid(11),msg:`Webhook failed: ${le.url}`,clearQueue:false,hideProgressBar:false});});});}}});})();}if(q!=null){let he={...n.formData,[L]:q};oe({...n,command:Z,formData:he});}},it=(l,R,C)=>T.findRowItem(l,R,C,U.containerSetup._children),ur=(l,R,C,L)=>T.findSegmentItem(l,R,C,L,U.containerSetup._children),fr=l=>T.findWidgetByIdRecursive(U.containerSetup._children,l),pr=(l,R)=>T.getActiveTabIndex(U.containerSetup._children,R),ft=(l,R,C,L=true,q={})=>{let Z=Object.keys(q).length>0?q:U.containerSetup;if(!R)return;let ye=T.getTabContainer(Z._children,R),he=T.getTabContainerChildrens(Z._children,R);if(he===void 0)return;for(let B=0;B<he.data.length;B++)he.data[B].activeTab="0";let be=he.data.filter((B,Me)=>Me===C)[0];be.properties={...ye.item.properties.tabsetup,...be.properties};let Te=T.getNodeUpdatePath(he.path,{$splice:[[C,1,{...be,activeTab:"1"}]]});var z={containerSetup:{...Z,_children:(0, mr.default)(Z._children,Te)},selectedWidgetProps:{...U.selectedWidgetProps,tabsetup:{...be.properties},_path:{...U.selectedWidgetProps._path,panelId:be.id},lastActiveTabId:R}};return L&&ke(z),z},gr=(l=true)=>{let R=$t;l&&(R={...n,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{id:"",isRoot:"",captions:[]}}}),oe(R);},ot=l=>{oe({...n,redrawComponent:!n.redrawComponent,command:{...l}});},qt=(l,R)=>{(async()=>{if(!S){l();return}await S({cmd:"ping"}).then(async C=>{(C==null?void 0:C.type)==="formbuilder/ping/rejected"?(G({toastID:nanoid(11),msg:"Application is being restarted. Please wait until it finishes....",clearQueue:false,hideProgressBar:false}),await Tt(1e3),qt(l)):l();});})();},Pt=(l,R=false,C,L=null)=>{qt(()=>{if(de(Z=>Z.slice(0,-1)),L!=null){let Z={...L,parentId:s.id};de(ye=>[...ye,Z]);}else if(l!=null){let Z={id:nanoid(5),pluginCode:l==null?void 0:l.pluginCode,formCode:l==null?void 0:l.formCode,guid:null,isFormEditorMode:true,parentId:s.id};de(ye=>[...ye,Z]);}if($e(n.params,true),C){let Z=C==null?void 0:C.folderId;Jt(Z,[]);}else oe({...n,redrawComponent:!n.redrawComponent});}),R&&n.isModal&&$e(s,true);},hr=(l,R="",C)=>{let L={...n,redrawFoldersComponent:!n.redrawFoldersComponent,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:"",captions:C,id:l!==null?l:"",isRoot:R}}};oe(L);},Jt=(l,R)=>{let C=$t;l==null?C={...n,redrawFoldersComponent:!n.redrawFoldersComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:l!==null?l:"",captions:R}}}:C={...n,params:{...n.params,folderData:{...n.params.folderData,id:l!==null?l:"",addedFolderId:l!==null?l:"",isRoot:"",captions:R}}},oe(C);},jt=l=>{l&&de(R=>[...R.slice(0,-1),{...l,id:nanoid(5)}]);},br=()=>{X(void 0);},vr=()=>F(null),yr=l=>{let{title:R,subtitle:C}=l,L=R;return C!==void 0&&String(C).trim()!==""&&(L=R+" - "+C),n.enableEventHandlers&&Object.keys((n==null?void 0:n.formData)||{}).length>0&&Object.entries(n.formData).forEach(([q,Z])=>{L=L.replace(`#${q}`,Z);}),L},{properties:Fe}=U.containerSetup||{},{minHeight:Qt}=(Fe==null?void 0:Fe.style)||{},pt={};Qt&&(pt.minHeight=Qt),ie&&(pt={...pt,width:"100%",minWidth:J-J*.3,maxHeight:"calc(100dvh - 4rem)",overflow:"auto"});let Kt={};return e&&(Kt={overflowY:"scroll",height:"100vh",padding:"0px 10px 10px 10px"}),jsx(k$1.Provider,{value:P$1,children:jsx(va.Provider,{value:D,children:jsxs(rr,{execCommands:ot,eventDispatcher:Ie,redrawComponent:n.redrawFoldersComponent,formlayout:n.formLayout,params:n.params,onFolderSelected:hr,onFolderAdded:Jt,formData:n.formData,children:[jsxs("div",{id:"main-content-wrapper",className:o,children:[jsx("div",{className:"content",children:jsx("div",{className:"main-content on-scrollbar",style:Kt,children:jsxs("div",{id:"formCanvas",ref:c,style:{maxWidth:i,border:(Fe==null?void 0:Fe.border)===false?"none":void 0},children:[jsxs("form",{onSubmit:l=>{l.preventDefault();},style:{position:"relative"},children:[Fe&&!Fe.hideheader&&jsxs("div",{className:"form-header top-border-radius",style:{backgroundColor:(Fe==null?void 0:Fe.headerbackground)===false?"transparent":void 0},children:[jsx("div",{style:{flex:1,marginLeft:"0.5rem"},children:Fe&&yr(Fe)}),ie&&s.modalCloseFn!==void 0&&jsx("div",{style:{width:"2.5em"},children:jsx(lr,{onClick:()=>s.modalCloseFn(null),children:Pe__default.createElement(P)})})]}),Fe&&Fe.hideheader&&ie&&s.modalCloseFn!==void 0&&jsx("div",{style:{position:"absolute",top:"0.5rem",right:"0.5rem",zIndex:9999},children:jsx(lr,{size:"medium",onClick:l=>{l.stopPropagation(),s.modalCloseFn(null);},sx:{backgroundColor:"rgba(255, 255, 255, 0.95)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:Pe__default.createElement(P)})}),jsx("div",{style:pt,className:"form-container bottom-border-radius",children:jsx("div",{className:"form-container",children:jsx(m$1,{darkMode:false,noPadding:true,children:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Md,{eventDispatcher:Ie,context:n,formWidth:b$1,findRowItem:it,findSegmentItem:ur,findWidgetItem:fr,modal:ie,getActiveTabIndex:pr,setActiveTabIndex:ft,setRedrawComponent:gr,execCommands:ot,widgets:U.containerSetup})})})})})]}),I!==null&&jsx(d,{componentName:I.componentName,options:I.options,params:{params:(Xt=I.options)!=null&&Xt.contextParams?(Yt=I.options)==null?void 0:Yt.contextParams:n.params,formData:n.formData,execCommands:l=>ot(l),modalCloseFn:()=>vr(),modalCloseAndOpenFn:l=>jt(l)}})]})})}),(P$1==null?void 0:P$1.toLowerCase())==="free"&&!ie&&jsxs("div",{style:{textAlign:"center",padding:"12px 16px",fontSize:"13px",color:"#aaa"},children:["Powered by"," ",jsx("a",{href:"https://buildocs.com",target:"_blank",rel:"noopener noreferrer",style:{color:"#3498db",textDecoration:"none",fontWeight:500},children:"Buildocs"})]})]}),!ue&&jsx(a$2,{message:ge("Please wait...")}),!V.isFormEditorMode&&ce&&ce.fileId&&jsx(Suspense,{fallback:jsx(a$2,{message:ge("Loading viewer...")}),children:jsx(Rd,{fileId:ce.fileId,fileBase64:ce.data,fieldName:ce.fieldName,params:{...ce.context?ce.context:n.params,modalCloseFn:br}},nanoid(11))}),!V.isFormEditorMode&&(V==null?void 0:V.pluginCode)&&(V==null?void 0:V.formCode)&&jsx(a$3,{component:jsx(kd,{params:{id:V.id,parentId:V.parentId,pluginCode:V.pluginCode,formCode:V.formCode,guid:V.guid==null?"new":V.guid,pGuid:V.pGuid,modal:true,modalCloseFn:(l,R,C,L,q=null)=>Pt(l,C,L,q),modalCloseAndOpenFn:l=>jt(l),originator:V.originator,parent:V.parent,folderData:V.folderData,prefillData:V.prefillData},enableEventHandlers:true}),id:V.id,onCloseModal:Pt,parentId:V.parentId},V.id),V.isFormEditorMode&&(V==null?void 0:V.pluginCode)&&(V==null?void 0:V.formCode)&&jsx(a$3,{component:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Sd,{inPreviewMode:false,pluginCode:V.pluginCode,formCode:V.formCode,modal:true},nanoid(11))}),id:V.id,onCloseModal:()=>Pt(null,false,null),parentId:V.parentId,windowMode:"fullWindow"},V.id)]})})})}),Md=t=>{let e=0,o=i=>{for(var a in i)typeof i[a]=="object"&&i[a]!==null?o(i[a]):a==="tabIndex"&&(t.modal?i[a]=0:i[a]=++e);};return o(t.widgets._children),(t.widgets._children||[]).map(({id:i,tabId:a,panelId:d,type:r,component:m,properties:s})=>Pe__default.createElement(Ve.getFormComponent(m,s),{key:"key_"+i,id:i,tabId:a,panelId:d,className:r,context:{...t.context,formDimension:{width:t.formWidth,height:0}},properties:s,widgetsState:t.context.widgetsState,methodProvider:{eventDispatcher:t.eventDispatcher,findRowItem:t.findRowItem,findSegmentItem:t.findSegmentItem,findWidgetItem:t.findWidgetItem,getActiveTabIndex:t.getActiveTabIndex,setActiveTabIndex:t.setActiveTabIndex,setRedrawComponent:t.setRedrawComponent,execCommands:t.execCommands}},i))};
|
|
2
2
|
export{Vn as a,kd as b};
|