@oc-digital/react-component-library 2.0.7-beta.0 → 2.0.7-beta.2

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,{useState as t,useMemo as r,useCallback as n,useEffect as a,useRef as o,memo as i,Fragment as l}from"react";import{makeStyles as c,Button as s,CircularProgress as d,Typography as m,Box as u,withStyles as p,createStyles as g,TableRow as f,Table as h,TableHead as v,TableBody as b,TableCell as y,Link as x,ButtonBase as E,Grid as w,ListItem as C,ListItemIcon as N,ListItemText as k,Collapse as S,List as B,IconButton as R,Container as I,Divider as T,InputBase as L,InputAdornment as F,TextField as A,MenuItem as W,Checkbox as P,FormControl as D,Select as O,FormHelperText as M,Tooltip as j,Avatar as z}from"@material-ui/core";import{string as H}from"yup";import{Pagination as G,Alert as K}from"@material-ui/lab";import{Link as V,useLocation as U,useHistory as J}from"react-router-dom";import q from"@material-ui/icons/Error";import{ExpandLess as Y,ExpandMore as X,CloudUpload as Q,Forward as $}from"@material-ui/icons";import{isValid as Z}from"date-fns";import _ from"@material-ui/icons/Close";import ee from"@material-ui/icons/AddBoxOutlined";import te from"@material-ui/icons/Search";import{isEqual as re}from"lodash";import ne from"react-number-format";import{MuiPickersUtilsProvider as ae,DatePicker as oe,KeyboardDatePicker as ie}from"@material-ui/pickers";import le from"@date-io/date-fns";import{useTable as ce,useFilters as se,useGlobalFilter as de,usePagination as me,useRowSelect as ue,useAsyncDebounce as pe}from"react-table";import{useVirtual as ge}from"react-virtual";var fe=function(){return fe=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},fe.apply(this,arguments)};function he(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 ve(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function l(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((n=n.apply(e,t||[])).next())}))}function be(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(c){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,c])}}}function ye(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))}H().trim().required("Required"),H().trim().required("Required").matches(/^\d*\.?\d*$/,"Must be a Number");var xe="success",Ee="error",we="warning",Ce="read",Ne="noAccess",ke=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}),Se=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"}),Be=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}),Re=c((function(e){return{submitButton:{borderRadius:"1.5rem",padding:"0.4rem 1rem",textTransform:"none"},containedText:{color:"white"},spinnerColour:{color:e.palette.grey[500]}}})),Ie=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,c=void 0===l?"submit":l,m=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=he(t,["loading","children","errors","type","onClick","disabled","variant","styling","color","accessLevel"]),C=fe(fe({},ke()),Re());if([Ne,Ce].includes(E))return null;var N=p;return p||!n&&!i||(N=!0),e.createElement(s,fe({},w,{variant:f,color:y,type:c,className:C.submitButton+" "+("contained"===f&&C.containedText)+" "+v,disabled:N,onClick:m}),a,n?e.createElement(d,{className:C.leftSpacer1+" "+C.spinnerColour,size:"1.1rem",thickness:6}):"")},Te=function(t){var r=t.children,n=t.styling,a=void 0===n?null:n,o=Se();return e.createElement(m,{variant:"h6",className:o.bolderText+" "+(a||"")},r)},Le=function(t){var r=t.limitWidth,n=void 0!==r&&r,a=t.children,o=t.styling,i=fe(fe({},ke()),Be());return e.createElement(u,{boxShadow:3,className:i.contentBox+" "+(o||"")},e.createElement(u,{className:i.centeredText+" "+(n?i.limitWidth50rem:"")},a))},Fe=function(t){var r=t.text,n=void 0===r?"Loading data...":r,a=t.styling,o=fe(fe({},ke()),Be());return e.createElement(u,{className:o.flexCenter+" "+(a||"")},e.createElement(m,{variant:"body2",color:"textSecondary",className:o.rightSpacer1},n),e.createElement(d,{size:"1.5rem"}))},Ae=p(g({root:{"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(f),We=p(g({root:{"&:nth-of-type(even) td":{backgroundColor:"rgba(0, 0, 0, 0.03)"},"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(f),Pe=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)")}}}}})),De=function(t){var r=t.children,n=t.align,a=void 0===n?"centerJustify":n,o=t.headerColours,i=he(t,["children","align","headerColours"]),l=fe(fe({},Be()),Pe(fe({},o||{})));return e.createElement(y,fe({},i,{classes:{root:l.root,head:l.head}}),e.createElement(u,{className:l.flexCenter+" "+l[a]},r))},Oe=function(t){var r=t.rowBorderSeparation,n=void 0!==r&&r,a=t.children,o=he(t,["rowBorderSeparation","children"]);return n?e.createElement(Ae,fe({},o),a):e.createElement(We,fe({},o),a)},Me=function(t){var r=t.colSpan,n=t.children,a=je();return e.createElement(Oe,null,e.createElement(De,{className:a.adjustedCellPadding,colSpan:r},n))},je=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"}}),ze=function(o){var i=o.rowBorderSeparation,l=void 0!==i&&i,c=o.headers,s=o.rows,d=o.headerCellAlignment,m=void 0===d?[]:d,u=o.rowCellAlignment,p=void 0===u?[]:u,g=o.styling,y=o.headerColours,x=o.paginate,E=void 0!==x&&x,w=o.itemsPerPage,C=void 0===w?30:w,N=fe(fe(fe({},Be()),ke()),je()),k=t(1),S=k[0],B=k[1],R=r((function(){return!!(E&&((null==s?void 0:s.length)||0)>C)}),[C,E,s]),I=t(R?s.slice(0,C):s),T=I[0],L=I[1],F=n((function(e,t){B(t)}),[]);return a((function(){L(R?s.slice(C*(S-1),C*S):s)}),[R,C,S,s]),e.createElement(e.Fragment,null,e.createElement(h,{className:N.tableStyles+" "+(R?N.contentBreak:"")+" "+(g||"")},c?e.createElement(v,null,e.createElement(f,null,c.map((function(t,r){return e.createElement(De,{align:m[r]||"centerJustify",key:"header-cell-"+r,headerColours:y},t)})))):null,e.createElement(b,null,T?T.length?T.map((function(t,r){var n=!!t.onClick;return e.createElement(Oe,{rowBorderSeparation:l,className:n?N.pointer:void 0,key:"row-"+r,onClick:n?t.onClick:void 0},t.row.map((function(t,n){return e.createElement(De,{align:p[n]||"centerJustify",className:l&&T.length!==r+1?N.bottomBorder:void 0,key:"row-"+r+"-cell-"+n},t)})))})):e.createElement(Me,{colSpan:(null==c?void 0:c.length)||0},"Table is empty"):e.createElement(Me,{colSpan:(null==c?void 0:c.length)||0},e.createElement(Fe,null)))),R?e.createElement(G,{className:N.flexCenter,count:Math.ceil(s.length/C),page:S,onChange:F,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)},He=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%"}}})),Ge=function(t){var r=t.logo,n=t.content,a=t.colors,o=He(fe({},a||{})),i=n.first,l=void 0===i?null:i,c=n.second,s=void 0===c?null:c,d=n.third,p=void 0===d?null:d;return e.createElement(u,{className:o.BreadcrumbsContainer+" "+o.flexItemsCenter},e.createElement(u,{className:(l?o.primaryBreadcrumbItem+" "+o.breadCrumbShadow:"")+" "+o.flexItemsCenter},e.createElement(x,{component:V,to:"/",className:o.logoSpacing},e.createElement(u,{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(x,{underline:"none",component:V,to:l.link,color:"inherit",className:o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},l.name))),s&&e.createElement(u,{className:o.flexItemsCenter+" "+o.secondaryBreadcrumbItem+" "+o.breadCrumbShadow+" "+(p?"":o.activeBreadcrumb)},e.createElement(m,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(x,{component:V,underline:"none",to:s.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},s.name))),p&&e.createElement(u,{className:o.flexItemsCenter+" "+o.tertiaryBreadcrumbItem+" "+o.breadCrumbShadow},e.createElement(m,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(x,{component:V,underline:"none",to:p.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},p.name))))},Ke=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}}})),Ve=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,c=t.onClick,d=fe(fe(fe({},Ke()),ke()),Se());return e.createElement(u,{className:d.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,fe({className:d.button,key:t.name},c?{onClick:function(){return c(t)}}:{component:V,to:t.link}),e.createElement(u,{className:d.svgContainer+" "+d.labelBreak},n(t)),e.createElement(m,{className:d.orgLabel,variant:"body1"},t.name)))}))):e.createElement(m,{className:d.centerText,variant:"body2",color:"textSecondary"},l):e.createElement(Fe,{text:o}))},Ue=function(t){var r=t.text,n=void 0===r?"Something went wrong":r,a=fe(fe({},ke()),Be());return e.createElement(u,{className:a.flexCenter},e.createElement(q,{fontSize:"medium",className:a.rightSpacer1,color:"error"}),e.createElement(m,{variant:"body2",color:"textSecondary"},n))},Je=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"}}})),qe=function(e,t){return!!e.split("/").includes(t)},Ye=function(r){var n,a,o=r.mainItem,i=r.subItems,l=r.config,c=r.Icon,s=fe(fe(fe({},Se()),ke()),Je(fe(fe({},(null===(n=l.secondary)||void 0===n?void 0:n.mainItemColors)||{}),(null===(a=l.secondary)||void 0===a?void 0:a.subItemColors)||{}))),d=U(),p=qe(d.pathname,o.id),g=t(!!(null==i?void 0:i.length)&&p),f=g[0],h=g[1];return e.createElement(e.Fragment,null,e.createElement(C,{button:!0,dense:!0,className:s.mainListItem,component:V,to:o.route},e.createElement(N,{className:s.listIcon+" "+s.mainIconMarginAdjustment+" "+s.rightSpacer1},e.createElement(c,{id:"second-nav-item",styling:s.mainIconSize+" "+s.mainIconColor+" "+(p?s.activeMainIconColor:"")})),e.createElement(k,{disableTypography:!0,className:s.noYMargin,primary:e.createElement(m,{variant:"body2",className:s.bolderText+" "+s.textOverflowElipsis,color:"inherit"},o.name,(null==i?void 0:i.length)?e.createElement(m,{component:"span",variant:"body2",className:s.bolderText,color:"inherit"}," ","(",i.length,")"):null)}),(null==i?void 0:i.length)?e.createElement(N,{className:s.listIcon,onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(e){return!e}))}},f?e.createElement(Y,null):e.createElement(X,null)):null),(null==i?void 0:i.length)?e.createElement(S,{in:f,timeout:"auto",unmountOnExit:!0},e.createElement(B,{component:"div",disablePadding:!0},i.map((function(t){var r=t.name,n=t.route,a=t.id;return e.createElement(u,{key:a,className:s.subItemWrapper},e.createElement(u,{className:s.relativeWrapper+" "+s.rightSpacer1},e.createElement(u,{className:s.subItemBorder+" "}),e.createElement(u,{className:s.subItemBorderMask+" "+(qe(d.pathname,a)?s.activeSubItemBorder:"")+" "})),e.createElement(C,{key:n,component:V,to:n,button:!0,dense:!0,className:s.subListItem+" "+(qe(d.pathname,a)?s.activeSubListItem:"")},e.createElement(k,{disableTypography:!0,primary:e.createElement(m,{variant:"body2",className:s.textOverflowElipsis,color:"inherit"},r)})))})))):null)};function Xe(e){return e.sort((function(e,t){return+t.startDate.split("T")[0].replaceAll("-","")-+e.startDate.split("T")[0].replaceAll("-","")}))}var Qe=function(e,t,r){return r?(e&&Z(e)?e:new Date(0)).getTime()===(t&&Z(t)?t:new Date(0)).getTime():e===t},$e=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)}}})),Ze=function(t){var r,n,a,o,i=t.secondaryNavItems,l=t.primaryNavItems,c=t.expandedOptions,s=t.setExpandedOptions,d=t.config,p={titleColor:null===(r=d.secondary)||void 0===r?void 0:r.titleColor,titleIconColor:null===(n=d.secondary)||void 0===n?void 0:n.titleIconColor},g=fe(fe(fe({},ke()),Se()),$e(p)),f=J(),h=i[c.view];if(!h)return null;var v=l.find((function(e){return e.field===c.view})).Icon;return e.createElement(u,{className:g.secondaryNavWrapper},e.createElement(u,{className:g.titleWrapper},e.createElement(m,{className:g.rightSpacer1+" "+g.title},c.view),h.button?e.createElement(R,{className:g.titleIcons,size:"small",type:"button",onClick:function(){return f.push(h.button.url)}},e.createElement(ee,null)):null,e.createElement(R,{className:g.titleIcons+" "+g.closeButton,size:"small",type:"button",onClick:function(){return s({view:"",expanded:!1})}},(null===(a=d.secondary)||void 0===a?void 0:a.closeButtonSvg)||e.createElement(_,null))),e.createElement(B,{className:g.listWrapper,component:"div"},Xe(h.items).map((function(t){return e.createElement(Ye,fe({key:t.mainItem.route},t,{config:d,Icon:v}))})),(null===(o=h.archivedItems)||void 0===o?void 0:o.length)?e.createElement(e.Fragment,null,e.createElement(u,{className:g.archivedBorder+" "+g.contentBreak}),e.createElement(m,{variant:"body2",className:g.archivedSeparator+" "+g.bolderText},"Archived ",c.view),Xe(h.archivedItems).map((function(t){return e.createElement(Ye,fe({key:t.mainItem.route},t,{config:d,Icon:v}))}))):null))},_e=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"}}})),et=function(t){var r=t.expandedOptions,n=t.setExpandedOptions,a=t.navigationLinks,o=t.config,i=U(),l=_e(fe({},o.primary||{})),c=function(e,t){return""===r.view?i.pathname===t||!(e===o.rootRouteName||!i.pathname.startsWith(t)):r.view===e};return e.createElement(B,{className:l.primaryNavContainer+" "+l.listWrapper},a.map((function(t,r,a){var i;return e.createElement(C,fe({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:V,to:t.path},{onClick:function(){n({view:t.field,expanded:!!t.hasSecondary})}}),e.createElement(N,{className:l.iconWrapper},e.createElement(t.Icon,{styling:l.textColour+" "+(c(t.field,t.path)?l.activeTextColour:"")})),e.createElement(m,{variant:"caption",className:l.itemName+" "+l.textColour+" "+(c(t.field,t.path)?l.activeTextColour:"")},t.field),e.createElement(u,{className:l.itemBorder+" "+(c(t.field,t.path)?l.activeBorder:"")}))})))},tt=c({leftNavContainer:{height:"100%",display:"flex",position:"relative",width:"max-content"}}),rt=function(r){var n=r.primaryNavItems,o=r.secondaryNavItems,i=r.config,l=t({view:"",expanded:!1}),c=l[0],s=l[1],d=tt(),m=U(),p=n.reduce((function(e,t){return t.hasSecondary?ye(ye([],e,!0),[t.field],!1):e}),[]);return a((function(){s((function(e){return p.includes(e.view)&&!0===e.expanded?e:{view:"",expanded:!1}}))}),[m.pathname]),e.createElement(u,{component:"nav",className:d.leftNavContainer},e.createElement(et,{expandedOptions:c,setExpandedOptions:s,navigationLinks:n,config:i}),c.expanded&&e.createElement(Ze,{secondaryNavItems:o,primaryNavItems:n,expandedOptions:c,setExpandedOptions:s,config:i}))},nt=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"}}})),at=function(t){var r=t.sideNavigation,n=t.children,a=t.desktopWidth,o=t.topOffset,i=nt({topOffset:o});return e.createElement(u,{className:i.remainingHeightBox},r?e.createElement(u,{className:i.fullHeightFlexbox+" "+i.relativeContainer},r):null,e.createElement(I,{disableGutters:!0,maxWidth:!1,className:i.scrollWrapper},e.createElement(I,{disableGutters:!0,maxWidth:a?"xl":"lg",className:i.componentWrapper},n)))},ot=function(e,t,r){void 0===r&&(r=250);var o=n(e,t);a((function(){var e=setTimeout(o,r);return function(){return clearTimeout(e)}}),[o,r])},it=function(e,t){var r=o();a((function(){r.current=e})),a((function(){if(null!==t){var e=setInterval((function(){r.current&&r.current()}),t);return function(){return clearInterval(e)}}}),[t])};function lt(e,t){var r=o(t);a((function(){var n=Object.keys(fe(fe({},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:re(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 ct=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"}}})),st=function(t){var r=t.array,n=t.sortFn,a=t.sortKey,o=void 0===a?"name":a,i=t.buttonClick,l=t.linkTo,c=t.ItemTemplate,s=t.arrayKey,d=void 0===s?"id":s,u=t.loadingMessage,p=void 0===u?"Loading list...":u,g=t.emptyMessage,f=void 0===g?"List is empty":g,h=t.alphabetisedHeader,v=void 0===h||h,b=fe(fe(fe({},ct()),ke()),Be());if(void 0===r)return e.createElement(Fe,{styling:b.topMargin,text:p});if(!(null==r?void 0:r.length))return e.createElement(m,{className:b.topMargin,align:"center",variant:"body2",color:"textSecondary"},f);var y=n?ye([],r,!0).sort(n):r,x="";return e.createElement(B,{className:b.limitWidth50rem},y.map((function(t,r){var n,a=!1;if(v){var s=((null===(n=t[o])||void 0===n?void 0:n[0])||"???").toLowerCase();s!==x&&(x=s,a=!0)}return e.createElement(e.Fragment,{key:t[d]||"alphabetical-list-"+r},v&&a?e.createElement(e.Fragment,null,e.createElement(m,{className:""+b.letterHeader,align:"left"},x.toUpperCase()),e.createElement(T,{className:b.contentBreak+" "+b.divider})):null,e.createElement(C,fe({className:b.listItem,alignItems:"flex-start",button:!(!i&&!l)||void 0,onClick:i?function(){return i(t)}:void 0},l&&!i?{component:V,to:l(t)}:{}),e.createElement(c,{item:t})))})))},dt=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]}}})),mt=function(r){var n=r.array,o=r.sortFn,i=r.sortKey,l=void 0===i?"name":i,c=r.buttonClick,s=r.linkTo,d=r.ItemTemplate,m=r.arrayKey,p=void 0===m?"id":m,g=r.loadingMessage,f=void 0===g?"Loading list...":g,h=r.emptyMessage,v=void 0===h?"List is empty":h,b=r.inputBackgroundColor,y=r.placeholder,x=r.disabledSearch,E=r.delay,w=void 0===E?500:E,C=r.minQueryLength,N=void 0===C?3:C,k=r.handleOnChange,S=r.searchKeys,B=void 0===S?["name"]:S,R=r.alphabetisedHeader,I=void 0===R||R,T=fe(fe(fe({},ke()),Be()),dt({background:b})),A=t(""),W=A[0],P=A[1],D=t(!1),O=D[0],M=D[1],j=t(n),z=j[0],H=j[1];return ot((function(){!O&&W.length>=N&&(k?k(W):H(null==n?void 0:n.filter((function(e){var t=B.some((function(t){var r;return null===(r=e[t])||void 0===r?void 0:r.toLowerCase().includes(W.toLowerCase())}));return t}))))}),[W],w),a((function(){H(n)}),[n]),e.createElement(e.Fragment,null,e.createElement(u,{className:T.searchBox+" "+T.limitWidth50rem},e.createElement(L,{disabled:x,type:"text",value:W,placeholder:y||"Enter to search",onChange:function(e){O&&M(!1),P(e.target.value)},className:T.searchField,endAdornment:e.createElement(F,{position:"end",className:T.rightSpacer2},e.createElement(te,{className:T.searchIcon}))})),null!==n&&e.createElement(st,{array:z,sortFn:o,sortKey:l,buttonClick:c,linkTo:s,ItemTemplate:d,arrayKey:p,loadingMessage:f,emptyMessage:v,alphabetisedHeader:I}))},ut=c((function(e){return{inputField:function(t){var r=t.size;return fe({borderRadius:"14px"},"small"===r?e.typography.body2:{})},labelStyles:function(t){var r=t.size;return fe({},"small"===r?fe(fe({transform:"translate(14px, 9px) scale(1) !important"},e.typography.body2),{"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:"translate(15px, -9px) scale(0.75) !important"}}):{})}}})),pt=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,c=t.InputProps,s=void 0===c?{}:c,d=t.accessLevel,m=t.disabled,u=t.fixedDecimalScale,p=he(t,["size","styling","numberField","inputProps","InputProps","accessLevel","disabled","fixedDecimalScale"]),g=ut({size:n});if(d===Ne)return null;var f=m;d===Ce&&(f=!0);var h=fe({},o&&{fixedDecimalScale:!!u});return e.createElement(A,fe({className:a||"",disabled:f},p,{inputProps:fe(fe({},l),h),InputProps:fe(fe({},s),{className:g.inputField,inputComponent:o?gt:void 0}),InputLabelProps:{className:g.labelStyles},variant:"outlined",size:n}))},gt=function(t){var r=t.inputRef,n=t.onChange,a=he(t,["inputRef","onChange"]);return e.createElement(ne,fe({},a,{getInputRef:r,onValueChange:function(e){n({target:{name:t.name||"",value:e.value}})},thousandSeparator:!0,decimalScale:2,isNumericString:!0}))},ft=c((function(e){return{listItem:function(t){var r=t.background,n=t.size;return fe(fe({overflow:"auto",scrollbarWidth:"thin"},"small"===n?e.typography.body2:{}),{"&:hover":{backgroundColor:r+" !important"}})},inputStyles:function(t){var r=t.background,n=t.size;return fe(fe({borderRadius:"14px !important"},"small"===n?fe({paddingTop:"9.5px",paddingBottom:"8.5px"},e.typography.body2):{}),{"&:focus":{backgroundColor:r}})},selectedListItem:function(e){return{"&:focus":{background:e.background+" !important"}}}}})),ht=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,c=t.disabled,s=t.accessLevel,d=he(t,["selectOptions","background","size","styling","disabled","accessLevel"]),m=ft({background:a,size:i});if(s===Ne)return null;var u=c;return s===Ce&&(u=!0),e.createElement(pt,fe({className:l||""},d,{disabled:u,size:i,SelectProps:{inputProps:{className:m.inputStyles}},select:!0}),r.map((function(t){return e.createElement(W,{key:t.value,value:t.value,className:m.listItem,classes:{selected:m.selectedListItem}},t.description)})))},vt=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,c=t.disabled,s=he(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Ne)return null;var d=c;return l===Ce&&(d=!0),e.createElement(ae,{utils:le},e.createElement(oe,fe({className:r||""},s,{disabled:d,inputVariant:"outlined",autoOk:!0,format:a,minDate:i,TextFieldComponent:pt})))},bt=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,c=t.disabled,s=he(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Ne)return null;var d=c;return l===Ce&&(d=!0),e.createElement(ae,{utils:le},e.createElement(ie,fe({className:r||""},s,{disabled:d,inputVariant:"outlined",autoOk:!0,allowKeyboardControl:!0,format:a,minDate:i,TextFieldComponent:pt})))},yt=c((function(e){return{confirmWrapper:{display:"inline-block"},confirmContainer:{display:"flex",alignItems:"center"},whiteText:{color:e.palette.common.white}}})),xt=function(r){var n=r.children,o=r.onClick,i=r.styling,l=r.disabled,c=void 0!==l&&l,s=r.variant,d=void 0===s?"outlined":s,p=r.color,g=void 0===p?"primary":p,f=r.accessLevel,h=void 0===f?"":f,v=he(r,["children","onClick","styling","disabled","variant","color","accessLevel"]),b=fe(fe({},ke()),yt()),y=t(!1),x=y[0],E=y[1],w=t(!1),C=w[0],N=w[1];return it((function(){return E(!1)}),!x||C?null:4500),a((function(){N(v.loading),E(v.loading)}),[v.loading]),[Ne,Ce].includes(h)?null:x?e.createElement(u,{className:b.confirmWrapper},e.createElement(u,{className:b.confirmContainer},e.createElement(m,{className:b.rightSpacer1,variant:"body1"},"Are you sure?"),e.createElement(Ie,fe({},v,{type:"button",onClick:function(e){N(!0),o(e)},variant:"contained",styling:b.whiteText,disabled:c,color:g}),"Confirm",v.loading?"ing":""))):e.createElement(Ie,{type:"button",variant:d,disabled:c,styling:i,color:g,onClick:function(){return E(!0)}},n)},Et=function(e,t){var r=e.toString().length;return r?r+(t?3:1)+Math.floor(r/3)/3+"ch":"6ch"},wt=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:fe({},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"}}}})),Ct=function(t){var r=t.error,n=t.disabled,a=t.value,o=t.onBlur,i=t.onChange,l=t.prefix,c=t.suffix,s=t.numberField,d=void 0!==s&&s,u=t.textAlign,p=t.fixedDecimalScale,g=wt({textAlign:u}),f=fe({},d&&{fixedDecimalScale:!!p});return"string"==typeof a||"number"==typeof a?e.createElement(A,{error:!!r,inputProps:fe({className:g.inputBase,style:{width:Et(a,!!p)}},f),value:a,onChange:i,onBlur:o,InputProps:{startAdornment:l?e.createElement(F,{position:"end",className:g.startAdornment},l):null,endAdornment:c?e.createElement(F,{position:"start",className:g.startAdornment},c):null,inputComponent:d?gt:void 0,className:g.body2Text+" "+g.modifiedUnderline,classes:{input:g.input}},helperText:r||void 0,disabled:n}):e.createElement(m,{variant:"body2"},"Incorrect value type")},Nt=function(t){return e.createElement(Ct,fe({},fe(fe({},t),{numberField:!0})))},kt=function(t){return e.createElement(Ct,fe({},fe(fe({},t),{numberField:!0,fixedDecimalScale:!0})))},St=p(g({root:{padding:"3px"}}))(P),Bt=function(t){var r=t.disabled,n=t.fullDate,a=void 0!==n&&n,o=t.value,i=t.error,l=t.onChange,c=t.onBlur,s=t.textAlign,d=wt({textAlign:s});return e.createElement(ae,{utils:le},e.createElement(oe,{disabled:r,views:a?void 0:["year","month"],value:o,autoOk:!0,format:a?"dd MMM yyyy":"MMM yyyy",InputProps:{className:d.body2Text+" "+d.modifiedUnderline},inputProps:{className:d.inputBase+" "+(a?d.fullDateWidth:d.dateFieldWidth),classes:{input:d.input}},error:!!i,helperText:i||void 0,onChange:l,onBlur:c}))},Rt=function(t){return e.createElement(Bt,fe({},t))},It=function(t){return e.createElement(Bt,fe({},t,{fullDate:!0}))},Tt=function(t){var r=t.value,n=t.disabled,a=t.onChange;return e.createElement(P,{disabled:n,checked:r,onChange:a,color:"primary",size:"small"})},Lt=function(t){return e.createElement(Tt,fe({},t))},Ft=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,c=void 0===l?null:l,s=t.textAlign,d=t.fixedDecimalScale,m=wt({});return e.createElement(u,{className:m.totalContainer+" "+m.body2Text+" "+("left"===s?m.justifyStart:"right"===s?m.justifyEnd:m.justifyCenter)},i&&i,e.createElement(u,{className:m.body2Text},a?e.createElement(ne,{value:r,displayType:"text",thousandSeparator:!0,isNumericString:!0,decimalScale:2,fixedDecimalScale:d}):r),c&&c)},At=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,c=wt({});return e.createElement(D,{margin:"none",error:!!r},e.createElement(O,{className:c.body2Text+" "+c.modifiedUnderline,inputProps:{className:c.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:c.body2Text,key:r,value:r},n)}))),r&&e.createElement(M,null,r))},Wt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,c=t.renderValue,s=wt({});return e.createElement(D,{margin:"none",error:!!r},e.createElement(O,{className:s.body2Text+" "+s.modifiedUnderline,inputProps:{className:s.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l,renderValue:c,multiple:!0},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(W,{className:s.body2Text,key:r,value:r},n)}))),r&&e.createElement(M,null,r))},Pt=c((function(e){return{newRowHighlight:{backgroundColor:"#73c4ca30"},editedCellHighlight:{backgroundColor:"#5840f52e",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"}}})),Dt=function(r){var n=r.value,o=void 0===n?"":n,i=r.row,l=i.index,c=i.values,s=i.original,d=r.column.id,m=r.syncCellWithState,u=r.setRows,p=r.fieldConfig,g=r.disabled,f=p[d],h=f.validationRule,v=f.dependentValidationRule,b=f.isCheckbox,y=f.isDateField,x=f.customRenderFn,E=f.prefix,w=f.suffix,C=f.textAlign,N=f.onBlur,k=f.onChangeValueModifier,S=t(!1),B=S[0],R=S[1],I=t(o),T=I[0],L=I[1],F=b,A=function(e){var t=!1;if(h)try{h.validateSync(e),B&&R(!1)}catch(e){t=!0,!B&&R(e.message)}if(v)try{v(c).validateSync(e),B&&R(!1)}catch(e){t=!0,!B&&R(e.message)}return t},W=function(e){return ve(void 0,void 0,void 0,(function(){return be(this,(function(t){switch(t.label){case 0:return F?m(l,d,e,!1):m(l,d,T,!!B),!N||!u||B||Qe(c[d],T,y)?[3,2]:[4,N({rowIndex:l,value:T,setRows:u,values:s})];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))};a((function(){L(o);var e=A(o);B!==e&&m(l,d,o,e,!0)}),[o]),a((function(){s.errors&&!!s.errors[d]!=!!B&&A(o)}),[s.errors]);var P,D={value:T,values:c,disabled:g||s.disabledRow,error:B,onChange:function(e){var t;if(y){t=e;var r=k?k(t):t;return L(r),void A(r)}t=e;var n=F?t.target.checked:t.target.value;F?(L(n),W(n)):(L(n),A(n))},onBlur:W,prefix:E,suffix:w,textAlign:C,originalValues:s};return x?x(D):(P=D,e.createElement(Ct,fe({},fe({},P))))},Ot=function(t){var r=t.row,n=t.classes,a=t.disabled,o=t.includeRowSelect;return e.createElement(f,{hover:!0,className:("NEW"===r.original.rowStatus?n.newRowHighlight:"")+" "+("EDITED"===r.original.rowStatus?n.editedBorder:"")+"\n"+(r.original.hasOwnProperty("errors")&&Object.values(r.original.errors).includes(!0)?n.errorBorder:"")+" "+(r.original.disabledRow||a?n.disabled:"")},r.cells.map((function(t,r){return e.createElement(y,fe({},t.getCellProps(),{align:t.column.textAlign||"center",className:"EDITED"===t.row.original.rowStatus&&t.row.original.edited[t.column.id]?n.editedCellHighlight:"",padding:0===(o&&r)?"checkbox":"normal"}),t.render("Cell"))})))},Mt=[],jt=i((function(t){var r=t.tableRows,o=t.tableHeaders,i=t.syncCellWithState,l=t.setRows,c=void 0===l?void 0:l,s=t.skipPageReset,d=void 0!==s&&s,p=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,N=void 0!==C&&C,k=t.defaultPageSize,S=void 0===k?50:k,B=t.virtContainerStyling,R=t.overscan,I=t.rowHeight,T=t.includeGlobalSearch,L=fe(fe({},Pt()),Be()),F=e.useRef(null),A=e.useMemo((function(){return{Cell:Dt}}),[]),W=ce({columns:o,data:r||Mt,defaultColumn:A,autoResetPage:!!N&&!d,filterTypes:x,initialState:{pageSize:N?S:void 0},syncCellWithState:i,setRows:c,fieldConfig:p,disabled:f,autoResetGlobalFilter:!1},se,de,me,ue,(function(t){b&&t.visibleColumns.push((function(t){return ye([{id:"selection",Header:function(t){var r=t.getToggleAllRowsSelectedProps,n=t.getToggleAllPageRowsSelectedProps;return e.createElement(St,fe({},N?n():r(),{disabled:f,size:"small"}))},Cell:function(t){var r=t.row;return e.createElement(St,fe({},r.getToggleRowSelectedProps(),{disabled:f||r.original.disableSelection,size:"small"}))}}],t,!0)}))})),P=W.getTableProps,D=W.getTableBodyProps,O=W.headerGroups,M=W.rows,j=W.page,z=W.prepareRow,H=W.state,K=H.selectedRowIds,V=H.pageIndex,U=W.state,J=W.setFilter,q=W.pageCount,Y=W.gotoPage,X=W.preGlobalFilteredRows,Q=W.setGlobalFilter,$=W.isAllRowsSelected,Z=W.selectedFlatRows,_=ge({size:(N?j:M).length,parentRef:F,overscan:R||5,estimateSize:n((function(){return I||54}),[I])}),ee=N?j:M,te=_.virtualItems,re=te.length>0?te[0].start:0,ne=te.length>0?_.totalSize-te[te.length-1].end:0,ae=n((function(e,t){Y(t-1)}),[]);return a((function(){y&&J(y.filterRow,y.filterValues)}),[y]),a((function(){h&&h(Object.keys(K).map((function(e){return+e})))}),[K]),e.createElement(e.Fragment,null,T?e.createElement(Ht,{preGlobalFilteredRows:X,globalFilter:U.globalFilter,setGlobalFilter:Q}):null,e.createElement("div",{ref:F,className:B||L.virtualisationContainer},e.createElement(Gt,fe({},{disabled:f,includeRowSelect:b,getTableProps:P,headerGroups:O,getTableBodyProps:D,rowsToRender:ee,prepareRow:z,paddingTop:re,paddingBottom:ne,virtualRows:te,isAllRowsSelected:$,selectedFlatRows:Z}))),null===r?e.createElement(u,{className:L.emptyLoadingPadding},e.createElement(Fe,null)):null,r&&!r.length?e.createElement(u,{className:L.emptyLoadingPadding+" "+L.centeredText},e.createElement(m,{variant:"body2"},w)):null,N&&(null==r?void 0:r.length)?e.createElement(G,{className:L.flexCenter+" "+L.pagination,count:q,page:V+1,onChange:ae,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),zt=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:fe({width:"100%",maxWidth:"18rem",color:"inherit"},e.typography.body2)}})),Ht=i((function(r){var n=r.preGlobalFilteredRows,a=r.globalFilter,o=r.setGlobalFilter,i=t(a),l=i[0],c=i[1],s=fe(fe({},ke()),zt()),d=pe((function(e){o(e||void 0)}),200),m=n.length;return e.createElement("div",{className:s.container+" "+s.contentBreak},e.createElement(te,{className:s.rightSpacer1+" "+s.leftSpacer1}),e.createElement(L,{className:""+s.input,value:l||"",onChange:function(e){c(e.target.value),d(e.target.value)},placeholder:"Search "+m+" records...",inputProps:{"aria-label":"search"}}))})),Gt=i((function(t){var r=t.disabled,n=t.includeRowSelect,a=t.getTableProps,o=t.headerGroups,i=t.getTableBodyProps,l=t.rowsToRender,c=t.prepareRow,s=t.paddingTop,d=t.paddingBottom,m=t.virtualRows,u=t.isAllRowsSelected,p=t.selectedFlatRows;return e.createElement(h,fe({},a(),{stickyHeader:!0,style:{borderCollapse:"collapse"}}),e.createElement(Kt,{headerGroups:o,includeRowSelect:n,isAllRowsSelected:u}),e.createElement(b,fe({},i()),s>0&&e.createElement("tr",null,e.createElement("td",{style:{height:s+"px"}})),e.createElement(Vt,fe({},{disabled:r,includeRowSelect:n,rowsToRender:l,prepareRow:c,virtualRows:m,selectedFlatRows:p})),d>0&&e.createElement("tr",null,e.createElement("td",{style:{height:d+"px"}}))))})),Kt=i((function(t){var r=t.headerGroups,n=t.includeRowSelect;return t.isAllRowsSelected,e.createElement(v,null,r.map((function(t){return e.createElement(f,fe({},t.getHeaderGroupProps()),t.headers.map((function(t,r){return e.createElement(y,fe({},t.getHeaderProps(),{align:t.textAlign||"center",padding:0===(n&&r)?"checkbox":"normal"}),t.render("Header"))})))})))})),Vt=i((function(t){var r=t.rowsToRender,n=t.virtualRows,a=t.prepareRow,o=he(t,["rowsToRender","virtualRows","prepareRow"]),i=fe(fe({},Pt()),Be());return e.createElement(e.Fragment,null,n.map((function(t){var n=r[t.index];return a(n),e.createElement(l,{key:n.original.rowKey||n.getRowProps().key},n.original.disabledRow?e.createElement(j,{title:n.original.tooltipText||"This row is disabled",arrow:!0},e.createElement(Ot,fe({},fe(fe({},o),{row:n,classes:i})))):e.createElement(Ot,fe({},fe(fe({},o),{row:n,classes:i}))))})))})),Ut=c((function(e){return{alertStyling:{borderRadius:"14px"},closeButton:{color:e.palette.text.secondary,marginRight:e.spacing(2)},showCursor:{cursor:"pointer"}}})),Jt=function(t){var r=t.alertActionHandler,n=t.formStatus,a=t.actionButton,o=t.alertMessage,i=t.addBreak,l=void 0===i||i,c=t.styling,d=fe(fe({},ke()),Ut());return e.createElement(S,{in:[xe,Ee,we].includes(n)},e.createElement(K,{onClick:r,className:d.alertStyling+" "+(l?d.sectionBreak:"")+" "+(c||"")+" "+(r?d.showCursor:""),severity:n===Ee?Ee:n===xe?xe:we,action:a?e.createElement(s,{className:d.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"}}})),Yt=function(r){var n=r.id,o=void 0===n?"image-upload":n,i=r.url,l=r.roundedAvatar,c=void 0!==l&&l,p=r.handleSaveImage,g=r.alt,f=r.accessLevel,h=fe(fe({},qt()),ke()),v=t(!!i),b=v[0],y=v[1],x=t("enabled"),E=x[0],w=x[1],C=t(null),N=C[0],k=C[1];if(a((function(){i&&y(!0)}),[i]),f===Ne)return null;var S=!1;f===Ce&&(S=!0);var B,I=function(e,t){return ve(void 0,void 0,void 0,(function(){var r,n;return be(this,(function(a){switch(a.label){case 0:return S?[2]:(k(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(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:w(Ee),y(!!i),a.label=7;case 7:return[2]}}))}))},T=function(e){return ve(void 0,void 0,void 0,(function(){var t,r,n;return be(this,(function(a){switch(a.label){case 0:return w("loading"),e.size>=524288?(k("Image size should be less than 0.5MB"),w(Ee),y(!!i),[2]):(t=e.name.split(".")[1].toLowerCase(),["png","jpg","jpeg"].includes(t)?[4,e.arrayBuffer()]:(k("Please provide an image in png, jpg or jpeg format"),w(Ee),y(!!i),[2]));case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,p(t,r,e)];case 3:return a.sent(),w(xe),y(!0),[3,5];case 4:return n=a.sent(),console.log(n),w(Ee),y(!!i),[3,5];case 5:return[2]}}))}))};switch(E){case"dragEnter":B=e.createElement(u,{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":B=e.createElement(u,{className:h.dropBox},e.createElement(m,{color:"textSecondary"},"Loading..."),e.createElement(d,{className:h.loadingCircle,size:25}));break;default:B=e.createElement("label",{htmlFor:o},e.createElement(R,{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(u,{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(u,{className:h.labelBreak},e.createElement("label",{htmlFor:o},e.createElement(s,{className:""+(c?h.roundedAvatarButton:""),"aria-label":"upload picture",component:"span"},c?e.createElement(z,{className:h.roundedAvatar,src:i,alt:g||"Profile Avatar"}):e.createElement("img",{className:h.organisationImage,src:i,alt:g||"Company Logo"})))),e.createElement(u,{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(),I("dragDrop",e))}},e.createElement("input",{id:o,className:h.hiddenInput,type:"file",accept:".png, .jpg, .jpeg",disabled:S,onChange:function(e){return I("input",e)}}),B),e.createElement(u,{className:h.widthLimiter},e.createElement(Jt,{formStatus:E,alertMessage:N||(E===xe?"Uploaded successfully!":"Something went wrong.")})))};export{Jt as Alert,st as AlphabeticalList,Ge as Breadcrumbs,Ie as Button,xt as ButtonWithConfirm,Le as ContentBox,Te as ContentLabel,vt as DatePicker,jt as EditableTable,Ve as EntityList,Ue as ErrorIndicator,Yt as ImageDisplayAndUpload,bt as KeyboardDatePicker,rt as LeftNavigation,Fe as LoadingSpinner,at as MainLayout,Ft as NonEditableField,gt as NumberFormatField,mt as SearchBar,ht as Select,ze as StaticTable,Bt as TableDatePicker,Wt as TableMultipleSelect,At as TableSelect,Ct as TableTextField,pt as TextField,Qe as didCellValueChange,Lt as tableCheckbox,Rt as tableDateField,It as tableInvoiceDateField,Nt as tableNumericStringField,kt as tableNumericStringFixedDecimalField,ot as useDebounceEffect,it as useInterval,lt as useWhyDidYouUpdate};
1
+ import e,{useState as t,useMemo as r,useCallback as n,useEffect as a,useRef as o,forwardRef as i,memo as l,Fragment as c}from"react";import{makeStyles as s,Button as d,CircularProgress as m,Typography as u,Box as p,withStyles as g,createStyles as f,TableRow as h,Table as v,TableHead as b,TableBody as y,TableCell as x,Link as E,ButtonBase as w,Grid as C,ListItem as N,ListItemIcon as k,ListItemText as S,Collapse as B,List as R,IconButton as I,Container as T,Divider as L,InputBase as F,InputAdornment as A,TextField as W,MenuItem as P,Checkbox as D,FormControl as O,Select as M,FormHelperText as j,Tooltip as z,Avatar as H}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 J,useHistory as q}from"react-router-dom";import Y 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 ce from"@date-io/date-fns";import{useTable as se,useFilters as de,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{c(n.next(e))}catch(e){o(e)}}function l(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((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(c){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,c])}}}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="warning",Ne="read",ke="noAccess",Se=s({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}),Be=s((function(e){return{boldText:{fontWeight:700},bolderText:{fontWeight:500},smallText:{fontSize:"0.7rem"},warningColor:{color:e.palette.warning.main},centerText:{textAlign:"center"}}}),{classNamePrefix:"font"}),Re=s({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}),Ie=s((function(e){return{submitButton:{borderRadius:"1.5rem",padding:"0.4rem 1rem",textTransform:"none"},containedText:{color:"white"},spinnerColour:{color:e.palette.grey[500]}}})),Te=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,c=void 0===l?"submit":l,s=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({},Se()),Ie());if([ke,Ne].includes(E))return null;var N=p;return p||!n&&!i||(N=!0),e.createElement(d,he({},w,{variant:f,color:y,type:c,className:C.submitButton+" "+("contained"===f&&C.containedText)+" "+v,disabled:N,onClick:s}),a,n?e.createElement(m,{className:C.leftSpacer1+" "+C.spinnerColour,size:"1.1rem",thickness:6}):"")},Le=function(t){var r=t.children,n=t.styling,a=void 0===n?null:n,o=Be();return e.createElement(u,{variant:"h6",className:o.bolderText+" "+(a||"")},r)},Fe=function(t){var r=t.limitWidth,n=void 0!==r&&r,a=t.children,o=t.styling,i=he(he({},Se()),Re());return e.createElement(p,{boxShadow:3,className:i.contentBox+" "+(o||"")},e.createElement(p,{className:i.centeredText+" "+(n?i.limitWidth50rem:"")},a))},Ae=function(t){var r=t.text,n=void 0===r?"Loading data...":r,a=t.styling,o=he(he({},Se()),Re());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"}))},We=g(f({root:{"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),Pe=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),De=s((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)")}}}}})),Oe=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({},Re()),De(he({},o||{})));return e.createElement(x,he({},i,{classes:{root:l.root,head:l.head}}),e.createElement(p,{className:l.flexCenter+" "+l[a]},r))},Me=function(t){var r=t.rowBorderSeparation,n=void 0!==r&&r,a=t.children,o=ve(t,["rowBorderSeparation","children"]);return n?e.createElement(We,he({},o),a):e.createElement(Pe,he({},o),a)},je=function(t){var r=t.colSpan,n=t.children,a=ze();return e.createElement(Me,null,e.createElement(Oe,{className:a.adjustedCellPadding,colSpan:r},n))},ze=s({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"}}),He=function(o){var i=o.rowBorderSeparation,l=void 0!==i&&i,c=o.headers,s=o.rows,d=o.headerCellAlignment,m=void 0===d?[]:d,u=o.rowCellAlignment,p=void 0===u?[]:u,g=o.styling,f=o.headerColours,x=o.paginate,E=void 0!==x&&x,w=o.itemsPerPage,C=void 0===w?30:w,N=he(he(he({},Re()),Se()),ze()),k=t(1),S=k[0],B=k[1],R=r((function(){return!!(E&&((null==s?void 0:s.length)||0)>C)}),[C,E,s]),I=t(R?s.slice(0,C):s),T=I[0],L=I[1],F=n((function(e,t){B(t)}),[]);return a((function(){L(R?s.slice(C*(S-1),C*S):s)}),[R,C,S,s]),e.createElement(e.Fragment,null,e.createElement(v,{className:N.tableStyles+" "+(R?N.contentBreak:"")+" "+(g||"")},c?e.createElement(b,null,e.createElement(h,null,c.map((function(t,r){return e.createElement(Oe,{align:m[r]||"centerJustify",key:"header-cell-"+r,headerColours:f},t)})))):null,e.createElement(y,null,T?T.length?T.map((function(t,r){var n=!!t.onClick;return e.createElement(Me,{rowBorderSeparation:l,className:n?N.pointer:void 0,key:"row-"+r,onClick:n?t.onClick:void 0},t.row.map((function(t,n){return e.createElement(Oe,{align:p[n]||"centerJustify",className:l&&T.length!==r+1?N.bottomBorder:void 0,key:"row-"+r+"-cell-"+n},t)})))})):e.createElement(je,{colSpan:(null==c?void 0:c.length)||0},"Table is empty"):e.createElement(je,{colSpan:(null==c?void 0:c.length)||0},e.createElement(Ae,null)))),R?e.createElement(K,{className:N.flexCenter,count:Math.ceil(s.length/C),page:S,onChange:F,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)},Ge=s((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%"}}})),Ke=function(t){var r=t.logo,n=t.content,a=t.colors,o=Ge(he({},a||{})),i=n.first,l=void 0===i?null:i,c=n.second,s=void 0===c?null:c,d=n.third,m=void 0===d?null:d;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))),s&&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:s.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},s.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))))},Ve=s((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}}})),Ue=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,c=t.onClick,s=he(he(he({},Ve()),Se()),Be());return e.createElement(p,{className:s.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(d,he({className:s.button,key:t.name},c?{onClick:function(){return c(t)}}:{component:U,to:t.link}),e.createElement(p,{className:s.svgContainer+" "+s.labelBreak},n(t)),e.createElement(u,{className:s.orgLabel,variant:"body1"},t.name)))}))):e.createElement(u,{className:s.centerText,variant:"body2",color:"textSecondary"},l):e.createElement(Ae,{text:o}))},Je=function(t){var r=t.text,n=void 0===r?"Something went wrong":r,a=he(he({},Se()),Re());return e.createElement(p,{className:a.flexCenter},e.createElement(Y,{fontSize:"medium",className:a.rightSpacer1,color:"error"}),e.createElement(u,{variant:"body2",color:"textSecondary"},n))},qe=s((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"}}})),Ye=function(e,t){return!!e.split("/").includes(t)},Xe=function(r){var n,a,o=r.mainItem,i=r.subItems,l=r.config,c=r.Icon,s=he(he(he({},Be()),Se()),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)||{}))),d=J(),m=Ye(d.pathname,o.id),g=t(!!(null==i?void 0:i.length)&&m),f=g[0],h=g[1];return e.createElement(e.Fragment,null,e.createElement(N,{button:!0,dense:!0,className:s.mainListItem,component:U,to:o.route},e.createElement(k,{className:s.listIcon+" "+s.mainIconMarginAdjustment+" "+s.rightSpacer1},e.createElement(c,{id:"second-nav-item",styling:s.mainIconSize+" "+s.mainIconColor+" "+(m?s.activeMainIconColor:"")})),e.createElement(S,{disableTypography:!0,className:s.noYMargin,primary:e.createElement(u,{variant:"body2",className:s.bolderText+" "+s.textOverflowElipsis,color:"inherit"},o.name,(null==i?void 0:i.length)?e.createElement(u,{component:"span",variant:"body2",className:s.bolderText,color:"inherit"}," ","(",i.length,")"):null)}),(null==i?void 0:i.length)?e.createElement(k,{className:s.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(B,{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:s.subItemWrapper},e.createElement(p,{className:s.relativeWrapper+" "+s.rightSpacer1},e.createElement(p,{className:s.subItemBorder+" "}),e.createElement(p,{className:s.subItemBorderMask+" "+(Ye(d.pathname,a)?s.activeSubItemBorder:"")+" "})),e.createElement(N,{key:n,component:U,to:n,button:!0,dense:!0,className:s.subListItem+" "+(Ye(d.pathname,a)?s.activeSubListItem:"")},e.createElement(S,{disableTypography:!0,primary:e.createElement(u,{variant:"body2",className:s.textOverflowElipsis,color:"inherit"},r)})))})))):null)};function Qe(e){return e.sort((function(e,t){return+t.startDate.split("T")[0].replaceAll("-","")-+e.startDate.split("T")[0].replaceAll("-","")}))}var $e=function(e,t,r){return r?(e&&_(e)?e:new Date(0)).getTime()===(t&&_(t)?t:new Date(0)).getTime():e===t},Ze=s((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)}}})),_e=function(t){var r,n,a,o,i=t.secondaryNavItems,l=t.primaryNavItems,c=t.expandedOptions,s=t.setExpandedOptions,d=t.config,m={titleColor:null===(r=d.secondary)||void 0===r?void 0:r.titleColor,titleIconColor:null===(n=d.secondary)||void 0===n?void 0:n.titleIconColor},g=he(he(he({},Se()),Be()),Ze(m)),f=q(),h=i[c.view];if(!h)return null;var v=l.find((function(e){return e.field===c.view})).Icon;return e.createElement(p,{className:g.secondaryNavWrapper},e.createElement(p,{className:g.titleWrapper},e.createElement(u,{className:g.rightSpacer1+" "+g.title},c.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 s({view:"",expanded:!1})}},(null===(a=d.secondary)||void 0===a?void 0:a.closeButtonSvg)||e.createElement(ee,null))),e.createElement(R,{className:g.listWrapper,component:"div"},Qe(h.items).map((function(t){return e.createElement(Xe,he({key:t.mainItem.route},t,{config:d,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 ",c.view),Qe(h.archivedItems).map((function(t){return e.createElement(Xe,he({key:t.mainItem.route},t,{config:d,Icon:v}))}))):null))},et=s((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"}}})),tt=function(t){var r=t.expandedOptions,n=t.setExpandedOptions,a=t.navigationLinks,o=t.config,i=J(),l=et(he({},o.primary||{})),c=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(N,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(k,{className:l.iconWrapper},e.createElement(t.Icon,{styling:l.textColour+" "+(c(t.field,t.path)?l.activeTextColour:"")})),e.createElement(u,{variant:"caption",className:l.itemName+" "+l.textColour+" "+(c(t.field,t.path)?l.activeTextColour:"")},t.field),e.createElement(p,{className:l.itemBorder+" "+(c(t.field,t.path)?l.activeBorder:"")}))})))},rt=s({leftNavContainer:{height:"100%",display:"flex",position:"relative",width:"max-content"}}),nt=function(r){var n=r.primaryNavItems,o=r.secondaryNavItems,i=r.config,l=t({view:"",expanded:!1}),c=l[0],s=l[1],d=rt(),m=J(),u=n.reduce((function(e,t){return t.hasSecondary?xe(xe([],e,!0),[t.field],!1):e}),[]);return a((function(){s((function(e){return u.includes(e.view)&&!0===e.expanded?e:{view:"",expanded:!1}}))}),[m.pathname]),e.createElement(p,{component:"nav",className:d.leftNavContainer},e.createElement(tt,{expandedOptions:c,setExpandedOptions:s,navigationLinks:n,config:i}),c.expanded&&e.createElement(_e,{secondaryNavItems:o,primaryNavItems:n,expandedOptions:c,setExpandedOptions:s,config:i}))},at=s((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"}}})),ot=function(t){var r=t.sideNavigation,n=t.children,a=t.desktopWidth,o=t.topOffset,i=at({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)))},it=function(e,t,r){void 0===r&&(r=250);var o=n(e,t);a((function(){var e=setTimeout(o,r);return function(){return clearTimeout(e)}}),[o,r])},lt=function(e,t){var r=o();a((function(){r.current=e})),a((function(){if(null!==t){var e=setInterval((function(){r.current&&r.current()}),t);return function(){return clearInterval(e)}}}),[t])};function ct(e,t){var r=o(t);a((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 st=s((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"}}})),dt=function(t){var r=t.array,n=t.sortFn,a=t.sortKey,o=void 0===a?"name":a,i=t.buttonClick,l=t.linkTo,c=t.ItemTemplate,s=t.arrayKey,d=void 0===s?"id":s,m=t.loadingMessage,p=void 0===m?"Loading list...":m,g=t.emptyMessage,f=void 0===g?"List is empty":g,h=t.alphabetisedHeader,v=void 0===h||h,b=he(he(he({},st()),Se()),Re());if(void 0===r)return e.createElement(Ae,{styling:b.topMargin,text:p});if(!(null==r?void 0:r.length))return e.createElement(u,{className:b.topMargin,align:"center",variant:"body2",color:"textSecondary"},f);var y=n?xe([],r,!0).sort(n):r,x="";return e.createElement(R,{className:b.limitWidth50rem},y.map((function(t,r){var n,a=!1;if(v){var s=((null===(n=t[o])||void 0===n?void 0:n[0])||"???").toLowerCase();s!==x&&(x=s,a=!0)}return e.createElement(e.Fragment,{key:t[d]||"alphabetical-list-"+r},v&&a?e.createElement(e.Fragment,null,e.createElement(u,{className:""+b.letterHeader,align:"left"},x.toUpperCase()),e.createElement(L,{className:b.contentBreak+" "+b.divider})):null,e.createElement(N,he({className:b.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(c,{item:t})))})))},mt=s((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]}}})),ut=function(r){var n=r.array,o=r.sortFn,i=r.sortKey,l=void 0===i?"name":i,c=r.buttonClick,s=r.linkTo,d=r.ItemTemplate,m=r.arrayKey,u=void 0===m?"id":m,g=r.loadingMessage,f=void 0===g?"Loading list...":g,h=r.emptyMessage,v=void 0===h?"List is empty":h,b=r.inputBackgroundColor,y=r.placeholder,x=r.disabledSearch,E=r.delay,w=void 0===E?500:E,C=r.minQueryLength,N=void 0===C?3:C,k=r.handleOnChange,S=r.searchKeys,B=void 0===S?["name"]:S,R=r.alphabetisedHeader,I=void 0===R||R,T=he(he(he({},Se()),Re()),mt({background:b})),L=t(""),W=L[0],P=L[1],D=t(!1),O=D[0],M=D[1],j=t(n),z=j[0],H=j[1];return it((function(){!O&&W.length>=N&&(k?k(W):H(null==n?void 0:n.filter((function(e){var t=B.some((function(t){var r;return null===(r=e[t])||void 0===r?void 0:r.toLowerCase().includes(W.toLowerCase())}));return t}))))}),[W],w),a((function(){H(n)}),[n]),e.createElement(e.Fragment,null,e.createElement(p,{className:T.searchBox+" "+T.limitWidth50rem},e.createElement(F,{disabled:x,type:"text",value:W,placeholder:y||"Enter to search",onChange:function(e){O&&M(!1),P(e.target.value)},className:T.searchField,endAdornment:e.createElement(A,{position:"end",className:T.rightSpacer2},e.createElement(re,{className:T.searchIcon}))})),null!==n&&e.createElement(dt,{array:z,sortFn:o,sortKey:l,buttonClick:c,linkTo:s,ItemTemplate:d,arrayKey:u,loadingMessage:f,emptyMessage:v,alphabetisedHeader:I}))},pt=s((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"}}):{})}}})),gt=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,c=t.InputProps,s=void 0===c?{}:c,d=t.accessLevel,m=t.disabled,u=t.fixedDecimalScale,p=ve(t,["size","styling","numberField","inputProps","InputProps","accessLevel","disabled","fixedDecimalScale"]),g=pt({size:n});if(d===ke)return null;var f=m;d===Ne&&(f=!0);var h=he({},o&&{fixedDecimalScale:!!u});return e.createElement(W,he({className:a||"",disabled:f},p,{inputProps:he(he({},l),h),InputProps:he(he({},s),{className:g.inputField,inputComponent:o?ft:void 0}),InputLabelProps:{className:g.labelStyles},variant:"outlined",size:n}))},ft=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}))},ht=s((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"}}}}})),vt=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,c=t.disabled,s=t.accessLevel,d=ve(t,["selectOptions","background","size","styling","disabled","accessLevel"]),m=ht({background:a,size:i});if(s===ke)return null;var u=c;return s===Ne&&(u=!0),e.createElement(gt,he({className:l||""},d,{disabled:u,size:i,SelectProps:{inputProps:{className:m.inputStyles}},select:!0}),r.map((function(t){return e.createElement(P,{key:t.value,value:t.value,className:m.listItem,classes:{selected:m.selectedListItem}},t.description)})))},bt=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,c=t.disabled,s=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===ke)return null;var d=c;return l===Ne&&(d=!0),e.createElement(oe,{utils:ce},e.createElement(ie,he({className:r||""},s,{disabled:d,inputVariant:"outlined",autoOk:!0,format:a,minDate:i,TextFieldComponent:gt})))},yt=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,c=t.disabled,s=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===ke)return null;var d=c;return l===Ne&&(d=!0),e.createElement(oe,{utils:ce},e.createElement(le,he({className:r||""},s,{disabled:d,inputVariant:"outlined",autoOk:!0,allowKeyboardControl:!0,format:a,minDate:i,TextFieldComponent:gt})))},xt=s((function(e){return{confirmWrapper:{display:"inline-block"},confirmContainer:{display:"flex",alignItems:"center"},whiteText:{color:e.palette.common.white}}})),Et=function(r){var n=r.children,o=r.onClick,i=r.styling,l=r.disabled,c=void 0!==l&&l,s=r.variant,d=void 0===s?"outlined":s,m=r.color,g=void 0===m?"primary":m,f=r.accessLevel,h=void 0===f?"":f,v=ve(r,["children","onClick","styling","disabled","variant","color","accessLevel"]),b=he(he({},Se()),xt()),y=t(!1),x=y[0],E=y[1],w=t(!1),C=w[0],N=w[1];return lt((function(){return E(!1)}),!x||C?null:4500),a((function(){N(v.loading),E(v.loading)}),[v.loading]),[ke,Ne].includes(h)?null:x?e.createElement(p,{className:b.confirmWrapper},e.createElement(p,{className:b.confirmContainer},e.createElement(u,{className:b.rightSpacer1,variant:"body1"},"Are you sure?"),e.createElement(Te,he({},v,{type:"button",onClick:function(e){N(!0),o(e)},variant:"contained",styling:b.whiteText,disabled:c,color:g}),"Confirm",v.loading?"ing":""))):e.createElement(Te,{type:"button",variant:d,disabled:c,styling:i,color:g,onClick:function(){return E(!0)}},n)},wt=function(e,t){var r=e.toString().length;return r?r+(t?3:1)+Math.floor(r/3)/3+"ch":"6ch"},Ct=s((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"}}}})),Nt=function(t){var r=t.error,n=t.disabled,a=t.value,o=t.onBlur,i=t.onChange,l=t.prefix,c=t.suffix,s=t.numberField,d=void 0!==s&&s,m=t.textAlign,p=t.fixedDecimalScale,g=Ct({textAlign:m}),f=he({},d&&{fixedDecimalScale:!!p});return"string"==typeof a||"number"==typeof a?e.createElement(W,{error:!!r,inputProps:he({className:g.inputBase,style:{width:wt(a,!!p)}},f),value:a,onChange:i,onBlur:o,InputProps:{startAdornment:l?e.createElement(A,{position:"end",className:g.startAdornment},l):null,endAdornment:c?e.createElement(A,{position:"start",className:g.startAdornment},c):null,inputComponent:d?ft:void 0,className:g.body2Text+" "+g.modifiedUnderline,classes:{input:g.input}},helperText:r||void 0,disabled:n}):e.createElement(u,{variant:"body2"},"Incorrect value type")},kt=function(t){return e.createElement(Nt,he({},he(he({},t),{numberField:!0})))},St=function(t){return e.createElement(Nt,he({},he(he({},t),{numberField:!0,fixedDecimalScale:!0})))},Bt=g(f({root:{padding:"3px"}}))(D),Rt=function(t){var r=t.disabled,n=t.fullDate,a=void 0!==n&&n,o=t.value,i=t.error,l=t.onChange,c=t.onBlur,s=t.textAlign,d=Ct({textAlign:s});return e.createElement(oe,{utils:ce},e.createElement(ie,{disabled:r,views:a?void 0:["year","month"],value:o,autoOk:!0,format:a?"dd MMM yyyy":"MMM yyyy",InputProps:{className:d.body2Text+" "+d.modifiedUnderline},inputProps:{className:d.inputBase+" "+(a?d.fullDateWidth:d.dateFieldWidth),classes:{input:d.input}},error:!!i,helperText:i||void 0,onChange:l,onBlur:c}))},It=function(t){return e.createElement(Rt,he({},t))},Tt=function(t){return e.createElement(Rt,he({},t,{fullDate:!0}))},Lt=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"})},Ft=function(t){return e.createElement(Lt,he({},t))},At=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,c=void 0===l?null:l,s=t.textAlign,d=t.fixedDecimalScale,m=Ct({});return e.createElement(p,{className:m.totalContainer+" "+m.body2Text+" "+("left"===s?m.justifyStart:"right"===s?m.justifyEnd:m.justifyCenter)},i&&i,e.createElement(p,{className:m.body2Text},a?e.createElement(ae,{value:r,displayType:"text",thousandSeparator:!0,isNumericString:!0,decimalScale:2,fixedDecimalScale:d}):r),c&&c)},Wt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,c=Ct({});return e.createElement(O,{margin:"none",error:!!r},e.createElement(M,{className:c.body2Text+" "+c.modifiedUnderline,inputProps:{className:c.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(P,{className:c.body2Text,key:r,value:r},n)}))),r&&e.createElement(j,null,r))},Pt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,c=t.renderValue,s=Ct({});return e.createElement(O,{margin:"none",error:!!r},e.createElement(M,{className:s.body2Text+" "+s.modifiedUnderline,inputProps:{className:s.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l,renderValue:c,multiple:!0},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(P,{className:s.body2Text,key:r,value:r},n)}))),r&&e.createElement(j,null,r))},Dt=s((function(e){return{newRowHighlight:{backgroundColor:"#73c4ca30"},editedCellHighlight:{backgroundColor:"#5840f52e",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"}}})),Ot=function(r){var n=r.value,o=void 0===n?"":n,i=r.row,l=i.index,c=i.values,s=i.original,d=r.column.id,m=r.syncCellWithState,u=r.setRows,p=r.fieldConfig,g=r.disabled,f=p[d],h=f.validationRule,v=f.dependentValidationRule,b=f.isCheckbox,y=f.isDateField,x=f.customRenderFn,E=f.prefix,w=f.suffix,C=f.textAlign,N=f.onBlur,k=f.onChangeValueModifier,S=t(!1),B=S[0],R=S[1],I=t(o),T=I[0],L=I[1],F=b,A=function(e){var t=!1;if(h)try{h.validateSync(e),B&&R(!1)}catch(e){t=!0,!B&&R(e.message)}if(v)try{v(c).validateSync(e),B&&R(!1)}catch(e){t=!0,!B&&R(e.message)}return t},W=function(e){return be(void 0,void 0,void 0,(function(){return ye(this,(function(t){switch(t.label){case 0:return F?m(l,d,e,!1):m(l,d,T,!!B),!N||!u||B||$e(c[d],T,y)?[3,2]:[4,N({rowIndex:l,value:T,setRows:u,values:s})];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))};a((function(){L(o);var e=A(o);B!==e&&m(l,d,o,e,!0)}),[o]),a((function(){s.errors&&!!s.errors[d]!=!!B&&A(o)}),[s.errors]);var P,D={value:T,values:c,disabled:g||s.disabledRow,error:B,onChange:function(e){var t;if(y){t=e;var r=k?k(t):t;return L(r),void A(r)}t=e;var n=F?t.target.checked:t.target.value;F?(L(n),W(n)):(L(n),A(n))},onBlur:W,prefix:E,suffix:w,textAlign:C,originalValues:s};return x?x(D):(P=D,e.createElement(Nt,he({},he({},P))))},Mt=i((function(t,r){var n=t.row,a=t.classes,o=t.disabled,i=t.includeRowSelect;return e.createElement(h,{ref:r,hover:!0,className:("NEW"===n.original.rowStatus?a.newRowHighlight:"")+" "+("EDITED"===n.original.rowStatus?a.editedBorder:"")+"\n"+(n.original.hasOwnProperty("errors")&&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:"",padding:0===(i&&r)?"checkbox":"normal"}),t.render("Cell"))})))})),jt=[],zt=l((function(t){var r=t.tableRows,o=t.tableHeaders,i=t.syncCellWithState,l=t.setRows,c=void 0===l?void 0:l,s=t.skipPageReset,d=void 0!==s&&s,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,N=void 0!==C&&C,k=t.defaultPageSize,S=void 0===k?50:k,B=t.virtContainerStyling,R=t.overscan,I=t.rowHeight,T=t.includeGlobalSearch,L=he(he({},Dt()),Re()),F=e.useRef(null),A=e.useMemo((function(){return{Cell:Ot}}),[]),W=se({columns:o,data:r||jt,defaultColumn:A,autoResetPage:!!N&&!d,filterTypes:x,initialState:{pageSize:N?S:void 0},syncCellWithState:i,setRows:c,fieldConfig:m,disabled:f,autoResetGlobalFilter:!1},de,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 e.createElement(Bt,he({},N?n():r(),{disabled:f,size:"small"}))},Cell:function(t){var r=t.row;return e.createElement(Bt,he({},r.getToggleRowSelectedProps(),{disabled:f||r.original.disableSelection,size:"small"}))}}],t,!0)}))})),P=W.getTableProps,D=W.getTableBodyProps,O=W.headerGroups,M=W.rows,j=W.page,z=W.prepareRow,H=W.state,G=H.selectedRowIds,V=H.pageIndex,U=W.state,J=W.setFilter,q=W.pageCount,Y=W.gotoPage,X=W.preGlobalFilteredRows,Q=W.setGlobalFilter,$=W.isAllRowsSelected,Z=W.selectedFlatRows,_=fe({size:(N?j:M).length,parentRef:F,overscan:R||5,estimateSize:n((function(){return I||54}),[I])}),ee=N?j:M,te=_.virtualItems,re=te.length>0?te[0].start:0,ne=te.length>0?_.totalSize-te[te.length-1].end:0,ae=n((function(e,t){Y(t-1)}),[]);return a((function(){y&&J(y.filterRow,y.filterValues)}),[y]),a((function(){h&&h(Object.keys(G).map((function(e){return+e})))}),[G]),e.createElement(e.Fragment,null,T?e.createElement(Gt,{preGlobalFilteredRows:X,globalFilter:U.globalFilter,setGlobalFilter:Q}):null,e.createElement("div",{ref:F,className:B||L.virtualisationContainer},e.createElement(Kt,he({},{disabled:f,includeRowSelect:b,getTableProps:P,headerGroups:O,getTableBodyProps:D,rowsToRender:ee,prepareRow:z,paddingTop:re,paddingBottom:ne,virtualRows:te,isAllRowsSelected:$,selectedFlatRows:Z}))),null===r?e.createElement(p,{className:L.emptyLoadingPadding},e.createElement(Ae,null)):null,r&&!r.length?e.createElement(p,{className:L.emptyLoadingPadding+" "+L.centeredText},e.createElement(u,{variant:"body2"},w)):null,N&&(null==r?void 0:r.length)?e.createElement(K,{className:L.flexCenter+" "+L.pagination,count:q,page:V+1,onChange:ae,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Ht=s((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)}})),Gt=l((function(r){var n=r.preGlobalFilteredRows,a=r.globalFilter,o=r.setGlobalFilter,i=t(a),l=i[0],c=i[1],s=he(he({},Se()),Ht()),d=ge((function(e){o(e||void 0)}),200),m=n.length;return e.createElement("div",{className:s.container+" "+s.contentBreak},e.createElement(re,{className:s.rightSpacer1+" "+s.leftSpacer1}),e.createElement(F,{className:""+s.input,value:l||"",onChange:function(e){c(e.target.value),d(e.target.value)},placeholder:"Search "+m+" records...",inputProps:{"aria-label":"search"}}))})),Kt=l((function(t){var r=t.disabled,n=t.includeRowSelect,a=t.getTableProps,o=t.headerGroups,i=t.getTableBodyProps,l=t.rowsToRender,c=t.prepareRow,s=t.paddingTop,d=t.paddingBottom,m=t.virtualRows,u=t.isAllRowsSelected,p=t.selectedFlatRows;return e.createElement(v,he({},a(),{stickyHeader:!0,style:{borderCollapse:"collapse"}}),e.createElement(Vt,{headerGroups:o,includeRowSelect:n,isAllRowsSelected:u}),e.createElement(y,he({},i()),s>0&&e.createElement("tr",null,e.createElement("td",{style:{height:s+"px"}})),e.createElement(Ut,he({},{disabled:r,includeRowSelect:n,rowsToRender:l,prepareRow:c,virtualRows:m,selectedFlatRows:p})),d>0&&e.createElement("tr",null,e.createElement("td",{style:{height:d+"px"}}))))})),Vt=l((function(t){var r=t.headerGroups,n=t.includeRowSelect;return t.isAllRowsSelected,e.createElement(b,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:0===(n&&r)?"checkbox":"normal"}),t.render("Header"))})))})))})),Ut=l((function(t){var r=t.rowsToRender,n=t.virtualRows,a=t.prepareRow,o=ve(t,["rowsToRender","virtualRows","prepareRow"]),i=he(he({},Dt()),Re());return e.createElement(e.Fragment,null,n.map((function(t){var n=r[t.index];return a(n),console.log({profilesId:n.original.profileId,disabledRow:n.original.disabledRow,tooltipText:n.original.tooltipText}),e.createElement(c,{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(Mt,he({},he(he({},o),{row:n,classes:i})))):e.createElement(Mt,he({},he(he({},o),{row:n,classes:i}))))})))})),Jt=s((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,c=t.styling,s=he(he({},Se()),Jt());return e.createElement(B,{in:[Ee,we,Ce].includes(n)},e.createElement(V,{onClick:r,className:s.alertStyling+" "+(l?s.sectionBreak:"")+" "+(c||"")+" "+(r?s.showCursor:""),severity:n===we?we:n===Ee?Ee:Ce,action:a?e.createElement(d,{className:s.closeButton,"aria-label":"close",color:"inherit",size:"small",onClick:function(e){e.stopPropagation(),a.handler()}},a.text):null},o))},Yt=s((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"}}})),Xt=function(r){var n=r.id,o=void 0===n?"image-upload":n,i=r.url,l=r.roundedAvatar,c=void 0!==l&&l,s=r.handleSaveImage,g=r.alt,f=r.accessLevel,h=he(he({},Yt()),Se()),v=t(!!i),b=v[0],y=v[1],x=t("enabled"),E=x[0],w=x[1],C=t(null),N=C[0],k=C[1];if(a((function(){i&&y(!0)}),[i]),f===ke)return null;var S=!1;f===Ne&&(S=!0);var B,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]:(k(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?(k("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()]:(k("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,s(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":B=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":B=e.createElement(p,{className:h.dropBox},e.createElement(u,{color:"textSecondary"},"Loading..."),e.createElement(m,{className:h.loadingCircle,size:25}));break;default:B=e.createElement("label",{htmlFor:o},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:o},e.createElement(d,{className:""+(c?h.roundedAvatarButton:""),"aria-label":"upload picture",component:"span"},c?e.createElement(H,{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:o,className:h.hiddenInput,type:"file",accept:".png, .jpg, .jpeg",disabled:S,onChange:function(e){return R("input",e)}}),B),e.createElement(p,{className:h.widthLimiter},e.createElement(qt,{formStatus:E,alertMessage:N||(E===Ee?"Uploaded successfully!":"Something went wrong.")})))};export{qt as Alert,dt as AlphabeticalList,Ke as Breadcrumbs,Te as Button,Et as ButtonWithConfirm,Fe as ContentBox,Le as ContentLabel,bt as DatePicker,zt as EditableTable,Ue as EntityList,Je as ErrorIndicator,Xt as ImageDisplayAndUpload,yt as KeyboardDatePicker,nt as LeftNavigation,Ae as LoadingSpinner,ot as MainLayout,At as NonEditableField,ft as NumberFormatField,ut as SearchBar,vt as Select,He as StaticTable,Rt as TableDatePicker,Pt as TableMultipleSelect,Wt as TableSelect,Nt as TableTextField,gt as TextField,$e as didCellValueChange,Ft as tableCheckbox,It as tableDateField,Tt as tableInvoiceDateField,kt as tableNumericStringField,St as tableNumericStringFixedDecimalField,it as useDebounceEffect,lt as useInterval,ct as useWhyDidYouUpdate};
2
2
  //# sourceMappingURL=index.js.map