moorr-react-mui 0.3.19 → 0.3.20

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.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- import e,{forwardRef as t,useMemo as n,useCallback as o,createContext as r,useContext as i,useState as l,useRef as a,useEffect as s,useImperativeHandle as d}from"react";import c from"@mui/material/Button";import{useMediaQuery as u,Typography as m,ClickAwayListener as p,SpeedDial as h,Box as g,SpeedDialIcon as v,SpeedDialAction as f,Slide as b,Icon as y,IconButton as x,Button as E}from"@mui/material";import{integers as w,utils as M,dates as C,decimals as k,strings as T}from"moorr-common";import N from"@mui/material/IconButton";import S from"@material-ui/core/MenuItem";import{makeStyles as O,createStyles as F,withStyles as P,StylesProvider as D}from"@material-ui/core/styles";import I from"@material-ui/core/TextField";import{StylesProvider as A,Modal as R,Backdrop as V,Fade as U}from"@material-ui/core";import{createGenerateClassName as L,StylesProvider as j}from"@material-ui/styles";import{v4 as B}from"uuid";import $,{Responsive as z}from"react-grid-layout";import W from"@mui/material/Accordion";import H from"@mui/material/AccordionSummary";import G from"@mui/material/AccordionDetails";import q from"@mui/icons-material/ExpandMore";import K from"react-dom";import{toast as _}from"react-toastify";import Y from"@mui/icons-material/Cancel";import X from"@mui/icons-material/Close";import Z from"@mui/icons-material/CheckCircle";import J from"@mui/material/Box";import Q from"@mui/material/Fade";import ee from"@mui/material/Slide";const te=({type:t,label:n})=>(t||(t="button"),e.createElement("button",{type:t,className:"moorr-button"},e.createElement("span",null,n)));function ne(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function oe(e,t,n,o){return new(n||(n=Promise))((function(r,i){function l(e){try{s(o.next(e))}catch(e){i(e)}}function a(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}s((o=o.apply(e,t||[])).next())}))}const re=t(((t,o)=>{var{style:r={},handleClick:i,label:l,disabled:a}=t,s=ne(t,["style","handleClick","label","disabled"]);const d=u("(max-width: 600px)"),m=n((()=>d?"8rem":"172px"),[d]);return e.createElement(c,Object.assign({},s,{ref:o,disabled:a,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!a&&{backgroundColor:"#541868"}),{color:"#FFFFFF",fontWeight:400,fontSize:"14px",width:m,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),r),onClick:i,variant:"contained"}),l)})),ie=t(((t,r)=>{var{sx:i,item:l,label:a,qty:s,disabled:d,highlight:u,onSelectItem:p}=t,h=ne(t,["sx","item","label","qty","disabled","highlight","onSelectItem"]);const g=n((()=>({width:"27px",height:"27px",color:"#FFFFFF",flexShrink:0})),[]),v=n((()=>{const e=Object.assign(Object.assign({},i),{flexGrow:1,fontFamily:"Poppins",fontSize:"14px",fontWeight:400,lineHeight:"9px",minHeight:"42px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none",gap:"0.5rem","&:hover > button":{opacity:1}});return s>0?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#FBFBFD",borderColor:!0===u?"#541868":"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,i]),f=o((e=>oe(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),M.isFunction(p)&&s<=0&&(yield Promise.all([p(l,1)]))}))),[s,p]),b=o((()=>!w.isValid(s)||s<=0?null:e.createElement(N,{disabled:d,sx:Object.assign(Object.assign({},g),{backgroundColor:"#E37D7D",opacity:0,"&:hover":{backgroundColor:"#E37D7D"},"&:active":{backgroundColor:"#E37D7D"}}),onClick:()=>p&&p(l,Math.max(0,s-1))},"-")),[d,g,s,p]),y=o((()=>!w.isValid(s)||s<=0?null:e.createElement(N,{disabled:d,sx:Object.assign(Object.assign({},g),{backgroundColor:"#541868",opacity:0,"&:hover":{backgroundColor:"#541868"},"&:active":{backgroundColor:"#541868"}}),onClick:()=>p&&p(l,s+1)},"+")),[d,g,s,p]),x=o((()=>{let t,n;return!w.isValid(s)||s<=0?(t=1,n=0):(t=`${s}`,n=1),e.createElement(m,{variant:"body1",component:"span",sx:{color:"#541868",fontWeight:700,fontSize:"14px",lineHeight:"20px",flexShrink:0,opacity:n}},t)}),[s]);return e.createElement(c,Object.assign({},h,{ref:r,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,disabled:d,sx:v,onClick:f}),b(),e.createElement(m,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:l),y(),x())})),le=t(((t,o)=>{var{style:r={},handleClick:i,label:l,disabled:a}=t,s=ne(t,["style","handleClick","label","disabled"]);const d=u("(max-width: 600px)"),m=n((()=>d?"8rem":"172px"),[d]);return e.createElement(c,Object.assign({},s,{ref:o,disabled:a,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!a&&{backgroundColor:"#D4C5D9"}),{color:"#541868",fontWeight:400,fontSize:"14px",width:m,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),r),onClick:i,variant:"contained"}),l)})),ae=t(((t,r)=>{var{sx:i,item:l,label:a,itemSelected:s,onSelectItem:d}=t,u=ne(t,["sx","item","label","itemSelected","onSelectItem"]);const p=n((()=>{const e=Object.assign(Object.assign({},i),{flexGrow:1,fontFamily:"Poppins",fontSize:"13px",fontWeight:400,lineHeight:"18px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none"});return s?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#fbfbfd",borderColor:"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,i]),h=o((e=>oe(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),M.isFunction(d)&&(yield Promise.all([d(l)]))}))),[d]);return e.createElement(c,Object.assign({},u,{ref:r,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:p,onClick:h}),e.createElement(m,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:l))})),se=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});O(se);const de=O((()=>F({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var ce=P(se)((({handleChange:t,value:n,disabled:o=!1,name:r,className:i,classes:l,size:a,menuItemLabel:s,options:d,labelPlacement:c="start",label:u,required:m=!1,isMBRequiredField:p,fullWidth:h,selectIconComponent:g})=>{const{root:v,focused:f,error:b,notchedOutline:y,notchedOutlineMBRequired:x}=l,E=de();let w;return g&&(w={IconComponent:g}),e.createElement(I,{fullWidth:!1!==h,id:"outlined-basic",variant:"outlined",value:n,onChange:t,disabled:o,name:r,className:[i].join(" "),InputProps:{classes:{root:v,focused:f,error:b,notchedOutline:!p||n&&0!==(null==n?void 0:n.length)?!m||n&&0!==(null==n?void 0:n.length)?y:E.mandatory:x}},color:"primary",size:a||"small",select:!0,SelectProps:w,defaultValue:""},e.createElement(S,{value:"",disabled:!0},e.createElement("em",null,s)),d&&d.map(((t,n)=>"-separator-"===t?e.createElement(S,{key:`separator-${n}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(S,{key:`menu-item-${n}-${t.value||t}`,value:t.value||t},t.label||t))))}));const ue={};function me(e,t){e&&t&&(ue[e]=t)}const pe=({className:t,icon:n,width:o,height:r,fill:i,stroke:l,accent:a,dropShadow:s})=>{if(M.isNullOrUndefined(n))return null;const d=ue[n]||null;return d?e.createElement(d,{className:t,fill:i,width:o,height:r,stroke:l,accent:a,dropShadow:s}):null},he={};var ge=({stylePrefix:t,children:n})=>{let o;if(t)o=he[t]?he[t]:he[t]=L({seed:t});else{const e=`MoorrStylesProvider-${B()}-`;o=L({seed:e})}return e.createElement(j,{generateClassName:o,injectFirst:!0},e.createElement(A,{generateClassName:o,injectFirst:!0},e.createElement(D,{generateClassName:o},n)))};const ve=r({});function fe(){return i(ve)}const be={};function ye(e,t){e&&t&&(be[e]=t)}const xe=({graphingTile:t,graphingTileIndex:n})=>{var o;if(!(null===(o=null==t?void 0:t.tile)||void 0===o?void 0:o.tileType))return null;const r=be[t.tile.tileType]||null;return r?e.createElement(r,{graphingTile:t,graphingTileIndex:n}):null},Ee=[20,20],we={lg:600,sm:0},Me={lg:8,sm:2},Ce=({tilePrefix:t,responsive:n,columns:o,containerPadding:r,referenceMargin:i,referenceWidth:d,graphingTiles:c})=>{const u=fe(),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l(null),x=a(null),E=()=>{const e=(null==x?void 0:x.current)?(null==x?void 0:x.current).getBoundingClientRect().width:null;y(e);const t=T(e);p(t)};let w;const C=e=>{E(),clearTimeout(w),w=setTimeout((()=>{E()}),300)};s((()=>{E()}),[x]),s((()=>(window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)})),[]),s((()=>{if(n){if(!Array.isArray(c)||0===c.length)return void f({lg:[]});const e=c.map(((e,n)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${n}`})));f({lg:e})}else{if(!Array.isArray(c)||0===c.length)return void g([]);g(c.map(((e,n)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${n}`,static:!0}))))}}),[c]);const k=()=>null==c?void 0:c.map(((n,o)=>{if(!n.tile||!n.visible)return null;if(M.isFunction(u.isTileVisible)&&n.tile.id&&!u.isTileVisible(n.tile.id))return null;let r="graphing-tile-container";n.tile.id&&(r+=` ${n.tile.id}`),!1!==n.border&&(r+=" bordered"),n.autoHeight&&(r+=" auto-height");const i=`${t?t+"_":""}tile_${o}`;return e.createElement("div",{className:r,key:i},e.createElement(xe,{graphingTile:n,graphingTileIndex:o}))})),T=e=>{if(!i||isNaN(i)||i<=0||!d||isNaN(d)||d<=0||null==e)return Ee;const t=e/d*i;return[t,t]};return e.createElement("div",{ref:x,className:"graphing-tiles-container"},(()=>{if(!b||!m)return null;if(!1!==n){if(!v)return null;const t=[r||0,0];return e.createElement(z,{width:b,breakpoints:we,cols:o||Me,rowHeight:1,layouts:v,containerPadding:t,margin:m,isDraggable:!1},k())}return h?e.createElement($,{width:b,cols:9,rowHeight:50,margin:m,isDraggable:!1,layout:h},k()):null})())},ke={};function Te(e,t){ke[e]=t}function Ne(e){const t=ke[null==e?void 0:e.tileType];return t?new t(e):null}function Se(e){const t=[];return e.forEach((e=>{const n=Ne(e);n&&t.push(n)})),t}class Oe{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=Ne(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class Fe{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new Oe(e))}))}}const Pe={};function De(e,t){Pe[e]=t}function Ie(e){const t=Pe[null==e?void 0:e.controlType];return t?new t(e):null}function Ae(e){const t=[];return e.forEach((e=>{const n=Ie(e);n&&t.push(n)})),t}class Re{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class Ve extends Re{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(M.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>M.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class Ue{constructor(e){this.border=e.border,this.background=e.background||null,this.control=Ie(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class Le{constructor(e){this.label=e.label||"",this.value=e.value||"",this.icon=e.icon||"",this.accent=e.accent||""}}class je{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ue(e))})),this.add=!0===e.add,this.addActions=[],Array.isArray(e.addActions)&&e.addActions.forEach((e=>{this.addActions.push(new Le(e))}))}}class Be{constructor(e){this.id=e.id,this.tileType=e.tileType}}class $e extends Be{constructor(e){super(e),this.control=new Ue(e.control)}}class ze extends Be{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ue(e))}))}}class We extends Be{constructor(e){super(e),M.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new je(e))):this.formGroups=[]}}Te("form-groups-tile",We);class He extends ze{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}Te("horizontal-tile",He);class Ge extends ze{constructor(e){super(e),this.states={};for(const t in e.states){const n=e.states[t];n&&(this.states[t]=new Fe(n))}}}Te("selectable-states-tile",Ge);class qe extends Be{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ue(e))}))}}Te("simple-form-tile",qe);class Ke extends $e{constructor(e){super(e)}}Te("single-tile",Ke);class _e extends ze{constructor(e){super(e)}}Te("vertical-tile",_e);const Ye=(e,t,n)=>{s((()=>{const n=document.querySelector("#react-root");return null==n||n.addEventListener(e,t),()=>{null==n||n.removeEventListener(e,t)}}),null!=n?n:[t])},Xe=(e,t)=>{const n=document.querySelector("#react-root");null==n||n.dispatchEvent(new CustomEvent(e,{detail:null!=t?t:{}}))},Ze=({})=>{const{settings:t,handleUIReady:n}=fe(),[r,i]=l(null),[a,d]=l([]),[c,u]=l(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{u(!0),M.isFunction(n)&&n()}),300)}),300)}),[]);const m=o((e=>{var t,n,o,r,i,l,s,c,u,m,p;if(!(null==a?void 0:a.length)||!(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.id))return;const h=a.find((t=>{var n,o;return(null===(n=t.tile)||void 0===n?void 0:n.id)===(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.id)}));if(!h)return;M.isNullOrUndefined(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.x)||(h.x=null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.x),M.isNullOrUndefined(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.y)||(h.y=null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.y),M.isNullOrUndefined(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.w)||(h.w=null===(s=null==e?void 0:e.detail)||void 0===s?void 0:s.w),M.isNullOrUndefined(null===(c=null==e?void 0:e.detail)||void 0===c?void 0:c.h)||(h.h=null===(u=null==e?void 0:e.detail)||void 0===u?void 0:u.h),M.isNullOrUndefined(null===(m=null==e?void 0:e.detail)||void 0===m?void 0:m.visible)||(h.visible=null===(p=null==e?void 0:e.detail)||void 0===p?void 0:p.visible);const g=a.map((e=>new Oe(e)));d(g)}),[a]);Ye("graphingGrid.updateTile",m),s((()=>{var e;t?(i(new Fe(t)),d(null===(e=t.tiles)||void 0===e?void 0:e.map((e=>new Oe(e))))):i(null)}),[t]);const p=()=>(null==t?void 0:t.infoIconUrl)&&t.infoIconHref?e.createElement("a",{className:"information-anchor",href:t.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==t?void 0:t.title,src:null==t?void 0:t.infoIconUrl})):null;if(!r)return null;let h="graphing-grid-container";return c&&(h+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:h},M.isNullOrUndefined(null==t?void 0:t.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==t?void 0:t.title,p()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(Ce,{graphingTiles:a,responsive:r.responsive,columns:r.columns,containerPadding:r.containerPadding,referenceMargin:r.referenceMargin,referenceWidth:r.referenceWidth})))},Je={};function Qe(e,t){e&&t&&(Je[e]=t)}const et=({graphingTile:t,graphingTileIndex:n,graphingTileControl:o,ControlProps:r})=>{var i;if(!(null===(i=null==o?void 0:o.control)||void 0===i?void 0:i.controlType))return null;const l=Je[o.control.controlType]||null;return l?e.createElement(l,Object.assign({graphingTile:t,graphingTileIndex:n,graphingTileControl:o},r)):null},tt=({graphingTile:t,graphingTileIndex:n,graphingTileControls:o,ControlProps:r})=>{var i,l;let a="graphing-tile-controls-container";return(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)&&(a+=" "+(null===(l=null==t?void 0:t.tile)||void 0===l?void 0:l.tileType)),e.createElement("div",{className:a},null==o?void 0:o.map(((o,i)=>{var l,a;if(!o.control)return null;let s="graphing-tile-control-container";(null===(l=o.control)||void 0===l?void 0:l.controlType)&&(s+=" "+(null===(a=o.control)||void 0===a?void 0:a.controlType)),!1!==o.border&&(s+=" bordered");const d=`control_${n}_${i}`;return e.createElement("div",{className:s,key:d},e.createElement(et,{graphingTile:t,graphingTileIndex:n,graphingTileControl:o,ControlProps:r}))})))},nt=({className:t,context:n})=>e.createElement(ve.Provider,{value:n},e.createElement("div",{className:t},e.createElement(Ze,null))),ot=({accentColor:t,open:n,actions:o,disabled:r,onClickAway:i,onClick:l})=>e.createElement(p,{onClickAway:i},e.createElement(h,{ariaLabel:"Add a New Card",direction:"down",open:n,className:n?"add-card-open":void 0,onClick:l,icon:e.createElement(g,{sx:{display:"flex"}},e.createElement(v,{open:n,icon:e.createElement(pe,{icon:"add-icon",stroke:n?"#E24242":"#FFFFFF"})})),FabProps:{className:n?"add-card-open":void 0,variant:"extended",disabled:r,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:{background:"transparent",color:"inherit",width:"auto",height:"30px",whiteSpace:"nowrap",boxShadow:"none",textTransform:"inherit","&:hover,:active":{background:"transparent",boxShadow:"none"},"& > div":{display:"flex",flexDirection:"row",gap:"1rem",textTransform:"inherit",justifyContent:"center"},"& > div > .MuiTypography-root.MuiTypography-button":{textTransform:"inherit",fontFamily:"Poppins",fontStyle:"normal",fontWeight:400,fontSize:"14px"},"& > div > .MuiSpeedDialIcon-root":{display:"flex",width:"30px",height:"30px",alignItems:"center",justifyContent:"center",backgroundColor:"#541868",transition:"background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",borderRadius:"15px",color:"#FFFFFF"},"& > div > .MuiSpeedDialIcon-root:hover":{backgroundColor:" rgba(0, 0, 0, 0.04)"},"& > div > .MuiSpeedDialIcon-root > svg":{transform:"rotate(0deg)",transition:"transform 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,opacity 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"},"&.add-card-open > div > .MuiSpeedDialIcon-root":{background:"#FFFFFF",color:"#E24242"},"&.add-card-open > div > .MuiSpeedDialIcon-root > svg":{transform:"rotate(45deg)"}}},sx:{position:"absolute",width:"30px",zIndex:1,"&.add-card-open":{zIndex:1050},"& > .MuiSpeedDial-actions":{alignSelf:"flex-end",marginRight:"-15px"},"& > .MuiSpeedDial-actions .MuiSpeedDialAction-staticTooltipLabel":{whiteSpace:"nowrap"}}},o)),rt=({graphingTile:t,graphingTileIndex:r})=>{const i=null==t?void 0:t.tile;if(!i)return null;const d=fe();return e.createElement("div",{className:"form-groups-tile-component"},!M.isArray(i.formGroups)||i.formGroups.length<0?null:i.formGroups.map(((i,c)=>{const u=a(null),[m,p]=l("normal"),[h,v]=l("form-group-container");s((()=>{w()}),[h,m]);const[b,y]=l(0),[x,E]=l(!0);s((()=>{if(x){const e=u.current;M.isNullOrUndefined(e)?y(0):setTimeout((()=>{y(e.scrollHeight)}),10)}else y(0)}),[x]);const w=e=>{if(x){const e=u.current;M.isNullOrUndefined(e)?y(0):setTimeout((()=>{y(Math.max(e.clientHeight,e.scrollHeight))}),10)}else y(0)},C=o((e=>{""===e.value?(p("add"),E(!0)):(null==d?void 0:d.handleFormGroupAdd)&&M.isFunction(d.handleFormGroupAdd)&&d.handleFormGroupAdd(i,e)}),[i,null==d?void 0:d.handleFormGroupAdd]),k=n((()=>i.addActions&&i.addActions.length?i.addActions.map(((t,n)=>e.createElement(f,{key:n.toString(),icon:e.createElement(pe,{icon:t.icon,fill:t.accent,stroke:"#FFFFFF"}),tooltipTitle:e.createElement("span",null,t.label),tooltipOpen:!0,FabProps:{disableFocusRipple:!0,disableRipple:!0,disableTouchRipple:!0},sx:{"& > .MuiSpeedDialAction-staticTooltipLabel":{background:"#ffffff",color:"#000000",textTransform:"inherit",fontFamily:"Poppins",fontStyle:"normal",fontWeight:400,fontSize:"12px",padding:"0.25rem 0.5rem",cursor:"pointer"},"& > .MuiSpeedDialAction-staticTooltipLabel#AddaNewCard-action-0-label":{marginRight:0},"& > .MuiFab-root":{backgroundColor:"transparent !important",color:"#ffffff",boxShadow:"none",width:"36px !important",height:"36px !important",margin:"0.375rem 1rem 0.375rem 0.25rem","&:hover":{backgroundColor:"transparent !important"},"&:active":{backgroundColor:"transparent !important",boxShadow:"none"},justifyContent:"flex-end !important"}},onClick:()=>C(t)}))):null),[i.addActions,C]),[T,N]=l(!1),S=o((e=>{e.stopPropagation(),N((e=>!e))}),[]),O=o((()=>!0!==i.add||M.isFunction(d.formGroupHasAddMode)&&!d.formGroupHasAddMode(i.id)?null:k?e.createElement(ot,{accentColor:"#541868",open:T,actions:k,onClick:S,onClickAway:()=>N(!1)}):e.createElement("button",{type:"button",className:"form-group-tile-add-button",onClick:F,disabled:"add"==m},e.createElement(pe,{icon:"add-icon",stroke:"#ffffff"}))),[m,d.formGroupHasAddMode,T,k,S]),F=e=>{e.stopPropagation(),p("add"),E(!0)},P=e=>oe(void 0,void 0,void 0,(function*(){M.isFunction(null==d?void 0:d.handleFormGroupCancel)&&(yield Promise.all([null==d?void 0:d.handleFormGroupCancel({formGroup:i})])),p("normal")})),[D,I]=l(!1),A=e=>oe(void 0,void 0,void 0,(function*(){if(M.isFunction(null==d?void 0:d.handleFormGroupSave))try{I(!0);const[e]=yield Promise.all([null==d?void 0:d.handleFormGroupSave({formGroup:i})]);if(!1===e)return}finally{I(!1)}p("normal")}));let R="form-group-container";return M.isFunction(d.isFormGroupVisible)&&(d.isFormGroupVisible(i.id)||(R+=" hidden")),R!==h&&v(R),e.createElement(W,{key:`${i.id}-{${c}}`,className:R,expanded:x,onChange:e=>{"add"!==m&&E((e=>!e))},TransitionProps:{unmountOnExit:!0}},e.createElement(H,{className:"form-group-title",expandIcon:"add"!==m?e.createElement(q,null):null},e.createElement("span",{className:"form-group-title-text"},i.title),O()),e.createElement("hr",null),e.createElement(G,{className:"form-group-components"},(()=>{if("add"===m){let t;return M.isFunction(d.renderFormGroup)&&(t=d.renderFormGroup(i,"add")),e.createElement(e.Fragment,null,t,e.createElement("hr",null),e.createElement("div",{className:"form-group-add-mode-buttons"},e.createElement("button",{className:"cancel-button",disabled:D,onClick:P},"Cancel"),e.createElement("button",{className:"save-button",disabled:D,onClick:A},"Create")))}{const n=i.controls;let o,l;if(M.isFunction(d.renderFormGroup)){if(o=d.renderFormGroup(i,"normal"),!M.isNullOrUndefined(o))return o;l=d.renderFormGroup(i,"footer")}return e.createElement(e.Fragment,null,e.createElement(tt,{graphingTile:t,graphingTileIndex:r,graphingTileControls:n,ControlProps:{onUIChange:w}}),l)}})()),e.createElement(g,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:T?2:-1,borderRadius:"10px",transition:"opacity 225ms cubic-bezier(0.4, 0, 0.2, 1)",opacity:T?1:0}}))})))};ye("form-groups-tile",rt);const it=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const[r,i]=l(null),[a,d]=l(0),[c,u]=l(0),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l([]);s((()=>{let e=[];const t=Math.ceil(o.controls.length/o.controlsPerPage);if(t>0)for(let n=0;n<t;n++){const t={pageIndex:n,controls:[]};for(let e=0;e<o.controlsPerPage;e++){const r=n*o.controlsPerPage+e;if(r>=o.controls.length)break;t.controls.push(o.controls[r])}e.push(t)}d(t),u(0),p(null),g(null),f(null),y(e)}),o.controls);const x=e=>{let t=e-1;t<0&&(t=a-1),g(t)},E=e=>{e.stopPropagation(),x(c),f(null),p(null)},w=e=>{e.stopPropagation()},M=e=>{e.stopPropagation()},C=e=>{if(e.stopPropagation(),null!==r)return;const t=c;let n=c-1;n<0&&(n=a-1),p(t),u(n),g(null),f(t);const o=setTimeout((()=>{x(n),f(null),p(null),setTimeout((function(){i(null)}),300)}),300);i(o)},k=e=>{let t=e+1;t>=a&&(t=0),f(t)},T=e=>{e.stopPropagation(),g(null),k(c),p(null)},N=e=>{e.stopPropagation()},S=e=>{e.stopPropagation()},O=e=>{if(e.stopPropagation(),null!==r)return;const t=c;let n=c+1;n>=a&&(n=0),p(t),u(n),g(t),f(null);const o=setTimeout((()=>{g(null),k(n),p(null),setTimeout((function(){i(null)}),300)}),300);i(o)},F={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:F},e.createElement("div",{className:"horizontal-tile-pages-container"},b.map(((o,r)=>{let i="horizontal-tile-page-container";return r===c?i+=" active":r===h?i+=" navigating-from-left":r===v&&(i+=" navigating-from-right"),r===m&&(i+=" previous"),e.createElement("div",{key:`horizontal-tile-page-${r}`,className:i},e.createElement(tt,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:F}),a<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:E,onMouseLeave:w,onMouseDown:M,onClick:C},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:T,onMouseLeave:N,onMouseDown:S,onClick:O},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),a<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(a).keys()).map((t=>{let n="paginator-anchor";return t===c&&(n+=" active"),e.createElement("a",{key:`horizontal-tile-page-index-${t}`,className:n,onMouseEnter:e=>{e.stopPropagation(),t!==c&&(t<c?(g(t),f(null)):(g(null),f(t)),p(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===c)return;const n=c,o=t;p(n),u(o),n<o?g(n):f(n)}})}))))};ye("horizontal-tile",it);const lt=({graphingTile:t})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[o,r]=l(""),[i,a]=l(null),[d,c]=l([]),u=fe();s((()=>{const e=Object.keys(n.states);if(c(e.map((e=>{var t;return{label:null===(t=n.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];m(t)}else r(""),a(null)}),[n.states]);const m=e=>{r(e),a(n.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==i?void 0:i.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(ce,{options:d,label:"Select",value:o,handleChange:e=>{var t;m(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==u?void 0:u.handleSelectableStatesTileChange)&&(null==u||u.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},i?e.createElement(Ce,{tilePrefix:o,graphingTiles:i.tiles,responsive:i.responsive,columns:i.columns,containerPadding:i.containerPadding,referenceMargin:i.referenceMargin,referenceWidth:i.referenceWidth}):null))};ye("selectable-states-tile",lt);const at=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const r=fe(),i=e=>{M.isFunction(r.handleUIChange)&&r.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!M.isArray(o.controls)||o.controls.length<0)return null;const r=o.controls;return e.createElement(tt,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r,ControlProps:{onUIChange:i}})})())};ye("simple-form-tile",at);const st=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const r=[o.control],i={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:i},e.createElement(tt,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r}))};ye("single-tile",st);const dt=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const r=o.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(tt,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r}))};function ct(e,t){const n=fe(),o=null==e?void 0:e.control,[r,i]=l(null);return s((()=>{if(!(o&&(n.data&&n.data[o.dataKey]||t)))return;const e=null!=t?t:n.data[o.dataKey];i(e)}),[o,t,n.data]),{context:n,settings:o,data:r}}ye("vertical-tile",dt);const ut={};function mt(e,t){ut[e]=t}function pt(e){const t=ut[e];return t?new t:null}function ht(e){const t=[];return e.forEach((e=>{const n=pt(e);n&&t.push(n)})),t}const gt=(e,t,n)=>!(!M.isNullOrUndefined(n)&&""!==(null==n?void 0:n.trim())&&"normal"!==n&&"hover"!==n&&(M.isNullOrUndefined(t)||""===(null==t?void 0:t.trim())))&&(!M.isNullOrUndefined(t)&&""!==(null==t?void 0:t.trim())||!M.isNullOrUndefined(e)&&"warning"!==(null==e?void 0:e.error_0)),vt=(e,t)=>{let n=!1,o=!1;return Object.entries(e).forEach((([e,t])=>{const r=null==t?void 0:t.error;n=n||gt(r),o=o||!0===(null==r?void 0:r.mandatory)})),M.isFunction(t)&&t(n,o),{hasErrors:n,hasMandatoryErrors:o}},ft=(e,t)=>oe(void 0,void 0,void 0,(function*(){var n;const o=(t||{})[e.key];if(!M.isArray(o))return;const r={count:0};return!0===(null===(n=null==e?void 0:e.originalEvent)||void 0===n?void 0:n.noValidate)||o.forEach(((t,n)=>{var o;const i=pt(null!==(o=null==e?void 0:e.validatorType)&&void 0!==o?o:t.type);if(M.isNullOrUndefined(i))return;e.validatorData&&(i.validatorData=e.validatorData);const l=i.validate(t,e.value);r.mandatory=!0===t.mandatory||"AsAtDate"===e.validatorType,r.errors=l,M.isArray(l)&&l.length>0&&l.forEach(((n,o)=>{r[`error_${o}`]=i.getErrorMessage(t,e.control,n),r.count+=1}))})),r})),bt=(e,t,n,o,r)=>oe(void 0,void 0,void 0,(function*(){var i;if(M.isNullOrUndefined(e)||M.isNullOrUndefined(t))return{hasErrors:!1,hasMandatoryErrors:!1};let l;M.isNullOrUndefined(n)?o((e=>(l=Object.assign({},e),e))):l=Object.assign({},n);const a=[];return null===(i=null==e?void 0:e.tiles)||void 0===i||i.forEach((e=>{var n,o,r,i,s;switch(null===(n=null==e?void 0:e.tile)||void 0===n?void 0:n.tileType){case"form-groups-tile":null===(r=null===(o=null==e?void 0:e.tile)||void 0===o?void 0:o.formGroups)||void 0===r||r.forEach((e=>{var n,o;(null===(n=null==e?void 0:e.controls)||void 0===n?void 0:n.length)&&(null===(o=null==e?void 0:e.controls)||void 0===o||o.forEach((e=>{var n,o;if(!(null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey)||(null==e?void 0:e.control.readOnly))return;const r=l[null===(o=null==e?void 0:e.control)||void 0===o?void 0:o.dataKey];if(r.readOnly||r.hidden)return;a.push(oe(void 0,void 0,void 0,(function*(){var n,o;const i=yield ft({originalEvent:null,control:null==e?void 0:e.control,key:null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey,value:null==r?void 0:r.value},t);!M.isNullOrUndefined(i)&&i.count>0&&(l[null===(o=null==e?void 0:e.control)||void 0===o?void 0:o.dataKey].error=i)})))})))}));break;case"simple-form-tile":null===(s=null===(i=null==e?void 0:e.tile)||void 0===i?void 0:i.controls)||void 0===s||s.forEach((e=>oe(void 0,void 0,void 0,(function*(){var n,o;if(!(null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey)||(null==e?void 0:e.control.readOnly))return;const r=l[null===(o=null==e?void 0:e.control)||void 0===o?void 0:o.dataKey];if(r.readOnly||r.hidden)return;a.push(oe(void 0,void 0,void 0,(function*(){var n,o;const i=yield ft({originalEvent:null,control:null==e?void 0:e.control,key:null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey,value:null==r?void 0:r.value},t);!M.isNullOrUndefined(i)&&i.count>0&&(l[null===(o=null==e?void 0:e.control)||void 0===o?void 0:o.dataKey].error=i)})))}))));break;default:return}})),yield Promise.all(a),o(l),vt(l,r)})),yt=()=>{const[e,t]=l(0),[n,r]=l({});return{updatingCount:e,updatingFlags:n,setUpdating:o((e=>{t((e=>e+1)),r((t=>Object.assign(Object.assign({},t),{[e]:!0})))}),[e,n]),unsetUpdating:o((e=>{t((e=>e-1)),r((t=>Object.assign(Object.assign({},t),{[e]:!1})))}),[e,n])}},xt=(e,t,n,r,i,a)=>{const d=fe(),[c,u]=l(t),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l(null),[x,E]=l(!1),w=o((()=>new Promise((t=>{if(x)return void t(x);const n={};Xe(`graphingForm.validateForm.${e}`,{callback:(e,o)=>{n.hasErrors=!0===(null==n?void 0:n.hasErrors)||e,n.hasMandatoryErrors=1==(null==n?void 0:n.hasMandatoryErrors)||o;const r=!n.hasErrors&&!n.hasMandatoryErrors;r||!0===i||E(!0),t(r)}})}))),[x,e]);s((()=>{if(!n)return;oe(void 0,void 0,void 0,(function*(){yield r(null,t,f,y,null!=a?a:()=>{},n),u(t);const e=t.tiles[0];p(e);const o={};e.tile.controls.forEach((e=>{o[e.control.dataKey]=e})),g(o)}))}),[t,n]);const[M,C]=l(!1),[k,T]=l(!1),N=o(((e,t)=>{const n=!0===t;C(!0===e),T(n)}),[]),[S,O]=l(null),F=o((e=>oe(void 0,void 0,void 0,(function*(){var n,o;if(!t||!v||!S)return{hasErrors:!1,hasMandatoryErrors:!1};const{hasErrors:r,hasMandatoryErrors:i}=yield bt(t,v,null,O,N);return(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.callback)&&(null===(o=null==e?void 0:e.detail)||void 0===o||o.callback(r,i)),{hasErrors:r,hasMandatoryErrors:i}}))),[t,v,S,N]);Ye(`graphingForm.validateForm.${e}`,F);const{updatingCount:P,updatingFlags:D,setUpdating:I,unsetUpdating:A}=yt();return{context:d,settings:c,graphingTile:m,graphingControls:h,inputSchemas:v,dropdownValues:b,data:S,setData:O,updatingCount:P,updatingFlags:D,setUpdating:I,unsetUpdating:A,hasErrors:M,hasMandatoryErrors:k,handleSetHasErrors:N,canSubmit:w}};class Et{constructor(){}getErrorMessage(e,t,n){if(M.isNullOrUndefined(n))return n;if(!M.isNullOrUndefined(null==t?void 0:t.validationErrorMessages)&&!M.isNullOrUndefined(t.validationErrorMessages[n])&&M.isString(t.validationErrorMessages[n])&&""!==t.validationErrorMessages[n].trim())return t.validationErrorMessages[n];switch(n){case"mandatory":return"This field is mandatory. Please ensure it is not empty or invalid";case"required":return"This field is required. Please ensure it is not empty or invalid";case"mbRequired":return"warning";case"enum":return M.isArray(null==e?void 0:e.enum)&&e.enum.length>0?`Value must be in this list: ${e.enum.filter((e=>!M.isNullOrUndefined(e)&&""!==e)).join(", ")}`:"Value must be in enum list";case"as-at-future":return"Your current value's as at date must not be in the future"}return n}validate(e,t){const n=this.validateInputValue(e,t);return!0!==(null==e?void 0:e.mbRequired)||this.validateMbRequired(e,t)||n.push("mbRequired"),n}validateInputValue(e,t){const n=[];return!0!==(null==e?void 0:e.mandatory)||this.validateMandatory(e,t)||n.push("mandatory"),!0!==(null==e?void 0:e.required)||this.validateRequired(e,t)||n.push("required"),M.isArray(null==e?void 0:e.enum)&&(null==e?void 0:e.enum.length)>0&&!this.validateEnum(null==e?void 0:e.enum,t)&&n.push("enum"),n}validateMandatory(e,t){return!M.isNullOrUndefined(t)}validateRequired(e,t){return this.validateMandatory(e,t)}validateMbRequired(e,t){return this.validateMandatory(e,t)}validateEnum(e,t){return!(M.isArray(e)&&0!==e.length&&!M.isNullOrUndefined(t))||e.includes(t)}}class wt extends Et{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&!!t.formatted}}mt("Address",wt);class Mt extends Et{validateInputValue(e,t){const n=super.validateInputValue(e,t);if(n.length>0)return n;if(C.isValid(t)){const e=new Date(t),o=C.todayUtc();e.getTime()>o.getTime()&&n.push("as-at-future")}return n}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&C.isValid(t)}}mt("AsAtDate",Mt);class Ct extends Et{validateInputValue(e,t){const n=super.validateInputValue(e,t);return t=k.parse(t),k.isValid(e.min)&&!this.validateMin(e.min,t)&&n.push("min"),k.isValid(e.max)&&!this.validateMax(e.max,t)&&n.push("max"),n}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${k.getCurrencyText(e.min,!1,e.decimalPlaces||2,"")}`;case"max":return`Data not saved. The value must be less than or equal to ${k.getCurrencyText(e.max,!1,e.decimalPlaces||2,"")}`;default:return super.getErrorMessage(e,t,n)}}validateMin(e,t){return!k.isValid(e)||!k.isValid(t)||t>=e}validateMax(e,t){return!k.isValid(e)||!k.isValid(t)||t<=e}}mt("Number",Ct);class kt extends Ct{validateInputValue(e,t){return super.validateInputValue(e,t)}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${k.getCurrencyText(e.min,!1,e.decimalPlaces||2)}`;case"max":return`Data not saved. The value must be less than or equal to ${k.getCurrencyText(e.max,!1,e.decimalPlaces||2)}`;default:return super.getErrorMessage(e,t,n)}}}mt("Currency",kt);class Tt extends Et{getErrorMessage(e,t,n){var o,r,i,l;switch(n=super.getErrorMessage(e,t,n)){case"min":if(C.isValid(null===(o=this.validatorData)||void 0===o?void 0:o.min)){const e=C.parse(null===(r=this.validatorData)||void 0===r?void 0:r.min);return`Value cannot be before ${C.format(e,"DD/MM/yyyy")}`}break;case"max":if(C.isValid(null===(i=this.validatorData)||void 0===i?void 0:i.max)){const e=C.parse(null===(l=this.validatorData)||void 0===l?void 0:l.max);return`Value cannot be after ${C.format(e,"DD/MM/yyyy")}`}}return n}validateInputValue(e,t){var n,o,r,i;const l=super.validateInputValue(e,t);if(0===l.length&&C.isValid(t)){const e=C.parse(t);if(C.isValid(null===(n=this.validatorData)||void 0===n?void 0:n.min)){const t=C.parse(null===(o=this.validatorData)||void 0===o?void 0:o.min);(null==t?void 0:t.getTime())>(null==e?void 0:e.getTime())&&l.push("min")}if(C.isValid(null===(r=this.validatorData)||void 0===r?void 0:r.max)){const t=C.parse(null===(i=this.validatorData)||void 0===i?void 0:i.max);(null==t?void 0:t.getTime())<(null==e?void 0:e.getTime())&&l.push("max")}}return l}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&C.isValid(t)}}mt("Date",Tt);class Nt extends Et{validateInputValue(e,t){const n=super.validateInputValue(e,t);return!M.isNullOrUndefined(e.minLength)&&w.isValid(e.minLength)&&e.minLength>0&&!this.validateMinLength(e.minLength,t)&&n.push("minLength"),!M.isNullOrUndefined(e.maxLength)&&w.isValid(e.maxLength)&&e.maxLength>0&&!this.validateMaxLength(e.maxLength,t)&&n.push("maxLength"),!M.isNullOrUndefined(e.match)&&M.isString(e.match)&&e.match.length>0&&!this.validateMatch(e.match,t)&&n.push("match"),n}getErrorMessage(e,t,n){const o=super.getErrorMessage(e,t,n);switch(o){case"minLength":return`Data not saved. Minimum ${e.minLength} characters are required`;case"maxLength":return`Data not saved. Maximum ${e.maxLength} characters are allowed`;case"match":return"Data not saved. This field contains invalid characters";default:return o}}validateMinLength(e,t){return!(!(!w.isValid(e)||e<=0||M.isNullOrUndefined(t))&&M.isString(t))||t.length>=e}validateMaxLength(e,t){return!(!(!w.isValid(e)||e<=0||M.isNullOrUndefined(t))&&M.isString(t))||t.length<=e}validateMatch(e,t){if(M.isNullOrUndefined(e)||!M.isString(e)||""===e.trim())return!0;if(M.isNullOrUndefined(t)||!M.isString(t)||""===t.trim())return!0;const n=e.match(/(\/?)(.+)\1([a-z]*)/i),o=n[2],r=n[3];return new RegExp(o,r).test(t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&(M.isString(t)&&t.length>0&&""!==t.trim())}}mt("String",Nt);class St extends Nt{validateInputValue(e,t){return super.validateInputValue(e,t)}}mt("Notes",St);class Ot extends Et{validateInputValue(e,t){return super.validateInputValue(e,t)}}mt("ObjectId",Ot);class Ft extends Et{validateInputValue(e,t){return super.validateInputValue(e,t)}}mt("[ObjectId]",Ft);class Pt extends Et{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){var n,o,r;if(!super.validateMandatory(e,t))return!1;switch(null==t?void 0:t.ownershipType){case"Sole":return 1===(null===(n=null==t?void 0:t.owners)||void 0===n?void 0:n.length);case"Joint":return 2===(null===(o=null==t?void 0:t.owners)||void 0===o?void 0:o.length);case"Other":return(null===(r=null==t?void 0:t.owners)||void 0===r?void 0:r.length)>=1}return!1}}mt("Ownership",Pt);class Dt extends Ct{validateInputValue(e,t){return super.validateInputValue(e,t)}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${k.getCurrencyText(e.min,!1,e.decimalPlaces||2,"")}%`;case"max":return`Data not saved. The value must be less than or equal to ${k.getCurrencyText(e.max,!1,e.decimalPlaces||2,"")}%`;default:return super.getErrorMessage(e,t,n)}}}mt("Percentage",Dt);class It extends Et{validateInputValue(e,t){return super.validateInputValue(e,t)}}mt("SelectBoolean",It);class At extends Et{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&(M.isString(t)&&t.length>0&&""!==t.trim()&&null!==w.parse(t))}}mt("SelectNumber",At);class Rt extends Et{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!M.isNullOrUndefined(t)&&""!==t.trim()&&this.validateEnum(e.enum,t)}}mt("Select",Rt);const Vt=(e,t,n)=>{De(e,t),Qe(e,n)},Ut=()=>{const e=jt.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(K.unmountComponentAtNode(e),e.remove())}),300))};let Lt=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((n,o)=>{let r,i;"function"==typeof t.onClose&&(r=t.onClose),t.onClose=e=>{r&&r(e),n({dismissed:!1,result:e}),t.showModal=!1,Ut()},"function"==typeof t.onDismiss&&(i=t.onClose),t.onDismiss=()=>{i&&i(),n({dismissed:!0}),t.showModal=!1,Ut()},t.showModal=!0;let l=e.createElement(ge,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));jt.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),K.render(l,this._container)}))}};const jt=[],Bt={},$t=O((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),zt=t=>{const n=$t(),o={};t.fixedWidth&&(o.width=t.fixedWidth),t.fixedHeight&&(o.height=t.fixedHeight);let r=n.paper+" moorr-modal-content-container";t.contentClassName&&(r+=" "+t.contentClassName);const[i,a]=l(!1),[d,c]=l(!1);s((()=>{c(!i&&!1!==t.showModal)}),[i,d,t.showModal]);const u=e=>{a(!0),(null==t?void 0:t.onDismiss)&&t.onDismiss(e)};let m=n.modal;switch(m+=" moorr-modal-container",t.effect){case"fade":m+=" moorr-fade-modal";break;case"slide":m+=" moorr-slide-modal"}return i&&(m+=" moorr-modal-closing"),e.createElement(R,{disableEnforceFocus:!0,className:m,open:d,onClose:u,closeAfterTransition:!0,BackdropComponent:V,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),M.isFunction(t.onBackdropClick)?t.onBackdropClick(e):u("backdrop")}}},(()=>{switch(t.effect){case"fade":default:return e.createElement(U,{in:d},e.createElement("div",{className:r,style:o},t.children));case"slide":return e.createElement(b,{in:d,direction:"left",timeout:300},e.createElement("div",{className:r},t.children))}})())},Wt=(t,n)=>{switch(t){default:case"info":case"warning":case"error":(t=>{_(t,{icon:e.createElement(Y,{sx:{color:"#EB5757"}}),style:{color:"#EB5757",backgroundColor:"#FCECEC",border:"2px solid #EB5757",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(X,{sx:{color:"#EB5757"}})})})(n);break;case"success":(t=>{_(t,{icon:e.createElement(Z,{sx:{color:"#1B5E20"}}),style:{color:"#1B5E20",backgroundColor:"#E8F5E9",border:"2px solid #1B5E20",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(X,{sx:{color:"#1B5E20"}})})})(n)}},Ht=t=>e.createElement(zt,{effect:"fade",contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),Gt=t=>{const{className:n,onDismiss:r,showModal:i,onClose:l,icon:a,title:s,body:d,closeLabel:c}=t,u=o((()=>{l(!1)}),[l]);o((()=>{l(!0)}),[l]);const p=o((()=>M.isString(d)?e.createElement(m,{paragraph:!0},d):M.isArray(d)&&d.length>0?d.map(((t,n)=>{const o=`paragraph-${n}`;if(M.isString(t)||!M.isNullOrUndefined(t))return e.createElement(m,{paragraph:!0,key:o},t)})):M.isNullOrUndefined(d)?e.createElement(m,{paragraph:!0},"Please alert to continue."):d),[d]),h=o((()=>e.createElement(g,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},p())),[p]),v=o((()=>M.isString(s)||!M.isNullOrUndefined(s)?s:"Alert"),[s]),f=o((()=>e.createElement(g,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=a?a:e.createElement(y,null),e.createElement(m,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},v()),e.createElement(x,{onClick:u,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"},"data-testid":"dismiss"},e.createElement(X,{sx:{fontSize:"1rem"}})))),[a,v,u]),b=o((()=>{const t=c||"Dismiss";return e.createElement(re,{handleClick:u,label:t,"data-testid":`${T.toKebabCase(t)}`})}),[c,u]);return e.createElement(Ht,{className:"alert-modal"+(n?" "+n:""),widthValue:"400px",showModal:!0===i,onDismiss:r,onBackdropClick:u,renderHeader:f(),renderBody:h(),renderStatusMessage:b()})};class qt extends Lt{constructor(e){super(e)}getComponent(){return Gt}}Bt.alert=qt;const Kt=t=>{const{className:n,onDismiss:r,showModal:i,onClose:l,icon:a,title:s,body:d,cancelLabel:c,confirmLabel:u}=t,p=o((()=>{l(!1)}),[l]),h=o((()=>{l(!0)}),[l]),v=o((()=>M.isString(d)?e.createElement(m,{paragraph:!0},d):M.isArray(d)&&d.length>0?d.map(((t,n)=>{const o=`paragraph-${n}`;if(M.isString(t)||!M.isNullOrUndefined(t))return e.createElement(m,{paragraph:!0,key:o},t)})):M.isNullOrUndefined(d)?e.createElement(m,{paragraph:!0},"Please confirm to continue."):d),[d]),f=o((()=>e.createElement(g,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},v())),[v]),b=o((()=>M.isString(s)||!M.isNullOrUndefined(s)?s:"Confirm"),[s]),E=o((()=>e.createElement(g,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=a?a:e.createElement(y,null),e.createElement(m,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},b()),e.createElement(x,{onClick:p,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(X,{sx:{fontSize:"1rem"},"data-testid":"dismiss"})))),[a,b,p]),w=o((()=>{const t=c||"Cancel";return e.createElement(le,{handleClick:p,label:t,"data-testid":`${T.toKebabCase(t)}`})}),[c,p]),C=o((()=>{const t=u||"Dismiss";return e.createElement(re,{handleClick:h,label:t,"data-testid":`${T.toKebabCase(t)}`})}),[u,h]);return e.createElement(Ht,{className:"confirm-modal"+(n?" "+n:""),widthValue:"400px",showModal:!0===i,onDismiss:r,onBackdropClick:p,renderHeader:E(),renderBody:f(),renderLeftButtons:w(),renderRightButtons:C()})};class _t extends Lt{constructor(e){super(e)}getComponent(){return Kt}}Bt.confirm=_t;const Yt=t=>{const{className:n,header:o,body:r,leftButtonLabel:i,rightButtonLabel:l,hiddenClose:a,width:s}=t,d=e=>{e.stopPropagation(),t.onDismiss()};return e.createElement(Ht,{className:"opti-info-modal"+(n?" "+n:""),widthValue:null!=s?s:"554px",showModal:!0===t.showModal,onDismiss:t.onDismiss,renderBody:e.createElement(g,{sx:{display:"flex",flexDirection:"row",position:"relative"}},e.createElement(g,{sx:{position:"absolute",right:"12px",top:"12px",cursor:"pointer"}},e.createElement("svg",{onClick:t.onDismiss,width:"20",height:"20",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M16.8564 6.35381L12.2707 10.9395L16.8976 15.5664L15.5609 16.903L10.9341 12.2762L6.36889 16.8414L5.13506 15.6075L9.70023 11.0424L5.07337 6.4155L6.41002 5.07885L11.0369 9.70571L15.6226 5.11998L16.8564 6.35381Z",fill:"#541868"}))),e.createElement(g,{sx:{width:"60px",background:"#541868",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",flexShrink:0}}),e.createElement(g,{sx:{position:"absolute",top:"11.81px",left:"12px",borderRadius:"50% 50% 0% 50%",padding:"5px",background:"white"}},e.createElement("img",{style:{height:"50px",background:"#66E84B",borderRadius:"50% 50% 0% 50%",padding:"5px"},src:"/assets/img/opti/Opti-Blinked.gif"})),e.createElement(g,{sx:{padding:"1rem 1rem 1rem 1.5rem"}},e.createElement(g,{sx:{color:"#541868",fontSize:"16px",lineHeight:"22.4px",fontWeight:400}},o),e.createElement(g,{sx:{marginTop:"1rem"}},r),e.createElement(g,{className:"opti-info-modal-buttons",sx:{textAlign:"right",marginTop:"1rem"}},i&&e.createElement(E,{className:"opti-info-modal-button-left",style:{marginRight:"5px"},variant:"contained",color:"primary",onClick:()=>{},"data-testid":`${T.toKebabCase(i)}`},i),!a&&e.createElement(re,{label:"Close",handleClick:d,"data-testid":"close"}))))})};class Xt extends Lt{constructor(e){super(e)}getComponent(){return Yt}}Bt.optiInfo=Xt;const Zt=e=>{var t,n,o,r,i;const l=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!l||!Bt[l])return Promise.reject("invalid-modal");const a=new Bt[l]((null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.props)||{}).open();(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.then)&&a.then((t=>{var n;try{null===(n=null==e?void 0:e.detail)||void 0===n||n.then(t)}catch(e){console.error(e)}})),(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.catch)&&a.catch(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.catch),a.finally((()=>{var t,n;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(n=null==e?void 0:e.detail)||void 0===n||n.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=a)};document&&(document.removeEventListener("openModal",Zt),document.addEventListener("openModal",Zt));const Jt=(e,t)=>{const[n,r]=l(null),i=a(null),d=o((e=>{if(!e)return;const n=Object.assign({},e.contentRect.toJSON());w.isValid(t)&&t>0?(clearTimeout(i.current),i.current=setTimeout((()=>{r(n)}),t)):r(n)}),[t]);return s((()=>{const t=e.current;let n;return t&&(n=new ResizeObserver((([e])=>d(e))),n.observe(t)),()=>{n&&t&&(n.unobserve(t),n.disconnect())}}),[e.current]),n},Qt=r({}),en=()=>i(Qt),tn=()=>({context:en()}),nn=(e,t,n)=>{var r,i;const{context:a}=tn();s((()=>{var e,t;M.mutexRelease(null!==(t=null===(e=null==a?void 0:a.sectionContext)||void 0===e?void 0:e.updateSessionId)&&void 0!==t?t:"default")}),[null===(r=null==a?void 0:a.sectionContext)||void 0===r?void 0:r.updateSessionId]);const[d,c]=l(0),u=o((()=>{c((e=>e+1))}),[]),[m,p]=l(!1),[h,g]=l(!1),v=o(((e,t)=>{const n=!0===t;p(!0===e),g(n)}),[]),f=o((n=>oe(void 0,void 0,void 0,(function*(){if(M.isFunction(t)){const[e]=yield Promise.all([t(n)]);if(!e)return}return a.onMoveBack&&a.onMoveBack({section:e,data:n})}))),[h,t,a.onMoveBack]),[b,y]=l(!1),[x,E]=l(!1),[w,C]=l(null);s((()=>{x&&a.onMoveNext&&a.onMoveNext({section:e,data:w})}),[x,w]);const k=o((e=>oe(void 0,void 0,void 0,(function*(){var t,o;try{y(!0),yield M.delay(350),yield M.mutex(null!==(o=null===(t=null==a?void 0:a.sectionContext)||void 0===t?void 0:t.updateSessionId)&&void 0!==o?o:"default",(()=>oe(void 0,void 0,void 0,(function*(){if(yield M.delay(350),M.isFunction(n)){const[t]=yield Promise.all([n(e)]);if(!t)return}else if(m||h)return;E(!0),C(e)}))))}finally{y(!1)}}))),[null===(i=null==a?void 0:a.sectionContext)||void 0===i?void 0:i.updateSessionId,m,h,n]),{updatingCount:T,updatingFlags:N,setUpdating:S,unsetUpdating:O}=yt();return{context:a.sectionContext,sectionStep:d,nextSectionStep:u,hasErrors:m,hasMandatoryErrors:h,handleSetHasErrors:v,moveBack:f,moveNext:k,awaitingMoveNext:b,updatingCount:T,updatingFlags:N,setUpdating:S,unsetUpdating:O}},on=(e,t,n)=>{const[r,i]=l(t),[a,d]=l(null),[c,u]=l(null),[m,p]=l(null),[h,g]=l(!1),v=o((()=>new Promise((t=>{if(h)return void t(h);const n={};Xe(`wizardSection.validateForm.${e}`,{callback:(e,o)=>{n.hasErrors=!0===(null==n?void 0:n.hasErrors)||e,n.hasMandatoryErrors=1==(null==n?void 0:n.hasMandatoryErrors)||o;const r=!n.hasErrors&&!n.hasMandatoryErrors;r||g(!0),t(r)}})}))),[h,e]),{context:f,sectionStep:b,nextSectionStep:y,updatingCount:x,updatingFlags:E,setUpdating:w,unsetUpdating:M,hasErrors:C,hasMandatoryErrors:k,handleSetHasErrors:T,moveBack:N,moveNext:S,awaitingMoveNext:O}=nn(e,void 0,v);s((()=>{if(!(null==f?void 0:f.validationSchemas))return;oe(void 0,void 0,void 0,(function*(){yield n(null,t,p,(()=>{}),(()=>{}),f.validationSchemas),i(t);const e=t.tiles[0];d(e);const o={};e.tile.controls.forEach((e=>{o[e.control.dataKey]=e})),u(o)}))}),[t,null==f?void 0:f.validationSchemas]);const[F,P]=l(null),D=o((e=>oe(void 0,void 0,void 0,(function*(){var n,o;if(!t||!m||!F)return{hasErrors:!1,hasMandatoryErrors:!1};const{hasErrors:r,hasMandatoryErrors:i}=yield bt(t,m,null,P,T);return(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.callback)&&(null===(o=null==e?void 0:e.detail)||void 0===o||o.callback(r,i)),{hasErrors:r,hasMandatoryErrors:i}}))),[t,m,F,T]);return Ye(`wizardSection.validateForm.${e}`,D),{context:f,sectionStep:b,nextSectionStep:y,settings:r,graphingTile:a,graphingControls:c,inputSchemas:m,data:F,setData:P,updatingCount:x,updatingFlags:E,setUpdating:w,unsetUpdating:M,hasErrors:C,hasMandatoryErrors:k,handleSetHasErrors:T,moveBack:N,moveNext:S,awaitingMoveNext:O}},rn=e=>{const[t,n]=l(e),[o,r]=l(null),[i,a]=l(null);return s((()=>{n(e);const t=e.tiles[0];r(t);const o={};t.tile.controls.forEach((e=>{o[e.control.dataKey]=e})),a(o)}),[e]),{settings:t,graphingTile:o,graphingControls:i}},ln=t(((t,n)=>{var{stepIndex:o,sectionStep:r,onNextSectionStep:i,onStepIncrease:l,enterTimeout:a,onEntered:s,children:d}=t,c=ne(t,["stepIndex","sectionStep","onNextSectionStep","onStepIncrease","enterTimeout","onEntered","children"]);return e.createElement(Q,{in:r>=o,timeout:{enter:null!=a?a:600},mountOnEnter:!0,onEntered:()=>{i&&i(),s&&s()}},e.createElement(J,Object.assign({},c,{ref:n}),d))})),an=t(((t,r)=>{var i,l,{section:a,children:d,animate:c,animateIn:m,animateOut:p,animateEasing:h,animateDuration:g,maxWidth:v,sx:f}=t,b=ne(t,["section","children","animate","animateIn","animateOut","animateEasing","animateDuration","maxWidth","sx"]);const y=u("(max-width: 700px)"),x=en();s((()=>{x.setSectionMaxWidth(null!=v?v:0)}),[v]);const E=n((()=>{var e;let t={position:"absolute",height:"100%",top:0,overflowY:"auto",overflowX:"hidden","&::-webkit-scrollbar":{width:"6px",height:"6px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#a98bb3",borderRadius:"6px"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:"rgb(118, 70, 134)"},"&::-webkit-scrollbar-track":{background:"rgba(118, 70, 134, 0.15)",borderRadius:"6px"}};if(!y&&w.isValid(v)&&v>0&&!M.isNullOrUndefined(null===(e=x.containerRect)||void 0===e?void 0:e.width)&&x.containerRect.width>v){const e=Math.floor((x.containerRect.width-v)/2);t=Object.assign(Object.assign({},t),{left:e,width:`calc(100% - ${e}px)`})}else t=Object.assign(Object.assign({},t),{left:0,width:"100%",padding:y?"0 0.75rem":"0"});return t}),[y,v,null===(i=x.containerRect)||void 0===i?void 0:i.width]),C=n((()=>{var e;let t=Object.assign(Object.assign({},f),{width:"100%"});return w.isValid(v)&&v>0&&!M.isNullOrUndefined(null===(e=x.containerRect)||void 0===e?void 0:e.width)&&x.containerRect.width>v&&(t=Object.assign(Object.assign({},t),{maxWidth:v})),t}),[f,v,null===(l=x.containerRect)||void 0===l?void 0:l.width]),k=o((()=>e.createElement(J,Object.assign({},b,{ref:r,className:`wizard-section wizard-section-${a}`,sx:E}),e.createElement(J,{sx:C},d))),[a,E,C,d,b]),T=n((()=>{var e;return null!==(e=null!=c?c:x.animate)&&void 0!==e?e:"fade"}),[x.animate,c]),N=n((()=>({enter:!1!==m?null!=g?g:300:0,exit:!1!==p?null!=g?g:300:0})),[m,p,g]),S=n((()=>null!=h?h:"ease-in-out"),[]),O=o((()=>e.createElement(Q,{easing:S,timeout:N,in:x.section===a,mountOnEnter:!0,unmountOnExit:!0,onEnter:e=>{e.style.opacity="0"},onEntering:e=>{e.style.opacity="1"},onEntered:e=>{e.style.opacity="",e.style.transition="",x.setSectionMaxWidth(null!=v?v:0)}},k())),[S,N,x.section,a,k]),F=n((()=>{switch(T){case"scroll-up":return"back"!==x.moveDirection?x.section===a?"up":"down":x.section===a?"down":"up";case"scroll-down":return"back"!==x.moveDirection?x.section===a?"down":"up":x.section===a?"up":"down";case"scroll-left":return"back"!==x.moveDirection?x.section===a?"left":"right":x.section===a?"right":"left";case"scroll-right":return"back"!==x.moveDirection?x.section===a?"right":"left":x.section===a?"left":"right"}}),[x.section,x.moveDirection,a,T]),P=o((()=>e.createElement(ee,{container:x.containerRef.current,direction:F,easing:S,timeout:N,in:x.section===a,mountOnEnter:!0,unmountOnExit:!0,onEnter:e=>{var t,n,o,r;switch(F){case"up":e.style.transform=e.style.webkitTransform=`translateY(${null===(t=x.containerRect)||void 0===t?void 0:t.height}px)`;break;case"down":e.style.transform=e.style.webkitTransform=`translateY(-${null===(n=x.containerRect)||void 0===n?void 0:n.height}px)`;break;case"left":e.style.transform=e.style.webkitTransform=`translateX(${null===(o=x.containerRect)||void 0===o?void 0:o.width}px)`;break;case"right":e.style.transform=e.style.webkitTransform=`translateX(-${null===(r=x.containerRect)||void 0===r?void 0:r.height}px)`}},onEntering:e=>{switch(F){case"up":case"down":e.style.transform=e.style.webkitTransform="translateY(0)";break;case"left":case"right":e.style.transform=e.style.webkitTransform="translateX(0)"}},onEntered:e=>{e.style.transform="",e.style.webkitTransform="",e.style.transition="",x.setSectionMaxWidth(null!=v?v:0)}},k())),[S,N,x.section,a,F,x.containerRect,k]),D=o((()=>{switch(T){case"fade":return O();case"scroll-up":case"scroll-down":case"scroll-left":case"scroll-right":return P()}return x.section!==a?null:k()}),[x.section,a,T,O,P,k]);return e.createElement(e.Fragment,null,D())})),sn=t((({children:t,initialSection:r,animate:i,avatar:c,isAvatarVisible:u,sx:m,onMoveBack:p,onMoveNext:h,onSectionChange:g,sectionContext:v},f)=>{const b=a(null),y=Jt(b),[x,E]=l(r);s((()=>{r&&g&&g(r)}),[r]);const[C,k]=l(null),[T,N]=l(),S=a(null),O=Jt(S),F=o(((e,t)=>{e!==x&&(E(e),k(null!=t?t:null),g&&g(e))}),[x,g]),P=n((()=>({containerRef:b,containerRect:y,section:x,moveDirection:C,onMoveBack:p,onMoveNext:h,changeSection:F,setSectionMaxWidth:N,animate:i,sectionContext:v})),[y,x,C,p,h,F,i,v]);d(f,(()=>({section:x,context:P})),[x,P]);const D=n((()=>{if(M.isNullOrUndefined(y))return null;if(M.isNullOrUndefined(c)||M.isNullOrUndefined(O))return null;let e={display:"inline-block",position:"absolute"};return e=M.isFunction(u)&&!u(x)?Object.assign(Object.assign({},e),{opacity:0}):Object.assign(Object.assign({},e),{opacity:1}),w.isValid(T)&&T>0&&(e=Object.assign(Object.assign({},e),{left:Math.floor((y.width-T)/2)-O.width})),e}),[y,c,u,O,T]),I=o((()=>M.isNullOrUndefined(T)||0===T||M.isNullOrUndefined(D)?null:c),[T,c,D]);return e.createElement(J,{ref:b,sx:Object.assign({position:"relative"},m)},e.createElement(Qt.Provider,{value:P},e.createElement(J,{ref:S,sx:D},I()),t))}));export{wt as AddressValidator,qt as AlertModal,Mt as AsAtDateValidator,te as Button,_t as ConfirmModal,kt as CurrencyValidator,Tt as DateValidator,ce as Dropdown,Ht as FadeModal,Le as FormGroupAddActionModel,je as FormGroupModel,rt as FormGroupsTile,We as FormGroupsTileModel,Ve as FormInputModel,ve as GraphingContext,et as GraphingControl,Re as GraphingControlModel,Ue as GraphingControlSettingsModel,Ze as GraphingGrid,nt as GraphingPage,Fe as GraphingSettingsModel,xe as GraphingTile,tt as GraphingTileControls,Be as GraphingTileModel,Oe as GraphingTileSettingsModel,Ce as GraphingTiles,it as HorizontalTile,He as HorizontalTileModel,Lt as Modal,zt as MoorrModal,ze as MultipleControlsTileModel,St as NotesValidator,Ct as NumberValidator,Ot as ObjectIdValidator,Ft as ObjectIdsValidator,Xt as OptiInfoModal,Pt as OwnershipValidator,Dt as PercentageValidator,re as PrimaryButton,ie as QtyButton,le as SecondaryButton,It as SelectBooleanValidator,ae as SelectButton,At as SelectNumberValidator,Rt as SelectValidator,lt as SelectableStatesTile,Ge as SelectableStatesTileModel,at as SimpleFormTile,qe as SimpleFormTileModel,$e as SingleControlTileModel,st as SingleTile,Ke as SingleTileModel,Nt as StringValidator,ge as StylesProvider,pe as SvgIcon,Et as Validator,dt as VerticalTile,_e as VerticalTileModel,sn as Wizard,an as WizardSection,ln as WizardSectionStep,vt as checkDataForErrors,Ie as createGraphingControl,Ae as createGraphingControls,Ne as createGraphingTile,Se as createGraphingTiles,pt as createValidator,ht as createValidators,Xe as dispatchRootEvent,gt as hasInputError,Bt as modals,jt as modalsStack,De as registerGraphingControl,Qe as registerGraphingControlComponent,Vt as registerGraphingFrameworkComponent,Te as registerGraphingTile,ye as registerGraphingTileComponent,me as registerSvgIconComponent,mt as registerValidator,Wt as toastMessage,fe as useGraphingContext,xt as useGraphingForm,ct as useGraphingFramework,Jt as useResizeObserver,Ye as useRootEventListener,yt as useUpdateTracker,tn as useWizard,en as useWizardContext,rn as useWizardForm,on as useWizardFormSection,nn as useWizardSection,bt as validateData,ft as validateInput};
1
+ import e,{forwardRef as t,useMemo as n,useCallback as o,createContext as r,useContext as i,useState as l,useRef as a,useEffect as s,useImperativeHandle as d}from"react";import c from"@mui/material/Button";import{useMediaQuery as u,Typography as m,SpeedDial as p,Box as h,SpeedDialIcon as g,SpeedDialAction as v,Slide as f,Icon as b,IconButton as y,Button as x}from"@mui/material";import{integers as E,utils as w,dates as M,decimals as C,strings as k}from"moorr-common";import T from"@mui/material/IconButton";import N from"@material-ui/core/MenuItem";import{makeStyles as S,createStyles as F,withStyles as O,StylesProvider as P}from"@material-ui/core/styles";import D from"@material-ui/core/TextField";import{StylesProvider as I,Modal as A,Backdrop as R,Fade as V}from"@material-ui/core";import{createGenerateClassName as U,StylesProvider as L}from"@material-ui/styles";import{v4 as j}from"uuid";import B,{Responsive as $}from"react-grid-layout";import z from"@mui/material/Accordion";import W from"@mui/material/AccordionSummary";import H from"@mui/material/AccordionDetails";import G from"@mui/icons-material/ExpandMore";import q from"react-dom";import{toast as K}from"react-toastify";import _ from"@mui/icons-material/Cancel";import Y from"@mui/icons-material/Close";import X from"@mui/icons-material/CheckCircle";import Z from"@mui/material/Box";import J from"@mui/material/Fade";import Q from"@mui/material/Slide";const ee=({type:t,label:n})=>(t||(t="button"),e.createElement("button",{type:t,className:"moorr-button"},e.createElement("span",null,n)));function te(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function ne(e,t,n,o){return new(n||(n=Promise))((function(r,i){function l(e){try{s(o.next(e))}catch(e){i(e)}}function a(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}s((o=o.apply(e,t||[])).next())}))}const oe=t(((t,o)=>{var{style:r={},handleClick:i,label:l,disabled:a}=t,s=te(t,["style","handleClick","label","disabled"]);const d=u("(max-width: 600px)"),m=n((()=>d?"8rem":"172px"),[d]);return e.createElement(c,Object.assign({},s,{ref:o,disabled:a,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!a&&{backgroundColor:"#541868"}),{color:"#FFFFFF",fontWeight:400,fontSize:"14px",width:m,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),r),onClick:i,variant:"contained"}),l)})),re=t(((t,r)=>{var{sx:i,item:l,label:a,qty:s,disabled:d,highlight:u,onSelectItem:p}=t,h=te(t,["sx","item","label","qty","disabled","highlight","onSelectItem"]);const g=n((()=>({width:"27px",height:"27px",color:"#FFFFFF",flexShrink:0})),[]),v=n((()=>{const e=Object.assign(Object.assign({},i),{flexGrow:1,fontFamily:"Poppins",fontSize:"14px",fontWeight:400,lineHeight:"9px",minHeight:"42px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none",gap:"0.5rem","&:hover > button":{opacity:1}});return s>0?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#FBFBFD",borderColor:!0===u?"#541868":"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,i]),f=o((e=>ne(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),w.isFunction(p)&&s<=0&&(yield Promise.all([p(l,1)]))}))),[s,p]),b=o((()=>!E.isValid(s)||s<=0?null:e.createElement(T,{disabled:d,sx:Object.assign(Object.assign({},g),{backgroundColor:"#E37D7D",opacity:0,"&:hover":{backgroundColor:"#E37D7D"},"&:active":{backgroundColor:"#E37D7D"}}),onClick:()=>p&&p(l,Math.max(0,s-1))},"-")),[d,g,s,p]),y=o((()=>!E.isValid(s)||s<=0?null:e.createElement(T,{disabled:d,sx:Object.assign(Object.assign({},g),{backgroundColor:"#541868",opacity:0,"&:hover":{backgroundColor:"#541868"},"&:active":{backgroundColor:"#541868"}}),onClick:()=>p&&p(l,s+1)},"+")),[d,g,s,p]),x=o((()=>{let t,n;return!E.isValid(s)||s<=0?(t=1,n=0):(t=`${s}`,n=1),e.createElement(m,{variant:"body1",component:"span",sx:{color:"#541868",fontWeight:700,fontSize:"14px",lineHeight:"20px",flexShrink:0,opacity:n}},t)}),[s]);return e.createElement(c,Object.assign({},h,{ref:r,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,disabled:d,sx:v,onClick:f}),b(),e.createElement(m,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:l),y(),x())})),ie=t(((t,o)=>{var{style:r={},handleClick:i,label:l,disabled:a}=t,s=te(t,["style","handleClick","label","disabled"]);const d=u("(max-width: 600px)"),m=n((()=>d?"8rem":"172px"),[d]);return e.createElement(c,Object.assign({},s,{ref:o,disabled:a,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!a&&{backgroundColor:"#D4C5D9"}),{color:"#541868",fontWeight:400,fontSize:"14px",width:m,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),r),onClick:i,variant:"contained"}),l)})),le=t(((t,r)=>{var{sx:i,item:l,label:a,itemSelected:s,onSelectItem:d}=t,u=te(t,["sx","item","label","itemSelected","onSelectItem"]);const p=n((()=>{const e=Object.assign(Object.assign({},i),{flexGrow:1,fontFamily:"Poppins",fontSize:"13px",fontWeight:400,lineHeight:"18px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none"});return s?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#fbfbfd",borderColor:"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,i]),h=o((e=>ne(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),w.isFunction(d)&&(yield Promise.all([d(l)]))}))),[d]);return e.createElement(c,Object.assign({},u,{ref:r,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:p,onClick:h}),e.createElement(m,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:l))})),ae=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});S(ae);const se=S((()=>F({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var de=O(ae)((({handleChange:t,value:n,disabled:o=!1,name:r,className:i,classes:l,size:a,menuItemLabel:s,options:d,labelPlacement:c="start",label:u,required:m=!1,isMBRequiredField:p,fullWidth:h,selectIconComponent:g})=>{const{root:v,focused:f,error:b,notchedOutline:y,notchedOutlineMBRequired:x}=l,E=se();let w;return g&&(w={IconComponent:g}),e.createElement(D,{fullWidth:!1!==h,id:"outlined-basic",variant:"outlined",value:n,onChange:t,disabled:o,name:r,className:[i].join(" "),InputProps:{classes:{root:v,focused:f,error:b,notchedOutline:!p||n&&0!==(null==n?void 0:n.length)?!m||n&&0!==(null==n?void 0:n.length)?y:E.mandatory:x}},color:"primary",size:a||"small",select:!0,SelectProps:w,defaultValue:""},e.createElement(N,{value:"",disabled:!0},e.createElement("em",null,s)),d&&d.map(((t,n)=>"-separator-"===t?e.createElement(N,{key:`separator-${n}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(N,{key:`menu-item-${n}-${t.value||t}`,value:t.value||t},t.label||t))))}));const ce={};function ue(e,t){e&&t&&(ce[e]=t)}const me=({className:t,icon:n,width:o,height:r,fill:i,stroke:l,accent:a,dropShadow:s})=>{if(w.isNullOrUndefined(n))return null;const d=ce[n]||null;return d?e.createElement(d,{className:t,fill:i,width:o,height:r,stroke:l,accent:a,dropShadow:s}):null},pe={};var he=({stylePrefix:t,children:n})=>{let o;if(t)o=pe[t]?pe[t]:pe[t]=U({seed:t});else{const e=`MoorrStylesProvider-${j()}-`;o=U({seed:e})}return e.createElement(L,{generateClassName:o,injectFirst:!0},e.createElement(I,{generateClassName:o,injectFirst:!0},e.createElement(P,{generateClassName:o},n)))};const ge=r({});function ve(){return i(ge)}const fe={};function be(e,t){e&&t&&(fe[e]=t)}const ye=({graphingTile:t,graphingTileIndex:n})=>{var o;if(!(null===(o=null==t?void 0:t.tile)||void 0===o?void 0:o.tileType))return null;const r=fe[t.tile.tileType]||null;return r?e.createElement(r,{graphingTile:t,graphingTileIndex:n}):null},xe=[20,20],Ee={lg:600,sm:0},we={lg:8,sm:2},Me=({tilePrefix:t,responsive:n,columns:o,containerPadding:r,referenceMargin:i,referenceWidth:d,graphingTiles:c})=>{const u=ve(),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l(null),x=a(null),E=()=>{const e=(null==x?void 0:x.current)?(null==x?void 0:x.current).getBoundingClientRect().width:null;y(e);const t=T(e);p(t)};let M;const C=e=>{E(),clearTimeout(M),M=setTimeout((()=>{E()}),300)};s((()=>{E()}),[x]),s((()=>(window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)})),[]),s((()=>{if(n){if(!Array.isArray(c)||0===c.length)return void f({lg:[]});const e=c.map(((e,n)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${n}`})));f({lg:e})}else{if(!Array.isArray(c)||0===c.length)return void g([]);g(c.map(((e,n)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${n}`,static:!0}))))}}),[c]);const k=()=>null==c?void 0:c.map(((n,o)=>{if(!n.tile||!n.visible)return null;if(w.isFunction(u.isTileVisible)&&n.tile.id&&!u.isTileVisible(n.tile.id))return null;let r="graphing-tile-container";n.tile.id&&(r+=` ${n.tile.id}`),!1!==n.border&&(r+=" bordered"),n.autoHeight&&(r+=" auto-height");const i=`${t?t+"_":""}tile_${o}`;return e.createElement("div",{className:r,key:i},e.createElement(ye,{graphingTile:n,graphingTileIndex:o}))})),T=e=>{if(!i||isNaN(i)||i<=0||!d||isNaN(d)||d<=0||null==e)return xe;const t=e/d*i;return[t,t]};return e.createElement("div",{ref:x,className:"graphing-tiles-container"},(()=>{if(!b||!m)return null;if(!1!==n){if(!v)return null;const t=[r||0,0];return e.createElement($,{width:b,breakpoints:Ee,cols:o||we,rowHeight:1,layouts:v,containerPadding:t,margin:m,isDraggable:!1},k())}return h?e.createElement(B,{width:b,cols:9,rowHeight:50,margin:m,isDraggable:!1,layout:h},k()):null})())},Ce={};function ke(e,t){Ce[e]=t}function Te(e){const t=Ce[null==e?void 0:e.tileType];return t?new t(e):null}function Ne(e){const t=[];return e.forEach((e=>{const n=Te(e);n&&t.push(n)})),t}class Se{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=Te(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class Fe{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new Se(e))}))}}const Oe={};function Pe(e,t){Oe[e]=t}function De(e){const t=Oe[null==e?void 0:e.controlType];return t?new t(e):null}function Ie(e){const t=[];return e.forEach((e=>{const n=De(e);n&&t.push(n)})),t}class Ae{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class Re extends Ae{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(w.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>w.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class Ve{constructor(e){this.border=e.border,this.background=e.background||null,this.control=De(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class Ue{constructor(e){this.label=e.label||"",this.value=e.value||"",this.icon=e.icon||"",this.accent=e.accent||""}}class Le{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ve(e))})),this.add=!0===e.add,this.addActions=[],Array.isArray(e.addActions)&&e.addActions.forEach((e=>{this.addActions.push(new Ue(e))}))}}class je{constructor(e){this.id=e.id,this.tileType=e.tileType}}class Be extends je{constructor(e){super(e),this.control=new Ve(e.control)}}class $e extends je{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ve(e))}))}}class ze extends je{constructor(e){super(e),w.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new Le(e))):this.formGroups=[]}}ke("form-groups-tile",ze);class We extends $e{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}ke("horizontal-tile",We);class He extends $e{constructor(e){super(e),this.states={};for(const t in e.states){const n=e.states[t];n&&(this.states[t]=new Fe(n))}}}ke("selectable-states-tile",He);class Ge extends je{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new Ve(e))}))}}ke("simple-form-tile",Ge);class qe extends Be{constructor(e){super(e)}}ke("single-tile",qe);class Ke extends $e{constructor(e){super(e)}}ke("vertical-tile",Ke);const _e=(e,t,n)=>{s((()=>{const n=document.querySelector("#react-root");return null==n||n.addEventListener(e,t),()=>{null==n||n.removeEventListener(e,t)}}),null!=n?n:[t])},Ye=(e,t)=>{const n=document.querySelector("#react-root");null==n||n.dispatchEvent(new CustomEvent(e,{detail:null!=t?t:{}}))},Xe=({})=>{const{settings:t,handleUIReady:n}=ve(),[r,i]=l(null),[a,d]=l([]),[c,u]=l(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{u(!0),w.isFunction(n)&&n()}),300)}),300)}),[]);const m=o((e=>{var t,n,o,r,i,l,s,c,u,m,p;if(!(null==a?void 0:a.length)||!(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.id))return;const h=a.find((t=>{var n,o;return(null===(n=t.tile)||void 0===n?void 0:n.id)===(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.id)}));if(!h)return;w.isNullOrUndefined(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.x)||(h.x=null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.x),w.isNullOrUndefined(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.y)||(h.y=null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.y),w.isNullOrUndefined(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.w)||(h.w=null===(s=null==e?void 0:e.detail)||void 0===s?void 0:s.w),w.isNullOrUndefined(null===(c=null==e?void 0:e.detail)||void 0===c?void 0:c.h)||(h.h=null===(u=null==e?void 0:e.detail)||void 0===u?void 0:u.h),w.isNullOrUndefined(null===(m=null==e?void 0:e.detail)||void 0===m?void 0:m.visible)||(h.visible=null===(p=null==e?void 0:e.detail)||void 0===p?void 0:p.visible);const g=a.map((e=>new Se(e)));d(g)}),[a]);_e("graphingGrid.updateTile",m),s((()=>{var e;t?(i(new Fe(t)),d(null===(e=t.tiles)||void 0===e?void 0:e.map((e=>new Se(e))))):i(null)}),[t]);const p=()=>(null==t?void 0:t.infoIconUrl)&&t.infoIconHref?e.createElement("a",{className:"information-anchor",href:t.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==t?void 0:t.title,src:null==t?void 0:t.infoIconUrl})):null;if(!r)return null;let h="graphing-grid-container";return c&&(h+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:h},w.isNullOrUndefined(null==t?void 0:t.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==t?void 0:t.title,p()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(Me,{graphingTiles:a,responsive:r.responsive,columns:r.columns,containerPadding:r.containerPadding,referenceMargin:r.referenceMargin,referenceWidth:r.referenceWidth})))},Ze={};function Je(e,t){e&&t&&(Ze[e]=t)}const Qe=({graphingTile:t,graphingTileIndex:n,graphingTileControl:o,ControlProps:r})=>{var i;if(!(null===(i=null==o?void 0:o.control)||void 0===i?void 0:i.controlType))return null;const l=Ze[o.control.controlType]||null;return l?e.createElement(l,Object.assign({graphingTile:t,graphingTileIndex:n,graphingTileControl:o},r)):null},et=({graphingTile:t,graphingTileIndex:n,graphingTileControls:o,ControlProps:r})=>{var i,l;let a="graphing-tile-controls-container";return(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)&&(a+=" "+(null===(l=null==t?void 0:t.tile)||void 0===l?void 0:l.tileType)),e.createElement("div",{className:a},null==o?void 0:o.map(((o,i)=>{var l,a;if(!o.control)return null;let s="graphing-tile-control-container";(null===(l=o.control)||void 0===l?void 0:l.controlType)&&(s+=" "+(null===(a=o.control)||void 0===a?void 0:a.controlType)),!1!==o.border&&(s+=" bordered");const d=`control_${n}_${i}`;return e.createElement("div",{className:s,key:d},e.createElement(Qe,{graphingTile:t,graphingTileIndex:n,graphingTileControl:o,ControlProps:r}))})))},tt=({className:t,context:n})=>e.createElement(ge.Provider,{value:n},e.createElement("div",{className:t},e.createElement(Xe,null))),nt=({accentColor:t,open:n,actions:o,disabled:r,onClick:i})=>e.createElement(p,{ariaLabel:"Add a New Card",direction:"down",open:n,className:n?"add-card-open":void 0,onClick:i,icon:e.createElement(h,{sx:{display:"flex"}},e.createElement(g,{open:n,icon:e.createElement(me,{icon:"add-icon",stroke:n?"#E24242":"#FFFFFF"})})),FabProps:{className:n?"add-card-open":void 0,variant:"extended",disabled:r,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:{background:"transparent",color:"inherit",width:"auto",height:"30px",whiteSpace:"nowrap",boxShadow:"none",textTransform:"inherit","&:hover,:active":{background:"transparent",boxShadow:"none"},"& > div":{display:"flex",flexDirection:"row",gap:"1rem",textTransform:"inherit",justifyContent:"center"},"& > div > .MuiTypography-root.MuiTypography-button":{textTransform:"inherit",fontFamily:"Poppins",fontStyle:"normal",fontWeight:400,fontSize:"14px"},"& > div > .MuiSpeedDialIcon-root":{display:"flex",width:"30px",height:"30px",alignItems:"center",justifyContent:"center",backgroundColor:"#541868",transition:"background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",borderRadius:"15px",color:"#FFFFFF"},"& > div > .MuiSpeedDialIcon-root:hover":{backgroundColor:"#541868"},"& > div > .MuiSpeedDialIcon-root > svg":{transform:"rotate(0deg)",transition:"transform 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,opacity 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"},"&.add-card-open > div > .MuiSpeedDialIcon-root":{backgroundColor:"#FFFFFF",color:"#E24242"},"&.add-card-open > div > .MuiSpeedDialIcon-root:hover":{backgroundColor:"#FFFFFF",color:"#E24242"},"&.add-card-open > div > .MuiSpeedDialIcon-root > svg":{transform:"rotate(45deg)"}}},sx:{position:"absolute",width:"30px",zIndex:1,"&.add-card-open":{zIndex:1050},"& > .MuiSpeedDial-actions":{alignSelf:"flex-end",marginRight:"-15px"},"& > .MuiSpeedDial-actions .MuiSpeedDialAction-staticTooltipLabel":{whiteSpace:"nowrap"}}},o),ot=({graphingTile:t,graphingTileIndex:r})=>{const i=null==t?void 0:t.tile;if(!i)return null;const d=ve();return e.createElement("div",{className:"form-groups-tile-component"},!w.isArray(i.formGroups)||i.formGroups.length<0?null:i.formGroups.map(((i,c)=>{const u=a(null),[m,p]=l("normal"),[g,f]=l("form-group-container");s((()=>{M()}),[g,m]);const[b,y]=l(0),[x,E]=l(!0);s((()=>{if(x){const e=u.current;w.isNullOrUndefined(e)?y(0):setTimeout((()=>{y(e.scrollHeight)}),10)}else y(0)}),[x]);const M=e=>{if(x){const e=u.current;w.isNullOrUndefined(e)?y(0):setTimeout((()=>{y(Math.max(e.clientHeight,e.scrollHeight))}),10)}else y(0)},C=o((e=>{""===e.value?(p("add"),E(!0)):(null==d?void 0:d.handleFormGroupAdd)&&w.isFunction(d.handleFormGroupAdd)&&d.handleFormGroupAdd(i,e)}),[i,null==d?void 0:d.handleFormGroupAdd]),k=n((()=>i.addActions&&i.addActions.length?i.addActions.map(((t,n)=>e.createElement(v,{key:n.toString(),icon:e.createElement(me,{icon:t.icon,fill:t.accent,stroke:"#FFFFFF"}),tooltipTitle:e.createElement("span",null,t.label),tooltipOpen:!0,FabProps:{disableFocusRipple:!0,disableRipple:!0,disableTouchRipple:!0},sx:{"& > .MuiSpeedDialAction-staticTooltipLabel":{background:"#ffffff",color:"#000000",textTransform:"inherit",fontFamily:"Poppins",fontStyle:"normal",fontWeight:400,fontSize:"12px",padding:"0.25rem 0.5rem",cursor:"pointer"},"& > .MuiSpeedDialAction-staticTooltipLabel#AddaNewCard-action-0-label":{marginRight:0},"& > .MuiFab-root":{backgroundColor:"transparent !important",color:"#ffffff",boxShadow:"none",width:"36px !important",height:"36px !important",margin:"0.375rem 1rem 0.375rem 0.25rem","&:hover":{backgroundColor:"transparent !important"},"&:active":{backgroundColor:"transparent !important",boxShadow:"none"},justifyContent:"flex-end !important"}},onClick:()=>C(t)}))):null),[i.addActions,C]),[T,N]=l(!1),S=o((e=>{e.stopPropagation(),N((e=>!e))}),[]),F=o((()=>!0!==i.add||w.isFunction(d.formGroupHasAddMode)&&!d.formGroupHasAddMode(i.id)?null:k?e.createElement(nt,{accentColor:"#541868",open:T,actions:k,onClick:S,onClickAway:()=>N(!1)}):e.createElement("button",{type:"button",className:"form-group-tile-add-button",onClick:O,disabled:"add"==m},e.createElement(me,{icon:"add-icon",stroke:"#ffffff"}))),[m,d.formGroupHasAddMode,T,k,S]),O=e=>{e.stopPropagation(),p("add"),E(!0)},P=e=>ne(void 0,void 0,void 0,(function*(){w.isFunction(null==d?void 0:d.handleFormGroupCancel)&&(yield Promise.all([null==d?void 0:d.handleFormGroupCancel({formGroup:i})])),p("normal")})),[D,I]=l(!1),A=e=>ne(void 0,void 0,void 0,(function*(){if(w.isFunction(null==d?void 0:d.handleFormGroupSave))try{I(!0);const[e]=yield Promise.all([null==d?void 0:d.handleFormGroupSave({formGroup:i})]);if(!1===e)return}finally{I(!1)}p("normal")}));let R="form-group-container";return w.isFunction(d.isFormGroupVisible)&&(d.isFormGroupVisible(i.id)||(R+=" hidden")),R!==g&&f(R),e.createElement(z,{key:`${i.id}-{${c}}`,className:R,expanded:x,onChange:e=>{"add"!==m&&E((e=>!e))},TransitionProps:{unmountOnExit:!0}},e.createElement(W,{className:"form-group-title",expandIcon:"add"!==m?e.createElement(G,null):null},e.createElement("span",{className:"form-group-title-text"},i.title),F()),e.createElement("hr",null),e.createElement(H,{className:"form-group-components"},(()=>{if("add"===m){let t;return w.isFunction(d.renderFormGroup)&&(t=d.renderFormGroup(i,"add")),e.createElement(e.Fragment,null,t,e.createElement("hr",null),e.createElement("div",{className:"form-group-add-mode-buttons"},e.createElement("button",{className:"cancel-button",disabled:D,onClick:P},"Cancel"),e.createElement("button",{className:"save-button",disabled:D,onClick:A},"Create")))}{const n=i.controls;let o,l;if(w.isFunction(d.renderFormGroup)){if(o=d.renderFormGroup(i,"normal"),!w.isNullOrUndefined(o))return o;l=d.renderFormGroup(i,"footer")}return e.createElement(e.Fragment,null,e.createElement(et,{graphingTile:t,graphingTileIndex:r,graphingTileControls:n,ControlProps:{onUIChange:M}}),l)}})()),k&&e.createElement(h,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:T?2:-1,borderRadius:"10px",transition:"opacity 225ms cubic-bezier(0.4, 0, 0.2, 1)",opacity:T?1:0},onClick:()=>N(!1)}))})))};be("form-groups-tile",ot);const rt=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const[r,i]=l(null),[a,d]=l(0),[c,u]=l(0),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l([]);s((()=>{let e=[];const t=Math.ceil(o.controls.length/o.controlsPerPage);if(t>0)for(let n=0;n<t;n++){const t={pageIndex:n,controls:[]};for(let e=0;e<o.controlsPerPage;e++){const r=n*o.controlsPerPage+e;if(r>=o.controls.length)break;t.controls.push(o.controls[r])}e.push(t)}d(t),u(0),p(null),g(null),f(null),y(e)}),o.controls);const x=e=>{let t=e-1;t<0&&(t=a-1),g(t)},E=e=>{e.stopPropagation(),x(c),f(null),p(null)},w=e=>{e.stopPropagation()},M=e=>{e.stopPropagation()},C=e=>{if(e.stopPropagation(),null!==r)return;const t=c;let n=c-1;n<0&&(n=a-1),p(t),u(n),g(null),f(t);const o=setTimeout((()=>{x(n),f(null),p(null),setTimeout((function(){i(null)}),300)}),300);i(o)},k=e=>{let t=e+1;t>=a&&(t=0),f(t)},T=e=>{e.stopPropagation(),g(null),k(c),p(null)},N=e=>{e.stopPropagation()},S=e=>{e.stopPropagation()},F=e=>{if(e.stopPropagation(),null!==r)return;const t=c;let n=c+1;n>=a&&(n=0),p(t),u(n),g(t),f(null);const o=setTimeout((()=>{g(null),k(n),p(null),setTimeout((function(){i(null)}),300)}),300);i(o)},O={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:O},e.createElement("div",{className:"horizontal-tile-pages-container"},b.map(((o,r)=>{let i="horizontal-tile-page-container";return r===c?i+=" active":r===h?i+=" navigating-from-left":r===v&&(i+=" navigating-from-right"),r===m&&(i+=" previous"),e.createElement("div",{key:`horizontal-tile-page-${r}`,className:i},e.createElement(et,{graphingTile:t,graphingTileIndex:n,graphingTileControls:o.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:O}),a<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:E,onMouseLeave:w,onMouseDown:M,onClick:C},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:T,onMouseLeave:N,onMouseDown:S,onClick:F},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),a<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(a).keys()).map((t=>{let n="paginator-anchor";return t===c&&(n+=" active"),e.createElement("a",{key:`horizontal-tile-page-index-${t}`,className:n,onMouseEnter:e=>{e.stopPropagation(),t!==c&&(t<c?(g(t),f(null)):(g(null),f(t)),p(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===c)return;const n=c,o=t;p(n),u(o),n<o?g(n):f(n)}})}))))};be("horizontal-tile",rt);const it=({graphingTile:t})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[o,r]=l(""),[i,a]=l(null),[d,c]=l([]),u=ve();s((()=>{const e=Object.keys(n.states);if(c(e.map((e=>{var t;return{label:null===(t=n.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];m(t)}else r(""),a(null)}),[n.states]);const m=e=>{r(e),a(n.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==i?void 0:i.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(de,{options:d,label:"Select",value:o,handleChange:e=>{var t;m(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==u?void 0:u.handleSelectableStatesTileChange)&&(null==u||u.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},i?e.createElement(Me,{tilePrefix:o,graphingTiles:i.tiles,responsive:i.responsive,columns:i.columns,containerPadding:i.containerPadding,referenceMargin:i.referenceMargin,referenceWidth:i.referenceWidth}):null))};be("selectable-states-tile",it);const lt=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const r=ve(),i=e=>{w.isFunction(r.handleUIChange)&&r.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!w.isArray(o.controls)||o.controls.length<0)return null;const r=o.controls;return e.createElement(et,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r,ControlProps:{onUIChange:i}})})())};be("simple-form-tile",lt);const at=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const r=[o.control],i={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:i},e.createElement(et,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r}))};be("single-tile",at);const st=({graphingTile:t,graphingTileIndex:n})=>{const o=null==t?void 0:t.tile;if(!o)return null;const r=o.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(et,{graphingTile:t,graphingTileIndex:n,graphingTileControls:r}))};function dt(e,t){const n=ve(),o=null==e?void 0:e.control,[r,i]=l(null);return s((()=>{if(!(o&&(n.data&&n.data[o.dataKey]||t)))return;const e=null!=t?t:n.data[o.dataKey];i(e)}),[o,t,n.data]),{context:n,settings:o,data:r}}be("vertical-tile",st);const ct={};function ut(e,t){ct[e]=t}function mt(e){const t=ct[e];return t?new t:null}function pt(e){const t=[];return e.forEach((e=>{const n=mt(e);n&&t.push(n)})),t}const ht=(e,t,n)=>!(!w.isNullOrUndefined(n)&&""!==(null==n?void 0:n.trim())&&"normal"!==n&&"hover"!==n&&(w.isNullOrUndefined(t)||""===(null==t?void 0:t.trim())))&&(!w.isNullOrUndefined(t)&&""!==(null==t?void 0:t.trim())||!w.isNullOrUndefined(e)&&"warning"!==(null==e?void 0:e.error_0)),gt=(e,t)=>{let n=!1,o=!1;return Object.entries(e).forEach((([e,t])=>{const r=null==t?void 0:t.error;n=n||ht(r),o=o||!0===(null==r?void 0:r.mandatory)})),w.isFunction(t)&&t(n,o),{hasErrors:n,hasMandatoryErrors:o}},vt=(e,t)=>ne(void 0,void 0,void 0,(function*(){var n;const o=(t||{})[e.key];if(!w.isArray(o))return;const r={count:0};return!0===(null===(n=null==e?void 0:e.originalEvent)||void 0===n?void 0:n.noValidate)||o.forEach(((t,n)=>{var o;const i=mt(null!==(o=null==e?void 0:e.validatorType)&&void 0!==o?o:t.type);if(w.isNullOrUndefined(i))return;e.validatorData&&(i.validatorData=e.validatorData);const l=i.validate(t,e.value);r.mandatory=!0===t.mandatory||"AsAtDate"===e.validatorType,r.errors=l,w.isArray(l)&&l.length>0&&l.forEach(((n,o)=>{r[`error_${o}`]=i.getErrorMessage(t,e.control,n),r.count+=1}))})),r})),ft=(e,t,n,o,r)=>ne(void 0,void 0,void 0,(function*(){var i;if(w.isNullOrUndefined(e)||w.isNullOrUndefined(t))return{hasErrors:!1,hasMandatoryErrors:!1};let l;w.isNullOrUndefined(n)?o((e=>(l=Object.assign({},e),e))):l=Object.assign({},n);const a=[];return null===(i=null==e?void 0:e.tiles)||void 0===i||i.forEach((e=>{var n,o,r,i,s;switch(null===(n=null==e?void 0:e.tile)||void 0===n?void 0:n.tileType){case"form-groups-tile":null===(r=null===(o=null==e?void 0:e.tile)||void 0===o?void 0:o.formGroups)||void 0===r||r.forEach((e=>{var n,o;(null===(n=null==e?void 0:e.controls)||void 0===n?void 0:n.length)&&(null===(o=null==e?void 0:e.controls)||void 0===o||o.forEach((e=>{var n,o;if(!(null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey)||(null==e?void 0:e.control.readOnly))return;const r=l[null===(o=null==e?void 0:e.control)||void 0===o?void 0:o.dataKey];if(r.readOnly||r.hidden)return;a.push(ne(void 0,void 0,void 0,(function*(){var n,o;const i=yield vt({originalEvent:null,control:null==e?void 0:e.control,key:null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey,value:null==r?void 0:r.value},t);!w.isNullOrUndefined(i)&&i.count>0&&(l[null===(o=null==e?void 0:e.control)||void 0===o?void 0:o.dataKey].error=i)})))})))}));break;case"simple-form-tile":null===(s=null===(i=null==e?void 0:e.tile)||void 0===i?void 0:i.controls)||void 0===s||s.forEach((e=>ne(void 0,void 0,void 0,(function*(){var n,o;if(!(null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey)||(null==e?void 0:e.control.readOnly))return;const r=l[null===(o=null==e?void 0:e.control)||void 0===o?void 0:o.dataKey];if(r.readOnly||r.hidden)return;a.push(ne(void 0,void 0,void 0,(function*(){var n,o;const i=yield vt({originalEvent:null,control:null==e?void 0:e.control,key:null===(n=null==e?void 0:e.control)||void 0===n?void 0:n.dataKey,value:null==r?void 0:r.value},t);!w.isNullOrUndefined(i)&&i.count>0&&(l[null===(o=null==e?void 0:e.control)||void 0===o?void 0:o.dataKey].error=i)})))}))));break;default:return}})),yield Promise.all(a),o(l),gt(l,r)})),bt=()=>{const[e,t]=l(0),[n,r]=l({});return{updatingCount:e,updatingFlags:n,setUpdating:o((e=>{t((e=>e+1)),r((t=>Object.assign(Object.assign({},t),{[e]:!0})))}),[e,n]),unsetUpdating:o((e=>{t((e=>e-1)),r((t=>Object.assign(Object.assign({},t),{[e]:!1})))}),[e,n])}},yt=(e,t,n,r,i,a)=>{const d=ve(),[c,u]=l(t),[m,p]=l(null),[h,g]=l(null),[v,f]=l(null),[b,y]=l(null),[x,E]=l(!1),w=o((()=>new Promise((t=>{if(x)return void t(x);const n={};Ye(`graphingForm.validateForm.${e}`,{callback:(e,o)=>{n.hasErrors=!0===(null==n?void 0:n.hasErrors)||e,n.hasMandatoryErrors=1==(null==n?void 0:n.hasMandatoryErrors)||o;const r=!n.hasErrors&&!n.hasMandatoryErrors;r||!0===i||E(!0),t(r)}})}))),[x,e]);s((()=>{if(!n)return;ne(void 0,void 0,void 0,(function*(){yield r(null,t,f,y,null!=a?a:()=>{},n),u(t);const e=t.tiles[0];p(e);const o={};e.tile.controls.forEach((e=>{o[e.control.dataKey]=e})),g(o)}))}),[t,n]);const[M,C]=l(!1),[k,T]=l(!1),N=o(((e,t)=>{const n=!0===t;C(!0===e),T(n)}),[]),[S,F]=l(null),O=o((e=>ne(void 0,void 0,void 0,(function*(){var n,o;if(!t||!v||!S)return{hasErrors:!1,hasMandatoryErrors:!1};const{hasErrors:r,hasMandatoryErrors:i}=yield ft(t,v,null,F,N);return(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.callback)&&(null===(o=null==e?void 0:e.detail)||void 0===o||o.callback(r,i)),{hasErrors:r,hasMandatoryErrors:i}}))),[t,v,S,N]);_e(`graphingForm.validateForm.${e}`,O);const{updatingCount:P,updatingFlags:D,setUpdating:I,unsetUpdating:A}=bt();return{context:d,settings:c,graphingTile:m,graphingControls:h,inputSchemas:v,dropdownValues:b,data:S,setData:F,updatingCount:P,updatingFlags:D,setUpdating:I,unsetUpdating:A,hasErrors:M,hasMandatoryErrors:k,handleSetHasErrors:N,canSubmit:w}};class xt{constructor(){}getErrorMessage(e,t,n){if(w.isNullOrUndefined(n))return n;if(!w.isNullOrUndefined(null==t?void 0:t.validationErrorMessages)&&!w.isNullOrUndefined(t.validationErrorMessages[n])&&w.isString(t.validationErrorMessages[n])&&""!==t.validationErrorMessages[n].trim())return t.validationErrorMessages[n];switch(n){case"mandatory":return"This field is mandatory. Please ensure it is not empty or invalid";case"required":return"This field is required. Please ensure it is not empty or invalid";case"mbRequired":return"warning";case"enum":return w.isArray(null==e?void 0:e.enum)&&e.enum.length>0?`Value must be in this list: ${e.enum.filter((e=>!w.isNullOrUndefined(e)&&""!==e)).join(", ")}`:"Value must be in enum list";case"as-at-future":return"Your current value's as at date must not be in the future"}return n}validate(e,t){const n=this.validateInputValue(e,t);return!0!==(null==e?void 0:e.mbRequired)||this.validateMbRequired(e,t)||n.push("mbRequired"),n}validateInputValue(e,t){const n=[];return!0!==(null==e?void 0:e.mandatory)||this.validateMandatory(e,t)||n.push("mandatory"),!0!==(null==e?void 0:e.required)||this.validateRequired(e,t)||n.push("required"),w.isArray(null==e?void 0:e.enum)&&(null==e?void 0:e.enum.length)>0&&!this.validateEnum(null==e?void 0:e.enum,t)&&n.push("enum"),n}validateMandatory(e,t){return!w.isNullOrUndefined(t)}validateRequired(e,t){return this.validateMandatory(e,t)}validateMbRequired(e,t){return this.validateMandatory(e,t)}validateEnum(e,t){return!(w.isArray(e)&&0!==e.length&&!w.isNullOrUndefined(t))||e.includes(t)}}class Et extends xt{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&!!t.formatted}}ut("Address",Et);class wt extends xt{validateInputValue(e,t){const n=super.validateInputValue(e,t);if(n.length>0)return n;if(M.isValid(t)){const e=new Date(t),o=M.todayUtc();e.getTime()>o.getTime()&&n.push("as-at-future")}return n}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&M.isValid(t)}}ut("AsAtDate",wt);class Mt extends xt{validateInputValue(e,t){const n=super.validateInputValue(e,t);return t=C.parse(t),C.isValid(e.min)&&!this.validateMin(e.min,t)&&n.push("min"),C.isValid(e.max)&&!this.validateMax(e.max,t)&&n.push("max"),n}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${C.getCurrencyText(e.min,!1,e.decimalPlaces||2,"")}`;case"max":return`Data not saved. The value must be less than or equal to ${C.getCurrencyText(e.max,!1,e.decimalPlaces||2,"")}`;default:return super.getErrorMessage(e,t,n)}}validateMin(e,t){return!C.isValid(e)||!C.isValid(t)||t>=e}validateMax(e,t){return!C.isValid(e)||!C.isValid(t)||t<=e}}ut("Number",Mt);class Ct extends Mt{validateInputValue(e,t){return super.validateInputValue(e,t)}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${C.getCurrencyText(e.min,!1,e.decimalPlaces||2)}`;case"max":return`Data not saved. The value must be less than or equal to ${C.getCurrencyText(e.max,!1,e.decimalPlaces||2)}`;default:return super.getErrorMessage(e,t,n)}}}ut("Currency",Ct);class kt extends xt{getErrorMessage(e,t,n){var o,r,i,l;switch(n=super.getErrorMessage(e,t,n)){case"min":if(M.isValid(null===(o=this.validatorData)||void 0===o?void 0:o.min)){const e=M.parse(null===(r=this.validatorData)||void 0===r?void 0:r.min);return`Value cannot be before ${M.format(e,"DD/MM/yyyy")}`}break;case"max":if(M.isValid(null===(i=this.validatorData)||void 0===i?void 0:i.max)){const e=M.parse(null===(l=this.validatorData)||void 0===l?void 0:l.max);return`Value cannot be after ${M.format(e,"DD/MM/yyyy")}`}}return n}validateInputValue(e,t){var n,o,r,i;const l=super.validateInputValue(e,t);if(0===l.length&&M.isValid(t)){const e=M.parse(t);if(M.isValid(null===(n=this.validatorData)||void 0===n?void 0:n.min)){const t=M.parse(null===(o=this.validatorData)||void 0===o?void 0:o.min);(null==t?void 0:t.getTime())>(null==e?void 0:e.getTime())&&l.push("min")}if(M.isValid(null===(r=this.validatorData)||void 0===r?void 0:r.max)){const t=M.parse(null===(i=this.validatorData)||void 0===i?void 0:i.max);(null==t?void 0:t.getTime())<(null==e?void 0:e.getTime())&&l.push("max")}}return l}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&M.isValid(t)}}ut("Date",kt);class Tt extends xt{validateInputValue(e,t){const n=super.validateInputValue(e,t);return!w.isNullOrUndefined(e.minLength)&&E.isValid(e.minLength)&&e.minLength>0&&!this.validateMinLength(e.minLength,t)&&n.push("minLength"),!w.isNullOrUndefined(e.maxLength)&&E.isValid(e.maxLength)&&e.maxLength>0&&!this.validateMaxLength(e.maxLength,t)&&n.push("maxLength"),!w.isNullOrUndefined(e.match)&&w.isString(e.match)&&e.match.length>0&&!this.validateMatch(e.match,t)&&n.push("match"),n}getErrorMessage(e,t,n){const o=super.getErrorMessage(e,t,n);switch(o){case"minLength":return`Data not saved. Minimum ${e.minLength} characters are required`;case"maxLength":return`Data not saved. Maximum ${e.maxLength} characters are allowed`;case"match":return"Data not saved. This field contains invalid characters";default:return o}}validateMinLength(e,t){return!(!(!E.isValid(e)||e<=0||w.isNullOrUndefined(t))&&w.isString(t))||t.length>=e}validateMaxLength(e,t){return!(!(!E.isValid(e)||e<=0||w.isNullOrUndefined(t))&&w.isString(t))||t.length<=e}validateMatch(e,t){if(w.isNullOrUndefined(e)||!w.isString(e)||""===e.trim())return!0;if(w.isNullOrUndefined(t)||!w.isString(t)||""===t.trim())return!0;const n=e.match(/(\/?)(.+)\1([a-z]*)/i),o=n[2],r=n[3];return new RegExp(o,r).test(t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&(w.isString(t)&&t.length>0&&""!==t.trim())}}ut("String",Tt);class Nt extends Tt{validateInputValue(e,t){return super.validateInputValue(e,t)}}ut("Notes",Nt);class St extends xt{validateInputValue(e,t){return super.validateInputValue(e,t)}}ut("ObjectId",St);class Ft extends xt{validateInputValue(e,t){return super.validateInputValue(e,t)}}ut("[ObjectId]",Ft);class Ot extends xt{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){var n,o,r;if(!super.validateMandatory(e,t))return!1;switch(null==t?void 0:t.ownershipType){case"Sole":return 1===(null===(n=null==t?void 0:t.owners)||void 0===n?void 0:n.length);case"Joint":return 2===(null===(o=null==t?void 0:t.owners)||void 0===o?void 0:o.length);case"Other":return(null===(r=null==t?void 0:t.owners)||void 0===r?void 0:r.length)>=1}return!1}}ut("Ownership",Ot);class Pt extends Mt{validateInputValue(e,t){return super.validateInputValue(e,t)}getErrorMessage(e,t,n){switch(n){case"min":return`Data not saved. The value must be greater than or equal to ${C.getCurrencyText(e.min,!1,e.decimalPlaces||2,"")}%`;case"max":return`Data not saved. The value must be less than or equal to ${C.getCurrencyText(e.max,!1,e.decimalPlaces||2,"")}%`;default:return super.getErrorMessage(e,t,n)}}}ut("Percentage",Pt);class Dt extends xt{validateInputValue(e,t){return super.validateInputValue(e,t)}}ut("SelectBoolean",Dt);class It extends xt{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!!super.validateMandatory(e,t)&&(w.isString(t)&&t.length>0&&""!==t.trim()&&null!==E.parse(t))}}ut("SelectNumber",It);class At extends xt{validateInputValue(e,t){return super.validateInputValue(e,t)}validateMandatory(e,t){return!w.isNullOrUndefined(t)&&""!==t.trim()&&this.validateEnum(e.enum,t)}}ut("Select",At);const Rt=(e,t,n)=>{Pe(e,t),Je(e,n)},Vt=()=>{const e=Lt.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(q.unmountComponentAtNode(e),e.remove())}),300))};let Ut=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((n,o)=>{let r,i;"function"==typeof t.onClose&&(r=t.onClose),t.onClose=e=>{r&&r(e),n({dismissed:!1,result:e}),t.showModal=!1,Vt()},"function"==typeof t.onDismiss&&(i=t.onClose),t.onDismiss=()=>{i&&i(),n({dismissed:!0}),t.showModal=!1,Vt()},t.showModal=!0;let l=e.createElement(he,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));Lt.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),q.render(l,this._container)}))}};const Lt=[],jt={},Bt=S((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),$t=t=>{const n=Bt(),o={};t.fixedWidth&&(o.width=t.fixedWidth),t.fixedHeight&&(o.height=t.fixedHeight);let r=n.paper+" moorr-modal-content-container";t.contentClassName&&(r+=" "+t.contentClassName);const[i,a]=l(!1),[d,c]=l(!1);s((()=>{c(!i&&!1!==t.showModal)}),[i,d,t.showModal]);const u=e=>{a(!0),(null==t?void 0:t.onDismiss)&&t.onDismiss(e)};let m=n.modal;switch(m+=" moorr-modal-container",t.effect){case"fade":m+=" moorr-fade-modal";break;case"slide":m+=" moorr-slide-modal"}return i&&(m+=" moorr-modal-closing"),e.createElement(A,{disableEnforceFocus:!0,className:m,open:d,onClose:u,closeAfterTransition:!0,BackdropComponent:R,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),w.isFunction(t.onBackdropClick)?t.onBackdropClick(e):u("backdrop")}}},(()=>{switch(t.effect){case"fade":default:return e.createElement(V,{in:d},e.createElement("div",{className:r,style:o},t.children));case"slide":return e.createElement(f,{in:d,direction:"left",timeout:300},e.createElement("div",{className:r},t.children))}})())},zt=(t,n)=>{switch(t){default:case"info":case"warning":case"error":(t=>{K(t,{icon:e.createElement(_,{sx:{color:"#EB5757"}}),style:{color:"#EB5757",backgroundColor:"#FCECEC",border:"2px solid #EB5757",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(Y,{sx:{color:"#EB5757"}})})})(n);break;case"success":(t=>{K(t,{icon:e.createElement(X,{sx:{color:"#1B5E20"}}),style:{color:"#1B5E20",backgroundColor:"#E8F5E9",border:"2px solid #1B5E20",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(Y,{sx:{color:"#1B5E20"}})})})(n)}},Wt=t=>e.createElement($t,{effect:"fade",contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),Ht=t=>{const{className:n,onDismiss:r,showModal:i,onClose:l,icon:a,title:s,body:d,closeLabel:c}=t,u=o((()=>{l(!1)}),[l]);o((()=>{l(!0)}),[l]);const p=o((()=>w.isString(d)?e.createElement(m,{paragraph:!0},d):w.isArray(d)&&d.length>0?d.map(((t,n)=>{const o=`paragraph-${n}`;if(w.isString(t)||!w.isNullOrUndefined(t))return e.createElement(m,{paragraph:!0,key:o},t)})):w.isNullOrUndefined(d)?e.createElement(m,{paragraph:!0},"Please alert to continue."):d),[d]),g=o((()=>e.createElement(h,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},p())),[p]),v=o((()=>w.isString(s)||!w.isNullOrUndefined(s)?s:"Alert"),[s]),f=o((()=>e.createElement(h,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=a?a:e.createElement(b,null),e.createElement(m,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},v()),e.createElement(y,{onClick:u,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"},"data-testid":"dismiss"},e.createElement(Y,{sx:{fontSize:"1rem"}})))),[a,v,u]),x=o((()=>{const t=c||"Dismiss";return e.createElement(oe,{handleClick:u,label:t,"data-testid":`${k.toKebabCase(t)}`})}),[c,u]);return e.createElement(Wt,{className:"alert-modal"+(n?" "+n:""),widthValue:"400px",showModal:!0===i,onDismiss:r,onBackdropClick:u,renderHeader:f(),renderBody:g(),renderStatusMessage:x()})};class Gt extends Ut{constructor(e){super(e)}getComponent(){return Ht}}jt.alert=Gt;const qt=t=>{const{className:n,onDismiss:r,showModal:i,onClose:l,icon:a,title:s,body:d,cancelLabel:c,confirmLabel:u}=t,p=o((()=>{l(!1)}),[l]),g=o((()=>{l(!0)}),[l]),v=o((()=>w.isString(d)?e.createElement(m,{paragraph:!0},d):w.isArray(d)&&d.length>0?d.map(((t,n)=>{const o=`paragraph-${n}`;if(w.isString(t)||!w.isNullOrUndefined(t))return e.createElement(m,{paragraph:!0,key:o},t)})):w.isNullOrUndefined(d)?e.createElement(m,{paragraph:!0},"Please confirm to continue."):d),[d]),f=o((()=>e.createElement(h,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},v())),[v]),x=o((()=>w.isString(s)||!w.isNullOrUndefined(s)?s:"Confirm"),[s]),E=o((()=>e.createElement(h,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=a?a:e.createElement(b,null),e.createElement(m,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},x()),e.createElement(y,{onClick:p,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(Y,{sx:{fontSize:"1rem"},"data-testid":"dismiss"})))),[a,x,p]),M=o((()=>{const t=c||"Cancel";return e.createElement(ie,{handleClick:p,label:t,"data-testid":`${k.toKebabCase(t)}`})}),[c,p]),C=o((()=>{const t=u||"Dismiss";return e.createElement(oe,{handleClick:g,label:t,"data-testid":`${k.toKebabCase(t)}`})}),[u,g]);return e.createElement(Wt,{className:"confirm-modal"+(n?" "+n:""),widthValue:"400px",showModal:!0===i,onDismiss:r,onBackdropClick:p,renderHeader:E(),renderBody:f(),renderLeftButtons:M(),renderRightButtons:C()})};class Kt extends Ut{constructor(e){super(e)}getComponent(){return qt}}jt.confirm=Kt;const _t=t=>{const{className:n,header:o,body:r,leftButtonLabel:i,rightButtonLabel:l,hiddenClose:a,width:s}=t,d=e=>{e.stopPropagation(),t.onDismiss()};return e.createElement(Wt,{className:"opti-info-modal"+(n?" "+n:""),widthValue:null!=s?s:"554px",showModal:!0===t.showModal,onDismiss:t.onDismiss,renderBody:e.createElement(h,{sx:{display:"flex",flexDirection:"row",position:"relative"}},e.createElement(h,{sx:{position:"absolute",right:"12px",top:"12px",cursor:"pointer"}},e.createElement("svg",{onClick:t.onDismiss,width:"20",height:"20",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M16.8564 6.35381L12.2707 10.9395L16.8976 15.5664L15.5609 16.903L10.9341 12.2762L6.36889 16.8414L5.13506 15.6075L9.70023 11.0424L5.07337 6.4155L6.41002 5.07885L11.0369 9.70571L15.6226 5.11998L16.8564 6.35381Z",fill:"#541868"}))),e.createElement(h,{sx:{width:"60px",background:"#541868",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",flexShrink:0}}),e.createElement(h,{sx:{position:"absolute",top:"11.81px",left:"12px",borderRadius:"50% 50% 0% 50%",padding:"5px",background:"white"}},e.createElement("img",{style:{height:"50px",background:"#66E84B",borderRadius:"50% 50% 0% 50%",padding:"5px"},src:"/assets/img/opti/Opti-Blinked.gif"})),e.createElement(h,{sx:{padding:"1rem 1rem 1rem 1.5rem"}},e.createElement(h,{sx:{color:"#541868",fontSize:"16px",lineHeight:"22.4px",fontWeight:400}},o),e.createElement(h,{sx:{marginTop:"1rem"}},r),e.createElement(h,{className:"opti-info-modal-buttons",sx:{textAlign:"right",marginTop:"1rem"}},i&&e.createElement(x,{className:"opti-info-modal-button-left",style:{marginRight:"5px"},variant:"contained",color:"primary",onClick:()=>{},"data-testid":`${k.toKebabCase(i)}`},i),!a&&e.createElement(oe,{label:"Close",handleClick:d,"data-testid":"close"}))))})};class Yt extends Ut{constructor(e){super(e)}getComponent(){return _t}}jt.optiInfo=Yt;const Xt=e=>{var t,n,o,r,i;const l=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!l||!jt[l])return Promise.reject("invalid-modal");const a=new jt[l]((null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.props)||{}).open();(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.then)&&a.then((t=>{var n;try{null===(n=null==e?void 0:e.detail)||void 0===n||n.then(t)}catch(e){console.error(e)}})),(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.catch)&&a.catch(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.catch),a.finally((()=>{var t,n;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(n=null==e?void 0:e.detail)||void 0===n||n.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=a)};document&&(document.removeEventListener("openModal",Xt),document.addEventListener("openModal",Xt));const Zt=(e,t)=>{const[n,r]=l(null),i=a(null),d=o((e=>{if(!e)return;const n=Object.assign({},e.contentRect.toJSON());E.isValid(t)&&t>0?(clearTimeout(i.current),i.current=setTimeout((()=>{r(n)}),t)):r(n)}),[t]);return s((()=>{const t=e.current;let n;return t&&(n=new ResizeObserver((([e])=>d(e))),n.observe(t)),()=>{n&&t&&(n.unobserve(t),n.disconnect())}}),[e.current]),n},Jt=r({}),Qt=()=>i(Jt),en=()=>({context:Qt()}),tn=(e,t,n)=>{var r,i;const{context:a}=en();s((()=>{var e,t;w.mutexRelease(null!==(t=null===(e=null==a?void 0:a.sectionContext)||void 0===e?void 0:e.updateSessionId)&&void 0!==t?t:"default")}),[null===(r=null==a?void 0:a.sectionContext)||void 0===r?void 0:r.updateSessionId]);const[d,c]=l(0),u=o((()=>{c((e=>e+1))}),[]),[m,p]=l(!1),[h,g]=l(!1),v=o(((e,t)=>{const n=!0===t;p(!0===e),g(n)}),[]),f=o((n=>ne(void 0,void 0,void 0,(function*(){if(w.isFunction(t)){const[e]=yield Promise.all([t(n)]);if(!e)return}return a.onMoveBack&&a.onMoveBack({section:e,data:n})}))),[h,t,a.onMoveBack]),[b,y]=l(!1),[x,E]=l(!1),[M,C]=l(null);s((()=>{x&&a.onMoveNext&&a.onMoveNext({section:e,data:M})}),[x,M]);const k=o((e=>ne(void 0,void 0,void 0,(function*(){var t,o;try{y(!0),yield w.delay(350),yield w.mutex(null!==(o=null===(t=null==a?void 0:a.sectionContext)||void 0===t?void 0:t.updateSessionId)&&void 0!==o?o:"default",(()=>ne(void 0,void 0,void 0,(function*(){if(yield w.delay(350),w.isFunction(n)){const[t]=yield Promise.all([n(e)]);if(!t)return}else if(m||h)return;E(!0),C(e)}))))}finally{y(!1)}}))),[null===(i=null==a?void 0:a.sectionContext)||void 0===i?void 0:i.updateSessionId,m,h,n]),{updatingCount:T,updatingFlags:N,setUpdating:S,unsetUpdating:F}=bt();return{context:a.sectionContext,sectionStep:d,nextSectionStep:u,hasErrors:m,hasMandatoryErrors:h,handleSetHasErrors:v,moveBack:f,moveNext:k,awaitingMoveNext:b,updatingCount:T,updatingFlags:N,setUpdating:S,unsetUpdating:F}},nn=(e,t,n)=>{const[r,i]=l(t),[a,d]=l(null),[c,u]=l(null),[m,p]=l(null),[h,g]=l(!1),v=o((()=>new Promise((t=>{if(h)return void t(h);const n={};Ye(`wizardSection.validateForm.${e}`,{callback:(e,o)=>{n.hasErrors=!0===(null==n?void 0:n.hasErrors)||e,n.hasMandatoryErrors=1==(null==n?void 0:n.hasMandatoryErrors)||o;const r=!n.hasErrors&&!n.hasMandatoryErrors;r||g(!0),t(r)}})}))),[h,e]),{context:f,sectionStep:b,nextSectionStep:y,updatingCount:x,updatingFlags:E,setUpdating:w,unsetUpdating:M,hasErrors:C,hasMandatoryErrors:k,handleSetHasErrors:T,moveBack:N,moveNext:S,awaitingMoveNext:F}=tn(e,void 0,v);s((()=>{if(!(null==f?void 0:f.validationSchemas))return;ne(void 0,void 0,void 0,(function*(){yield n(null,t,p,(()=>{}),(()=>{}),f.validationSchemas),i(t);const e=t.tiles[0];d(e);const o={};e.tile.controls.forEach((e=>{o[e.control.dataKey]=e})),u(o)}))}),[t,null==f?void 0:f.validationSchemas]);const[O,P]=l(null),D=o((e=>ne(void 0,void 0,void 0,(function*(){var n,o;if(!t||!m||!O)return{hasErrors:!1,hasMandatoryErrors:!1};const{hasErrors:r,hasMandatoryErrors:i}=yield ft(t,m,null,P,T);return(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.callback)&&(null===(o=null==e?void 0:e.detail)||void 0===o||o.callback(r,i)),{hasErrors:r,hasMandatoryErrors:i}}))),[t,m,O,T]);return _e(`wizardSection.validateForm.${e}`,D),{context:f,sectionStep:b,nextSectionStep:y,settings:r,graphingTile:a,graphingControls:c,inputSchemas:m,data:O,setData:P,updatingCount:x,updatingFlags:E,setUpdating:w,unsetUpdating:M,hasErrors:C,hasMandatoryErrors:k,handleSetHasErrors:T,moveBack:N,moveNext:S,awaitingMoveNext:F}},on=e=>{const[t,n]=l(e),[o,r]=l(null),[i,a]=l(null);return s((()=>{n(e);const t=e.tiles[0];r(t);const o={};t.tile.controls.forEach((e=>{o[e.control.dataKey]=e})),a(o)}),[e]),{settings:t,graphingTile:o,graphingControls:i}},rn=t(((t,n)=>{var{stepIndex:o,sectionStep:r,onNextSectionStep:i,onStepIncrease:l,enterTimeout:a,onEntered:s,children:d}=t,c=te(t,["stepIndex","sectionStep","onNextSectionStep","onStepIncrease","enterTimeout","onEntered","children"]);return e.createElement(J,{in:r>=o,timeout:{enter:null!=a?a:600},mountOnEnter:!0,onEntered:()=>{i&&i(),s&&s()}},e.createElement(Z,Object.assign({},c,{ref:n}),d))})),ln=t(((t,r)=>{var i,l,{section:a,children:d,animate:c,animateIn:m,animateOut:p,animateEasing:h,animateDuration:g,maxWidth:v,sx:f}=t,b=te(t,["section","children","animate","animateIn","animateOut","animateEasing","animateDuration","maxWidth","sx"]);const y=u("(max-width: 700px)"),x=Qt();s((()=>{x.setSectionMaxWidth(null!=v?v:0)}),[v]);const M=n((()=>{var e;let t={position:"absolute",height:"100%",top:0,overflowY:"auto",overflowX:"hidden","&::-webkit-scrollbar":{width:"6px",height:"6px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#a98bb3",borderRadius:"6px"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:"rgb(118, 70, 134)"},"&::-webkit-scrollbar-track":{background:"rgba(118, 70, 134, 0.15)",borderRadius:"6px"}};if(!y&&E.isValid(v)&&v>0&&!w.isNullOrUndefined(null===(e=x.containerRect)||void 0===e?void 0:e.width)&&x.containerRect.width>v){const e=Math.floor((x.containerRect.width-v)/2);t=Object.assign(Object.assign({},t),{left:e,width:`calc(100% - ${e}px)`})}else t=Object.assign(Object.assign({},t),{left:0,width:"100%",padding:y?"0 0.75rem":"0"});return t}),[y,v,null===(i=x.containerRect)||void 0===i?void 0:i.width]),C=n((()=>{var e;let t=Object.assign(Object.assign({},f),{width:"100%"});return E.isValid(v)&&v>0&&!w.isNullOrUndefined(null===(e=x.containerRect)||void 0===e?void 0:e.width)&&x.containerRect.width>v&&(t=Object.assign(Object.assign({},t),{maxWidth:v})),t}),[f,v,null===(l=x.containerRect)||void 0===l?void 0:l.width]),k=o((()=>e.createElement(Z,Object.assign({},b,{ref:r,className:`wizard-section wizard-section-${a}`,sx:M}),e.createElement(Z,{sx:C},d))),[a,M,C,d,b]),T=n((()=>{var e;return null!==(e=null!=c?c:x.animate)&&void 0!==e?e:"fade"}),[x.animate,c]),N=n((()=>({enter:!1!==m?null!=g?g:300:0,exit:!1!==p?null!=g?g:300:0})),[m,p,g]),S=n((()=>null!=h?h:"ease-in-out"),[]),F=o((()=>e.createElement(J,{easing:S,timeout:N,in:x.section===a,mountOnEnter:!0,unmountOnExit:!0,onEnter:e=>{e.style.opacity="0"},onEntering:e=>{e.style.opacity="1"},onEntered:e=>{e.style.opacity="",e.style.transition="",x.setSectionMaxWidth(null!=v?v:0)}},k())),[S,N,x.section,a,k]),O=n((()=>{switch(T){case"scroll-up":return"back"!==x.moveDirection?x.section===a?"up":"down":x.section===a?"down":"up";case"scroll-down":return"back"!==x.moveDirection?x.section===a?"down":"up":x.section===a?"up":"down";case"scroll-left":return"back"!==x.moveDirection?x.section===a?"left":"right":x.section===a?"right":"left";case"scroll-right":return"back"!==x.moveDirection?x.section===a?"right":"left":x.section===a?"left":"right"}}),[x.section,x.moveDirection,a,T]),P=o((()=>e.createElement(Q,{container:x.containerRef.current,direction:O,easing:S,timeout:N,in:x.section===a,mountOnEnter:!0,unmountOnExit:!0,onEnter:e=>{var t,n,o,r;switch(O){case"up":e.style.transform=e.style.webkitTransform=`translateY(${null===(t=x.containerRect)||void 0===t?void 0:t.height}px)`;break;case"down":e.style.transform=e.style.webkitTransform=`translateY(-${null===(n=x.containerRect)||void 0===n?void 0:n.height}px)`;break;case"left":e.style.transform=e.style.webkitTransform=`translateX(${null===(o=x.containerRect)||void 0===o?void 0:o.width}px)`;break;case"right":e.style.transform=e.style.webkitTransform=`translateX(-${null===(r=x.containerRect)||void 0===r?void 0:r.height}px)`}},onEntering:e=>{switch(O){case"up":case"down":e.style.transform=e.style.webkitTransform="translateY(0)";break;case"left":case"right":e.style.transform=e.style.webkitTransform="translateX(0)"}},onEntered:e=>{e.style.transform="",e.style.webkitTransform="",e.style.transition="",x.setSectionMaxWidth(null!=v?v:0)}},k())),[S,N,x.section,a,O,x.containerRect,k]),D=o((()=>{switch(T){case"fade":return F();case"scroll-up":case"scroll-down":case"scroll-left":case"scroll-right":return P()}return x.section!==a?null:k()}),[x.section,a,T,F,P,k]);return e.createElement(e.Fragment,null,D())})),an=t((({children:t,initialSection:r,animate:i,avatar:c,isAvatarVisible:u,sx:m,onMoveBack:p,onMoveNext:h,onSectionChange:g,sectionContext:v},f)=>{const b=a(null),y=Zt(b),[x,M]=l(r);s((()=>{r&&g&&g(r)}),[r]);const[C,k]=l(null),[T,N]=l(),S=a(null),F=Zt(S),O=o(((e,t)=>{e!==x&&(M(e),k(null!=t?t:null),g&&g(e))}),[x,g]),P=n((()=>({containerRef:b,containerRect:y,section:x,moveDirection:C,onMoveBack:p,onMoveNext:h,changeSection:O,setSectionMaxWidth:N,animate:i,sectionContext:v})),[y,x,C,p,h,O,i,v]);d(f,(()=>({section:x,context:P})),[x,P]);const D=n((()=>{if(w.isNullOrUndefined(y))return null;if(w.isNullOrUndefined(c)||w.isNullOrUndefined(F))return null;let e={display:"inline-block",position:"absolute"};return e=w.isFunction(u)&&!u(x)?Object.assign(Object.assign({},e),{opacity:0}):Object.assign(Object.assign({},e),{opacity:1}),E.isValid(T)&&T>0&&(e=Object.assign(Object.assign({},e),{left:Math.floor((y.width-T)/2)-F.width})),e}),[y,c,u,F,T]),I=o((()=>w.isNullOrUndefined(T)||0===T||w.isNullOrUndefined(D)?null:c),[T,c,D]);return e.createElement(Z,{ref:b,sx:Object.assign({position:"relative"},m)},e.createElement(Jt.Provider,{value:P},e.createElement(Z,{ref:S,sx:D},I()),t))}));export{Et as AddressValidator,Gt as AlertModal,wt as AsAtDateValidator,ee as Button,Kt as ConfirmModal,Ct as CurrencyValidator,kt as DateValidator,de as Dropdown,Wt as FadeModal,Ue as FormGroupAddActionModel,Le as FormGroupModel,ot as FormGroupsTile,ze as FormGroupsTileModel,Re as FormInputModel,ge as GraphingContext,Qe as GraphingControl,Ae as GraphingControlModel,Ve as GraphingControlSettingsModel,Xe as GraphingGrid,tt as GraphingPage,Fe as GraphingSettingsModel,ye as GraphingTile,et as GraphingTileControls,je as GraphingTileModel,Se as GraphingTileSettingsModel,Me as GraphingTiles,rt as HorizontalTile,We as HorizontalTileModel,Ut as Modal,$t as MoorrModal,$e as MultipleControlsTileModel,Nt as NotesValidator,Mt as NumberValidator,St as ObjectIdValidator,Ft as ObjectIdsValidator,Yt as OptiInfoModal,Ot as OwnershipValidator,Pt as PercentageValidator,oe as PrimaryButton,re as QtyButton,ie as SecondaryButton,Dt as SelectBooleanValidator,le as SelectButton,It as SelectNumberValidator,At as SelectValidator,it as SelectableStatesTile,He as SelectableStatesTileModel,lt as SimpleFormTile,Ge as SimpleFormTileModel,Be as SingleControlTileModel,at as SingleTile,qe as SingleTileModel,Tt as StringValidator,he as StylesProvider,me as SvgIcon,xt as Validator,st as VerticalTile,Ke as VerticalTileModel,an as Wizard,ln as WizardSection,rn as WizardSectionStep,gt as checkDataForErrors,De as createGraphingControl,Ie as createGraphingControls,Te as createGraphingTile,Ne as createGraphingTiles,mt as createValidator,pt as createValidators,Ye as dispatchRootEvent,ht as hasInputError,jt as modals,Lt as modalsStack,Pe as registerGraphingControl,Je as registerGraphingControlComponent,Rt as registerGraphingFrameworkComponent,ke as registerGraphingTile,be as registerGraphingTileComponent,ue as registerSvgIconComponent,ut as registerValidator,zt as toastMessage,ve as useGraphingContext,yt as useGraphingForm,dt as useGraphingFramework,Zt as useResizeObserver,_e as useRootEventListener,bt as useUpdateTracker,en as useWizard,Qt as useWizardContext,on as useWizardForm,nn as useWizardFormSection,tn as useWizardSection,ft as validateData,vt as validateInput};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moorr-react-mui",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "Moorr React MUI Common Library",
5
5
  "scripts": {
6
6
  "_clear": "rimraf index.* && rimraf typings/* && rimraf cjs/*",