@dartech/arsenal-ui 0.3.29 → 0.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g opacity="0.6">
3
+ <path 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"/>
4
+ </g>
5
+ </svg>
package/index.js CHANGED
@@ -1 +1 @@
1
- import{createTheme as e,responsiveFontSizes as r,ThemeProvider as t}from"@mui/material/styles";import{jsx as i,jsxs as n,Fragment as a}from"react/jsx-runtime";import l from"@mui/material/Button";import o from"@mui/material/Dialog";import s from"@mui/material/DialogActions";import c from"@mui/material/DialogContent";import d from"@mui/material/DialogContentText";import p from"@mui/material/DialogTitle";import u from"@mui/material/Box";import m from"@mui/material/CircularProgress";import{__rest as g,__awaiter as h}from"tslib";import{useController as b,useWatch as f,useFormContext as y,useFieldArray as v}from"react-hook-form";import O from"@mui/material/TextField";import x,{useRef as C,useEffect as E,useState as T,useCallback as j,useMemo as S,createElement as N,forwardRef as k,createContext as w,useContext as I,memo as M,Suspense as P}from"react";import A from"@mui/material/MenuItem";import $ from"@mui/icons-material/Clear";import{InputAdornment as V,IconButton as F,FormHelperText as L,Box as R,Backdrop as q,styled as D}from"@mui/material";import z from"@mui/material/FormControl";import B from"@mui/material/FormControlLabel";import W from"@mui/material/FormHelperText";import G from"@mui/material/Checkbox";import J from"@mui/material/Radio";import H from"@mui/material/RadioGroup";import _ from"@mui/material/FormLabel";import Y from"@mui/material/Autocomplete";import{useQuery as K}from"@tanstack/react-query";import U from"qs";import X from"@mui/icons-material/FileCopyOutlined";import Q from"@mui/material/Tooltip";import Z from"@mui/material/IconButton";import ee from"@mui/icons-material/ArrowBack";import{useNavigate as re,useLocation as te,Link as ie,useSearchParams as ne,BrowserRouter as ae,Outlet as le}from"react-router-dom";import oe from"react-ace";import se from"@mui/material/Typography";import ce from"@mui/material/Switch";import{DatePicker as de}from"@mui/x-date-pickers/DatePicker";import{format as pe,isMatch as ue,isValid as me,parse as ge}from"date-fns";import{DateTimePicker as he}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as be}from"@mui/x-date-pickers/TimePicker";import fe from"@mui/material/Pagination";import ye from"@mui/material/TablePagination";import{useGridApiContext as ve,useGridSelector as Oe,gridPageSelector as xe,gridPageCountSelector as Ce,gridRowCountSelector as Ee,gridPageSizeSelector as Te,GridColumnMenuContainer as je,GridFilterMenuItem as Se,DataGrid as Ne,GridActionsCellItem as ke}from"@mui/x-data-grid";import{makeStyles as we}from"tss-react/mui";import Ie from"@mui/material/Table";import Me from"@mui/material/TableBody";import Pe from"@mui/material/TableCell";import Ae from"@mui/material/TableContainer";import $e from"@mui/material/TableHead";import Ve from"@mui/material/TableRow";import Fe from"@mui/material/TableSortLabel";import Le from"@mui/material/TableFooter";import Re from"@mui/material/Menu";import qe from"@mui/icons-material/MoreHoriz";import De from"@mui/material/Paper";import ze from"@mui/material/Tab";import Be from"@mui/material/Tabs";import We from"@mui/material/Unstable_Grid2";import Ge from"@mui/material/Accordion";import Je from"@mui/material/AccordionSummary";import He from"@mui/material/AccordionDetails";import _e from"@mui/material/AccordionActions";import Ye from"@mui/icons-material/ExpandMore";import Ke from"@mui/icons-material/Delete";import Ue from"@mui/material/Stepper";import Xe from"@mui/material/Step";import Qe from"@mui/material/StepLabel";import Ze from"@mui/material/StepContent";import er from"@mui/material/StepConnector";import rr from"@mui/material/Chip";import tr from"@mui/icons-material/Add";import ir from"@mui/material/Select";import nr from"@mui/material/InputLabel";import ar from"@mui/icons-material/Close";import lr from"@mui/icons-material/CheckCircle";import or from"classnames";import{toast as sr}from"react-toastify";import cr from"@mui/material/Toolbar";import dr from"@mui/material/Drawer";import pr from"@mui/material/List";import ur from"@mui/material/ListItem";import mr from"@mui/material/ListItemIcon";import gr from"@mui/material/ListItemButton";import hr from"@mui/material/ListSubheader";import br from"@mui/material/Collapse";import fr from"@mui/material/ListItemText";import yr from"@mui/icons-material/ExpandLess";import vr from"@mui/icons-material/NotInterested";import Or from"@mui/icons-material/Fullscreen";var xr;!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"}(xr||(xr={}));const Cr="yyyy-MM-dd",Er="HH:mm:ss",Tr="yyyy-MM-dd'T'HH:mm:ss.SSSXXX";var jr;!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"}(jr||(jr={}));const Sr=({transparent:e,position:r})=>i(u,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:i(m,{})})),Nr=({open:e,title:r,description:t,closeButtonTitle:a="Close",onClose:m,confirmButtonTitle:g="Confirm",confirmButtonDisabled:h=!1,onConfirm:b,children:f,dialogProps:y,loading:v,maxWidth:O="xs"})=>i("div",{children:n(o,Object.assign({open:e,onClose:m,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:O},y,{children:[v&&i(Sr,{}),i(p,Object.assign({id:"alert-dialog-title"},{children:r})),n(c,{children:[t&&i(d,Object.assign({id:"alert-dialog-description"},{children:t})),i(u,Object.assign({maxWidth:"100%",overflow:"hidden"},{children:f}))]}),n(s,{children:[i(l,Object.assign({onClick:m,color:"primary",variant:"contained"},{children:a})),g&&b?i(l,Object.assign({onClick:b,color:"secondary",variant:"contained",autoFocus:!0,disabled:h},{children:g})):null]})]}))}),kr=e=>{var r,{control:t,validate:n,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,textarea:d=!1,hideErrorMessage:p=!1,onChange:u}=e,m=g(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange"]);const{field:{ref:h,onChange:y},fieldState:{error:v}}=b({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:n}}),x=f({control:t,name:a});return i(O,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:h,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:u||y},m,{inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=x?x:""})}))};function wr(e,r){const t=C();E((()=>()=>{t.current&&clearTimeout(t.current)}),[]);return(...i)=>{clearTimeout(t.current),t.current=setTimeout((()=>{e(...i)}),r)}}const Ir=()=>{const[e,r]=T(!1);return{open:e,toggle:()=>{r((e=>!e))},onClose:()=>{r(!1)},onOpen:()=>{r(!0)}}},Mr=e=>{var r,{control:t,validate:n,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,textarea:d=!1,hideErrorMessage:p=!1,onChange:u}=e,m=g(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange"]);const{field:{ref:h,onChange:y},fieldState:{error:v}}=b({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:n}}),x=f({control:t,name:a}),[C,S]=T("");E((()=>{!C&&x&&S(x)}),[C,x]);const N=wr((e=>{y(e)}),200),k=j((e=>{S(e.target.value),N(e.target.value)}),[N]);return i(O,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:h,name:a,label:l,error:!!v,helperText:!p&&(null==v?void 0:v.message),disabled:c,multiline:d,minRows:d?3:1,value:null!=C?C:"",onChange:k},m,{inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=C?C:""})}))},Pr=e=>{var r,{control:t,validate:n,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,hideErrorMessage:d=!1,onChange:p,labelKey:u,valueKey:m,options:h=[]}=e,y=g(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options"]);const{field:{ref:v,onChange:x},fieldState:{error:C}}=b({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:n}}),E=f({control:t,name:a}),T=j((e=>"string"==typeof e?e:m?e[m]:e.value),[m]),S=j((e=>"string"==typeof e?e:u?e[u]:e.label),[u]),N=j((()=>{x(null)}),[x]);return i(O,Object.assign({select:!0,fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:v,name:a,label:l,error:!!C,helperText:!d&&(null==C?void 0:C.message),disabled:c,value:null!=E?E:"",onChange:p||x},y,{inputProps:Object.assign(Object.assign({},null!==(r=null==y?void 0:y.inputProps)&&void 0!==r?r:{}),{value:null!=E?E:""}),InputProps:Object.assign({endAdornment:!o&&E?i(V,Object.assign({position:"end",sx:{mr:2}},{children:i(F,Object.assign({onClick:N,size:"small"},{children:i($,{fontSize:"small"})}))})):null},null==y?void 0:y.InputProps)},{children:h.map(((e,r)=>i(A,Object.assign({value:T(e)},{children:S(e)}),r)))}))},Ar=e=>{var{control:r,validate:t,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,hideErrorMessage:d=!1,onChange:p}=e,u=g(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange"]);const{field:{ref:m,onChange:h},fieldState:{error:y}}=b({name:a,control:r,defaultValue:s}),v=f({control:r,name:a}),O=S((()=>{if("boolean"==typeof v)return v;if("string"==typeof v){if("false"===v)return h(!1),!1;if("true"===v)return h(!0),!0}return!1}),[v,h]);return n(z,Object.assign({error:!!y,component:"fieldset",variant:"standard",disabled:c},{children:[i(B,{control:i(G,Object.assign({checked:O,onChange:p||h,name:a,inputRef:m,disabled:c},u)),label:l}),!d&&(null==y?void 0:y.message)&&i(W,{children:y.message})]}))},$r=({name:e,label:r,values:t=[],control:a,required:l,defaultValue:o,disabled:s,hideErrorMessage:c,labelKey:d,valueKey:p,validate:u,onChange:m})=>{const{field:{ref:g,onChange:h},fieldState:{error:y}}=b({name:e,control:a,defaultValue:o,rules:{required:l&&"Please, fill this field",validate:u}}),v=f({control:a,name:e}),O=j((e=>"string"==typeof e?e:p?e[p]:e.value),[p]),x=j((e=>"string"==typeof e?e:d?e[d]:e.label),[d]);return n(z,Object.assign({disabled:s,error:!!y},{children:[i(_,Object.assign({id:"radio-buttons-group"},{children:r})),i(H,Object.assign({"aria-labelledby":"radio-buttons-group",ref:g,name:e,value:v,onChange:m||h},{children:t.map((e=>i(B,{value:O(e),control:i(J,{}),label:x(e)})))})),!c&&(null==y?void 0:y.message)&&i(L,{children:y.message})]}))};var Vr=({valueKey:e,labelKey:r})=>{const t=j(((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=j((e=>e?"string"==typeof e?e:r&&e[r]?e[r]+"":e.label+""||e.name+""||e.value+""||e.code+""||"--no label--":""),[r]),n=j(((e,r)=>N(R,Object.assign({},e,{component:"li",key:e.id}),i(r))),[i]);return{isOptionEqualToValue:t,getOptionLabel:i,renderOption:n}};const Fr=e=>{var{control:r,validate:t,name:n="",label:a="",required:l=!1,defaultValue:o="",disabled:s=!1,hideErrorMessage:c=!1,onChange:d,labelKey:p,valueKey:u,options:m=[],multiple:h,textFieldProps:y={},disableCloseOnSelect:v}=e,x=g(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options","multiple","textFieldProps","disableCloseOnSelect"]);const{field:{ref:C,onChange:E},fieldState:{error:T}}=b({name:n,control:r,defaultValue:o,rules:{required:l&&"Please, fill this field",validate:t}}),j=f({control:r,name:n,defaultValue:h?[]:null}),{getOptionLabel:S,isOptionEqualToValue:N,renderOption:k}=Vr({valueKey:u,labelKey:p});return i(Y,Object.assign({fullWidth:!0,disablePortal:!0,size:"small",readOnly:s,options:m,multiple:h,getOptionLabel:S,isOptionEqualToValue:N,disableCloseOnSelect:v||h,filterSelectedOptions:h,value:j,onChange:d||((e,r)=>{E(r)}),renderOption:k,renderInput:e=>i(O,Object.assign({},e,{variant:"outlined",name:n,label:a,error:!!T,inputRef:C,helperText:!c&&(null==T?void 0:T.message)},y))},x))};function Lr(e){var{name:r,label:t,control:a,required:l=!1,searchBy:o,labelKey:s,multiple:c=!1,disabled:d,valueKey:p,sortBy:u="",hideErrorMessage:h,disableCloseOnSelect:y,textFieldProps:v,onChange:C,queryFunction:S,validate:N,itemQueryFunction:k}=e,w=g(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}}=b({control:a,name:r,rules:{required:l&&"Please, fill this field",validate:N}}),$=f({control:a,name:r,defaultValue:c?[]:null}),{getOptionLabel:V,isOptionEqualToValue:F,renderOption:L}=Vr({valueKey:p,labelKey:s}),[R,q]=T(!1),[D,z]=T(""),[B,W]=T(""),[G,J]=T(0),[H,_]=T(0),[X,Q]=T([]),Z=wr((e=>{_(0),W(e),Q([])}),500),ee=j(((e,r)=>{z(r),Z(r)}),[Z]),re=j(((e,r)=>{M(r),C&&C(e,r)}),[M,C]);E((()=>{if(!A&&$&&k){let e=$;"object"==typeof $&&p in $&&(e=$[p]),k(e).then((e=>{M(e),z(e[s])})).catch()}}),[$,A,p,s,k,M]);const te=j((e=>{const r=e.currentTarget;r.scrollHeight-r.scrollTop-r.clientHeight<=1&&X.length<G&&_((e=>e+1))}),[G,X]),{data:ie,isFetching:ne}=K(["options",H,B],(()=>{const e=U.parse(Object.assign({page:`${H}`,size:"20",sort:u},B?{[o]:B}:{}),{ignoreQueryPrefix:!0});return S(e)}));return E((()=>{ie&&(Q((e=>[...e,...ie.collection])),J(ie.totalItems))}),[ie]),i(Y,Object.assign({fullWidth:!0,disablePortal:!0,size:"small",readOnly:d,options:X,multiple:c,getOptionLabel:V,isOptionEqualToValue:F,disableCloseOnSelect:y||c,filterSelectedOptions:c,inputValue:D,value:$,onChange:re,loading:ne,clearOnBlur:!1,open:R,filterOptions:e=>e,onOpen:()=>{q(!0)},onClose:()=>{q(!1),W("")},onInputChange:ee,ListboxProps:{onScroll:te},renderOption:L,renderInput:e=>i(O,Object.assign({},e,{label:t,variant:"outlined",error:!!P,inputRef:I,helperText:!h&&(null==P?void 0:P.message),InputProps:Object.assign(Object.assign({},e.InputProps),{endAdornment:n(x.Fragment,{children:[ne?i(m,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})})},v))},w))}const Rr=({copyText:e,helpText:r="Copy"})=>{const[t,n]=T(r);return t?i(Q,Object.assign({title:t,placement:"top"},{children:i(Z,Object.assign({onClick:()=>{navigator.clipboard.writeText(e),n("Copied!"),setTimeout((()=>{n(r)}),1e3)}},{children:i(X,{fontSize:"small"})}))})):null},qr=({text:e,buttonProps:r={}})=>{const t=re(),{state:n}=te(),a=S((()=>null==n?void 0:n.from),[n]),o=j((()=>{t(a||-1)}),[t,a]);return i(u,Object.assign({mr:2},{children:e?i(l,Object.assign({color:"inherit",onClick:a?null:o,component:ie,to:null!=a?a:""},r,{children:e})):i(Z,Object.assign({onClick:o},{children:i(ee,{})}))}))},Dr=k(((e,r)=>{var{control:t,name:l,mode:o="json",label:s,width:c="100%",height:d="200px",theme:p="monokai",readOnly:m,required:h=!1,validateJson:v=!1,fontSize:O=16,validate:x=!0,parseValue:C}=e,E=g(e,["control","name","mode","label","width","height","theme","readOnly","required","validateJson","fontSize","validate","parseValue"]);const{setError:T,clearErrors:j}=y(),{field:{onChange:S},fieldState:{error:N}}=b({control:t,name:l}),k=f({control:t,name:l});return n(u,Object.assign({display:"flex",flexDirection:"column",width:"100%"},{children:[i(u,{children:s&&i(se,Object.assign({variant:"subtitle1",display:"inline",style:{marginRight:10}},{children:s}))}),n(a,{children:[i(oe,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},style:{lineHeight:1.4,zIndex:0,isolation:"isolate"},readOnly:m,value:"json"===o&&"string"!=typeof k?null===k?"":JSON.stringify(k):k,onChange:e=>{if(!e&&h?T(l,{message:"Required field"}):j(l),v)try{JSON.parse(e),j(l)}catch(e){T(l,{message:"Invalid JSON"})}if(C)try{const r=JSON.parse(e);console.log("parsed val:",r),S(r)}catch(r){S(e)}else S(e)},mode:o,onLoad:e=>{x&&v||e.getSession().setUseWorker(!1)}},E)),N&&i(W,Object.assign({error:!0},{children:N.message}))]})]}))})),zr=(e,r)=>{const t=[...e];return t.splice(r,1),t},Br=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};function Wr(e){return e.replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}const Gr=(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},Jr=e=>{if(!e)return"";if("string"!=typeof e)try{return JSON.stringify(e,null,"\t")}catch(e){return"Failed to stringify JSON"}return e},Hr=e=>{try{return JSON.parse(e)}catch(e){return null}},_r=e=>{try{const r=JSON.parse(e);return Object.keys(r).forEach((e=>{r[e]=_r(r[e])})),r}catch(r){return e}},Yr=({value:e,height:r="200px"})=>{const t=S((()=>{if("string"==typeof e)return e;if("object"==typeof e)try{return JSON.stringify(e,null,"\t")}catch(e){return"Failed to parse JSON"}return null}),[e]);return i(oe,{readOnly:!0,value:t,mode:"json",width:"100%",height:r,fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})},Kr=({open:e,onClose:r,value:t})=>n(o,Object.assign({disableEscapeKeyDown:!0,open:e,onClose:r,fullWidth:!0,maxWidth:"md",style:{width:800,left:"30%"}},{children:[i(c,{children:i(oe,{readOnly:!0,value:t,mode:"json",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})}),n(s,{children:[i(Rr,{copyText:t}),i(l,Object.assign({onClick:r,variant:"contained",color:"secondary"},{children:"Close"}))]})]}));var Ur=({value:e,copyButton:r=!1,textField:t=!1})=>{const{open:a,onOpen:l,onClose:o}=Ir();return n(u,Object.assign({width:"100%"},{children:[n(u,Object.assign({display:"flex",alignItems:"center",justifyContent:"flex-end",pt:1,mb:2},{children:[r&&i(Rr,{copyText:Jr(e)}),i(Q,Object.assign({title:"Open",placement:"top"},{children:i(Z,Object.assign({size:"small",onClick:()=>l()},{children:i(Or,{fontSize:"small"})}))}))]})),t?i(u,Object.assign({overflow:"hidden",whiteSpace:"nowrap"},{children:"object"==typeof e?JSON.stringify(e):e})):i(Yr,{value:e}),i(Kr,{open:a,value:Jr(e),onClose:o})]}))};const Xr=({value:e,type:r,copyText:t,status:a})=>{switch(r){case"id":return n(u,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[i(u,Object.assign({mr:"auto"},{children:`${e.slice(0,6)}...${e.slice(-6)}`})),i(Rr,{copyText:t||e})]}));case"JSON_copy":return i(Ur,{value:e,copyButton:!0});case"JSON":return i(Ur,{value:e});case"JSON_text":return i(Ur,{value:e,textField:!0});case"copy":return n(u,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[i(u,Object.assign({mr:"auto"},{children:e})),i(Rr,{copyText:t||e})]}));case"boolean":return e?i(lr,{color:"primary",fontSize:"small"}):i(vr,{fontSize:"small"});case"date":return e?n("div",{children:[i("div",{children:pe(new Date(e),"dd.MM.yyyy")}),i("div",{children:pe(new Date(e),"HH:mm:ss")})]}):"";case"status":return i(Mi,{text:e,status:a});case"array":return i(u,{children:e.map(((e,r)=>i(u,{children:e},r)))});default:return i("div",{children:e})}},Qr=new RegExp("^[-+]?[0-9]+$"),Zr=new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/),et=e=>"string"==typeof e&&e.includes("$("),rt=e=>e===xr.DATE||e===xr.DATE_TIME||e===xr.TIME,tt=e=>!e&&0!==e&&!1!==e,it=(e,r,t)=>{if(null==r&&e!==xr.BOOLEAN)return null;let i=r;switch(e){case xr.BOOLEAN:i=!!r;break;case xr.INTEGER:case xr.BIG_INTEGER:case xr.BIG_DECIMAL:case xr.FLOAT:case xr.LONG:case xr.DOUBLE:i=Number(r);break;case xr.DATE:case xr.DATE_TIME:case xr.TIME:i=pe(new Date(r.toString()),t.formatText);break;case xr.JSON:case xr.ANY:try{"string"!=typeof r&&(i=JSON.stringify(r)),i=JSON.parse(i)}catch(e){console.log(e),i=null}break;case xr.ENTITY:i=nt(t.properties,r)}return i},nt=(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=>it(n,r,{formatText:e.format,properties:e.properties}))):t[i]=it(n,a,{formatText:e.format,properties:e.properties})})),t}return null},at=(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=>it(e.propertyType,r,{formatText:e.format,properties:e.properties}))):t[n]=it(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===xr.BIG_DECIMAL&&(u.precisionScale=e.precisionScale,u.roundingMode=e.roundingMode),p!==xr.DATE&&p!==xr.TIME&&p!==xr.DATE_TIME||(u.format=e.format),p===xr.STRING&&(u.restrictedValues=e.restrictedValues),p===xr.ENTITY_REFERENCE&&(u.definitionCode=e.definitionCode,u.definitionVersion=e.definitionVersion,u.labelPropertyCode=e.labelPropertyCode,u.valuePropertyCode=e.valuePropertyCode),p===xr.ENTITY&&(u.properties=at(e.properties,r)),t[i]=u})),t};function lt(e,r){return Object.keys(e).map((t=>{const i=Object.assign(Object.assign({key:t},e[t]),r||{});if(i.propertyType===xr.ENTITY&&(i.properties=lt(i.properties,r)),i.propertyType===xr.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)=>Gr(e,r,"sortOrder")))}const ot=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return pe(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},st=e=>{let r=[];return r=Array.isArray(e.properties)?e.properties:lt(e.properties),r.reduce(((e,r)=>{const t=JSON.parse(JSON.stringify(e));return r.propertyType===xr.ENTITY?t[r.key]=st(r):t[r.key]=r.propertyType,t}),{})},ct=({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===xr.JSON||e===xr.ENTITY||e===xr.ANY?i.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):i.push({value:"expression",label:"Expression",sortOrder:3})),e!==xr.JSON&&e!==xr.ANY&&e!==xr.ENTITY||i.push({value:"json_valid",label:"JSON editor",sortOrder:2}),i=i.sort(((e,r)=>Gr(e,r,"sortOrder"))),i},dt=({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===xr.JSON||e===xr.ENTITY||e===xr.ANY?i.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):i.push({value:"expression",label:"Expression",sortOrder:3})),e){case xr.STRING:i[0].label="Text input";break;case xr.INTEGER:case xr.BIG_INTEGER:case xr.BIG_DECIMAL:case xr.FLOAT:case xr.LONG:case xr.DOUBLE:i[0].label="Number input";break;case xr.BOOLEAN:i[0].label="Switch";break;case xr.ENTITY_REFERENCE:i[0].label="Entity reference fields";break;case xr.JSON:i[0].label="JSON editor";break;case xr.DATE:i[0].label="Date picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case xr.DATE_TIME:i[0].label="Date & Time picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case xr.TIME:i[0].label="Time picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case xr.ANY:i[0].label="Textarea"}return i=i.sort(((e,r)=>Gr(e,r,"sortOrder"))),i},pt=e=>{var r,{control:t,validate:n,name:a="",label:l="",required:o=!1,defaultValue:s,disabled:c=!1,hideErrorMessage:d=!1,onChange:p,decimal:u=!1}=e,m=g(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","decimal"]);const{field:{ref:h,onChange:y},fieldState:{error:v}}=b({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:e=>u&&!Zr.test(e)?"Not valid number":!(!u&&!Qr.test(e))||"Not valid integer"}}),x=f({control:t,name:a});return i(O,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:h,name:a,label:l,error:!!v,helperText:!d&&(null==v?void 0:v.message),disabled:c,value:null!=x?x:""},m,{onChange:e=>{const r=e.nativeEvent.data||e.target.value;(!isNaN(r)||u&&"."===r||"-"===r||"+"===r)&&(p?p(e):y(e.target.value))},inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=x?x:""})}))},ut=e=>{var{control:r,name:t,label:n}=e,a=g(e,["control","name","label"]);const{field:{ref:l,onChange:o}}=b({control:r,name:t}),s=f({control:r,name:t}),c=S((()=>{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]);E((()=>{null===s&&o(!1)}),[s,o]);return i(B,{label:n,name:t,control:i(ce,Object.assign({color:"primary",size:"small",inputRef:l,onChange:e=>{const{checked:r}=e.target;o(r)},checked:c},a))})},mt=({control:e,name:r,required:t,label:n,format:a=Cr,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=b({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!ue(e,a)||"Incorrect date format"}}),d=f({control:e,name:r});return i(de,{label:n,inputRef:s,inputFormat:a,value:d||null,onChange:e=>{o(me(e)?pe(e,a):e)},renderInput:e=>i(O,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},gt=({control:e,name:r,required:t,label:n,format:a=Tr,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=b({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!ue(e,a)||"Incorrect date format"}}),d=f({control:e,name:r});return i(he,{mask:"",ampm:!1,inputRef:s,label:n,value:d||null,inputFormat:a,onChange:e=>{o(me(e)?pe(e,a):e)},renderInput:e=>i(O,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},ht=({control:e,name:r,required:t,label:n,format:a=Er,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=b({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!ue(e,a)||"Incorrect date format"}}),d=f({control:e,name:r}),[p,u]=T(null);return E((()=>{if(d&&a){let e=ge(d,a,new Date);me(e)||(e=ge(d,"HH:mm:ss.SSS",new Date)),u(e)}}),[d,a]),i(be,{mask:"",inputRef:s,label:n,ampm:!1,value:p,inputFormat:a,onChange:e=>{u(e),o(me(e)?pe(e,a):e)},renderInput:e=>i(O,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})};var bt=()=>{const e=ve(),r=Oe(e,xe),t=Oe(e,Ce),a=Oe(e,Ee),l=Oe(e,Te),o=r=>e.current.setPage(r);return n(u,Object.assign({px:2,display:"flex",alignItems:"center"},{children:[i(ye,{component:"div",page:r,count:a,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}),i(fe,{count:t,page:r+1,onChange:(e,r)=>o(r-1)})]}))};var ft=e=>{var{hideMenu:r,currentColumn:t,onUnsort:n}=e,a=g(e,["hideMenu","currentColumn","onUnsort"]);return i(je,Object.assign({hideMenu:r,currentColumn:t},a,{children:i(Se,{onClick:r,column:t})}))};var yt=({mode:e})=>{const[r,t]=ne(),i=+r.get("page")||0,n=+r.get("size")||10;return E((()=>{"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 vt=()=>{const[e,r]=ne(),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 Ot=e=>{const[r,t]=T(10);E((()=>{t(e)}),[e]);return{pageSize:r,handlePageSizeChange:e=>t(e)}},xt=we()({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 Ct=({columns:e,rows:r,rowCount:t,loading:n,disableMargin:a,mode:l="server",initialPageSize:o=10,pagination:s=!0,onCellClick:c})=>{const{classes:d}=xt(),{page:p,size:m,onPageChange:g,onSizeChange:h}=yt({mode:l}),{onColumnHeaderClick:b,getSortedColumns:f}=vt(),{pageSize:y,handlePageSizeChange:v}=Ot(o),O={sortingMode:l,paginationMode:l,pageSize:"server"===l?m:s?y:t,onPageSizeChange:"server"===l?h:v,components:{Pagination:bt}};return"server"===l&&(O.sortModel=[],O.onColumnHeaderClick=b,O.page=p,O.onPageChange=g,O.components.ColumnMenu=ft),i(u,Object.assign({mt:a?0:2},{children:i(Ne,Object.assign({autoHeight:!0,hideFooterPagination:!s,hideFooter:!s,disableSelectionOnClick:!0,showColumnRightBorder:!0,showCellRightBorder:!0,className:d.root,loading:n,rows:r,columns:f(e),rowCount:t,rowsPerPageOptions:[10,20,50,100],onCellClick:c},O))}))},Et=({icon:e,label:r,showInMenu:t,onClick:n,location:a})=>a?i(Z,Object.assign({component:ie,to:a,size:"small"},{children:i(Q,Object.assign({title:r,arrow:!0},{children:x.cloneElement(e,{fontSize:"small"})}))})):i(ke,{nonce:"",onResize:void 0,onResizeCapture:void 0,icon:i(Q,Object.assign({title:r,arrow:!0},{children:e})),onClick:n,label:r,showInMenu:t});var Tt=()=>{const[e,r]=ne(),t=S((()=>{var r;return null!==(r=e.get("page"))&&void 0!==r?r:0}),[e]),i=S((()=>{var r;return null!==(r=e.get("size"))&&void 0!==r?r:10}),[e]),n=j((e=>{r((r=>(r.set("page",`${e}`),r)))}),[r]),a=j((e=>{r((r=>(r.set("size",`${e}`),r)))}),[r]);return E((()=>{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 jt=()=>{const[e,r]=ne(),t=S((()=>e.getAll("sort").map((e=>e.split(",")))),[e]),i=j((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=j((e=>{const r=t.find((([r,t])=>r===e));return!!r&&r[1]}),[t]);return{sortParams:t,onSortChanged:i,getColumnSorting:n}};function St({columns:e=[],rows:r=[],totalCount:t,children:a,pagination:l=!0,loading:o=!1,onRowClick:s,verticalAlign:c="middle"},d){const{page:p,size:u,onPageChange:m,onSizeChange:g}=Tt(),{onSortChanged:h,getColumnSorting:b}=jt();return n(Ae,Object.assign({sx:{position:"relative",overflow:"visible"}},{children:[i(q,Object.assign({open:o,sx:{position:"absolute",top:0,left:0}},{children:i(Sr,{})})),n(Ie,Object.assign({ref:d},{children:[i($e,{children:i(Ve,{children:e.map(((e,r)=>{const t=!!e.sortKey&&b(e.sortKey);return i(Pe,Object.assign({align:e.align?e.align:"left",sortDirection:t,sx:{width:e.width?`${e.width}%`:"unset"}},{children:i(Fe,Object.assign({active:!!t,hideSortIcon:!e.sortKey,direction:t||"asc",onClick:()=>e.sortKey?h(e.sortKey):{}},{children:e.label}))}),r)}))})}),i(Me,{children:r.map(((r,t)=>i(Ve,Object.assign({hover:!0,onClick:s?()=>s(r):r.onClick,sx:{verticalAlign:c}},{children:e.map(((e,n)=>i(Pe,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]}),n)))}),t)))}),l||a?i(Le,{children:n(Ve,{children:[a&&i(Pe,Object.assign({colSpan:e.length,sx:{background:"#F0F0F7",px:4,py:3}},{children:a})),l&&r.length&&i(ye,{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 Nt=k(St),kt=({actionsList:e})=>{const[r,t]=T(null),a=Boolean(r),l=()=>{t(null)};return n("div",{children:[i(Z,Object.assign({"aria-label":"more",id:"more-button","aria-controls":a?"more-menu":void 0,"aria-expanded":a?"true":void 0,"aria-haspopup":"true",onClick:e=>{e.stopPropagation(),t(e.currentTarget)}},{children:i(qe,{})})),i(Re,Object.assign({id:"more-menu",MenuListProps:{"aria-labelledby":"more-button"},anchorEl:r,open:a,onClose:e=>{e.stopPropagation(),l()},PaperProps:{style:{minWidth:"127px"}}},{children:e.map((e=>i(A,Object.assign({onClick:r=>{r.stopPropagation(),e.onClick&&e.onClick(),l()}},{children:e.title}),e.title)))}))]})},wt=e=>{const{children:r,value:t,index:n}=e,a=g(e,["children","value","index"]);return i("div",Object.assign({role:"tabpanel",hidden:t!==n,id:`simple-tabpanel-${n}`,"aria-labelledby":`simple-tab-${n}`},a,{children:t===n?r:null}))},It=e=>{var r;const{tabs:t}=e,a=re(),l=te(),o=S((()=>new URLSearchParams(l.search)),[l.search]),s=o.get("tab");return n(u,{children:[i(De,{children:i(Be,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),a({pathname:l.pathname,search:o.toString()},{replace:!0})}},{children:t.map((e=>i(ze,{value:e.name,label:e.label},e.name)))}))}),i(u,Object.assign({mt:2},{children:t.map((e=>{var r;return i(wt,Object.assign({value:s||(null===(r=t[0])||void 0===r?void 0:r.name),index:e.name},{children:e.component}),e.name)}))}))]})};var Mt=we()((()=>({container:{paddingBottom:"8px"},title:{fontSize:"14px",fontWeight:600,color:"#536DFE"},text:{fontSize:"18px",wordWrap:"break-word"}})));const Pt=({title:e,text:r,json:t})=>{const{classes:a}=Mt();return n("div",Object.assign({className:a.container},{children:[i("div",Object.assign({className:a.title},{children:e})),r&&i("div",Object.assign({className:a.text},{children:r})),t&&i(oe,{readOnly:!0,value:t,mode:"json",height:"300px",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})]}))},At=Object.values(jr).sort(((e,r)=>e.localeCompare(r)));var $t=({propertyFieldName:e})=>{const{control:r}=y();return n(a,{children:[i(We,{children:i(pt,{required:!0,control:r,defaultValue:2,name:`${e}.precisionScale`,label:"Precision Scale"})}),i(We,{children:i(Pr,{required:!0,control:r,name:`${e}.roundingMode`,label:"Rounding Mode",defaultValue:jr.HALF_UP,options:At})})]})};var Vt=({propertyFieldName:e,defaultValue:r=""})=>{const{control:t}=y();return i(We,{children:i(kr,{required:!0,control:t,defaultValue:r,name:`${e}.format`,label:"Format"})})};const Ft=we()((()=>({content:{marginLeft:"4px"},connector:{marginLeft:"4px"},stepper:{padding:"12px"},label:{display:"flex",alignItems:"flex-start"}}))),Lt=()=>i("div",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#536DFE",marginTop:"5px"}}),Rt=({data:e})=>{const{classes:r}=Ft();return n(Ue,Object.assign({nonLinear:!0,orientation:"vertical",className:r.stepper,connector:i(er,{className:r.connector})},{children:[e.filter(Boolean).map(((e,t)=>n(Xe,Object.assign({expanded:!0},{children:[i(Qe,Object.assign({className:r.label,StepIconComponent:Lt,StepIconProps:{icon:"",completed:!1,active:!0}},{children:e.label})),i(Ze,Object.assign({className:r.content},{children:e.content}))]}),t))),i(Xe,{})]}))},qt=({properties:e=[]})=>{const r=S((()=>e?e.map((e=>{const r="string"==typeof e.propertyType?e.propertyType:e.propertyType.value;return{label:n(u,Object.assign({display:"flex",flexDirection:"column"},{children:[n("b",{children:[e.name,e.isRequired?"*":""]}),n("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," | ",r]})]})),content:"ENTITY"===e.propertyType&&i(qt,{properties:e.properties})}})):[]),[e]);return i(Rt,{data:r})};var Dt=qt;const zt={key:"",propertyType:"",name:"",defaultValue:"",isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0};var Bt=({parentPropertyFieldName:e,entityDefinition:r=!1,globalParameter:t=!1})=>{const{control:d,setValue:u,getValues:m,trigger:g}=y(),b=f({control:d,name:`${e}.properties`,defaultValue:m(`${e}.properties`)||[]}),v=f({control:d,name:`${e}.name`}),O=Ir(),[x,C]=T(0),E=j((()=>{if(b){const r=b.length;u(`${e}.properties.${r}`,zt),C(r)}else u(`${e}.properties`,[zt])}),[b,e,u]),S=()=>h(void 0,void 0,void 0,(function*(){(yield g(`${e}.properties`))&&O.onClose()}));return n(a,{children:[i(We,{children:i(se,Object.assign({variant:"h6"},{children:"Properties"}))}),i(We,{children:i(Dt,{properties:b})}),i(We,{children:i(l,Object.assign({variant:"contained",color:"primary",onClick:O.onOpen},{children:"Edit properties"}))}),n(o,Object.assign({disableEscapeKeyDown:!0,open:O.open,onClose:S,fullWidth:!0,maxWidth:"md"},{children:[n(p,{children:[v||"Entity"," Properties"]}),i(c,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:n(We,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[n(We,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9"}},{children:[i(Ue,Object.assign({nonLinear:!0,activeStep:x,orientation:"vertical",style:{paddingLeft:"4px"}},{children:b.map(((e,r)=>n(Xe,Object.assign({onClick:()=>(e=>C(e))(r),style:{cursor:"pointer"}},{children:[i(Qe,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:e.name||"(no name)"})),i(Ze,{})]}),r)))})),i(l,Object.assign({variant:"contained",size:"small",color:"primary",onClick:E},{children:"Add property"}))]})),i(We,Object.assign({container:!0,wrap:"nowrap",direction:"column",xs:9,spacing:2,style:{height:"100%",overflowY:"auto"}},{children:i(fi,{hideAddButton:!0,parentFieldName:e,focusOnIndex:x,entityDefinition:r,globalParameter:t})}))]}))})),i(s,{children:i(l,Object.assign({variant:"contained",color:"primary",onClick:S},{children:"Ok"}))})]}))]})};var Wt=({propertyFieldName:e})=>{const{control:r}=y();return n(a,{children:[i(We,{children:i(kr,{required:!0,control:r,name:`${e}.definitionCode`,label:"Definition Code"})}),i(We,{children:i(kr,{required:!0,control:r,name:`${e}.definitionVersion`,label:"Definition Version"})}),i(We,{children:i(kr,{required:!0,control:r,name:`${e}.labelPropertyCode`,label:"Label Property Code"})}),i(We,{children:i(kr,{required:!0,control:r,name:`${e}.valuePropertyCode`,label:"Value Property Code"})})]})};var Gt=({propertyFieldName:e})=>{const r=S((()=>`${e}.restrictedValues`),[e]),{control:t,setValue:l,getValues:o}=y(),s=f({control:t,name:r,defaultValue:o(`${e}.restrictedValues`)||[]}),[c,d]=T(""),[p,m]=T(""),g=j((e=>{l(r,zr(s,e))}),[s,r,l]),h=()=>{c&&(l(r,[...s,c]),d(""))};return n(a,{children:[i(We,{children:i(se,Object.assign({variant:"h6"},{children:"Restricted Values"}))}),!!(null==s?void 0:s.length)&&i(We,{children:i(u,Object.assign({display:"flex",flexWrap:"wrap"},{children:s.map(((e,r)=>i(rr,{sx:{mr:1},variant:"outlined",label:e,onDelete:()=>g(r)},r)))}))}),i(We,{children:i(O,{fullWidth:!0,variant:"outlined",size:"small",label:"Add restricted value",value:c,onChange:e=>{const{value:r}=e.target;d(r),s.includes(r)?m("This value already exists"):m("")},error:!!p,helperText:p,name:"restrictedValues",inputProps:{onKeyDown:e=>{"Enter"===e.key&&h()}},InputProps:{endAdornment:i(Z,Object.assign({size:"small",onClick:h,disabled:!!p},{children:i(tr,{})}))}})})]})};const Jt=({propertyType:e,propertyFieldName:r,entityDefinition:t=!1,globalParameter:n=!1})=>{switch(e){case xr.STRING:return i(Gt,{propertyFieldName:r});case xr.BIG_DECIMAL:return i($t,{propertyFieldName:r});case xr.DATE:return i(Vt,{propertyFieldName:r,defaultValue:Cr});case xr.TIME:return i(Vt,{propertyFieldName:r,defaultValue:Er});case xr.DATE_TIME:return i(Vt,{propertyFieldName:r,defaultValue:Tr});case xr.ENTITY_REFERENCE:return i(Wt,{propertyFieldName:r});case xr.ENTITY:return i(Bt,{parentPropertyFieldName:r,globalParameter:n,entityDefinition:t});default:return null}};var Ht=({validate:e=!1,name:r,inputRef:t})=>{const{control:n,setValue:a,setError:l,clearErrors:o}=y(),s=f({control:n,name:r});return i(oe,{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},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 _t=({name:e,label:r,required:t,restrictedValues:a})=>{const{control:l}=y(),{field:{onChange:o,ref:s},fieldState:{error:c}}=b({control:l,name:e,rules:{required:t&&(Array.isArray(a)&&a.length?"Please, select a value":"Please, fill this field")}}),d=f({control:l,name:e});return Array.isArray(a)&&a.length?n(z,Object.assign({fullWidth:!0,size:"small",variant:"outlined",error:!!c},{children:[i(nr,Object.assign({htmlFor:"type-select"},{children:r})),i(ir,Object.assign({labelId:"type-select",label:r,value:d||"",onChange:o,ref:s},{children:a.map((e=>i(A,Object.assign({value:e},{children:e}),e)))}))]})):i(kr,{hideErrorMessage:!0,required:t,control:l,name:e,label:r})};const Yt=({property:e,name:r,label:t,useExpression:n,inputRef:a})=>{const{control:l}=y();switch(S((()=>"string"==typeof e.propertyType?e.propertyType:e.propertyType.value),[e])){case xr.BIG_DECIMAL:case xr.FLOAT:case xr.DOUBLE:return i(pt,{decimal:!0,required:!0,hideErrorMessage:!0,control:l,name:r,label:t});case xr.INTEGER:case xr.BIG_INTEGER:case xr.LONG:return i(pt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t});case xr.BOOLEAN:return i(ut,{control:l,name:r});case xr.DATE:return i(mt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case xr.TIME:return i(ht,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case xr.DATE_TIME:return i(gt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case xr.JSON:return i(Ht,{validate:!0,name:r,inputRef:a});case xr.STRING:return i(_t,{required:!0,name:r,label:t,restrictedValues:e.restrictedValues});case xr.ENTITY_REFERENCE:return i(kr,{required:!0,hideErrorMessage:!0,name:r,label:t,control:l});case xr.ANY:return i(Ht,{name:r,inputRef:a});case xr.ENTITY:return i(Si,{properties:e.properties,dataFieldName:r,useExpression:n});default:return i("div",{children:"No widget"})}};var Kt=({value:e,property:r,label:t,isDirty:i,required:n=!1,useExpression:a=!1,multipleOptions:l=!1})=>{const o=S((()=>t?`${t} (value)`:`${r.name} (value)`),[t,r]),s=S((()=>t?`${t} (widget)`:`${r.name} (widget)`),[t,r]),c=S((()=>"string"==typeof r.propertyType?r.propertyType:r.propertyType.value),[r]),[d,p]=T(null),u=S((()=>l?ct({propertyType:c,required:n,useExpression:a}):dt({propertyType:c,required:n,useExpression:a})),[a,n,c,l]);return E((()=>{d?i||(et(e)&&"expression"!==d?p("expression"):null==e||et(e)||"widget"===d||p("widget")):tt(e)&&(null==u?void 0:u.length)?p(u[0].value):a&&et(e)?p("expression"):p("widget")}),[e,d,u,a,i]),{propertyType:c,valueLabel:o,fillOptionLabel:s,fillOption:d,fillOptions:u,setFillOption:p}};var Ut=we()((()=>({inputLabel:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"}})));const Xt=({property:e,name:r,useExpression:t,label:a,required:l,title:o})=>{const{control:s,clearErrors:c,register:d}=y(),{field:{ref:p,onChange:m},fieldState:{error:g,isDirty:h}}=b({name:r}),v=f({control:s,name:r}),{propertyType:O,valueLabel:x,fillOptionLabel:C,fillOption:T,fillOptions:j,setFillOption:S}=Kt({value:v,property:e,isDirty:h,label:a,required:l,useExpression:t});E((()=>{void 0===v&&m(null)}),[v,m]);const{classes:N}=Ut();return n(We,Object.assign({xs:12},{children:[o&&i(u,Object.assign({mb:2},{children:i(se,Object.assign({variant:"h6"},{children:o}))})),j?i(u,Object.assign({mb:2},{children:n(z,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(nr,Object.assign({htmlFor:"type-select",className:N.inputLabel},{children:C})),i(ir,Object.assign({labelId:"type-select",label:C,value:T||"",onChange:e=>{const t=e.target.value;"null"===t?d(r,{value:null}):"widget"===t?m(null):"expression"!==t&&"string"!==t||m(""),S(t),c(r)}},{children:j.map((e=>i(A,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===T&&(O===xr.JSON||O===xr.ENTITY||O===xr.ANY?i(Ht,{name:r,inputRef:p}):i(kr,{control:s,name:r,label:x,required:!0,hideErrorMessage:!0})),"string"===T&&i(kr,{control:s,name:r,label:x,required:!0,hideErrorMessage:!0}),"json_notvalid"===T&&i(Ht,{name:r,inputRef:p}),"widget"===T&&i(Yt,{property:e,name:r,useExpression:t,label:x,inputRef:p,required:l}),g&&i(se,Object.assign({color:"secondary"},{children:g.message}))]}))};var Qt=({name:e,property:r,useExpression:t,required:a,label:o})=>{const{control:s,setValue:c,clearErrors:d}=y();b({control:s,name:e,rules:{validate:e=>!(!e||Array.isArray(e)&&!e.length)||"Please, fill array"}});const p=f({control:s,name:e}),m=j((()=>{p&&Array.isArray(p)?c(`${e}.${p.length}`,null):c(e,[null]),d(e)}),[e,p,c,d]),g=j((r=>{c(e,zr(p,r))}),[e,p,c]);return n(We,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[p&&Array.isArray(p)?p.map(((l,s)=>i(We,Object.assign({xs:12},{children:n(u,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[i(Xt,{required:a,property:r,useExpression:t,name:`${e}.${s}`,label:`${o||r.name} (${s+1})`}),i(u,Object.assign({mt:"8px",ml:"4px"},{children:i(Z,Object.assign({size:"small",onClick:()=>g(s)},{children:i(ar,{fontSize:"small"})}))}))]}))}),s))):null,i(We,{children:i(l,Object.assign({variant:"contained",size:"small",color:"primary",onClick:m},{children:"Add value"}))})]}))};const Zt=({property:e,name:r,useExpression:t,required:a,label:l,title:o})=>{const{control:s,clearErrors:c}=y(),{field:{ref:d,onChange:p},fieldState:{error:m,isDirty:g}}=b({control:s,name:r,rules:{validate:e=>!(a&&!e)||"Please, fill this field"}}),h=f({control:s,name:r}),{propertyType:v,valueLabel:O,fillOptionLabel:x,fillOption:C,fillOptions:T,setFillOption:j}=Kt({property:e,value:h,isDirty:g,label:l,required:a,useExpression:t,multipleOptions:!0});E((()=>{void 0===h&&p(null)}),[h,p]);const{classes:S}=Ut();return n(We,{children:[o&&i(u,Object.assign({mb:2},{children:i(se,Object.assign({variant:"h6"},{children:o}))})),T?i(u,Object.assign({mb:2},{children:n(z,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(nr,Object.assign({htmlFor:"type-select",className:S.inputLabel},{children:x})),i(ir,Object.assign({labelId:"type-select",label:x,value:C||"",onChange:e=>{const t=e.target.value;"null"===t?p(null):"expression"===t||"json_valid"===t||"json_notvalid"===t?p(""):"widget"===t&&p([]),j(t),c(r)}},{children:T.map((e=>i(A,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===C&&(v===xr.JSON||v===xr.ENTITY||v===xr.ANY?i(Ht,{name:r,inputRef:d}):i(kr,{required:!0,hideErrorMessage:!0,control:s,name:r,label:O})),"json_valid"===C&&i(Ht,{validate:!0,name:r,inputRef:d}),"widget"===C&&i(Qt,{property:e,name:r,useExpression:t,required:a,label:l}),m&&i(se,Object.assign({color:"secondary"},{children:m.message}))]})},ei=({propertyFieldName:e,name:r,label:t="",required:n})=>{const{control:a}=y(),l=f({control:a,name:`${e}.propertyType`}),o=f({control:a,name:`${e}.isMultiple`}),s=f({control:a,name:`${e}.format`}),c=f({control:a,name:`${e}.restrictedValues`}),d=f({control:a,name:`${e}.properties`}),p=f({control:a,name:`${e}.isRequired`}),u=S((()=>{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 i(o?Zt:Xt,{name:r,property:u,title:t,required:n})};var ri=({name:e})=>{const r=S((()=>({type:""})),[]),{control:t}=y(),{fields:a,append:o,remove:s}=v({control:t,name:e});return n(u,Object.assign({mt:2},{children:[i(l,Object.assign({variant:"outlined",size:"small",onClick:()=>o(r)},{children:"Add node"})),a.map((({id:r},t)=>i(di,{removeHandle:()=>s(t),name:`${e}.${t}`},r)))]}))};const ti=w(""),ii=({name:e,control:r})=>n(a,{children:[i(se,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),i(u,{children:i(kr,{control:r,name:`${e}.minimumLength`,label:"Minimum Length",type:"number"})}),i(u,Object.assign({mt:2},{children:i(kr,{control:r,name:`${e}.maximumLength`,label:"Maximum Length",type:"number"})}))]}),ni=({name:e,control:r})=>n(a,{children:[i(se,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),i(u,{children:i(kr,{control:r,name:`${e}.multipleOf`,label:"Multiple Of",type:"number"})}),i(u,Object.assign({mt:2},{children:i(kr,{control:r,name:`${e}.minimum`,label:"Minimum",type:"number"})})),i(u,Object.assign({mt:2},{children:i(kr,{control:r,name:`${e}.maximum`,label:"Maximum",type:"number"})})),n(u,Object.assign({mt:2},{children:[i(Ar,{control:r,name:`${e}.exclusiveMinimum`,label:"Exclusive Minimum",defaultValue:"false"}),i(Ar,{control:r,name:`${e}.exclusiveMaximum`,label:"Exclusive Maximum",defaultValue:"false"})]}))]}),ai=["STRING_REGEX","JSON_SCHEMA"],li=new Set([xr.INTEGER,xr.FLOAT,xr.DOUBLE,xr.BIG_DECIMAL,xr.BIG_INTEGER,xr.LONG]);var oi=({name:e})=>{const{control:r,setValue:t}=y(),l=I(ti),o=f({control:r,name:`${e}.type`}),s=S((()=>{if("STRING_REGEX"===o)return i(kr,{control:r,name:`${e}.pattern`,label:"Pattern"});if("JSON_SCHEMA"===o)switch(!0){case l===xr.STRING:return i(ii,{name:`${e}.node`,control:r});case li.has(l):return i(ni,{name:`${e}.node`,control:r});case l===xr.JSON:return i(Dr,{label:"Properties",control:r,name:`${e}.properties`,validateJson:!0,parseValue:!0});default:return"Not available for type "+l}return null}),[l,o,r,e]);return E((()=>{li.has(l)&&"JSON_SCHEMA"===o&&(t(`${e}.node.exclusiveMinimum`,!1),t(`${e}.node.exclusiveMaximum`,!1))}),[l,o,t,e]),i(Rt,{data:[{label:"Validator",content:n(a,{children:[i(u,{children:i(Pr,{control:r,name:`${e}.type`,label:"Type",options:ai,onChange:r=>{t(e,{}),t(`${e}.type`,r.target.value)}})}),i(u,Object.assign({mt:2},{children:s}))]})}]})};const si=["AND","OR","NOT","NODE"],ci=({name:e,removeHandle:r})=>{const{control:t}=y(),l=f({control:t,name:`${e}.type`}),o=S((()=>({AND:i(ri,{name:`${e}.nodes`}),OR:i(ri,{name:`${e}.nodes`}),NODE:i(oi,{name:`${e}.validator`}),NOT:i(ci,{name:`${e}.node`})})),[e]);return i(Rt,{data:[{label:"Node Type",content:n(a,{children:[n(u,Object.assign({display:"flex",alignItems:"center"},{children:[i(Pr,{required:!0,control:t,name:`${e}.type`,label:"Type",options:si}),r&&i(u,Object.assign({ml:2},{children:i(Z,Object.assign({onClick:r,color:"primary"},{children:i(Ke,{})}))}))]})),i(u,{children:o[l]})]})}]})};var di=ci;const pi=({name:e})=>{const[r,t]=T(!1),{setValue:l,getValues:o}=y(),s=j((r=>{t(r.target.checked),r.target.checked||l(e,null)}),[l,e]);return E((()=>{o(e)&&t(!0)}),[e,o]),n(a,{children:[n(u,Object.assign({display:"flex",justifyContent:"space-between"},{children:[i(se,Object.assign({variant:"h6"},{children:"Validator"})),i(B,{label:"Enable",control:i(G,{color:"primary",checked:r,onChange:s})})]})),r&&i(di,{name:e})]})};var ui=({name:e,label:r="",propertyFieldName:t,type:n,decimal:a=!1,options:l=[],required:o=!1})=>{const{control:s}=y(),c=S((()=>`${t}.${e}`),[e,t]);switch(n){case"text":return i(kr,{control:s,name:c,label:r,required:o});case"number":return i(pt,{control:s,name:c,label:r,decimal:a,required:o});case"select":return i(Pr,{control:s,name:c,label:r,options:l,required:o});case"autocomplete":return i(Fr,{control:s,name:c,label:r,options:l,required:o});case"json":return i(Dr,{control:s,name:c,label:r,mode:"json",required:o});default:return null}};var mi=e=>({customCheckboxes:S((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:S((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e])});const gi=Object.values(xr).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))})));var hi=({propertyFieldName:e,entityDefinition:r=!1,globalParameter:t=!1,customPropertyFields:l=[]})=>{var o;const{control:s,setValue:c}=y(),d=f({control:s,name:`${e}.propertyType`}),p=f({control:s,name:`${e}.isMultiple`}),u=f({control:s,name:`${e}.isRequired`}),{customCheckboxes:m,customFields:g}=mi(l),h=S((()=>{let e=t?"Value":"Default Value";return p&&(e+="s"),e}),[t,p]);return E((()=>{d&&"string"==typeof d&&c(`${e}.propertyType`,gi.find((e=>e.value===d)))}),[d,c,e]),n(We,Object.assign({container:!0,direction:"column",spacing:2},{children:[i(We,{children:i(Mr,{required:!0,control:s,name:`${e}.key`,label:"Key"})}),i(We,{children:i(Mr,{required:!0,control:s,name:`${e}.name`,label:"Name"})}),i(We,{children:i(Fr,{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)}})}),i(We,{children:i(pt,{required:!0,control:s,name:`${e}.sortOrder`,label:"Sort Order"})}),i(We,{children:i(Dr,{control:s,name:`${e}.uiSettings`,label:"UI Settings",validateJson:!0})}),n(We,{children:[i(Ar,{control:s,name:`${e}.isMultiple`,label:"Multiple"}),i(Ar,{control:s,name:`${e}.isEnabled`,label:"Enabled"}),i(Ar,{control:s,name:`${e}.isRequired`,label:"Required"}),r&&i(Ar,{control:s,name:`${e}.isViewableInList`,label:"Is viewable in list"}),m.length?i(a,{children:m.map(((r,t)=>i(Ar,{control:s,name:`${e}.${r.name}`,label:r.label},t)))}):null]}),d&&n(a,{children:[i(We,{children:i(ti.Provider,Object.assign({value:null!==(o=d.value)&&void 0!==o?o:d},{children:i(pi,{name:`${e}.validationNode`})}))}),i(Jt,{propertyType:"string"==typeof d?d:d.value,propertyFieldName:e,globalParameter:t,entityDefinition:r}),i(ei,{propertyFieldName:e,name:`${e}.${t?"value":"defaultValue"}`,label:h,required:!!t&&u})]}),g.length?i(a,{children:g.map(((r,t)=>i(We,{children:i(ui,Object.assign({},r,{propertyFieldName:e}))},t)))}):null]}))};const 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:o,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[]})=>{const p=S((()=>e?`${e}.properties`:"properties"),[e]),{setValue:u,clearErrors:m,control:g}=y(),{fieldState:{error:h}}=b({control:g,name:p,rules:{required:o&&"Please, add properties"}}),v=f({control:g,name:p}),O=C([]);E((()=>{"number"==typeof t&&O.current[t]&&O.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,O]);const x=j((()=>{v?u(`${p}.${v.length}`,bi):u(p,[bi]),m(p)}),[v,p,m,u]),T=j((e=>{u(`${p}`,zr(v,e))}),[v,p,u]);return n(a,{children:[h&&h.message&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(se,Object.assign({color:"secondary"},{children:h.message}))})),v&&v.map(((e,r)=>i(We,Object.assign({sm:12,md:8,lg:6,ref:e=>O.current[r]=e},{children:n(Ge,Object.assign({defaultExpanded:!0,elevation:3},{children:[i(Je,Object.assign({expandIcon:i(Ye,{})},{children:i(se,Object.assign({color:h&&h[r]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:e.name||`Property ${r+1}`}))})),i(He,{children:i(hi,{propertyFieldName:`${p}.${r}`,entityDefinition:s,globalParameter:c,customPropertyFields:d})}),i(_e,{children:i(l,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>T(r)},{children:"Remove"}))})]}))}),r))),!r&&i(We,Object.assign({xs:12},{children:i(l,Object.assign({variant:"contained",size:"small",color:"primary",onClick:x},{children:"Add property"}))}))]})},yi=({definitionFieldName:e,title:r,hideCodeField:t,hideVersionField:a,hideNameField:l,required:o=!1})=>{const{control:s}=y();return n(We,Object.assign({container:!0,direction:"column",spacing:2},{children:[r&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(u,Object.assign({my:2},{children:i(se,Object.assign({variant:"h4"},{children:r}))}))})),!l&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(kr,{required:!0,control:s,name:e?`${e}.name`:"name",label:"Name"})})),!t&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(kr,{required:!0,control:s,name:e?`${e}.code`:"code",label:"Code"})})),!a&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(pt,{required:!0,control:s,name:e?`${e}.version`:"version",label:"Version"})})),i(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!==xr.JSON&&r!==xr.ENTITY&&r!==xr.ANY||!e?i(se,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===e?"null":e.toString()})):i(Yr,{value:e}),xi=(e,r,t)=>{switch(r){case"isRequired":case"isMultiple":case"isEnabled":case"isViewableInList":return e?i(lr,{color:"primary",fontSize:"small"}):null;case"restrictedValues":return e?i(u,Object.assign({display:"flex",flexWrap:"wrap"},{children:e.map((e=>i(rr,{label:e,style:{wordBreak:"break-word",maxWidth:"500px"}},e)))})):null;case"defaultValue":case"value":return i(Oi,{value:e,type:t});case"values":case"defaultValues":return Array.isArray(e)&&t!==xr.ENTITY&&t!==xr.JSON&&t!==xr.ANY?n("div",{children:["[",null==e?void 0:e.map(((e,r)=>i("div",{children:i(Oi,{value:e,type:t})},r))),"]"]}):i(Yr,{value:e});case"uiSettings":case"validationNode":return e?i(Yr,{value:e}):null;default:return i(se,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:e}))}};var Ci=({property:e})=>{const r=S((()=>(e&&(e.isMultiple?(delete e.defaultValue,delete e.value):(delete e.defaultValues,delete e.values)),e)),[e]);return i(Ie,Object.assign({size:"small"},{children:i(Me,{children:Object.keys(vi).map((e=>e in r?n(Ve,{children:[i(Pe,Object.assign({width:"30%"},{children:i(se,{children:vi[e]})})),i(Pe,{children:xi(r[e],e,r.propertyType)})]},e):null))})}))};var Ei=M((({properties:e,parentNames:r=[]})=>{const t=S((()=>{let r=!1;return e.every((e=>e.propertyType!==xr.ENTITY||(r=!0,!1))),r}),[e]);return n(u,Object.assign({mt:4},{children:[i(se,Object.assign({variant:"h6"},{children:"Properties"})),n(Ue,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[e.map((e=>n(Xe,Object.assign({expanded:!0},{children:[i(Qe,{StepIconProps:{icon:"",completed:!1,active:!0}}),i(Ze,{children:i(Ti,{property:e,parentNames:[...r],defaultExpanded:!1})})]}),e.key))),t&&i(Xe,{})]}))]}))}));const Ti=({property:e,parentNames:r=[],defaultExpanded:t=!0})=>{const[a,l]=T(!0);return E((()=>{l(t)}),[t]),n(Ge,Object.assign({elevation:3,style:{backgroundColor:r.length%2==1?"#f1f1f1":"#fff"},expanded:a,onChange:()=>l((e=>!e))},{children:[i(Je,Object.assign({expandIcon:i(Ye,{})},{children:i(se,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:e.name}))})),i(He,{children:n(u,Object.assign({width:"100%"},{children:[i(Ci,{property:e}),e.propertyType===xr.ENTITY&&i(Ei,{properties:lt(e.properties),parentNames:[...r,e.name]})]}))})]}))},ji=({properties:e,expandAll:r=!0})=>{const t=S((()=>Array.isArray(e)?e:e?lt(e):[]),[e]);return i(u,Object.assign({display:"flex",flexDirection:"column"},{children:t.length?t.map((e=>i(Ti,{property:e,defaultExpanded:r},e.key))):i(se,{children:"No properties"})}))},Si=({properties:e,dataFieldName:r,useExpression:t=!1,title:a})=>{const l=S((()=>e?e.map((e=>{const a="string"==typeof e.propertyType?e.propertyType:e.propertyType.value;return{label:n(u,Object.assign({display:"flex",flexDirection:"column"},{children:[n("b",{children:[e.name,e.isRequired?"*":""]}),n("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," | ",a]})]})),content:e.isMultiple?i(Zt,{property:e,name:`${r}.${e.key}`,useExpression:t,label:e.name,required:e.isRequired}):i(Xt,{property:e,name:`${r}.${e.key}`,useExpression:t,label:e.name,required:e.isRequired})}})):[]),[e,r,t]);return n(We,Object.assign({container:!0,direction:"column",spacing:2},{children:[a&&i(We,Object.assign({xs:12},{children:i("div",Object.assign({style:{fontWeight:"600"}},{children:a}))})),i(Rt,{data:l})]}))},Ni=({property:e,data:r,properties:t})=>{const n=e=>i(u,Object.assign({style:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"4px"}},{children:null===e?"null":null==e?void 0:e.toString()}));if(et(r))return n(r);switch(e.propertyType){case xr.JSON:return i(Yr,{value:r});case xr.ENTITY:return i(wi,{properties:t,data:r});case xr.ANY:return"object"==typeof r?i(Yr,{value:r}):n(r);default:return n(r)}};var ki=({property:e,data:r,hasBackground:t=!1})=>{const n=S((()=>e.propertyType===xr.ENTITY?Array.isArray(e.properties)?e.properties:lt(e.properties):[]),[e]);return i(u,Object.assign({style:{backgroundColor:t?"#f1f1f1":"none"}},{children:i(Ni,{property:e,data:r,properties:n})}))};const wi=({properties:e,data:r})=>{const t=S((()=>e&&r?e.map((e=>{var t;const{key:l,name:o,isMultiple:s,propertyType:c}=e,d=null!==(t=r[e.key])&&void 0!==t?t:r;return{label:n(u,Object.assign({display:"flex",flexDirection:"column"},{children:[i("b",{children:o}),n("span",{children:[l," | ",s?"multiple":"single"," | ",c]})]})),content:s&&Array.isArray(d)&&e.propertyType!==xr.ANY?i(a,{children:d.map(((r,t)=>i(u,Object.assign({mb:2},{children:i(ki,{property:e,data:r,hasBackground:!0})}),t)))}):i(ki,{property:e,data:d})}})):[]),[e,r]);return i(We,Object.assign({container:!0,direction:"column",spacing:2},{children:i(Rt,{data:t})}))};var Ii=we()((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 i("div",Object.assign({className:or(t.root,{[r]:!0})},{children:e}))},Pi=we()((()=>({propertyStepLabel:{"&:hover":{fontWeight:"600",cursor:"pointer"}}}))),Ai=({properties:e,parentKey:r="",activePath:t="",prefix:a="",onClick:l})=>{const{classes:o}=Pi();return i(Ue,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 n(Xe,Object.assign({expanded:!0,onClick:()=>{return e=c,void l(a?`${a}.${e}`:e);var e}},{children:[i(Qe,Object.assign({StepIconProps:{icon:"",completed:!1,active:t===c}},{children:n("div",Object.assign({className:o.propertyStepLabel},{children:[e.name," - ",e.key," - ",d]}))})),i(Ze,{children:i("div",{children:d===xr.ENTITY&&i(Ai,{onClick:l,activePath:t,properties:e.properties,parentKey:c},e.key)})})]}),e.key)}))}))};var $i=Ai;const Vi=({open:e=!1,onClose:r,onPaste:t,properties:a})=>{const[d,u]=T("");return n(o,Object.assign({open:e,onClose:r,fullWidth:!0,maxWidth:"md"},{children:[i(p,{children:"JSON path picker"}),n(c,{children:[(null==a?void 0:a.length)?a.map(((e,r)=>n("div",{children:[i(se,Object.assign({variant:"h6"},{children:e.title})),i($i,{properties:e.properties,prefix:e.pathPrefix,onClick:u,activePath:d})]},r))):i(se,{children:"Please, add properties"}),d&&n(se,Object.assign({variant:"h6",gutterBottom:!0},{children:["Selected path : $(",d,")"]}))]}),n(s,{children:[i(l,Object.assign({variant:"contained",color:"primary",onClick:()=>{navigator.clipboard.writeText(`$(${d})`),sr.success("Copied!")}},{children:"Copy"})),i(l,Object.assign({variant:"contained",color:"primary",onClick:()=>{t(`$(${d})`),sr.success("Pasted!")}},{children:"Paste"})),i(l,Object.assign({variant:"contained",color:"secondary",onClick:r},{children:"Close"}))]})]}))},Fi=D(dr)((e=>({width:248,flexShrink:0,"& .MuiDrawer-paper":{backgroundColor:e.theme.palette.secondary.main,width:248,boxSizing:"border-box",borderRight:"none",borderRadius:0}}))),Li=D(gr)((({theme:e})=>({borderRadius:e.spacing(2.5),padding:e.spacing(2,0,2,2),textAlign:"left","&.active":{backgroundColor:"rgba(38, 40, 66, 0.12)","&.main":{backgroundColor:"rgba(255, 255, 255, 0.12)",boxShadow:"-4px 0 0 0px #E0613A"}}}))),Ri=D(pr)((e=>({padding:e.theme.spacing(3,3,3,4),margin:0}))),qi=D(ur)((e=>({color:"#fff"}))),Di=D(mr)((()=>({color:"#fff",minWidth:28,"& svg":{fill:"#fff",color:"#fff"}}))),zi=D(hr)((()=>({backgroundColor:"inherit",color:"#fff"})));var Bi=({route:e,isActive:r})=>e.link?i(qi,Object.assign({disablePadding:!0},{component:ie,replace:!0,to:{pathname:e.link,search:e.query}},{children:n(Li,Object.assign({className:or({active:r,main:e.main})},{children:[e.icon&&i(Di,{children:e.icon}),i(fr,{primary:e.name,primaryTypographyProps:{variant:"body2"}})]}))})):i(zi,{children:e.name});function Wi({route:e,isActive:r,isListOpen:t,handleClick:a}){return(null==e?void 0:e.link)?i(qi,Object.assign({disablePadding:!0,onClick:a},{children:n(Li,Object.assign({className:or({active:r,main:e.main})},{children:[e.icon&&i(Di,{children:e.icon}),i(fr,{primary:e.name,primaryTypographyProps:{variant:"body2"}}),i(yr,{})]}))})):i(zi,{children:e.name})}const Gi=({route:e})=>{var r,t;const l=te(),[o,s]=T(!1),c=S((()=>!!e.link&&l.pathname.startsWith(e.link)),[l.pathname,e]);return E((()=>{s(c)}),[c]),(null===(r=e.children)||void 0===r?void 0:r.length)?n(a,{children:[i(Wi,{route:e,isActive:c,handleClick:()=>{s(!o)},isListOpen:o||!e.link}),i(br,Object.assign({in:o||!e.link,timeout:"auto"},{children:i(pr,Object.assign({component:"div",disablePadding:!0},{children:null===(t=e.children)||void 0===t?void 0:t.map(((e,r)=>i(Gi,{route:e},r)))}))}))]}):i(Bi,{route:e,isActive:c})};var Ji=Gi;var Hi=e({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",fontSize:14,h1:{fontWeight:400},h3:{fontWeight:500},h4:{fontWeight:500}}});var _i={components:{MuiButton:{styleOverrides:{root:{lineHeight:1.429}}},MuiInputBase:{styleOverrides:{root:{borderRadius:Hi.spacing(3),minWidth:Hi.spacing(25),background:Hi.palette.background.default},input:{minWidth:Hi.spacing(25)}}},MuiSelect:{styleOverrides:{nativeInput:{padding:0,height:"32px"}}},MuiTextField:{styleOverrides:{root:{minWidth:Hi.spacing(25)}}},MuiInputLabel:{styleOverrides:{root:{position:"relative",overflow:"initial",transform:"none",marginBottom:Hi.spacing(1),fontWeight:500,fontSize:"14px",lineHeight:"20px"}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:Hi.spacing(3),minWidth:Hi.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 Yi={components:{MuiTableContainer:{styleOverrides:{root:{borderRadius:Hi.spacing(3),border:"1px solid rgba(38, 40, 66, 0.08)"}}},MuiTableHead:{styleOverrides:{root:{backgroundColor:"#F7F8FC"}}},MuiTableCell:{styleOverrides:{root:{minHeight:48,padding:Hi.spacing(1,2),"&:first-of-type":{paddingLeft:Hi.spacing(4)}},head:{maxHeight:"40px",padding:Hi.spacing(2.75,2),color:"#6D6E85"},body:{wordBreak:"break-all"}}},MuiTableSortLabel:{styleOverrides:{root:{maxHeight:"24px",lineHeight:1}}}}};var Ki={components:{MuiStepIcon:{styleOverrides:{root:{fontSize:"20px",color:Hi.palette.text.disabled,"&.Mui-active, &.Mui-completed":{color:Hi.palette.secondary.main}}}}}};var Ui={components:{MuiTypography:{styleOverrides:{h1:{[Hi.breakpoints.up("lg")]:{fontSize:"1.5rem"}},h3:{fontSize:"1.25rem",[Hi.breakpoints.up("lg")]:{fontSize:"1.125rem"}},h4:{fontSize:"1rem",[Hi.breakpoints.up("lg")]:{fontSize:"1rem"}},subtitle2:{color:"#6D6E85"}}}}};const Xi=r(e(Hi,{components:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},_i.components),Yi.components),Ki.components),Ui.components),{MuiToolbar:{styleOverrides:{root:{[Hi.breakpoints.up("sm")]:{minHeight:"56px"}}}},MuiAppBar:{styleOverrides:{root:{boxShadow:"none",backgroundColor:"#007F9B"}}},MuiButton:{styleOverrides:{root:{borderRadius:Hi.spacing(2.5),padding:Hi.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:Hi.palette.secondary.dark}}},MuiDialog:{styleOverrides:{root:{"& .MuiModal-backdrop":{background:"rgba(28, 55, 77, 0.5)",backdropFilter:"blur(2px)"}},paper:{borderRadius:Hi.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:Hi.spacing(3,6)}}},MuiTabs:{styleOverrides:{root:{minHeight:"38px"},indicator:{backgroundColor:Hi.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:Hi.palette.secondary.main}}}}})})),Qi=({routes:e,theme:r})=>{const a=r||Xi;return i(t,Object.assign({theme:a},{children:i(ae,{children:n(Fi,Object.assign({variant:"permanent",anchor:"left"},{children:[i(cr,Object.assign({sx:{backgroundColor:a.palette.background.default,borderRight:"1px solid rgba(38, 40, 66, 0.08)",fontSize:24,fontWeight:600}},{children:"Fin tech LAB"})),i(Ri,{children:e.map(((e,r)=>i(Ji,{route:e},r)))})]}))})}))},Zi=({children:e,toolbar:r,contentSx:t})=>n(u,Object.assign({component:"main",sx:{flexGrow:1,bgcolor:"background.default"}},{children:[i(cr,Object.assign({sx:{borderBottom:"1px solid rgba(38, 40, 66, 0.08)"}},{children:r})),i(u,Object.assign({sx:Object.assign(Object.assign({},t),{height:"calc(100vh - 56px)",overflow:"scroll"})},{children:i(P,Object.assign({fallback:i(Sr,{})},{children:null!=e?e:i(le,{})}))}))]}));export{Nr as AlertDialog,qr as BackButton,Zi as ContentLayout,Dr as ControlAceEditor,Fr as ControlAutocomplete,Ar as ControlCheckbox,mt as ControlDate,gt as ControlDateTime,Mr as ControlDebouncedInput,kr as ControlInput,pt as ControlNumberInput,Lr as ControlQueryAutocomplete,$r as ControlRadio,Pr as ControlSelect,ut as ControlSwitch,ht as ControlTime,Rr as CopyButton,yi as CreateDefinition,fi as CreatePropertiesList,Cr as DATE_DEFAULT_FORMAT,Tr as DATE_TIME_DEFAULT_FORMAT,Si as DefinitionFiller,wi as DefinitionValueView,Pt as InfoItem,Kr as JsonModalView,Vi as JsonPathPicker,Yr as JsonView,Sr as Loader,Zt as MultiplePropertyFiller,Xt as PropertyFiller,xr as PropertyType,ei as PropertyValueField,jr as RoundingMode,It as RouteTabs,Qi as Sidebar,Nt as SimpleTable,Mi as Status,Rt as StepperView,Er as TIME_DEFAULT_FORMAT,wt as TabPanel,Ct as Table,Et as TableAction,kt as TableActionCell,ji as ViewPropertiesList,Ti as ViewProperty,Wr as capitalize,_r as deepParseJson,Qr as digitsOnly,Zr as floatsOnly,nt as formatDefinitionData,Xr as formatTableRowValue,ot as getDemPropertyDateFormat,st as getEntityStarterValue,Jr as getJsonStringValue,ct as getMultiplePropertyFillOptions,dt as getSinglePropertyFillOptions,rt as isDateType,et as isExpression,tt as isPropertyValueEmpty,at as propertiesArrayToObject,lt as propertiesObjectToArray,zr as removeArrayItem,Hr as safeParseJson,Gr as sortArrayOfObjects,Xi as theme,wr as useDebounce,Ir as useToggle,Br as validateJson};
1
+ import{createTheme as e,responsiveFontSizes as r,ThemeProvider as t}from"@mui/material/styles";import{jsx as i,jsxs as n,Fragment as a}from"react/jsx-runtime";import l from"@mui/material/Button";import o from"@mui/material/Dialog";import s from"@mui/material/DialogActions";import c from"@mui/material/DialogContent";import d from"@mui/material/DialogContentText";import p from"@mui/material/DialogTitle";import u from"@mui/material/Box";import m from"@mui/material/CircularProgress";import{__rest as g,__awaiter as h}from"tslib";import{useController as b,useWatch as f,useFormContext as y,useFieldArray as v}from"react-hook-form";import O from"@mui/material/TextField";import x,{useRef as C,useEffect as E,useState as T,useCallback as j,useMemo as S,createElement as N,forwardRef as k,createContext as w,useContext as I,memo as M,Suspense as P}from"react";import A from"@mui/material/MenuItem";import $ from"@mui/icons-material/Clear";import{InputAdornment as V,IconButton as F,FormHelperText as L,Box as R,Backdrop as q,styled as D}from"@mui/material";import z from"@mui/material/FormControl";import B from"@mui/material/FormControlLabel";import W from"@mui/material/FormHelperText";import G from"@mui/material/Checkbox";import J from"@mui/material/Radio";import H from"@mui/material/RadioGroup";import _ from"@mui/material/FormLabel";import Y from"@mui/material/Autocomplete";import{useQuery as K}from"@tanstack/react-query";import U from"qs";import X from"@mui/icons-material/FileCopyOutlined";import Z from"@mui/material/Tooltip";import Q from"@mui/material/IconButton";import ee from"@mui/icons-material/ArrowBack";import{useNavigate as re,useLocation as te,Link as ie,useSearchParams as ne,BrowserRouter as ae,Outlet as le}from"react-router-dom";import oe from"react-ace";import se from"@mui/material/Typography";import ce from"@mui/material/Switch";import{DatePicker as de}from"@mui/x-date-pickers/DatePicker";import{format as pe,isMatch as ue,isValid as me,parse as ge}from"date-fns";import{DateTimePicker as he}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as be}from"@mui/x-date-pickers/TimePicker";import fe from"@mui/material/Pagination";import ye from"@mui/material/TablePagination";import{useGridApiContext as ve,useGridSelector as Oe,gridPageSelector as xe,gridPageCountSelector as Ce,gridRowCountSelector as Ee,gridPageSizeSelector as Te,GridColumnMenuContainer as je,GridFilterMenuItem as Se,DataGrid as Ne,GridActionsCellItem as ke}from"@mui/x-data-grid";import{makeStyles as we}from"tss-react/mui";import Ie from"@mui/material/Table";import Me from"@mui/material/TableBody";import Pe from"@mui/material/TableCell";import Ae from"@mui/material/TableContainer";import $e from"@mui/material/TableHead";import Ve from"@mui/material/TableRow";import Fe from"@mui/material/TableSortLabel";import Le from"@mui/material/TableFooter";import Re from"@mui/material/Menu";import qe from"@mui/icons-material/MoreHoriz";import De from"@mui/material/Paper";import ze from"@mui/material/Tab";import Be from"@mui/material/Tabs";import We from"@mui/material/Unstable_Grid2";import Ge from"@mui/material/Accordion";import Je from"@mui/material/AccordionSummary";import He from"@mui/material/AccordionDetails";import _e from"@mui/material/AccordionActions";import Ye from"@mui/icons-material/ExpandMore";import Ke from"@mui/icons-material/Delete";import Ue from"@mui/material/Stepper";import Xe from"@mui/material/Step";import Ze from"@mui/material/StepLabel";import Qe from"@mui/material/StepContent";import er from"@mui/material/StepConnector";import rr from"@mui/material/Chip";import tr from"@mui/icons-material/Add";import ir from"@mui/material/Select";import nr from"@mui/material/InputLabel";import ar from"@mui/icons-material/Close";import lr from"@mui/icons-material/CheckCircle";import or from"classnames";import{toast as sr}from"react-toastify";import cr from"@mui/material/Toolbar";import dr from"@mui/material/Drawer";import pr from"@mui/material/List";import ur from"@mui/material/ListItem";import mr from"@mui/material/ListItemIcon";import gr from"@mui/material/ListItemButton";import hr from"@mui/material/ListSubheader";import br from"@mui/material/Collapse";import fr from"@mui/material/ListItemText";import yr from"@mui/icons-material/NotInterested";import vr from"@mui/icons-material/Fullscreen";var Or;!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"}(Or||(Or={}));const xr="yyyy-MM-dd",Cr="HH:mm:ss",Er="yyyy-MM-dd'T'HH:mm:ss.SSSXXX";var Tr;!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"}(Tr||(Tr={}));const jr=({transparent:e,position:r})=>i(u,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:i(m,{})})),Sr=({open:e,title:r,description:t,closeButtonTitle:a="Close",onClose:m,confirmButtonTitle:g="Confirm",confirmButtonDisabled:h=!1,onConfirm:b,children:f,dialogProps:y,loading:v,maxWidth:O="xs"})=>i("div",{children:n(o,Object.assign({open:e,onClose:m,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:O},y,{children:[v&&i(jr,{}),i(p,Object.assign({id:"alert-dialog-title"},{children:r})),n(c,{children:[t&&i(d,Object.assign({id:"alert-dialog-description"},{children:t})),i(u,Object.assign({maxWidth:"100%",overflow:"hidden"},{children:f}))]}),n(s,{children:[i(l,Object.assign({onClick:m,color:"primary",variant:"contained"},{children:a})),g&&b?i(l,Object.assign({onClick:b,color:"secondary",variant:"contained",autoFocus:!0,disabled:h},{children:g})):null]})]}))}),Nr=e=>{var r,{control:t,validate:n,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,textarea:d=!1,hideErrorMessage:p=!1,onChange:u}=e,m=g(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange"]);const{field:{ref:h,onChange:y},fieldState:{error:v}}=b({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:n}}),x=f({control:t,name:a});return i(O,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:h,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:u||y},m,{inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=x?x:""})}))};function kr(e,r){const t=C();E((()=>()=>{t.current&&clearTimeout(t.current)}),[]);return(...i)=>{clearTimeout(t.current),t.current=setTimeout((()=>{e(...i)}),r)}}const wr=()=>{const[e,r]=T(!1);return{open:e,toggle:()=>{r((e=>!e))},onClose:()=>{r(!1)},onOpen:()=>{r(!0)}}},Ir=e=>{var r,{control:t,validate:n,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,textarea:d=!1,hideErrorMessage:p=!1,onChange:u}=e,m=g(e,["control","validate","name","label","required","defaultValue","disabled","textarea","hideErrorMessage","onChange"]);const{field:{ref:h,onChange:y},fieldState:{error:v}}=b({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:n}}),x=f({control:t,name:a}),[C,S]=T("");E((()=>{!C&&x&&S(x)}),[C,x]);const N=kr((e=>{y(e)}),200),k=j((e=>{S(e.target.value),N(e.target.value)}),[N]);return i(O,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:h,name:a,label:l,error:!!v,helperText:!p&&(null==v?void 0:v.message),disabled:c,multiline:d,minRows:d?3:1,value:null!=C?C:"",onChange:k},m,{inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=C?C:""})}))},Mr=e=>{var r,{control:t,validate:n,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,hideErrorMessage:d=!1,onChange:p,labelKey:u,valueKey:m,options:h=[]}=e,y=g(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options"]);const{field:{ref:v,onChange:x},fieldState:{error:C}}=b({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:n}}),E=f({control:t,name:a}),T=j((e=>"string"==typeof e?e:m?e[m]:e.value),[m]),S=j((e=>"string"==typeof e?e:u?e[u]:e.label),[u]),N=j((()=>{x(null)}),[x]);return i(O,Object.assign({select:!0,fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:v,name:a,label:l,error:!!C,helperText:!d&&(null==C?void 0:C.message),disabled:c,value:null!=E?E:"",onChange:p||x},y,{inputProps:Object.assign(Object.assign({},null!==(r=null==y?void 0:y.inputProps)&&void 0!==r?r:{}),{value:null!=E?E:""}),InputProps:Object.assign({endAdornment:!o&&E?i(V,Object.assign({position:"end",sx:{mr:2}},{children:i(F,Object.assign({onClick:N,size:"small"},{children:i($,{fontSize:"small"})}))})):null},null==y?void 0:y.InputProps)},{children:h.map(((e,r)=>i(A,Object.assign({value:T(e)},{children:S(e)}),r)))}))},Pr=e=>{var{control:r,validate:t,name:a="",label:l="",required:o=!1,defaultValue:s="",disabled:c=!1,hideErrorMessage:d=!1,onChange:p}=e,u=g(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange"]);const{field:{ref:m,onChange:h},fieldState:{error:y}}=b({name:a,control:r,defaultValue:s}),v=f({control:r,name:a}),O=S((()=>{if("boolean"==typeof v)return v;if("string"==typeof v){if("false"===v)return h(!1),!1;if("true"===v)return h(!0),!0}return!1}),[v,h]);return n(z,Object.assign({error:!!y,component:"fieldset",variant:"standard",disabled:c},{children:[i(B,{control:i(G,Object.assign({checked:O,onChange:p||h,name:a,inputRef:m,disabled:c},u)),label:l}),!d&&(null==y?void 0:y.message)&&i(W,{children:y.message})]}))},Ar=({name:e,label:r,values:t=[],control:a,required:l,defaultValue:o,disabled:s,hideErrorMessage:c,labelKey:d,valueKey:p,validate:u,onChange:m})=>{const{field:{ref:g,onChange:h},fieldState:{error:y}}=b({name:e,control:a,defaultValue:o,rules:{required:l&&"Please, fill this field",validate:u}}),v=f({control:a,name:e}),O=j((e=>"string"==typeof e?e:p?e[p]:e.value),[p]),x=j((e=>"string"==typeof e?e:d?e[d]:e.label),[d]);return n(z,Object.assign({disabled:s,error:!!y},{children:[i(_,Object.assign({id:"radio-buttons-group"},{children:r})),i(H,Object.assign({"aria-labelledby":"radio-buttons-group",ref:g,name:e,value:v,onChange:m||h},{children:t.map((e=>i(B,{value:O(e),control:i(J,{}),label:x(e)})))})),!c&&(null==y?void 0:y.message)&&i(L,{children:y.message})]}))};var $r=({valueKey:e,labelKey:r})=>{const t=j(((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=j((e=>e?"string"==typeof e?e:r&&e[r]?e[r]+"":e.label+""||e.name+""||e.value+""||e.code+""||"--no label--":""),[r]),n=j(((e,r)=>N(R,Object.assign({},e,{component:"li",key:e.id}),i(r))),[i]);return{isOptionEqualToValue:t,getOptionLabel:i,renderOption:n}};const Vr=e=>{var{control:r,validate:t,name:n="",label:a="",required:l=!1,defaultValue:o="",disabled:s=!1,hideErrorMessage:c=!1,onChange:d,labelKey:p,valueKey:u,options:m=[],multiple:h,textFieldProps:y={},disableCloseOnSelect:v}=e,x=g(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","labelKey","valueKey","options","multiple","textFieldProps","disableCloseOnSelect"]);const{field:{ref:C,onChange:E},fieldState:{error:T}}=b({name:n,control:r,defaultValue:o,rules:{required:l&&"Please, fill this field",validate:t}}),j=f({control:r,name:n,defaultValue:h?[]:null}),{getOptionLabel:S,isOptionEqualToValue:N,renderOption:k}=$r({valueKey:u,labelKey:p});return i(Y,Object.assign({fullWidth:!0,disablePortal:!0,size:"small",readOnly:s,options:m,multiple:h,getOptionLabel:S,isOptionEqualToValue:N,disableCloseOnSelect:v||h,filterSelectedOptions:h,value:j,onChange:d||((e,r)=>{E(r)}),renderOption:k,renderInput:e=>i(O,Object.assign({},e,{variant:"outlined",name:n,label:a,error:!!T,inputRef:C,helperText:!c&&(null==T?void 0:T.message)},y))},x))};function Fr(e){var{name:r,label:t,control:a,required:l=!1,searchBy:o,labelKey:s,multiple:c=!1,disabled:d,valueKey:p,sortBy:u="",hideErrorMessage:h,disableCloseOnSelect:y,textFieldProps:v,onChange:C,queryFunction:S,validate:N,itemQueryFunction:k}=e,w=g(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}}=b({control:a,name:r,rules:{required:l&&"Please, fill this field",validate:N}}),$=f({control:a,name:r,defaultValue:c?[]:null}),{getOptionLabel:V,isOptionEqualToValue:F,renderOption:L}=$r({valueKey:p,labelKey:s}),[R,q]=T(!1),[D,z]=T(""),[B,W]=T(""),[G,J]=T(0),[H,_]=T(0),[X,Z]=T([]),Q=kr((e=>{_(0),W(e),Z([])}),500),ee=j(((e,r)=>{z(r),Q(r)}),[Q]),re=j(((e,r)=>{M(r),C&&C(e,r)}),[M,C]);E((()=>{if(!A&&$&&k){let e=$;"object"==typeof $&&p in $&&(e=$[p]),k(e).then((e=>{M(e),z(e[s])})).catch()}}),[$,A,p,s,k,M]);const te=j((e=>{const r=e.currentTarget;r.scrollHeight-r.scrollTop-r.clientHeight<=1&&X.length<G&&_((e=>e+1))}),[G,X]),{data:ie,isFetching:ne}=K(["options",H,B],(()=>{const e=U.parse(Object.assign({page:`${H}`,size:"20",sort:u},B?{[o]:B}:{}),{ignoreQueryPrefix:!0});return S(e)}));return E((()=>{ie&&(Z((e=>[...e,...ie.collection])),J(ie.totalItems))}),[ie]),i(Y,Object.assign({fullWidth:!0,disablePortal:!0,size:"small",readOnly:d,options:X,multiple:c,getOptionLabel:V,isOptionEqualToValue:F,disableCloseOnSelect:y||c,filterSelectedOptions:c,inputValue:D,value:$,onChange:re,loading:ne,clearOnBlur:!1,open:R,filterOptions:e=>e,onOpen:()=>{q(!0)},onClose:()=>{q(!1),W("")},onInputChange:ee,ListboxProps:{onScroll:te},renderOption:L,renderInput:e=>i(O,Object.assign({},e,{label:t,variant:"outlined",error:!!P,inputRef:I,helperText:!h&&(null==P?void 0:P.message),InputProps:Object.assign(Object.assign({},e.InputProps),{endAdornment:n(x.Fragment,{children:[ne?i(m,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})})},v))},w))}const Lr=({copyText:e,helpText:r="Copy"})=>{const[t,n]=T(r);return t?i(Z,Object.assign({title:t,placement:"top"},{children:i(Q,Object.assign({onClick:()=>{navigator.clipboard.writeText(e),n("Copied!"),setTimeout((()=>{n(r)}),1e3)}},{children:i(X,{fontSize:"small"})}))})):null},Rr=({text:e,buttonProps:r={}})=>{const t=re(),{state:n}=te(),a=S((()=>null==n?void 0:n.from),[n]),o=j((()=>{t(a||-1)}),[t,a]);return i(u,Object.assign({mr:2},{children:e?i(l,Object.assign({color:"inherit",onClick:a?null:o,component:ie,to:null!=a?a:""},r,{children:e})):i(Q,Object.assign({onClick:o},{children:i(ee,{})}))}))},qr=k(((e,r)=>{var{control:t,name:l,mode:o="json",label:s,width:c="100%",height:d="200px",theme:p="monokai",readOnly:m,required:h=!1,validateJson:v=!1,fontSize:O=16,validate:x=!0,parseValue:C}=e,E=g(e,["control","name","mode","label","width","height","theme","readOnly","required","validateJson","fontSize","validate","parseValue"]);const{setError:T,clearErrors:j}=y(),{field:{onChange:S},fieldState:{error:N}}=b({control:t,name:l}),k=f({control:t,name:l});return n(u,Object.assign({display:"flex",flexDirection:"column",width:"100%"},{children:[i(u,{children:s&&i(se,Object.assign({variant:"subtitle1",display:"inline",style:{marginRight:10}},{children:s}))}),n(a,{children:[i(oe,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},style:{lineHeight:1.4,zIndex:0,isolation:"isolate"},readOnly:m,value:"json"===o&&"string"!=typeof k?null===k?"":JSON.stringify(k):k,onChange:e=>{if(!e&&h?T(l,{message:"Required field"}):j(l),v)try{JSON.parse(e),j(l)}catch(e){T(l,{message:"Invalid JSON"})}if(C)try{const r=JSON.parse(e);console.log("parsed val:",r),S(r)}catch(r){S(e)}else S(e)},mode:o,onLoad:e=>{x&&v||e.getSession().setUseWorker(!1)}},E)),N&&i(W,Object.assign({error:!0},{children:N.message}))]})]}))})),Dr=(e,r)=>{const t=[...e];return t.splice(r,1),t},zr=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};function Br(e){return e.replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}const Wr=(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},Gr=e=>{if(!e)return"";if("string"!=typeof e)try{return JSON.stringify(e,null,"\t")}catch(e){return"Failed to stringify JSON"}return e},Jr=e=>{try{return JSON.parse(e)}catch(e){return null}},Hr=e=>{try{const r=JSON.parse(e);return Object.keys(r).forEach((e=>{r[e]=Hr(r[e])})),r}catch(r){return e}},_r=({value:e,height:r="200px"})=>{const t=S((()=>{if("string"==typeof e)return e;if("object"==typeof e)try{return JSON.stringify(e,null,"\t")}catch(e){return"Failed to parse JSON"}return null}),[e]);return i(oe,{readOnly:!0,value:t,mode:"json",width:"100%",height:r,fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})},Yr=({open:e,onClose:r,value:t})=>n(o,Object.assign({disableEscapeKeyDown:!0,open:e,onClose:r,fullWidth:!0,maxWidth:"md",style:{width:800,left:"30%"}},{children:[i(c,{children:i(oe,{readOnly:!0,value:t,mode:"json",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})}),n(s,{children:[i(Lr,{copyText:t}),i(l,Object.assign({onClick:r,variant:"contained",color:"secondary"},{children:"Close"}))]})]}));var Kr=({value:e,copyButton:r=!1,textField:t=!1})=>{const{open:a,onOpen:l,onClose:o}=wr();return n(u,Object.assign({width:"100%"},{children:[n(u,Object.assign({display:"flex",alignItems:"center",justifyContent:"flex-end",pt:1,mb:2},{children:[r&&i(Lr,{copyText:Gr(e)}),i(Z,Object.assign({title:"Open",placement:"top"},{children:i(Q,Object.assign({size:"small",onClick:()=>l()},{children:i(vr,{fontSize:"small"})}))}))]})),t?i(u,Object.assign({overflow:"hidden",whiteSpace:"nowrap"},{children:"object"==typeof e?JSON.stringify(e):e})):i(_r,{value:e}),i(Yr,{open:a,value:Gr(e),onClose:o})]}))};const Ur=({value:e,type:r,copyText:t,status:a})=>{switch(r){case"id":return n(u,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[i(u,Object.assign({mr:"auto"},{children:`${e.slice(0,6)}...${e.slice(-6)}`})),i(Lr,{copyText:t||e})]}));case"JSON_copy":return i(Kr,{value:e,copyButton:!0});case"JSON":return i(Kr,{value:e});case"JSON_text":return i(Kr,{value:e,textField:!0});case"copy":return n(u,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[i(u,Object.assign({mr:"auto"},{children:e})),i(Lr,{copyText:t||e})]}));case"boolean":return e?i(lr,{color:"primary",fontSize:"small"}):i(yr,{fontSize:"small"});case"date":return e?n("div",{children:[i("div",{children:pe(new Date(e),"dd.MM.yyyy")}),i("div",{children:pe(new Date(e),"HH:mm:ss")})]}):"";case"status":return i(Ii,{text:e,status:a});case"array":return i(u,{children:e.map(((e,r)=>i(u,{children:e},r)))});default:return i("div",{children:e})}},Xr=new RegExp("^[-+]?[0-9]+$"),Zr=new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/),Qr=e=>"string"==typeof e&&e.includes("$("),et=e=>e===Or.DATE||e===Or.DATE_TIME||e===Or.TIME,rt=e=>!e&&0!==e&&!1!==e,tt=(e,r,t)=>{if(null==r&&e!==Or.BOOLEAN)return null;let i=r;switch(e){case Or.BOOLEAN:i=!!r;break;case Or.INTEGER:case Or.BIG_INTEGER:case Or.BIG_DECIMAL:case Or.FLOAT:case Or.LONG:case Or.DOUBLE:i=Number(r);break;case Or.DATE:case Or.DATE_TIME:case Or.TIME:i=pe(new Date(r.toString()),t.formatText);break;case Or.JSON:case Or.ANY:try{"string"!=typeof r&&(i=JSON.stringify(r)),i=JSON.parse(i)}catch(e){console.log(e),i=null}break;case Or.ENTITY:i=it(t.properties,r)}return i},it=(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=>tt(n,r,{formatText:e.format,properties:e.properties}))):t[i]=tt(n,a,{formatText:e.format,properties:e.properties})})),t}return null},nt=(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=>tt(e.propertyType,r,{formatText:e.format,properties:e.properties}))):t[n]=tt(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===Or.BIG_DECIMAL&&(u.precisionScale=e.precisionScale,u.roundingMode=e.roundingMode),p!==Or.DATE&&p!==Or.TIME&&p!==Or.DATE_TIME||(u.format=e.format),p===Or.STRING&&(u.restrictedValues=e.restrictedValues),p===Or.ENTITY_REFERENCE&&(u.definitionCode=e.definitionCode,u.definitionVersion=e.definitionVersion,u.labelPropertyCode=e.labelPropertyCode,u.valuePropertyCode=e.valuePropertyCode),p===Or.ENTITY&&(u.properties=nt(e.properties,r)),t[i]=u})),t};function at(e,r){return Object.keys(e).map((t=>{const i=Object.assign(Object.assign({key:t},e[t]),r||{});if(i.propertyType===Or.ENTITY&&(i.properties=at(i.properties,r)),i.propertyType===Or.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)=>Wr(e,r,"sortOrder")))}const lt=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return pe(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},ot=e=>{let r=[];return r=Array.isArray(e.properties)?e.properties:at(e.properties),r.reduce(((e,r)=>{const t=JSON.parse(JSON.stringify(e));return r.propertyType===Or.ENTITY?t[r.key]=ot(r):t[r.key]=r.propertyType,t}),{})},st=({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===Or.JSON||e===Or.ENTITY||e===Or.ANY?i.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):i.push({value:"expression",label:"Expression",sortOrder:3})),e!==Or.JSON&&e!==Or.ANY&&e!==Or.ENTITY||i.push({value:"json_valid",label:"JSON editor",sortOrder:2}),i=i.sort(((e,r)=>Wr(e,r,"sortOrder"))),i},ct=({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===Or.JSON||e===Or.ENTITY||e===Or.ANY?i.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):i.push({value:"expression",label:"Expression",sortOrder:3})),e){case Or.STRING:i[0].label="Text input";break;case Or.INTEGER:case Or.BIG_INTEGER:case Or.BIG_DECIMAL:case Or.FLOAT:case Or.LONG:case Or.DOUBLE:i[0].label="Number input";break;case Or.BOOLEAN:i[0].label="Switch";break;case Or.ENTITY_REFERENCE:i[0].label="Entity reference fields";break;case Or.JSON:i[0].label="JSON editor";break;case Or.DATE:i[0].label="Date picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case Or.DATE_TIME:i[0].label="Date & Time picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case Or.TIME:i[0].label="Time picker",i.push({value:"string",label:"Text input",sortOrder:2});break;case Or.ANY:i[0].label="Textarea"}return i=i.sort(((e,r)=>Wr(e,r,"sortOrder"))),i},dt=e=>{var r,{control:t,validate:n,name:a="",label:l="",required:o=!1,defaultValue:s,disabled:c=!1,hideErrorMessage:d=!1,onChange:p,decimal:u=!1}=e,m=g(e,["control","validate","name","label","required","defaultValue","disabled","hideErrorMessage","onChange","decimal"]);const{field:{ref:h,onChange:y},fieldState:{error:v}}=b({name:a,control:t,defaultValue:s,rules:{required:o&&"Please, fill this field",validate:e=>u&&!Zr.test(e)?"Not valid number":!(!u&&!Xr.test(e))||"Not valid integer"}}),x=f({control:t,name:a});return i(O,Object.assign({fullWidth:!0,size:"small",variant:"outlined",type:"text",inputRef:h,name:a,label:l,error:!!v,helperText:!d&&(null==v?void 0:v.message),disabled:c,value:null!=x?x:""},m,{onChange:e=>{const r=e.nativeEvent.data||e.target.value;(!isNaN(r)||u&&"."===r||"-"===r||"+"===r)&&(p?p(e):y(e.target.value))},inputProps:Object.assign(Object.assign({},null!==(r=null==m?void 0:m.inputProps)&&void 0!==r?r:{}),{value:null!=x?x:""})}))},pt=e=>{var{control:r,name:t,label:n}=e,a=g(e,["control","name","label"]);const{field:{ref:l,onChange:o}}=b({control:r,name:t}),s=f({control:r,name:t}),c=S((()=>{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]);E((()=>{null===s&&o(!1)}),[s,o]);return i(B,{label:n,name:t,control:i(ce,Object.assign({color:"primary",size:"small",inputRef:l,onChange:e=>{const{checked:r}=e.target;o(r)},checked:c},a))})},ut=({control:e,name:r,required:t,label:n,format:a=xr,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=b({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!ue(e,a)||"Incorrect date format"}}),d=f({control:e,name:r});return i(de,{label:n,inputRef:s,inputFormat:a,value:d||null,onChange:e=>{o(me(e)?pe(e,a):e)},renderInput:e=>i(O,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:n,format:a=Er,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=b({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!ue(e,a)||"Incorrect date format"}}),d=f({control:e,name:r});return i(he,{mask:"",ampm:!1,inputRef:s,label:n,value:d||null,inputFormat:a,onChange:e=>{o(me(e)?pe(e,a):e)},renderInput:e=>i(O,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},gt=({control:e,name:r,required:t,label:n,format:a=Cr,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=b({control:e,name:r,rules:{required:t&&"Please, fill this field",validate:e=>!!ue(e,a)||"Incorrect date format"}}),d=f({control:e,name:r}),[p,u]=T(null);return E((()=>{if(d&&a){let e=ge(d,a,new Date);me(e)||(e=ge(d,"HH:mm:ss.SSS",new Date)),u(e)}}),[d,a]),i(be,{mask:"",inputRef:s,label:n,ampm:!1,value:p,inputFormat:a,onChange:e=>{u(e),o(me(e)?pe(e,a):e)},renderInput:e=>i(O,Object.assign({},e,{fullWidth:!0,size:"small",variant:"outlined",name:r,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})};var ht=()=>{const e=ve(),r=Oe(e,xe),t=Oe(e,Ce),a=Oe(e,Ee),l=Oe(e,Te),o=r=>e.current.setPage(r);return n(u,Object.assign({px:2,display:"flex",alignItems:"center"},{children:[i(ye,{component:"div",page:r,count:a,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}),i(fe,{count:t,page:r+1,onChange:(e,r)=>o(r-1)})]}))};var bt=e=>{var{hideMenu:r,currentColumn:t,onUnsort:n}=e,a=g(e,["hideMenu","currentColumn","onUnsort"]);return i(je,Object.assign({hideMenu:r,currentColumn:t},a,{children:i(Se,{onClick:r,column:t})}))};var ft=({mode:e})=>{const[r,t]=ne(),i=+r.get("page")||0,n=+r.get("size")||10;return E((()=>{"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 yt=()=>{const[e,r]=ne(),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 vt=e=>{const[r,t]=T(10);E((()=>{t(e)}),[e]);return{pageSize:r,handlePageSizeChange:e=>t(e)}},Ot=we()({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 xt=({columns:e,rows:r,rowCount:t,loading:n,disableMargin:a,mode:l="server",initialPageSize:o=10,pagination:s=!0,onCellClick:c})=>{const{classes:d}=Ot(),{page:p,size:m,onPageChange:g,onSizeChange:h}=ft({mode:l}),{onColumnHeaderClick:b,getSortedColumns:f}=yt(),{pageSize:y,handlePageSizeChange:v}=vt(o),O={sortingMode:l,paginationMode:l,pageSize:"server"===l?m:s?y:t,onPageSizeChange:"server"===l?h:v,components:{Pagination:ht}};return"server"===l&&(O.sortModel=[],O.onColumnHeaderClick=b,O.page=p,O.onPageChange=g,O.components.ColumnMenu=bt),i(u,Object.assign({mt:a?0:2},{children:i(Ne,Object.assign({autoHeight:!0,hideFooterPagination:!s,hideFooter:!s,disableSelectionOnClick:!0,showColumnRightBorder:!0,showCellRightBorder:!0,className:d.root,loading:n,rows:r,columns:f(e),rowCount:t,rowsPerPageOptions:[10,20,50,100],onCellClick:c},O))}))},Ct=({icon:e,label:r,showInMenu:t,onClick:n,location:a})=>a?i(Q,Object.assign({component:ie,to:a,size:"small"},{children:i(Z,Object.assign({title:r,arrow:!0},{children:x.cloneElement(e,{fontSize:"small"})}))})):i(ke,{nonce:"",onResize:void 0,onResizeCapture:void 0,icon:i(Z,Object.assign({title:r,arrow:!0},{children:e})),onClick:n,label:r,showInMenu:t});var Et=()=>{const[e,r]=ne(),t=S((()=>{var r;return null!==(r=e.get("page"))&&void 0!==r?r:0}),[e]),i=S((()=>{var r;return null!==(r=e.get("size"))&&void 0!==r?r:10}),[e]),n=j((e=>{r((r=>(r.set("page",`${e}`),r)))}),[r]),a=j((e=>{r((r=>(r.set("size",`${e}`),r)))}),[r]);return E((()=>{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 Tt=()=>{const[e,r]=ne(),t=S((()=>e.getAll("sort").map((e=>e.split(",")))),[e]),i=j((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=j((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:a,pagination:l=!0,loading:o=!1,onRowClick:s,verticalAlign:c="middle"},d){const{page:p,size:u,onPageChange:m,onSizeChange:g}=Et(),{onSortChanged:h,getColumnSorting:b}=Tt();return n(Ae,Object.assign({sx:{position:"relative",overflow:"visible"}},{children:[i(q,Object.assign({open:o,sx:{position:"absolute",top:0,left:0}},{children:i(jr,{})})),n(Ie,Object.assign({ref:d},{children:[i($e,{children:i(Ve,{children:e.map(((e,r)=>{const t=!!e.sortKey&&b(e.sortKey);return i(Pe,Object.assign({align:e.align?e.align:"left",sortDirection:t,sx:{width:e.width?`${e.width}%`:"unset"}},{children:i(Fe,Object.assign({active:!!t,hideSortIcon:!e.sortKey,direction:t||"asc",onClick:()=>e.sortKey?h(e.sortKey):{}},{children:e.label}))}),r)}))})}),i(Me,{children:r.map(((r,t)=>i(Ve,Object.assign({hover:!0,onClick:s?()=>s(r):r.onClick,sx:{verticalAlign:c}},{children:e.map(((e,n)=>i(Pe,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]}),n)))}),t)))}),l||a?i(Le,{children:n(Ve,{children:[a&&i(Pe,Object.assign({colSpan:e.length,sx:{background:"#F0F0F7",px:4,py:3}},{children:a})),l&&r.length&&i(ye,{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 St=k(jt),Nt=({actionsList:e})=>{const[r,t]=T(null),a=Boolean(r),l=()=>{t(null)};return n("div",{children:[i(Q,Object.assign({"aria-label":"more",id:"more-button","aria-controls":a?"more-menu":void 0,"aria-expanded":a?"true":void 0,"aria-haspopup":"true",onClick:e=>{e.stopPropagation(),t(e.currentTarget)}},{children:i(qe,{})})),i(Re,Object.assign({id:"more-menu",MenuListProps:{"aria-labelledby":"more-button"},anchorEl:r,open:a,onClose:e=>{e.stopPropagation(),l()},PaperProps:{style:{minWidth:"127px"}}},{children:e.map((e=>i(A,Object.assign({onClick:r=>{r.stopPropagation(),e.onClick&&e.onClick(),l()}},{children:e.title}),e.title)))}))]})},kt=e=>{const{children:r,value:t,index:n}=e,a=g(e,["children","value","index"]);return i("div",Object.assign({role:"tabpanel",hidden:t!==n,id:`simple-tabpanel-${n}`,"aria-labelledby":`simple-tab-${n}`},a,{children:t===n?r:null}))},wt=e=>{var r;const{tabs:t}=e,a=re(),l=te(),o=S((()=>new URLSearchParams(l.search)),[l.search]),s=o.get("tab");return n(u,{children:[i(De,{children:i(Be,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),a({pathname:l.pathname,search:o.toString()},{replace:!0})}},{children:t.map((e=>i(ze,{value:e.name,label:e.label},e.name)))}))}),i(u,Object.assign({mt:2},{children:t.map((e=>{var r;return i(kt,Object.assign({value:s||(null===(r=t[0])||void 0===r?void 0:r.name),index:e.name},{children:e.component}),e.name)}))}))]})};var It=we()((()=>({container:{paddingBottom:"8px"},title:{fontSize:"14px",fontWeight:600,color:"#536DFE"},text:{fontSize:"18px",wordWrap:"break-word"}})));const Mt=({title:e,text:r,json:t})=>{const{classes:a}=It();return n("div",Object.assign({className:a.container},{children:[i("div",Object.assign({className:a.title},{children:e})),r&&i("div",Object.assign({className:a.text},{children:r})),t&&i(oe,{readOnly:!0,value:t,mode:"json",height:"300px",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})]}))},Pt=Object.values(Tr).sort(((e,r)=>e.localeCompare(r)));var At=({propertyFieldName:e})=>{const{control:r}=y();return n(a,{children:[i(We,{children:i(dt,{required:!0,control:r,defaultValue:2,name:`${e}.precisionScale`,label:"Precision Scale"})}),i(We,{children:i(Mr,{required:!0,control:r,name:`${e}.roundingMode`,label:"Rounding Mode",defaultValue:Tr.HALF_UP,options:Pt})})]})};var $t=({propertyFieldName:e,defaultValue:r=""})=>{const{control:t}=y();return i(We,{children:i(Nr,{required:!0,control:t,defaultValue:r,name:`${e}.format`,label:"Format"})})};const Vt=we()((()=>({content:{marginLeft:"4px"},connector:{marginLeft:"4px"},stepper:{padding:"12px"},label:{display:"flex",alignItems:"flex-start"}}))),Ft=()=>i("div",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#536DFE",marginTop:"5px"}}),Lt=({data:e})=>{const{classes:r}=Vt();return n(Ue,Object.assign({nonLinear:!0,orientation:"vertical",className:r.stepper,connector:i(er,{className:r.connector})},{children:[e.filter(Boolean).map(((e,t)=>n(Xe,Object.assign({expanded:!0},{children:[i(Ze,Object.assign({className:r.label,StepIconComponent:Ft,StepIconProps:{icon:"",completed:!1,active:!0}},{children:e.label})),i(Qe,Object.assign({className:r.content},{children:e.content}))]}),t))),i(Xe,{})]}))},Rt=({properties:e=[]})=>{const r=S((()=>e?e.map((e=>{const r="string"==typeof e.propertyType?e.propertyType:e.propertyType.value;return{label:n(u,Object.assign({display:"flex",flexDirection:"column"},{children:[n("b",{children:[e.name,e.isRequired?"*":""]}),n("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," | ",r]})]})),content:"ENTITY"===e.propertyType&&i(Rt,{properties:e.properties})}})):[]),[e]);return i(Lt,{data:r})};var qt=Rt;const Dt={key:"",propertyType:"",name:"",defaultValue:"",isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0};var zt=({parentPropertyFieldName:e,entityDefinition:r=!1,globalParameter:t=!1})=>{const{control:d,setValue:u,getValues:m,trigger:g}=y(),b=f({control:d,name:`${e}.properties`,defaultValue:m(`${e}.properties`)||[]}),v=f({control:d,name:`${e}.name`}),O=wr(),[x,C]=T(0),E=j((()=>{if(b){const r=b.length;u(`${e}.properties.${r}`,Dt),C(r)}else u(`${e}.properties`,[Dt])}),[b,e,u]),S=()=>h(void 0,void 0,void 0,(function*(){(yield g(`${e}.properties`))&&O.onClose()}));return n(a,{children:[i(We,{children:i(se,Object.assign({variant:"h6"},{children:"Properties"}))}),i(We,{children:i(qt,{properties:b})}),i(We,{children:i(l,Object.assign({variant:"contained",color:"primary",onClick:O.onOpen},{children:"Edit properties"}))}),n(o,Object.assign({disableEscapeKeyDown:!0,open:O.open,onClose:S,fullWidth:!0,maxWidth:"md"},{children:[n(p,{children:[v||"Entity"," Properties"]}),i(c,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:n(We,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[n(We,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9"}},{children:[i(Ue,Object.assign({nonLinear:!0,activeStep:x,orientation:"vertical",style:{paddingLeft:"4px"}},{children:b.map(((e,r)=>n(Xe,Object.assign({onClick:()=>(e=>C(e))(r),style:{cursor:"pointer"}},{children:[i(Ze,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:e.name||"(no name)"})),i(Qe,{})]}),r)))})),i(l,Object.assign({variant:"contained",size:"small",color:"primary",onClick:E},{children:"Add property"}))]})),i(We,Object.assign({container:!0,wrap:"nowrap",direction:"column",xs:9,spacing:2,style:{height:"100%",overflowY:"auto"}},{children:i(bi,{hideAddButton:!0,parentFieldName:e,focusOnIndex:x,entityDefinition:r,globalParameter:t})}))]}))})),i(s,{children:i(l,Object.assign({variant:"contained",color:"primary",onClick:S},{children:"Ok"}))})]}))]})};var Bt=({propertyFieldName:e})=>{const{control:r}=y();return n(a,{children:[i(We,{children:i(Nr,{required:!0,control:r,name:`${e}.definitionCode`,label:"Definition Code"})}),i(We,{children:i(Nr,{required:!0,control:r,name:`${e}.definitionVersion`,label:"Definition Version"})}),i(We,{children:i(Nr,{required:!0,control:r,name:`${e}.labelPropertyCode`,label:"Label Property Code"})}),i(We,{children:i(Nr,{required:!0,control:r,name:`${e}.valuePropertyCode`,label:"Value Property Code"})})]})};var Wt=({propertyFieldName:e})=>{const r=S((()=>`${e}.restrictedValues`),[e]),{control:t,setValue:l,getValues:o}=y(),s=f({control:t,name:r,defaultValue:o(`${e}.restrictedValues`)||[]}),[c,d]=T(""),[p,m]=T(""),g=j((e=>{l(r,Dr(s,e))}),[s,r,l]),h=()=>{c&&(l(r,[...s,c]),d(""))};return n(a,{children:[i(We,{children:i(se,Object.assign({variant:"h6"},{children:"Restricted Values"}))}),!!(null==s?void 0:s.length)&&i(We,{children:i(u,Object.assign({display:"flex",flexWrap:"wrap"},{children:s.map(((e,r)=>i(rr,{sx:{mr:1},variant:"outlined",label:e,onDelete:()=>g(r)},r)))}))}),i(We,{children:i(O,{fullWidth:!0,variant:"outlined",size:"small",label:"Add restricted value",value:c,onChange:e=>{const{value:r}=e.target;d(r),s.includes(r)?m("This value already exists"):m("")},error:!!p,helperText:p,name:"restrictedValues",inputProps:{onKeyDown:e=>{"Enter"===e.key&&h()}},InputProps:{endAdornment:i(Q,Object.assign({size:"small",onClick:h,disabled:!!p},{children:i(tr,{})}))}})})]})};const Gt=({propertyType:e,propertyFieldName:r,entityDefinition:t=!1,globalParameter:n=!1})=>{switch(e){case Or.STRING:return i(Wt,{propertyFieldName:r});case Or.BIG_DECIMAL:return i(At,{propertyFieldName:r});case Or.DATE:return i($t,{propertyFieldName:r,defaultValue:xr});case Or.TIME:return i($t,{propertyFieldName:r,defaultValue:Cr});case Or.DATE_TIME:return i($t,{propertyFieldName:r,defaultValue:Er});case Or.ENTITY_REFERENCE:return i(Bt,{propertyFieldName:r});case Or.ENTITY:return i(zt,{parentPropertyFieldName:r,globalParameter:n,entityDefinition:t});default:return null}};var Jt=({validate:e=!1,name:r,inputRef:t})=>{const{control:n,setValue:a,setError:l,clearErrors:o}=y(),s=f({control:n,name:r});return i(oe,{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},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 Ht=({name:e,label:r,required:t,restrictedValues:a})=>{const{control:l}=y(),{field:{onChange:o,ref:s},fieldState:{error:c}}=b({control:l,name:e,rules:{required:t&&(Array.isArray(a)&&a.length?"Please, select a value":"Please, fill this field")}}),d=f({control:l,name:e});return Array.isArray(a)&&a.length?n(z,Object.assign({fullWidth:!0,size:"small",variant:"outlined",error:!!c},{children:[i(nr,Object.assign({htmlFor:"type-select"},{children:r})),i(ir,Object.assign({labelId:"type-select",label:r,value:d||"",onChange:o,ref:s},{children:a.map((e=>i(A,Object.assign({value:e},{children:e}),e)))}))]})):i(Nr,{hideErrorMessage:!0,required:t,control:l,name:e,label:r})};const _t=({property:e,name:r,label:t,useExpression:n,inputRef:a})=>{const{control:l}=y();switch(S((()=>"string"==typeof e.propertyType?e.propertyType:e.propertyType.value),[e])){case Or.BIG_DECIMAL:case Or.FLOAT:case Or.DOUBLE:return i(dt,{decimal:!0,required:!0,hideErrorMessage:!0,control:l,name:r,label:t});case Or.INTEGER:case Or.BIG_INTEGER:case Or.LONG:return i(dt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t});case Or.BOOLEAN:return i(pt,{control:l,name:r});case Or.DATE:return i(ut,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case Or.TIME:return i(gt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case Or.DATE_TIME:return i(mt,{required:!0,hideErrorMessage:!0,control:l,name:r,label:t,format:e.format});case Or.JSON:return i(Jt,{validate:!0,name:r,inputRef:a});case Or.STRING:return i(Ht,{required:!0,name:r,label:t,restrictedValues:e.restrictedValues});case Or.ENTITY_REFERENCE:return i(Nr,{required:!0,hideErrorMessage:!0,name:r,label:t,control:l});case Or.ANY:return i(Jt,{name:r,inputRef:a});case Or.ENTITY:return i(ji,{properties:e.properties,dataFieldName:r,useExpression:n});default:return i("div",{children:"No widget"})}};var Yt=({value:e,property:r,label:t,isDirty:i,required:n=!1,useExpression:a=!1,multipleOptions:l=!1})=>{const o=S((()=>t?`${t} (value)`:`${r.name} (value)`),[t,r]),s=S((()=>t?`${t} (widget)`:`${r.name} (widget)`),[t,r]),c=S((()=>"string"==typeof r.propertyType?r.propertyType:r.propertyType.value),[r]),[d,p]=T(null),u=S((()=>l?st({propertyType:c,required:n,useExpression:a}):ct({propertyType:c,required:n,useExpression:a})),[a,n,c,l]);return E((()=>{d?i||(Qr(e)&&"expression"!==d?p("expression"):null==e||Qr(e)||"widget"===d||p("widget")):rt(e)&&(null==u?void 0:u.length)?p(u[0].value):a&&Qr(e)?p("expression"):p("widget")}),[e,d,u,a,i]),{propertyType:c,valueLabel:o,fillOptionLabel:s,fillOption:d,fillOptions:u,setFillOption:p}};var Kt=we()((()=>({inputLabel:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"}})));const Ut=({property:e,name:r,useExpression:t,label:a,required:l,title:o})=>{const{control:s,clearErrors:c,register:d}=y(),{field:{ref:p,onChange:m},fieldState:{error:g,isDirty:h}}=b({name:r}),v=f({control:s,name:r}),{propertyType:O,valueLabel:x,fillOptionLabel:C,fillOption:T,fillOptions:j,setFillOption:S}=Yt({value:v,property:e,isDirty:h,label:a,required:l,useExpression:t});E((()=>{void 0===v&&m(null)}),[v,m]);const{classes:N}=Kt();return n(We,Object.assign({xs:12},{children:[o&&i(u,Object.assign({mb:2},{children:i(se,Object.assign({variant:"h6"},{children:o}))})),j?i(u,Object.assign({mb:2},{children:n(z,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(nr,Object.assign({htmlFor:"type-select",className:N.inputLabel},{children:C})),i(ir,Object.assign({labelId:"type-select",label:C,value:T||"",onChange:e=>{const t=e.target.value;"null"===t?d(r,{value:null}):"widget"===t?m(null):"expression"!==t&&"string"!==t||m(""),S(t),c(r)}},{children:j.map((e=>i(A,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===T&&(O===Or.JSON||O===Or.ENTITY||O===Or.ANY?i(Jt,{name:r,inputRef:p}):i(Nr,{control:s,name:r,label:x,required:!0,hideErrorMessage:!0})),"string"===T&&i(Nr,{control:s,name:r,label:x,required:!0,hideErrorMessage:!0}),"json_notvalid"===T&&i(Jt,{name:r,inputRef:p}),"widget"===T&&i(_t,{property:e,name:r,useExpression:t,label:x,inputRef:p,required:l}),g&&i(se,Object.assign({color:"secondary"},{children:g.message}))]}))};var Xt=({name:e,property:r,useExpression:t,required:a,label:o})=>{const{control:s,setValue:c,clearErrors:d}=y();b({control:s,name:e,rules:{validate:e=>!(!e||Array.isArray(e)&&!e.length)||"Please, fill array"}});const p=f({control:s,name:e}),m=j((()=>{p&&Array.isArray(p)?c(`${e}.${p.length}`,null):c(e,[null]),d(e)}),[e,p,c,d]),g=j((r=>{c(e,Dr(p,r))}),[e,p,c]);return n(We,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[p&&Array.isArray(p)?p.map(((l,s)=>i(We,Object.assign({xs:12},{children:n(u,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[i(Ut,{required:a,property:r,useExpression:t,name:`${e}.${s}`,label:`${o||r.name} (${s+1})`}),i(u,Object.assign({mt:"8px",ml:"4px"},{children:i(Q,Object.assign({size:"small",onClick:()=>g(s)},{children:i(ar,{fontSize:"small"})}))}))]}))}),s))):null,i(We,{children:i(l,Object.assign({variant:"contained",size:"small",color:"primary",onClick:m},{children:"Add value"}))})]}))};const Zt=({property:e,name:r,useExpression:t,required:a,label:l,title:o})=>{const{control:s,clearErrors:c}=y(),{field:{ref:d,onChange:p},fieldState:{error:m,isDirty:g}}=b({control:s,name:r,rules:{validate:e=>!(a&&!e)||"Please, fill this field"}}),h=f({control:s,name:r}),{propertyType:v,valueLabel:O,fillOptionLabel:x,fillOption:C,fillOptions:T,setFillOption:j}=Yt({property:e,value:h,isDirty:g,label:l,required:a,useExpression:t,multipleOptions:!0});E((()=>{void 0===h&&p(null)}),[h,p]);const{classes:S}=Kt();return n(We,{children:[o&&i(u,Object.assign({mb:2},{children:i(se,Object.assign({variant:"h6"},{children:o}))})),T?i(u,Object.assign({mb:2},{children:n(z,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[i(nr,Object.assign({htmlFor:"type-select",className:S.inputLabel},{children:x})),i(ir,Object.assign({labelId:"type-select",label:x,value:C||"",onChange:e=>{const t=e.target.value;"null"===t?p(null):"expression"===t||"json_valid"===t||"json_notvalid"===t?p(""):"widget"===t&&p([]),j(t),c(r)}},{children:T.map((e=>i(A,Object.assign({value:e.value},{children:e.label}),e.value)))}))]}))})):null,"expression"===C&&(v===Or.JSON||v===Or.ENTITY||v===Or.ANY?i(Jt,{name:r,inputRef:d}):i(Nr,{required:!0,hideErrorMessage:!0,control:s,name:r,label:O})),"json_valid"===C&&i(Jt,{validate:!0,name:r,inputRef:d}),"widget"===C&&i(Xt,{property:e,name:r,useExpression:t,required:a,label:l}),m&&i(se,Object.assign({color:"secondary"},{children:m.message}))]})},Qt=({propertyFieldName:e,name:r,label:t="",required:n})=>{const{control:a}=y(),l=f({control:a,name:`${e}.propertyType`}),o=f({control:a,name:`${e}.isMultiple`}),s=f({control:a,name:`${e}.format`}),c=f({control:a,name:`${e}.restrictedValues`}),d=f({control:a,name:`${e}.properties`}),p=f({control:a,name:`${e}.isRequired`}),u=S((()=>{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 i(o?Zt:Ut,{name:r,property:u,title:t,required:n})};var ei=({name:e})=>{const r=S((()=>({type:""})),[]),{control:t}=y(),{fields:a,append:o,remove:s}=v({control:t,name:e});return n(u,Object.assign({mt:2},{children:[i(l,Object.assign({variant:"outlined",size:"small",onClick:()=>o(r)},{children:"Add node"})),a.map((({id:r},t)=>i(ci,{removeHandle:()=>s(t),name:`${e}.${t}`},r)))]}))};const ri=w(""),ti=({name:e,control:r})=>n(a,{children:[i(se,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),i(u,{children:i(Nr,{control:r,name:`${e}.minimumLength`,label:"Minimum Length",type:"number"})}),i(u,Object.assign({mt:2},{children:i(Nr,{control:r,name:`${e}.maximumLength`,label:"Maximum Length",type:"number"})}))]}),ii=({name:e,control:r})=>n(a,{children:[i(se,Object.assign({variant:"body2",gutterBottom:!0},{children:"Node"})),i(u,{children:i(Nr,{control:r,name:`${e}.multipleOf`,label:"Multiple Of",type:"number"})}),i(u,Object.assign({mt:2},{children:i(Nr,{control:r,name:`${e}.minimum`,label:"Minimum",type:"number"})})),i(u,Object.assign({mt:2},{children:i(Nr,{control:r,name:`${e}.maximum`,label:"Maximum",type:"number"})})),n(u,Object.assign({mt:2},{children:[i(Pr,{control:r,name:`${e}.exclusiveMinimum`,label:"Exclusive Minimum",defaultValue:"false"}),i(Pr,{control:r,name:`${e}.exclusiveMaximum`,label:"Exclusive Maximum",defaultValue:"false"})]}))]}),ni=["STRING_REGEX","JSON_SCHEMA"],ai=new Set([Or.INTEGER,Or.FLOAT,Or.DOUBLE,Or.BIG_DECIMAL,Or.BIG_INTEGER,Or.LONG]);var li=({name:e})=>{const{control:r,setValue:t}=y(),l=I(ri),o=f({control:r,name:`${e}.type`}),s=S((()=>{if("STRING_REGEX"===o)return i(Nr,{control:r,name:`${e}.pattern`,label:"Pattern"});if("JSON_SCHEMA"===o)switch(!0){case l===Or.STRING:return i(ti,{name:`${e}.node`,control:r});case ai.has(l):return i(ii,{name:`${e}.node`,control:r});case l===Or.JSON:return i(qr,{label:"Properties",control:r,name:`${e}.properties`,validateJson:!0,parseValue:!0});default:return"Not available for type "+l}return null}),[l,o,r,e]);return E((()=>{ai.has(l)&&"JSON_SCHEMA"===o&&(t(`${e}.node.exclusiveMinimum`,!1),t(`${e}.node.exclusiveMaximum`,!1))}),[l,o,t,e]),i(Lt,{data:[{label:"Validator",content:n(a,{children:[i(u,{children:i(Mr,{control:r,name:`${e}.type`,label:"Type",options:ni,onChange:r=>{t(e,{}),t(`${e}.type`,r.target.value)}})}),i(u,Object.assign({mt:2},{children:s}))]})}]})};const oi=["AND","OR","NOT","NODE"],si=({name:e,removeHandle:r})=>{const{control:t}=y(),l=f({control:t,name:`${e}.type`}),o=S((()=>({AND:i(ei,{name:`${e}.nodes`}),OR:i(ei,{name:`${e}.nodes`}),NODE:i(li,{name:`${e}.validator`}),NOT:i(si,{name:`${e}.node`})})),[e]);return i(Lt,{data:[{label:"Node Type",content:n(a,{children:[n(u,Object.assign({display:"flex",alignItems:"center"},{children:[i(Mr,{required:!0,control:t,name:`${e}.type`,label:"Type",options:oi}),r&&i(u,Object.assign({ml:2},{children:i(Q,Object.assign({onClick:r,color:"primary"},{children:i(Ke,{})}))}))]})),i(u,{children:o[l]})]})}]})};var ci=si;const di=({name:e})=>{const[r,t]=T(!1),{setValue:l,getValues:o}=y(),s=j((r=>{t(r.target.checked),r.target.checked||l(e,null)}),[l,e]);return E((()=>{o(e)&&t(!0)}),[e,o]),n(a,{children:[n(u,Object.assign({display:"flex",justifyContent:"space-between"},{children:[i(se,Object.assign({variant:"h6"},{children:"Validator"})),i(B,{label:"Enable",control:i(G,{color:"primary",checked:r,onChange:s})})]})),r&&i(ci,{name:e})]})};var pi=({name:e,label:r="",propertyFieldName:t,type:n,decimal:a=!1,options:l=[],required:o=!1})=>{const{control:s}=y(),c=S((()=>`${t}.${e}`),[e,t]);switch(n){case"text":return i(Nr,{control:s,name:c,label:r,required:o});case"number":return i(dt,{control:s,name:c,label:r,decimal:a,required:o});case"select":return i(Mr,{control:s,name:c,label:r,options:l,required:o});case"autocomplete":return i(Vr,{control:s,name:c,label:r,options:l,required:o});case"json":return i(qr,{control:s,name:c,label:r,mode:"json",required:o});default:return null}};var ui=e=>({customCheckboxes:S((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:S((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e])});const mi=Object.values(Or).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))})));var gi=({propertyFieldName:e,entityDefinition:r=!1,globalParameter:t=!1,customPropertyFields:l=[]})=>{var o;const{control:s,setValue:c}=y(),d=f({control:s,name:`${e}.propertyType`}),p=f({control:s,name:`${e}.isMultiple`}),u=f({control:s,name:`${e}.isRequired`}),{customCheckboxes:m,customFields:g}=ui(l),h=S((()=>{let e=t?"Value":"Default Value";return p&&(e+="s"),e}),[t,p]);return E((()=>{d&&"string"==typeof d&&c(`${e}.propertyType`,mi.find((e=>e.value===d)))}),[d,c,e]),n(We,Object.assign({container:!0,direction:"column",spacing:2},{children:[i(We,{children:i(Ir,{required:!0,control:s,name:`${e}.key`,label:"Key"})}),i(We,{children:i(Ir,{required:!0,control:s,name:`${e}.name`,label:"Name"})}),i(We,{children:i(Vr,{required:!0,control:s,name:`${e}.propertyType`,label:"Type",options:mi,onChange:(r,i)=>{const n=`${e}.propertyType`,a=`${e}.${t?"value":"defaultValue"}`;c(a,p?[]:null),c(n,i)}})}),i(We,{children:i(dt,{required:!0,control:s,name:`${e}.sortOrder`,label:"Sort Order"})}),i(We,{children:i(qr,{control:s,name:`${e}.uiSettings`,label:"UI Settings",validateJson:!0})}),n(We,{children:[i(Pr,{control:s,name:`${e}.isMultiple`,label:"Multiple"}),i(Pr,{control:s,name:`${e}.isEnabled`,label:"Enabled"}),i(Pr,{control:s,name:`${e}.isRequired`,label:"Required"}),r&&i(Pr,{control:s,name:`${e}.isViewableInList`,label:"Is viewable in list"}),m.length?i(a,{children:m.map(((r,t)=>i(Pr,{control:s,name:`${e}.${r.name}`,label:r.label},t)))}):null]}),d&&n(a,{children:[i(We,{children:i(ri.Provider,Object.assign({value:null!==(o=d.value)&&void 0!==o?o:d},{children:i(di,{name:`${e}.validationNode`})}))}),i(Gt,{propertyType:"string"==typeof d?d:d.value,propertyFieldName:e,globalParameter:t,entityDefinition:r}),i(Qt,{propertyFieldName:e,name:`${e}.${t?"value":"defaultValue"}`,label:h,required:!!t&&u})]}),g.length?i(a,{children:g.map(((r,t)=>i(We,{children:i(pi,Object.assign({},r,{propertyFieldName:e}))},t)))}):null]}))};const hi={key:"",propertyType:null,name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},bi=({parentFieldName:e,hideAddButton:r,focusOnIndex:t,required:o,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[]})=>{const p=S((()=>e?`${e}.properties`:"properties"),[e]),{setValue:u,clearErrors:m,control:g}=y(),{fieldState:{error:h}}=b({control:g,name:p,rules:{required:o&&"Please, add properties"}}),v=f({control:g,name:p}),O=C([]);E((()=>{"number"==typeof t&&O.current[t]&&O.current[t].scrollIntoView({behavior:"smooth",block:"start"})}),[t,O]);const x=j((()=>{v?u(`${p}.${v.length}`,hi):u(p,[hi]),m(p)}),[v,p,m,u]),T=j((e=>{u(`${p}`,Dr(v,e))}),[v,p,u]);return n(a,{children:[h&&h.message&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(se,Object.assign({color:"secondary"},{children:h.message}))})),v&&v.map(((e,r)=>i(We,Object.assign({sm:12,md:8,lg:6,ref:e=>O.current[r]=e},{children:n(Ge,Object.assign({defaultExpanded:!0,elevation:3},{children:[i(Je,Object.assign({expandIcon:i(Ye,{})},{children:i(se,Object.assign({color:h&&h[r]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:e.name||`Property ${r+1}`}))})),i(He,{children:i(gi,{propertyFieldName:`${p}.${r}`,entityDefinition:s,globalParameter:c,customPropertyFields:d})}),i(_e,{children:i(l,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>T(r)},{children:"Remove"}))})]}))}),r))),!r&&i(We,Object.assign({xs:12},{children:i(l,Object.assign({variant:"contained",size:"small",color:"primary",onClick:x},{children:"Add property"}))}))]})},fi=({definitionFieldName:e,title:r,hideCodeField:t,hideVersionField:a,hideNameField:l,required:o=!1})=>{const{control:s}=y();return n(We,Object.assign({container:!0,direction:"column",spacing:2},{children:[r&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(u,Object.assign({my:2},{children:i(se,Object.assign({variant:"h4"},{children:r}))}))})),!l&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(Nr,{required:!0,control:s,name:e?`${e}.name`:"name",label:"Name"})})),!t&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(Nr,{required:!0,control:s,name:e?`${e}.code`:"code",label:"Code"})})),!a&&i(We,Object.assign({sm:12,md:8,lg:6},{children:i(dt,{required:!0,control:s,name:e?`${e}.version`:"version",label:"Version"})})),i(bi,{required:o,parentFieldName:e})]}))},yi={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"},vi=({value:e,type:r})=>r!==Or.JSON&&r!==Or.ENTITY&&r!==Or.ANY||!e?i(se,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===e?"null":e.toString()})):i(_r,{value:e}),Oi=(e,r,t)=>{switch(r){case"isRequired":case"isMultiple":case"isEnabled":case"isViewableInList":return e?i(lr,{color:"primary",fontSize:"small"}):null;case"restrictedValues":return e?i(u,Object.assign({display:"flex",flexWrap:"wrap"},{children:e.map((e=>i(rr,{label:e,style:{wordBreak:"break-word",maxWidth:"500px"}},e)))})):null;case"defaultValue":case"value":return i(vi,{value:e,type:t});case"values":case"defaultValues":return Array.isArray(e)&&t!==Or.ENTITY&&t!==Or.JSON&&t!==Or.ANY?n("div",{children:["[",null==e?void 0:e.map(((e,r)=>i("div",{children:i(vi,{value:e,type:t})},r))),"]"]}):i(_r,{value:e});case"uiSettings":case"validationNode":return e?i(_r,{value:e}):null;default:return i(se,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:e}))}};var xi=({property:e})=>{const r=S((()=>(e&&(e.isMultiple?(delete e.defaultValue,delete e.value):(delete e.defaultValues,delete e.values)),e)),[e]);return i(Ie,Object.assign({size:"small"},{children:i(Me,{children:Object.keys(yi).map((e=>e in r?n(Ve,{children:[i(Pe,Object.assign({width:"30%"},{children:i(se,{children:yi[e]})})),i(Pe,{children:Oi(r[e],e,r.propertyType)})]},e):null))})}))};var Ci=M((({properties:e,parentNames:r=[]})=>{const t=S((()=>{let r=!1;return e.every((e=>e.propertyType!==Or.ENTITY||(r=!0,!1))),r}),[e]);return n(u,Object.assign({mt:4},{children:[i(se,Object.assign({variant:"h6"},{children:"Properties"})),n(Ue,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[e.map((e=>n(Xe,Object.assign({expanded:!0},{children:[i(Ze,{StepIconProps:{icon:"",completed:!1,active:!0}}),i(Qe,{children:i(Ei,{property:e,parentNames:[...r],defaultExpanded:!1})})]}),e.key))),t&&i(Xe,{})]}))]}))}));const Ei=({property:e,parentNames:r=[],defaultExpanded:t=!0})=>{const[a,l]=T(!0);return E((()=>{l(t)}),[t]),n(Ge,Object.assign({elevation:3,style:{backgroundColor:r.length%2==1?"#f1f1f1":"#fff"},expanded:a,onChange:()=>l((e=>!e))},{children:[i(Je,Object.assign({expandIcon:i(Ye,{})},{children:i(se,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:e.name}))})),i(He,{children:n(u,Object.assign({width:"100%"},{children:[i(xi,{property:e}),e.propertyType===Or.ENTITY&&i(Ci,{properties:at(e.properties),parentNames:[...r,e.name]})]}))})]}))},Ti=({properties:e,expandAll:r=!0})=>{const t=S((()=>Array.isArray(e)?e:e?at(e):[]),[e]);return i(u,Object.assign({display:"flex",flexDirection:"column"},{children:t.length?t.map((e=>i(Ei,{property:e,defaultExpanded:r},e.key))):i(se,{children:"No properties"})}))},ji=({properties:e,dataFieldName:r,useExpression:t=!1,title:a})=>{const l=S((()=>e?e.map((e=>{const a="string"==typeof e.propertyType?e.propertyType:e.propertyType.value;return{label:n(u,Object.assign({display:"flex",flexDirection:"column"},{children:[n("b",{children:[e.name,e.isRequired?"*":""]}),n("span",{children:[e.key," | ",e.isMultiple?"multiple":"single"," | ",a]})]})),content:e.isMultiple?i(Zt,{property:e,name:`${r}.${e.key}`,useExpression:t,label:e.name,required:e.isRequired}):i(Ut,{property:e,name:`${r}.${e.key}`,useExpression:t,label:e.name,required:e.isRequired})}})):[]),[e,r,t]);return n(We,Object.assign({container:!0,direction:"column",spacing:2},{children:[a&&i(We,Object.assign({xs:12},{children:i("div",Object.assign({style:{fontWeight:"600"}},{children:a}))})),i(Lt,{data:l})]}))},Si=({property:e,data:r,properties:t})=>{const n=e=>i(u,Object.assign({style:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"4px"}},{children:null===e?"null":null==e?void 0:e.toString()}));if(Qr(r))return n(r);switch(e.propertyType){case Or.JSON:return i(_r,{value:r});case Or.ENTITY:return i(ki,{properties:t,data:r});case Or.ANY:return"object"==typeof r?i(_r,{value:r}):n(r);default:return n(r)}};var Ni=({property:e,data:r,hasBackground:t=!1})=>{const n=S((()=>e.propertyType===Or.ENTITY?Array.isArray(e.properties)?e.properties:at(e.properties):[]),[e]);return i(u,Object.assign({style:{backgroundColor:t?"#f1f1f1":"none"}},{children:i(Si,{property:e,data:r,properties:n})}))};const ki=({properties:e,data:r})=>{const t=S((()=>e&&r?e.map((e=>{var t;const{key:l,name:o,isMultiple:s,propertyType:c}=e,d=null!==(t=r[e.key])&&void 0!==t?t:r;return{label:n(u,Object.assign({display:"flex",flexDirection:"column"},{children:[i("b",{children:o}),n("span",{children:[l," | ",s?"multiple":"single"," | ",c]})]})),content:s&&Array.isArray(d)&&e.propertyType!==Or.ANY?i(a,{children:d.map(((r,t)=>i(u,Object.assign({mb:2},{children:i(Ni,{property:e,data:r,hasBackground:!0})}),t)))}):i(Ni,{property:e,data:d})}})):[]),[e,r]);return i(We,Object.assign({container:!0,direction:"column",spacing:2},{children:i(Lt,{data:t})}))};var wi=we()((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 Ii=({text:e,status:r="default"})=>{const{classes:t}=wi();return i("div",Object.assign({className:or(t.root,{[r]:!0})},{children:e}))},Mi=we()((()=>({propertyStepLabel:{"&:hover":{fontWeight:"600",cursor:"pointer"}}}))),Pi=({properties:e,parentKey:r="",activePath:t="",prefix:a="",onClick:l})=>{const{classes:o}=Mi();return i(Ue,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 n(Xe,Object.assign({expanded:!0,onClick:()=>{return e=c,void l(a?`${a}.${e}`:e);var e}},{children:[i(Ze,Object.assign({StepIconProps:{icon:"",completed:!1,active:t===c}},{children:n("div",Object.assign({className:o.propertyStepLabel},{children:[e.name," - ",e.key," - ",d]}))})),i(Qe,{children:i("div",{children:d===Or.ENTITY&&i(Pi,{onClick:l,activePath:t,properties:e.properties,parentKey:c},e.key)})})]}),e.key)}))}))};var Ai=Pi;const $i=({open:e=!1,onClose:r,onPaste:t,properties:a})=>{const[d,u]=T("");return n(o,Object.assign({open:e,onClose:r,fullWidth:!0,maxWidth:"md"},{children:[i(p,{children:"JSON path picker"}),n(c,{children:[(null==a?void 0:a.length)?a.map(((e,r)=>n("div",{children:[i(se,Object.assign({variant:"h6"},{children:e.title})),i(Ai,{properties:e.properties,prefix:e.pathPrefix,onClick:u,activePath:d})]},r))):i(se,{children:"Please, add properties"}),d&&n(se,Object.assign({variant:"h6",gutterBottom:!0},{children:["Selected path : $(",d,")"]}))]}),n(s,{children:[i(l,Object.assign({variant:"contained",color:"primary",onClick:()=>{navigator.clipboard.writeText(`$(${d})`),sr.success("Copied!")}},{children:"Copy"})),i(l,Object.assign({variant:"contained",color:"primary",onClick:()=>{t(`$(${d})`),sr.success("Pasted!")}},{children:"Paste"})),i(l,Object.assign({variant:"contained",color:"secondary",onClick:r},{children:"Close"}))]})]}))},Vi=D(dr)((e=>({width:248,flexShrink:0,"& .MuiDrawer-paper":{backgroundColor:e.theme.palette.secondary.main,width:248,boxSizing:"border-box",borderRight:"none",borderRadius:0}}))),Fi=D(gr)((({theme:e})=>({borderRadius:e.spacing(2.5),padding:e.spacing(2,0,2,2),textAlign:"left","&.active":{backgroundColor:"rgba(38, 40, 66, 0.12)","&.main":{backgroundColor:"rgba(255, 255, 255, 0.12)",boxShadow:"-4px 0 0 0px #E0613A"}}}))),Li=D(pr)((e=>({padding:e.theme.spacing(3,3,3,4),margin:0}))),Ri=D(ur)((e=>({color:"#fff"}))),qi=D(mr)((()=>({color:"#fff",minWidth:28,"& svg":{fill:"#fff",color:"#fff"}}))),Di=D(hr)((()=>({backgroundColor:"inherit",color:"#fff"})));var zi=({route:e,isActive:r})=>e.link?i(Ri,Object.assign({disablePadding:!0},{component:ie,replace:!0,to:{pathname:e.link,search:e.query}},{children:n(Fi,Object.assign({className:or({active:r,main:e.main})},{children:[e.icon&&i(qi,{children:e.icon}),i(fr,{primary:e.name,primaryTypographyProps:{variant:"body2"}})]}))})):i(Di,{children:e.name});function Bi({route:e,isActive:r,isListOpen:t,handleClick:a}){return(null==e?void 0:e.link)?i(Ri,Object.assign({disablePadding:!0,onClick:a},{children:n(Fi,Object.assign({className:or({active:r,main:e.main})},{children:[e.icon&&i(qi,{children:e.icon}),i(fr,{primary:e.name,primaryTypographyProps:{variant:"body2"}}),i(u,{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})`}})]}))})):i(Di,{children:e.name})}const Wi=({route:e})=>{var r,t;const l=te(),[o,s]=T(!1),c=S((()=>!!e.link&&l.pathname.startsWith(e.link)),[l.pathname,e]);return E((()=>{s(c)}),[c]),(null===(r=e.children)||void 0===r?void 0:r.length)?n(a,{children:[i(Bi,{route:e,isActive:c,handleClick:()=>{s(!o)},isListOpen:o||!e.link}),i(br,Object.assign({in:o||!e.link,timeout:"auto"},{children:i(pr,Object.assign({component:"div",disablePadding:!0},{children:null===(t=e.children)||void 0===t?void 0:t.map(((e,r)=>i(Wi,{route:e},r)))}))}))]}):i(zi,{route:e,isActive:c})};var Gi=Wi;var Ji=e({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",fontSize:14,h1:{fontWeight:400},h3:{fontWeight:500},h4:{fontWeight:500}}});var Hi={components:{MuiButton:{styleOverrides:{root:{lineHeight:1.429}}},MuiInputBase:{styleOverrides:{root:{borderRadius:Ji.spacing(3),minWidth:Ji.spacing(25),background:Ji.palette.background.default},input:{minWidth:Ji.spacing(25)}}},MuiSelect:{styleOverrides:{nativeInput:{padding:0,height:"32px"}}},MuiTextField:{styleOverrides:{root:{minWidth:Ji.spacing(25)}}},MuiInputLabel:{styleOverrides:{root:{position:"relative",overflow:"initial",transform:"none",marginBottom:Ji.spacing(1),fontWeight:500,fontSize:"14px",lineHeight:"20px"}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:Ji.spacing(3),minWidth:Ji.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 _i={components:{MuiTableContainer:{styleOverrides:{root:{borderRadius:Ji.spacing(3),border:"1px solid rgba(38, 40, 66, 0.08)"}}},MuiTableHead:{styleOverrides:{root:{backgroundColor:"#F7F8FC"}}},MuiTableCell:{styleOverrides:{root:{minHeight:48,padding:Ji.spacing(1,2),"&:first-of-type":{paddingLeft:Ji.spacing(4)}},head:{maxHeight:"40px",padding:Ji.spacing(2.75,2),color:"#6D6E85"},body:{wordBreak:"break-all"}}},MuiTableSortLabel:{styleOverrides:{root:{maxHeight:"24px",lineHeight:1}}}}};var Yi={components:{MuiStepIcon:{styleOverrides:{root:{fontSize:"20px",color:Ji.palette.text.disabled,"&.Mui-active, &.Mui-completed":{color:Ji.palette.secondary.main}}}}}};var Ki={components:{MuiTypography:{styleOverrides:{h1:{[Ji.breakpoints.up("lg")]:{fontSize:"1.5rem"}},h3:{fontSize:"1.25rem",[Ji.breakpoints.up("lg")]:{fontSize:"1.125rem"}},h4:{fontSize:"1rem",[Ji.breakpoints.up("lg")]:{fontSize:"1rem"}},subtitle2:{color:"#6D6E85"}}}}};const Ui=r(e(Ji,{components:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Hi.components),_i.components),Yi.components),Ki.components),{MuiToolbar:{styleOverrides:{root:{[Ji.breakpoints.up("sm")]:{minHeight:"56px"}}}},MuiAppBar:{styleOverrides:{root:{boxShadow:"none",backgroundColor:"#007F9B"}}},MuiButton:{styleOverrides:{root:{borderRadius:Ji.spacing(2.5),padding:Ji.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:Ji.palette.secondary.dark}}},MuiDialog:{styleOverrides:{root:{"& .MuiModal-backdrop":{background:"rgba(28, 55, 77, 0.5)",backdropFilter:"blur(2px)"}},paper:{borderRadius:Ji.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:Ji.spacing(3,6)}}},MuiTabs:{styleOverrides:{root:{minHeight:"38px"},indicator:{backgroundColor:Ji.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:Ji.palette.secondary.main}}}}})})),Xi=({routes:e,theme:r})=>{const a=r||Ui;return i(t,Object.assign({theme:a},{children:i(ae,{children:n(Vi,Object.assign({variant:"permanent",anchor:"left"},{children:[i(cr,Object.assign({sx:{backgroundColor:a.palette.background.default,borderRight:"1px solid rgba(38, 40, 66, 0.08)",fontSize:24,fontWeight:600}},{children:"Fin tech LAB"})),i(Li,{children:e.map(((e,r)=>i(Gi,{route:e},r)))})]}))})}))},Zi=({children:e,toolbar:r,contentSx:t})=>n(u,Object.assign({component:"main",sx:{flexGrow:1,bgcolor:"background.default"}},{children:[i(cr,Object.assign({sx:{borderBottom:"1px solid rgba(38, 40, 66, 0.08)"}},{children:r})),i(u,Object.assign({sx:Object.assign(Object.assign({},t),{height:"calc(100vh - 56px)",overflow:"scroll"})},{children:i(P,Object.assign({fallback:i(jr,{})},{children:null!=e?e:i(le,{})}))}))]}));export{Sr as AlertDialog,Rr as BackButton,Zi as ContentLayout,qr as ControlAceEditor,Vr as ControlAutocomplete,Pr as ControlCheckbox,ut as ControlDate,mt as ControlDateTime,Ir as ControlDebouncedInput,Nr as ControlInput,dt as ControlNumberInput,Fr as ControlQueryAutocomplete,Ar as ControlRadio,Mr as ControlSelect,pt as ControlSwitch,gt as ControlTime,Lr as CopyButton,fi as CreateDefinition,bi as CreatePropertiesList,xr as DATE_DEFAULT_FORMAT,Er as DATE_TIME_DEFAULT_FORMAT,ji as DefinitionFiller,ki as DefinitionValueView,Mt as InfoItem,Yr as JsonModalView,$i as JsonPathPicker,_r as JsonView,jr as Loader,Zt as MultiplePropertyFiller,Ut as PropertyFiller,Or as PropertyType,Qt as PropertyValueField,Tr as RoundingMode,wt as RouteTabs,Xi as Sidebar,St as SimpleTable,Ii as Status,Lt as StepperView,Cr as TIME_DEFAULT_FORMAT,kt as TabPanel,xt as Table,Ct as TableAction,Nt as TableActionCell,Ti as ViewPropertiesList,Ei as ViewProperty,Br as capitalize,Hr as deepParseJson,Xr as digitsOnly,Zr as floatsOnly,it as formatDefinitionData,Ur as formatTableRowValue,lt as getDemPropertyDateFormat,ot as getEntityStarterValue,Gr as getJsonStringValue,st as getMultiplePropertyFillOptions,ct as getSinglePropertyFillOptions,et as isDateType,Qr as isExpression,rt as isPropertyValueEmpty,nt as propertiesArrayToObject,at as propertiesObjectToArray,Dr as removeArrayItem,Jr as safeParseJson,Wr as sortArrayOfObjects,Ui as theme,kr as useDebounce,wr as useToggle,zr as validateJson};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "0.3.29",
3
+ "version": "0.3.31",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"