@buildocsdev/sdk 1.1.27 → 1.1.28

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