@dartech/arsenal-ui 1.0.5 → 1.0.6

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/index.js CHANGED
@@ -1 +1 @@
1
- import{styled as e,ThemeProvider as r,createTheme as t,responsiveFontSizes as i}from"@mui/material/styles";import{jsx as n,jsxs as a,Fragment as l}from"react/jsx-runtime";import o from"@mui/material/Button";import s from"@mui/material/Dialog";import c from"@mui/material/DialogActions";import d from"@mui/material/DialogContent";import p from"@mui/material/DialogContentText";import u from"@mui/material/DialogTitle";import m from"@mui/material/Box";import g from"@mui/material/CircularProgress";import{__rest as h,__awaiter as b}from"tslib";import{useController as f,useWatch as y,useFormContext as v,useFieldArray as O}from"react-hook-form";import C from"@mui/material/TextField";import x,{useRef as E,useEffect as j,useState as T,useCallback as S,useMemo as N,createElement as k,forwardRef as w,createContext as I,useContext as M,memo as P,Suspense as A}from"react";import L from"@mui/material/MenuItem";import V from"@mui/icons-material/Clear";import $ from"@mui/material/IconButton";import R from"@mui/material/InputAdornment";import F from"@mui/material/FormControl";import q from"@mui/material/FormControlLabel";import D from"@mui/material/FormHelperText";import z from"@mui/material/Checkbox";import B from"@mui/material/Radio";import W from"@mui/material/RadioGroup";import J from"@mui/material/FormLabel";import G from"@mui/material/Autocomplete";import{useQuery as H}from"@tanstack/react-query";import _ from"qs";import Y from"@mui/material/Tooltip";import K from"@mui/material/SvgIcon";import{useNavigate as U,useLocation as X,Link as Z,useSearchParams as Q,Outlet as ee}from"react-router-dom";import re from"react-ace";import te from"@mui/material/Typography";import ie from"@mui/material/Switch";import{DatePicker as ne}from"@mui/x-date-pickers/DatePicker";import{format as ae,isMatch as le,isValid as oe,parse as se}from"date-fns";import{DateTimePicker as ce}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as de}from"@mui/x-date-pickers/TimePicker";import pe from"@mui/material/Pagination";import ue from"@mui/material/TablePagination";import{useGridApiContext as me,useGridSelector as ge,gridPageSelector as he,gridPageCountSelector as be,gridRowCountSelector as fe,gridPageSizeSelector as ye,GridColumnMenuContainer as ve,GridFilterMenuItem as Oe,DataGrid as Ce,GridActionsCellItem as xe}from"@mui/x-data-grid";import{makeStyles as Ee}from"tss-react/mui";import je from"@mui/material/Table";import Te from"@mui/material/TableBody";import Se from"@mui/material/TableCell";import Ne from"@mui/material/TableContainer";import ke from"@mui/material/TableHead";import we from"@mui/material/TableRow";import Ie from"@mui/material/TableSortLabel";import Me from"@mui/material/TableFooter";import Pe from"@mui/material/Backdrop";import Ae from"@mui/material/Menu";import Le from"@mui/icons-material/MoreHoriz";import Ve from"@mui/material/Paper";import $e from"@mui/material/Tab";import Re from"@mui/material/Tabs";import Fe from"@mui/material/Unstable_Grid2";import qe from"@mui/material/Accordion";import De from"@mui/material/AccordionSummary";import ze from"@mui/material/AccordionDetails";import Be from"@mui/material/AccordionActions";import{ExpandMore as We}from"@mui/icons-material";import Je from"@mui/icons-material/Delete";import Ge from"@mui/material/Stepper";import He from"@mui/material/Step";import _e from"@mui/material/StepLabel";import Ye from"@mui/material/StepContent";import Ke from"@mui/material/StepConnector";import Ue from"@mui/material/Chip";import Xe from"@mui/icons-material/Add";import Ze from"@mui/material/Select";import Qe from"@mui/material/InputLabel";import er from"@mui/icons-material/Close";import rr from"@monaco-editor/react";import tr from"@mui/icons-material/ExpandMore";import ir from"@mui/icons-material/CheckCircle";import nr from"classnames";import{toast as ar}from"react-toastify";import{theme as lr}from"@dartech/arsenal-ui";import or from"@mui/material/Drawer";import sr from"@mui/material/List";import cr from"@mui/material/ListItem";import dr from"@mui/material/ListItemIcon";import pr from"@mui/material/ListItemButton";import ur from"@mui/material/ListSubheader";import mr from"@mui/material/ListItemText";import gr from"@mui/material/Toolbar";import hr from"@mui/material/ButtonBase";import br from"@mui/material/Collapse";var fr;!function(e){e.STRING="STRING",e.INTEGER="INTEGER",e.BIG_INTEGER="BIG_INTEGER",e.BIG_DECIMAL="BIG_DECIMAL",e.FLOAT="FLOAT",e.LONG="LONG",e.DOUBLE="DOUBLE",e.BOOLEAN="BOOLEAN",e.ENTITY_REFERENCE="ENTITY_REFERENCE",e.ENTITY="ENTITY",e.JSON="JSON",e.DATE="DATE",e.TIME="TIME",e.DATE_TIME="DATE_TIME",e.ANY="ANY"}(fr||(fr={}));const yr="yyyy-MM-dd",vr="HH:mm:ss",Or="yyyy-MM-dd'T'HH:mm:ss.SSSXXX";var Cr;!function(e){e.UP="UP",e.DOWN="DOWN",e.CEILING="CEILING",e.FLOOR="FLOOR",e.HALF_UP="HALF_UP",e.HALF_DOWN="HALF_DOWN",e.HALF_EVEN="HALF_EVEN",e.UNNECESSARY="UNNECESSARY"}(Cr||(Cr={}));const xr=({transparent:e,position:r})=>n(m,Object.assign({position:null!=r?r:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:e?"none":"rgba(255, 255, 255, .3)",zIndex:10},{children:n(g,{})})),Er=({open:e,title:r,description:t,closeButtonTitle:i="Close",onClose:l,confirmButtonTitle:g="Confirm",confirmButtonDisabled:h=!1,onConfirm:b,children:f,dialogProps:y,loading:v,maxWidth:O="xs"})=>n("div",{children:a(s,Object.assign({open:e,onClose:l,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:O},y,{children:[v&&n(xr,{}),n(u,Object.assign({id:"alert-dialog-title"},{children:r})),a(d,{children:[t&&n(p,Object.assign({id:"alert-dialog-description"},{children:t})),n(m,Object.assign({maxWidth:"100%",overflow:"hidden"},{children:f}))]}),a(c,{children:[n(o,Object.assign({onClick:l,color:"primary",variant:"contained"},{children:i})),g&&b?n(o,Object.assign({onClick:b,color:"secondary",variant:"contained",autoFocus:!0,disabled:h},{children:g})):null]})]}))}),jr=e=>{var r,{control:t,validate:i,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,textarea:d=!1,hideErrorMessage:p=!1,onChange:u}=e,m=h(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange"]);const{field:{ref:g,onChange:b},fieldState:{error:v}}=f({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:i}}),O=y({control:t,name:a});return n(C,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:g,name:a,label:l,error:!!v,helperText:!p&&(null==v?void 0:v.message),disabled:c,multiline:d,minRows:d?3:1,value:null!=O?O:"",onChange:u||b},m,{inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=O?O:""})}))};function Tr(e,r){const t=E();j((()=>()=>{t.current&&clearTimeout(t.current)}),[]);return(...i)=>{clearTimeout(t.current),t.current=setTimeout((()=>{e(...i)}),r)}}const Sr=()=>{const[e,r]=T(!1);return{open:e,toggle:()=>{r((e=>!e))},onClose:()=>{r(!1)},onOpen:()=>{r(!0)}}},Nr=e=>{var r,{control:t,validate:i,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,textarea:d=!1,hideErrorMessage:p=!1,onChange:u}=e,m=h(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange"]);const{field:{ref:g,onChange:b},fieldState:{error:v}}=f({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:i}}),O=y({control:t,name:a}),[x,E]=T("");j((()=>{!x&&O&&E(O)}),[x,O]);const N=Tr((e=>{b(e)}),200),k=S((e=>{E(e.target.value),N(e.target.value)}),[N]);return n(C,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:g,name:a,label:l,error:!!v,helperText:!p&&(null==v?void 0:v.message),disabled:c,multiline:d,minRows:d?3:1,value:null!=x?x:"",onChange:k},m,{inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=x?x:""})}))},kr=e=>{var r,{control:t,validate:i,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,hideErrorMessage:d=!1,onChange:p,labelKey:u,valueKey:m,options:g=[]}=e,b=h(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options"]);const{field:{ref:v,onChange:O},fieldState:{error:x}}=f({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:i}}),E=y({control:t,name:a}),j=S((e=>"string"==typeof e?e:m?e[m]:e.value),[m]),T=S((e=>"string"==typeof e?e:u?e[u]:e.label),[u]),N=S((()=>{O(null)}),[O]);return n(C,Object.assign({select:!0,fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:v,name:a,label:l,error:!!x,helperText:!d&&(null==x?void 0:x.message),disabled:c,value:null!=E?E:"",onChange:p||O},b,{inputProps:Object.assign(Object.assign({},null!==(r=null==b?void 0:b.inputProps)&&void 0!==r?r:{}),{value:null!=E?E:""}),InputProps:Object.assign({endAdornment:!o&&E?n(R,Object.assign({position:"end",sx:{mr:2}},{children:n($,Object.assign({onClick:N,size:"small"},{children:n(V,{fontSize:"small"})}))})):null},null==b?void 0:b.InputProps)},{children:g.map(((e,r)=>n(L,Object.assign({value:j(e)},{children:T(e)}),r)))}))},wr=e=>{var{control:r,validate:t,name:i="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,hideErrorMessage:d=!1,onChange:p}=e,u=h(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange"]);const{field:{ref:m,onChange:g},fieldState:{error:b}}=f({name:i,control:r,defaultValue:s}),v=y({control:r,name:i}),O=N((()=>{if("boolean"==typeof v)return v;if("string"==typeof v){if("false"===v)return g(!1),!1;if("true"===v)return g(!0),!0}return!1}),[v,g]);return a(F,Object.assign({error:!!b,component:"fieldset",variant:"standard",disabled:c},{children:[n(q,{control:n(z,Object.assign({checked:O,onChange:p||g,name:i,inputRef:m,disabled:c},u)),label:l}),!d&&(null==b?void 0:b.message)&&n(D,{children:b.message})]}))},Ir=({name:e,label:r,values:t=[],control:i,required:l,defaultValue:o,disabled:s,hideErrorMessage:c,labelKey:d,valueKey:p,validate:u,onChange:m})=>{const{field:{ref:g,onChange:h},fieldState:{error:b}}=f({name:e,control:i,defaultValue:o,rules:{required:l&&"Please, fill this field",validate:u}}),v=y({control:i,name:e}),O=S((e=>"string"==typeof e?e:p?e[p]:e.value),[p]),C=S((e=>"string"==typeof e?e:d?e[d]:e.label),[d]);return a(F,Object.assign({disabled:s,error:!!b},{children:[n(J,Object.assign({id:"radio-buttons-group"},{children:r})),n(W,Object.assign({"aria-labelledby":"radio-buttons-group",ref:g,name:e,value:v,onChange:m||h},{children:t.map((e=>n(q,{value:O(e),control:n(B,{}),label:C(e)})))})),!c&&(null==b?void 0:b.message)&&n(D,{children:b.message})]}))};var Mr=({valueKey:e,labelKey:r})=>{const t=S(((r,t)=>{if(r&&t){if("string"==typeof r)return r===t;if(e)return r[e]===t[e]||r[e]===t;if(r.value)return r.value===t.value||r.value===t}return!1}),[e]),i=S((e=>e?"string"==typeof e?e:r&&e[r]?e[r]+"":e.label+""||e.name+""||e.value+""||e.code+""||"--no label--":""),[r]),n=S(((e,r)=>k(m,Object.assign({},e,{component:"li",key:e.id}),i(r))),[i]);return{isOptionEqualToValue:t,getOptionLabel:i,renderOption:n}};const Pr=e=>{var{control:r,validate:t,name:i="",label:a="",required:l=!1,defaultValue:o="",disabled:s=!1,hideErrorMessage:c=!1,onChange:d,labelKey:p,valueKey:u,options:m=[],multiple:g,textFieldProps:b={},disableCloseOnSelect:v}=e,O=h(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options","multiple","textFieldProps","disableCloseOnSelect"]);const{field:{ref:x,onChange:E},fieldState:{error:j}}=f({name:i,control:r,defaultValue:o,rules:{required:l&&"Please, fill this field",validate:t}}),T=y({control:r,name:i,defaultValue:g?[]:null}),{getOptionLabel:S,isOptionEqualToValue:N,renderOption:k}=Mr({valueKey:u,labelKey:p});return n(G,Object.assign({fullWidth:!0,disablePortal:!0,size:"small",readOnly:s,options:m,multiple:g,getOptionLabel:S,isOptionEqualToValue:N,disableCloseOnSelect:v||g,filterSelectedOptions:g,value:T,onChange:d||((e,r)=>{E(r)}),renderOption:k,renderInput:e=>n(C,Object.assign({},e,{variant:"outlined",name:i,label:a,error:!!j,inputRef:x,helperText:!c&&(null==j?void 0:j.message)},b))},O))};function Ar(e){var{name:r,label:t,control:i,required:l=!1,searchBy:o,labelKey:s,multiple:c=!1,disabled:d,valueKey:p,sortBy:u="",hideErrorMessage:m,disableCloseOnSelect:b,textFieldProps:v,onChange:O,queryFunction:E,validate:N,itemQueryFunction:k}=e,w=h(e,["name","label","control","required","searchBy","labelKey","multiple","disabled","valueKey","sortBy","hideErrorMessage","disableCloseOnSelect","textFieldProps","onChange","queryFunction","validate","itemQueryFunction"]);const{field:{ref:I,onChange:M},fieldState:{error:P,isDirty:A}}=f({control:i,name:r,rules:{required:l&&"Please, fill this field",validate:N}}),L=y({control:i,name:r,defaultValue:c?[]:null}),{getOptionLabel:V,isOptionEqualToValue:$,renderOption:R}=Mr({valueKey:p,labelKey:s}),[F,q]=T(!1),[D,z]=T(""),[B,W]=T(""),[J,Y]=T(0),[K,U]=T(0),[X,Z]=T([]),Q=Tr((e=>{U(0),W(e),Z([])}),500),ee=S(((e,r)=>{z(r),Q(r)}),[Q]),re=S(((e,r)=>{M(r),O&&O(e,r)}),[M,O]);j((()=>{if(!A&&L&&k){let e=L;"object"==typeof L&&p in L&&(e=L[p]),k(e).then((e=>{M(e),z(e[s])})).catch()}}),[L,A,p,s,k,M]);const te=S((e=>{const r=e.currentTarget;r.scrollHeight-r.scrollTop-r.clientHeight<=1&&X.length<J&&U((e=>e+1))}),[J,X]),{data:ie,isFetching:ne}=H(["options",K,B],(()=>{const e=_.parse(Object.assign({page:`${K}`,size:"20",sort:u},B?{[o]:B}:{}),{ignoreQueryPrefix:!0});return E(e)}));return j((()=>{ie&&(Z((e=>[...e,...ie.collection])),Y(ie.totalItems))}),[ie]),n(G,Object.assign({fullWidth:!0,disablePortal:!0,size:"small",readOnly:d,options:X,multiple:c,getOptionLabel:V,isOptionEqualToValue:$,disableCloseOnSelect:b||c,filterSelectedOptions:c,inputValue:D,value:L,onChange:re,loading:ne,clearOnBlur:!1,open:F,filterOptions:e=>e,onOpen:()=>{q(!0)},onClose:()=>{q(!1),W("")},onInputChange:ee,ListboxProps:{onScroll:te},renderOption:R,renderInput:e=>n(C,Object.assign({},e,{label:t,variant:"outlined",error:!!P,inputRef:I,helperText:!m&&(null==P?void 0:P.message),InputProps:Object.assign(Object.assign({},e.InputProps),{endAdornment:a(x.Fragment,{children:[ne?n(g,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})})},v))},w))}const Lr=({copyText:e,helpText:r="Copy"})=>{const[t,i]=T(r);return t?n(Y,Object.assign({title:t,placement:"top"},{children:n($,Object.assign({onClick:()=>{navigator.clipboard.writeText(e),i("Copied!"),setTimeout((()=>{i(r)}),1e3)}},{children:n(K,Object.assign({fontSize:"small"},{children:n("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"})}))}))})):null},Vr=({text:e,buttonProps:r={}})=>{const t=U(),{state:i}=X(),a=N((()=>null==i?void 0:i.from),[i]),l=S((()=>{t(a||-1)}),[t,a]);return n(m,Object.assign({mr:2},{children:e?n(o,Object.assign({color:"inherit",onClick:a?null:l,component:Z,to:null!=a?a:""},r,{children:e})):n($,Object.assign({onClick:l},{children:n(K,{children:n("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"})})}))}))},$r=w(((e,r)=>{var{control:t,name:i,mode:o="json",label:s,width:c="100%",height:d="200px",theme:p="monokai",readOnly:u,required:g=!1,validateJson:b=!1,fontSize:O=16,validate:C=!0,parseValue:x}=e,E=h(e,["control","name","mode","label","width","height","theme","readOnly","required","validateJson","fontSize","validate","parseValue"]);const{setError:j,clearErrors:T}=v(),{field:{onChange:S},fieldState:{error:N}}=f({control:t,name:i}),k=y({control:t,name:i});return a(m,Object.assign({display:"flex",flexDirection:"column",width:"100%"},{children:[n(m,{children:s&&n(te,Object.assign({variant:"subtitle1",display:"inline",style:{marginRight:10}},{children:s}))}),a(l,{children:[n(re,Object.assign({ref:r,focus:!0,wrapEnabled:!0,width:c,height:d,showPrintMargin:!1,theme:p,fontSize:O,setOptions:{enableLiveAutocompletion:!0,enableBasicAutocompletion:!0,enableSnippets:!0,showLineNumbers:!0,tabSize:2,useWorker:!1},style:{lineHeight:1.4,zIndex:0,isolation:"isolate"},readOnly:u,value:"json"===o&&"string"!=typeof k?null===k?"":JSON.stringify(k):k,onChange:e=>{if(!e&&g?j(i,{message:"Required field"}):T(i),b)try{JSON.parse(e),T(i)}catch(e){j(i,{message:"Invalid JSON"})}if(x)try{const r=JSON.parse(e);console.log("parsed val:",r),S(r)}catch(r){S(e)}else S(e)},mode:o,onLoad:e=>{C&&b||e.getSession().setUseWorker(!1)}},E)),N&&n(D,Object.assign({error:!0},{children:N.message}))]})]}))})),Rr=(e,r)=>{const t=[...e];return t.splice(r,1),t},Fr=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};function qr(e){return e.replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}const Dr=(e,r,t,i="asc")=>{const n=e[t],a=r[t];return n<a?"asc"===i?-1:1:n>a?"asc"===i?1:-1:0},zr=e=>{if(!e)return"";if("string"==typeof e)try{return JSON.stringify(JSON.parse(e),null,2)}catch(r){return e}else try{return JSON.stringify(e,null,2)}catch(e){return"Failed to stringify JSON"}},Br=e=>{try{return JSON.parse(e)}catch(e){return null}},Wr=e=>{try{const r=JSON.parse(e);return Object.keys(r).forEach((e=>{r[e]=Wr(r[e])})),r}catch(r){return e}},Jr=({value:e,height:r="200px"})=>{const t=N((()=>{if("string"==typeof e)return e;if("object"==typeof e)try{return JSON.stringify(e,null,2)}catch(e){return"Failed to parse JSON"}return null}),[e]);return n(rr,{width:"100%",height:r,language:"json",value:t,options:{tabSize:2,fontSize:16,readOnly:!0,minimap:{enabled:!1}}})},Gr=({open:e,onClose:r,value:t})=>a(s,Object.assign({disableEscapeKeyDown:!0,open:e,onClose:r,fullWidth:!0,maxWidth:"md",style:{width:800,left:"30%"}},{children:[n(d,{children:n(re,{readOnly:!0,value:t,mode:"json",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2,useWorker:!1}})}),a(c,{children:[n(Lr,{copyText:t}),n(o,Object.assign({onClick:r,variant:"contained",color:"secondary"},{children:"Close"}))]})]}));var Hr=({value:e,copyButton:r=!1,textField:t=!1})=>{const{open:i,onOpen:l,onClose:o}=Sr(),s=S((e=>{e.stopPropagation(),l()}),[l]);return a(m,Object.assign({width:"100%"},{children:[a(m,Object.assign({display:"flex",alignItems:"center",justifyContent:"flex-end",pt:1,mb:2},{children:[r&&n(Lr,{copyText:zr(e)}),n(Y,Object.assign({title:"Open",placement:"top"},{children:n($,Object.assign({size:"small",onClick:s},{children:n(K,{children:n("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})})}))}))]})),t?n(m,Object.assign({overflow:"hidden",whiteSpace:"nowrap"},{children:"object"==typeof e?JSON.stringify(e):e})):n(Jr,{value:e}),n(Gr,{open:i,value:zr(e),onClose:o})]}))};const _r=({value:e,type:r,copyText:t,status:i})=>{switch(r){case"id":return a(m,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[n(m,Object.assign({mr:"auto"},{children:`${e.slice(0,6)}...${e.slice(-6)}`})),n(Lr,{copyText:t||e})]}));case"JSON_copy":return n(Hr,{value:e,copyButton:!0});case"JSON":return n(Hr,{value:e});case"JSON_text":return n(Hr,{value:e,textField:!0});case"copy":return a(m,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[n(m,Object.assign({mr:"auto"},{children:e})),n(Lr,{copyText:t||e})]}));case"boolean":return n(K,e?Object.assign({color:"primary",fontSize:"small"},{children:n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}):Object.assign({fontSize:"small"},{children:n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"})}));case"date":return e?a("div",{children:[n("div",{children:ae(new Date(e),"dd.MM.yyyy")}),n("div",{children:ae(new Date(e),"HH:mm:ss")})]}):"";case"status":return n(wi,{text:e,status:i});case"array":return n(m,{children:e.map(((e,r)=>n(m,{children:e},r)))});default:return n("div",{children:e})}},Yr=new RegExp("^[-+]?[0-9]+$"),Kr=new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/),Ur=e=>"string"==typeof e&&e.includes("$("),Xr=e=>e===fr.DATE||e===fr.DATE_TIME||e===fr.TIME,Zr=e=>!e&&0!==e&&!1!==e,Qr=(e,r,t)=>{if(null==r&&e!==fr.BOOLEAN)return null;let i=r;switch(e){case fr.BOOLEAN:i=!!r;break;case fr.INTEGER:case fr.BIG_INTEGER:case fr.BIG_DECIMAL:case fr.FLOAT:case fr.LONG:case fr.DOUBLE:i=Number(r);break;case fr.DATE:case fr.DATE_TIME:case fr.TIME:i=ae(new Date(r.toString()),t.formatText);break;case fr.JSON:case fr.ANY:try{"string"!=typeof r&&(i=JSON.stringify(r)),i=JSON.parse(i)}catch(e){console.log(e),i=null}break;case fr.ENTITY:i=et(t.properties,r)}return i},et=(e,r)=>{if(r){const t={};return e.forEach((e=>{const{key:i,propertyType:n}=e,a=r[i];Array.isArray(a)?t[i]=a.map((r=>Qr(n,r,{formatText:e.format,properties:e.properties}))):t[i]=Qr(n,a,{formatText:e.format,properties:e.properties})})),t}return null},rt=(e,r)=>{const t={};return e.forEach((e=>{const{key:i,name:n,isRequired:a,isMultiple:l,sortOrder:o,isEnabled:s,uiSettings:c,validationNode:d}=e,p="string"==typeof e.propertyType?e.propertyType:e.propertyType.value,u=Object.assign({name:n,propertyType:p,isRequired:a,isMultiple:l,sortOrder:o,isEnabled:s,validationNode:d,uiSettings:c},((e,r)=>{const t={};let i,n="";return r?e.isMultiple?(n="values",i=e.value):(n="value",i=e.value):e.isMultiple?(n="defaultValues",i=e.defaultValue):(n="defaultValue",i=e.defaultValue),Array.isArray(i)?t[n]=i.map((r=>Qr(e.propertyType,r,{formatText:e.format,properties:e.properties}))):t[n]=Qr(e.propertyType,i,{formatText:e.format,properties:e.properties}),t})(Object.assign(Object.assign({},e),{propertyType:p}),r));if("isViewableInList"in e&&(u.isViewableInList=e.isViewableInList),c)try{u.uiSettings=JSON.parse(c)}catch(e){console.log(e)}else u.uiSettings=null;p===fr.BIG_DECIMAL&&(u.precisionScale=e.precisionScale,u.roundingMode=e.roundingMode),p!==fr.DATE&&p!==fr.TIME&&p!==fr.DATE_TIME||(u.format=e.format),p===fr.STRING&&(u.restrictedValues=e.restrictedValues),p===fr.ENTITY_REFERENCE&&(u.definitionCode=e.definitionCode,u.definitionVersion=e.definitionVersion,u.labelPropertyCode=e.labelPropertyCode,u.valuePropertyCode=e.valuePropertyCode),p===fr.ENTITY&&(u.properties=rt(e.properties,r)),t[i]=u})),t};function tt(e,r){return Object.keys(e).map((t=>{const i=Object.assign(Object.assign({key:t},e[t]),r||{});if(i.propertyType===fr.ENTITY&&(i.properties=tt(i.properties,r)),i.propertyType===fr.JSON)try{null==i.defaultValue?i.defaultValue="":i.defaultValue=JSON.stringify(i.defaultValue,null,2)}catch(e){i.defaultValue=""}if(i.uiSettings)try{i.uiSettings=JSON.stringify(i.uiSettings,null,2)}catch(e){i.uiSettings=""}return i.isMultiple&&("defaultValues"in i&&(i.defaultValue=i.defaultValues),"values"in i&&(i.value=i.values)),i})).sort(((e,r)=>Dr(e,r,"sortOrder")))}const it=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return ae(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},nt=e=>{let r=[];return r=Array.isArray(e.properties)?e.properties:tt(e.properties),r.reduce(((e,r)=>{const t=JSON.parse(JSON.stringify(e));return r.propertyType===fr.ENTITY?t[r.key]=nt(r):t[r.key]=r.propertyType,t}),{})},at=({propertyType:e,useExpression:r,required:t})=>{let i=[{value:"widget",label:"Fill array (widget)",sortOrder:1}];return t||i.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===fr.JSON||e===fr.ENTITY||e===fr.ANY?i.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):i.push({value:"expression",label:"Expression",sortOrder:3})),e!==fr.JSON&&e!==fr.ANY&&e!==fr.ENTITY||i.push({value:"json_valid",label:"JSON editor",sortOrder:2}),i=i.sort(((e,r)=>Dr(e,r,"sortOrder"))),i},lt=({propertyType:e,useExpression:r,required:t})=>{let i=[{value:"widget",label:"Widget",sortOrder:1}];switch(t||i.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===fr.JSON||e===fr.ENTITY||e===fr.ANY?i.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):i.push({value:"expression",label:"Expression",sortOrder:3})),e===fr.JSON&&i.push({value:"dem_builder",label:"DEM Builder",sortOrder:2}),e){case fr.STRING:i[0].label="Text input";break;case fr.INTEGER:case fr.BIG_INTEGER:case fr.BIG_DECIMAL:case fr.FLOAT:case fr.LONG:case fr.DOUBLE:i[0].label="Number input";break;case fr.BOOLEAN:i[0].label="Switch";break;case fr.ENTITY_REFERENCE:i[0].label="Entity reference fields";break;case fr.JSON:i[0].label="JSON editor";break;case fr.DATE:i[0].label="Date picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case fr.DATE_TIME:i[0].label="Date & Time picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case fr.TIME:i[0].label="Time picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case fr.ANY:i[0].label="Textarea"}return i=i.sort(((e,r)=>Dr(e,r,"sortOrder"))),i},ot=e=>{var r,{control:t,validate:i,name:a="",label:l="",required:o=!1,defaultValue:s,disabled:c=!1,hideErrorMessage:d=!1,onChange:p,decimal:u=!1}=e,m=h(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","decimal"]);const{field:{ref:g,onChange:b},fieldState:{error:v}}=f({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:e=>u&&!Kr.test(e)?"Not valid number":!(!u&&!Yr.test(e))||"Not valid integer"}}),O=y({control:t,name:a});return n(C,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:g,name:a,label:l,error:!!v,helperText:!d&&(null==v?void 0:v.message),disabled:c,value:null!=O?O:""},m,{onChange:e=>{const r=e.nativeEvent.data||e.target.value;(!isNaN(r)||u&&"."===r||"-"===r||"+"===r)&&(p?p(e):b(e.target.value))},inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=O?O:""})}))},st=e=>{var{control:r,name:t,label:i}=e,a=h(e,["control","name","label"]);const{field:{ref:l,onChange:o}}=f({control:r,name:t}),s=y({control:r,name:t}),c=N((()=>{if("boolean"==typeof s)return s;if("string"==typeof s){if("false"===s)return o(!1),!1;if("true"===s)return o(!0),!0}return!1}),[s,o]);j((()=>{null===s&&o(!1)}),[s,o]);return n(q,{label:i,name:t,control:n(ie,Object.assign({color:"primary",size:"small",inputRef:l,onChange:e=>{const{checked:r}=e.target;o(r)},checked:c},a))})},ct=({control:e,name:r,required:t,label:i,format:a=yr,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=f({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!le(e,a)||"Incorrect date format"}}),d=y({control:e,name:r});return n(ne,{label:i,inputRef:s,inputFormat:a,value:d||null,onChange:e=>{o(oe(e)?ae(e,a):e)},renderInput:e=>n(C,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},dt=({control:e,name:r,required:t,label:i,format:a=Or,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=f({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!le(e,a)||"Incorrect date format"}}),d=y({control:e,name:r});return n(ce,{mask:"",ampm:!1,inputRef:s,label:i,value:d||null,inputFormat:a,onChange:e=>{o(oe(e)?ae(e,a):e)},renderInput:e=>n(C,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},pt=({control:e,name:r,required:t,label:i,format:a=vr,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=f({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!le(e,a)||"Incorrect date format"}}),d=y({control:e,name:r}),[p,u]=T(null);return j((()=>{if(d&&a){let e=se(d,a,new Date);oe(e)||(e=se(d,"HH:mm:ss.SSS",new Date)),u(e)}}),[d,a]),n(de,{mask:"",inputRef:s,label:i,ampm:!1,value:p,inputFormat:a,onChange:e=>{u(e),o(oe(e)?ae(e,a):e)},renderInput:e=>n(C,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})};var ut=()=>{const e=me(),r=ge(e,he),t=ge(e,be),i=ge(e,fe),l=ge(e,ye),o=r=>e.current.setPage(r);return a(m,Object.assign({px:2,display:"flex",alignItems:"center"},{children:[n(ue,{component:"div",page:r,count:i,rowsPerPage:l,rowsPerPageOptions:[10,20,50,100],onPageChange:(e,r)=>o(r),onRowsPerPageChange:r=>e.current.setPageSize(parseInt(r.target.value,10)),ActionsComponent:void 0}),n(pe,{count:t,page:r+1,onChange:(e,r)=>o(r-1)})]}))};var mt=e=>{var{hideMenu:r,currentColumn:t,onUnsort:i}=e,a=h(e,["hideMenu","currentColumn","onUnsort"]);return n(ve,Object.assign({hideMenu:r,currentColumn:t},a,{children:n(Oe,{onClick:r,column:t})}))};var gt=({mode:e})=>{const[r,t]=Q(),i=+r.get("page")||0,n=+r.get("size")||10;return j((()=>{"server"===e&&(r.has("page")||r.set("page","0"),r.has("size")||r.set("size","10"),t(r,{replace:!0}))}),[e,r,t]),{page:i,size:n,onPageChange:e=>{r.set("page",`${e}`),t(r,{replace:!0})},onSizeChange:e=>{r.set("size",`${e}`),t(r,{replace:!0})}}};var ht=()=>{const[e,r]=Q(),t=e.getAll("sort").map((e=>e.split(",")));return{onColumnHeaderClick:({field:t})=>{let i=!1;const n=e.getAll("sort");e.delete("sort"),n.forEach((r=>{const[n,a]=r.split(",");n===t?(i=!0,"asc"===a&&e.append("sort",`${n},desc`)):e.append("sort",`${n},${a}`)})),i||e.append("sort",`${t},asc`),r(e,{replace:!0})},getSortedColumns:e=>e.map((e=>{const r=t.find((r=>r[0]===e.field));return e.headerClassName=r?`Sorted --${r[1]} `:"",e}))}};var bt=e=>{const[r,t]=T(10);j((()=>{t(e)}),[e]);return{pageSize:r,handlePageSizeChange:e=>t(e)}},ft=Ee()({root:{width:"100%","& .MuiDataGrid-virtualScrollerContent":{height:"auto !important",minHeight:"56px !important"},"& .MuiDataGrid-virtualScrollerRenderZone":{position:"static"},"& .MuiDataGrid-renderingZone":{maxHeight:"none !important"},"& .MuiDataGrid-cell":{maxHeight:"none !important",lineHeight:"unset !important",textOverflow:"ellipsis",wordBreak:"break-all","& .MuiDataGrid-actionsCell":{width:"100%",gridGap:"4px",flexWrap:"wrap",'& > button[aria-label="more"]':{marginLeft:"auto"}}},"& .MuiDataGrid-row":{maxHeight:"none !important"},"& .Sorted":{"& .MuiDataGrid-iconButtonContainer":{visibility:"visible",width:"auto","& svg":{opacity:"1 !important"}},"&.--desc":{"& svg":{transform:"rotate(180deg)"}}}}});const yt=({columns:e,rows:r,rowCount:t,loading:i,disableMargin:a,mode:l="server",initialPageSize:o=10,pagination:s=!0,onCellClick:c})=>{const{classes:d}=ft(),{page:p,size:u,onPageChange:g,onSizeChange:h}=gt({mode:l}),{onColumnHeaderClick:b,getSortedColumns:f}=ht(),{pageSize:y,handlePageSizeChange:v}=bt(o),O={sortingMode:l,paginationMode:l,pageSize:"server"===l?u:s?y:t,onPageSizeChange:"server"===l?h:v,components:{Pagination:ut}};return"server"===l&&(O.sortModel=[],O.onColumnHeaderClick=b,O.page=p,O.onPageChange=g,O.components.ColumnMenu=mt),n(m,Object.assign({mt:a?0:2},{children:n(Ce,Object.assign({autoHeight:!0,hideFooterPagination:!s,hideFooter:!s,disableSelectionOnClick:!0,showColumnRightBorder:!0,showCellRightBorder:!0,className:d.root,loading:i,rows:r,columns:f(e),rowCount:t,rowsPerPageOptions:[10,20,50,100],onCellClick:c},O))}))},vt=({icon:e,label:r,showInMenu:t,onClick:i,location:a})=>a?n($,Object.assign({component:Z,to:a,size:"small"},{children:n(Y,Object.assign({title:r,arrow:!0},{children:x.cloneElement(e,{fontSize:"small"})}))})):n(xe,{nonce:"",onResize:void 0,onResizeCapture:void 0,icon:n(Y,Object.assign({title:r,arrow:!0},{children:e})),onClick:i,label:r,showInMenu:t});var Ot=()=>{const[e,r]=Q(),t=N((()=>{var r;return null!==(r=e.get("page"))&&void 0!==r?r:0}),[e]),i=N((()=>{var r;return null!==(r=e.get("size"))&&void 0!==r?r:10}),[e]),n=S((e=>{r((r=>(r.set("page",`${e}`),r)))}),[r]),a=S((e=>{r((r=>(r.set("size",`${e}`),r)))}),[r]);return j((()=>{e.has("page")||r((e=>(e.set("page","0"),e))),e.has("size")||r((e=>(e.set("size","10"),e)))}),[e,r]),{page:t,size:i,onPageChange:n,onSizeChange:a}};var Ct=()=>{const[e,r]=Q(),t=N((()=>e.getAll("sort").map((e=>e.split(",")))),[e]),i=S((e=>{r((r=>{console.log(e,r.get("page")),r.delete("sort");let i=!1;return t.forEach((([t,n])=>{t===e?(i=!0,"asc"===n&&r.append("sort",`${t},desc`)):r.append("sort",`${t},${n}`)})),i||r.append("sort",`${e},asc`),r}))}),[t,r]),n=S((e=>{const r=t.find((([r,t])=>r===e));return!!r&&r[1]}),[t]);return{sortParams:t,onSortChanged:i,getColumnSorting:n}};function xt({columns:e=[],rows:r=[],totalCount:t,children:i,pagination:l=!0,loading:o=!1,onRowClick:s,verticalAlign:c="middle"},d){const{page:p,size:u,onPageChange:m,onSizeChange:g}=Ot(),{onSortChanged:h,getColumnSorting:b}=Ct();return a(Ne,Object.assign({sx:{position:"relative",overflow:"visible"}},{children:[n(Pe,Object.assign({open:o,sx:{position:"absolute",top:0,left:0}},{children:n(xr,{})})),a(je,Object.assign({ref:d},{children:[n(ke,{children:n(we,{children:e.map(((e,r)=>{const t=!!e.sortKey&&b(e.sortKey);return n(Se,Object.assign({align:e.align?e.align:"left",sortDirection:t,sx:{width:e.width?`${e.width}%`:"unset"}},{children:n(Ie,Object.assign({active:!!t,hideSortIcon:!e.sortKey,direction:t||"asc",onClick:()=>e.sortKey?h(e.sortKey):{}},{children:e.label}))}),r)}))})}),n(Te,{children:r.map(((r,t)=>n(we,Object.assign({hover:!0,onClick:s?()=>s(r):r.onClick,sx:{verticalAlign:c}},{children:e.map(((e,i)=>n(Se,Object.assign({align:e.align?e.align:"left",sx:{width:e.width?`${e.width}%`:"unset"}},{children:e.renderCell?e.renderCell(r,t):r[e.id]}),i)))}),t)))}),l||i?n(Me,{children:a(we,{children:[i&&n(Se,Object.assign({colSpan:e.length,sx:{background:"#F0F0F7",px:4,py:3}},{children:i})),l&&r.length&&n(ue,{rowsPerPageOptions:[5,10,25],count:t,rowsPerPage:+u,page:+p,sx:{borderBottom:"none"},onPageChange:(e,r)=>m(r),onRowsPerPageChange:e=>g(+e.target.value)})]})}):null]}))]}))}const Et=w(xt),jt=({actionsList:e})=>{const[r,t]=T(null),i=Boolean(r),l=()=>{t(null)};return a("div",{children:[n($,Object.assign({"aria-label":"more",id:"more-button","aria-controls":i?"more-menu":void 0,"aria-expanded":i?"true":void 0,"aria-haspopup":"true",onClick:e=>{e.stopPropagation(),t(e.currentTarget)}},{children:n(Le,{})})),n(Ae,Object.assign({id:"more-menu",MenuListProps:{"aria-labelledby":"more-button"},anchorEl:r,open:i,onClose:e=>{e.stopPropagation(),l()},PaperProps:{style:{minWidth:"127px"}}},{children:e.map((e=>n(L,Object.assign({onClick:r=>{r.stopPropagation(),e.onClick&&e.onClick(),l()}},{children:e.title}),e.title)))}))]})},Tt=e=>{const{children:r,value:t,index:i}=e,a=h(e,["children","value","index"]);return n("div",Object.assign({role:"tabpanel",hidden:t!==i,id:`simple-tabpanel-${i}`,"aria-labelledby":`simple-tab-${i}`},a,{children:t===i?r:null}))},St=e=>{var r;const{tabs:t}=e,i=U(),l=X(),o=N((()=>new URLSearchParams(l.search)),[l.search]),s=o.get("tab");return a(m,{children:[n(Ve,{children:n(Re,Object.assign({value:s||(null===(r=t[0])||void 0===r?void 0:r.name),indicatorColor:"primary",textColor:"primary",onChange:(e,r)=>{o.set("tab",r),i({pathname:l.pathname,search:o.toString()},{replace:!0})}},{children:t.map((e=>n($e,{value:e.name,label:e.label},e.name)))}))}),n(m,Object.assign({mt:2},{children:t.map((e=>{var r;return n(Tt,Object.assign({value:s||(null===(r=t[0])||void 0===r?void 0:r.name),index:e.name},{children:e.component}),e.name)}))}))]})};var Nt=Ee()((()=>({container:{paddingBottom:"8px"},title:{fontSize:"14px",fontWeight:600,color:"#536DFE"},text:{fontSize:"18px",wordWrap:"break-word"}})));const kt=({title:e,text:r,json:t})=>{const{classes:i}=Nt();return a("div",Object.assign({className:i.container},{children:[n("div",Object.assign({className:i.title},{children:e})),r&&n("div",Object.assign({className:i.text},{children:r})),t&&n(re,{readOnly:!0,value:t,mode:"json",height:"300px",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2,useWorker:!1}})]}))},wt=Object.values(Cr).sort(((e,r)=>e.localeCompare(r)));var It=({propertyFieldName:e})=>{const{control:r}=v();return a(l,{children:[n(Fe,{children:n(ot,{required:!0,control:r,defaultValue:2,name:`${e}.precisionScale`,label:"Precision Scale"})}),n(Fe,{children:n(kr,{required:!0,control:r,name:`${e}.roundingMode`,label:"Rounding Mode",defaultValue:Cr.HALF_UP,options:wt})})]})};var Mt=({propertyFieldName:e,defaultValue:r=""})=>{const{control:t}=v();return n(Fe,{children:n(jr,{required:!0,control:t,defaultValue:r,name:`${e}.format`,label:"Format"})})};const Pt=Ee()((()=>({content:{marginLeft:"4px"},connector:{marginLeft:"4px"},stepper:{padding:"12px"},label:{display:"flex",alignItems:"flex-start"}}))),At=()=>n("div",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#536DFE",marginTop:"5px"}}),Lt=({data:e})=>{const{classes:r}=Pt();return a(Ge,Object.assign({nonLinear:!0,orientation:"vertical",className:r.stepper,connector:n(Ke,{className:r.connector})},{children:[e.filter(Boolean).map(((e,t)=>a(He,Object.assign({expanded:!0},{children:[n(_e,Object.assign({className:r.label,StepIconComponent:At,StepIconProps:{icon:"",completed:!1,active:!0}},{children:e.label})),n(Ye,Object.assign({className:r.content},{children:e.content}))]}),t))),n(He,{})]}))},Vt=({properties:e=[]})=>{const r=N((()=>e?e.map((e=>{const r="string"==typeof e.propertyType?e.propertyType:e.propertyType.value;return{label:a(m,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),a("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," | ",r]})]})),content:"ENTITY"===e.propertyType&&n(Vt,{properties:e.properties})}})):[]),[e]);return n(Lt,{data:r})};var $t=Vt;const Rt={key:"",propertyType:"",name:"",defaultValue:"",isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0};var Ft=({parentPropertyFieldName:e,entityDefinition:r=!1,globalParameter:t=!1})=>{const{control:i,setValue:p,getValues:m,trigger:g}=v(),h=y({control:i,name:`${e}.properties`,defaultValue:m(`${e}.properties`)||[]}),f=y({control:i,name:`${e}.name`}),O=Sr(),[C,x]=T(0),E=S((()=>{if(h){const r=h.length;p(`${e}.properties.${r}`,Rt),x(r)}else p(`${e}.properties`,[Rt])}),[h,e,p]),j=()=>b(void 0,void 0,void 0,(function*(){(yield g(`${e}.properties`))&&O.onClose()}));return a(l,{children:[n(Fe,{children:n(te,Object.assign({variant:"h6"},{children:"Properties"}))}),n(Fe,{children:n($t,{properties:h})}),n(Fe,{children:n(o,Object.assign({variant:"contained",color:"primary",onClick:O.onOpen},{children:"Edit properties"}))}),a(s,Object.assign({disableEscapeKeyDown:!0,open:O.open,onClose:j,fullWidth:!0,maxWidth:"md"},{children:[a(u,{children:[f||"Entity"," Properties"]}),n(d,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:a(Fe,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[a(Fe,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9"}},{children:[n(Ge,Object.assign({nonLinear:!0,activeStep:C,orientation:"vertical",style:{paddingLeft:"4px"}},{children:h.map(((e,r)=>a(He,Object.assign({onClick:()=>(e=>x(e))(r),style:{cursor:"pointer"}},{children:[n(_e,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:e.name||"(no name)"})),n(Ye,{})]}),r)))})),n(o,Object.assign({variant:"contained",size:"small",color:"primary",onClick:E},{children:"Add property"}))]})),n(Fe,Object.assign({container:!0,wrap:"nowrap",direction:"column",xs:9,spacing:2,style:{height:"100%",overflowY:"auto"}},{children:n(hi,{hideAddButton:!0,parentFieldName:e,focusOnIndex:C,entityDefinition:r,globalParameter:t})}))]}))})),n(c,{children:n(o,Object.assign({variant:"contained",color:"primary",onClick:j},{children:"Ok"}))})]}))]})};var qt=({propertyFieldName:e})=>{const{control:r}=v();return a(l,{children:[n(Fe,{children:n(jr,{required:!0,control:r,name:`${e}.definitionCode`,label:"Definition Code"})}),n(Fe,{children:n(jr,{required:!0,control:r,name:`${e}.definitionVersion`,label:"Definition Version"})}),n(Fe,{children:n(jr,{required:!0,control:r,name:`${e}.labelPropertyCode`,label:"Label Property Code"})}),n(Fe,{children:n(jr,{required:!0,control:r,name:`${e}.valuePropertyCode`,label:"Value Property Code"})})]})};var Dt=({propertyFieldName:e})=>{const r=N((()=>`${e}.restrictedValues`),[e]),{control:t,setValue:i,getValues:o}=v(),s=y({control:t,name:r,defaultValue:o(`${e}.restrictedValues`)||[]}),[c,d]=T(""),[p,u]=T(""),g=S((e=>{i(r,Rr(s,e))}),[s,r,i]),h=()=>{c&&(i(r,[...s,c]),d(""))};return a(l,{children:[n(Fe,{children:n(te,Object.assign({variant:"h6"},{children:"Restricted Values"}))}),!!(null==s?void 0:s.length)&&n(Fe,{children:n(m,Object.assign({display:"flex",flexWrap:"wrap"},{children:s.map(((e,r)=>n(Ue,{sx:{mr:1},variant:"outlined",label:e,onDelete:()=>g(r)},r)))}))}),n(Fe,{children:n(C,{fullWidth:!0,variant:"outlined",size:"small",label:"Add restricted value",value:c,onChange:e=>{const{value:r}=e.target;d(r),s.includes(r)?u("This value already exists"):u("")},error:!!p,helperText:p,name:"restrictedValues",inputProps:{onKeyDown:e=>{"Enter"===e.key&&h()}},InputProps:{endAdornment:n($,Object.assign({size:"small",onClick:h,disabled:!!p},{children:n(Xe,{})}))}})})]})};const zt=({propertyType:e,propertyFieldName:r,entityDefinition:t=!1,globalParameter:i=!1})=>{switch(e){case fr.STRING:return n(Dt,{propertyFieldName:r});case fr.BIG_DECIMAL:return n(It,{propertyFieldName:r});case fr.DATE:return n(Mt,{propertyFieldName:r,defaultValue:yr});case fr.TIME:return n(Mt,{propertyFieldName:r,defaultValue:vr});case fr.DATE_TIME:return n(Mt,{propertyFieldName:r,defaultValue:Or});case fr.ENTITY_REFERENCE:return n(qt,{propertyFieldName:r});case fr.ENTITY:return n(Ft,{parentPropertyFieldName:r,globalParameter:i,entityDefinition:t});default:return null}};var Bt=({validate:e=!1,name:r,inputRef:t})=>{const{control:i,setValue:a,setError:l,clearErrors:o}=v(),s=y({control:i,name:r});return n(re,{wrapEnabled:!0,width:"100%",height:"200px",theme:"monokai",fontSize:14,showPrintMargin:!1,style:{lineHeight:1.4,zIndex:0,isolation:"isolate"},setOptions:{enableLiveAutocompletion:!0,enableBasicAutocompletion:!0,showLineNumbers:!0,tabSize:2,useWorker:!1},ref:t,name:r,value:"string"!=typeof s?null===s?"":JSON.stringify(s):s,onChange:t=>{if(a(r,t),e)try{JSON.parse(t),o(r)}catch(e){l(r,{message:"Invalid JSON"})}},mode:"json",onLoad:r=>{e||r.getSession().setUseWorker(!1)}})};var Wt=({name:e,label:r,required:t,restrictedValues:i})=>{const{control:l}=v(),{field:{onChange:o,ref:s},fieldState:{error:c}}=f({control:l,name:e,rules:{required:t&&(Array.isArray(i)&&i.length?"Please, select a value":"Please, fill this field")}}),d=y({control:l,name:e});return Array.isArray(i)&&i.length?a(F,Object.assign({fullWidth:!0,size:"small",variant:"outlined",error:!!c},{children:[n(Qe,Object.assign({htmlFor:"type-select"},{children:r})),n(Ze,Object.assign({labelId:"type-select",label:r,value:d||"",onChange:o,ref:s},{children:i.map((e=>n(L,Object.assign({value:e},{children:e}),e)))}))]})):n(jr,{hideErrorMessage:!0,required:t,control:l,name:e,label:r})};const Jt=({property:e,name:r,label:t,useExpression:i,inputRef:a})=>{const{control:l}=v();switch(N((()=>"string"==typeof e.propertyType?e.propertyType:e.propertyType.value),[e])){case fr.BIG_DECIMAL:case fr.FLOAT:case fr.DOUBLE:return n(ot,{decimal:!0,required:!0,hideErrorMessage:!0,control:l,name:r,label:t});case fr.INTEGER:case fr.BIG_INTEGER:case fr.LONG:return n(ot,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t});case fr.BOOLEAN:return n(st,{control:l,name:r});case fr.DATE:return n(ct,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case fr.TIME:return n(pt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case fr.DATE_TIME:return n(dt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case fr.JSON:return n(Bt,{validate:!0,name:r,inputRef:a});case fr.STRING:return n(Wt,{required:!0,name:r,label:t,restrictedValues:e.restrictedValues});case fr.ENTITY_REFERENCE:return n(jr,{required:!0,hideErrorMessage:!0,name:r,label:t,control:l});case fr.ANY:return n(Bt,{name:r,inputRef:a});case fr.ENTITY:return n(ji,{properties:e.properties,dataFieldName:r,useExpression:i});default:return n("div",{children:"No widget"})}};var Gt=({value:e,property:r,label:t,isDirty:i,required:n=!1,useExpression:a=!1,multipleOptions:l=!1})=>{const o=N((()=>t?`${t} (value)`:`${r.name} (value)`),[t,r]),s=N((()=>t?`${t} (widget)`:`${r.name} (widget)`),[t,r]),c=N((()=>"string"==typeof r.propertyType?r.propertyType:r.propertyType.value),[r]),[d,p]=T(null),u=N((()=>l?at({propertyType:c,required:n,useExpression:a}):lt({propertyType:c,required:n,useExpression:a})),[a,n,c,l]);return j((()=>{d?i||(Ur(e)&&"expression"!==d?p("expression"):null==e||Ur(e)||"widget"===d||p("widget")):Zr(e)&&(null==u?void 0:u.length)?p(u[0].value):a&&Ur(e)?p("expression"):p("widget")}),[e,d,u,a,i]),{propertyType:c,valueLabel:o,fillOptionLabel:s,fillOption:d,fillOptions:u,setFillOption:p}};var Ht=Ee()((()=>({inputLabel:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"}})));const _t={code:"",name:"",version:0,properties:[]},Yt={code:"",name:"",version:0,properties:{}},Kt=({property:e,name:r,useExpression:t,label:i,required:l,title:o})=>{const{control:s,clearErrors:c,register:d}=v(),{field:{ref:p,onChange:u},fieldState:{error:g,isDirty:h}}=f({name:r}),b=y({control:s,name:r}),{propertyType:O,valueLabel:C,fillOptionLabel:x,fillOption:E,fillOptions:T,setFillOption:S}=Gt({value:b,property:e,isDirty:h,label:i,required:l,useExpression:t});j((()=>{void 0===b&&u(null)}),[b,u]);const{classes:N}=Ht();return a(Fe,Object.assign({xs:12},{children:[o&&n(m,Object.assign({mb:2},{children:n(te,Object.assign({variant:"h6"},{children:o}))})),T?n(m,Object.assign({mb:2},{children:a(F,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[n(Qe,Object.assign({htmlFor:"type-select",className:N.inputLabel},{children:x})),n(Ze,Object.assign({labelId:"type-select",label:x,value:E||"",onChange:e=>{const t=e.target.value;if("null"===t)d(r,{value:null});else if("widget"===t)if(O===fr.JSON&&b&&"string"!=typeof b&&"dem_builder"===E&&"properties"in b){const e=Object.assign(Object.assign({},b),{properties:rt(b.property||[])});try{u(JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed")}}else u(null);else if("expression"===t||"string"===t)u("");else if("dem_builder"===t)if(b)try{const e=JSON.parse(b);e.properties=tt(e.properties||{}),u(e)}catch(e){u(_t),console.log("Parse failed")}else u(_t);S(t),c(r)}},{children:T.map((e=>n(L,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===E&&(O===fr.JSON||O===fr.ENTITY||O===fr.ANY?n(Bt,{name:r,inputRef:p}):n(jr,{control:s,name:r,label:C,required:!0,hideErrorMessage:!0})),"string"===E&&n(jr,{control:s,name:r,label:C,required:!0,hideErrorMessage:!0}),"json_notvalid"===E&&n(Bt,{name:r,inputRef:p}),"widget"===E&&n(Jt,{property:e,name:r,useExpression:t,label:C,inputRef:p,required:l}),"dem_builder"===E&&n(bi,{title:"JSON",definitionFieldName:r}),g&&n(te,Object.assign({color:"secondary"},{children:g.message}))]}))};var Ut=({name:e,property:r,useExpression:t,required:i,label:l})=>{const{control:s,setValue:c,clearErrors:d}=v();f({control:s,name:e,rules:{validate:e=>!(!e||Array.isArray(e)&&!e.length)||"Please, fill array"}});const p=y({control:s,name:e}),u=S((()=>{p&&Array.isArray(p)?c(`${e}.${p.length}`,null):c(e,[null]),d(e)}),[e,p,c,d]),g=S((r=>{c(e,Rr(p,r))}),[e,p,c]);return a(Fe,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[p&&Array.isArray(p)?p.map(((o,s)=>n(Fe,Object.assign({xs:12},{children:a(m,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[n(Kt,{required:i,property:r,useExpression:t,name:`${e}.${s}`,label:`${l||r.name} (${s+1})`}),n(m,Object.assign({mt:"8px",ml:"4px"},{children:n($,Object.assign({size:"small",onClick:()=>g(s)},{children:n(er,{fontSize:"small"})}))}))]}))}),s))):null,n(Fe,{children:n(o,Object.assign({variant:"contained",size:"small",color:"primary",onClick:u},{children:"Add value"}))})]}))};const Xt=({property:e,name:r,useExpression:t,required:i,label:l,title:o})=>{const{control:s,clearErrors:c}=v(),{field:{ref:d,onChange:p},fieldState:{error:u,isDirty:g}}=f({control:s,name:r,rules:{validate:e=>!(i&&!e)||"Please, fill this field"}}),h=y({control:s,name:r}),{propertyType:b,valueLabel:O,fillOptionLabel:C,fillOption:x,fillOptions:E,setFillOption:T}=Gt({property:e,value:h,isDirty:g,label:l,required:i,useExpression:t,multipleOptions:!0});j((()=>{void 0===h&&p(null)}),[h,p]);const{classes:S}=Ht();return a(Fe,{children:[o&&n(m,Object.assign({mb:2},{children:n(te,Object.assign({variant:"h6"},{children:o}))})),E?n(m,Object.assign({mb:2},{children:a(F,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[n(Qe,Object.assign({htmlFor:"type-select",className:S.inputLabel},{children:C})),n(Ze,Object.assign({labelId:"type-select",label:C,value:x||"",onChange:e=>{const t=e.target.value;"null"===t?p(null):"expression"===t||"json_valid"===t||"json_notvalid"===t?p(""):"widget"===t&&p([]),T(t),c(r)}},{children:E.map((e=>n(L,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===x&&(b===fr.JSON||b===fr.ENTITY||b===fr.ANY?n(Bt,{name:r,inputRef:d}):n(jr,{required:!0,hideErrorMessage:!0,control:s,name:r,label:O})),"json_valid"===x&&n(Bt,{validate:!0,name:r,inputRef:d}),"widget"===x&&n(Ut,{property:e,name:r,useExpression:t,required:i,label:l}),u&&n(te,Object.assign({color:"secondary"},{children:u.message}))]})},Zt=({propertyFieldName:e,name:r,label:t="",required:i})=>{const{control:a}=v(),l=y({control:a,name:`${e}.propertyType`}),o=y({control:a,name:`${e}.isMultiple`}),s=y({control:a,name:`${e}.format`}),c=y({control:a,name:`${e}.restrictedValues`}),d=y({control:a,name:`${e}.properties`}),p=y({control:a,name:`${e}.isRequired`}),u=N((()=>{const e="string"==typeof l?l:l.value;return{name:t,isRequired:p,isMultiple:o,format:s,restrictedValues:c,properties:d,propertyType:e,defaultValue:null,defaultValues:[],sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null}}),[l,s,c,o,t,p,d]);return n(o?Xt:Kt,{name:r,property:u,title:t,required:i})};var Qt=({name:e})=>{const r=N((()=>({type:""})),[]),{control:t}=v(),{fields:i,append:l,remove:s}=O({control:t,name:e});return a(m,Object.assign({mt:2},{children:[n(o,Object.assign({variant:"outlined",size:"small",onClick:()=>l(r)},{children:"Add node"})),i.map((({id:r},t)=>n(si,{removeHandle:()=>s(t),name:`${e}.${t}`},r)))]}))};const ei=I(""),ri=({name:e,control:r})=>a(l,{children:[n(te,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),n(m,{children:n(jr,{control:r,name:`${e}.minimumLength`,label:"Minimum Length",type:"number"})}),n(m,Object.assign({mt:2},{children:n(jr,{control:r,name:`${e}.maximumLength`,label:"Maximum Length",type:"number"})}))]}),ti=({name:e,control:r})=>a(l,{children:[n(te,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),n(m,{children:n(jr,{control:r,name:`${e}.multipleOf`,label:"Multiple Of",type:"number"})}),n(m,Object.assign({mt:2},{children:n(jr,{control:r,name:`${e}.minimum`,label:"Minimum",type:"number"})})),n(m,Object.assign({mt:2},{children:n(jr,{control:r,name:`${e}.maximum`,label:"Maximum",type:"number"})})),a(m,Object.assign({mt:2},{children:[n(wr,{control:r,name:`${e}.exclusiveMinimum`,label:"Exclusive Minimum",defaultValue:"false"}),n(wr,{control:r,name:`${e}.exclusiveMaximum`,label:"Exclusive Maximum",defaultValue:"false"})]}))]}),ii=["STRING_REGEX","JSON_SCHEMA"],ni=new Set([fr.INTEGER,fr.FLOAT,fr.DOUBLE,fr.BIG_DECIMAL,fr.BIG_INTEGER,fr.LONG]);var ai=({name:e})=>{const{control:r,setValue:t}=v(),i=M(ei),o=y({control:r,name:`${e}.type`}),s=N((()=>{if("STRING_REGEX"===o)return n(jr,{control:r,name:`${e}.pattern`,label:"Pattern"});if("JSON_SCHEMA"===o)switch(!0){case i===fr.STRING:return n(ri,{name:`${e}.node`,control:r});case ni.has(i):return n(ti,{name:`${e}.node`,control:r});case i===fr.JSON:return n($r,{label:"Properties",control:r,name:`${e}.properties`,validateJson:!0,parseValue:!0});default:return"Not available for type "+i}return null}),[i,o,r,e]);return j((()=>{ni.has(i)&&"JSON_SCHEMA"===o&&(t(`${e}.node.exclusiveMinimum`,!1),t(`${e}.node.exclusiveMaximum`,!1))}),[i,o,t,e]),n(Lt,{data:[{label:"Validator",content:a(l,{children:[n(m,{children:n(kr,{control:r,name:`${e}.type`,label:"Type",options:ii,onChange:r=>{t(e,{}),t(`${e}.type`,r.target.value)}})}),n(m,Object.assign({mt:2},{children:s}))]})}]})};const li=["AND","OR","NOT","NODE"],oi=({name:e,removeHandle:r})=>{const{control:t}=v(),i=y({control:t,name:`${e}.type`}),o=N((()=>({AND:n(Qt,{name:`${e}.nodes`}),OR:n(Qt,{name:`${e}.nodes`}),NODE:n(ai,{name:`${e}.validator`}),NOT:n(oi,{name:`${e}.node`})})),[e]);return n(Lt,{data:[{label:"Node Type",content:a(l,{children:[a(m,Object.assign({display:"flex",alignItems:"center"},{children:[n(kr,{required:!0,control:t,name:`${e}.type`,label:"Type",options:li}),r&&n(m,Object.assign({ml:2},{children:n($,Object.assign({onClick:r,color:"primary"},{children:n(Je,{})}))}))]})),n(m,{children:o[i]})]})}]})};var si=oi;const ci=({name:e})=>{const[r,t]=T(!1),{setValue:i,getValues:o}=v(),s=S((r=>{t(r.target.checked),r.target.checked||i(e,null)}),[i,e]);return j((()=>{o(e)&&t(!0)}),[e,o]),a(l,{children:[a(m,Object.assign({display:"flex",justifyContent:"space-between"},{children:[n(te,Object.assign({variant:"h6"},{children:"Validator"})),n(q,{label:"Enable",control:n(z,{color:"primary",checked:r,onChange:s})})]})),r&&n(si,{name:e})]})};var di=({name:e,label:r="",propertyFieldName:t,type:i,decimal:a=!1,options:l=[],required:o=!1})=>{const{control:s}=v(),c=N((()=>`${t}.${e}`),[e,t]);switch(i){case"text":return n(jr,{control:s,name:c,label:r,required:o});case"number":return n(ot,{control:s,name:c,label:r,decimal:a,required:o});case"select":return n(kr,{control:s,name:c,label:r,options:l,required:o});case"autocomplete":return n(Pr,{control:s,name:c,label:r,options:l,required:o});case"json":return n($r,{control:s,name:c,label:r,mode:"json",required:o});default:return null}};var pi=e=>({customCheckboxes:N((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:N((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e])});const ui=Object.values(fr).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}))),mi=({propertyFieldName:e,entityDefinition:r=!1,globalParameter:t=!1,customPropertyFields:i=[]})=>{var o;const{control:s,setValue:c}=v(),d=y({control:s,name:`${e}.propertyType`}),p=y({control:s,name:`${e}.isMultiple`}),u=y({control:s,name:`${e}.isRequired`}),{customCheckboxes:m,customFields:g}=pi(i),h=N((()=>{let e=t?"Value":"Default Value";return p&&(e+="s"),e}),[t,p]);return j((()=>{d&&"string"==typeof d&&c(`${e}.propertyType`,ui.find((e=>e.value===d)))}),[d,c,e]),a(Fe,Object.assign({container:!0,direction:"column",spacing:2},{children:[n(Fe,{children:n(Nr,{required:!0,control:s,name:`${e}.key`,label:"Key"})}),n(Fe,{children:n(Nr,{required:!0,control:s,name:`${e}.name`,label:"Name"})}),n(Fe,{children:n(Pr,{required:!0,control:s,name:`${e}.propertyType`,label:"Type",options:ui,onChange:(r,i)=>{const n=`${e}.propertyType`,a=`${e}.${t?"value":"defaultValue"}`;c(a,p?[]:null),c(n,i)}})}),n(Fe,{children:n(ot,{required:!0,control:s,name:`${e}.sortOrder`,label:"Sort Order"})}),n(Fe,{children:n($r,{control:s,name:`${e}.uiSettings`,label:"UI Settings",validateJson:!0})}),a(Fe,{children:[n(wr,{control:s,name:`${e}.isMultiple`,label:"Multiple"}),n(wr,{control:s,name:`${e}.isEnabled`,label:"Enabled"}),n(wr,{control:s,name:`${e}.isRequired`,label:"Required"}),r&&n(wr,{control:s,name:`${e}.isViewableInList`,label:"Is viewable in list"}),m.length?n(l,{children:m.map(((r,t)=>n(wr,{control:s,name:`${e}.${r.name}`,label:r.label},t)))}):null]}),d&&a(l,{children:[n(Fe,{children:n(ei.Provider,Object.assign({value:null!==(o=d.value)&&void 0!==o?o:d},{children:n(ci,{name:`${e}.validationNode`})}))}),n(zt,{propertyType:"string"==typeof d?d:d.value,propertyFieldName:e,globalParameter:t,entityDefinition:r}),n(Zt,{propertyFieldName:e,name:`${e}.${t?"value":"defaultValue"}`,label:h,required:!!t&&u})]}),g.length?n(l,{children:g.map(((r,t)=>n(Fe,{children:n(di,Object.assign({},r,{propertyFieldName:e}))},t)))}):null]}))},gi={key:"",propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},hi=({parentFieldName:e,hideAddButton:r,focusOnIndex:t,required:i,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[]})=>{const p=N((()=>e?`${e}.properties`:"properties"),[e]),{setValue:u,clearErrors:m,control:g}=v(),{fieldState:{error:h}}=f({control:g,name:p,rules:{required:i&&"Please, add properties"}}),b=y({control:g,name:p}),O=E([]);j((()=>{"number"==typeof t&&O.current[t]&&O.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,O]);const C=S((()=>{b?u(`${p}.${b.length}`,gi):u(p,[gi]),m(p)}),[b,p,m,u]),x=S((e=>{u(`${p}`,Rr(b,e))}),[b,p,u]);return a(l,{children:[h&&h.message&&n(Fe,Object.assign({sm:12},{children:n(te,Object.assign({color:"secondary"},{children:h.message}))})),b&&b.map(((e,r)=>n(Fe,Object.assign({sm:12,ref:e=>O.current[r]=e},{children:a(qe,Object.assign({defaultExpanded:!0,elevation:3},{children:[n(De,Object.assign({expandIcon:n(We,{})},{children:n(te,Object.assign({color:h&&h[r]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:e.name||`Property ${r+1}`}))})),n(ze,{children:n(mi,{propertyFieldName:`${p}.${r}`,entityDefinition:s,globalParameter:c,customPropertyFields:d})}),n(Be,{children:n(o,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>x(r)},{children:"Remove"}))})]}))}),r))),!r&&n(Fe,Object.assign({xs:12},{children:n(o,Object.assign({variant:"contained",size:"small",color:"primary",onClick:C},{children:"Add property"}))}))]})},bi=({definitionFieldName:e,title:r,hideCodeField:t,hideVersionField:i,hideNameField:l,required:o=!1})=>{const{control:s}=v();return a(Fe,Object.assign({container:!0,direction:"column",spacing:2},{children:[r&&n(Fe,Object.assign({sm:12},{children:n(m,Object.assign({my:2},{children:n(te,Object.assign({variant:"h4"},{children:r}))}))})),!l&&n(Fe,Object.assign({sm:12},{children:n(jr,{required:!0,control:s,name:e?`${e}.name`:"name",label:"Name"})})),!t&&n(Fe,Object.assign({sm:12},{children:n(jr,{required:!0,control:s,name:e?`${e}.code`:"code",label:"Code"})})),!i&&n(Fe,Object.assign({sm:12},{children:n(ot,{required:!0,control:s,name:e?`${e}.version`:"version",label:"Version"})})),n(hi,{required:o,parentFieldName:e})]}))},fi={name:"Name",key:"Key",propertyType:"Property Type",defaultValue:"Default Value",defaultValues:"Default Values",sortOrder:"Sort Order",isRequired:"Required",isMultiple:"Multiple",isEnabled:"Enabled",isViewableInList:"Is Viewable In List",precisionScale:"Precision Scale",roundingMode:"Rounding Mode",format:"Format",definitionCode:"Definition Code",definitionVersion:"Definition Version",labelPropertyCode:"Label Property Code",valuePropertyCode:"Value Property Code",restrictedValues:"Restricted Values",value:"Value",values:"Values",uiSettings:"UI Settings",validationNode:"Validation Node"},yi=({value:e,type:r})=>r!==fr.JSON&&r!==fr.ENTITY&&r!==fr.ANY||!e?n(te,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===e?"null":e.toString()})):n(Jr,{value:e}),vi=(e,r,t)=>{switch(r){case"isRequired":case"isMultiple":case"isEnabled":case"isViewableInList":return e?n(ir,{color:"primary",fontSize:"small"}):null;case"restrictedValues":return e?n(m,Object.assign({display:"flex",flexWrap:"wrap"},{children:e.map((e=>n(Ue,{label:e,style:{wordBreak:"break-word",maxWidth:"500px"}},e)))})):null;case"defaultValue":case"value":return n(yi,{value:e,type:t});case"values":case"defaultValues":return Array.isArray(e)&&t!==fr.ENTITY&&t!==fr.JSON&&t!==fr.ANY?a("div",{children:["[",null==e?void 0:e.map(((e,r)=>n("div",{children:n(yi,{value:e,type:t})},r))),"]"]}):n(Jr,{value:e});case"uiSettings":case"validationNode":return e?n(Jr,{value:e}):null;default:return n(te,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:e}))}};var Oi=({property:e})=>{const r=N((()=>(e&&(e.isMultiple?(delete e.defaultValue,delete e.value):(delete e.defaultValues,delete e.values)),e)),[e]);return n(je,Object.assign({size:"small"},{children:n(Te,{children:Object.keys(fi).map((e=>e in r?a(we,{children:[n(Se,Object.assign({width:"30%"},{children:n(te,{children:fi[e]})})),n(Se,{children:vi(r[e],e,r.propertyType)})]},e):null))})}))};var Ci=P((({properties:e,parentNames:r=[]})=>{const t=N((()=>{let r=!1;return e.every((e=>e.propertyType!==fr.ENTITY||(r=!0,!1))),r}),[e]);return a(m,Object.assign({mt:4},{children:[n(te,Object.assign({variant:"h6"},{children:"Properties"})),a(Ge,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[e.map((e=>a(He,Object.assign({expanded:!0},{children:[n(_e,{StepIconProps:{icon:"",completed:!1,active:!0}}),n(Ye,{children:n(xi,{property:e,parentNames:[...r],defaultExpanded:!1})})]}),e.key))),t&&n(He,{})]}))]}))}));const xi=({property:e,parentNames:r=[],defaultExpanded:t=!0})=>{const[i,l]=T(!0);return j((()=>{l(t)}),[t]),a(qe,Object.assign({elevation:3,style:{backgroundColor:r.length%2==1?"#f1f1f1":"#fff"},expanded:i,onChange:()=>l((e=>!e))},{children:[n(De,Object.assign({expandIcon:n(tr,{})},{children:n(te,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:e.name}))})),n(ze,{children:a(m,Object.assign({width:"100%"},{children:[n(Oi,{property:e}),e.propertyType===fr.ENTITY&&n(Ci,{properties:tt(e.properties),parentNames:[...r,e.name]})]}))})]}))},Ei=({properties:e,expandAll:r=!0})=>{const t=N((()=>Array.isArray(e)?e:e?tt(e):[]),[e]);return n(m,Object.assign({display:"flex",flexDirection:"column"},{children:t.length?t.map((e=>n(xi,{property:e,defaultExpanded:r},e.key))):n(te,{children:"No properties"})}))},ji=({properties:e,dataFieldName:r,useExpression:t=!1,title:i})=>{const l=N((()=>e?e.map((e=>{const i="string"==typeof e.propertyType?e.propertyType:e.propertyType.value;return{label:a(m,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),a("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," | ",i]})]})),content:e.isMultiple?n(Xt,{property:e,name:`${r}.${e.key}`,useExpression:t,label:e.name,required:e.isRequired}):n(Kt,{property:e,name:`${r}.${e.key}`,useExpression:t,label:e.name,required:e.isRequired})}})):[]),[e,r,t]);return a(Fe,Object.assign({container:!0,direction:"column",spacing:2},{children:[i&&n(Fe,Object.assign({xs:12},{children:n("div",Object.assign({style:{fontWeight:"600"}},{children:i}))})),n(Lt,{data:l})]}))},Ti=({property:e,data:r,properties:t})=>{const i=e=>n(m,Object.assign({style:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"4px"}},{children:null===e?"null":null==e?void 0:e.toString()}));if(Ur(r))return i(r);switch(e.propertyType){case fr.JSON:return n(Jr,{value:r});case fr.ENTITY:return n(Ni,{properties:t,data:r});case fr.ANY:return"object"==typeof r?n(Jr,{value:r}):i(r);default:return i(r)}};var Si=({property:e,data:r,hasBackground:t=!1})=>{const i=N((()=>e.propertyType===fr.ENTITY?Array.isArray(e.properties)?e.properties:tt(e.properties):[]),[e]);return n(m,Object.assign({style:{backgroundColor:t?"#f1f1f1":"none"}},{children:n(Ti,{property:e,data:r,properties:i})}))};const Ni=({properties:e,data:r})=>{const t=N((()=>e&&r?e.map((e=>{var t;const{key:i,name:o,isMultiple:s,propertyType:c}=e,d=null!==(t=r[e.key])&&void 0!==t?t:r;return{label:a(m,Object.assign({display:"flex",flexDirection:"column"},{children:[n("b",{children:o}),a("span",{children:[i," | ",s?"multiple":"single"," | ",c]})]})),content:s&&Array.isArray(d)&&e.propertyType!==fr.ANY?n(l,{children:d.map(((r,t)=>n(m,Object.assign({mb:2},{children:n(Si,{property:e,data:r,hasBackground:!0})}),t)))}):n(Si,{property:e,data:d})}})):[]),[e,r]);return n(Fe,Object.assign({container:!0,direction:"column",spacing:2},{children:n(Lt,{data:t})}))};var ki=Ee()((e=>({root:{backgroundColor:"#eee",fontSize:"14px",padding:"0 8px",borderRadius:"10px",width:"fit-content","&.success":{backgroundColor:"#a9dfa9"},"&.error":{backgroundColor:"#ff7e7e"},"&.warning":{backgroundColor:e.palette.warning.main}}})));const wi=({text:e,status:r="default"})=>{const{classes:t}=ki();return n("div",Object.assign({className:nr(t.root,{[r]:!0})},{children:e}))},Ii=Ee()((()=>({propertyStepLabel:{"&:hover":{fontWeight:"600",cursor:"pointer"}}}))),Mi=({properties:e,parentKey:r="",activePath:t="",prefix:i="",onClick:l})=>{const{classes:o}=Ii();return n(Ge,Object.assign({orientation:"vertical",onClick:e=>e.stopPropagation()},{children:e&&e.map((e=>{var s;const c=r?`${r}.${e.key}`:e.key,d=null!==(s=e.propertyType.value)&&void 0!==s?s:e.propertyType;return a(He,Object.assign({expanded:!0,onClick:()=>{return e=c,void l(i?`${i}.${e}`:e);var e}},{children:[n(_e,Object.assign({StepIconProps:{icon:"",completed:!1,active:t===c}},{children:a("div",Object.assign({className:o.propertyStepLabel},{children:[e.name," - ",e.key," - ",d]}))})),n(Ye,{children:n("div",{children:d===fr.ENTITY&&n(Mi,{onClick:l,activePath:t,properties:e.properties,parentKey:c},e.key)})})]}),e.key)}))}))};var Pi=Mi;const Ai=({open:e=!1,onClose:r,onPaste:t,properties:i})=>{const[l,p]=T("");return a(s,Object.assign({open:e,onClose:r,fullWidth:!0,maxWidth:"md"},{children:[n(u,{children:"JSON path picker"}),a(d,{children:[(null==i?void 0:i.length)?i.map(((e,r)=>a("div",{children:[n(te,Object.assign({variant:"h6"},{children:e.title})),n(Pi,{properties:e.properties,prefix:e.pathPrefix,onClick:p,activePath:l})]},r))):n(te,{children:"Please, add properties"}),l&&a(te,Object.assign({variant:"h6",gutterBottom:!0},{children:["Selected path : $(",l,")"]}))]}),a(c,{children:[n(o,Object.assign({variant:"contained",color:"primary",onClick:()=>{navigator.clipboard.writeText(`$(${l})`),ar.success("Copied!")}},{children:"Copy"})),n(o,Object.assign({variant:"contained",color:"primary",onClick:()=>{t(`$(${l})`),ar.success("Pasted!")}},{children:"Paste"})),n(o,Object.assign({variant:"contained",color:"secondary",onClick:r},{children:"Close"}))]})]}))},Li=I({collapsed:!1,toggleCollapse:()=>{console.log("collapse toggle")}}),Vi=()=>M(Li),$i=({children:e})=>{const[r,t]=T(!!localStorage.getItem("sidebar_collapsed")),i=S((()=>{t(!r),localStorage.setItem("sidebar_collapsed",`${!r}`)}),[r]);return n(Li.Provider,Object.assign({value:{collapsed:r,toggleCollapse:i}},{children:e}))},Ri=e("div")({position:"relative","&:hover":{".button-collapse":{opacity:1}}}),Fi=e(or)((e=>({width:248,flexShrink:0,position:"relative",transition:"all 0.3s ease-in-out","& .MuiDrawer-paper":{backgroundColor:e.theme.palette.secondary.main,width:248,boxSizing:"border-box",borderRight:"none",borderRadius:0,transition:"all 0.3s ease-in-out",overflow:"hidden"},"&.collapsed":{width:64,"& .MuiDrawer-paper":{width:64}}}))),qi=e(gr)((({theme:e})=>({backgroundColor:"#fff",borderRight:"1px solid rgba(38, 40, 66, 0.08)",fontSize:24,fontWeight:600}))),Di=e(sr)((e=>({padding:e.theme.spacing(3),margin:0}))),zi=e(cr)((e=>({color:"#fff",height:e.theme.spacing(11),overflow:"hidden"}))),Bi=e(pr)((({theme:e})=>({borderRadius:e.spacing(2.5),padding:e.spacing(2),height:e.spacing(11),"&.active":{backgroundColor:"rgba(38, 40, 66, 0.12)","&.main":{backgroundColor:"rgba(255, 255, 255, 0.12)",borderLeft:"4px solid #E0613A"}},"&:hover":{backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.collapsed":{width:e.spacing(11),"&.active":{"&.main":{border:"none",backgroundColor:"#E0613A"}}}}))),Wi=e(dr)((({theme:e})=>({color:"#fff",width:20,height:20,minWidth:20,marginRight:e.spacing(2),"& svg":{marginLeft:2,fill:"#fff",color:"#fff"},"&.collapsed":{marginRight:0}}))),Ji=e(ur)((()=>({backgroundColor:"inherit",color:"#fff",paddingLeft:0,textTransform:"uppercase"}))),Gi=e(mr)((e=>({width:"100%","& > *":{overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-all",whiteSpace:"nowrap"},"&.collapsed":{display:"none"}}))),Hi=e(sr)((e=>({margin:0,padding:0,"& .MuiListItemText-root":{paddingLeft:e.theme.spacing(7)}}))),_i=e(hr)((e=>({position:"absolute",top:e.theme.spacing(10),left:"calc(100% - 16px)",width:e.theme.spacing(8),height:e.theme.spacing(8),border:"1px solid #E0E3EA",borderRadius:"50%",boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.12)",backgroundColor:"#fff",zIndex:8e3,opacity:0,transition:"all 0.3s ease-in-out","&.collapsed":{img:{transition:"all 0.3s ease-in-out",transform:"rotate(180deg)"}}})));var Yi=({route:e,isActive:r})=>{const{collapsed:t}=Vi();return e.link?n(zi,Object.assign({disablePadding:!0},{component:Z,replace:!0,to:{pathname:e.link,search:e.query}},{children:a(Bi,Object.assign({className:nr({active:r,main:e.main,collapsed:t})},{children:[e.icon&&n(Wi,Object.assign({className:nr({collapsed:t})},{children:e.icon})),n(Gi,{primary:e.name,primaryTypographyProps:{variant:"body2"},className:nr({collapsed:t})})]}))})):n(Ji,{children:e.name})};function Ki({route:e,isActive:r,isListOpen:t,handleClick:i}){const{collapsed:l}=Vi();return(null==e?void 0:e.link)?n(zi,Object.assign({disablePadding:!0,onClick:i},{children:a(Bi,Object.assign({className:nr({active:r,main:e.main,collapsed:l})},{children:[e.icon&&n(Wi,{children:e.icon}),n(Gi,{primary:e.name,primaryTypographyProps:{variant:"body2"},className:nr({collapsed:l})}),n(m,{component:"img",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg opacity='0.6'%3e%3cpath d='M10.3533 2.81334C10.447 2.90709 10.4996 3.03417 10.4996 3.16667C10.4996 3.29917 10.447 3.42626 10.3533 3.52001L5.87334 8.00001L10.3533 12.48C10.4025 12.5258 10.4419 12.581 10.4692 12.6423C10.4965 12.7036 10.5112 12.7699 10.5124 12.837C10.5136 12.9041 10.5012 12.9708 10.4761 13.0331C10.4509 13.0953 10.4135 13.1519 10.366 13.1994C10.3186 13.2468 10.262 13.2843 10.1997 13.3094C10.1375 13.3346 10.0708 13.3469 10.0037 13.3457C9.93652 13.3446 9.87032 13.3299 9.80898 13.3025C9.74765 13.2752 9.69245 13.2358 9.64667 13.1867L4.81334 8.35334C4.71971 8.25959 4.66711 8.13251 4.66711 8.00001C4.66711 7.86751 4.71971 7.74042 4.81334 7.64667L9.64667 2.81334C9.74042 2.71971 9.86751 2.66711 10 2.66711C10.1325 2.66711 10.2596 2.71971 10.3533 2.81334Z' fill='white'/%3e%3c/g%3e%3c/svg%3e",mr:3,sx:{transition:"transform .3s",transform:`rotate(${t?"-90deg":0})`,opacity:l?0:1}})]}))})):n(Ji,{children:e.name})}const Ui=({route:e})=>{var r,t;const i=X(),{collapsed:o}=Vi(),[s,c]=T(!1),d=N((()=>!!e.link&&i.pathname.startsWith(e.link)),[i.pathname,e]);return j((()=>{c(d)}),[d]),(null===(r=e.children)||void 0===r?void 0:r.length)&&!o?a(l,{children:[n(Ki,{route:e,isActive:d,handleClick:()=>{c(!s)},isListOpen:s||!e.link}),n(br,Object.assign({in:s||!e.link,timeout:"auto"},{children:n(Hi,{children:null===(t=e.children)||void 0===t?void 0:t.map(((e,r)=>n(Ui,{route:e},r)))})}))]}):n(Yi,{route:e,isActive:d})};var Xi=Ui;const Zi=({src:e,alt:r})=>n(m,Object.assign({sx:{width:20,height:20,display:"flex",justifyContent:"center",alignItems:"center"}},{children:n("img",{src:e,alt:r})}));var Qi=({title:e,routes:r})=>{const{collapsed:t,toggleCollapse:i}=Vi();return a(Ri,{children:[n(_i,Object.assign({className:nr("button-collapse",{collapsed:t}),onClick:i},{children:n("img",{src:"data:image/svg+xml,%3csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6.47054 0.861939C6.59552 0.986958 6.66573 1.1565 6.66573 1.33327C6.66573 1.51005 6.59552 1.67959 6.47054 1.80461L2.27521 5.99994L6.47054 10.1953C6.59198 10.321 6.65917 10.4894 6.65766 10.6642C6.65614 10.839 6.58602 11.0062 6.46242 11.1298C6.33881 11.2534 6.1716 11.3235 5.99681 11.3251C5.82201 11.3266 5.65361 11.2594 5.52787 11.1379L0.861207 6.47127C0.736226 6.34625 0.666016 6.17672 0.666016 5.99994C0.666016 5.82316 0.736226 5.65362 0.861207 5.52861L5.52787 0.861939C5.65289 0.736958 5.82243 0.666748 5.99921 0.666748C6.17598 0.666748 6.34552 0.736958 6.47054 0.861939V0.861939Z' fill='%238B8C9E'/%3e%3c/svg%3e",alt:"collapse"})})),a(Fi,Object.assign({variant:"permanent",anchor:"left",className:nr({collapsed:t})},{children:[!!e&&n(qi,{children:e}),n(Di,{children:r.map(((e,r)=>n(Xi,{route:e},r)))})]}))]})};const en=({routes:e,theme:t=lr,title:i=""})=>n(r,Object.assign({theme:t},{children:n($i,{children:n(Qi,{title:i,routes:e})})})),rn=({children:e,toolbar:r,contentSx:t})=>a(m,Object.assign({component:"main",sx:{flexGrow:1,bgcolor:"background.default"}},{children:[n(gr,Object.assign({sx:{borderBottom:"1px solid rgba(38, 40, 66, 0.08)"}},{children:r})),n(m,Object.assign({sx:Object.assign(Object.assign({},t),{height:"calc(100vh - 56px)",overflow:"scroll"})},{children:n(A,Object.assign({fallback:n(xr,{})},{children:null!=e?e:n(ee,{})}))}))]}));var tn=t({spacing:4,palette:{primary:{main:"#E0613A",dark:"#d9512e",light:"#E0613A"},secondary:{main:"#007994",dark:"#262842",light:"#cbe8ee"},text:{disabled:"#A9A9B8"},success:{main:"#2DB77B",light:"#DBFCEE"},grey:{700:"#101F2B"}},typography:{fontFamily:'Euclid,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',fontSize:14,h1:{fontWeight:400},h3:{fontWeight:500},h4:{fontWeight:500}},components:{}});var nn={components:{MuiButton:{styleOverrides:{root:{lineHeight:1.429}}},MuiInputBase:{styleOverrides:{root:{borderRadius:tn.spacing(3),minWidth:tn.spacing(25),background:tn.palette.background.default},input:{minWidth:tn.spacing(25)}}},MuiSelect:{styleOverrides:{nativeInput:{padding:0,height:"32px"}}},MuiTextField:{styleOverrides:{root:{minWidth:tn.spacing(25)}}},MuiInputLabel:{styleOverrides:{root:{position:"relative",overflow:"initial",transform:"none",marginBottom:tn.spacing(1),fontWeight:500,fontSize:"14px",lineHeight:"20px"}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:tn.spacing(3),minWidth:tn.spacing(25)},notchedOutline:{top:0,"& legend":{display:"none",transition:"none"}}}},MuiAutocomplete:{styleOverrides:{paper:{marginTop:8,borderRadius:12,boxShadow:"0px 8px 16px rgba(0, 0, 0, 0.04)"},listbox:{"::-webkit-scrollbar":{width:"6px",backgroundColor:"white"},"::-webkit-scrollbar-thumb":{borderRadius:"10px",backgroundColor:"rgba(38, 40, 66, 0.24)"}}}},MuiMenu:{styleOverrides:{list:{paddingTop:0,paddingBottom:0,background:"white","& li.Mui-selected":{background:"rgba(38, 40, 66, 0.08) !important"}}}},MuiPopover:{styleOverrides:{paper:{marginTop:8,borderRadius:12,boxShadow:"0px 8px 16px rgba(0, 0, 0, 0.04)"}}},MuiFormLabel:{styleOverrides:{asterisk:{color:"#D6331F","&$error":{color:"#D6331F"}}}}}};var an={components:{MuiTableContainer:{styleOverrides:{root:{borderRadius:tn.spacing(3),border:"1px solid rgba(38, 40, 66, 0.08)"}}},MuiTableHead:{styleOverrides:{root:{backgroundColor:"#F7F8FC"}}},MuiTableCell:{styleOverrides:{root:{minHeight:48,padding:tn.spacing(1,2),"&:first-of-type":{paddingLeft:tn.spacing(4)}},head:{maxHeight:"40px",padding:tn.spacing(2.75,2),color:"#6D6E85"},body:{wordBreak:"break-all"}}},MuiTableSortLabel:{styleOverrides:{root:{maxHeight:"24px",lineHeight:1}}}}};var ln={components:{MuiStepIcon:{styleOverrides:{root:{fontSize:"20px",color:tn.palette.text.disabled,"&.Mui-active, &.Mui-completed":{color:tn.palette.secondary.main}}}}}};var on={components:{MuiTypography:{styleOverrides:{h1:{[tn.breakpoints.up("lg")]:{fontSize:"1.5rem"}},h3:{fontSize:"1.25rem",[tn.breakpoints.up("lg")]:{fontSize:"1.125rem"}},h4:{fontSize:"1rem",[tn.breakpoints.up("lg")]:{fontSize:"1rem"}},subtitle2:{color:"#6D6E85"}}}}};const sn=i(t(tn,{components:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},nn.components),an.components),ln.components),on.components),{MuiToolbar:{styleOverrides:{root:{[tn.breakpoints.up("sm")]:{minHeight:"56px"}}}},MuiAppBar:{styleOverrides:{root:{boxShadow:"none",backgroundColor:"#007F9B"}}},MuiButton:{styleOverrides:{root:{borderRadius:tn.spacing(2.5),padding:tn.spacing(2.5,4),lineHeight:"20px",fontSize:"1rem",textTransform:"none"},outlined:{color:"#262842",backgroundColor:"#FFFFFF !important",border:"1px solid rgba(38, 40, 66, 0.12)"},text:{color:tn.palette.secondary.dark}}},MuiDialog:{styleOverrides:{root:{"& .MuiModal-backdrop":{background:"rgba(28, 55, 77, 0.5)",backdropFilter:"blur(2px)"}},paper:{borderRadius:tn.spacing(3)},paperWidthXs:{maxWidth:500}}},MuiDialogContent:{styleOverrides:{root:{color:"#6D6E85"}}},MuiDialogActions:{styleOverrides:{root:{background:"#F7F8FC",borderTop:"1px solid rgba(38, 40, 66, 0.08)",padding:tn.spacing(3,6)}}},MuiTabs:{styleOverrides:{root:{minHeight:"38px"},indicator:{backgroundColor:tn.palette.secondary.main}}},MuiTab:{styleOverrides:{root:{fontSize:14,fontWeight:500,textTransform:"none",padding:"10px 12px",lineHeight:"1.125rem",minHeight:"38px",color:"#8B8C9E","&.Mui-selected":{color:tn.palette.secondary.main}}}}})}));export{Er as AlertDialog,Vr as BackButton,rn as ContentLayout,$r as ControlAceEditor,Pr as ControlAutocomplete,wr as ControlCheckbox,ct as ControlDate,dt as ControlDateTime,Nr as ControlDebouncedInput,jr as ControlInput,ot as ControlNumberInput,Ar as ControlQueryAutocomplete,Ir as ControlRadio,kr as ControlSelect,st as ControlSwitch,pt as ControlTime,Lr as CopyButton,bi as CreateDefinition,hi as CreatePropertiesList,mi as CreatePropertyFormFields,yr as DATE_DEFAULT_FORMAT,Or as DATE_TIME_DEFAULT_FORMAT,ji as DefinitionFiller,Ni as DefinitionValueView,kt as InfoItem,Gr as JsonModalView,Ai as JsonPathPicker,Jr as JsonView,xr as Loader,Zi as MenuIcon,Xt as MultiplePropertyFiller,Kt as PropertyFiller,fr as PropertyType,Zt as PropertyValueField,Cr as RoundingMode,St as RouteTabs,en as Sidebar,Et as SimpleTable,wi as Status,Lt as StepperView,vr as TIME_DEFAULT_FORMAT,Tt as TabPanel,yt as Table,vt as TableAction,jt as TableActionCell,Ei as ViewPropertiesList,xi as ViewProperty,qr as capitalize,Wr as deepParseJson,_t as defaultDefinitionArrayValue,Yt as defaultDefinitionObjectValue,Yr as digitsOnly,Kr as floatsOnly,et as formatDefinitionData,_r as formatTableRowValue,it as getDemPropertyDateFormat,nt as getEntityStarterValue,zr as getJsonStringValue,at as getMultiplePropertyFillOptions,lt as getSinglePropertyFillOptions,Xr as isDateType,Ur as isExpression,Zr as isPropertyValueEmpty,rt as propertiesArrayToObject,tt as propertiesObjectToArray,Rr as removeArrayItem,Br as safeParseJson,Dr as sortArrayOfObjects,sn as theme,Tr as useDebounce,Sr as useToggle,Fr as validateJson};
1
+ import{styled as e,ThemeProvider as r,createTheme as t,responsiveFontSizes as i}from"@mui/material/styles";import{jsx as n,jsxs as a,Fragment as l}from"react/jsx-runtime";import o from"@mui/material/Button";import s from"@mui/material/Dialog";import c from"@mui/material/DialogActions";import d from"@mui/material/DialogContent";import p from"@mui/material/DialogContentText";import u from"@mui/material/DialogTitle";import m from"@mui/material/Box";import g from"@mui/material/CircularProgress";import{__rest as h,__awaiter as b}from"tslib";import{useController as f,useWatch as y,useFormContext as v,useFieldArray as O}from"react-hook-form";import C from"@mui/material/TextField";import x,{useRef as E,useEffect as j,useState as T,useCallback as S,useMemo as N,createElement as k,forwardRef as w,createContext as I,useContext as M,memo as P,Suspense as A}from"react";import L from"@mui/material/MenuItem";import V from"@mui/icons-material/Clear";import $ from"@mui/material/IconButton";import R from"@mui/material/InputAdornment";import F from"@mui/material/FormControl";import q from"@mui/material/FormControlLabel";import D from"@mui/material/FormHelperText";import z from"@mui/material/Checkbox";import B from"@mui/material/Radio";import W from"@mui/material/RadioGroup";import J from"@mui/material/FormLabel";import G from"@mui/material/Autocomplete";import{useQuery as H}from"@tanstack/react-query";import _ from"qs";import Y from"@mui/material/Tooltip";import K from"@mui/material/SvgIcon";import{useNavigate as U,useLocation as X,Link as Z,useSearchParams as Q,Outlet as ee}from"react-router-dom";import re from"react-ace";import te from"@mui/material/Typography";import ie from"@mui/material/Switch";import{DatePicker as ne}from"@mui/x-date-pickers/DatePicker";import{format as ae,isMatch as le,isValid as oe,parse as se}from"date-fns";import{DateTimePicker as ce}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as de}from"@mui/x-date-pickers/TimePicker";import pe from"@mui/material/Pagination";import ue from"@mui/material/TablePagination";import{useGridApiContext as me,useGridSelector as ge,gridPageSelector as he,gridPageCountSelector as be,gridRowCountSelector as fe,gridPageSizeSelector as ye,GridColumnMenuContainer as ve,GridFilterMenuItem as Oe,DataGrid as Ce,GridActionsCellItem as xe}from"@mui/x-data-grid";import{makeStyles as Ee}from"tss-react/mui";import je from"@mui/material/Table";import Te from"@mui/material/TableBody";import Se from"@mui/material/TableCell";import Ne from"@mui/material/TableContainer";import ke from"@mui/material/TableHead";import we from"@mui/material/TableRow";import Ie from"@mui/material/TableSortLabel";import Me from"@mui/material/TableFooter";import Pe from"@mui/material/Backdrop";import Ae from"@mui/material/Menu";import Le from"@mui/icons-material/MoreHoriz";import Ve from"@mui/material/Paper";import $e from"@mui/material/Tab";import Re from"@mui/material/Tabs";import Fe from"@mui/material/Unstable_Grid2";import qe from"@mui/material/Accordion";import De from"@mui/material/AccordionSummary";import ze from"@mui/material/AccordionDetails";import Be from"@mui/material/AccordionActions";import{ExpandMore as We}from"@mui/icons-material";import Je from"@mui/icons-material/Delete";import Ge from"@mui/material/Stepper";import He from"@mui/material/Step";import _e from"@mui/material/StepLabel";import Ye from"@mui/material/StepContent";import Ke from"@mui/material/StepConnector";import Ue from"@mui/material/Chip";import Xe from"@mui/icons-material/Add";import Ze from"@mui/material/Select";import Qe from"@mui/material/InputLabel";import er from"@mui/icons-material/Close";import rr from"@monaco-editor/react";import tr from"@mui/icons-material/ExpandMore";import ir from"@mui/icons-material/CheckCircle";import nr from"classnames";import{toast as ar}from"react-toastify";import{theme as lr}from"@dartech/arsenal-ui";import or from"@mui/material/Drawer";import sr from"@mui/material/List";import cr from"@mui/material/ListItem";import dr from"@mui/material/ListItemIcon";import pr from"@mui/material/ListItemButton";import ur from"@mui/material/ListSubheader";import mr from"@mui/material/ListItemText";import gr from"@mui/material/Toolbar";import hr from"@mui/material/ButtonBase";import br from"@mui/material/Collapse";var fr;!function(e){e.STRING="STRING",e.INTEGER="INTEGER",e.BIG_INTEGER="BIG_INTEGER",e.BIG_DECIMAL="BIG_DECIMAL",e.FLOAT="FLOAT",e.LONG="LONG",e.DOUBLE="DOUBLE",e.BOOLEAN="BOOLEAN",e.ENTITY_REFERENCE="ENTITY_REFERENCE",e.ENTITY="ENTITY",e.JSON="JSON",e.DATE="DATE",e.TIME="TIME",e.DATE_TIME="DATE_TIME",e.ANY="ANY"}(fr||(fr={}));const yr="yyyy-MM-dd",vr="HH:mm:ss",Or="yyyy-MM-dd'T'HH:mm:ss.SSSXXX";var Cr;!function(e){e.UP="UP",e.DOWN="DOWN",e.CEILING="CEILING",e.FLOOR="FLOOR",e.HALF_UP="HALF_UP",e.HALF_DOWN="HALF_DOWN",e.HALF_EVEN="HALF_EVEN",e.UNNECESSARY="UNNECESSARY"}(Cr||(Cr={}));const xr=({transparent:e,position:r})=>n(m,Object.assign({position:null!=r?r:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:e?"none":"rgba(255, 255, 255, .3)",zIndex:10},{children:n(g,{})})),Er=({open:e,title:r,description:t,closeButtonTitle:i="Close",onClose:l,confirmButtonTitle:g="Confirm",confirmButtonDisabled:h=!1,onConfirm:b,children:f,dialogProps:y,loading:v,maxWidth:O="xs"})=>n("div",{children:a(s,Object.assign({open:e,onClose:l,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:O},y,{children:[v&&n(xr,{}),n(u,Object.assign({id:"alert-dialog-title"},{children:r})),a(d,{children:[t&&n(p,Object.assign({id:"alert-dialog-description"},{children:t})),n(m,Object.assign({maxWidth:"100%",overflow:"hidden"},{children:f}))]}),a(c,{children:[n(o,Object.assign({onClick:l,color:"primary",variant:"contained"},{children:i})),g&&b?n(o,Object.assign({onClick:b,color:"secondary",variant:"contained",autoFocus:!0,disabled:h},{children:g})):null]})]}))}),jr=e=>{var r,{control:t,validate:i,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,textarea:d=!1,hideErrorMessage:p=!1,onChange:u}=e,m=h(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange"]);const{field:{ref:g,onChange:b},fieldState:{error:v}}=f({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:i}}),O=y({control:t,name:a});return n(C,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:g,name:a,label:l,error:!!v,helperText:!p&&(null==v?void 0:v.message),disabled:c,multiline:d,minRows:d?3:1,value:null!=O?O:"",onChange:u||b},m,{inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=O?O:""})}))};function Tr(e,r){const t=E();j((()=>()=>{t.current&&clearTimeout(t.current)}),[]);return(...i)=>{clearTimeout(t.current),t.current=setTimeout((()=>{e(...i)}),r)}}const Sr=()=>{const[e,r]=T(!1);return{open:e,toggle:()=>{r((e=>!e))},onClose:()=>{r(!1)},onOpen:()=>{r(!0)}}},Nr=e=>{var r,{control:t,validate:i,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,textarea:d=!1,hideErrorMessage:p=!1,onChange:u}=e,m=h(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange"]);const{field:{ref:g,onChange:b},fieldState:{error:v}}=f({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:i}}),O=y({control:t,name:a}),[x,E]=T("");j((()=>{!x&&O&&E(O)}),[x,O]);const N=Tr((e=>{b(e)}),200),k=S((e=>{E(e.target.value),N(e.target.value)}),[N]);return n(C,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:g,name:a,label:l,error:!!v,helperText:!p&&(null==v?void 0:v.message),disabled:c,multiline:d,minRows:d?3:1,value:null!=x?x:"",onChange:k},m,{inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=x?x:""})}))},kr=e=>{var r,{control:t,validate:i,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,hideErrorMessage:d=!1,onChange:p,labelKey:u,valueKey:m,options:g=[]}=e,b=h(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options"]);const{field:{ref:v,onChange:O},fieldState:{error:x}}=f({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:i}}),E=y({control:t,name:a}),j=S((e=>"string"==typeof e?e:m?e[m]:e.value),[m]),T=S((e=>"string"==typeof e?e:u?e[u]:e.label),[u]),N=S((()=>{O(null)}),[O]);return n(C,Object.assign({select:!0,fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:v,name:a,label:l,error:!!x,helperText:!d&&(null==x?void 0:x.message),disabled:c,value:null!=E?E:"",onChange:p||O},b,{inputProps:Object.assign(Object.assign({},null!==(r=null==b?void 0:b.inputProps)&&void 0!==r?r:{}),{value:null!=E?E:""}),InputProps:Object.assign({endAdornment:!o&&E?n(R,Object.assign({position:"end",sx:{mr:2}},{children:n($,Object.assign({onClick:N,size:"small"},{children:n(V,{fontSize:"small"})}))})):null},null==b?void 0:b.InputProps)},{children:g.map(((e,r)=>n(L,Object.assign({value:j(e)},{children:T(e)}),r)))}))},wr=e=>{var{control:r,validate:t,name:i="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,hideErrorMessage:d=!1,onChange:p}=e,u=h(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange"]);const{field:{ref:m,onChange:g},fieldState:{error:b}}=f({name:i,control:r,defaultValue:s}),v=y({control:r,name:i}),O=N((()=>{if("boolean"==typeof v)return v;if("string"==typeof v){if("false"===v)return g(!1),!1;if("true"===v)return g(!0),!0}return!1}),[v,g]);return a(F,Object.assign({error:!!b,component:"fieldset",variant:"standard",disabled:c},{children:[n(q,{control:n(z,Object.assign({checked:O,onChange:p||g,name:i,inputRef:m,disabled:c},u)),label:l}),!d&&(null==b?void 0:b.message)&&n(D,{children:b.message})]}))},Ir=({name:e,label:r,values:t=[],control:i,required:l,defaultValue:o,disabled:s,hideErrorMessage:c,labelKey:d,valueKey:p,validate:u,onChange:m})=>{const{field:{ref:g,onChange:h},fieldState:{error:b}}=f({name:e,control:i,defaultValue:o,rules:{required:l&&"Please, fill this field",validate:u}}),v=y({control:i,name:e}),O=S((e=>"string"==typeof e?e:p?e[p]:e.value),[p]),C=S((e=>"string"==typeof e?e:d?e[d]:e.label),[d]);return a(F,Object.assign({disabled:s,error:!!b},{children:[n(J,Object.assign({id:"radio-buttons-group"},{children:r})),n(W,Object.assign({"aria-labelledby":"radio-buttons-group",ref:g,name:e,value:v,onChange:m||h},{children:t.map((e=>n(q,{value:O(e),control:n(B,{}),label:C(e)})))})),!c&&(null==b?void 0:b.message)&&n(D,{children:b.message})]}))};var Mr=({valueKey:e,labelKey:r})=>{const t=S(((r,t)=>{if(r&&t){if("string"==typeof r)return r===t;if(e)return r[e]===t[e]||r[e]===t;if(r.value)return r.value===t.value||r.value===t}return!1}),[e]),i=S((e=>e?"string"==typeof e?e:r&&e[r]?e[r]+"":e.label+""||e.name+""||e.value+""||e.code+""||"--no label--":""),[r]),n=S(((e,r)=>k(m,Object.assign({},e,{component:"li",key:e.id}),i(r))),[i]);return{isOptionEqualToValue:t,getOptionLabel:i,renderOption:n}};const Pr=e=>{var{control:r,validate:t,name:i="",label:a="",required:l=!1,defaultValue:o="",disabled:s=!1,hideErrorMessage:c=!1,onChange:d,labelKey:p,valueKey:u,options:m=[],multiple:g,textFieldProps:b={},disableCloseOnSelect:v}=e,O=h(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options","multiple","textFieldProps","disableCloseOnSelect"]);const{field:{ref:x,onChange:E},fieldState:{error:j}}=f({name:i,control:r,defaultValue:o,rules:{required:l&&"Please, fill this field",validate:t}}),T=y({control:r,name:i,defaultValue:g?[]:null}),{getOptionLabel:S,isOptionEqualToValue:N,renderOption:k}=Mr({valueKey:u,labelKey:p});return n(G,Object.assign({fullWidth:!0,disablePortal:!0,size:"small",readOnly:s,options:m,multiple:g,getOptionLabel:S,isOptionEqualToValue:N,disableCloseOnSelect:v||g,filterSelectedOptions:g,value:T,onChange:d||((e,r)=>{E(r)}),renderOption:k,renderInput:e=>n(C,Object.assign({},e,{variant:"outlined",name:i,label:a,error:!!j,inputRef:x,helperText:!c&&(null==j?void 0:j.message)},b))},O))};function Ar(e){var{name:r,label:t,control:i,required:l=!1,searchBy:o,labelKey:s,multiple:c=!1,disabled:d,valueKey:p,sortBy:u="",hideErrorMessage:m,disableCloseOnSelect:b,textFieldProps:v,onChange:O,queryFunction:E,validate:N,itemQueryFunction:k}=e,w=h(e,["name","label","control","required","searchBy","labelKey","multiple","disabled","valueKey","sortBy","hideErrorMessage","disableCloseOnSelect","textFieldProps","onChange","queryFunction","validate","itemQueryFunction"]);const{field:{ref:I,onChange:M},fieldState:{error:P,isDirty:A}}=f({control:i,name:r,rules:{required:l&&"Please, fill this field",validate:N}}),L=y({control:i,name:r,defaultValue:c?[]:null}),{getOptionLabel:V,isOptionEqualToValue:$,renderOption:R}=Mr({valueKey:p,labelKey:s}),[F,q]=T(!1),[D,z]=T(""),[B,W]=T(""),[J,Y]=T(0),[K,U]=T(0),[X,Z]=T([]),Q=Tr((e=>{U(0),W(e),Z([])}),500),ee=S(((e,r)=>{z(r),Q(r)}),[Q]),re=S(((e,r)=>{M(r),O&&O(e,r)}),[M,O]);j((()=>{if(!A&&L&&k){let e=L;"object"==typeof L&&p in L&&(e=L[p]),k(e).then((e=>{M(e),z(e[s])})).catch()}}),[L,A,p,s,k,M]);const te=S((e=>{const r=e.currentTarget;r.scrollHeight-r.scrollTop-r.clientHeight<=1&&X.length<J&&U((e=>e+1))}),[J,X]),{data:ie,isFetching:ne}=H(["options",K,B],(()=>{const e=_.parse(Object.assign({page:`${K}`,size:"20",sort:u},B?{[o]:B}:{}),{ignoreQueryPrefix:!0});return E(e)}));return j((()=>{ie&&(Z((e=>[...e,...ie.collection])),Y(ie.totalItems))}),[ie]),n(G,Object.assign({fullWidth:!0,disablePortal:!0,size:"small",readOnly:d,options:X,multiple:c,getOptionLabel:V,isOptionEqualToValue:$,disableCloseOnSelect:b||c,filterSelectedOptions:c,inputValue:D,value:L,onChange:re,loading:ne,clearOnBlur:!1,open:F,filterOptions:e=>e,onOpen:()=>{q(!0)},onClose:()=>{q(!1),W("")},onInputChange:ee,ListboxProps:{onScroll:te},renderOption:R,renderInput:e=>n(C,Object.assign({},e,{label:t,variant:"outlined",error:!!P,inputRef:I,helperText:!m&&(null==P?void 0:P.message),InputProps:Object.assign(Object.assign({},e.InputProps),{endAdornment:a(x.Fragment,{children:[ne?n(g,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})})},v))},w))}const Lr=({copyText:e,helpText:r="Copy"})=>{const[t,i]=T(r);return t?n(Y,Object.assign({title:t,placement:"top"},{children:n($,Object.assign({onClick:()=>{navigator.clipboard.writeText(e),i("Copied!"),setTimeout((()=>{i(r)}),1e3)}},{children:n(K,Object.assign({fontSize:"small"},{children:n("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"})}))}))})):null},Vr=({text:e,buttonProps:r={}})=>{const t=U(),{state:i}=X(),a=N((()=>null==i?void 0:i.from),[i]),l=S((()=>{t(a||-1)}),[t,a]);return n(m,Object.assign({mr:2},{children:e?n(o,Object.assign({color:"inherit",onClick:a?null:l,component:Z,to:null!=a?a:""},r,{children:e})):n($,Object.assign({onClick:l},{children:n(K,{children:n("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"})})}))}))},$r=w(((e,r)=>{var{control:t,name:i,mode:o="json",label:s,width:c="100%",height:d="200px",theme:p="monokai",readOnly:u,required:g=!1,validateJson:b=!1,fontSize:O=16,validate:C=!0,parseValue:x}=e,E=h(e,["control","name","mode","label","width","height","theme","readOnly","required","validateJson","fontSize","validate","parseValue"]);const{setError:j,clearErrors:T}=v(),{field:{onChange:S},fieldState:{error:N}}=f({control:t,name:i}),k=y({control:t,name:i});return a(m,Object.assign({display:"flex",flexDirection:"column",width:"100%"},{children:[n(m,{children:s&&n(te,Object.assign({variant:"subtitle1",display:"inline",style:{marginRight:10}},{children:s}))}),a(l,{children:[n(re,Object.assign({ref:r,focus:!0,wrapEnabled:!0,width:c,height:d,showPrintMargin:!1,theme:p,fontSize:O,setOptions:{enableLiveAutocompletion:!0,enableBasicAutocompletion:!0,enableSnippets:!0,showLineNumbers:!0,tabSize:2,useWorker:!1},style:{lineHeight:1.4,zIndex:0,isolation:"isolate"},readOnly:u,value:"json"===o&&"string"!=typeof k?null===k?"":JSON.stringify(k):k,onChange:e=>{if(!e&&g?j(i,{message:"Required field"}):T(i),b)try{JSON.parse(e),T(i)}catch(e){j(i,{message:"Invalid JSON"})}if(x)try{const r=JSON.parse(e);console.log("parsed val:",r),S(r)}catch(r){S(e)}else S(e)},mode:o,onLoad:e=>{C&&b||e.getSession().setUseWorker(!1)}},E)),N&&n(D,Object.assign({error:!0},{children:N.message}))]})]}))})),Rr=(e,r)=>{const t=[...e];return t.splice(r,1),t},Fr=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};function qr(e){return e.replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}const Dr=(e,r,t,i="asc")=>{const n=e[t],a=r[t];return n<a?"asc"===i?-1:1:n>a?"asc"===i?1:-1:0},zr=e=>{if(!e)return"";if("string"==typeof e)try{return JSON.stringify(JSON.parse(e),null,2)}catch(r){return e}else try{return JSON.stringify(e,null,2)}catch(e){return"Failed to stringify JSON"}},Br=e=>{try{return JSON.parse(e)}catch(e){return null}},Wr=e=>{try{const r=JSON.parse(e);return Object.keys(r).forEach((e=>{r[e]=Wr(r[e])})),r}catch(r){return e}},Jr=window,Gr=Jr.define;Jr.define=null;const Hr=({value:e,height:r="200px"})=>{const t=N((()=>{if("string"==typeof e)return e;if("object"==typeof e)try{return JSON.stringify(e,null,2)}catch(e){return"Failed to parse JSON"}return null}),[e]);return n(rr,{width:"100%",height:r,language:"json",value:t,onMount:function(){Jr.define=Gr},options:{tabSize:2,fontSize:16,readOnly:!0,minimap:{enabled:!1}}})},_r=({open:e,onClose:r,value:t})=>a(s,Object.assign({disableEscapeKeyDown:!0,open:e,onClose:r,fullWidth:!0,maxWidth:"md",style:{width:800,left:"30%"}},{children:[n(d,{children:n(re,{readOnly:!0,value:t,mode:"json",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2,useWorker:!1}})}),a(c,{children:[n(Lr,{copyText:t}),n(o,Object.assign({onClick:r,variant:"contained",color:"secondary"},{children:"Close"}))]})]}));var Yr=({value:e,copyButton:r=!1,textField:t=!1})=>{const{open:i,onOpen:l,onClose:o}=Sr(),s=S((e=>{e.stopPropagation(),l()}),[l]);return a(m,Object.assign({width:"100%"},{children:[a(m,Object.assign({display:"flex",alignItems:"center",justifyContent:"flex-end",pt:1,mb:2},{children:[r&&n(Lr,{copyText:zr(e)}),n(Y,Object.assign({title:"Open",placement:"top"},{children:n($,Object.assign({size:"small",onClick:s},{children:n(K,{children:n("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})})}))}))]})),t?n(m,Object.assign({overflow:"hidden",whiteSpace:"nowrap"},{children:"object"==typeof e?JSON.stringify(e):e})):n(Hr,{value:e}),n(_r,{open:i,value:zr(e),onClose:o})]}))};const Kr=({value:e,type:r,copyText:t,status:i})=>{switch(r){case"id":return a(m,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[n(m,Object.assign({mr:"auto"},{children:`${e.slice(0,6)}...${e.slice(-6)}`})),n(Lr,{copyText:t||e})]}));case"JSON_copy":return n(Yr,{value:e,copyButton:!0});case"JSON":return n(Yr,{value:e});case"JSON_text":return n(Yr,{value:e,textField:!0});case"copy":return a(m,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[n(m,Object.assign({mr:"auto"},{children:e})),n(Lr,{copyText:t||e})]}));case"boolean":return n(K,e?Object.assign({color:"primary",fontSize:"small"},{children:n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}):Object.assign({fontSize:"small"},{children:n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"})}));case"date":return e?a("div",{children:[n("div",{children:ae(new Date(e),"dd.MM.yyyy")}),n("div",{children:ae(new Date(e),"HH:mm:ss")})]}):"";case"status":return n(Mi,{text:e,status:i});case"array":return n(m,{children:e.map(((e,r)=>n(m,{children:e},r)))});default:return n("div",{children:e})}},Ur=new RegExp("^[-+]?[0-9]+$"),Xr=new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/),Zr=e=>"string"==typeof e&&e.includes("$("),Qr=e=>e===fr.DATE||e===fr.DATE_TIME||e===fr.TIME,et=e=>!e&&0!==e&&!1!==e,rt=(e,r,t)=>{if(null==r&&e!==fr.BOOLEAN)return null;let i=r;switch(e){case fr.BOOLEAN:i=!!r;break;case fr.INTEGER:case fr.BIG_INTEGER:case fr.BIG_DECIMAL:case fr.FLOAT:case fr.LONG:case fr.DOUBLE:i=Number(r);break;case fr.DATE:case fr.DATE_TIME:case fr.TIME:i=ae(new Date(r.toString()),t.formatText);break;case fr.JSON:case fr.ANY:try{"string"!=typeof r&&(i=JSON.stringify(r)),i=JSON.parse(i)}catch(e){console.log(e),i=null}break;case fr.ENTITY:i=tt(t.properties,r)}return i},tt=(e,r)=>{if(r){const t={};return e.forEach((e=>{const{key:i,propertyType:n}=e,a=r[i];Array.isArray(a)?t[i]=a.map((r=>rt(n,r,{formatText:e.format,properties:e.properties}))):t[i]=rt(n,a,{formatText:e.format,properties:e.properties})})),t}return null},it=(e,r)=>{const t={};return e.forEach((e=>{const{key:i,name:n,isRequired:a,isMultiple:l,sortOrder:o,isEnabled:s,uiSettings:c,validationNode:d}=e,p="string"==typeof e.propertyType?e.propertyType:e.propertyType.value,u=Object.assign({name:n,propertyType:p,isRequired:a,isMultiple:l,sortOrder:o,isEnabled:s,validationNode:d,uiSettings:c},((e,r)=>{const t={};let i,n="";return r?e.isMultiple?(n="values",i=e.value):(n="value",i=e.value):e.isMultiple?(n="defaultValues",i=e.defaultValue):(n="defaultValue",i=e.defaultValue),Array.isArray(i)?t[n]=i.map((r=>rt(e.propertyType,r,{formatText:e.format,properties:e.properties}))):t[n]=rt(e.propertyType,i,{formatText:e.format,properties:e.properties}),t})(Object.assign(Object.assign({},e),{propertyType:p}),r));if("isViewableInList"in e&&(u.isViewableInList=e.isViewableInList),c)try{u.uiSettings=JSON.parse(c)}catch(e){console.log(e)}else u.uiSettings=null;p===fr.BIG_DECIMAL&&(u.precisionScale=e.precisionScale,u.roundingMode=e.roundingMode),p!==fr.DATE&&p!==fr.TIME&&p!==fr.DATE_TIME||(u.format=e.format),p===fr.STRING&&(u.restrictedValues=e.restrictedValues),p===fr.ENTITY_REFERENCE&&(u.definitionCode=e.definitionCode,u.definitionVersion=e.definitionVersion,u.labelPropertyCode=e.labelPropertyCode,u.valuePropertyCode=e.valuePropertyCode),p===fr.ENTITY&&(u.properties=it(e.properties,r)),t[i]=u})),t};function nt(e,r){return Object.keys(e).map((t=>{const i=Object.assign(Object.assign({key:t},e[t]),r||{});if(i.propertyType===fr.ENTITY&&(i.properties=nt(i.properties,r)),i.propertyType===fr.JSON)try{null==i.defaultValue?i.defaultValue="":i.defaultValue=JSON.stringify(i.defaultValue,null,2)}catch(e){i.defaultValue=""}if(i.uiSettings)try{i.uiSettings=JSON.stringify(i.uiSettings,null,2)}catch(e){i.uiSettings=""}return i.isMultiple&&("defaultValues"in i&&(i.defaultValue=i.defaultValues),"values"in i&&(i.value=i.values)),i})).sort(((e,r)=>Dr(e,r,"sortOrder")))}const at=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return ae(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},lt=e=>{let r=[];return r=Array.isArray(e.properties)?e.properties:nt(e.properties),r.reduce(((e,r)=>{const t=JSON.parse(JSON.stringify(e));return r.propertyType===fr.ENTITY?t[r.key]=lt(r):t[r.key]=r.propertyType,t}),{})},ot=({propertyType:e,useExpression:r,required:t})=>{let i=[{value:"widget",label:"Fill array (widget)",sortOrder:1}];return t||i.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===fr.JSON||e===fr.ENTITY||e===fr.ANY?i.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):i.push({value:"expression",label:"Expression",sortOrder:3})),e!==fr.JSON&&e!==fr.ANY&&e!==fr.ENTITY||i.push({value:"json_valid",label:"JSON editor",sortOrder:2}),i=i.sort(((e,r)=>Dr(e,r,"sortOrder"))),i},st=({propertyType:e,useExpression:r,required:t})=>{let i=[{value:"widget",label:"Widget",sortOrder:1}];switch(t||i.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===fr.JSON||e===fr.ENTITY||e===fr.ANY?i.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):i.push({value:"expression",label:"Expression",sortOrder:3})),e===fr.JSON&&i.push({value:"dem_builder",label:"DEM Builder",sortOrder:2}),e){case fr.STRING:i[0].label="Text input";break;case fr.INTEGER:case fr.BIG_INTEGER:case fr.BIG_DECIMAL:case fr.FLOAT:case fr.LONG:case fr.DOUBLE:i[0].label="Number input";break;case fr.BOOLEAN:i[0].label="Switch";break;case fr.ENTITY_REFERENCE:i[0].label="Entity reference fields";break;case fr.JSON:i[0].label="JSON editor";break;case fr.DATE:i[0].label="Date picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case fr.DATE_TIME:i[0].label="Date & Time picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case fr.TIME:i[0].label="Time picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case fr.ANY:i[0].label="Textarea"}return i=i.sort(((e,r)=>Dr(e,r,"sortOrder"))),i},ct=e=>{var r,{control:t,validate:i,name:a="",label:l="",required:o=!1,defaultValue:s,disabled:c=!1,hideErrorMessage:d=!1,onChange:p,decimal:u=!1}=e,m=h(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","decimal"]);const{field:{ref:g,onChange:b},fieldState:{error:v}}=f({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:e=>u&&!Xr.test(e)?"Not valid number":!(!u&&!Ur.test(e))||"Not valid integer"}}),O=y({control:t,name:a});return n(C,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:g,name:a,label:l,error:!!v,helperText:!d&&(null==v?void 0:v.message),disabled:c,value:null!=O?O:""},m,{onChange:e=>{const r=e.nativeEvent.data||e.target.value;(!isNaN(r)||u&&"."===r||"-"===r||"+"===r)&&(p?p(e):b(e.target.value))},inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=O?O:""})}))},dt=e=>{var{control:r,name:t,label:i}=e,a=h(e,["control","name","label"]);const{field:{ref:l,onChange:o}}=f({control:r,name:t}),s=y({control:r,name:t}),c=N((()=>{if("boolean"==typeof s)return s;if("string"==typeof s){if("false"===s)return o(!1),!1;if("true"===s)return o(!0),!0}return!1}),[s,o]);j((()=>{null===s&&o(!1)}),[s,o]);return n(q,{label:i,name:t,control:n(ie,Object.assign({color:"primary",size:"small",inputRef:l,onChange:e=>{const{checked:r}=e.target;o(r)},checked:c},a))})},pt=({control:e,name:r,required:t,label:i,format:a=yr,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=f({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!le(e,a)||"Incorrect date format"}}),d=y({control:e,name:r});return n(ne,{label:i,inputRef:s,inputFormat:a,value:d||null,onChange:e=>{o(oe(e)?ae(e,a):e)},renderInput:e=>n(C,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},ut=({control:e,name:r,required:t,label:i,format:a=Or,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=f({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!le(e,a)||"Incorrect date format"}}),d=y({control:e,name:r});return n(ce,{mask:"",ampm:!1,inputRef:s,label:i,value:d||null,inputFormat:a,onChange:e=>{o(oe(e)?ae(e,a):e)},renderInput:e=>n(C,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},mt=({control:e,name:r,required:t,label:i,format:a=vr,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=f({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!le(e,a)||"Incorrect date format"}}),d=y({control:e,name:r}),[p,u]=T(null);return j((()=>{if(d&&a){let e=se(d,a,new Date);oe(e)||(e=se(d,"HH:mm:ss.SSS",new Date)),u(e)}}),[d,a]),n(de,{mask:"",inputRef:s,label:i,ampm:!1,value:p,inputFormat:a,onChange:e=>{u(e),o(oe(e)?ae(e,a):e)},renderInput:e=>n(C,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})};var gt=()=>{const e=me(),r=ge(e,he),t=ge(e,be),i=ge(e,fe),l=ge(e,ye),o=r=>e.current.setPage(r);return a(m,Object.assign({px:2,display:"flex",alignItems:"center"},{children:[n(ue,{component:"div",page:r,count:i,rowsPerPage:l,rowsPerPageOptions:[10,20,50,100],onPageChange:(e,r)=>o(r),onRowsPerPageChange:r=>e.current.setPageSize(parseInt(r.target.value,10)),ActionsComponent:void 0}),n(pe,{count:t,page:r+1,onChange:(e,r)=>o(r-1)})]}))};var ht=e=>{var{hideMenu:r,currentColumn:t,onUnsort:i}=e,a=h(e,["hideMenu","currentColumn","onUnsort"]);return n(ve,Object.assign({hideMenu:r,currentColumn:t},a,{children:n(Oe,{onClick:r,column:t})}))};var bt=({mode:e})=>{const[r,t]=Q(),i=+r.get("page")||0,n=+r.get("size")||10;return j((()=>{"server"===e&&(r.has("page")||r.set("page","0"),r.has("size")||r.set("size","10"),t(r,{replace:!0}))}),[e,r,t]),{page:i,size:n,onPageChange:e=>{r.set("page",`${e}`),t(r,{replace:!0})},onSizeChange:e=>{r.set("size",`${e}`),t(r,{replace:!0})}}};var ft=()=>{const[e,r]=Q(),t=e.getAll("sort").map((e=>e.split(",")));return{onColumnHeaderClick:({field:t})=>{let i=!1;const n=e.getAll("sort");e.delete("sort"),n.forEach((r=>{const[n,a]=r.split(",");n===t?(i=!0,"asc"===a&&e.append("sort",`${n},desc`)):e.append("sort",`${n},${a}`)})),i||e.append("sort",`${t},asc`),r(e,{replace:!0})},getSortedColumns:e=>e.map((e=>{const r=t.find((r=>r[0]===e.field));return e.headerClassName=r?`Sorted --${r[1]} `:"",e}))}};var yt=e=>{const[r,t]=T(10);j((()=>{t(e)}),[e]);return{pageSize:r,handlePageSizeChange:e=>t(e)}},vt=Ee()({root:{width:"100%","& .MuiDataGrid-virtualScrollerContent":{height:"auto !important",minHeight:"56px !important"},"& .MuiDataGrid-virtualScrollerRenderZone":{position:"static"},"& .MuiDataGrid-renderingZone":{maxHeight:"none !important"},"& .MuiDataGrid-cell":{maxHeight:"none !important",lineHeight:"unset !important",textOverflow:"ellipsis",wordBreak:"break-all","& .MuiDataGrid-actionsCell":{width:"100%",gridGap:"4px",flexWrap:"wrap",'& > button[aria-label="more"]':{marginLeft:"auto"}}},"& .MuiDataGrid-row":{maxHeight:"none !important"},"& .Sorted":{"& .MuiDataGrid-iconButtonContainer":{visibility:"visible",width:"auto","& svg":{opacity:"1 !important"}},"&.--desc":{"& svg":{transform:"rotate(180deg)"}}}}});const Ot=({columns:e,rows:r,rowCount:t,loading:i,disableMargin:a,mode:l="server",initialPageSize:o=10,pagination:s=!0,onCellClick:c})=>{const{classes:d}=vt(),{page:p,size:u,onPageChange:g,onSizeChange:h}=bt({mode:l}),{onColumnHeaderClick:b,getSortedColumns:f}=ft(),{pageSize:y,handlePageSizeChange:v}=yt(o),O={sortingMode:l,paginationMode:l,pageSize:"server"===l?u:s?y:t,onPageSizeChange:"server"===l?h:v,components:{Pagination:gt}};return"server"===l&&(O.sortModel=[],O.onColumnHeaderClick=b,O.page=p,O.onPageChange=g,O.components.ColumnMenu=ht),n(m,Object.assign({mt:a?0:2},{children:n(Ce,Object.assign({autoHeight:!0,hideFooterPagination:!s,hideFooter:!s,disableSelectionOnClick:!0,showColumnRightBorder:!0,showCellRightBorder:!0,className:d.root,loading:i,rows:r,columns:f(e),rowCount:t,rowsPerPageOptions:[10,20,50,100],onCellClick:c},O))}))},Ct=({icon:e,label:r,showInMenu:t,onClick:i,location:a})=>a?n($,Object.assign({component:Z,to:a,size:"small"},{children:n(Y,Object.assign({title:r,arrow:!0},{children:x.cloneElement(e,{fontSize:"small"})}))})):n(xe,{nonce:"",onResize:void 0,onResizeCapture:void 0,icon:n(Y,Object.assign({title:r,arrow:!0},{children:e})),onClick:i,label:r,showInMenu:t});var xt=()=>{const[e,r]=Q(),t=N((()=>{var r;return null!==(r=e.get("page"))&&void 0!==r?r:0}),[e]),i=N((()=>{var r;return null!==(r=e.get("size"))&&void 0!==r?r:10}),[e]),n=S((e=>{r((r=>(r.set("page",`${e}`),r)))}),[r]),a=S((e=>{r((r=>(r.set("size",`${e}`),r)))}),[r]);return j((()=>{e.has("page")||r((e=>(e.set("page","0"),e))),e.has("size")||r((e=>(e.set("size","10"),e)))}),[e,r]),{page:t,size:i,onPageChange:n,onSizeChange:a}};var Et=()=>{const[e,r]=Q(),t=N((()=>e.getAll("sort").map((e=>e.split(",")))),[e]),i=S((e=>{r((r=>{console.log(e,r.get("page")),r.delete("sort");let i=!1;return t.forEach((([t,n])=>{t===e?(i=!0,"asc"===n&&r.append("sort",`${t},desc`)):r.append("sort",`${t},${n}`)})),i||r.append("sort",`${e},asc`),r}))}),[t,r]),n=S((e=>{const r=t.find((([r,t])=>r===e));return!!r&&r[1]}),[t]);return{sortParams:t,onSortChanged:i,getColumnSorting:n}};function jt({columns:e=[],rows:r=[],totalCount:t,children:i,pagination:l=!0,loading:o=!1,onRowClick:s,verticalAlign:c="middle"},d){const{page:p,size:u,onPageChange:m,onSizeChange:g}=xt(),{onSortChanged:h,getColumnSorting:b}=Et();return a(Ne,Object.assign({sx:{position:"relative",overflow:"visible"}},{children:[n(Pe,Object.assign({open:o,sx:{position:"absolute",top:0,left:0}},{children:n(xr,{})})),a(je,Object.assign({ref:d},{children:[n(ke,{children:n(we,{children:e.map(((e,r)=>{const t=!!e.sortKey&&b(e.sortKey);return n(Se,Object.assign({align:e.align?e.align:"left",sortDirection:t,sx:{width:e.width?`${e.width}%`:"unset"}},{children:n(Ie,Object.assign({active:!!t,hideSortIcon:!e.sortKey,direction:t||"asc",onClick:()=>e.sortKey?h(e.sortKey):{}},{children:e.label}))}),r)}))})}),n(Te,{children:r.map(((r,t)=>n(we,Object.assign({hover:!0,onClick:s?()=>s(r):r.onClick,sx:{verticalAlign:c}},{children:e.map(((e,i)=>n(Se,Object.assign({align:e.align?e.align:"left",sx:{width:e.width?`${e.width}%`:"unset"}},{children:e.renderCell?e.renderCell(r,t):r[e.id]}),i)))}),t)))}),l||i?n(Me,{children:a(we,{children:[i&&n(Se,Object.assign({colSpan:e.length,sx:{background:"#F0F0F7",px:4,py:3}},{children:i})),l&&r.length&&n(ue,{rowsPerPageOptions:[5,10,25],count:t,rowsPerPage:+u,page:+p,sx:{borderBottom:"none"},onPageChange:(e,r)=>m(r),onRowsPerPageChange:e=>g(+e.target.value)})]})}):null]}))]}))}const Tt=w(jt),St=({actionsList:e})=>{const[r,t]=T(null),i=Boolean(r),l=()=>{t(null)};return a("div",{children:[n($,Object.assign({"aria-label":"more",id:"more-button","aria-controls":i?"more-menu":void 0,"aria-expanded":i?"true":void 0,"aria-haspopup":"true",onClick:e=>{e.stopPropagation(),t(e.currentTarget)}},{children:n(Le,{})})),n(Ae,Object.assign({id:"more-menu",MenuListProps:{"aria-labelledby":"more-button"},anchorEl:r,open:i,onClose:e=>{e.stopPropagation(),l()},PaperProps:{style:{minWidth:"127px"}}},{children:e.map((e=>n(L,Object.assign({onClick:r=>{r.stopPropagation(),e.onClick&&e.onClick(),l()}},{children:e.title}),e.title)))}))]})},Nt=e=>{const{children:r,value:t,index:i}=e,a=h(e,["children","value","index"]);return n("div",Object.assign({role:"tabpanel",hidden:t!==i,id:`simple-tabpanel-${i}`,"aria-labelledby":`simple-tab-${i}`},a,{children:t===i?r:null}))},kt=e=>{var r;const{tabs:t}=e,i=U(),l=X(),o=N((()=>new URLSearchParams(l.search)),[l.search]),s=o.get("tab");return a(m,{children:[n(Ve,{children:n(Re,Object.assign({value:s||(null===(r=t[0])||void 0===r?void 0:r.name),indicatorColor:"primary",textColor:"primary",onChange:(e,r)=>{o.set("tab",r),i({pathname:l.pathname,search:o.toString()},{replace:!0})}},{children:t.map((e=>n($e,{value:e.name,label:e.label},e.name)))}))}),n(m,Object.assign({mt:2},{children:t.map((e=>{var r;return n(Nt,Object.assign({value:s||(null===(r=t[0])||void 0===r?void 0:r.name),index:e.name},{children:e.component}),e.name)}))}))]})};var wt=Ee()((()=>({container:{paddingBottom:"8px"},title:{fontSize:"14px",fontWeight:600,color:"#536DFE"},text:{fontSize:"18px",wordWrap:"break-word"}})));const It=({title:e,text:r,json:t})=>{const{classes:i}=wt();return a("div",Object.assign({className:i.container},{children:[n("div",Object.assign({className:i.title},{children:e})),r&&n("div",Object.assign({className:i.text},{children:r})),t&&n(re,{readOnly:!0,value:t,mode:"json",height:"300px",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2,useWorker:!1}})]}))},Mt=Object.values(Cr).sort(((e,r)=>e.localeCompare(r)));var Pt=({propertyFieldName:e})=>{const{control:r}=v();return a(l,{children:[n(Fe,{children:n(ct,{required:!0,control:r,defaultValue:2,name:`${e}.precisionScale`,label:"Precision Scale"})}),n(Fe,{children:n(kr,{required:!0,control:r,name:`${e}.roundingMode`,label:"Rounding Mode",defaultValue:Cr.HALF_UP,options:Mt})})]})};var At=({propertyFieldName:e,defaultValue:r=""})=>{const{control:t}=v();return n(Fe,{children:n(jr,{required:!0,control:t,defaultValue:r,name:`${e}.format`,label:"Format"})})};const Lt=Ee()((()=>({content:{marginLeft:"4px"},connector:{marginLeft:"4px"},stepper:{padding:"12px"},label:{display:"flex",alignItems:"flex-start"}}))),Vt=()=>n("div",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#536DFE",marginTop:"5px"}}),$t=({data:e})=>{const{classes:r}=Lt();return a(Ge,Object.assign({nonLinear:!0,orientation:"vertical",className:r.stepper,connector:n(Ke,{className:r.connector})},{children:[e.filter(Boolean).map(((e,t)=>a(He,Object.assign({expanded:!0},{children:[n(_e,Object.assign({className:r.label,StepIconComponent:Vt,StepIconProps:{icon:"",completed:!1,active:!0}},{children:e.label})),n(Ye,Object.assign({className:r.content},{children:e.content}))]}),t))),n(He,{})]}))},Rt=({properties:e=[]})=>{const r=N((()=>e?e.map((e=>{const r="string"==typeof e.propertyType?e.propertyType:e.propertyType.value;return{label:a(m,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),a("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," | ",r]})]})),content:"ENTITY"===e.propertyType&&n(Rt,{properties:e.properties})}})):[]),[e]);return n($t,{data:r})};var Ft=Rt;const qt={key:"",propertyType:"",name:"",defaultValue:"",isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0};var Dt=({parentPropertyFieldName:e,entityDefinition:r=!1,globalParameter:t=!1})=>{const{control:i,setValue:p,getValues:m,trigger:g}=v(),h=y({control:i,name:`${e}.properties`,defaultValue:m(`${e}.properties`)||[]}),f=y({control:i,name:`${e}.name`}),O=Sr(),[C,x]=T(0),E=S((()=>{if(h){const r=h.length;p(`${e}.properties.${r}`,qt),x(r)}else p(`${e}.properties`,[qt])}),[h,e,p]),j=()=>b(void 0,void 0,void 0,(function*(){(yield g(`${e}.properties`))&&O.onClose()}));return a(l,{children:[n(Fe,{children:n(te,Object.assign({variant:"h6"},{children:"Properties"}))}),n(Fe,{children:n(Ft,{properties:h})}),n(Fe,{children:n(o,Object.assign({variant:"contained",color:"primary",onClick:O.onOpen},{children:"Edit properties"}))}),a(s,Object.assign({disableEscapeKeyDown:!0,open:O.open,onClose:j,fullWidth:!0,maxWidth:"md"},{children:[a(u,{children:[f||"Entity"," Properties"]}),n(d,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:a(Fe,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[a(Fe,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9"}},{children:[n(Ge,Object.assign({nonLinear:!0,activeStep:C,orientation:"vertical",style:{paddingLeft:"4px"}},{children:h.map(((e,r)=>a(He,Object.assign({onClick:()=>(e=>x(e))(r),style:{cursor:"pointer"}},{children:[n(_e,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:e.name||"(no name)"})),n(Ye,{})]}),r)))})),n(o,Object.assign({variant:"contained",size:"small",color:"primary",onClick:E},{children:"Add property"}))]})),n(Fe,Object.assign({container:!0,wrap:"nowrap",direction:"column",xs:9,spacing:2,style:{height:"100%",overflowY:"auto"}},{children:n(fi,{hideAddButton:!0,parentFieldName:e,focusOnIndex:C,entityDefinition:r,globalParameter:t})}))]}))})),n(c,{children:n(o,Object.assign({variant:"contained",color:"primary",onClick:j},{children:"Ok"}))})]}))]})};var zt=({propertyFieldName:e})=>{const{control:r}=v();return a(l,{children:[n(Fe,{children:n(jr,{required:!0,control:r,name:`${e}.definitionCode`,label:"Definition Code"})}),n(Fe,{children:n(jr,{required:!0,control:r,name:`${e}.definitionVersion`,label:"Definition Version"})}),n(Fe,{children:n(jr,{required:!0,control:r,name:`${e}.labelPropertyCode`,label:"Label Property Code"})}),n(Fe,{children:n(jr,{required:!0,control:r,name:`${e}.valuePropertyCode`,label:"Value Property Code"})})]})};var Bt=({propertyFieldName:e})=>{const r=N((()=>`${e}.restrictedValues`),[e]),{control:t,setValue:i,getValues:o}=v(),s=y({control:t,name:r,defaultValue:o(`${e}.restrictedValues`)||[]}),[c,d]=T(""),[p,u]=T(""),g=S((e=>{i(r,Rr(s,e))}),[s,r,i]),h=()=>{c&&(i(r,[...s,c]),d(""))};return a(l,{children:[n(Fe,{children:n(te,Object.assign({variant:"h6"},{children:"Restricted Values"}))}),!!(null==s?void 0:s.length)&&n(Fe,{children:n(m,Object.assign({display:"flex",flexWrap:"wrap"},{children:s.map(((e,r)=>n(Ue,{sx:{mr:1},variant:"outlined",label:e,onDelete:()=>g(r)},r)))}))}),n(Fe,{children:n(C,{fullWidth:!0,variant:"outlined",size:"small",label:"Add restricted value",value:c,onChange:e=>{const{value:r}=e.target;d(r),s.includes(r)?u("This value already exists"):u("")},error:!!p,helperText:p,name:"restrictedValues",inputProps:{onKeyDown:e=>{"Enter"===e.key&&h()}},InputProps:{endAdornment:n($,Object.assign({size:"small",onClick:h,disabled:!!p},{children:n(Xe,{})}))}})})]})};const Wt=({propertyType:e,propertyFieldName:r,entityDefinition:t=!1,globalParameter:i=!1})=>{switch(e){case fr.STRING:return n(Bt,{propertyFieldName:r});case fr.BIG_DECIMAL:return n(Pt,{propertyFieldName:r});case fr.DATE:return n(At,{propertyFieldName:r,defaultValue:yr});case fr.TIME:return n(At,{propertyFieldName:r,defaultValue:vr});case fr.DATE_TIME:return n(At,{propertyFieldName:r,defaultValue:Or});case fr.ENTITY_REFERENCE:return n(zt,{propertyFieldName:r});case fr.ENTITY:return n(Dt,{parentPropertyFieldName:r,globalParameter:i,entityDefinition:t});default:return null}};var Jt=({validate:e=!1,name:r,inputRef:t})=>{const{control:i,setValue:a,setError:l,clearErrors:o}=v(),s=y({control:i,name:r});return n(re,{wrapEnabled:!0,width:"100%",height:"200px",theme:"monokai",fontSize:14,showPrintMargin:!1,style:{lineHeight:1.4,zIndex:0,isolation:"isolate"},setOptions:{enableLiveAutocompletion:!0,enableBasicAutocompletion:!0,showLineNumbers:!0,tabSize:2,useWorker:!1},ref:t,name:r,value:"string"!=typeof s?null===s?"":JSON.stringify(s):s,onChange:t=>{if(a(r,t),e)try{JSON.parse(t),o(r)}catch(e){l(r,{message:"Invalid JSON"})}},mode:"json",onLoad:r=>{e||r.getSession().setUseWorker(!1)}})};var Gt=({name:e,label:r,required:t,restrictedValues:i})=>{const{control:l}=v(),{field:{onChange:o,ref:s},fieldState:{error:c}}=f({control:l,name:e,rules:{required:t&&(Array.isArray(i)&&i.length?"Please, select a value":"Please, fill this field")}}),d=y({control:l,name:e});return Array.isArray(i)&&i.length?a(F,Object.assign({fullWidth:!0,size:"small",variant:"outlined",error:!!c},{children:[n(Qe,Object.assign({htmlFor:"type-select"},{children:r})),n(Ze,Object.assign({labelId:"type-select",label:r,value:d||"",onChange:o,ref:s},{children:i.map((e=>n(L,Object.assign({value:e},{children:e}),e)))}))]})):n(jr,{hideErrorMessage:!0,required:t,control:l,name:e,label:r})};const Ht=({property:e,name:r,label:t,useExpression:i,inputRef:a})=>{const{control:l}=v();switch(N((()=>"string"==typeof e.propertyType?e.propertyType:e.propertyType.value),[e])){case fr.BIG_DECIMAL:case fr.FLOAT:case fr.DOUBLE:return n(ct,{decimal:!0,required:!0,hideErrorMessage:!0,control:l,name:r,label:t});case fr.INTEGER:case fr.BIG_INTEGER:case fr.LONG:return n(ct,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t});case fr.BOOLEAN:return n(dt,{control:l,name:r});case fr.DATE:return n(pt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case fr.TIME:return n(mt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case fr.DATE_TIME:return n(ut,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case fr.JSON:return n(Jt,{validate:!0,name:r,inputRef:a});case fr.STRING:return n(Gt,{required:!0,name:r,label:t,restrictedValues:e.restrictedValues});case fr.ENTITY_REFERENCE:return n(jr,{required:!0,hideErrorMessage:!0,name:r,label:t,control:l});case fr.ANY:return n(Jt,{name:r,inputRef:a});case fr.ENTITY:return n(Si,{properties:e.properties,dataFieldName:r,useExpression:i});default:return n("div",{children:"No widget"})}};var _t=({value:e,property:r,label:t,isDirty:i,required:n=!1,useExpression:a=!1,multipleOptions:l=!1})=>{const o=N((()=>t?`${t} (value)`:`${r.name} (value)`),[t,r]),s=N((()=>t?`${t} (widget)`:`${r.name} (widget)`),[t,r]),c=N((()=>"string"==typeof r.propertyType?r.propertyType:r.propertyType.value),[r]),[d,p]=T(null),u=N((()=>l?ot({propertyType:c,required:n,useExpression:a}):st({propertyType:c,required:n,useExpression:a})),[a,n,c,l]);return j((()=>{d?i||(Zr(e)&&"expression"!==d?p("expression"):null==e||Zr(e)||"widget"===d||p("widget")):et(e)&&(null==u?void 0:u.length)?p(u[0].value):a&&Zr(e)?p("expression"):p("widget")}),[e,d,u,a,i]),{propertyType:c,valueLabel:o,fillOptionLabel:s,fillOption:d,fillOptions:u,setFillOption:p}};var Yt=Ee()((()=>({inputLabel:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"}})));const Kt={code:"",name:"",version:0,properties:[]},Ut={code:"",name:"",version:0,properties:{}},Xt=({property:e,name:r,useExpression:t,label:i,required:l,title:o})=>{const{control:s,clearErrors:c,register:d}=v(),{field:{ref:p,onChange:u},fieldState:{error:g,isDirty:h}}=f({name:r}),b=y({control:s,name:r}),{propertyType:O,valueLabel:C,fillOptionLabel:x,fillOption:E,fillOptions:T,setFillOption:S}=_t({value:b,property:e,isDirty:h,label:i,required:l,useExpression:t});j((()=>{void 0===b&&u(null)}),[b,u]);const{classes:N}=Yt();return a(Fe,Object.assign({xs:12},{children:[o&&n(m,Object.assign({mb:2},{children:n(te,Object.assign({variant:"h6"},{children:o}))})),T?n(m,Object.assign({mb:2},{children:a(F,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[n(Qe,Object.assign({htmlFor:"type-select",className:N.inputLabel},{children:x})),n(Ze,Object.assign({labelId:"type-select",label:x,value:E||"",onChange:e=>{const t=e.target.value;if("null"===t)d(r,{value:null});else if("widget"===t)if(O===fr.JSON&&b&&"string"!=typeof b&&"dem_builder"===E&&"properties"in b){const e=Object.assign(Object.assign({},b),{properties:it(b.property||[])});try{u(JSON.stringify(e,null,"\t"))}catch(e){console.log("Stringify failed")}}else u(null);else if("expression"===t||"string"===t)u("");else if("dem_builder"===t)if(b)try{const e=JSON.parse(b);e.properties=nt(e.properties||{}),u(e)}catch(e){u(Kt),console.log("Parse failed")}else u(Kt);S(t),c(r)}},{children:T.map((e=>n(L,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===E&&(O===fr.JSON||O===fr.ENTITY||O===fr.ANY?n(Jt,{name:r,inputRef:p}):n(jr,{control:s,name:r,label:C,required:!0,hideErrorMessage:!0})),"string"===E&&n(jr,{control:s,name:r,label:C,required:!0,hideErrorMessage:!0}),"json_notvalid"===E&&n(Jt,{name:r,inputRef:p}),"widget"===E&&n(Ht,{property:e,name:r,useExpression:t,label:C,inputRef:p,required:l}),"dem_builder"===E&&n(yi,{title:"JSON",definitionFieldName:r}),g&&n(te,Object.assign({color:"secondary"},{children:g.message}))]}))};var Zt=({name:e,property:r,useExpression:t,required:i,label:l})=>{const{control:s,setValue:c,clearErrors:d}=v();f({control:s,name:e,rules:{validate:e=>!(!e||Array.isArray(e)&&!e.length)||"Please, fill array"}});const p=y({control:s,name:e}),u=S((()=>{p&&Array.isArray(p)?c(`${e}.${p.length}`,null):c(e,[null]),d(e)}),[e,p,c,d]),g=S((r=>{c(e,Rr(p,r))}),[e,p,c]);return a(Fe,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[p&&Array.isArray(p)?p.map(((o,s)=>n(Fe,Object.assign({xs:12},{children:a(m,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[n(Xt,{required:i,property:r,useExpression:t,name:`${e}.${s}`,label:`${l||r.name} (${s+1})`}),n(m,Object.assign({mt:"8px",ml:"4px"},{children:n($,Object.assign({size:"small",onClick:()=>g(s)},{children:n(er,{fontSize:"small"})}))}))]}))}),s))):null,n(Fe,{children:n(o,Object.assign({variant:"contained",size:"small",color:"primary",onClick:u},{children:"Add value"}))})]}))};const Qt=({property:e,name:r,useExpression:t,required:i,label:l,title:o})=>{const{control:s,clearErrors:c}=v(),{field:{ref:d,onChange:p},fieldState:{error:u,isDirty:g}}=f({control:s,name:r,rules:{validate:e=>!(i&&!e)||"Please, fill this field"}}),h=y({control:s,name:r}),{propertyType:b,valueLabel:O,fillOptionLabel:C,fillOption:x,fillOptions:E,setFillOption:T}=_t({property:e,value:h,isDirty:g,label:l,required:i,useExpression:t,multipleOptions:!0});j((()=>{void 0===h&&p(null)}),[h,p]);const{classes:S}=Yt();return a(Fe,{children:[o&&n(m,Object.assign({mb:2},{children:n(te,Object.assign({variant:"h6"},{children:o}))})),E?n(m,Object.assign({mb:2},{children:a(F,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[n(Qe,Object.assign({htmlFor:"type-select",className:S.inputLabel},{children:C})),n(Ze,Object.assign({labelId:"type-select",label:C,value:x||"",onChange:e=>{const t=e.target.value;"null"===t?p(null):"expression"===t||"json_valid"===t||"json_notvalid"===t?p(""):"widget"===t&&p([]),T(t),c(r)}},{children:E.map((e=>n(L,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===x&&(b===fr.JSON||b===fr.ENTITY||b===fr.ANY?n(Jt,{name:r,inputRef:d}):n(jr,{required:!0,hideErrorMessage:!0,control:s,name:r,label:O})),"json_valid"===x&&n(Jt,{validate:!0,name:r,inputRef:d}),"widget"===x&&n(Zt,{property:e,name:r,useExpression:t,required:i,label:l}),u&&n(te,Object.assign({color:"secondary"},{children:u.message}))]})},ei=({propertyFieldName:e,name:r,label:t="",required:i})=>{const{control:a}=v(),l=y({control:a,name:`${e}.propertyType`}),o=y({control:a,name:`${e}.isMultiple`}),s=y({control:a,name:`${e}.format`}),c=y({control:a,name:`${e}.restrictedValues`}),d=y({control:a,name:`${e}.properties`}),p=y({control:a,name:`${e}.isRequired`}),u=N((()=>{const e="string"==typeof l?l:l.value;return{name:t,isRequired:p,isMultiple:o,format:s,restrictedValues:c,properties:d,propertyType:e,defaultValue:null,defaultValues:[],sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null}}),[l,s,c,o,t,p,d]);return n(o?Qt:Xt,{name:r,property:u,title:t,required:i})};var ri=({name:e})=>{const r=N((()=>({type:""})),[]),{control:t}=v(),{fields:i,append:l,remove:s}=O({control:t,name:e});return a(m,Object.assign({mt:2},{children:[n(o,Object.assign({variant:"outlined",size:"small",onClick:()=>l(r)},{children:"Add node"})),i.map((({id:r},t)=>n(di,{removeHandle:()=>s(t),name:`${e}.${t}`},r)))]}))};const ti=I(""),ii=({name:e,control:r})=>a(l,{children:[n(te,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),n(m,{children:n(jr,{control:r,name:`${e}.minimumLength`,label:"Minimum Length",type:"number"})}),n(m,Object.assign({mt:2},{children:n(jr,{control:r,name:`${e}.maximumLength`,label:"Maximum Length",type:"number"})}))]}),ni=({name:e,control:r})=>a(l,{children:[n(te,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),n(m,{children:n(jr,{control:r,name:`${e}.multipleOf`,label:"Multiple Of",type:"number"})}),n(m,Object.assign({mt:2},{children:n(jr,{control:r,name:`${e}.minimum`,label:"Minimum",type:"number"})})),n(m,Object.assign({mt:2},{children:n(jr,{control:r,name:`${e}.maximum`,label:"Maximum",type:"number"})})),a(m,Object.assign({mt:2},{children:[n(wr,{control:r,name:`${e}.exclusiveMinimum`,label:"Exclusive Minimum",defaultValue:"false"}),n(wr,{control:r,name:`${e}.exclusiveMaximum`,label:"Exclusive Maximum",defaultValue:"false"})]}))]}),ai=["STRING_REGEX","JSON_SCHEMA"],li=new Set([fr.INTEGER,fr.FLOAT,fr.DOUBLE,fr.BIG_DECIMAL,fr.BIG_INTEGER,fr.LONG]);var oi=({name:e})=>{const{control:r,setValue:t}=v(),i=M(ti),o=y({control:r,name:`${e}.type`}),s=N((()=>{if("STRING_REGEX"===o)return n(jr,{control:r,name:`${e}.pattern`,label:"Pattern"});if("JSON_SCHEMA"===o)switch(!0){case i===fr.STRING:return n(ii,{name:`${e}.node`,control:r});case li.has(i):return n(ni,{name:`${e}.node`,control:r});case i===fr.JSON:return n($r,{label:"Properties",control:r,name:`${e}.properties`,validateJson:!0,parseValue:!0});default:return"Not available for type "+i}return null}),[i,o,r,e]);return j((()=>{li.has(i)&&"JSON_SCHEMA"===o&&(t(`${e}.node.exclusiveMinimum`,!1),t(`${e}.node.exclusiveMaximum`,!1))}),[i,o,t,e]),n($t,{data:[{label:"Validator",content:a(l,{children:[n(m,{children:n(kr,{control:r,name:`${e}.type`,label:"Type",options:ai,onChange:r=>{t(e,{}),t(`${e}.type`,r.target.value)}})}),n(m,Object.assign({mt:2},{children:s}))]})}]})};const si=["AND","OR","NOT","NODE"],ci=({name:e,removeHandle:r})=>{const{control:t}=v(),i=y({control:t,name:`${e}.type`}),o=N((()=>({AND:n(ri,{name:`${e}.nodes`}),OR:n(ri,{name:`${e}.nodes`}),NODE:n(oi,{name:`${e}.validator`}),NOT:n(ci,{name:`${e}.node`})})),[e]);return n($t,{data:[{label:"Node Type",content:a(l,{children:[a(m,Object.assign({display:"flex",alignItems:"center"},{children:[n(kr,{required:!0,control:t,name:`${e}.type`,label:"Type",options:si}),r&&n(m,Object.assign({ml:2},{children:n($,Object.assign({onClick:r,color:"primary"},{children:n(Je,{})}))}))]})),n(m,{children:o[i]})]})}]})};var di=ci;const pi=({name:e})=>{const[r,t]=T(!1),{setValue:i,getValues:o}=v(),s=S((r=>{t(r.target.checked),r.target.checked||i(e,null)}),[i,e]);return j((()=>{o(e)&&t(!0)}),[e,o]),a(l,{children:[a(m,Object.assign({display:"flex",justifyContent:"space-between"},{children:[n(te,Object.assign({variant:"h6"},{children:"Validator"})),n(q,{label:"Enable",control:n(z,{color:"primary",checked:r,onChange:s})})]})),r&&n(di,{name:e})]})};var ui=({name:e,label:r="",propertyFieldName:t,type:i,decimal:a=!1,options:l=[],required:o=!1})=>{const{control:s}=v(),c=N((()=>`${t}.${e}`),[e,t]);switch(i){case"text":return n(jr,{control:s,name:c,label:r,required:o});case"number":return n(ct,{control:s,name:c,label:r,decimal:a,required:o});case"select":return n(kr,{control:s,name:c,label:r,options:l,required:o});case"autocomplete":return n(Pr,{control:s,name:c,label:r,options:l,required:o});case"json":return n($r,{control:s,name:c,label:r,mode:"json",required:o});default:return null}};var mi=e=>({customCheckboxes:N((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:N((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e])});const gi=Object.values(fr).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}))),hi=({propertyFieldName:e,entityDefinition:r=!1,globalParameter:t=!1,customPropertyFields:i=[]})=>{var o;const{control:s,setValue:c}=v(),d=y({control:s,name:`${e}.propertyType`}),p=y({control:s,name:`${e}.isMultiple`}),u=y({control:s,name:`${e}.isRequired`}),{customCheckboxes:m,customFields:g}=mi(i),h=N((()=>{let e=t?"Value":"Default Value";return p&&(e+="s"),e}),[t,p]);return j((()=>{d&&"string"==typeof d&&c(`${e}.propertyType`,gi.find((e=>e.value===d)))}),[d,c,e]),a(Fe,Object.assign({container:!0,direction:"column",spacing:2},{children:[n(Fe,{children:n(Nr,{required:!0,control:s,name:`${e}.key`,label:"Key"})}),n(Fe,{children:n(Nr,{required:!0,control:s,name:`${e}.name`,label:"Name"})}),n(Fe,{children:n(Pr,{required:!0,control:s,name:`${e}.propertyType`,label:"Type",options:gi,onChange:(r,i)=>{const n=`${e}.propertyType`,a=`${e}.${t?"value":"defaultValue"}`;c(a,p?[]:null),c(n,i)}})}),n(Fe,{children:n(ct,{required:!0,control:s,name:`${e}.sortOrder`,label:"Sort Order"})}),n(Fe,{children:n($r,{control:s,name:`${e}.uiSettings`,label:"UI Settings",validateJson:!0})}),a(Fe,{children:[n(wr,{control:s,name:`${e}.isMultiple`,label:"Multiple"}),n(wr,{control:s,name:`${e}.isEnabled`,label:"Enabled"}),n(wr,{control:s,name:`${e}.isRequired`,label:"Required"}),r&&n(wr,{control:s,name:`${e}.isViewableInList`,label:"Is viewable in list"}),m.length?n(l,{children:m.map(((r,t)=>n(wr,{control:s,name:`${e}.${r.name}`,label:r.label},t)))}):null]}),d&&a(l,{children:[n(Fe,{children:n(ti.Provider,Object.assign({value:null!==(o=d.value)&&void 0!==o?o:d},{children:n(pi,{name:`${e}.validationNode`})}))}),n(Wt,{propertyType:"string"==typeof d?d:d.value,propertyFieldName:e,globalParameter:t,entityDefinition:r}),n(ei,{propertyFieldName:e,name:`${e}.${t?"value":"defaultValue"}`,label:h,required:!!t&&u})]}),g.length?n(l,{children:g.map(((r,t)=>n(Fe,{children:n(ui,Object.assign({},r,{propertyFieldName:e}))},t)))}):null]}))},bi={key:"",propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},fi=({parentFieldName:e,hideAddButton:r,focusOnIndex:t,required:i,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[]})=>{const p=N((()=>e?`${e}.properties`:"properties"),[e]),{setValue:u,clearErrors:m,control:g}=v(),{fieldState:{error:h}}=f({control:g,name:p,rules:{required:i&&"Please, add properties"}}),b=y({control:g,name:p}),O=E([]);j((()=>{"number"==typeof t&&O.current[t]&&O.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,O]);const C=S((()=>{b?u(`${p}.${b.length}`,bi):u(p,[bi]),m(p)}),[b,p,m,u]),x=S((e=>{u(`${p}`,Rr(b,e))}),[b,p,u]);return a(l,{children:[h&&h.message&&n(Fe,Object.assign({sm:12},{children:n(te,Object.assign({color:"secondary"},{children:h.message}))})),b&&b.map(((e,r)=>n(Fe,Object.assign({sm:12,ref:e=>O.current[r]=e},{children:a(qe,Object.assign({defaultExpanded:!0,elevation:3},{children:[n(De,Object.assign({expandIcon:n(We,{})},{children:n(te,Object.assign({color:h&&h[r]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:e.name||`Property ${r+1}`}))})),n(ze,{children:n(hi,{propertyFieldName:`${p}.${r}`,entityDefinition:s,globalParameter:c,customPropertyFields:d})}),n(Be,{children:n(o,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>x(r)},{children:"Remove"}))})]}))}),r))),!r&&n(Fe,Object.assign({xs:12},{children:n(o,Object.assign({variant:"contained",size:"small",color:"primary",onClick:C},{children:"Add property"}))}))]})},yi=({definitionFieldName:e,title:r,hideCodeField:t,hideVersionField:i,hideNameField:l,required:o=!1})=>{const{control:s}=v();return a(Fe,Object.assign({container:!0,direction:"column",spacing:2},{children:[r&&n(Fe,Object.assign({sm:12},{children:n(m,Object.assign({my:2},{children:n(te,Object.assign({variant:"h4"},{children:r}))}))})),!l&&n(Fe,Object.assign({sm:12},{children:n(jr,{required:!0,control:s,name:e?`${e}.name`:"name",label:"Name"})})),!t&&n(Fe,Object.assign({sm:12},{children:n(jr,{required:!0,control:s,name:e?`${e}.code`:"code",label:"Code"})})),!i&&n(Fe,Object.assign({sm:12},{children:n(ct,{required:!0,control:s,name:e?`${e}.version`:"version",label:"Version"})})),n(fi,{required:o,parentFieldName:e})]}))},vi={name:"Name",key:"Key",propertyType:"Property Type",defaultValue:"Default Value",defaultValues:"Default Values",sortOrder:"Sort Order",isRequired:"Required",isMultiple:"Multiple",isEnabled:"Enabled",isViewableInList:"Is Viewable In List",precisionScale:"Precision Scale",roundingMode:"Rounding Mode",format:"Format",definitionCode:"Definition Code",definitionVersion:"Definition Version",labelPropertyCode:"Label Property Code",valuePropertyCode:"Value Property Code",restrictedValues:"Restricted Values",value:"Value",values:"Values",uiSettings:"UI Settings",validationNode:"Validation Node"},Oi=({value:e,type:r})=>r!==fr.JSON&&r!==fr.ENTITY&&r!==fr.ANY||!e?n(te,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===e?"null":e.toString()})):n(Hr,{value:e}),Ci=(e,r,t)=>{switch(r){case"isRequired":case"isMultiple":case"isEnabled":case"isViewableInList":return e?n(ir,{color:"primary",fontSize:"small"}):null;case"restrictedValues":return e?n(m,Object.assign({display:"flex",flexWrap:"wrap"},{children:e.map((e=>n(Ue,{label:e,style:{wordBreak:"break-word",maxWidth:"500px"}},e)))})):null;case"defaultValue":case"value":return n(Oi,{value:e,type:t});case"values":case"defaultValues":return Array.isArray(e)&&t!==fr.ENTITY&&t!==fr.JSON&&t!==fr.ANY?a("div",{children:["[",null==e?void 0:e.map(((e,r)=>n("div",{children:n(Oi,{value:e,type:t})},r))),"]"]}):n(Hr,{value:e});case"uiSettings":case"validationNode":return e?n(Hr,{value:e}):null;default:return n(te,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:e}))}};var xi=({property:e})=>{const r=N((()=>(e&&(e.isMultiple?(delete e.defaultValue,delete e.value):(delete e.defaultValues,delete e.values)),e)),[e]);return n(je,Object.assign({size:"small"},{children:n(Te,{children:Object.keys(vi).map((e=>e in r?a(we,{children:[n(Se,Object.assign({width:"30%"},{children:n(te,{children:vi[e]})})),n(Se,{children:Ci(r[e],e,r.propertyType)})]},e):null))})}))};var Ei=P((({properties:e,parentNames:r=[]})=>{const t=N((()=>{let r=!1;return e.every((e=>e.propertyType!==fr.ENTITY||(r=!0,!1))),r}),[e]);return a(m,Object.assign({mt:4},{children:[n(te,Object.assign({variant:"h6"},{children:"Properties"})),a(Ge,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[e.map((e=>a(He,Object.assign({expanded:!0},{children:[n(_e,{StepIconProps:{icon:"",completed:!1,active:!0}}),n(Ye,{children:n(ji,{property:e,parentNames:[...r],defaultExpanded:!1})})]}),e.key))),t&&n(He,{})]}))]}))}));const ji=({property:e,parentNames:r=[],defaultExpanded:t=!0})=>{const[i,l]=T(!0);return j((()=>{l(t)}),[t]),a(qe,Object.assign({elevation:3,style:{backgroundColor:r.length%2==1?"#f1f1f1":"#fff"},expanded:i,onChange:()=>l((e=>!e))},{children:[n(De,Object.assign({expandIcon:n(tr,{})},{children:n(te,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:e.name}))})),n(ze,{children:a(m,Object.assign({width:"100%"},{children:[n(xi,{property:e}),e.propertyType===fr.ENTITY&&n(Ei,{properties:nt(e.properties),parentNames:[...r,e.name]})]}))})]}))},Ti=({properties:e,expandAll:r=!0})=>{const t=N((()=>Array.isArray(e)?e:e?nt(e):[]),[e]);return n(m,Object.assign({display:"flex",flexDirection:"column"},{children:t.length?t.map((e=>n(ji,{property:e,defaultExpanded:r},e.key))):n(te,{children:"No properties"})}))},Si=({properties:e,dataFieldName:r,useExpression:t=!1,title:i})=>{const l=N((()=>e?e.map((e=>{const i="string"==typeof e.propertyType?e.propertyType:e.propertyType.value;return{label:a(m,Object.assign({display:"flex",flexDirection:"column"},{children:[a("b",{children:[e.name,e.isRequired?"*":""]}),a("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," | ",i]})]})),content:e.isMultiple?n(Qt,{property:e,name:`${r}.${e.key}`,useExpression:t,label:e.name,required:e.isRequired}):n(Xt,{property:e,name:`${r}.${e.key}`,useExpression:t,label:e.name,required:e.isRequired})}})):[]),[e,r,t]);return a(Fe,Object.assign({container:!0,direction:"column",spacing:2},{children:[i&&n(Fe,Object.assign({xs:12},{children:n("div",Object.assign({style:{fontWeight:"600"}},{children:i}))})),n($t,{data:l})]}))},Ni=({property:e,data:r,properties:t})=>{const i=e=>n(m,Object.assign({style:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"4px"}},{children:null===e?"null":null==e?void 0:e.toString()}));if(Zr(r))return i(r);switch(e.propertyType){case fr.JSON:return n(Hr,{value:r});case fr.ENTITY:return n(wi,{properties:t,data:r});case fr.ANY:return"object"==typeof r?n(Hr,{value:r}):i(r);default:return i(r)}};var ki=({property:e,data:r,hasBackground:t=!1})=>{const i=N((()=>e.propertyType===fr.ENTITY?Array.isArray(e.properties)?e.properties:nt(e.properties):[]),[e]);return n(m,Object.assign({style:{backgroundColor:t?"#f1f1f1":"none"}},{children:n(Ni,{property:e,data:r,properties:i})}))};const wi=({properties:e,data:r})=>{const t=N((()=>e&&r?e.map((e=>{var t;const{key:i,name:o,isMultiple:s,propertyType:c}=e,d=null!==(t=r[e.key])&&void 0!==t?t:r;return{label:a(m,Object.assign({display:"flex",flexDirection:"column"},{children:[n("b",{children:o}),a("span",{children:[i," | ",s?"multiple":"single"," | ",c]})]})),content:s&&Array.isArray(d)&&e.propertyType!==fr.ANY?n(l,{children:d.map(((r,t)=>n(m,Object.assign({mb:2},{children:n(ki,{property:e,data:r,hasBackground:!0})}),t)))}):n(ki,{property:e,data:d})}})):[]),[e,r]);return n(Fe,Object.assign({container:!0,direction:"column",spacing:2},{children:n($t,{data:t})}))};var Ii=Ee()((e=>({root:{backgroundColor:"#eee",fontSize:"14px",padding:"0 8px",borderRadius:"10px",width:"fit-content","&.success":{backgroundColor:"#a9dfa9"},"&.error":{backgroundColor:"#ff7e7e"},"&.warning":{backgroundColor:e.palette.warning.main}}})));const Mi=({text:e,status:r="default"})=>{const{classes:t}=Ii();return n("div",Object.assign({className:nr(t.root,{[r]:!0})},{children:e}))},Pi=Ee()((()=>({propertyStepLabel:{"&:hover":{fontWeight:"600",cursor:"pointer"}}}))),Ai=({properties:e,parentKey:r="",activePath:t="",prefix:i="",onClick:l})=>{const{classes:o}=Pi();return n(Ge,Object.assign({orientation:"vertical",onClick:e=>e.stopPropagation()},{children:e&&e.map((e=>{var s;const c=r?`${r}.${e.key}`:e.key,d=null!==(s=e.propertyType.value)&&void 0!==s?s:e.propertyType;return a(He,Object.assign({expanded:!0,onClick:()=>{return e=c,void l(i?`${i}.${e}`:e);var e}},{children:[n(_e,Object.assign({StepIconProps:{icon:"",completed:!1,active:t===c}},{children:a("div",Object.assign({className:o.propertyStepLabel},{children:[e.name," - ",e.key," - ",d]}))})),n(Ye,{children:n("div",{children:d===fr.ENTITY&&n(Ai,{onClick:l,activePath:t,properties:e.properties,parentKey:c},e.key)})})]}),e.key)}))}))};var Li=Ai;const Vi=({open:e=!1,onClose:r,onPaste:t,properties:i})=>{const[l,p]=T("");return a(s,Object.assign({open:e,onClose:r,fullWidth:!0,maxWidth:"md"},{children:[n(u,{children:"JSON path picker"}),a(d,{children:[(null==i?void 0:i.length)?i.map(((e,r)=>a("div",{children:[n(te,Object.assign({variant:"h6"},{children:e.title})),n(Li,{properties:e.properties,prefix:e.pathPrefix,onClick:p,activePath:l})]},r))):n(te,{children:"Please, add properties"}),l&&a(te,Object.assign({variant:"h6",gutterBottom:!0},{children:["Selected path : $(",l,")"]}))]}),a(c,{children:[n(o,Object.assign({variant:"contained",color:"primary",onClick:()=>{navigator.clipboard.writeText(`$(${l})`),ar.success("Copied!")}},{children:"Copy"})),n(o,Object.assign({variant:"contained",color:"primary",onClick:()=>{t(`$(${l})`),ar.success("Pasted!")}},{children:"Paste"})),n(o,Object.assign({variant:"contained",color:"secondary",onClick:r},{children:"Close"}))]})]}))},$i=I({collapsed:!1,toggleCollapse:()=>{console.log("collapse toggle")}}),Ri=()=>M($i),Fi=({children:e})=>{const[r,t]=T(!!localStorage.getItem("sidebar_collapsed")),i=S((()=>{t(!r),localStorage.setItem("sidebar_collapsed",`${!r}`)}),[r]);return n($i.Provider,Object.assign({value:{collapsed:r,toggleCollapse:i}},{children:e}))},qi=e("div")({position:"relative","&:hover":{".button-collapse":{opacity:1}}}),Di=e(or)((e=>({width:248,flexShrink:0,position:"relative",transition:"all 0.3s ease-in-out","& .MuiDrawer-paper":{backgroundColor:e.theme.palette.secondary.main,width:248,boxSizing:"border-box",borderRight:"none",borderRadius:0,transition:"all 0.3s ease-in-out",overflow:"hidden"},"&.collapsed":{width:64,"& .MuiDrawer-paper":{width:64}}}))),zi=e(gr)((({theme:e})=>({backgroundColor:"#fff",borderRight:"1px solid rgba(38, 40, 66, 0.08)",fontSize:24,fontWeight:600}))),Bi=e(sr)((e=>({padding:e.theme.spacing(3),margin:0}))),Wi=e(cr)((e=>({color:"#fff",height:e.theme.spacing(11),overflow:"hidden"}))),Ji=e(pr)((({theme:e})=>({borderRadius:e.spacing(2.5),padding:e.spacing(2),height:e.spacing(11),"&.active":{backgroundColor:"rgba(38, 40, 66, 0.12)","&.main":{backgroundColor:"rgba(255, 255, 255, 0.12)",borderLeft:"4px solid #E0613A"}},"&:hover":{backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.collapsed":{width:e.spacing(11),"&.active":{"&.main":{border:"none",backgroundColor:"#E0613A"}}}}))),Gi=e(dr)((({theme:e})=>({color:"#fff",width:20,height:20,minWidth:20,marginRight:e.spacing(2),"& svg":{marginLeft:2,fill:"#fff",color:"#fff"},"&.collapsed":{marginRight:0}}))),Hi=e(ur)((()=>({backgroundColor:"inherit",color:"#fff",paddingLeft:0,textTransform:"uppercase"}))),_i=e(mr)((e=>({width:"100%","& > *":{overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-all",whiteSpace:"nowrap"},"&.collapsed":{display:"none"}}))),Yi=e(sr)((e=>({margin:0,padding:0,"& .MuiListItemText-root":{paddingLeft:e.theme.spacing(7)}}))),Ki=e(hr)((e=>({position:"absolute",top:e.theme.spacing(10),left:"calc(100% - 16px)",width:e.theme.spacing(8),height:e.theme.spacing(8),border:"1px solid #E0E3EA",borderRadius:"50%",boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.12)",backgroundColor:"#fff",zIndex:8e3,opacity:0,transition:"all 0.3s ease-in-out","&.collapsed":{img:{transition:"all 0.3s ease-in-out",transform:"rotate(180deg)"}}})));var Ui=({route:e,isActive:r})=>{const{collapsed:t}=Ri();return e.link?n(Wi,Object.assign({disablePadding:!0},{component:Z,replace:!0,to:{pathname:e.link,search:e.query}},{children:a(Ji,Object.assign({className:nr({active:r,main:e.main,collapsed:t})},{children:[e.icon&&n(Gi,Object.assign({className:nr({collapsed:t})},{children:e.icon})),n(_i,{primary:e.name,primaryTypographyProps:{variant:"body2"},className:nr({collapsed:t})})]}))})):n(Hi,{children:e.name})};function Xi({route:e,isActive:r,isListOpen:t,handleClick:i}){const{collapsed:l}=Ri();return(null==e?void 0:e.link)?n(Wi,Object.assign({disablePadding:!0,onClick:i},{children:a(Ji,Object.assign({className:nr({active:r,main:e.main,collapsed:l})},{children:[e.icon&&n(Gi,{children:e.icon}),n(_i,{primary:e.name,primaryTypographyProps:{variant:"body2"},className:nr({collapsed:l})}),n(m,{component:"img",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg opacity='0.6'%3e%3cpath d='M10.3533 2.81334C10.447 2.90709 10.4996 3.03417 10.4996 3.16667C10.4996 3.29917 10.447 3.42626 10.3533 3.52001L5.87334 8.00001L10.3533 12.48C10.4025 12.5258 10.4419 12.581 10.4692 12.6423C10.4965 12.7036 10.5112 12.7699 10.5124 12.837C10.5136 12.9041 10.5012 12.9708 10.4761 13.0331C10.4509 13.0953 10.4135 13.1519 10.366 13.1994C10.3186 13.2468 10.262 13.2843 10.1997 13.3094C10.1375 13.3346 10.0708 13.3469 10.0037 13.3457C9.93652 13.3446 9.87032 13.3299 9.80898 13.3025C9.74765 13.2752 9.69245 13.2358 9.64667 13.1867L4.81334 8.35334C4.71971 8.25959 4.66711 8.13251 4.66711 8.00001C4.66711 7.86751 4.71971 7.74042 4.81334 7.64667L9.64667 2.81334C9.74042 2.71971 9.86751 2.66711 10 2.66711C10.1325 2.66711 10.2596 2.71971 10.3533 2.81334Z' fill='white'/%3e%3c/g%3e%3c/svg%3e",mr:3,sx:{transition:"transform .3s",transform:`rotate(${t?"-90deg":0})`,opacity:l?0:1}})]}))})):n(Hi,{children:e.name})}const Zi=({route:e})=>{var r,t;const i=X(),{collapsed:o}=Ri(),[s,c]=T(!1),d=N((()=>!!e.link&&i.pathname.startsWith(e.link)),[i.pathname,e]);return j((()=>{c(d)}),[d]),(null===(r=e.children)||void 0===r?void 0:r.length)&&!o?a(l,{children:[n(Xi,{route:e,isActive:d,handleClick:()=>{c(!s)},isListOpen:s||!e.link}),n(br,Object.assign({in:s||!e.link,timeout:"auto"},{children:n(Yi,{children:null===(t=e.children)||void 0===t?void 0:t.map(((e,r)=>n(Zi,{route:e},r)))})}))]}):n(Ui,{route:e,isActive:d})};var Qi=Zi;const en=({src:e,alt:r})=>n(m,Object.assign({sx:{width:20,height:20,display:"flex",justifyContent:"center",alignItems:"center"}},{children:n("img",{src:e,alt:r})}));var rn=({title:e,routes:r})=>{const{collapsed:t,toggleCollapse:i}=Ri();return a(qi,{children:[n(Ki,Object.assign({className:nr("button-collapse",{collapsed:t}),onClick:i},{children:n("img",{src:"data:image/svg+xml,%3csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6.47054 0.861939C6.59552 0.986958 6.66573 1.1565 6.66573 1.33327C6.66573 1.51005 6.59552 1.67959 6.47054 1.80461L2.27521 5.99994L6.47054 10.1953C6.59198 10.321 6.65917 10.4894 6.65766 10.6642C6.65614 10.839 6.58602 11.0062 6.46242 11.1298C6.33881 11.2534 6.1716 11.3235 5.99681 11.3251C5.82201 11.3266 5.65361 11.2594 5.52787 11.1379L0.861207 6.47127C0.736226 6.34625 0.666016 6.17672 0.666016 5.99994C0.666016 5.82316 0.736226 5.65362 0.861207 5.52861L5.52787 0.861939C5.65289 0.736958 5.82243 0.666748 5.99921 0.666748C6.17598 0.666748 6.34552 0.736958 6.47054 0.861939V0.861939Z' fill='%238B8C9E'/%3e%3c/svg%3e",alt:"collapse"})})),a(Di,Object.assign({variant:"permanent",anchor:"left",className:nr({collapsed:t})},{children:[!!e&&n(zi,{children:e}),n(Bi,{children:r.map(((e,r)=>n(Qi,{route:e},r)))})]}))]})};const tn=({routes:e,theme:t=lr,title:i=""})=>n(r,Object.assign({theme:t},{children:n(Fi,{children:n(rn,{title:i,routes:e})})})),nn=({children:e,toolbar:r,contentSx:t})=>a(m,Object.assign({component:"main",sx:{flexGrow:1,bgcolor:"background.default"}},{children:[n(gr,Object.assign({sx:{borderBottom:"1px solid rgba(38, 40, 66, 0.08)"}},{children:r})),n(m,Object.assign({sx:Object.assign(Object.assign({},t),{height:"calc(100vh - 56px)",overflow:"scroll"})},{children:n(A,Object.assign({fallback:n(xr,{})},{children:null!=e?e:n(ee,{})}))}))]}));var an=t({spacing:4,palette:{primary:{main:"#E0613A",dark:"#d9512e",light:"#E0613A"},secondary:{main:"#007994",dark:"#262842",light:"#cbe8ee"},text:{disabled:"#A9A9B8"},success:{main:"#2DB77B",light:"#DBFCEE"},grey:{700:"#101F2B"}},typography:{fontFamily:'Euclid,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',fontSize:14,h1:{fontWeight:400},h3:{fontWeight:500},h4:{fontWeight:500}},components:{}});var ln={components:{MuiButton:{styleOverrides:{root:{lineHeight:1.429}}},MuiInputBase:{styleOverrides:{root:{borderRadius:an.spacing(3),minWidth:an.spacing(25),background:an.palette.background.default},input:{minWidth:an.spacing(25)}}},MuiSelect:{styleOverrides:{nativeInput:{padding:0,height:"32px"}}},MuiTextField:{styleOverrides:{root:{minWidth:an.spacing(25)}}},MuiInputLabel:{styleOverrides:{root:{position:"relative",overflow:"initial",transform:"none",marginBottom:an.spacing(1),fontWeight:500,fontSize:"14px",lineHeight:"20px"}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:an.spacing(3),minWidth:an.spacing(25)},notchedOutline:{top:0,"& legend":{display:"none",transition:"none"}}}},MuiAutocomplete:{styleOverrides:{paper:{marginTop:8,borderRadius:12,boxShadow:"0px 8px 16px rgba(0, 0, 0, 0.04)"},listbox:{"::-webkit-scrollbar":{width:"6px",backgroundColor:"white"},"::-webkit-scrollbar-thumb":{borderRadius:"10px",backgroundColor:"rgba(38, 40, 66, 0.24)"}}}},MuiMenu:{styleOverrides:{list:{paddingTop:0,paddingBottom:0,background:"white","& li.Mui-selected":{background:"rgba(38, 40, 66, 0.08) !important"}}}},MuiPopover:{styleOverrides:{paper:{marginTop:8,borderRadius:12,boxShadow:"0px 8px 16px rgba(0, 0, 0, 0.04)"}}},MuiFormLabel:{styleOverrides:{asterisk:{color:"#D6331F","&$error":{color:"#D6331F"}}}}}};var on={components:{MuiTableContainer:{styleOverrides:{root:{borderRadius:an.spacing(3),border:"1px solid rgba(38, 40, 66, 0.08)"}}},MuiTableHead:{styleOverrides:{root:{backgroundColor:"#F7F8FC"}}},MuiTableCell:{styleOverrides:{root:{minHeight:48,padding:an.spacing(1,2),"&:first-of-type":{paddingLeft:an.spacing(4)}},head:{maxHeight:"40px",padding:an.spacing(2.75,2),color:"#6D6E85"},body:{wordBreak:"break-all"}}},MuiTableSortLabel:{styleOverrides:{root:{maxHeight:"24px",lineHeight:1}}}}};var sn={components:{MuiStepIcon:{styleOverrides:{root:{fontSize:"20px",color:an.palette.text.disabled,"&.Mui-active, &.Mui-completed":{color:an.palette.secondary.main}}}}}};var cn={components:{MuiTypography:{styleOverrides:{h1:{[an.breakpoints.up("lg")]:{fontSize:"1.5rem"}},h3:{fontSize:"1.25rem",[an.breakpoints.up("lg")]:{fontSize:"1.125rem"}},h4:{fontSize:"1rem",[an.breakpoints.up("lg")]:{fontSize:"1rem"}},subtitle2:{color:"#6D6E85"}}}}};const dn=i(t(an,{components:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ln.components),on.components),sn.components),cn.components),{MuiToolbar:{styleOverrides:{root:{[an.breakpoints.up("sm")]:{minHeight:"56px"}}}},MuiAppBar:{styleOverrides:{root:{boxShadow:"none",backgroundColor:"#007F9B"}}},MuiButton:{styleOverrides:{root:{borderRadius:an.spacing(2.5),padding:an.spacing(2.5,4),lineHeight:"20px",fontSize:"1rem",textTransform:"none"},outlined:{color:"#262842",backgroundColor:"#FFFFFF !important",border:"1px solid rgba(38, 40, 66, 0.12)"},text:{color:an.palette.secondary.dark}}},MuiDialog:{styleOverrides:{root:{"& .MuiModal-backdrop":{background:"rgba(28, 55, 77, 0.5)",backdropFilter:"blur(2px)"}},paper:{borderRadius:an.spacing(3)},paperWidthXs:{maxWidth:500}}},MuiDialogContent:{styleOverrides:{root:{color:"#6D6E85"}}},MuiDialogActions:{styleOverrides:{root:{background:"#F7F8FC",borderTop:"1px solid rgba(38, 40, 66, 0.08)",padding:an.spacing(3,6)}}},MuiTabs:{styleOverrides:{root:{minHeight:"38px"},indicator:{backgroundColor:an.palette.secondary.main}}},MuiTab:{styleOverrides:{root:{fontSize:14,fontWeight:500,textTransform:"none",padding:"10px 12px",lineHeight:"1.125rem",minHeight:"38px",color:"#8B8C9E","&.Mui-selected":{color:an.palette.secondary.main}}}}})}));export{Er as AlertDialog,Vr as BackButton,nn as ContentLayout,$r as ControlAceEditor,Pr as ControlAutocomplete,wr as ControlCheckbox,pt as ControlDate,ut as ControlDateTime,Nr as ControlDebouncedInput,jr as ControlInput,ct as ControlNumberInput,Ar as ControlQueryAutocomplete,Ir as ControlRadio,kr as ControlSelect,dt as ControlSwitch,mt as ControlTime,Lr as CopyButton,yi as CreateDefinition,fi as CreatePropertiesList,hi as CreatePropertyFormFields,yr as DATE_DEFAULT_FORMAT,Or as DATE_TIME_DEFAULT_FORMAT,Si as DefinitionFiller,wi as DefinitionValueView,It as InfoItem,_r as JsonModalView,Vi as JsonPathPicker,Hr as JsonView,xr as Loader,en as MenuIcon,Qt as MultiplePropertyFiller,Xt as PropertyFiller,fr as PropertyType,ei as PropertyValueField,Cr as RoundingMode,kt as RouteTabs,tn as Sidebar,Tt as SimpleTable,Mi as Status,$t as StepperView,vr as TIME_DEFAULT_FORMAT,Nt as TabPanel,Ot as Table,Ct as TableAction,St as TableActionCell,Ti as ViewPropertiesList,ji as ViewProperty,qr as capitalize,Wr as deepParseJson,Kt as defaultDefinitionArrayValue,Ut as defaultDefinitionObjectValue,Ur as digitsOnly,Xr as floatsOnly,tt as formatDefinitionData,Kr as formatTableRowValue,at as getDemPropertyDateFormat,lt as getEntityStarterValue,zr as getJsonStringValue,ot as getMultiplePropertyFillOptions,st as getSinglePropertyFillOptions,Qr as isDateType,Zr as isExpression,et as isPropertyValueEmpty,it as propertiesArrayToObject,nt as propertiesObjectToArray,Rr as removeArrayItem,Br as safeParseJson,Dr as sortArrayOfObjects,dn as theme,Tr as useDebounce,Sr as useToggle,Fr as validateJson};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type Props = {
2
3
  name: string;
3
4
  label?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type Props = {
2
3
  name: string;
3
4
  label?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type Props = {
2
3
  name: string;
3
4
  format: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import 'ace-builds/src-noconflict/ace';
2
3
  import 'ace-builds/src-noconflict/mode-json';
3
4
  type Props = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type Props = {
2
3
  name: string;
3
4
  label?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { PropertyUnion } from '../../../interfaces';
2
3
  type PropertyItemProps = {
3
4
  property: PropertyUnion;