@oc-digital/react-component-library 2.4.2-beta.0 → 2.4.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import e,{memo as t,useState as r,useMemo as n,useCallback as a,useEffect as o,useRef as i,forwardRef as l,Fragment as d}from"react";import{makeStyles as c,Button as s,CircularProgress as m,Typography as u,Box as p,withStyles as g,createStyles as f,TableRow as h,TableHead as v,Table as b,TableBody as y,TableCell as x,Link as E,ButtonBase as w,Grid as C,ListItem as k,ListItemIcon as B,ListItemText as S,Collapse as N,List as R,IconButton as I,Container as T,Divider as F,InputBase as L,InputAdornment as A,TextField as P,MenuItem as W,Checkbox as D,FormControl as O,Select as H,FormHelperText as M,Tooltip as z,Avatar as j}from"@material-ui/core";import{string as G}from"yup";import{Pagination as K,Alert as V}from"@material-ui/lab";import{Link as U,useLocation as Y,useHistory as J}from"react-router-dom";import q from"@material-ui/icons/Error";import{ExpandLess as X,ExpandMore as Q,CloudUpload as $,Forward as Z}from"@material-ui/icons";import{isValid as _}from"date-fns";import ee from"@material-ui/icons/Close";import te from"@material-ui/icons/AddBoxOutlined";import re from"@material-ui/icons/Search";import{isEqual as ne}from"lodash";import ae from"react-number-format";import{MuiPickersUtilsProvider as oe,DatePicker as ie,KeyboardDatePicker as le}from"@material-ui/pickers";import de from"@date-io/date-fns";import{useTable as ce,useFilters as se,useGlobalFilter as me,usePagination as ue,useRowSelect as pe,useAsyncDebounce as ge}from"react-table";import{useVirtual as fe}from"react-virtual";var he=function(){return he=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},he.apply(this,arguments)};function ve(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}function be(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{d(n.next(e))}catch(e){o(e)}}function l(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}d((n=n.apply(e,t||[])).next())}))}function ye(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(d){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){i.label=l[1];break}if(6===l[0]&&i.label<a[1]){i.label=a[1],a=l;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(l);break}a[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,d])}}}function xe(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}G().trim().required("Required"),G().trim().required("Required").matches(/^\d*\.?\d*$/,"Must be a Number");var Ee="success",we="error",Ce="loading",ke="enabled",Be="warning",Se="deleting",Ne="read",Re="noAccess",Ie=c({labelBreak:{marginBottom:"0.5rem"},contentBreak:{marginBottom:"1rem"},sectionBreak:{marginBottom:"1.5rem"},doubleSectionBreak:{marginBottom:"3rem"},rightSpacer1:{marginRight:"0.5rem"},rightSpacer2:{marginRight:"1rem"},leftSpacer1:{marginLeft:"0.5rem"},leftSpacer2:{marginLeft:"1rem"},buttonSpacing:{marginLeft:"0.5rem",marginRight:"0.5rem",marginBottom:"1rem"},leftRightPadding1:{paddingLeft:"0.5rem",paddingRight:"0.5rem"},leftRightPadding2:{paddingLeft:"1rem",paddingRight:"1rem"},topBottomPadding1:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},topBottomPadding2:{paddingTop:"1rem",paddingBottom:"1rem"}},{classNamePrefix:"spacing",index:2}),Te=c((function(e){return{boldText:{fontWeight:700},bolderText:{fontWeight:500},smallText:{fontSize:"0.7rem"},warningColor:{color:e.palette.warning.main},centerText:{textAlign:"center"}}}),{classNamePrefix:"font"}),Fe=c({contentBox:{background:"white",borderRadius:"14px",marginBottom:"1rem",padding:"3rem"},limitWidth60rem:{maxWidth:"60rem",marginLeft:"auto",marginRight:"auto"},limitWidth50rem:{maxWidth:"50rem",marginLeft:"auto",marginRight:"auto"},limitWidth45rem:{maxWidth:"45rem",marginLeft:"auto",marginRight:"auto"},limitWidth40rem:{maxWidth:"40rem",marginLeft:"auto",marginRight:"auto"},limitWidth35rem:{maxWidth:"35rem",marginLeft:"auto",marginRight:"auto"},limitWidth30rem:{maxWidth:"30rem",marginLeft:"auto",marginRight:"auto"},limitWidth25rem:{maxWidth:"25rem",marginLeft:"auto",marginRight:"auto"},centeredText:{textAlign:"center"},startAlignedText:{textAlign:"start"},width20:{width:"20%"},width49:{width:"49%"},width50:{width:"50%"},width60:{width:"60%"},width100:{width:"100%"},flexCenter:{display:"flex",alignItems:"center",justifyContent:"center"},centerJustify:{justifyContent:"center"},leftJustify:{justifyContent:"left"},rightJustify:{justifyContent:"right"}},{classNamePrefix:"layout",index:2}),Le=c((function(e){return{submitButton:{borderRadius:"1.5rem",padding:"0.4rem 1rem",textTransform:"none"},containedText:{color:"white"},spinnerColour:{color:e.palette.grey[500]}}})),Ae=function(t){var r=t.loading,n=void 0!==r&&r,a=t.children,o=t.errors,i=void 0!==o&&o,l=t.type,d=void 0===l?"submit":l,c=t.onClick,u=t.disabled,p=void 0!==u&&u,g=t.variant,f=void 0===g?"outlined":g,h=t.styling,v=void 0===h?"":h,b=t.color,y=void 0===b?"primary":b,x=t.accessLevel,E=void 0===x?"":x,w=ve(t,["loading","children","errors","type","onClick","disabled","variant","styling","color","accessLevel"]),C=he(he({},Ie()),Le());if([Re,Ne].includes(E))return null;var k=p;return p||!n&&!i||(k=!0),e.createElement(s,he({},w,{variant:f,color:y,type:d,className:C.submitButton+" "+("contained"===f&&C.containedText)+" "+v,disabled:k,onClick:c}),a,n?e.createElement(m,{className:C.leftSpacer1+" "+C.spinnerColour,size:"1.1rem",thickness:6}):"")},Pe=function(t){var r=t.children,n=t.styling,a=void 0===n?null:n,o=Te();return e.createElement(u,{variant:"h6",className:o.bolderText+" "+(a||"")},r)},We=function(t){var r=t.limitWidth,n=void 0!==r&&r,a=t.children,o=t.styling,i=he(he({},Ie()),Fe());return e.createElement(p,{boxShadow:3,className:i.contentBox+" "+(o||"")},e.createElement(p,{className:i.centeredText+" "+(n?i.limitWidth50rem:"")},a))},De=function(t){var r=t.text,n=void 0===r?"Loading data...":r,a=t.styling,o=he(he({},Ie()),Fe());return e.createElement(p,{className:o.flexCenter+" "+(a||"")},e.createElement(u,{variant:"body2",color:"textSecondary",className:o.rightSpacer1},n),e.createElement(m,{size:"1.5rem"}))},Oe=g(f({root:{"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),He=g(f({root:{"&:nth-of-type(even) td":{backgroundColor:"rgba(0, 0, 0, 0.03)"},"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),Me=c((function(e){return{root:{borderBottom:"none",paddingTop:"8px",paddingBottom:"8px","&:first-child":{borderTopLeftRadius:"14px",borderBottomLeftRadius:"14px"},"&:last-child":{borderTopRightRadius:"14px",borderBottomRightRadius:"14px"}},head:function(t){var r=t.background,n=t.border;return{backgroundColor:r||"HSLA(204, 58.3%, 81.2%, 0.1)",borderTop:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)"),borderBottom:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)"),color:t.text||e.palette.text.primary,fontWeight:500,"&:first-child":{borderLeft:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)")},"&:last-child":{borderRight:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)")}}}}})),ze=function(t){var r=t.children,n=t.align,a=void 0===n?"centerJustify":n,o=t.headerColours,i=ve(t,["children","align","headerColours"]),l=he(he({},Fe()),Me(he({},o||{})));return e.createElement(x,he({},i,{classes:{root:l.root,head:l.head}}),e.createElement("div",{className:l.flexCenter+" "+l[a]},r))},je=function(t){var r=t.rowBorderSeparation,n=void 0!==r&&r,a=t.children,o=ve(t,["rowBorderSeparation","children"]);return n?e.createElement(Oe,he({},o),a):e.createElement(He,he({},o),a)},Ge=function(t){var r=t.colSpan,n=t.children,a=Ke();return e.createElement(je,null,e.createElement(ze,{className:a.adjustedCellPadding,colSpan:r},n))},Ke=c({tableStyles:{borderCollapse:"separate",borderBottom:"1px solid rgb(224, 224, 224)"},pointer:{cursor:"pointer"},bottomBorder:{borderBottom:"1px solid rgba(224, 224, 224, 1)"},noShading:{backgroundColor:"transparent !important"},adjustedCellPadding:{paddingTop:"11px",paddingBottom:"11px"}}),Ve=t((function(t){var r=t.headers,n=t.headerCellAlignment,a=void 0===n?[]:n,o=t.headerColours;return r?e.createElement(v,null,e.createElement(h,null,r.map((function(t,r){return e.createElement(ze,{align:a[r]||"centerJustify",key:"header-cell-"+r,headerColours:o},t)})))):null})),Ue=t((function(t){var i=t.rowBorderSeparation,l=void 0!==i&&i,d=t.headers,c=t.rows,s=t.headerCellAlignment,m=void 0===s?[]:s,u=t.rowCellAlignment,p=void 0===u?[]:u,g=t.styling,f=t.headerColours,h=t.paginate,v=void 0!==h&&h,x=t.itemsPerPage,E=void 0===x?30:x,w=he(he(he({},Fe()),Ie()),Ke()),C=r(1),k=C[0],B=C[1],S=n((function(){return!!(v&&((null==c?void 0:c.length)||0)>E)}),[E,v,c]),N=r(S?c.slice(0,E):c),R=N[0],I=N[1],T=a((function(e,t){B(t)}),[]);return o((function(){I(S?c.slice(E*(k-1),E*k):c)}),[S,E,k,c]),e.createElement(e.Fragment,null,e.createElement(b,{className:w.tableStyles+" "+(S?w.contentBreak:"")+" "+(g||"")},e.createElement(Ve,{headers:d,headerCellAlignment:m,headerColours:f}),e.createElement(y,null,R?R.length?R.map((function(t,r){var n=!!t.onClick;return e.createElement(je,{rowBorderSeparation:l,className:n?w.pointer:void 0,key:"row-"+r,onClick:n?t.onClick:void 0},t.row.map((function(t,n){return e.createElement(ze,{align:p[n]||"centerJustify",className:l&&R.length!==r+1?w.bottomBorder:void 0,key:"row-"+r+"-cell-"+n},t)})))})):e.createElement(Ge,{colSpan:(null==d?void 0:d.length)||0},"Table is empty"):e.createElement(Ge,{colSpan:(null==d?void 0:d.length)||0},e.createElement(De,null)))),S?e.createElement(K,{className:w.flexCenter,count:Math.ceil(c.length/E),page:k,onChange:T,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Ye=c((function(e){return{logoContainer:{width:"3rem",height:"3rem",display:"flex",justifyContent:"center",alignItems:"center"},logo:{width:"100%",height:"100%","& > div":{width:"100%",height:"100%"},"& > svg":{width:"100%",height:"100%"}},logoInBreadcrumb:{width:"2rem",height:"2rem",margin:"0.125rem 0 0.125rem 0.313rem"},logoSpacing:{marginRight:e.spacing(1)},flexItemsCenter:{display:"flex",alignItems:"center"},nonPrimaryBreadcrumbOffset:{marginLeft:"2.5rem"},BreadcrumbsContainer:{height:"2.25rem",marginLeft:"0.875rem",marginRight:"1.5rem"},primaryBreadcrumbItem:function(t){var r=t.primary;return{backgroundColor:(null==r?void 0:r.background)||e.palette.common.white,color:(null==r?void 0:r.color)||e.palette.text.primary,borderRadius:"2rem",zIndex:3,height:"100%",display:"flex",alignItems:"center"}},secondaryBreadcrumbItem:function(t){var r=t.secondary;return{height:"2.25rem",backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",borderRadius:"2rem",zIndex:2,marginLeft:"-2rem",color:(null==r?void 0:r.color)||e.palette.text.primary}},tertiaryBreadcrumbItem:function(t){var r=t.tertiary;return{height:"2.25rem",backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",borderRadius:"2rem",zIndex:1,marginLeft:"-2rem",color:(null==r?void 0:r.color)||e.palette.common.white}},breadCrumbShadow:{boxShadow:e.shadows[2]},breadcrumbRightMargin:{marginRight:"1rem"},breadcrumbTextOverflow:{display:"block",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"12rem"},boldText:{fontWeight:500},activeBreadcrumb:function(t){var r=t.tertiary;return{backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",color:(null==r?void 0:r.color)||e.palette.common.white}},noWrap:{whiteSpace:"nowrap"},fullBorderRadius:{borderRadius:"100%"}}})),Je=function(t){var r=t.logo,n=t.content,a=t.colors,o=Ye(he({},a||{})),i=n.first,l=void 0===i?null:i,d=n.second,c=void 0===d?null:d,s=n.third,m=void 0===s?null:s;return e.createElement(p,{className:o.BreadcrumbsContainer+" "+o.flexItemsCenter},e.createElement(p,{className:(l?o.primaryBreadcrumbItem+" "+o.breadCrumbShadow:"")+" "+o.flexItemsCenter},e.createElement(E,{component:U,to:"/",className:o.logoSpacing},e.createElement(p,{className:o.logoContainer+" \n "+(l?o.logoInBreadcrumb:"")},e.createElement(w,{className:o.logo+" "+o.fullBorderRadius},r))),l&&e.createElement(u,{color:"textPrimary",className:o.boldText+" "+o.noWrap+" "+o.primaryBreadcrumbItem},e.createElement(E,{underline:"none",component:U,to:l.link,color:"inherit",className:o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},l.name))),c&&e.createElement(p,{className:o.flexItemsCenter+" "+o.secondaryBreadcrumbItem+" "+o.breadCrumbShadow+" "+(m?"":o.activeBreadcrumb)},e.createElement(u,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(E,{component:U,underline:"none",to:c.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},c.name))),m&&e.createElement(p,{className:o.flexItemsCenter+" "+o.tertiaryBreadcrumbItem+" "+o.breadCrumbShadow},e.createElement(u,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(E,{component:U,underline:"none",to:m.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},m.name))))},qe=c((function(e){return{container:{marginRight:e.spacing(-1.5),marginLeft:e.spacing(-1.5)},svgContainer:{marginLeft:"auto",marginRight:"auto"},button:{display:"block",textDecoration:"none",borderRadius:"14px",height:"100%",width:"100%",textAlign:"center"},orgLabel:{padding:e.spacing(1),paddingTop:0}}})),Xe=function(t){var r=t.entities,n=t.icon,a=t.loadingMessage,o=void 0===a?"Loading list...":a,i=t.emptyMessage,l=void 0===i?"List is empty":i,d=t.onClick,c=he(he(he({},qe()),Ie()),Te());return e.createElement(p,{className:c.container},r?r.length?e.createElement(C,{container:!0,spacing:3},r.map((function(t,r){return e.createElement(C,{key:t.name+"-"+r,item:!0,xs:4,md:3},e.createElement(s,he({className:c.button,key:t.name},d?{onClick:function(){return d(t)}}:{component:U,to:t.link}),e.createElement(p,{className:c.svgContainer+" "+c.labelBreak},n(t)),e.createElement(u,{className:c.orgLabel,variant:"body1"},t.name)))}))):e.createElement(u,{className:c.centerText,variant:"body2",color:"textSecondary"},l):e.createElement(De,{text:o}))},Qe=function(t){var r=t.text,n=void 0===r?"Something went wrong":r,a=he(he({},Ie()),Fe());return e.createElement(p,{className:a.flexCenter},e.createElement(q,{fontSize:"medium",className:a.rightSpacer1,color:"error"}),e.createElement(u,{variant:"body2",color:"textSecondary"},n))},$e=c((function(e){return{listIcon:{minWidth:"auto",paddingRight:"0.25rem"},mainIconSize:{fontSize:"1rem"},mainIconMarginAdjustment:{marginTop:"3px"},textOverflowElipsis:{overflow:"hidden",textOverflow:"ellipsis"},mainListItem:function(t){return{padding:"8px 24px 8px 16px",alignItems:"flex-start",backgroundColor:t.mainBackground||e.palette.common.white,color:t.mainText||e.palette.text.primary,borderRadius:e.spacing(.6),"&:hover":{backgroundColor:t.mainHover||e.palette.action.hover}}},mainIconColor:function(t){return{color:t.mainIcon||e.palette.grey[500]}},activeMainIconColor:function(e){return{color:e.mainActiveText||"#8FC1FF"}},subListItem:function(t){return{backgroundColor:t.subItemBackground||"#FFFFFF",color:t.subItemText||e.palette.text.secondary,borderRadius:"8px","&:hover":{backgroundColor:t.subItemHover||"rgba(143,193,255,0.3)"}}},activeSubListItem:function(e){return{backgroundColor:e.subItemActiveBackground||"#FFFFFF",color:e.subItemActiveText||"#8FC1FF","&:hover":{backgroundColor:e.subItemActiveHover||"rgba(143,193,255,0.3)"}}},subItemBorder:{borderLeft:"1px solid "+e.palette.grey[600],marginLeft:"1px",marginRight:"1px",width:"100%",height:"100%"},relativeWrapper:{position:"relative"},subItemBorderMask:function(e){return{borderLeft:"3px solid "+(e.subItemActiveText||"#8FC1FF"),borderRadius:"1px",position:"absolute",top:"50%",bottom:"50%",transition:"all 0.2s ease-in-out"}},activeSubItemBorder:{top:"0 !important",bottom:"0 !important"},subItemWrapper:{display:"flex",marginLeft:"13px",marginRight:"16px"},noYMargin:{marginTop:"unset",marginBottom:"unset"}}})),Ze=function(e,t){return!!e.split("/").includes(t)},_e=function(t){var n,a,o=t.mainItem,i=t.subItems,l=t.config,d=t.Icon,c=he(he(he({},Te()),Ie()),$e(he(he({},(null===(n=l.secondary)||void 0===n?void 0:n.mainItemColors)||{}),(null===(a=l.secondary)||void 0===a?void 0:a.subItemColors)||{}))),s=Y(),m=Ze(s.pathname,o.id),g=r(!!(null==i?void 0:i.length)&&m),f=g[0],h=g[1];return e.createElement(e.Fragment,null,e.createElement(k,{button:!0,dense:!0,className:c.mainListItem,component:U,to:o.route},e.createElement(B,{className:c.listIcon+" "+c.mainIconMarginAdjustment+" "+c.rightSpacer1},e.createElement(d,{id:"second-nav-item",styling:c.mainIconSize+" "+c.mainIconColor+" "+(m?c.activeMainIconColor:"")})),e.createElement(S,{disableTypography:!0,className:c.noYMargin,primary:e.createElement(u,{variant:"body2",className:c.bolderText+" "+c.textOverflowElipsis,color:"inherit"},o.name,(null==i?void 0:i.length)?e.createElement(u,{component:"span",variant:"body2",className:c.bolderText,color:"inherit"}," ","(",i.length,")"):null)}),(null==i?void 0:i.length)?e.createElement(B,{className:c.listIcon,onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(e){return!e}))}},f?e.createElement(X,null):e.createElement(Q,null)):null),(null==i?void 0:i.length)?e.createElement(N,{in:f,timeout:"auto",unmountOnExit:!0},e.createElement(R,{component:"div",disablePadding:!0},i.map((function(t){var r=t.name,n=t.route,a=t.id;return e.createElement(p,{key:a,className:c.subItemWrapper},e.createElement(p,{className:c.relativeWrapper+" "+c.rightSpacer1},e.createElement(p,{className:c.subItemBorder+" "}),e.createElement(p,{className:c.subItemBorderMask+" "+(Ze(s.pathname,a)?c.activeSubItemBorder:"")+" "})),e.createElement(k,{key:n,component:U,to:n,button:!0,dense:!0,className:c.subListItem+" "+(Ze(s.pathname,a)?c.activeSubListItem:"")},e.createElement(S,{disableTypography:!0,primary:e.createElement(u,{variant:"body2",className:c.textOverflowElipsis,color:"inherit"},r)})))})))):null)};function et(e){return e.sort((function(e,t){return+t.startDate.split("T")[0].replaceAll("-","")-+e.startDate.split("T")[0].replaceAll("-","")}))}var tt=function(e,t,r){return r?(e&&_(e)?e:new Date(0)).getTime()===(t&&_(t)?t:new Date(0)).getTime():e===t},rt=c((function(e){return{secondaryNavWrapper:{height:"100%",width:"300px",background:"white",overflowY:"auto",overflowX:"hidden",borderTopRightRadius:"14px",borderBottomRightRadius:"14px",marginLeft:"-16px",paddingLeft:"16px",border:"1px solid "+e.palette.grey[300],boxShadow:"0 2px 4px 0 rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},titleWrapper:{marginTop:"24px",display:"flex",alignItems:"center",paddingLeft:"16px",paddingRight:"16px"},title:{fontSize:"18px",fontWeight:500,color:function(e){return e.titleColor||"#8FC1FF"}},titleIcons:{color:function(e){return e.titleIconColor||"#8FC1FF"}},closeButton:{marginLeft:"auto"},archivedSeparator:{paddingLeft:"8px",color:e.palette.grey[500]},archivedBorder:{marginTop:"3rem",border:"1px solid "+e.palette.grey[200],width:"33%",marginLeft:"8px"},listWrapper:{marginLeft:e.spacing(1),marginRight:e.spacing(1)}}})),nt=function(t){var r,n,a,o,i=t.secondaryNavItems,l=t.primaryNavItems,d=t.expandedOptions,c=t.setExpandedOptions,s=t.config,m={titleColor:null===(r=s.secondary)||void 0===r?void 0:r.titleColor,titleIconColor:null===(n=s.secondary)||void 0===n?void 0:n.titleIconColor},g=he(he(he({},Ie()),Te()),rt(m)),f=J(),h=i[d.view];if(!h)return null;var v=l.find((function(e){return e.field===d.view})).Icon;return e.createElement(p,{className:g.secondaryNavWrapper},e.createElement(p,{className:g.titleWrapper},e.createElement(u,{className:g.rightSpacer1+" "+g.title},d.view),h.button?e.createElement(I,{className:g.titleIcons,size:"small",type:"button",onClick:function(){return f.push(h.button.url)}},e.createElement(te,null)):null,e.createElement(I,{className:g.titleIcons+" "+g.closeButton,size:"small",type:"button",onClick:function(){return c({view:"",expanded:!1})}},(null===(a=s.secondary)||void 0===a?void 0:a.closeButtonSvg)||e.createElement(ee,null))),e.createElement(R,{className:g.listWrapper,component:"div"},et(h.items).map((function(t){return e.createElement(_e,he({key:t.mainItem.route},t,{config:s,Icon:v}))})),(null===(o=h.archivedItems)||void 0===o?void 0:o.length)?e.createElement(e.Fragment,null,e.createElement(p,{className:g.archivedBorder+" "+g.contentBreak}),e.createElement(u,{variant:"body2",className:g.archivedSeparator+" "+g.bolderText},"Archived ",d.view),et(h.archivedItems).map((function(t){return e.createElement(_e,he({key:t.mainItem.route},t,{config:s,Icon:v}))}))):null))},at=c((function(e){return{primaryNavContainer:function(e){return{background:e.background||"linear-gradient(to bottom, #253a68 40%, #73c4ca)",border:"2px solid "+(e.activeBorderColor||"#8FC1FF"),borderLeft:"none",borderTopRightRadius:"14px",borderBottomRightRadius:"14px",minWidth:"4.5rem",overflowY:"auto",overflowX:"hidden"}},listWrapper:{display:"flex",flexDirection:"column",paddingTop:0},itemWrapper:{display:"flex",flexDirection:"column",padding:"0.75rem 0.5rem 0.5rem 0.5rem"},itemBorder:{borderRight:function(e){return"6px solid "+(e.activeBorderColor||"#8FC1FF")},position:"absolute",bottom:"50%",top:"50%",transition:"all 0.2s ease-in-out",right:"-3px"},activeBorder:{top:"15%",bottom:"15%"},iconWrapper:{minWidth:0,marginBottom:"4px",position:"relative"},itemName:{fontSize:"0.7rem",maxWidth:"3.5rem",textAlign:"center",textOverflow:"ellipsis",overflow:"hidden"},textColour:{color:function(e){return e.text||"#FFFFFF"}},activeTextColour:{color:function(e){return e.activeText||"#8FC1FF"}},lastItem:{marginTop:"auto"}}})),ot=function(t){var r=t.expandedOptions,n=t.setExpandedOptions,a=t.navigationLinks,o=t.config,i=Y(),l=at(he({},o.primary||{})),d=function(e,t){return""===r.view?i.pathname===t||!(e===o.rootRouteName||!i.pathname.startsWith(t)):r.view===e};return e.createElement(R,{className:l.primaryNavContainer+" "+l.listWrapper},a.map((function(t,r,a){var i;return e.createElement(k,he({key:t.field,button:!0,className:l.itemWrapper+" "+l.textColour+" "+((null===(i=o.primary)||void 0===i?void 0:i.moveLastItemToBottom)&&r===a.length-1?l.lastItem:"")},t.hasSecondary?{}:{component:U,to:t.path},{onClick:function(){n({view:t.field,expanded:!!t.hasSecondary})}}),e.createElement(B,{className:l.iconWrapper},e.createElement(t.Icon,{styling:l.textColour+" "+(d(t.field,t.path)?l.activeTextColour:"")})),e.createElement(u,{variant:"caption",className:l.itemName+" "+l.textColour+" "+(d(t.field,t.path)?l.activeTextColour:"")},t.field),e.createElement(p,{className:l.itemBorder+" "+(d(t.field,t.path)?l.activeBorder:"")}))})))},it=c({leftNavContainer:{height:"100%",display:"flex",position:"relative",width:"max-content"}}),lt=function(t){var n=t.primaryNavItems,a=t.secondaryNavItems,i=t.config,l=r({view:"",expanded:!1}),d=l[0],c=l[1],s=it(),m=Y(),u=n.reduce((function(e,t){return t.hasSecondary?xe(xe([],e,!0),[t.field],!1):e}),[]);return o((function(){c((function(e){return u.includes(e.view)&&!0===e.expanded?e:{view:"",expanded:!1}}))}),[m.pathname]),e.createElement(p,{component:"nav",className:s.leftNavContainer},e.createElement(ot,{expandedOptions:d,setExpandedOptions:c,navigationLinks:n,config:i}),d.expanded&&e.createElement(nt,{secondaryNavItems:a,primaryNavItems:n,expandedOptions:d,setExpandedOptions:c,config:i}))},dt=c((function(e){return{remainingHeightBox:{position:"absolute",top:function(e){var t;return null!==(t=e.topOffset)&&void 0!==t?t:"4rem"},bottom:0,left:0,right:0,display:"flex"},fullHeightFlexbox:{display:"flex",height:"100%"},relativeContainer:{position:"relative"},scrollWrapper:{overflow:"auto"},componentWrapper:{padding:e.spacing(2),paddingBottom:e.spacing(2),position:"relative"}}})),ct=function(t){var r=t.sideNavigation,n=t.children,a=t.desktopWidth,o=t.topOffset,i=dt({topOffset:o});return e.createElement(p,{className:i.remainingHeightBox},r?e.createElement(p,{className:i.fullHeightFlexbox+" "+i.relativeContainer},r):null,e.createElement(T,{disableGutters:!0,maxWidth:!1,className:i.scrollWrapper},e.createElement(T,{disableGutters:!0,maxWidth:a?"xl":"lg",className:i.componentWrapper},n)))},st=function(e,t,r){void 0===r&&(r=250);var n=a(e,t);o((function(){var e=setTimeout(n,r);return function(){return clearTimeout(e)}}),[n,r])},mt=function(e,t){var r=i();o((function(){r.current=e})),o((function(){if(null!==t){var e=setInterval((function(){r.current&&r.current()}),t);return function(){return clearInterval(e)}}}),[t])};function ut(e,t){var r=i(t);o((function(){var n=Object.keys(he(he({},r.current),t)),a={};n.forEach((function(e){r.current[e]!==t[e]&&(a[e]={from:r.current[e],to:t[e],changedKeys:t[e]&&"object"==typeof t[e]?Object.keys(r.current[e]).map((function(n){return r.current[e][n]===t[e][n]?"":n})).filter(Boolean):void 0,isDeepEqual:ne(r.current[e],t[e])})})),Object.keys(a).length&&console.log("[why-did-you-update]",e,{changes:a,props:{from:r.current,to:t}}),r.current=t}),Object.values(t))}var pt=c((function(e){return{divider:{background:e.palette.primary.main,height:"0.2rem"},letterHeader:{cursor:"default",color:e.palette.primary.main,marginTop:"1rem"},listItem:{borderRadius:"14px",border:"1px solid "+e.palette.grey[300],marginBottom:"0.5rem",paddingLeft:"24px",boxShadow:e.shadows[1]},topMargin:{marginTop:e.spacing(2),display:"block"}}})),gt=function(t){var r=t.array,n=t.sortFn,a=t.sortKey,o=void 0===a?"name":a,i=t.buttonClick,l=t.linkTo,d=t.ItemTemplate,c=t.arrayKey,s=void 0===c?"id":c,m=t.loading,p=void 0!==m&&m,g=t.loadingMessage,f=void 0===g?"Loading list...":g,h=t.emptyMessage,v=void 0===h?"List is empty":h,b=t.alphabetisedHeader,y=void 0===b||b,x=he(he(he({},pt()),Ie()),Fe());if(void 0===r||p)return e.createElement(De,{styling:x.topMargin,text:f});if(!(null==r?void 0:r.length))return e.createElement(u,{className:x.topMargin,align:"center",variant:"body2",color:"textSecondary"},v);var E=n?xe([],r,!0).sort(n):r,w="";return e.createElement(R,{className:x.limitWidth50rem},E.map((function(t,r){var n,a=!1;if(y){var c=((null===(n=t[o])||void 0===n?void 0:n[0])||"???").toLowerCase();c!==w&&(w=c,a=!0)}return e.createElement(e.Fragment,{key:t[s]||"alphabetical-list-"+r},y&&a?e.createElement(e.Fragment,null,e.createElement(u,{className:""+x.letterHeader,align:"left"},w.toUpperCase()),e.createElement(F,{className:x.contentBreak+" "+x.divider})):null,e.createElement(k,he({className:x.listItem,alignItems:"flex-start",button:!(!i&&!l)||void 0,onClick:i?function(){return i(t)}:void 0},l&&!i?{component:U,to:l(t)}:{}),e.createElement(d,{item:t})))})))},ft=c((function(e){return{searchBox:{display:"flex",alignContent:"center",alignItems:"center",padding:"8px",border:"2px solid "+e.palette.grey[300],borderRadius:"14px"},searchField:{borderRadius:"14px",width:"100%",background:function(e){return e.background||"RGBA(179, 213, 235, 0.1)"},height:"46px",paddingLeft:"24px",color:e.palette.grey[600]},searchIcon:{color:e.palette.grey[600]}}})),ht=function(t){var n=t.array,a=t.sortFn,i=t.sortKey,l=void 0===i?"name":i,d=t.buttonClick,c=t.linkTo,s=t.ItemTemplate,m=t.arrayKey,u=void 0===m?"id":m,g=t.loading,f=void 0!==g&&g,h=t.loadingMessage,v=void 0===h?"Loading list...":h,b=t.emptyMessage,y=void 0===b?"List is empty":b,x=t.dynamicEmptyMessage,E=t.inputBackgroundColor,w=t.placeholder,C=t.disabledSearch,k=t.delay,B=void 0===k?500:k,S=t.minQueryLength,N=void 0===S?3:S,R=t.handleOnChange,I=t.searchKeys,T=void 0===I?["name"]:I,F=t.alphabetisedHeader,P=void 0===F||F,W=t.initialSearchQuery,D=void 0===W?"":W,O=he(he(he({},Ie()),Fe()),ft({background:E})),H=r(D),M=H[0],z=H[1],j=r(!1),G=j[0],K=j[1],V=r(n),U=V[0],Y=V[1];return st((function(){!R&&!G&&M.length>=N&&Y(null==n?void 0:n.filter((function(e){var t=T.some((function(t){var r;return null===(r=e[t])||void 0===r?void 0:r.toLowerCase().includes(M.toLowerCase())}));return t})))}),[M,n],B),st((function(){R&&!G&&M.length>=N&&R(M)}),[M],B),o((function(){Y(n)}),[n]),e.createElement(e.Fragment,null,e.createElement(p,{className:O.searchBox+" "+O.limitWidth50rem},e.createElement(L,{disabled:C,type:"text",value:M,placeholder:w||"Enter to search",onChange:function(e){G&&K(!1),z(e.target.value)},className:O.searchField,endAdornment:e.createElement(A,{position:"end",className:O.rightSpacer2},e.createElement(re,{className:O.searchIcon}))})),null!==n&&e.createElement(gt,{array:U,sortFn:a,sortKey:l,buttonClick:d,linkTo:c,ItemTemplate:s,arrayKey:u,loading:f,loadingMessage:v,emptyMessage:x?x(M):y,alphabetisedHeader:P}))},vt=c((function(e){return{inputField:function(t){var r=t.size;return he({borderRadius:"14px"},"small"===r?e.typography.body2:{})},labelStyles:function(t){var r=t.size;return he({},"small"===r?he(he({transform:"translate(14px, 9px) scale(1) !important"},e.typography.body2),{"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:"translate(15px, -9px) scale(0.75) !important"}}):{})}}})),bt=function(t){var r=t.size,n=void 0===r?"small":r,a=t.styling,o=t.numberField,i=t.inputProps,l=void 0===i?{}:i,d=t.InputProps,c=void 0===d?{}:d,s=t.accessLevel,m=t.disabled,u=t.fixedDecimalScale,p=ve(t,["size","styling","numberField","inputProps","InputProps","accessLevel","disabled","fixedDecimalScale"]),g=vt({size:n});if(s===Re)return null;var f=m;s===Ne&&(f=!0);var h=he({},o&&{fixedDecimalScale:!!u});return e.createElement(P,he({className:a||"",disabled:f},p,{inputProps:he(he({},l),h),InputProps:he(he({},c),{className:g.inputField,inputComponent:o?yt:void 0}),InputLabelProps:{className:g.labelStyles},variant:"outlined",size:n}))},yt=function(t){var r=t.inputRef,n=t.onChange,a=ve(t,["inputRef","onChange"]);return e.createElement(ae,he({},a,{getInputRef:r,onValueChange:function(e){n({target:{name:t.name||"",value:e.value}})},thousandSeparator:!0,decimalScale:2,isNumericString:!0}))},xt=c((function(e){return{listItem:function(t){var r=t.background,n=t.size;return he(he({overflow:"auto",scrollbarWidth:"thin"},"small"===n?e.typography.body2:{}),{"&:hover":{backgroundColor:r+" !important"}})},inputStyles:function(t){var r=t.background,n=t.size;return he(he({borderRadius:"14px !important"},"small"===n?he({paddingTop:"9.5px",paddingBottom:"8.5px"},e.typography.body2):{}),{"&:focus":{backgroundColor:r}})},selectedListItem:function(e){return{"&:focus":{background:e.background+" !important"}}}}})),Et=function(t){var r=t.selectOptions,n=t.background,a=void 0===n?"#EFEDFF":n,o=t.size,i=void 0===o?"small":o,l=t.styling,d=t.disabled,c=t.accessLevel,s=ve(t,["selectOptions","background","size","styling","disabled","accessLevel"]),m=xt({background:a,size:i});if(c===Re)return null;var u=d;return c===Ne&&(u=!0),e.createElement(bt,he({className:l||""},s,{disabled:u,size:i,SelectProps:{inputProps:{className:m.inputStyles}},select:!0}),r.map((function(t){var r;return e.createElement(W,{key:t.value,value:t.value,disabled:null!==(r=null==t?void 0:t.disabled)&&void 0!==r&&r,className:m.listItem,classes:{selected:m.selectedListItem}},t.description)})))},wt=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd MMM yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,d=t.disabled,c=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Re)return null;var s=d;return l===Ne&&(s=!0),e.createElement(oe,{utils:de},e.createElement(ie,he({className:r||""},c,{disabled:s,inputVariant:"outlined",autoOk:!0,format:a,minDate:i,TextFieldComponent:bt})))},Ct=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd/MM/yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,d=t.disabled,c=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Re)return null;var s=d;return l===Ne&&(s=!0),e.createElement(oe,{utils:de},e.createElement(le,he({className:r||""},c,{disabled:s,inputVariant:"outlined",autoOk:!0,allowKeyboardControl:!0,format:a,minDate:i,TextFieldComponent:bt})))},kt=c((function(e){return{confirmWrapper:{display:"inline-block"},confirmContainer:{display:"flex",alignItems:"center"},whiteText:{color:e.palette.common.white}}})),Bt=function(t){var n=t.children,a=t.onClick,i=t.styling,l=t.disabled,d=void 0!==l&&l,c=t.variant,s=void 0===c?"outlined":c,m=t.color,g=void 0===m?"primary":m,f=t.accessLevel,h=void 0===f?"":f,v=t.confirmButtonLabel,b=void 0===v?"Are you sure?":v,y=ve(t,["children","onClick","styling","disabled","variant","color","accessLevel","confirmButtonLabel"]),x=he(he({},Ie()),kt()),E=r(!1),w=E[0],C=E[1],k=r(!1),B=k[0],S=k[1];return mt((function(){return C(!1)}),!w||B?null:4500),o((function(){S(y.loading),C(y.loading)}),[y.loading]),[Re,Ne].includes(h)?null:w?e.createElement(p,{className:x.confirmWrapper},e.createElement(p,{className:x.confirmContainer},e.createElement(u,{className:x.rightSpacer1,variant:"body1"},b),e.createElement(Ae,he({},y,{type:"button",onClick:function(e){S(!0),a(e)},variant:"contained",styling:x.whiteText,disabled:d,color:g}),"Confirm",y.loading?"ing":""))):e.createElement(Ae,{type:"button",variant:s,disabled:d,styling:i,color:g,onClick:function(){return C(!0)}},n)},St=function(e,t){var r=e.toString().length;return r?r+(t?3:1)+Math.floor(r/3)/3+"ch":"6ch"},Nt=c((function(e){return{inputBase:function(e){return{height:"unset",padding:0,textAlign:e.textAlign||"center"}},input:function(e){return{textAlign:e.textAlign||"center",marginRight:"0.4rem",marginLeft:"0.4rem"}},startAdornment:{color:e.palette.text.secondary},modifiedUnderline:{"&:not(.Mui-disabled):before":{borderBottom:"none",transition:"none"},"&:hover:not(.Mui-disabled):before":{borderBottom:"1px solid "+e.palette.grey[500]+" !important"}},body2Text:he({},e.typography.body2),dateFieldWidth:{width:"8ch"},fullDateWidth:{width:"11ch"},justifyStart:{justifyContent:"flex-start"},justifyCenter:{justifyContent:"center"},justifyEnd:{justifyContent:"flex-end"},totalContainer:{display:"flex",alignItems:"center",cursor:"default"},selectFocusBackground:{"&:focus":{backgroundColor:"unset"}}}})),Rt=function(t){var r=t.error,n=t.disabled,a=t.value,o=t.onBlur,i=t.onChange,l=t.prefix,d=t.suffix,c=t.numberField,s=void 0!==c&&c,m=t.textAlign,p=t.fixedDecimalScale,g=t.inputStyling,f=void 0===g?"":g,h=t.wrapperStyling,v=void 0===h?"":h,b=t.widthOverride,y=void 0===b?void 0:b,x=t.name,E=void 0===x?void 0:x,w=Nt({textAlign:m}),C=he({},s&&{fixedDecimalScale:!!p});return"string"==typeof a||"number"==typeof a?e.createElement(P,{name:E,className:v,error:!!r,inputProps:he({className:w.inputBase+" "+f,style:{width:y||St(a,!!p)}},C),value:a,onChange:i,onBlur:o,InputProps:{startAdornment:l?e.createElement(A,{position:"end",className:w.startAdornment},l):null,endAdornment:d?e.createElement(A,{position:"start",className:w.startAdornment},d):null,inputComponent:s?yt:void 0,className:w.body2Text+" "+w.modifiedUnderline,classes:{input:w.input}},helperText:r||void 0,disabled:n}):e.createElement(u,{variant:"body2"},"Incorrect value type")},It=function(t){return e.createElement(Rt,he({},he(he({},t),{numberField:!0})))},Tt=function(t){return e.createElement(Rt,he({},he(he({},t),{numberField:!0,fixedDecimalScale:!0})))},Ft=g(f({root:{padding:"3px"}}))(D),Lt=function(t){var r=t.disabled,n=t.fullDate,a=void 0!==n&&n,o=t.value,i=t.error,l=t.onChange,d=t.onBlur,c=t.textAlign,s=Nt({textAlign:c});return e.createElement(oe,{utils:de},e.createElement(ie,{disabled:r,views:a?void 0:["year","month"],value:o,autoOk:!0,format:a?"dd MMM yyyy":"MMM yyyy",InputProps:{className:s.body2Text+" "+s.modifiedUnderline},inputProps:{className:s.inputBase+" "+(a?s.fullDateWidth:s.dateFieldWidth),classes:{input:s.input}},error:!!i,helperText:i||void 0,onChange:l,onBlur:d}))},At=function(t){return e.createElement(Lt,he({fullDate:!0},t))},Pt=function(t){var r=t.value,n=t.disabled,a=t.onChange;return e.createElement(D,{disabled:n,checked:r,onChange:a,color:"primary",size:"small"})},Wt=function(t){return e.createElement(Pt,he({},t))},Dt=function(t){var r=t.text,n=t.numberField,a=void 0!==n&&n,o=t.prefix,i=void 0===o?null:o,l=t.suffix,d=void 0===l?null:l,c=t.textAlign,s=t.fixedDecimalScale,m=t.styling,u=void 0===m?"":m,g=t.inputStyling,f=void 0===g?"":g,h=t.widthOverride,v=void 0===h?void 0:h,b=Nt({});return e.createElement(p,{className:b.totalContainer+" "+b.body2Text+" "+("left"===c?b.justifyStart:"right"===c?b.justifyEnd:b.justifyCenter)+" "+u,style:{width:v}},i&&i,e.createElement(p,{className:b.body2Text,style:{width:v}},a?e.createElement(ae,{className:f,value:r,displayType:"text",thousandSeparator:!0,isNumericString:!0,decimalScale:2,fixedDecimalScale:s}):r),d&&d)},Ot=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,d=Nt({});return e.createElement(O,{margin:"none",error:!!r},e.createElement(H,{className:d.body2Text+" "+d.modifiedUnderline,inputProps:{className:d.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(W,{className:d.body2Text,key:r,value:r},n)}))),r&&e.createElement(M,null,r))},Ht=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,d=t.renderValue,c=Nt({});return e.createElement(O,{margin:"none",error:!!r},e.createElement(H,{className:c.body2Text+" "+c.modifiedUnderline,inputProps:{className:c.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l,renderValue:d,multiple:!0},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(W,{className:c.body2Text,key:r,value:r},n)}))),r&&e.createElement(M,null,r))},Mt=c((function(e){return{newRowHighlight:{backgroundColor:"#73c4ca30"},editedCellHighlight:{backgroundColor:"#5840f52e !important",backgroundClip:"padding-box"},editedBorder:{border:"3px solid #5840f52e",borderWidth:"2px 4px"},errorBorder:{border:"3px solid "+e.palette.error.light,borderWidth:"2px 4px"},emptyLoadingPadding:{paddingTop:"0.75rem",paddingBottom:"0.75rem"},centeredText:{textAlign:"center"},disabled:{backgroundColor:e.palette.action.hover},pagination:{marginTop:"1rem",marginBottom:"1rem"},virtualisationContainer:{maxHeight:"500px",overflow:"auto"},cellPadding:{padding:".5rem .75rem"},shadedHeader:{"&:nth-of-type(even).shadedHeader":{backgroundColor:"#eeeeee"}},shadedBodyCell:{"&:nth-of-type(even).shadedBodyCell":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"}},shadedHeaderGroupParent:{"&:nth-of-type(even).shadedHeaderGroupParent":{backgroundColor:"#eeeeee"}},shadedHeaderGroup2Children:{"&:nth-of-type(4n-2).shadedHeaderGroup2Children":{backgroundColor:"#eeeeee"},"&:nth-of-type(4n-1).shadedHeaderGroup2Children":{backgroundColor:"#eeeeee"}},shadedBody2CellsInsideGroup:{"&:nth-of-type(4n-2).shadedBody2CellsInsideGroup":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"},"&:nth-of-type(4n-1).shadedBody2CellsInsideGroup":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"}}}})),zt=function(t){var n=t.value,a=void 0===n?"":n,i=t.row,l=i.index,d=i.values,c=i.original,s=t.column.id,m=t.syncCellWithState,u=t.setRows,p=t.fieldConfig,g=t.disabled,f=p[s],h=f.validationRule,v=f.dependentValidationRule,b=f.isCheckbox,y=f.isDateField,x=f.customRenderFn,E=f.prefix,w=f.suffix,C=f.textAlign,k=f.onBlur,B=f.onChangeValueModifier,S=r(!1),N=S[0],R=S[1],I=r(a),T=I[0],F=I[1],L=b,A=function(e){var t=!1;if(h)try{h.validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}if(v)try{v(d).validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}return t},P=function(e){return be(void 0,void 0,void 0,(function(){return ye(this,(function(t){switch(t.label){case 0:return L?m(l,s,e,!1):m(l,s,T,!!N),!k||!u||N||tt(d[s],T,y)?[3,2]:[4,k({rowIndex:l,value:T,setRows:u,values:c})];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))};o((function(){F(a);var e=A(a);N!==e&&m(l,s,a,e,!0)}),[a]),o((function(){c.errors&&!!c.errors[s]!=!!N&&A(a)}),[c.errors]);var W,D={value:T,values:d,disabled:g||c.disabledRow,error:N,onChange:function(e){var t;if(y){t=e;var r=B?B(t):t;return F(r),void A(r)}t=e;var n=L?t.target.checked:t.target.value;L?(F(n),P(n)):(F(n),A(n))},onBlur:P,prefix:E,suffix:w,textAlign:C,originalValues:c};return x?x(D):(W=D,e.createElement(Rt,he({},he({},W))))},jt=l((function(t,r){var n=t.row,a=t.classes,o=t.disabled,i=t.includeRowSelect,l=ve(t,["row","classes","disabled","includeRowSelect"]);return e.createElement(h,he({},l,{ref:r,hover:!0,className:("NEW"===n.original.rowStatus?a.newRowHighlight:"")+" "+("EDITED"===n.original.rowStatus?a.editedBorder:"")+"\n"+(Object.values(n.original.errors||{}).includes(!0)?a.errorBorder:"")+" "+(n.original.disabledRow||o?a.disabled:"")}),n.cells.map((function(t,r){return e.createElement(x,he({},t.getCellProps(),{align:t.column.textAlign||"center",className:("EDITED"===t.row.original.rowStatus&&t.row.original.edited[t.column.id]?a.editedCellHighlight:"")+" "+a.cellPadding+"\n "+(t.column.shadedHeaderGroup?a.shadedBody2CellsInsideGroup+" shadedBody2CellsInsideGroup":"")+"\n "+(t.column.shadedHeader?a.shadedBodyCell+" shadedBodyCell":"")+"\n ",padding:i&&0===r?"checkbox":"normal"}),t.render("Cell"))})))})),Gt=[],Kt=t((function(t){var r=t.tableRows,n=t.tableHeaders,i=t.syncCellWithState,l=t.setRows,d=void 0===l?void 0:l,c=t.skipPageReset,s=void 0!==c&&c,m=t.fieldConfig,g=t.disabled,f=void 0!==g&&g,h=t.setSelectedRows,v=t.includeRowSelect,b=void 0===v||v,y=t.filterData,x=t.filterTypes,E=t.emptyTableText,w=void 0===E?"Table is empty":E,C=t.paginate,k=void 0!==C&&C,B=t.defaultPageSize,S=void 0===B?50:B,N=t.virtContainerStyling,R=t.overscan,I=t.rowHeight,T=t.includeGlobalSearch,F=t.disableHeaderSelect,L=he(he({},Mt()),Fe()),A=e.useRef(null),P=e.useMemo((function(){return{Cell:zt}}),[]),W=ce({columns:n,data:r||Gt,defaultColumn:P,autoResetPage:!!k&&!s,filterTypes:x,initialState:{pageSize:k?S:void 0},syncCellWithState:i,setRows:d,fieldConfig:m,disabled:f,autoResetGlobalFilter:!1},se,me,ue,pe,(function(t){b&&t.visibleColumns.push((function(t){return xe([{id:"selection",Header:function(t){var r=t.getToggleAllRowsSelectedProps,n=t.getToggleAllPageRowsSelectedProps;return F?"Select":e.createElement(Ft,he({},k?n():r(),{disabled:f,size:"small"}))},Cell:function(t){var r=t.row;return e.createElement(Ft,he({},r.getToggleRowSelectedProps(),{disabled:f||r.original.disableSelection,size:"small"}))}}],t,!0)}))})),D=W.getTableProps,O=W.getTableBodyProps,H=W.headerGroups,M=W.rows,z=W.page,j=W.prepareRow,G=W.state,V=G.selectedRowIds,U=G.pageIndex,Y=W.state,J=W.setFilter,q=W.pageCount,X=W.gotoPage,Q=W.preGlobalFilteredRows,$=W.setGlobalFilter,Z=W.isAllRowsSelected,_=W.selectedFlatRows,ee=fe({size:(k?z:M).length,parentRef:A,overscan:R||5,estimateSize:a((function(){return I||54}),[I])}),te=k?z:M,re=ee.virtualItems,ne=re.length>0?re[0].start:0,ae=re.length>0?ee.totalSize-re[re.length-1].end:0,oe=a((function(e,t){X(t-1)}),[]);return o((function(){y&&J(y.filterRow,y.filterValues)}),[y]),o((function(){h&&h(Object.keys(V).map((function(e){return+e})))}),[V]),e.createElement(e.Fragment,null,T?e.createElement(Ut,{preGlobalFilteredRows:Q,globalFilter:Y.globalFilter,setGlobalFilter:$}):null,e.createElement("div",{ref:A,className:N||L.virtualisationContainer},e.createElement(Yt,he({},{disabled:f,includeRowSelect:b,getTableProps:D,headerGroups:H,getTableBodyProps:O,rowsToRender:te,prepareRow:j,paddingTop:ne,paddingBottom:ae,virtualRows:re,isAllRowsSelected:Z,selectedFlatRows:_}))),null===r?e.createElement(p,{className:L.emptyLoadingPadding},e.createElement(De,null)):null,r&&!r.length?e.createElement(p,{className:L.emptyLoadingPadding+" "+L.centeredText},e.createElement(u,{variant:"body2"},w)):null,k&&(null==r?void 0:r.length)?e.createElement(K,{className:L.flexCenter+" "+L.pagination,count:q,page:U+1,onChange:oe,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Vt=c((function(e){return{container:{display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid "+e.palette.grey[600],borderRadius:"8px",width:"100%",maxWidth:"20rem",marginInline:"auto",color:e.palette.grey[600],"&:hover":{borderColor:e.palette.grey[800],color:e.palette.grey[800]},"&:focus-within":{borderColor:e.palette.grey[800],color:e.palette.grey[800]}},input:he({width:"100%",maxWidth:"18rem",color:"inherit"},e.typography.body2)}})),Ut=t((function(t){var n=t.preGlobalFilteredRows,a=t.globalFilter,o=t.setGlobalFilter,i=r(a),l=i[0],d=i[1],c=he(he({},Ie()),Vt()),s=ge((function(e){o(e||void 0)}),200),m=n.length;return e.createElement("div",{className:c.container+" "+c.contentBreak},e.createElement(re,{className:c.rightSpacer1+" "+c.leftSpacer1}),e.createElement(L,{className:""+c.input,value:l||"",onChange:function(e){d(e.target.value),s(e.target.value)},placeholder:"Search "+m+" records...",inputProps:{"aria-label":"search"}}))})),Yt=t((function(t){var r=t.disabled,n=t.includeRowSelect,a=t.getTableProps,o=t.headerGroups,i=t.getTableBodyProps,l=t.rowsToRender,d=t.prepareRow,c=t.paddingTop,s=t.paddingBottom,m=t.virtualRows,u=t.isAllRowsSelected,p=t.selectedFlatRows;return e.createElement(b,he({},a(),{stickyHeader:!0,style:{borderCollapse:"collapse"}}),e.createElement(Jt,{headerGroups:o,includeRowSelect:n,isAllRowsSelected:u}),e.createElement(y,he({},i()),c>0&&e.createElement("tr",null,e.createElement("td",{style:{height:c+"px"}})),e.createElement(qt,he({},{disabled:r,includeRowSelect:n,rowsToRender:l,prepareRow:d,virtualRows:m,selectedFlatRows:p})),s>0&&e.createElement("tr",null,e.createElement("td",{style:{height:s+"px"}}))))})),Jt=t((function(t){var r=t.headerGroups,n=t.includeRowSelect;t.isAllRowsSelected;var a=Mt();return e.createElement(v,null,r.map((function(t){return e.createElement(h,he({},t.getHeaderGroupProps()),t.headers.map((function(t,r){return e.createElement(x,he({},t.getHeaderProps(),{align:t.textAlign||"center",padding:n&&0===r?"checkbox":"normal",className:(t.shadedHeaderGroup?t.columns?a.shadedHeaderGroupParent+" shadedHeaderGroupParent":t.parent?a.shadedHeaderGroup2Children+" shadedHeaderGroup2Children":"":"")+" "+(t.shadedHeader?a.shadedHeader+" shadedHeader":"")}),t.render("Header"))})))})))})),qt=t((function(t){var r=t.rowsToRender,n=t.virtualRows,a=t.prepareRow,o=ve(t,["rowsToRender","virtualRows","prepareRow"]),i=he(he({},Mt()),Fe());return e.createElement(e.Fragment,null,n.map((function(t){var n=r[t.index];return a(n),e.createElement(d,{key:n.original.rowKey||n.getRowProps().key},n.original.disabledRow?e.createElement(z,{title:n.original.tooltipText||"This row is disabled",arrow:!0},e.createElement(jt,he({},he(he({},o),{row:n,classes:i})))):e.createElement(jt,he({},he(he({},o),{row:n,classes:i}))))})))})),Xt=c((function(e){return{alertStyling:{borderRadius:"14px"},closeButton:{color:e.palette.text.secondary,marginRight:e.spacing(2)},showCursor:{cursor:"pointer"}}})),Qt=function(t){var r=t.alertActionHandler,n=t.formStatus,a=t.actionButton,o=t.alertMessage,i=t.addBreak,l=void 0===i||i,d=t.styling,c=he(he({},Ie()),Xt());return e.createElement(N,{in:[Ee,we,Be].includes(n)},e.createElement(V,{onClick:r,className:c.alertStyling+" "+(l?c.sectionBreak:"")+" "+(d||"")+" "+(r?c.showCursor:""),severity:n===we?we:n===Ee?Ee:Be,action:a?e.createElement(s,{className:c.closeButton,"aria-label":"close",color:"inherit",size:"small",onClick:function(e){e.stopPropagation(),a.handler()}},a.text):null},o))},$t=c((function(e){return{greyBox:{backgroundColor:e.palette.grey[200],display:"flex",justifyContent:"center",alignItems:"center",padding:"1.5rem",borderRadius:"14px",position:"relative",height:"13.25rem"},widthLimiter:{width:"100%",maxWidth:"28rem",marginLeft:"auto",marginRight:"auto"},hiddenInput:{display:"none"},buttonColor:{backgroundColor:e.palette.primary.main},iconStyling:{color:e.palette.common.white,fontSize:"3rem"},sectionBreak:{marginBottom:e.spacing(3)},dropBox:{height:"100%",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"},dropArrowStyling:{color:e.palette.text.secondary,fontSize:"3rem"},topLeftArrow:{position:"absolute",top:0,left:0,transform:"rotate(45deg)"},topRightArrow:{position:"absolute",top:0,right:0,transform:"rotate(135deg)"},bottomLeftArrow:{position:"absolute",bottom:0,left:0,transform:"rotate(-45deg)"},bottomRightArrow:{position:"absolute",bottom:0,right:0,transform:"rotate(225deg)"},hiddenDisplay:{display:"none"},loadingCircle:{marginLeft:e.spacing(1)},roundedAvatarButton:{borderRadius:"100%"},roundedAvatar:{width:"16vmax",height:"16vmax",maxWidth:"13rem",maxHeight:"13rem"},organisationImage:{maxWidth:"8rem",minWidth:"5rem",maxHeight:"8rem"}}})),Zt=function(t){var n=t.id,a=void 0===n?"image-upload":n,i=t.url,l=t.roundedAvatar,d=void 0!==l&&l,c=t.handleSaveImage,g=t.alt,f=t.accessLevel,h=he(he({},$t()),Ie()),v=r(!!i),b=v[0],y=v[1],x=r("enabled"),E=x[0],w=x[1],C=r(null),k=C[0],B=C[1];if(o((function(){i&&y(!0)}),[i]),f===Re)return null;var S=!1;f===Ne&&(S=!0);var N,R=function(e,t){return be(void 0,void 0,void 0,(function(){var r,n;return ye(this,(function(a){switch(a.label){case 0:return S?[2]:(B(null),"input"!==e?[3,4]:(r=t.target).files&&r.files[0]?[4,T(r.files[0])]:[3,2]);case 1:return a.sent(),[3,3];case 2:w(we),y(!!i),a.label=3;case 3:return[3,7];case 4:return"dragDrop"!==e?[3,7]:(n=t.dataTransfer).files&&n.files[0]?[4,T(n.files[0])]:[3,6];case 5:return a.sent(),[3,7];case 6:w(we),y(!!i),a.label=7;case 7:return[2]}}))}))},T=function(e){return be(void 0,void 0,void 0,(function(){var t,r,n;return ye(this,(function(a){switch(a.label){case 0:return w("loading"),e.size>=524288?(B("Image size should be less than 0.5MB"),w(we),y(!!i),[2]):(t=e.name.split(".")[1].toLowerCase(),["png","jpg","jpeg"].includes(t)?[4,e.arrayBuffer()]:(B("Please provide an image in png, jpg or jpeg format"),w(we),y(!!i),[2]));case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,c(t,r,e)];case 3:return a.sent(),w(Ee),y(!0),[3,5];case 4:return n=a.sent(),console.log(n),w(we),y(!!i),[3,5];case 5:return[2]}}))}))};switch(E){case"dragEnter":N=e.createElement(p,{className:h.dropBox,style:{pointerEvents:"none"}},e.createElement(Z,{className:h.dropArrowStyling+" "+h.topLeftArrow}),e.createElement(Z,{className:h.dropArrowStyling+" "+h.topRightArrow}),e.createElement(u,{variant:"h5",color:"textSecondary"},"Drop Here"),e.createElement(Z,{className:h.dropArrowStyling+" "+h.bottomLeftArrow}),e.createElement(Z,{className:h.dropArrowStyling+" "+h.bottomRightArrow}));break;case"loading":N=e.createElement(p,{className:h.dropBox},e.createElement(u,{color:"textSecondary"},"Loading..."),e.createElement(m,{className:h.loadingCircle,size:25}));break;default:N=e.createElement("label",{htmlFor:a},e.createElement(I,{className:h.buttonColor+" "+h.sectionBreak,"aria-label":"upload picture",component:"span"},e.createElement($,{className:h.iconStyling})),e.createElement(u,{variant:"body2",color:"textSecondary"},"Drag and drop or browse to upload your image or logo."))}return e.createElement(p,{className:h.labelBreak,onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),y(!1))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),y(!1))}},b&&e.createElement(p,{className:h.labelBreak},e.createElement("label",{htmlFor:a},e.createElement(s,{className:""+(d?h.roundedAvatarButton:""),"aria-label":"upload picture",component:"span"},d?e.createElement(j,{className:h.roundedAvatar,src:i,alt:g||"Profile Avatar"}):e.createElement("img",{className:h.organisationImage,src:i,alt:g||"Company Logo"})))),e.createElement(p,{className:h.greyBox+" "+h.widthLimiter+" "+h.sectionBreak+" "+(b?h.hiddenDisplay:""),onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),w("dragEnter"))},onDragLeave:function(e){S||(e.preventDefault(),e.stopPropagation(),w("enabled"),y(!!i))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),w("dragEnter"))},onDrop:function(e){S||(e.preventDefault(),e.stopPropagation(),R("dragDrop",e))}},e.createElement("input",{id:a,className:h.hiddenInput,type:"file",accept:".png, .jpg, .jpeg",disabled:S,onChange:function(e){return R("input",e)}}),N),e.createElement(p,{className:h.widthLimiter},e.createElement(Qt,{formStatus:E,alertMessage:k||(E===Ee?"Uploaded successfully!":"Something went wrong.")})))},_t=c((function(e){var t,r;return{container:(t={minWidth:"4.5rem",height:"100%",background:"linear-gradient(180deg, #B3D6EC 0%, #B3D6EC 40%, #E97FAB 100%)",display:"flex",flexDirection:"column",overflowY:"auto",borderTopRightRadius:"1rem",borderBottomRightRadius:"1rem",border:"solid 2px rgb(188, 172, 242)",borderLeft:"none",boxSize:"border-box"},t[e.breakpoints.down("sm")]={flexDirection:"row",justifyContent:"center",background:"linear-gradient(90deg, #B3D6EC 0%, #B3D6EC 40%, #E97FAB 100%)",borderRadius:0,borderTopLeftRadius:"1rem",borderTopRightRadius:"1rem",width:"100dvw",margin:"auto",border:"solid 2px rgb(188, 172, 242)",borderBottom:"none",overflowY:"hidden",overflowX:"scroll"},t),item:(r={position:"relative",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"black",textDecoration:"none",fontSize:"0.725rem",padding:"0.75rem 0.5rem",gap:"0.25rem",backgroundColor:"transparent",transition:"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"},"&::after":{content:'" "',position:"absolute",top:"15%",bottom:"15%",right:0,width:3,zIndex:1,transition:"background-color 80ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"}},r[e.breakpoints.down("sm")]={padding:"0.5rem 1.0rem","&::after":{top:0,left:"15%",right:"15%",bottom:"auto",height:4,width:"auto"}},r),itemActive:{"&::after":{backgroundColor:"rgb(188, 172, 242)"}},separateItem:{marginTop:"auto"}}})),er=function(t){var r=t.tabs,n=_t(),a=Y();return e.createElement("div",{className:n.container},r.map((function(t){var r=t.Icon,o=t.field,i=t.path,l=t.separate,d=void 0!==l&&l;return e.createElement(U,{key:i,to:i,className:[n.item,d?n.separateItem:null,a.pathname===i?n.itemActive:null].filter(Boolean).join(" ")},e.createElement(e.Fragment,null,e.createElement(r,null),o))})))},tr=c((function(e){var t;return{tablessGrid:{},grid:function(t){var r,n=t.hideTabs,a=t.leaveHeightForMenu;return n?{}:((r={display:"grid",gridTemplateRows:"auto 1fr",gridTemplateColumns:"auto 1fr",height:a?"calc(100dvh - 4rem)":"100dvh",boxSize:"border-box"})[e.breakpoints.down("sm")]={gridTemplateColumns:"1fr",gridTemplateRows:"1fr auto"},r)},tabs:(t={height:function(e){return e.leaveHeightForMenu?"calc(100dvh - 4rem)":"100dvh"}},t[e.breakpoints.down("sm")]={order:1,height:"max-content !important"},t),content:{padding:"1rem",boxSizing:"border-box",height:"100%",overflowY:"scroll"}}})),rr=function(t){var r=t.tabs,n=t.hideTabs,a=void 0!==n&&n,o=t.leaveHeightForMenu,i=void 0===o||o,l=t.children,d=tr({hideTabs:a,leaveHeightForMenu:i});return e.createElement("div",{className:""+d.grid},e.createElement("div",{className:d.tabs},e.createElement(er,{tabs:r})),e.createElement("div",{className:d.content},e.createElement(T,{disableGutters:!0},e.createElement(e.Fragment,null,l))))};export{Qt as Alert,gt as AlphabeticalList,Je as Breadcrumbs,Ae as Button,Bt as ButtonWithConfirm,We as ContentBox,Pe as ContentLabel,wt as DatePicker,Kt as EditableTable,Xe as EntityList,Qe as ErrorIndicator,Se as FORM_DELETING,ke as FORM_ENABLED,we as FORM_ERROR,Ce as FORM_LOADING,Ee as FORM_SUCCESS,Be as FORM_WARNING,Zt as ImageDisplayAndUpload,Ct as KeyboardDatePicker,lt as LeftNavigation,De as LoadingSpinner,ct as MainLayout,rr as NavbarLayout,Dt as NonEditableField,yt as NumberFormatField,ht as SearchBar,Et as Select,Ue as StaticTable,Lt as TableDatePicker,Ht as TableMultipleSelect,Ot as TableSelect,Rt as TableTextField,bt as TextField,tt as didCellValueChange,Wt as tableCheckbox,At as tableDateField,It as tableNumericStringField,Tt as tableNumericStringFixedDecimalField,st as useDebounceEffect,mt as useInterval,ut as useWhyDidYouUpdate};
1
+ import e,{memo as t,useState as r,useMemo as n,useCallback as a,useEffect as o,useRef as i,forwardRef as l,Fragment as d}from"react";import{makeStyles as c,Button as s,CircularProgress as u,Typography as m,Box as p,withStyles as g,createStyles as f,TableRow as h,TableHead as v,Table as b,TableBody as y,TableCell as x,Link as C,ButtonBase as E,Grid as w,ListItem as k,ListItemIcon as B,ListItemText as S,Collapse as N,List as R,IconButton as I,Container as T,Divider as F,InputBase as L,InputAdornment as A,TextField as P,MenuItem as W,Checkbox as D,FormControl as H,Select as O,FormHelperText as M,Tooltip as z,Avatar as j}from"@material-ui/core";import{string as G}from"yup";import{Pagination as K,Alert as V}from"@material-ui/lab";import{Link as U,useLocation as Y,useHistory as J}from"react-router-dom";import q from"@material-ui/icons/Error";import{ExpandLess as X,ExpandMore as Z,CloudUpload as Q,Forward as $}from"@material-ui/icons";import{isValid as _}from"date-fns";import ee from"@material-ui/icons/Close";import te from"@material-ui/icons/AddBoxOutlined";import re from"@material-ui/icons/Search";import{isEqual as ne}from"lodash";import ae from"react-number-format";import{MuiPickersUtilsProvider as oe,DatePicker as ie,KeyboardDatePicker as le}from"@material-ui/pickers";import de from"@date-io/date-fns";import{useTable as ce,useFilters as se,useGlobalFilter as ue,usePagination as me,useRowSelect as pe,useAsyncDebounce as ge}from"react-table";import{useVirtual as fe}from"react-virtual";var he=function(){return he=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},he.apply(this,arguments)};function ve(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}function be(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{d(n.next(e))}catch(e){o(e)}}function l(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}d((n=n.apply(e,t||[])).next())}))}function ye(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(d){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){i.label=l[1];break}if(6===l[0]&&i.label<a[1]){i.label=a[1],a=l;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(l);break}a[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,d])}}}function xe(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}G().trim().required("Required"),G().trim().required("Required").matches(/^\d*\.?\d*$/,"Must be a Number");var Ce="success",Ee="error",we="loading",ke="enabled",Be="warning",Se="deleting",Ne="read",Re="noAccess",Ie=c({labelBreak:{marginBottom:"0.5rem"},contentBreak:{marginBottom:"1rem"},sectionBreak:{marginBottom:"1.5rem"},doubleSectionBreak:{marginBottom:"3rem"},rightSpacer1:{marginRight:"0.5rem"},rightSpacer2:{marginRight:"1rem"},leftSpacer1:{marginLeft:"0.5rem"},leftSpacer2:{marginLeft:"1rem"},buttonSpacing:{marginLeft:"0.5rem",marginRight:"0.5rem",marginBottom:"1rem"},leftRightPadding1:{paddingLeft:"0.5rem",paddingRight:"0.5rem"},leftRightPadding2:{paddingLeft:"1rem",paddingRight:"1rem"},topBottomPadding1:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},topBottomPadding2:{paddingTop:"1rem",paddingBottom:"1rem"}},{classNamePrefix:"spacing",index:2}),Te=c((function(e){return{boldText:{fontWeight:700},bolderText:{fontWeight:500},smallText:{fontSize:"0.7rem"},warningColor:{color:e.palette.warning.main},centerText:{textAlign:"center"}}}),{classNamePrefix:"font"}),Fe=c({contentBox:{background:"white",borderRadius:"14px",marginBottom:"1rem",padding:"3rem"},limitWidth60rem:{maxWidth:"60rem",marginLeft:"auto",marginRight:"auto"},limitWidth50rem:{maxWidth:"50rem",marginLeft:"auto",marginRight:"auto"},limitWidth45rem:{maxWidth:"45rem",marginLeft:"auto",marginRight:"auto"},limitWidth40rem:{maxWidth:"40rem",marginLeft:"auto",marginRight:"auto"},limitWidth35rem:{maxWidth:"35rem",marginLeft:"auto",marginRight:"auto"},limitWidth30rem:{maxWidth:"30rem",marginLeft:"auto",marginRight:"auto"},limitWidth25rem:{maxWidth:"25rem",marginLeft:"auto",marginRight:"auto"},centeredText:{textAlign:"center"},startAlignedText:{textAlign:"start"},width20:{width:"20%"},width49:{width:"49%"},width50:{width:"50%"},width60:{width:"60%"},width100:{width:"100%"},flexCenter:{display:"flex",alignItems:"center",justifyContent:"center"},centerJustify:{justifyContent:"center"},leftJustify:{justifyContent:"left"},rightJustify:{justifyContent:"right"}},{classNamePrefix:"layout",index:2}),Le=c((function(e){return{submitButton:{borderRadius:"1.5rem",padding:"0.4rem 1rem",textTransform:"none"},containedText:{color:"white"},spinnerColour:{color:e.palette.grey[500]}}})),Ae=function(t){var r=t.loading,n=void 0!==r&&r,a=t.children,o=t.errors,i=void 0!==o&&o,l=t.type,d=void 0===l?"submit":l,c=t.onClick,m=t.disabled,p=void 0!==m&&m,g=t.variant,f=void 0===g?"outlined":g,h=t.styling,v=void 0===h?"":h,b=t.color,y=void 0===b?"primary":b,x=t.accessLevel,C=void 0===x?"":x,E=ve(t,["loading","children","errors","type","onClick","disabled","variant","styling","color","accessLevel"]),w=he(he({},Ie()),Le());if([Re,Ne].includes(C))return null;var k=p;return p||!n&&!i||(k=!0),e.createElement(s,he({},E,{variant:f,color:y,type:d,className:w.submitButton+" "+("contained"===f&&w.containedText)+" "+v,disabled:k,onClick:c}),a,n?e.createElement(u,{className:w.leftSpacer1+" "+w.spinnerColour,size:"1.1rem",thickness:6}):"")},Pe=function(t){var r=t.children,n=t.styling,a=void 0===n?null:n,o=Te();return e.createElement(m,{variant:"h6",className:o.bolderText+" "+(a||"")},r)},We=function(t){var r=t.limitWidth,n=void 0!==r&&r,a=t.children,o=t.styling,i=he(he({},Ie()),Fe());return e.createElement(p,{boxShadow:3,className:i.contentBox+" "+(o||"")},e.createElement(p,{className:i.centeredText+" "+(n?i.limitWidth50rem:"")},a))},De=function(t){var r=t.text,n=void 0===r?"Loading data...":r,a=t.styling,o=he(he({},Ie()),Fe());return e.createElement(p,{className:o.flexCenter+" "+(a||"")},e.createElement(m,{variant:"body2",color:"textSecondary",className:o.rightSpacer1},n),e.createElement(u,{size:"1.5rem"}))},He=g(f({root:{"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),Oe=g(f({root:{"&:nth-of-type(even) td":{backgroundColor:"rgba(0, 0, 0, 0.03)"},"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),Me=c((function(e){return{root:{borderBottom:"none",paddingTop:"8px",paddingBottom:"8px","&:first-child":{borderTopLeftRadius:"14px",borderBottomLeftRadius:"14px"},"&:last-child":{borderTopRightRadius:"14px",borderBottomRightRadius:"14px"}},head:function(t){var r=t.background,n=t.border;return{backgroundColor:r||"HSLA(204, 58.3%, 81.2%, 0.1)",borderTop:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)"),borderBottom:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)"),color:t.text||e.palette.text.primary,fontWeight:500,"&:first-child":{borderLeft:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)")},"&:last-child":{borderRight:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)")}}}}})),ze=function(t){var r=t.children,n=t.align,a=void 0===n?"centerJustify":n,o=t.headerColours,i=ve(t,["children","align","headerColours"]),l=he(he({},Fe()),Me(he({},o||{})));return e.createElement(x,he({},i,{classes:{root:l.root,head:l.head}}),e.createElement("div",{className:l.flexCenter+" "+l[a]},r))},je=function(t){var r=t.rowBorderSeparation,n=void 0!==r&&r,a=t.children,o=ve(t,["rowBorderSeparation","children"]);return n?e.createElement(He,he({},o),a):e.createElement(Oe,he({},o),a)},Ge=function(t){var r=t.colSpan,n=t.children,a=Ke();return e.createElement(je,null,e.createElement(ze,{className:a.adjustedCellPadding,colSpan:r},n))},Ke=c({tableStyles:{borderCollapse:"separate",borderBottom:"1px solid rgb(224, 224, 224)"},pointer:{cursor:"pointer"},bottomBorder:{borderBottom:"1px solid rgba(224, 224, 224, 1)"},noShading:{backgroundColor:"transparent !important"},adjustedCellPadding:{paddingTop:"11px",paddingBottom:"11px"}}),Ve=t((function(t){var r=t.headers,n=t.headerCellAlignment,a=void 0===n?[]:n,o=t.headerColours;return r?e.createElement(v,null,e.createElement(h,null,r.map((function(t,r){return e.createElement(ze,{align:a[r]||"centerJustify",key:"header-cell-"+r,headerColours:o},t)})))):null})),Ue=t((function(t){var i=t.rowBorderSeparation,l=void 0!==i&&i,d=t.headers,c=t.rows,s=t.headerCellAlignment,u=void 0===s?[]:s,m=t.rowCellAlignment,p=void 0===m?[]:m,g=t.styling,f=t.headerColours,h=t.paginate,v=void 0!==h&&h,x=t.itemsPerPage,C=void 0===x?30:x,E=he(he(he({},Fe()),Ie()),Ke()),w=r(1),k=w[0],B=w[1],S=n((function(){return!!(v&&((null==c?void 0:c.length)||0)>C)}),[C,v,c]),N=r(S?c.slice(0,C):c),R=N[0],I=N[1],T=a((function(e,t){B(t)}),[]);return o((function(){I(S?c.slice(C*(k-1),C*k):c)}),[S,C,k,c]),e.createElement(e.Fragment,null,e.createElement(b,{className:E.tableStyles+" "+(S?E.contentBreak:"")+" "+(g||"")},e.createElement(Ve,{headers:d,headerCellAlignment:u,headerColours:f}),e.createElement(y,null,R?R.length?R.map((function(t,r){var n=!!t.onClick;return e.createElement(je,{rowBorderSeparation:l,className:n?E.pointer:void 0,key:"row-"+r,onClick:n?t.onClick:void 0},t.row.map((function(t,n){return e.createElement(ze,{align:p[n]||"centerJustify",className:l&&R.length!==r+1?E.bottomBorder:void 0,key:"row-"+r+"-cell-"+n},t)})))})):e.createElement(Ge,{colSpan:(null==d?void 0:d.length)||0},"Table is empty"):e.createElement(Ge,{colSpan:(null==d?void 0:d.length)||0},e.createElement(De,null)))),S?e.createElement(K,{className:E.flexCenter,count:Math.ceil(c.length/C),page:k,onChange:T,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Ye=c((function(e){return{logoContainer:{width:"3rem",height:"3rem",display:"flex",justifyContent:"center",alignItems:"center"},logo:{width:"100%",height:"100%","& > div":{width:"100%",height:"100%"},"& > svg":{width:"100%",height:"100%"}},logoInBreadcrumb:{width:"2rem",height:"2rem",margin:"0.125rem 0 0.125rem 0.313rem"},logoSpacing:{marginRight:e.spacing(1)},flexItemsCenter:{display:"flex",alignItems:"center"},nonPrimaryBreadcrumbOffset:{marginLeft:"2.5rem"},BreadcrumbsContainer:{height:"2.25rem",marginLeft:"0.875rem",marginRight:"1.5rem"},primaryBreadcrumbItem:function(t){var r=t.primary;return{backgroundColor:(null==r?void 0:r.background)||e.palette.common.white,color:(null==r?void 0:r.color)||e.palette.text.primary,borderRadius:"2rem",zIndex:3,height:"100%",display:"flex",alignItems:"center"}},secondaryBreadcrumbItem:function(t){var r=t.secondary;return{height:"2.25rem",backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",borderRadius:"2rem",zIndex:2,marginLeft:"-2rem",color:(null==r?void 0:r.color)||e.palette.text.primary}},tertiaryBreadcrumbItem:function(t){var r=t.tertiary;return{height:"2.25rem",backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",borderRadius:"2rem",zIndex:1,marginLeft:"-2rem",color:(null==r?void 0:r.color)||e.palette.common.white}},breadCrumbShadow:{boxShadow:e.shadows[2]},breadcrumbRightMargin:{marginRight:"1rem"},breadcrumbTextOverflow:{display:"block",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"12rem"},boldText:{fontWeight:500},activeBreadcrumb:function(t){var r=t.tertiary;return{backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",color:(null==r?void 0:r.color)||e.palette.common.white}},noWrap:{whiteSpace:"nowrap"},fullBorderRadius:{borderRadius:"100%"}}})),Je=function(t){var r=t.logo,n=t.content,a=t.colors,o=Ye(he({},a||{})),i=n.first,l=void 0===i?null:i,d=n.second,c=void 0===d?null:d,s=n.third,u=void 0===s?null:s;return e.createElement(p,{className:o.BreadcrumbsContainer+" "+o.flexItemsCenter},e.createElement(p,{className:(l?o.primaryBreadcrumbItem+" "+o.breadCrumbShadow:"")+" "+o.flexItemsCenter},e.createElement(C,{component:U,to:"/",className:o.logoSpacing},e.createElement(p,{className:o.logoContainer+" \n "+(l?o.logoInBreadcrumb:"")},e.createElement(E,{className:o.logo+" "+o.fullBorderRadius},r))),l&&e.createElement(m,{color:"textPrimary",className:o.boldText+" "+o.noWrap+" "+o.primaryBreadcrumbItem},e.createElement(C,{underline:"none",component:U,to:l.link,color:"inherit",className:o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},l.name))),c&&e.createElement(p,{className:o.flexItemsCenter+" "+o.secondaryBreadcrumbItem+" "+o.breadCrumbShadow+" "+(u?"":o.activeBreadcrumb)},e.createElement(m,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(C,{component:U,underline:"none",to:c.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},c.name))),u&&e.createElement(p,{className:o.flexItemsCenter+" "+o.tertiaryBreadcrumbItem+" "+o.breadCrumbShadow},e.createElement(m,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(C,{component:U,underline:"none",to:u.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},u.name))))},qe=c((function(e){return{container:{marginRight:e.spacing(-1.5),marginLeft:e.spacing(-1.5)},svgContainer:{marginLeft:"auto",marginRight:"auto"},button:{display:"block",textDecoration:"none",borderRadius:"14px",height:"100%",width:"100%",textAlign:"center"},orgLabel:{padding:e.spacing(1),paddingTop:0}}})),Xe=function(t){var r=t.entities,n=t.icon,a=t.loadingMessage,o=void 0===a?"Loading list...":a,i=t.emptyMessage,l=void 0===i?"List is empty":i,d=t.onClick,c=he(he(he({},qe()),Ie()),Te());return e.createElement(p,{className:c.container},r?r.length?e.createElement(w,{container:!0,spacing:3},r.map((function(t,r){return e.createElement(w,{key:t.name+"-"+r,item:!0,xs:4,md:3},e.createElement(s,he({className:c.button,key:t.name},d?{onClick:function(){return d(t)}}:{component:U,to:t.link}),e.createElement(p,{className:c.svgContainer+" "+c.labelBreak},n(t)),e.createElement(m,{className:c.orgLabel,variant:"body1"},t.name)))}))):e.createElement(m,{className:c.centerText,variant:"body2",color:"textSecondary"},l):e.createElement(De,{text:o}))},Ze=function(t){var r=t.text,n=void 0===r?"Something went wrong":r,a=he(he({},Ie()),Fe());return e.createElement(p,{className:a.flexCenter},e.createElement(q,{fontSize:"medium",className:a.rightSpacer1,color:"error"}),e.createElement(m,{variant:"body2",color:"textSecondary"},n))},Qe=c((function(e){return{listIcon:{minWidth:"auto",paddingRight:"0.25rem"},mainIconSize:{fontSize:"1rem"},mainIconMarginAdjustment:{marginTop:"3px"},textOverflowElipsis:{overflow:"hidden",textOverflow:"ellipsis"},mainListItem:function(t){return{padding:"8px 24px 8px 16px",alignItems:"flex-start",backgroundColor:t.mainBackground||e.palette.common.white,color:t.mainText||e.palette.text.primary,borderRadius:e.spacing(.6),"&:hover":{backgroundColor:t.mainHover||e.palette.action.hover}}},mainIconColor:function(t){return{color:t.mainIcon||e.palette.grey[500]}},activeMainIconColor:function(e){return{color:e.mainActiveText||"#8FC1FF"}},subListItem:function(t){return{backgroundColor:t.subItemBackground||"#FFFFFF",color:t.subItemText||e.palette.text.secondary,borderRadius:"8px","&:hover":{backgroundColor:t.subItemHover||"rgba(143,193,255,0.3)"}}},activeSubListItem:function(e){return{backgroundColor:e.subItemActiveBackground||"#FFFFFF",color:e.subItemActiveText||"#8FC1FF","&:hover":{backgroundColor:e.subItemActiveHover||"rgba(143,193,255,0.3)"}}},subItemBorder:{borderLeft:"1px solid "+e.palette.grey[600],marginLeft:"1px",marginRight:"1px",width:"100%",height:"100%"},relativeWrapper:{position:"relative"},subItemBorderMask:function(e){return{borderLeft:"3px solid "+(e.subItemActiveText||"#8FC1FF"),borderRadius:"1px",position:"absolute",top:"50%",bottom:"50%",transition:"all 0.2s ease-in-out"}},activeSubItemBorder:{top:"0 !important",bottom:"0 !important"},subItemWrapper:{display:"flex",marginLeft:"13px",marginRight:"16px"},noYMargin:{marginTop:"unset",marginBottom:"unset"}}})),$e=function(e,t){return!!e.split("/").includes(t)},_e=function(t){var n,a,o=t.mainItem,i=t.subItems,l=t.config,d=t.Icon,c=he(he(he({},Te()),Ie()),Qe(he(he({},(null===(n=l.secondary)||void 0===n?void 0:n.mainItemColors)||{}),(null===(a=l.secondary)||void 0===a?void 0:a.subItemColors)||{}))),s=Y(),u=$e(s.pathname,o.id),g=r(!!(null==i?void 0:i.length)&&u),f=g[0],h=g[1];return e.createElement(e.Fragment,null,e.createElement(k,{button:!0,dense:!0,className:c.mainListItem,component:U,to:o.route},e.createElement(B,{className:c.listIcon+" "+c.mainIconMarginAdjustment+" "+c.rightSpacer1},e.createElement(d,{id:"second-nav-item",styling:c.mainIconSize+" "+c.mainIconColor+" "+(u?c.activeMainIconColor:"")})),e.createElement(S,{disableTypography:!0,className:c.noYMargin,primary:e.createElement(m,{variant:"body2",className:c.bolderText+" "+c.textOverflowElipsis,color:"inherit"},o.name,(null==i?void 0:i.length)?e.createElement(m,{component:"span",variant:"body2",className:c.bolderText,color:"inherit"}," ","(",i.length,")"):null)}),(null==i?void 0:i.length)?e.createElement(B,{className:c.listIcon,onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(e){return!e}))}},f?e.createElement(X,null):e.createElement(Z,null)):null),(null==i?void 0:i.length)?e.createElement(N,{in:f,timeout:"auto",unmountOnExit:!0},e.createElement(R,{component:"div",disablePadding:!0},i.map((function(t){var r=t.name,n=t.route,a=t.id;return e.createElement(p,{key:a,className:c.subItemWrapper},e.createElement(p,{className:c.relativeWrapper+" "+c.rightSpacer1},e.createElement(p,{className:c.subItemBorder+" "}),e.createElement(p,{className:c.subItemBorderMask+" "+($e(s.pathname,a)?c.activeSubItemBorder:"")+" "})),e.createElement(k,{key:n,component:U,to:n,button:!0,dense:!0,className:c.subListItem+" "+($e(s.pathname,a)?c.activeSubListItem:"")},e.createElement(S,{disableTypography:!0,primary:e.createElement(m,{variant:"body2",className:c.textOverflowElipsis,color:"inherit"},r)})))})))):null)};function et(e){return e.sort((function(e,t){return+t.startDate.split("T")[0].replaceAll("-","")-+e.startDate.split("T")[0].replaceAll("-","")}))}var tt=function(e,t,r){return r?(e&&_(e)?e:new Date(0)).getTime()===(t&&_(t)?t:new Date(0)).getTime():e===t},rt=c((function(e){return{secondaryNavWrapper:{height:"100%",width:"300px",background:"white",overflowY:"auto",overflowX:"hidden",borderTopRightRadius:"14px",borderBottomRightRadius:"14px",marginLeft:"-16px",paddingLeft:"16px",border:"1px solid "+e.palette.grey[300],boxShadow:"0 2px 4px 0 rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},titleWrapper:{marginTop:"24px",display:"flex",alignItems:"center",paddingLeft:"16px",paddingRight:"16px"},title:{fontSize:"18px",fontWeight:500,color:function(e){return e.titleColor||"#8FC1FF"}},titleIcons:{color:function(e){return e.titleIconColor||"#8FC1FF"}},closeButton:{marginLeft:"auto"},archivedSeparator:{paddingLeft:"8px",color:e.palette.grey[500]},archivedBorder:{marginTop:"3rem",border:"1px solid "+e.palette.grey[200],width:"33%",marginLeft:"8px"},listWrapper:{marginLeft:e.spacing(1),marginRight:e.spacing(1)}}})),nt=function(t){var r,n,a,o,i=t.secondaryNavItems,l=t.primaryNavItems,d=t.expandedOptions,c=t.setExpandedOptions,s=t.config,u={titleColor:null===(r=s.secondary)||void 0===r?void 0:r.titleColor,titleIconColor:null===(n=s.secondary)||void 0===n?void 0:n.titleIconColor},g=he(he(he({},Ie()),Te()),rt(u)),f=J(),h=i[d.view];if(!h)return null;var v=l.find((function(e){return e.field===d.view})).Icon;return e.createElement(p,{className:g.secondaryNavWrapper},e.createElement(p,{className:g.titleWrapper},e.createElement(m,{className:g.rightSpacer1+" "+g.title},d.view),h.button?e.createElement(I,{className:g.titleIcons,size:"small",type:"button",onClick:function(){return f.push(h.button.url)}},e.createElement(te,null)):null,e.createElement(I,{className:g.titleIcons+" "+g.closeButton,size:"small",type:"button",onClick:function(){return c({view:"",expanded:!1})}},(null===(a=s.secondary)||void 0===a?void 0:a.closeButtonSvg)||e.createElement(ee,null))),e.createElement(R,{className:g.listWrapper,component:"div"},et(h.items).map((function(t){return e.createElement(_e,he({key:t.mainItem.route},t,{config:s,Icon:v}))})),(null===(o=h.archivedItems)||void 0===o?void 0:o.length)?e.createElement(e.Fragment,null,e.createElement(p,{className:g.archivedBorder+" "+g.contentBreak}),e.createElement(m,{variant:"body2",className:g.archivedSeparator+" "+g.bolderText},"Archived ",d.view),et(h.archivedItems).map((function(t){return e.createElement(_e,he({key:t.mainItem.route},t,{config:s,Icon:v}))}))):null))},at=c((function(e){return{primaryNavContainer:function(e){return{background:e.background||"linear-gradient(to bottom, #253a68 40%, #73c4ca)",border:"2px solid "+(e.activeBorderColor||"#8FC1FF"),borderLeft:"none",borderTopRightRadius:"14px",borderBottomRightRadius:"14px",minWidth:"4.5rem",overflowY:"auto",overflowX:"hidden"}},listWrapper:{display:"flex",flexDirection:"column",paddingTop:0},itemWrapper:{display:"flex",flexDirection:"column",padding:"0.75rem 0.5rem 0.5rem 0.5rem"},itemBorder:{borderRight:function(e){return"6px solid "+(e.activeBorderColor||"#8FC1FF")},position:"absolute",bottom:"50%",top:"50%",transition:"all 0.2s ease-in-out",right:"-3px"},activeBorder:{top:"15%",bottom:"15%"},iconWrapper:{minWidth:0,marginBottom:"4px",position:"relative"},itemName:{fontSize:"0.7rem",maxWidth:"3.5rem",textAlign:"center",textOverflow:"ellipsis",overflow:"hidden"},textColour:{color:function(e){return e.text||"#FFFFFF"}},activeTextColour:{color:function(e){return e.activeText||"#8FC1FF"}},lastItem:{marginTop:"auto"}}})),ot=function(t){var r=t.expandedOptions,n=t.setExpandedOptions,a=t.navigationLinks,o=t.config,i=Y(),l=at(he({},o.primary||{})),d=function(e,t){return""===r.view?i.pathname===t||!(e===o.rootRouteName||!i.pathname.startsWith(t)):r.view===e};return e.createElement(R,{className:l.primaryNavContainer+" "+l.listWrapper},a.map((function(t,r,a){var i;return e.createElement(k,he({key:t.field,button:!0,className:l.itemWrapper+" "+l.textColour+" "+((null===(i=o.primary)||void 0===i?void 0:i.moveLastItemToBottom)&&r===a.length-1?l.lastItem:"")},t.hasSecondary?{}:{component:U,to:t.path},{onClick:function(){n({view:t.field,expanded:!!t.hasSecondary})}}),e.createElement(B,{className:l.iconWrapper},e.createElement(t.Icon,{styling:l.textColour+" "+(d(t.field,t.path)?l.activeTextColour:"")})),e.createElement(m,{variant:"caption",className:l.itemName+" "+l.textColour+" "+(d(t.field,t.path)?l.activeTextColour:"")},t.field),e.createElement(p,{className:l.itemBorder+" "+(d(t.field,t.path)?l.activeBorder:"")}))})))},it=c({leftNavContainer:{height:"100%",display:"flex",position:"relative",width:"max-content"}}),lt=function(t){var n=t.primaryNavItems,a=t.secondaryNavItems,i=t.config,l=r({view:"",expanded:!1}),d=l[0],c=l[1],s=it(),u=Y(),m=n.reduce((function(e,t){return t.hasSecondary?xe(xe([],e,!0),[t.field],!1):e}),[]);return o((function(){c((function(e){return m.includes(e.view)&&!0===e.expanded?e:{view:"",expanded:!1}}))}),[u.pathname]),e.createElement(p,{component:"nav",className:s.leftNavContainer},e.createElement(ot,{expandedOptions:d,setExpandedOptions:c,navigationLinks:n,config:i}),d.expanded&&e.createElement(nt,{secondaryNavItems:a,primaryNavItems:n,expandedOptions:d,setExpandedOptions:c,config:i}))},dt=c((function(e){return{remainingHeightBox:{position:"absolute",top:function(e){var t;return null!==(t=e.topOffset)&&void 0!==t?t:"4rem"},bottom:0,left:0,right:0,display:"flex"},fullHeightFlexbox:{display:"flex",height:"100%"},relativeContainer:{position:"relative"},scrollWrapper:{overflow:"auto"},componentWrapper:{padding:e.spacing(2),paddingBottom:e.spacing(2),position:"relative"}}})),ct=function(t){var r=t.sideNavigation,n=t.children,a=t.desktopWidth,o=t.topOffset,i=dt({topOffset:o});return e.createElement(p,{className:i.remainingHeightBox},r?e.createElement(p,{className:i.fullHeightFlexbox+" "+i.relativeContainer},r):null,e.createElement(T,{disableGutters:!0,maxWidth:!1,className:i.scrollWrapper},e.createElement(T,{disableGutters:!0,maxWidth:a?"xl":"lg",className:i.componentWrapper},n)))},st=function(e,t,r){void 0===r&&(r=250);var n=a(e,t);o((function(){var e=setTimeout(n,r);return function(){return clearTimeout(e)}}),[n,r])},ut=function(e,t){var r=i();o((function(){r.current=e})),o((function(){if(null!==t){var e=setInterval((function(){r.current&&r.current()}),t);return function(){return clearInterval(e)}}}),[t])};function mt(e,t){var r=i(t);o((function(){var n=Object.keys(he(he({},r.current),t)),a={};n.forEach((function(e){r.current[e]!==t[e]&&(a[e]={from:r.current[e],to:t[e],changedKeys:t[e]&&"object"==typeof t[e]?Object.keys(r.current[e]).map((function(n){return r.current[e][n]===t[e][n]?"":n})).filter(Boolean):void 0,isDeepEqual:ne(r.current[e],t[e])})})),Object.keys(a).length&&console.log("[why-did-you-update]",e,{changes:a,props:{from:r.current,to:t}}),r.current=t}),Object.values(t))}var pt=c((function(e){return{divider:{background:e.palette.primary.main,height:"0.2rem"},letterHeader:{cursor:"default",color:e.palette.primary.main,marginTop:"1rem"},listItem:{borderRadius:"14px",border:"1px solid "+e.palette.grey[300],marginBottom:"0.5rem",paddingLeft:"24px",boxShadow:e.shadows[1]},topMargin:{marginTop:e.spacing(2),display:"block"}}})),gt=function(t){var r=t.array,n=t.sortFn,a=t.sortKey,o=void 0===a?"name":a,i=t.buttonClick,l=t.linkTo,d=t.ItemTemplate,c=t.arrayKey,s=void 0===c?"id":c,u=t.loading,p=void 0!==u&&u,g=t.loadingMessage,f=void 0===g?"Loading list...":g,h=t.emptyMessage,v=void 0===h?"List is empty":h,b=t.alphabetisedHeader,y=void 0===b||b,x=he(he(he({},pt()),Ie()),Fe());if(void 0===r||p)return e.createElement(De,{styling:x.topMargin,text:f});if(!(null==r?void 0:r.length))return e.createElement(m,{className:x.topMargin,align:"center",variant:"body2",color:"textSecondary"},v);var C=n?xe([],r,!0).sort(n):r,E="";return e.createElement(R,{className:x.limitWidth50rem},C.map((function(t,r){var n,a=!1;if(y){var c=((null===(n=t[o])||void 0===n?void 0:n[0])||"???").toLowerCase();c!==E&&(E=c,a=!0)}return e.createElement(e.Fragment,{key:t[s]||"alphabetical-list-"+r},y&&a?e.createElement(e.Fragment,null,e.createElement(m,{className:""+x.letterHeader,align:"left"},E.toUpperCase()),e.createElement(F,{className:x.contentBreak+" "+x.divider})):null,e.createElement(k,he({className:x.listItem,alignItems:"flex-start",button:!(!i&&!l)||void 0,onClick:i?function(){return i(t)}:void 0},l&&!i?{component:U,to:l(t)}:{}),e.createElement(d,{item:t})))})))},ft=c((function(e){return{searchBox:{display:"flex",alignContent:"center",alignItems:"center",padding:"8px",border:"2px solid "+e.palette.grey[300],borderRadius:"14px"},searchField:{borderRadius:"14px",width:"100%",background:function(e){return e.background||"RGBA(179, 213, 235, 0.1)"},height:"46px",paddingLeft:"24px",color:e.palette.grey[600]},searchIcon:{color:e.palette.grey[600]}}})),ht=function(t){var n=t.array,a=t.sortFn,i=t.sortKey,l=void 0===i?"name":i,d=t.buttonClick,c=t.linkTo,s=t.ItemTemplate,u=t.arrayKey,m=void 0===u?"id":u,g=t.loading,f=void 0!==g&&g,h=t.loadingMessage,v=void 0===h?"Loading list...":h,b=t.emptyMessage,y=void 0===b?"List is empty":b,x=t.dynamicEmptyMessage,C=t.inputBackgroundColor,E=t.placeholder,w=t.disabledSearch,k=t.delay,B=void 0===k?500:k,S=t.minQueryLength,N=void 0===S?3:S,R=t.handleOnChange,I=t.searchKeys,T=void 0===I?["name"]:I,F=t.alphabetisedHeader,P=void 0===F||F,W=t.initialSearchQuery,D=void 0===W?"":W,H=he(he(he({},Ie()),Fe()),ft({background:C})),O=r(D),M=O[0],z=O[1],j=r(!1),G=j[0],K=j[1],V=r(n),U=V[0],Y=V[1];return st((function(){!R&&!G&&M.length>=N&&Y(null==n?void 0:n.filter((function(e){var t=T.some((function(t){var r;return null===(r=e[t])||void 0===r?void 0:r.toLowerCase().includes(M.toLowerCase())}));return t})))}),[M,n],B),st((function(){R&&!G&&M.length>=N&&R(M)}),[M],B),o((function(){Y(n)}),[n]),e.createElement(e.Fragment,null,e.createElement(p,{className:H.searchBox+" "+H.limitWidth50rem},e.createElement(L,{disabled:w,type:"text",value:M,placeholder:E||"Enter to search",onChange:function(e){G&&K(!1),z(e.target.value)},className:H.searchField,endAdornment:e.createElement(A,{position:"end",className:H.rightSpacer2},e.createElement(re,{className:H.searchIcon}))})),null!==n&&e.createElement(gt,{array:U,sortFn:a,sortKey:l,buttonClick:d,linkTo:c,ItemTemplate:s,arrayKey:m,loading:f,loadingMessage:v,emptyMessage:x?x(M):y,alphabetisedHeader:P}))},vt=c((function(e){return{inputField:function(t){var r=t.size;return he({borderRadius:"14px"},"small"===r?e.typography.body2:{})},labelStyles:function(t){var r=t.size;return he({},"small"===r?he(he({transform:"translate(14px, 9px) scale(1) !important"},e.typography.body2),{"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:"translate(15px, -9px) scale(0.75) !important"}}):{})}}})),bt=function(t){var r=t.size,n=void 0===r?"small":r,a=t.styling,o=t.numberField,i=t.inputProps,l=void 0===i?{}:i,d=t.InputProps,c=void 0===d?{}:d,s=t.accessLevel,u=t.disabled,m=t.fixedDecimalScale,p=ve(t,["size","styling","numberField","inputProps","InputProps","accessLevel","disabled","fixedDecimalScale"]),g=vt({size:n});if(s===Re)return null;var f=u;s===Ne&&(f=!0);var h=he({},o&&{fixedDecimalScale:!!m});return e.createElement(P,he({className:a||"",disabled:f},p,{inputProps:he(he({},l),h),InputProps:he(he({},c),{className:g.inputField,inputComponent:o?yt:void 0}),InputLabelProps:{className:g.labelStyles},variant:"outlined",size:n}))},yt=function(t){var r=t.inputRef,n=t.onChange,a=ve(t,["inputRef","onChange"]);return e.createElement(ae,he({},a,{getInputRef:r,onValueChange:function(e){n({target:{name:t.name||"",value:e.value}})},thousandSeparator:!0,decimalScale:2,isNumericString:!0}))},xt=c((function(e){return{listItem:function(t){var r=t.background,n=t.size;return he(he({overflow:"auto",scrollbarWidth:"thin"},"small"===n?e.typography.body2:{}),{"&:hover":{backgroundColor:r+" !important"}})},inputStyles:function(t){var r=t.background,n=t.size;return he(he({borderRadius:"14px !important"},"small"===n?he({paddingTop:"9.5px",paddingBottom:"8.5px"},e.typography.body2):{}),{"&:focus":{backgroundColor:r}})},selectedListItem:function(e){return{"&:focus":{background:e.background+" !important"}}}}})),Ct=function(t){var r=t.selectOptions,n=t.background,a=void 0===n?"#EFEDFF":n,o=t.size,i=void 0===o?"small":o,l=t.styling,d=t.disabled,c=t.accessLevel,s=ve(t,["selectOptions","background","size","styling","disabled","accessLevel"]),u=xt({background:a,size:i});if(c===Re)return null;var m=d;return c===Ne&&(m=!0),e.createElement(bt,he({className:l||""},s,{disabled:m,size:i,SelectProps:{inputProps:{className:u.inputStyles}},select:!0}),r.map((function(t){var r;return e.createElement(W,{key:t.value,value:t.value,disabled:null!==(r=null==t?void 0:t.disabled)&&void 0!==r&&r,className:u.listItem,classes:{selected:u.selectedListItem}},t.description)})))},Et=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd MMM yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,d=t.disabled,c=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Re)return null;var s=d;return l===Ne&&(s=!0),e.createElement(oe,{utils:de},e.createElement(ie,he({className:r||""},c,{disabled:s,inputVariant:"outlined",autoOk:!0,format:a,minDate:i,TextFieldComponent:bt})))},wt=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd/MM/yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,d=t.disabled,c=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Re)return null;var s=d;return l===Ne&&(s=!0),e.createElement(oe,{utils:de},e.createElement(le,he({className:r||""},c,{disabled:s,inputVariant:"outlined",autoOk:!0,allowKeyboardControl:!0,format:a,minDate:i,TextFieldComponent:bt})))},kt=c((function(e){return{confirmWrapper:{display:"inline-block"},confirmContainer:{display:"flex",alignItems:"center"},whiteText:{color:e.palette.common.white}}})),Bt=function(t){var n=t.children,a=t.onClick,i=t.styling,l=t.disabled,d=void 0!==l&&l,c=t.variant,s=void 0===c?"outlined":c,u=t.color,g=void 0===u?"primary":u,f=t.accessLevel,h=void 0===f?"":f,v=t.confirmButtonLabel,b=void 0===v?"Are you sure?":v,y=ve(t,["children","onClick","styling","disabled","variant","color","accessLevel","confirmButtonLabel"]),x=he(he({},Ie()),kt()),C=r(!1),E=C[0],w=C[1],k=r(!1),B=k[0],S=k[1];return ut((function(){return w(!1)}),!E||B?null:4500),o((function(){S(y.loading),w(y.loading)}),[y.loading]),[Re,Ne].includes(h)?null:E?e.createElement(p,{className:x.confirmWrapper},e.createElement(p,{className:x.confirmContainer},e.createElement(m,{className:x.rightSpacer1,variant:"body1"},b),e.createElement(Ae,he({},y,{type:"button",onClick:function(e){S(!0),a(e)},variant:"contained",styling:x.whiteText,disabled:d,color:g}),"Confirm",y.loading?"ing":""))):e.createElement(Ae,{type:"button",variant:s,disabled:d,styling:i,color:g,onClick:function(){return w(!0)}},n)},St=function(e,t){var r=t?(+e).toFixed(2).length:e.toString().length;return r?r+1+Math.floor(r/3)/3+"ch":"6ch"},Nt=c((function(e){return{inputBase:function(e){return{height:"unset",padding:0,textAlign:e.textAlign||"center"}},input:function(e){return{textAlign:e.textAlign||"center",marginRight:"0.4rem",marginLeft:"0.4rem"}},startAdornment:{color:e.palette.text.secondary},modifiedUnderline:{"&:not(.Mui-disabled):before":{borderBottom:"none",transition:"none"},"&:hover:not(.Mui-disabled):before":{borderBottom:"1px solid "+e.palette.grey[500]+" !important"}},body2Text:he({},e.typography.body2),dateFieldWidth:{width:"8ch"},fullDateWidth:{width:"11ch"},justifyStart:{justifyContent:"flex-start"},justifyCenter:{justifyContent:"center"},justifyEnd:{justifyContent:"flex-end"},totalContainer:{display:"flex",alignItems:"center",cursor:"default"},selectFocusBackground:{"&:focus":{backgroundColor:"unset"}}}})),Rt=function(t){var r=t.error,n=t.disabled,a=t.value,o=t.onBlur,i=t.onChange,l=t.prefix,d=t.suffix,c=t.numberField,s=void 0!==c&&c,u=t.textAlign,p=t.fixedDecimalScale,g=t.inputStyling,f=void 0===g?"":g,h=t.wrapperStyling,v=void 0===h?"":h,b=t.widthOverride,y=void 0===b?void 0:b,x=t.name,C=void 0===x?void 0:x,E=Nt({textAlign:u}),w=he({},s&&{fixedDecimalScale:!!p});return"string"==typeof a||"number"==typeof a?e.createElement(P,{name:C,className:v,error:!!r,inputProps:he({className:E.inputBase+" "+f,style:{width:y||St(a,!!p)}},w),value:a,onChange:i,onBlur:o,InputProps:{startAdornment:l?e.createElement(A,{position:"end",className:E.startAdornment},l):null,endAdornment:d?e.createElement(A,{position:"start",className:E.startAdornment},d):null,inputComponent:s?yt:void 0,className:E.body2Text+" "+E.modifiedUnderline,classes:{input:E.input}},helperText:r||void 0,disabled:n}):e.createElement(m,{variant:"body2"},"Incorrect value type")},It=function(t){return e.createElement(Rt,he({},he(he({},t),{numberField:!0})))},Tt=function(t){return e.createElement(Rt,he({},he(he({},t),{numberField:!0,fixedDecimalScale:!0})))},Ft=g(f({root:{padding:"3px"}}))(D),Lt=function(t){var r=t.disabled,n=t.fullDate,a=void 0!==n&&n,o=t.value,i=t.error,l=t.onChange,d=t.onBlur,c=t.textAlign,s=Nt({textAlign:c});return e.createElement(oe,{utils:de},e.createElement(ie,{disabled:r,views:a?void 0:["year","month"],value:o,autoOk:!0,format:a?"dd MMM yyyy":"MMM yyyy",InputProps:{className:s.body2Text+" "+s.modifiedUnderline},inputProps:{className:s.inputBase+" "+(a?s.fullDateWidth:s.dateFieldWidth),classes:{input:s.input}},error:!!i,helperText:i||void 0,onChange:l,onBlur:d}))},At=function(t){return e.createElement(Lt,he({fullDate:!0},t))},Pt=function(t){var r=t.value,n=t.disabled,a=t.onChange;return e.createElement(D,{disabled:n,checked:r,onChange:a,color:"primary",size:"small"})},Wt=function(t){return e.createElement(Pt,he({},t))},Dt=function(t){var r=t.text,n=t.numberField,a=void 0!==n&&n,o=t.prefix,i=void 0===o?null:o,l=t.suffix,d=void 0===l?null:l,c=t.textAlign,s=t.fixedDecimalScale,u=t.styling,m=void 0===u?"":u,g=t.inputStyling,f=void 0===g?"":g,h=t.widthOverride,v=void 0===h?void 0:h,b=Nt({});return e.createElement(p,{className:b.totalContainer+" "+b.body2Text+" "+("left"===c?b.justifyStart:"right"===c?b.justifyEnd:b.justifyCenter)+" "+m,style:{width:v}},i&&i,e.createElement(p,{className:b.body2Text,style:{width:v}},a?e.createElement(ae,{className:f,value:r,displayType:"text",thousandSeparator:!0,isNumericString:!0,decimalScale:2,fixedDecimalScale:s}):r),d&&d)},Ht=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,d=Nt({});return e.createElement(H,{margin:"none",error:!!r},e.createElement(O,{className:d.body2Text+" "+d.modifiedUnderline,inputProps:{className:d.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(W,{className:d.body2Text,key:r,value:r},n)}))),r&&e.createElement(M,null,r))},Ot=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,d=t.renderValue,c=Nt({});return e.createElement(H,{margin:"none",error:!!r},e.createElement(O,{className:c.body2Text+" "+c.modifiedUnderline,inputProps:{className:c.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l,renderValue:d,multiple:!0},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(W,{className:c.body2Text,key:r,value:r},n)}))),r&&e.createElement(M,null,r))},Mt=c((function(e){return{newRowHighlight:{backgroundColor:"#73c4ca30"},editedCellHighlight:{backgroundColor:"#5840f52e !important",backgroundClip:"padding-box"},editedBorder:{border:"3px solid #5840f52e",borderWidth:"2px 4px"},errorBorder:{border:"3px solid "+e.palette.error.light,borderWidth:"2px 4px"},emptyLoadingPadding:{paddingTop:"0.75rem",paddingBottom:"0.75rem"},centeredText:{textAlign:"center"},disabled:{backgroundColor:e.palette.action.hover},pagination:{marginTop:"1rem",marginBottom:"1rem"},virtualisationContainer:{maxHeight:"500px",overflow:"auto"},cellPadding:{padding:".5rem .75rem"},shadedHeader:{"&:nth-of-type(even).shadedHeader":{backgroundColor:"#eeeeee"}},shadedBodyCell:{"&:nth-of-type(even).shadedBodyCell":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"}},shadedHeaderGroupParent:{"&:nth-of-type(even).shadedHeaderGroupParent":{backgroundColor:"#eeeeee"}},shadedHeaderGroup2Children:{"&:nth-of-type(4n-2).shadedHeaderGroup2Children":{backgroundColor:"#eeeeee"},"&:nth-of-type(4n-1).shadedHeaderGroup2Children":{backgroundColor:"#eeeeee"}},shadedBody2CellsInsideGroup:{"&:nth-of-type(4n-2).shadedBody2CellsInsideGroup":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"},"&:nth-of-type(4n-1).shadedBody2CellsInsideGroup":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"}},offsetStickyPosition:{top:0,left:"-3px",zIndex:2,position:"sticky"},stickyHeaderZIndex:{zIndex:3},headerCellColour:{backgroundColor:e.palette.grey[50]},rowCellColour:{backgroundColor:e.palette.common.white,backgroundClip:"padding-box"},rowHoverForStickyCell:{"&:hover .stickyRowCell":{backgroundColor:"rgb(245,245,245)"}},headerBorders:{"& :not(tr:last-child th)":{border:"none"}}}})),zt=function(t){var n=t.value,a=void 0===n?"":n,i=t.row,l=i.index,d=i.values,c=i.original,s=t.column.id,u=t.syncCellWithState,m=t.setRows,p=t.fieldConfig,g=t.disabled,f=p[s],h=f.validationRule,v=f.dependentValidationRule,b=f.isCheckbox,y=f.isDateField,x=f.customRenderFn,C=f.prefix,E=f.suffix,w=f.textAlign,k=f.onBlur,B=f.onChangeValueModifier,S=r(!1),N=S[0],R=S[1],I=r(a),T=I[0],F=I[1],L=b,A=function(e){var t=!1;if(h)try{h.validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}if(v)try{v(d).validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}return t},P=function(e){return be(void 0,void 0,void 0,(function(){return ye(this,(function(t){switch(t.label){case 0:return L?u(l,s,e,!1):u(l,s,T,!!N),!k||!m||N||tt(d[s],T,y)?[3,2]:[4,k({rowIndex:l,value:T,setRows:m,values:c})];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))};o((function(){F(a);var e=A(a);N!==e&&u(l,s,a,e,!0)}),[a]),o((function(){c.errors&&!!c.errors[s]!=!!N&&A(a)}),[c.errors]);var W,D={value:T,values:d,disabled:g||c.disabledRow,error:N,onChange:function(e){var t;if(y){t=e;var r=B?B(t):t;return F(r),void A(r)}t=e;var n=L?t.target.checked:t.target.value;L?(F(n),P(n)):(F(n),A(n))},onBlur:P,prefix:C,suffix:E,textAlign:w,originalValues:c};return x?x(D):(W=D,e.createElement(Rt,he({},he({},W))))},jt=l((function(t,r){var n=t.row,a=t.classes,o=t.disabled,i=t.includeRowSelect,l=ve(t,["row","classes","disabled","includeRowSelect"]);return e.createElement(h,he({},l,{ref:r,hover:!0,className:("NEW"===n.original.rowStatus?a.newRowHighlight:"")+" "+("EDITED"===n.original.rowStatus?a.editedBorder:"")+"\n"+(Object.values(n.original.errors||{}).includes(!0)?a.errorBorder:"")+" "+(n.original.disabledRow||o?a.disabled:"")+"\n "+a.rowHoverForStickyCell}),n.cells.map((function(t,r){return e.createElement(x,he({},t.getCellProps(),{align:t.column.textAlign||"center",className:("EDITED"===t.row.original.rowStatus&&t.row.original.edited[t.column.id]?a.editedCellHighlight:"")+" "+a.cellPadding+"\n "+(t.column.shadedHeaderGroup?a.shadedBody2CellsInsideGroup+" shadedBody2CellsInsideGroup":"")+"\n "+(t.column.shadedHeader?a.shadedBodyCell+" shadedBodyCell":"")+"\n "+(t.column.stickyCell?a.offsetStickyPosition+" "+a.rowCellColour+" stickyRowCell":"")+"\n ",padding:i&&0===r?"checkbox":"normal"}),t.render("Cell"))})))})),Gt=[],Kt=t((function(t){var r=t.tableRows,n=t.tableHeaders,i=t.syncCellWithState,l=t.setRows,d=void 0===l?void 0:l,c=t.skipPageReset,s=void 0!==c&&c,u=t.fieldConfig,g=t.disabled,f=void 0!==g&&g,h=t.setSelectedRows,v=t.includeRowSelect,b=void 0===v||v,y=t.filterData,x=t.filterTypes,C=t.emptyTableText,E=void 0===C?"Table is empty":C,w=t.paginate,k=void 0!==w&&w,B=t.defaultPageSize,S=void 0===B?50:B,N=t.virtContainerStyling,R=t.overscan,I=t.rowHeight,T=t.includeGlobalSearch,F=t.disableHeaderSelect,L=he(he({},Mt()),Fe()),A=e.useRef(null),P=e.useMemo((function(){return{Cell:zt}}),[]),W=ce({columns:n,data:r||Gt,defaultColumn:P,autoResetPage:!!k&&!s,filterTypes:x,initialState:{pageSize:k?S:void 0},syncCellWithState:i,setRows:d,fieldConfig:u,disabled:f,autoResetGlobalFilter:!1},se,ue,me,pe,(function(t){b&&t.visibleColumns.push((function(t){return xe([{id:"selection",Header:function(t){var r=t.getToggleAllRowsSelectedProps,n=t.getToggleAllPageRowsSelectedProps;return F?"Select":e.createElement(Ft,he({},k?n():r(),{disabled:f,size:"small"}))},Cell:function(t){var r=t.row;return e.createElement(Ft,he({},r.getToggleRowSelectedProps(),{disabled:f||r.original.disableSelection,size:"small"}))}}],t,!0)}))})),D=W.getTableProps,H=W.getTableBodyProps,O=W.headerGroups,M=W.rows,z=W.page,j=W.prepareRow,G=W.state,V=G.selectedRowIds,U=G.pageIndex,Y=W.state,J=W.setFilter,q=W.pageCount,X=W.gotoPage,Z=W.preGlobalFilteredRows,Q=W.setGlobalFilter,$=W.isAllRowsSelected,_=W.selectedFlatRows,ee=fe({size:(k?z:M).length,parentRef:A,overscan:R||5,estimateSize:a((function(){return I||54}),[I])}),te=k?z:M,re=ee.virtualItems,ne=re.length>0?re[0].start:0,ae=re.length>0?ee.totalSize-re[re.length-1].end:0,oe=a((function(e,t){X(t-1)}),[]);return o((function(){y&&J(y.filterRow,y.filterValues)}),[y]),o((function(){h&&h(Object.keys(V).map((function(e){return+e})))}),[V]),e.createElement(e.Fragment,null,T?e.createElement(Ut,{preGlobalFilteredRows:Z,globalFilter:Y.globalFilter,setGlobalFilter:Q}):null,e.createElement("div",{ref:A,className:N||L.virtualisationContainer},e.createElement(Yt,he({},{disabled:f,includeRowSelect:b,getTableProps:D,headerGroups:O,getTableBodyProps:H,rowsToRender:te,prepareRow:j,paddingTop:ne,paddingBottom:ae,virtualRows:re,isAllRowsSelected:$,selectedFlatRows:_}))),null===r?e.createElement(p,{className:L.emptyLoadingPadding},e.createElement(De,null)):null,r&&!r.length?e.createElement(p,{className:L.emptyLoadingPadding+" "+L.centeredText},e.createElement(m,{variant:"body2"},E)):null,k&&(null==r?void 0:r.length)?e.createElement(K,{className:L.flexCenter+" "+L.pagination,count:q,page:U+1,onChange:oe,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Vt=c((function(e){return{container:{display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid "+e.palette.grey[600],borderRadius:"8px",width:"100%",maxWidth:"20rem",marginInline:"auto",color:e.palette.grey[600],"&:hover":{borderColor:e.palette.grey[800],color:e.palette.grey[800]},"&:focus-within":{borderColor:e.palette.grey[800],color:e.palette.grey[800]}},input:he({width:"100%",maxWidth:"18rem",color:"inherit"},e.typography.body2)}})),Ut=t((function(t){var n=t.preGlobalFilteredRows,a=t.globalFilter,o=t.setGlobalFilter,i=r(a),l=i[0],d=i[1],c=he(he({},Ie()),Vt()),s=ge((function(e){o(e||void 0)}),200),u=n.length;return e.createElement("div",{className:c.container+" "+c.contentBreak},e.createElement(re,{className:c.rightSpacer1+" "+c.leftSpacer1}),e.createElement(L,{className:""+c.input,value:l||"",onChange:function(e){d(e.target.value),s(e.target.value)},placeholder:"Search "+u+" records...",inputProps:{"aria-label":"search"}}))})),Yt=t((function(t){var r=t.disabled,n=t.includeRowSelect,a=t.getTableProps,o=t.headerGroups,i=t.getTableBodyProps,l=t.rowsToRender,d=t.prepareRow,c=t.paddingTop,s=t.paddingBottom,u=t.virtualRows,m=t.isAllRowsSelected,p=t.selectedFlatRows;return e.createElement(b,he({},a(),{style:{borderCollapse:"collapse"}}),e.createElement(Jt,{headerGroups:o,includeRowSelect:n,isAllRowsSelected:m}),e.createElement(y,he({},i()),c>0&&e.createElement("tr",null,e.createElement("td",{style:{height:c+"px"}})),e.createElement(qt,he({},{disabled:r,includeRowSelect:n,rowsToRender:l,prepareRow:d,virtualRows:u,selectedFlatRows:p})),s>0&&e.createElement("tr",null,e.createElement("td",{style:{height:s+"px"}}))))})),Jt=t((function(t){var r=t.headerGroups,n=t.includeRowSelect;t.isAllRowsSelected;var a=Mt();return e.createElement(v,{className:a.offsetStickyPosition+" "+a.stickyHeaderZIndex+" "+a.headerBorders},r.map((function(t){return e.createElement(h,he({},t.getHeaderGroupProps()),t.headers.map((function(t,r){var o;return e.createElement(x,he({},t.getHeaderProps(),{align:t.textAlign||"center",padding:n&&0===r?"checkbox":"normal",className:a.headerCellColour+"\n "+(t.shadedHeaderGroup?t.columns?a.shadedHeaderGroupParent+" shadedHeaderGroupParent":t.parent?a.shadedHeaderGroup2Children+" shadedHeaderGroup2Children":"":"")+" "+(t.shadedHeader?a.shadedHeader+" shadedHeader":"")+"\n "+(t.stickyCell||(null===(o=t.placeholderOf)||void 0===o?void 0:o.stickyCell)?a.offsetStickyPosition+" "+a.stickyHeaderZIndex:"")}),t.render("Header"))})))})))})),qt=t((function(t){var r=t.rowsToRender,n=t.virtualRows,a=t.prepareRow,o=ve(t,["rowsToRender","virtualRows","prepareRow"]),i=he(he({},Mt()),Fe());return e.createElement(e.Fragment,null,n.map((function(t){var n=r[t.index];return a(n),e.createElement(d,{key:n.original.rowKey||n.getRowProps().key},n.original.disabledRow?e.createElement(z,{title:n.original.tooltipText||"This row is disabled",arrow:!0},e.createElement(jt,he({},he(he({},o),{row:n,classes:i})))):e.createElement(jt,he({},he(he({},o),{row:n,classes:i}))))})))})),Xt=c((function(e){return{alertStyling:{borderRadius:"14px"},closeButton:{color:e.palette.text.secondary,marginRight:e.spacing(2)},showCursor:{cursor:"pointer"}}})),Zt=function(t){var r=t.alertActionHandler,n=t.formStatus,a=t.actionButton,o=t.alertMessage,i=t.addBreak,l=void 0===i||i,d=t.styling,c=he(he({},Ie()),Xt());return e.createElement(N,{in:[Ce,Ee,Be].includes(n)},e.createElement(V,{onClick:r,className:c.alertStyling+" "+(l?c.sectionBreak:"")+" "+(d||"")+" "+(r?c.showCursor:""),severity:n===Ee?Ee:n===Ce?Ce:Be,action:a?e.createElement(s,{className:c.closeButton,"aria-label":"close",color:"inherit",size:"small",onClick:function(e){e.stopPropagation(),a.handler()}},a.text):null},o))},Qt=c((function(e){return{greyBox:{backgroundColor:e.palette.grey[200],display:"flex",justifyContent:"center",alignItems:"center",padding:"1.5rem",borderRadius:"14px",position:"relative",height:"13.25rem"},widthLimiter:{width:"100%",maxWidth:"28rem",marginLeft:"auto",marginRight:"auto"},hiddenInput:{display:"none"},buttonColor:{backgroundColor:e.palette.primary.main},iconStyling:{color:e.palette.common.white,fontSize:"3rem"},sectionBreak:{marginBottom:e.spacing(3)},dropBox:{height:"100%",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"},dropArrowStyling:{color:e.palette.text.secondary,fontSize:"3rem"},topLeftArrow:{position:"absolute",top:0,left:0,transform:"rotate(45deg)"},topRightArrow:{position:"absolute",top:0,right:0,transform:"rotate(135deg)"},bottomLeftArrow:{position:"absolute",bottom:0,left:0,transform:"rotate(-45deg)"},bottomRightArrow:{position:"absolute",bottom:0,right:0,transform:"rotate(225deg)"},hiddenDisplay:{display:"none"},loadingCircle:{marginLeft:e.spacing(1)},roundedAvatarButton:{borderRadius:"100%"},roundedAvatar:{width:"16vmax",height:"16vmax",maxWidth:"13rem",maxHeight:"13rem"},organisationImage:{maxWidth:"8rem",minWidth:"5rem",maxHeight:"8rem"}}})),$t=function(t){var n=t.id,a=void 0===n?"image-upload":n,i=t.url,l=t.roundedAvatar,d=void 0!==l&&l,c=t.handleSaveImage,g=t.alt,f=t.accessLevel,h=he(he({},Qt()),Ie()),v=r(!!i),b=v[0],y=v[1],x=r("enabled"),C=x[0],E=x[1],w=r(null),k=w[0],B=w[1];if(o((function(){i&&y(!0)}),[i]),f===Re)return null;var S=!1;f===Ne&&(S=!0);var N,R=function(e,t){return be(void 0,void 0,void 0,(function(){var r,n;return ye(this,(function(a){switch(a.label){case 0:return S?[2]:(B(null),"input"!==e?[3,4]:(r=t.target).files&&r.files[0]?[4,T(r.files[0])]:[3,2]);case 1:return a.sent(),[3,3];case 2:E(Ee),y(!!i),a.label=3;case 3:return[3,7];case 4:return"dragDrop"!==e?[3,7]:(n=t.dataTransfer).files&&n.files[0]?[4,T(n.files[0])]:[3,6];case 5:return a.sent(),[3,7];case 6:E(Ee),y(!!i),a.label=7;case 7:return[2]}}))}))},T=function(e){return be(void 0,void 0,void 0,(function(){var t,r,n;return ye(this,(function(a){switch(a.label){case 0:return E("loading"),e.size>=524288?(B("Image size should be less than 0.5MB"),E(Ee),y(!!i),[2]):(t=e.name.split(".")[1].toLowerCase(),["png","jpg","jpeg"].includes(t)?[4,e.arrayBuffer()]:(B("Please provide an image in png, jpg or jpeg format"),E(Ee),y(!!i),[2]));case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,c(t,r,e)];case 3:return a.sent(),E(Ce),y(!0),[3,5];case 4:return n=a.sent(),console.log(n),E(Ee),y(!!i),[3,5];case 5:return[2]}}))}))};switch(C){case"dragEnter":N=e.createElement(p,{className:h.dropBox,style:{pointerEvents:"none"}},e.createElement($,{className:h.dropArrowStyling+" "+h.topLeftArrow}),e.createElement($,{className:h.dropArrowStyling+" "+h.topRightArrow}),e.createElement(m,{variant:"h5",color:"textSecondary"},"Drop Here"),e.createElement($,{className:h.dropArrowStyling+" "+h.bottomLeftArrow}),e.createElement($,{className:h.dropArrowStyling+" "+h.bottomRightArrow}));break;case"loading":N=e.createElement(p,{className:h.dropBox},e.createElement(m,{color:"textSecondary"},"Loading..."),e.createElement(u,{className:h.loadingCircle,size:25}));break;default:N=e.createElement("label",{htmlFor:a},e.createElement(I,{className:h.buttonColor+" "+h.sectionBreak,"aria-label":"upload picture",component:"span"},e.createElement(Q,{className:h.iconStyling})),e.createElement(m,{variant:"body2",color:"textSecondary"},"Drag and drop or browse to upload your image or logo."))}return e.createElement(p,{className:h.labelBreak,onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),y(!1))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),y(!1))}},b&&e.createElement(p,{className:h.labelBreak},e.createElement("label",{htmlFor:a},e.createElement(s,{className:""+(d?h.roundedAvatarButton:""),"aria-label":"upload picture",component:"span"},d?e.createElement(j,{className:h.roundedAvatar,src:i,alt:g||"Profile Avatar"}):e.createElement("img",{className:h.organisationImage,src:i,alt:g||"Company Logo"})))),e.createElement(p,{className:h.greyBox+" "+h.widthLimiter+" "+h.sectionBreak+" "+(b?h.hiddenDisplay:""),onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),E("dragEnter"))},onDragLeave:function(e){S||(e.preventDefault(),e.stopPropagation(),E("enabled"),y(!!i))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),E("dragEnter"))},onDrop:function(e){S||(e.preventDefault(),e.stopPropagation(),R("dragDrop",e))}},e.createElement("input",{id:a,className:h.hiddenInput,type:"file",accept:".png, .jpg, .jpeg",disabled:S,onChange:function(e){return R("input",e)}}),N),e.createElement(p,{className:h.widthLimiter},e.createElement(Zt,{formStatus:C,alertMessage:k||(C===Ce?"Uploaded successfully!":"Something went wrong.")})))},_t=c((function(e){var t,r;return{container:(t={minWidth:"4.5rem",height:"100%",background:"linear-gradient(180deg, #B3D6EC 0%, #B3D6EC 40%, #E97FAB 100%)",display:"flex",flexDirection:"column",overflowY:"auto",borderTopRightRadius:"1rem",borderBottomRightRadius:"1rem",border:"solid 2px rgb(188, 172, 242)",borderLeft:"none",boxSize:"border-box"},t[e.breakpoints.down("sm")]={flexDirection:"row",justifyContent:"center",background:"linear-gradient(90deg, #B3D6EC 0%, #B3D6EC 40%, #E97FAB 100%)",borderRadius:0,borderTopLeftRadius:"1rem",borderTopRightRadius:"1rem",width:"100dvw",margin:"auto",border:"solid 2px rgb(188, 172, 242)",borderBottom:"none",overflowY:"hidden",overflowX:"scroll"},t),item:(r={position:"relative",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"black",textDecoration:"none",fontSize:"0.725rem",padding:"0.75rem 0.5rem",gap:"0.25rem",backgroundColor:"transparent",transition:"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"},"&::after":{content:'" "',position:"absolute",top:"15%",bottom:"15%",right:0,width:3,zIndex:1,transition:"background-color 80ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"}},r[e.breakpoints.down("sm")]={padding:"0.5rem 1.0rem","&::after":{top:0,left:"15%",right:"15%",bottom:"auto",height:4,width:"auto"}},r),itemActive:{"&::after":{backgroundColor:"rgb(188, 172, 242)"}},separateItem:{marginTop:"auto"}}})),er=function(t){var r=t.tabs,n=_t(),a=Y();return e.createElement("div",{className:n.container},r.map((function(t){var r=t.Icon,o=t.field,i=t.path,l=t.separate,d=void 0!==l&&l;return e.createElement(U,{key:i,to:i,className:[n.item,d?n.separateItem:null,a.pathname===i?n.itemActive:null].filter(Boolean).join(" ")},e.createElement(e.Fragment,null,e.createElement(r,null),o))})))},tr=c((function(e){var t;return{tablessGrid:{},grid:function(t){var r,n=t.hideTabs,a=t.leaveHeightForMenu;return n?{}:((r={display:"grid",gridTemplateRows:"auto 1fr",gridTemplateColumns:"auto 1fr",height:a?"calc(100dvh - 4rem)":"100dvh",boxSize:"border-box"})[e.breakpoints.down("sm")]={gridTemplateColumns:"1fr",gridTemplateRows:"1fr auto"},r)},tabs:(t={height:function(e){return e.leaveHeightForMenu?"calc(100dvh - 4rem)":"100dvh"}},t[e.breakpoints.down("sm")]={order:1,height:"max-content !important"},t),content:{padding:"1rem",boxSizing:"border-box",height:"100%",overflowY:"scroll"}}})),rr=function(t){var r=t.tabs,n=t.hideTabs,a=void 0!==n&&n,o=t.leaveHeightForMenu,i=void 0===o||o,l=t.children,d=tr({hideTabs:a,leaveHeightForMenu:i});return e.createElement("div",{className:""+d.grid},e.createElement("div",{className:d.tabs},e.createElement(er,{tabs:r})),e.createElement("div",{className:d.content},e.createElement(T,{disableGutters:!0},e.createElement(e.Fragment,null,l))))};export{Zt as Alert,gt as AlphabeticalList,Je as Breadcrumbs,Ae as Button,Bt as ButtonWithConfirm,We as ContentBox,Pe as ContentLabel,Et as DatePicker,Kt as EditableTable,Xe as EntityList,Ze as ErrorIndicator,Se as FORM_DELETING,ke as FORM_ENABLED,Ee as FORM_ERROR,we as FORM_LOADING,Ce as FORM_SUCCESS,Be as FORM_WARNING,$t as ImageDisplayAndUpload,wt as KeyboardDatePicker,lt as LeftNavigation,De as LoadingSpinner,ct as MainLayout,rr as NavbarLayout,Dt as NonEditableField,yt as NumberFormatField,ht as SearchBar,Ct as Select,Ue as StaticTable,Lt as TableDatePicker,Ot as TableMultipleSelect,Ht as TableSelect,Rt as TableTextField,bt as TextField,tt as didCellValueChange,Wt as tableCheckbox,At as tableDateField,It as tableNumericStringField,Tt as tableNumericStringFixedDecimalField,st as useDebounceEffect,ut as useInterval,mt as useWhyDidYouUpdate};
2
2
  //# sourceMappingURL=index.js.map