@australiangreens/ag-internal-components 0.2.1 → 0.2.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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Ve=Object.defineProperty,ze=Object.defineProperties;var Ge=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var X=(e,t,n)=>t in e?Ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u=(e,t)=>{for(var n in t||(t={}))ie.call(t,n)&&X(e,n,t[n]);if(U)for(var n of U(t))se.call(t,n)&&X(e,n,t[n]);return e},B=(e,t)=>ze(e,Ge(t));var ae=(e,t)=>{var n={};for(var r in e)ie.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&U)for(var r of U(e))t.indexOf(r)<0&&se.call(e,r)&&(n[r]=e[r]);return n};var le=(e,t,n)=>X(e,typeof t!="symbol"?t+"":t,n);var I=(e,t,n)=>new Promise((r,s)=>{var a=c=>{try{l(n.next(c))}catch(p){s(p)}},d=c=>{try{l(n.throw(c))}catch(p){s(p)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,d);l((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),f=require("react"),i=require("@mui/material"),Xe=require("@mui/material/CssBaseline"),T=require("@mui/material/styles"),Q=require("souvlaki"),Ye=require("react-router-dom"),Ke=require("@mui/material/List"),Y=require("@mui/icons-material"),D=require("jotai"),Qe=require("@mui/material/Box"),Je=require("jotai/utils"),Ze=require("react-avatar"),J=require("@auth0/auth0-react"),Se=require("@tanstack/react-query"),et=require("autosuggest-highlight/match"),tt=require("autosuggest-highlight/parse"),ot=require("buffer"),nt=require("@mui/material/Skeleton"),L=e=>e&&e.__esModule?e:{default:e},we=L(Xe),je=L(Ke),ce=L(Qe),de=L(Ze),rt=L(et),it=L(tt),st=L(nt);function at({text:e}){const[t,n]=f.useState(0);return o.jsxs(o.Fragment,{children:[o.jsx(i.Typography,{variant:"h6",color:"inherit",component:"div",sx:{fontSize:"22px"},children:"Hello world"}),o.jsx(i.Typography,{variant:"caption",display:"block",children:o.jsx("span",{children:"Just ensuring MUI is working as planned as a peer dependency. v0.0.11"})}),o.jsx(i.Button,{variant:"outlined",onClick:()=>n(r=>r+1),"aria-label":"Increment",children:"Hello I am a button"}),o.jsxs("p",{children:["This is some text: ",o.jsx("span",{children:e})]}),o.jsxs(i.Paper,{children:["This number will incremember when button pressed: ",t]})]})}const Z=330,ee=73,N="Navbar",$={root:`${N}-root`,menuButton:`${N}-menuButton`,hide:`${N}-hide`,content:`${N}-content`,userInfoHolder:`${N}-userInfoHolder`,settings:`${N}-settings`,pieChartIcon:`${N}-pieChartIcon`},lt=T.styled(i.Box,{name:"NavBar"})(({theme:e})=>({[`&.${$.root}`]:{display:"flex"},[`& .${$.menuButton}`]:{marginRight:36},[`& .${$.hide}`]:{display:"none"},[`& .${$.content}`]:{flexGrow:1,padding:e.spacing(3)},[`& .${$.userInfoHolder}`]:{height:"148px",marginTop:"64px",marginBottom:"16px"}})),be=()=>({position:"absolute",height:"100%",overflowX:"hidden",overflowY:"hidden",color:"white",backgroundColor:"black"}),ct=()=>u({width:Z},be()),dt=()=>u({width:ee},be()),ut=T.styled(i.Drawer,{shouldForwardProp:e=>e!=="open"})(({theme:e,open:t})=>u(u({width:t?Z:ee,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",zIndex:e.zIndex.drawer+100},t&&{"& .MuiDrawer-paper":ct()}),!t&&{"& .MuiDrawer-paper":dt()}));class z extends Error{}le(z,"errorName","ContextError");const De=f.createContext(null),pt={},ht={},ke=({overrideState:e=pt,overrideActions:t=ht,children:n})=>{const[{open:r},s]=f.useState({open:!0}),a=f.useCallback(c=>{s({open:c})},[]),d=f.useCallback(()=>{s(c=>B(u({},c),{open:!c.open}))},[]),l=u(u({open:r,setOpen:a,toggleOpen:d},e),t);return o.jsx(De.Provider,{value:l,children:n})},Be=()=>{const e=f.useContext(De);if(e===null)throw new z("Error: Tried to useNavBar outside of a <NavBarProvider>");return e},Ee=(e={})=>u({open:!0},e),gt=Q.createHelper((e=Ee(),t={})=>({children:n})=>o.jsx(ke,{overrideState:e,overrideActions:t,children:n})),mt=Q.createHelper(()=>({children:e})=>o.jsx(Ye.BrowserRouter,{children:e})),ue=7,xt=T.styled(je.default)(({theme:e})=>({backgroundColor:"black",color:"white","& .MuiListItem-root":{padding:"unset"},"& .MuiListItemButton-root":{" .MuiListItemIcon-root":{color:"white",padding:`${ue}px`},"&.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected":{borderLeftStyle:"solid",borderLeftWidth:"7px",borderLeftColor:e.palette.primary.main,paddingLeft:`calc(${e.spacing(2)} - ${ue}px)`},"&:hover":{backgroundColor:e.palette.primary.dark},"&.Mui-selected.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected:hover":{backgroundColor:e.palette.primary.dark}}})),pe=7,ft=T.styled(je.default)(({theme:e})=>({backgroundColor:"#e8e8e8",color:"inherit","& .MuiListItem-root":{padding:"unset"},"& .MuiListItemButton-root":{" .MuiListItemIcon-root":{color:"inherit",padding:`${pe}px`},"&.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected":{borderLeftStyle:"solid",borderLeftWidth:"7px",borderLeftColor:e.palette.primary.main,paddingLeft:`calc(${e.spacing(2)} - ${pe}px)`},"&:hover":{backgroundColor:e.palette.primary.dark},"&.Mui-selected.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected:hover":{backgroundColor:e.palette.primary.dark}}}));function At({"data-testid":e,children:t}){const{open:n}=Be();return o.jsxs(lt,{className:$.root,"data-testid":e,children:[o.jsx(we.default,{}),o.jsx(ut,{variant:"permanent",anchor:"left",transitionDuration:null,open:n,children:t})]})}const _e=()=>{const e=i.useTheme();return i.useMediaQuery(e.breakpoints.down("sm"))},vt=64,Ct=72,yt=256,H=D.atom(!0),Fe=D.atom(yt),Ie=D.atom(Ct),K=D.atom(""),Te=D.atom(void 0),Ne=D.atom(vt),$e=D.atom(void 0);function St({links:e}){return o.jsx("div",{children:"LinksMenu not implemented yet"})}const W="Navbar",q={root:`${W}-root`,menuButton:`${W}-menuButton`,hide:`${W}-hide`,content:`${W}-content`},wt=T.styled(i.Box,{name:"NavBar"})(({theme:e})=>({[`&.${q.root}`]:{display:"flex"},[`& .${q.menuButton}`]:{marginRight:36},[`& .${q.hide}`]:{display:"none"},[`& .${q.content}`]:{flexGrow:1,padding:e.spacing(3)}})),R=(e,t,n)=>e.transitions.create(t,{easing:e.transitions.easing.sharp,duration:n==="leaving"?e.transitions.duration.leavingScreen:e.transitions.duration.enteringScreen}),jt=e=>{const t=i.useTheme();return o.jsx(i.Collapse,u({easing:t.transitions.easing.sharp,timeout:{enter:t.transitions.duration.enteringScreen,exit:t.transitions.duration.leavingScreen}},e))},Le=e=>{var t,n;return{overflowX:"hidden",color:"inherit",backgroundColor:(n=(t=e==null?void 0:e.navBar)==null?void 0:t.backgroundColor)!=null?n:"white"}},he=(e,t)=>u({width:t,transition:R(e,"width","entering")},Le(e)),ge=(e,t)=>u({width:t,transition:R(e,"width","leaving")},Le(e)),bt=T.styled(i.Drawer,{shouldForwardProp:e=>!["widthOpen","widthClosed","isSmallScreen"].includes(e)})(({theme:e,open:t,widthOpen:n,widthClosed:r,isSmallScreen:s})=>u(u({flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",display:"flex",flexDirection:"column"},t&&B(u({},he(e,n)),{backgroundColor:"","& .MuiDrawer-paper":he(e,n)})),!t&&B(u({},ge(e,s?n:r)),{backgroundColor:"","& .MuiDrawer-paper":ge(e,s?n:r)})));function Me(e){return e.replace(/(^|-)([a-z])/g,(t,n,r)=>n==="-"?" "+r.toUpperCase():r.toUpperCase())}function Dt(e,t,n,r){var d;if(!e)return"None";const a=Object.entries(e).filter(([l,c])=>l.startsWith("https://greens.org.au/roles/")&&c.includes(t)).map(([l])=>{var c;return Me((c=l.split("/").at(-1))!=null?c:"")});return(d=r.find(l=>n[l].some(c=>a.includes(c))))!=null?d:"None"}const kt=e=>{const{getIdTokenClaims:t,user:n}=J.useAuth0();return Se.useQuery({queryKey:["availableDomains",n==null?void 0:n.sub],queryFn:()=>I(null,null,function*(){const r=yield t();return r?Object.entries(r).reduce((s,[a,d])=>{var p;const l=Me((p=a.split("/").at(-1))!=null?p:""),c=a.startsWith("https://greens.org.au/roles/")&&e.includes(l)?d:[];return[...new Set([...s,...c])]},[]):[]})})},Bt=e=>Object.values(e).reduce((t,n)=>[...new Set([...t,...n])],[]),V={log:console.warn.bind(console),error:console.error.bind(console),warn:console.warn.bind(console),info:console.info.bind(console),debug:console.debug.bind(console)};function Et(e,t){console[e]=(...n)=>{for(const r of t)if(typeof r=="function"){if(r(...n))return}else if(r instanceof RegExp&&n.length>0){for(const s of n)if(typeof s=="string"&&r.test(s))return}V[e](n)}}function _t(e){if(e)console[e]=V[e];else for(const t of Object.keys(V))console[t]=V[t]}function Pe(e){let t=0;for(let n=0,r=e.length;n<r;n++){const s=e.charCodeAt(n);t=(t<<5)-t+s,t|=0}return t}const me=["#A62A21","#7e3794","#0B51C1","#3A6024","#A81563","#B3003C"],xe=e=>e.split(/\s/).map(t=>t.substring(0,1).toUpperCase()).filter(t=>!!t).slice(0,2).join("").toUpperCase();function Ft({user:e,domainCode:t,open:n,useNewAvatar:r=!1}){const s=i.useTheme();return o.jsxs(i.Box,{sx:{paddingTop:3,display:"flex",alignItems:"center",flexDirection:"column",gap:"0.5rem"},children:[!r&&o.jsx(i.Box,{sx:{width:n?"5rem":"2rem",transition:n?R(s,["width","height"],"entering"):R(s,["width","height"],"leaving"),aspectRatio:1},children:e!=null&&e.name?o.jsx(o.Fragment,{children:o.jsx(i.Avatar,{src:e==null?void 0:e.picture,sx:{width:"100%",height:"100%",bgcolor:me[Math.abs(Pe(e==null?void 0:e.name))%me.length]},children:xe(e==null?void 0:e.name)})}):o.jsx(i.Avatar,{sx:{width:"100%",height:"100%"}})}),r&&o.jsx(i.Box,{sx:{width:n?"5rem":"2rem",transition:n?R(s,["width","height"],"entering"):R(s,["width","height"],"leaving"),aspectRatio:1},children:e!=null&&e.name?o.jsx(o.Fragment,{children:o.jsxs(de.default,{src:e==null?void 0:e.picture,name:e==null?void 0:e.name,round:!0,size:n?"80":"32",children:[" ",xe(e==null?void 0:e.name)," ","ab"]})}):o.jsx(de.default,{})}),o.jsx(jt,{sx:{width:"100%"},in:n,children:o.jsx(i.Fade,{in:n,children:o.jsxs(i.Box,{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",children:[e!=null&&e.name?o.jsx(i.Typography,{children:e==null?void 0:e.name}):o.jsx(i.Skeleton,{animation:!1,width:"50%"}),t?o.jsx(i.Typography,{children:t.toUpperCase()}):o.jsx(i.Skeleton,{animation:!1,width:"25%"})]})})})]})}function It({open:e,widthClosed:t,widthOpen:n,"data-testid":r,top:s,middle:a,bottom:d,user:l,domainCode:c,useNewAvatar:p=!1}){const m=_e(),w=D.useSetAtom(H);return o.jsx(wt,{className:q.root,"data-testid":r,children:o.jsxs(bt,{open:e,widthOpen:n,widthClosed:t,anchor:"left",variant:m?"temporary":"permanent",PaperProps:{component:"nav"},onClose:()=>{w(!1)},isSmallScreen:m,children:[!m&&o.jsx(i.Toolbar,{}),s&&o.jsxs(i.Box,{flexGrow:"0",children:[s,o.jsx(i.Divider,{variant:"middle",sx:{marginY:"0.5rem"}})]}),o.jsx(i.Box,{flexGrow:"1",children:Array.isArray(a)?o.jsx(St,{links:a}):a}),o.jsxs(i.Box,{flexGrow:"0",children:[o.jsx(i.Divider,{variant:"middle",sx:{marginY:"0.5rem"}}),o.jsx(Ft,{user:l,domainCode:c,open:e,useNewAvatar:p}),d&&o.jsx(o.Fragment,{children:d})]})]})})}function Tt({children:e,topBarHeight:t,maxWidth:n=!1,noPadding:r}){return o.jsx(i.Box,{sx:{overflow:"auto",height:`calc(100vh - ${t}px)`,flexGrow:1},children:r?o.jsx(i.Box,{component:"main",id:"main-content",height:"inherit",children:e}):o.jsx(i.Container,{component:"main",id:"main-content",maxWidth:n,sx:{paddingTop:3,paddingBottom:3,flexGrow:1},children:e})})}const Nt="TopBar",$t={titleText:`${Nt}-titleText`};function Lt({titleText:e="",height:t,"data-testid":n,middle:r}){const s=D.useSetAtom(H),a=()=>s(c=>!c),d=i.useTheme(),l=_e();return o.jsx("header",{"data-testid":n,children:o.jsxs(i.Paper,{square:!0,elevation:0,sx:{width:"100%",position:"sticky",color:"primary.contrastText",backgroundColor:"primary.main",display:"flex",alignItems:"center",gap:2,flexShrink:0,height:t,zIndex:l?0:d.zIndex.drawer+101},children:[o.jsx(i.IconButton,{size:"medium",color:"inherit",sx:{padding:1.5,marginLeft:"12px"},onClick:a,children:o.jsx(Y.ViewHeadline,{fontSize:"medium"})}),o.jsx(i.Typography,{className:$t.titleText,variant:"h6",component:"h1",children:e}),r]})})}function Mt({children:e,initialTitleText:t,initialNavBarOpen:n,pageContainerProps:r,pageContentDataTestId:s,topBarDataTestId:a,navBarDataTestId:d,navBarMiddle:l,navBarBottom:c,user:p,domainCode:m,useNewAvatar:w=!1}){Je.useHydrateAtoms([[H,n!=null?n:!0],[K,t!=null?t:""]]);const y=D.useAtomValue(H),[x]=D.useAtom(Fe),[j]=D.useAtom(Ie),k=D.useAtomValue(K),[h]=D.useAtom(Ne),[b]=D.useAtom(Te),[E]=D.useAtom($e);return o.jsxs(ce.default,{children:[o.jsx(we.default,{}),o.jsx(Lt,{titleText:k,"data-testid":a,height:h,middle:b}),o.jsxs(ce.default,{sx:{display:"flex"},children:[o.jsx(It,{open:y,top:E,middle:l,bottom:c,user:p,domainCode:m,widthOpen:x,widthClosed:j,offsetTop:h,"data-testid":d,useNewAvatar:w}),o.jsx(Tt,B(u({"data-testid":s,topBarHeight:h},r),{children:e}))]})]})}const te=({isOpen:e,dialogTitle:t,children:n,maxWidth:r,primaryButton:s,secondaryButton:a,additionalButtons:d,onClose:l,sx:c,"data-testid":p,disableCloseOnBackdropOrEscape:m=!1,isLoading:w=!1})=>{var j,k;const[y,x]=f.useState(!1);return o.jsxs(i.Dialog,{open:e,onClose:(h,b)=>I(null,null,function*(){m&&(b==="backdropClick"||b==="escapeKeyDown")||y||(a!=null&&a.onClick?yield a.onClick():l())}),fullWidth:!0,maxWidth:r!=null?r:"xs","data-testid":p,sx:c,children:[w&&o.jsx(i.LinearProgress,{sx:{height:"4px",marginBottom:"-4px"}}),o.jsx(i.DialogTitle,{children:t}),o.jsx(i.DialogContent,{sx:{"& > :last-child":{marginBottom:0}},children:n}),o.jsxs(i.DialogActions,{children:[o.jsx(i.Button,{onClick:(j=a==null?void 0:a.onClick)!=null?j:l,"data-testid":a==null?void 0:a.testId,disabled:(a==null?void 0:a.disabled)||y,color:a==null?void 0:a.buttonColor,children:(k=a==null?void 0:a.text)!=null?k:"Cancel"}),d&&d.map((h,b)=>{var E;return o.jsx(i.Button,{onClick:h==null?void 0:h.onClick,"data-testid":h==null?void 0:h.testId,disabled:(h==null?void 0:h.disabled)||y,color:h==null?void 0:h.buttonColor,children:(E=h.text)!=null?E:`Button ${b}`},b)}),s&&o.jsx(i.Button,{onClick:()=>I(null,null,function*(){var h;x(!0),yield(h=s.onClick)==null?void 0:h.call(s),x(!1)}),"data-testid":s.testId,disabled:s.disabled||y,color:s==null?void 0:s.buttonColor,children:s.text})]})]})},oe=({minLength:e,preLoadedOptions:t,lookup:n,label:r,inputValue:s})=>Se.useQuery({queryFn:()=>e&&s.length<e?t!=null?t:[]:t?t.filter(a=>a.label.toLowerCase().includes(s.toLowerCase())):n(s),queryKey:["autocomplete",r,s]});function Pt({lookup:e=()=>I(null,null,function*(){}),enableHighlighting:t=!0,onChange:n,minLength:r=0,label:s,value:a,"data-testid":d,sx:l,boxSx:c,textFieldColor:p,textFieldVariant:m="filled",loadingText:w="Loading...",noOptionsText:y="No options",popupIcon:x=o.jsx(Y.ArrowDropDown,{}),error:j=!1,helperText:k="",preLoadedOptions:h=void 0,disablePortal:b=!1,disableIconFlip:E=!1}){const[F,O]=f.useState(""),M=(g,v)=>{const C=a.filter(S=>S.id!==v);n(C,"delete",g)},{data:A,isLoading:_}=oe({inputValue:F,label:s,lookup:e,minLength:r,preLoadedOptions:h}),P=F.length>=r;return o.jsxs("div",{"data-testid":d,children:[o.jsx(i.Autocomplete,{sx:u(u({},l),E?{".MuiAutocomplete-popupIndicatorOpen":{transform:"rotate(0deg)"}}:{}),"data-testid":d?`${d}:Autocomplete`:void 0,disablePortal:b,multiple:!0,getOptionLabel:g=>typeof g=="string"?g:g.label,loading:P?_:!1,options:[...a,...A!=null?A:[]],filterSelectedOptions:!0,includeInputInList:!0,value:a,onChange:(g,v,C)=>{n(v,C,g)},onInputChange:(g,v)=>O(v),noOptionsText:P?y:"Start typing to search",loadingText:w,popupIcon:x,renderInput:g=>o.jsx(i.TextField,B(u({},g),{label:s,fullWidth:!0,variant:m,error:j,helperText:k,InputProps:B(u({},g.InputProps),{endAdornment:o.jsxs(o.Fragment,{children:[_?o.jsx(i.CircularProgress,{color:"inherit",size:20}):null,g.InputProps.endAdornment]})}),"data-testid":d?`${d}:Autocomplete:TextField`:void 0,onKeyDown:v=>{(v.key==="Backspace"||v.key==="Delete")&&v.stopPropagation()},color:p})),renderTags:()=>null,isOptionEqualToValue:(g,v)=>g.id===v.id,renderOption:(g,v,C)=>{if(t){const S=rt.default(v.label,C.inputValue,{insideWords:!0,findAllOccurrences:!0}),G=it.default(v.label,S);return f.createElement("li",B(u({},g),{key:v.id,"data-testid":d?`${d}:Autocomplete:option(${v.id.toString()})`:void 0}),o.jsx("div",{children:G.map((re,We)=>o.jsx("span",{style:{fontWeight:re.highlight?700:400},children:re.text},We))}))}else return f.createElement("li",B(u({},g),{key:v.id,"data-testid":d?`${d}:option(${v.id.toString()})`:void 0}),v.label)}}),a.length>0&&o.jsx(i.Box,{sx:c,children:a.map(g=>o.jsx(i.Chip,{sx:{marginTop:1,marginRight:1,height:"auto"},label:o.jsx(i.Tooltip,{title:g.tooltipContent||"",placement:"bottom-start",PopperProps:{modifiers:[{name:"offset",options:{offset:[115,-15]}}]},children:o.jsx(i.Typography,{style:{whiteSpace:"normal"},children:g.chipLabel?g.chipLabel:g.label})}),"data-testid":d?`${d}:Chip(${g.id.toString()})`:void 0,onDelete:v=>M(v,g.id),deleteIcon:o.jsx(Y.Cancel,{"data-testid":d?`${d}:Chip(${g.id.toString()}):deleteIcon`:void 0})},g.id))})]})}const Rt=/MUI: The value provided to.*is invalid/i,Ot=({lookup:e=()=>I(null,null,function*(){}),onChange:t,label:n,value:r,sx:s,textFieldColor:a,textFieldVariant:d="filled",error:l=!1,"data-testid":c,noOptionsText:p="No options",minLength:m=3,disablePortal:w=!1,preLoadedOptions:y,helperText:x="",disabled:j,popupIcon:k,disableIconFlip:h})=>{const[b,E]=f.useState(""),{data:F,isLoading:O}=oe({inputValue:b,label:n,lookup:e,minLength:m!=null?m:0,preLoadedOptions:y}),M=b.length>=m;return o.jsx("div",{"data-testid":c,children:o.jsx(i.Stack,{direction:"row",spacing:1,children:o.jsx(i.Autocomplete,{sx:u(u({},s),h?{".MuiAutocomplete-popupIndicatorOpen":{transform:"rotate(0deg)"}}:{}),"data-testid":c?`${c}:Autocomplete`:void 0,loading:M?O:!1,options:F!=null?F:[],onChange:(A,_,P)=>{t(A,_,P)},disablePortal:w,filterOptions:A=>A,value:r,noOptionsText:M?p:"Start typing to search",getOptionLabel:A=>A.label,popupIcon:k,renderInput:A=>o.jsx(i.TextField,B(u({"data-testid":c?`${c}:Autocomplete:TextField`:void 0},A),{variant:d,label:n,color:a,error:l,helperText:x})),isOptionEqualToValue:(A,_)=>A.id===_.id,onInputChange:(A,_)=>{E(_)},renderOption:(A,_)=>f.createElement("li",B(u({},A),{key:_.id,"data-testid":c?`${c}:Autocomplete:option(${_.id.toString()})`:void 0}),_.label),disabled:j})})})},Re=e=>{if(!e)return-1;try{const n=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(ot.Buffer.from(n,"base64").toString("utf8").split("").map(function(a){return"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)}).join("")),s=JSON.parse(r);return s!=null&&s.exp?s.exp:-1}catch(t){return-1}},qt=({open:e=!1,closeHandler:t,setAuth0ExpiryTime:n})=>{const{logout:r,getAccessTokenSilently:s}=J.useAuth0(),[a,d]=f.useState(0),l=()=>I(null,null,function*(){r({logoutParams:{returnTo:`${window.location.origin}`}})}),c=()=>I(null,null,function*(){d(a+1),t()});f.useEffect(()=>{I(null,null,function*(){if(a>0){const y=yield s({cacheMode:"off"}),x=Re(y)*1e3;n(x)}})},[a,s,n]);const p={text:"Continue",onClick:c,disabled:!1,testId:"PreferencesDialog",buttonColor:"secondary"},m={text:"Log out",onClick:l,disabled:!1,testId:"PreferencesDialog",buttonColor:"secondary"};return o.jsx(te,{isOpen:e,primaryButton:p,secondaryButton:m,onClose:t,dialogTitle:"Session expiry",disableCloseOnBackdropOrEscape:!0,children:o.jsx("p",{style:{marginBottom:0},children:"Your session is about to time out due to inactivity. Do you want to continue?"})})};function Ht(e){return"error"in e}function Ut(e){var r;const t=e.error,n=(r=e==null?void 0:e.error_description)!=null?r:"";return t==="access_denied"&&n.startsWith("You do not have the required authorization")}function Wt(e){var r;const t=e.error,n=(r=e==null?void 0:e.error_description)!=null?r:"";return t==="access_denied"&&n.startsWith("User did not authorize the request")}function Vt(e){var r;const t=e.error,n=(r=e==null?void 0:e.error_description)!=null?r:"";return t==="access_denied"&&n.match(/Script.*time.*exceeded/)}function zt({children:e,appName:t="the app",throwErrors:n="none",disableConsoleLogging:r=!1,onError:s=()=>{}}){var w,y;const{isAuthenticated:a,isLoading:d,error:l,loginWithRedirect:c,logout:p}=J.useAuth0();f.useEffect(()=>{l&&s(l)},[l,s]);const m=f.useMemo(()=>({appState:{returnTo:`${window.location.pathname}${window.location.search}`}}),[]);if(f.useEffect(()=>{d||a||l||c(m)},[d,a,l,c,s,m]),l){if(r||console.error(`Error detected in AuthGuard [isAuthenticated=${a},isLoading=${d}]`,l),n==="all")throw l;if(Ht(l)){let x="Auth error",j="An unknown Auth0 error occurred.";if(Ut(l))x="Unauthorised",j=`You are not authorised to access ${t}.`;else if(Wt(l))x="App not authorised",j=`You have not authorised ${t} to access your user profile. This is necessary to use ${t}.`;else if(Vt(l))x="Auth0 script execution time exceeded",j="The Auth0 login flow exceeded the time limit (20s). Try again in a minute by clicking the RELOAD button below.";else if(l.message==="Invalid state"){const k=localStorage.getItem("auth0_redirect_count");k?k&&parseInt(k)<2&&(localStorage.setItem("auth0_redirect_count",String(parseInt(k)+1)),c(m)):(localStorage.setItem("auth0_redirect_count","1"),c(m))}else if(n==="unknown")throw l;return o.jsxs(i.Dialog,{open:!0,children:[o.jsx(i.DialogTitle,{children:x}),o.jsxs(i.DialogContent,{children:[o.jsx(i.Typography,{children:j}),o.jsx("br",{}),o.jsx(i.Typography,{variant:"subtitle2",children:"Details from Auth0"}),o.jsxs(i.Typography,{variant:"body2",children:["error: ",(w=l==null?void 0:l.error)!=null?w:"N/A"]}),o.jsxs(i.Typography,{variant:"body2",children:["description: ",(y=l==null?void 0:l.error_description)!=null?y:"N/A"]})]}),o.jsxs(i.DialogActions,{children:[x==="Auth0 script execution time exceeded"&&o.jsx(i.Button,{href:window.location.origin+window.location.pathname,children:"Reload"}),o.jsx(i.Button,{onClick:()=>p({logoutParams:{returnTo:window.location.origin}}),children:"Logout"})]})]})}else if(n==="unknown")throw l}return a?(localStorage.removeItem("auth0_redirect_count"),o.jsx(o.Fragment,{children:e})):o.jsx(st.default,{variant:"rectangular",animation:"pulse",height:"100vh",width:"100vw"})}const Gt={autoHideDuration:6e3,anchorOrigin:{vertical:"top",horizontal:"center"},disableWindowBlurListener:!1},Xt={shouldClose:(e,t)=>t!=="clickaway"},fe={message:"",severity:"info",variant:"standard",progressIndicator:void 0},Ae=100,ve=2e3,Yt=2e3,Kt=(()=>{let e=0;return()=>(e+=1,e)})(),Qt={borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},Jt={},Zt={},ne=f.createContext(null);function Oe(a){var d=a,{overrideState:e=Jt,overrideActions:t=Zt,shouldClose:n=Xt.shouldClose,children:r}=d,s=ae(d,["overrideState","overrideActions","shouldClose","children"]);var v;const[{open:l},c]=f.useState({open:!1}),p=f.useRef([]),m=f.useRef(Date.now()),w=f.useRef(0),y=f.useCallback(C=>{c({open:C})},[]),x=f.useCallback((C={})=>{w.current+=1,p.current.length>=Ae&&Date.now()-m.current>=ve&&(m.current=Date.now(),console.error(`SaladBarProvider: MAX_QUEUE_LENGTH (${Ae}) hit ${w.current} times in last ${ve}ms)`),w.current=0);const S=u(B(u({},fe),{key:Kt()}),C);return p.current.push(S),p.current.length===1&&c({open:!0}),S.key},[]),j=(C="",S={})=>x(u({message:C,severity:"success"},S)),k=(C="",S={})=>x(u({message:C,severity:"info"},S)),h=(C="",S={})=>x(u({message:C,severity:"warning"},S)),b=(C="",S={})=>x(u({message:C,severity:"error"},S)),E=C=>{const S=p.current.findIndex(G=>G.key===C);if(S!==-1)return S===0?(c({open:!1}),p.current[0]):p.current.splice(S,1)},F=(C,S)=>{n(C,S)&&c({open:!1})},O=()=>{},M=()=>{p.current.shift(),p.current.length>0&&c({open:!0})},A=(v=p.current[0])!=null?v:u({},fe),_={};"autoHideDuration"in A&&(_.autoHideDuration=A.autoHideDuration);const P=u(u({},Gt),s),g=u(u({open:l,setOpen:y,enqueueNotification:x,enqueueSuccessNotification:j,enqueueInfoNotification:k,enqueueWarningNotification:h,enqueueErrorNotification:b,removeNotification:E},e),t);return o.jsxs(ne.Provider,{value:g,children:[r,o.jsx(i.Snackbar,B(u(u({},P),_),{open:l,onClose:F,TransitionProps:{onExited:M,onExit:O},sx:{zIndex:Yt},children:o.jsxs("div",{children:[o.jsx(i.Alert,{onClose:C=>F(C,"closeAlert"),severity:A.severity,variant:"filled",icon:A.progressIndicator==="circular"?o.jsx(i.CircularProgress,{size:"1em"}):void 0,style:A.progressIndicator==="linear"?Qt:void 0,children:A.message}),A.progressIndicator==="linear"&&o.jsx(i.LinearProgress,{color:"primary"})]})}))]})}function qe(){const e=f.useContext(ne);if(e===null)throw new z("Error: Tried to useSaladBar outside of a <SaladBarProvider>");return e}const eo=Q.createHelper((e={autoHideDuration:1},t={},n={})=>({children:r})=>o.jsx(Oe,B(u({},e),{overrideState:t,overrideActions:n,children:o.jsx(o.Fragment,{children:r})}))),He="domainCode";var ye;const Ce=D.atom(JSON.parse((ye=localStorage.getItem(He))!=null?ye:'{"domainCode": ""}').domainCode),Ue=D.atom(e=>e(Ce),(e,t,n)=>{t(Ce,n),localStorage.setItem(He,JSON.stringify({domainCode:n}))}),to={act:"ACT",nsw:"NSW",nt:"NT",qld:"QLD",sa:"SA",tas:"TAS",vic:"VIC",wa:"WA",ag:"AG",fedmps:"Fedmps","":""},oo=e=>{var t;return e===null?"N/A":(t=to[e])!=null?t:""},no=({isLoading:e,isOpen:t,onClose:n,onDomainChange:r,domainOptions:s,applicationName:a,handleLogout:d})=>{const[l,c]=D.useAtom(Ue),[p,m]=f.useState(l),{enqueueSuccessNotification:w}=qe(),y=s.length===0,x=!!l&&!s.includes(l)&&!s.includes(p),j=!l||y||x,k=()=>I(null,null,function*(){p?(c(p),r==null||r(p),w(`Set organisation to ${p}`),n()):(c(""),r==null||r(""))}),h=()=>I(null,null,function*(){l&&!y&&!x?(m(l),n()):j&&d()});let b;return y?b="Unable to retrieve your active organisations. Try logging in again.":x&&(b="You no longer have any roles in your chosen organisation. Please choose another."),o.jsxs(te,{isOpen:t,dialogTitle:"Select an organisation",primaryButton:{text:"Confirm",onClick:k,disabled:!p||y||x,buttonColor:"primary"},secondaryButton:{text:j?"Logout":"Cancel",onClick:h},onClose:j?()=>{}:n,children:[o.jsxs(i.Typography,{marginBottom:2,children:["Select the default organisation that you want to use with the ",a,"."]}),o.jsx(i.Autocomplete,{loading:e,multiple:!1,disableClearable:!1,value:p!==""?p:null,onChange:(E,F)=>m(F!=null?F:""),getOptionLabel:oo,options:[...s],renderInput:E=>o.jsx(i.TextField,B(u({},E),{variant:"filled",label:"Select organisation",InputProps:B(u({},E.InputProps),{endAdornment:o.jsxs(o.Fragment,{children:[e?o.jsx(i.CircularProgress,{color:"inherit",size:20,sx:{marginTop:"-20px"}}):null,E.InputProps.endAdornment]})})}))}),b&&o.jsx(i.FormHelperText,{error:!0,children:b})]})},ro=T.createTheme({palette:{primary:{dark:"#00A651",light:"#A3D39C",main:"#007236",contrastText:"#FFF"},warning:{main:"#F5871F",light:"#FCC589",dark:"#A2590A",contrastText:"#FFF"},secondary:{main:"#662D91",light:"#BD8CBF",dark:"#440E62",contrastText:"#FFF"},error:{main:"#D43C95",light:"#8F2064",dark:"#F9CDE0",contrastText:"#FFF"},info:{main:"#00A88D",light:"#ADDCCF",dark:"#005243",contrastText:"#FFF"},success:{main:"#00A651",light:"#A3D39C",dark:"#007236",contrastText:"#FFF"}},typography:{explainer:{fontSize:"14px",marginBlockStart:"1em"}},navBar:{backgroundColor:"#E8E8E8"}}),io=T.createTheme({palette:{primary:{main:"#007236",dark:"#005221",light:"#00A04E",contrastText:"#FFFFFF"},secondary:{main:"#662D91",dark:"#440E62",light:"#93268F",contrastText:"#FFFFFF"},error:{main:"#D32F2F",dark:"#C62828",light:"#EF5350"},info:{main:"#0288D1",dark:"#01579B",light:"#03A9F4"},success:{main:"#0288D1",dark:"#01579B",light:"#03A9F4"}},components:{MuiTextField:{defaultProps:{color:"secondary"}},MuiToggleButtonGroup:{defaultProps:{color:"secondary"}},MuiCheckbox:{defaultProps:{color:"secondary"}},MuiSelect:{defaultProps:{color:"secondary"}},MuiSwitch:{defaultProps:{color:"secondary"}},MuiFormControl:{defaultProps:{color:"secondary"}},MuiMenuItem:{styleOverrides:{root:({theme:e})=>({"&.Mui-selected":{backgroundColor:T.alpha(e.palette.secondary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:T.alpha(e.palette.secondary.main,e.palette.action.selectedOpacity)},"&.Mui-focusVisible":{backgroundColor:T.alpha(e.palette.secondary.main,e.palette.action.focusOpacity)}}})}}},typography:{h4:{fontSize:"1.88rem",fontWeight:500},h5:{fontWeight:500},explainer:{fontSize:"14px",marginBlockStart:"1em"}},navBar:{backgroundColor:"#E8E8E8"}});exports.AgDialog=te;exports.AppLayout=Mt;exports.AuthGuard=zt;exports.Context=ne;exports.ContextError=z;exports.DomainCodeDialog=no;exports.ExampleComponent=at;exports.FetchAutocomplete=Pt;exports.MUI_AUTOCOMPLETE_VALUE_WARNING_REGEX=Rt;exports.NAVBAR_WIDTH_CLOSED=ee;exports.NAVBAR_WIDTH_OPENED=Z;exports.NavBar=At;exports.NavBarDarkStyledList=xt;exports.NavBarLightStyledList=ft;exports.NavBarProvider=ke;exports.SaladBarProvider=Oe;exports.SessionExpiryDialog=qt;exports.SingleAutocomplete=Ot;exports.buildNavBarState=Ee;exports.determineUserLevelFromClaims=Dt;exports.domainCodeAtom=Ue;exports.fed21Theme=ro;exports.getAuth0Expiry=Re;exports.getValidBusinessRoles=Bt;exports.internalAgSystemsTheme=io;exports.navBarClasses=$;exports.navBarOpenAtom=H;exports.navBarTopAtom=$e;exports.navBarWidthClosedAtom=Ie;exports.navBarWidthOpenAtom=Fe;exports.simpleHashCode=Pe;exports.suppressConsole=Et;exports.titleTextAtom=K;exports.topBarHeightAtom=Ne;exports.topBarMiddleAtom=Te;exports.unsuppressConsole=_t;exports.useAutocompleteOptions=oe;exports.useNavBar=Be;exports.useSaladBar=qe;exports.useValidDomains=kt;exports.withBrowserRouter=mt;exports.withNavBarProvider=gt;exports.withSaladBarProvider=eo;
|
|
1
|
+
"use strict";var Ve=Object.defineProperty,ze=Object.defineProperties;var Ge=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var X=(e,t,n)=>t in e?Ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u=(e,t)=>{for(var n in t||(t={}))ie.call(t,n)&&X(e,n,t[n]);if(U)for(var n of U(t))se.call(t,n)&&X(e,n,t[n]);return e},B=(e,t)=>ze(e,Ge(t));var ae=(e,t)=>{var n={};for(var r in e)ie.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&U)for(var r of U(e))t.indexOf(r)<0&&se.call(e,r)&&(n[r]=e[r]);return n};var le=(e,t,n)=>X(e,typeof t!="symbol"?t+"":t,n);var I=(e,t,n)=>new Promise((r,s)=>{var a=c=>{try{l(n.next(c))}catch(p){s(p)}},d=c=>{try{l(n.throw(c))}catch(p){s(p)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,d);l((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),f=require("react"),i=require("@mui/material"),Xe=require("@mui/material/CssBaseline"),T=require("@mui/material/styles"),Q=require("souvlaki"),Ye=require("react-router"),Ke=require("@mui/material/List"),Y=require("@mui/icons-material"),k=require("jotai"),Qe=require("@mui/material/Box"),Je=require("jotai/utils"),Ze=require("react-avatar"),J=require("@auth0/auth0-react"),Se=require("@tanstack/react-query"),et=require("autosuggest-highlight/match"),tt=require("autosuggest-highlight/parse"),ot=require("buffer"),nt=require("@mui/material/Skeleton"),L=e=>e&&e.__esModule?e:{default:e},we=L(Xe),je=L(Ke),ce=L(Qe),de=L(Ze),rt=L(et),it=L(tt),st=L(nt);function at({text:e}){const[t,n]=f.useState(0);return o.jsxs(o.Fragment,{children:[o.jsx(i.Typography,{variant:"h6",color:"inherit",component:"div",sx:{fontSize:"22px"},children:"Hello world"}),o.jsx(i.Typography,{variant:"caption",display:"block",children:o.jsx("span",{children:"Just ensuring MUI is working as planned as a peer dependency. v0.0.11"})}),o.jsx(i.Button,{variant:"outlined",onClick:()=>n(r=>r+1),"aria-label":"Increment",children:"Hello I am a button"}),o.jsxs("p",{children:["This is some text: ",o.jsx("span",{children:e})]}),o.jsxs(i.Paper,{children:["This number will incremember when button pressed: ",t]})]})}const Z=330,ee=73,N="Navbar",$={root:`${N}-root`,menuButton:`${N}-menuButton`,hide:`${N}-hide`,content:`${N}-content`,userInfoHolder:`${N}-userInfoHolder`,settings:`${N}-settings`,pieChartIcon:`${N}-pieChartIcon`},lt=T.styled(i.Box,{name:"NavBar"})(({theme:e})=>({[`&.${$.root}`]:{display:"flex"},[`& .${$.menuButton}`]:{marginRight:36},[`& .${$.hide}`]:{display:"none"},[`& .${$.content}`]:{flexGrow:1,padding:e.spacing(3)},[`& .${$.userInfoHolder}`]:{height:"148px",marginTop:"64px",marginBottom:"16px"}})),be=()=>({position:"absolute",height:"100%",overflowX:"hidden",overflowY:"hidden",color:"white",backgroundColor:"black"}),ct=()=>u({width:Z},be()),dt=()=>u({width:ee},be()),ut=T.styled(i.Drawer,{shouldForwardProp:e=>e!=="open"})(({theme:e,open:t})=>u(u({width:t?Z:ee,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",zIndex:e.zIndex.drawer+100},t&&{"& .MuiDrawer-paper":ct()}),!t&&{"& .MuiDrawer-paper":dt()}));class z extends Error{}le(z,"errorName","ContextError");const ke=f.createContext(null),pt={},ht={},De=({overrideState:e=pt,overrideActions:t=ht,children:n})=>{const[{open:r},s]=f.useState({open:!0}),a=f.useCallback(c=>{s({open:c})},[]),d=f.useCallback(()=>{s(c=>B(u({},c),{open:!c.open}))},[]),l=u(u({open:r,setOpen:a,toggleOpen:d},e),t);return o.jsx(ke.Provider,{value:l,children:n})},Be=()=>{const e=f.useContext(ke);if(e===null)throw new z("Error: Tried to useNavBar outside of a <NavBarProvider>");return e},Ee=(e={})=>u({open:!0},e),gt=Q.createHelper((e=Ee(),t={})=>({children:n})=>o.jsx(De,{overrideState:e,overrideActions:t,children:n})),xt=Q.createHelper(()=>({children:e})=>o.jsx(Ye.BrowserRouter,{children:e})),ue=7,mt=T.styled(je.default)(({theme:e})=>({backgroundColor:"black",color:"white","& .MuiListItem-root":{padding:"unset"},"& .MuiListItemButton-root":{" .MuiListItemIcon-root":{color:"white",padding:`${ue}px`},"&.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected":{borderLeftStyle:"solid",borderLeftWidth:"7px",borderLeftColor:e.palette.primary.main,paddingLeft:`calc(${e.spacing(2)} - ${ue}px)`},"&:hover":{backgroundColor:e.palette.primary.dark},"&.Mui-selected.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected:hover":{backgroundColor:e.palette.primary.dark}}})),pe=7,ft=T.styled(je.default)(({theme:e})=>({backgroundColor:"#e8e8e8",color:"inherit","& .MuiListItem-root":{padding:"unset"},"& .MuiListItemButton-root":{" .MuiListItemIcon-root":{color:"inherit",padding:`${pe}px`},"&.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected":{borderLeftStyle:"solid",borderLeftWidth:"7px",borderLeftColor:e.palette.primary.main,paddingLeft:`calc(${e.spacing(2)} - ${pe}px)`},"&:hover":{backgroundColor:e.palette.primary.dark},"&.Mui-selected.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected:hover":{backgroundColor:e.palette.primary.dark}}}));function At({"data-testid":e,children:t}){const{open:n}=Be();return o.jsxs(lt,{className:$.root,"data-testid":e,children:[o.jsx(we.default,{}),o.jsx(ut,{variant:"permanent",anchor:"left",transitionDuration:null,open:n,children:t})]})}const _e=()=>{const e=i.useTheme();return i.useMediaQuery(e.breakpoints.down("sm"))},vt=64,Ct=72,yt=256,H=k.atom(!0),Fe=k.atom(yt),Ie=k.atom(Ct),K=k.atom(""),Te=k.atom(void 0),Ne=k.atom(vt),$e=k.atom(void 0);function St({links:e}){return o.jsx("div",{children:"LinksMenu not implemented yet"})}const W="Navbar",q={root:`${W}-root`,menuButton:`${W}-menuButton`,hide:`${W}-hide`,content:`${W}-content`},wt=T.styled(i.Box,{name:"NavBar"})(({theme:e})=>({[`&.${q.root}`]:{display:"flex"},[`& .${q.menuButton}`]:{marginRight:36},[`& .${q.hide}`]:{display:"none"},[`& .${q.content}`]:{flexGrow:1,padding:e.spacing(3)}})),R=(e,t,n)=>e.transitions.create(t,{easing:e.transitions.easing.sharp,duration:n==="leaving"?e.transitions.duration.leavingScreen:e.transitions.duration.enteringScreen}),jt=e=>{const t=i.useTheme();return o.jsx(i.Collapse,u({easing:t.transitions.easing.sharp,timeout:{enter:t.transitions.duration.enteringScreen,exit:t.transitions.duration.leavingScreen}},e))},Le=e=>{var t,n;return{overflowX:"hidden",color:"inherit",backgroundColor:(n=(t=e==null?void 0:e.navBar)==null?void 0:t.backgroundColor)!=null?n:"white"}},he=(e,t)=>u({width:t,transition:R(e,"width","entering")},Le(e)),ge=(e,t)=>u({width:t,transition:R(e,"width","leaving")},Le(e)),bt=T.styled(i.Drawer,{shouldForwardProp:e=>!["widthOpen","widthClosed","isSmallScreen"].includes(e)})(({theme:e,open:t,widthOpen:n,widthClosed:r,isSmallScreen:s})=>u(u({flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",display:"flex",flexDirection:"column"},t&&B(u({},he(e,n)),{backgroundColor:"","& .MuiDrawer-paper":he(e,n)})),!t&&B(u({},ge(e,s?n:r)),{backgroundColor:"","& .MuiDrawer-paper":ge(e,s?n:r)})));function Me(e){return e.replace(/(^|-)([a-z])/g,(t,n,r)=>n==="-"?" "+r.toUpperCase():r.toUpperCase())}function kt(e,t,n,r){var d;if(!e)return"None";const a=Object.entries(e).filter(([l,c])=>l.startsWith("https://greens.org.au/roles/")&&c.includes(t)).map(([l])=>{var c;return Me((c=l.split("/").at(-1))!=null?c:"")});return(d=r.find(l=>n[l].some(c=>a.includes(c))))!=null?d:"None"}const Dt=e=>{const{getIdTokenClaims:t,user:n}=J.useAuth0();return Se.useQuery({queryKey:["availableDomains",n==null?void 0:n.sub],queryFn:()=>I(null,null,function*(){const r=yield t();return r?Object.entries(r).reduce((s,[a,d])=>{var p;const l=Me((p=a.split("/").at(-1))!=null?p:""),c=a.startsWith("https://greens.org.au/roles/")&&e.includes(l)?d:[];return[...new Set([...s,...c])]},[]):[]})})},Bt=e=>Object.values(e).reduce((t,n)=>[...new Set([...t,...n])],[]),V={log:console.warn.bind(console),error:console.error.bind(console),warn:console.warn.bind(console),info:console.info.bind(console),debug:console.debug.bind(console)};function Et(e,t){console[e]=(...n)=>{for(const r of t)if(typeof r=="function"){if(r(...n))return}else if(r instanceof RegExp&&n.length>0){for(const s of n)if(typeof s=="string"&&r.test(s))return}V[e](n)}}function _t(e){if(e)console[e]=V[e];else for(const t of Object.keys(V))console[t]=V[t]}function Pe(e){let t=0;for(let n=0,r=e.length;n<r;n++){const s=e.charCodeAt(n);t=(t<<5)-t+s,t|=0}return t}const xe=["#A62A21","#7e3794","#0B51C1","#3A6024","#A81563","#B3003C"],me=e=>e.split(/\s/).map(t=>t.substring(0,1).toUpperCase()).filter(t=>!!t).slice(0,2).join("").toUpperCase();function Ft({user:e,domainCode:t,open:n,useNewAvatar:r=!1}){const s=i.useTheme();return o.jsxs(i.Box,{sx:{paddingTop:3,display:"flex",alignItems:"center",flexDirection:"column",gap:"0.5rem"},children:[!r&&o.jsx(i.Box,{sx:{width:n?"5rem":"2rem",transition:n?R(s,["width","height"],"entering"):R(s,["width","height"],"leaving"),aspectRatio:1},children:e!=null&&e.name?o.jsx(o.Fragment,{children:o.jsx(i.Avatar,{src:e==null?void 0:e.picture,sx:{width:"100%",height:"100%",bgcolor:xe[Math.abs(Pe(e==null?void 0:e.name))%xe.length]},children:me(e==null?void 0:e.name)})}):o.jsx(i.Avatar,{sx:{width:"100%",height:"100%"}})}),r&&o.jsx(i.Box,{sx:{width:n?"5rem":"2rem",transition:n?R(s,["width","height"],"entering"):R(s,["width","height"],"leaving"),aspectRatio:1},children:e!=null&&e.name?o.jsx(o.Fragment,{children:o.jsxs(de.default,{src:e==null?void 0:e.picture,name:e==null?void 0:e.name,round:!0,size:n?"80":"32",children:[" ",me(e==null?void 0:e.name)," ","ab"]})}):o.jsx(de.default,{})}),o.jsx(jt,{sx:{width:"100%"},in:n,children:o.jsx(i.Fade,{in:n,children:o.jsxs(i.Box,{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",children:[e!=null&&e.name?o.jsx(i.Typography,{children:e==null?void 0:e.name}):o.jsx(i.Skeleton,{animation:!1,width:"50%"}),t?o.jsx(i.Typography,{children:t.toUpperCase()}):o.jsx(i.Skeleton,{animation:!1,width:"25%"})]})})})]})}function It({open:e,widthClosed:t,widthOpen:n,"data-testid":r,top:s,middle:a,bottom:d,user:l,domainCode:c,useNewAvatar:p=!1}){const x=_e(),w=k.useSetAtom(H);return o.jsx(wt,{className:q.root,"data-testid":r,children:o.jsxs(bt,{open:e,widthOpen:n,widthClosed:t,anchor:"left",variant:x?"temporary":"permanent",PaperProps:{component:"nav"},onClose:()=>{w(!1)},isSmallScreen:x,children:[!x&&o.jsx(i.Toolbar,{}),s&&o.jsxs(i.Box,{flexGrow:"0",children:[s,o.jsx(i.Divider,{variant:"middle",sx:{marginY:"0.5rem"}})]}),o.jsx(i.Box,{flexGrow:"1",children:Array.isArray(a)?o.jsx(St,{links:a}):a}),o.jsxs(i.Box,{flexGrow:"0",children:[o.jsx(i.Divider,{variant:"middle",sx:{marginY:"0.5rem"}}),o.jsx(Ft,{user:l,domainCode:c,open:e,useNewAvatar:p}),d&&o.jsx(o.Fragment,{children:d})]})]})})}function Tt({children:e,topBarHeight:t,maxWidth:n=!1,noPadding:r}){return o.jsx(i.Box,{sx:{overflow:"auto",height:`calc(100vh - ${t}px)`,flexGrow:1},children:r?o.jsx(i.Box,{component:"main",id:"main-content",height:"inherit",children:e}):o.jsx(i.Container,{component:"main",id:"main-content",maxWidth:n,sx:{paddingTop:3,paddingBottom:3,flexGrow:1},children:e})})}const Nt="TopBar",$t={titleText:`${Nt}-titleText`};function Lt({titleText:e="",height:t,"data-testid":n,middle:r}){const s=k.useSetAtom(H),a=()=>s(c=>!c),d=i.useTheme(),l=_e();return o.jsx("header",{"data-testid":n,children:o.jsxs(i.Paper,{square:!0,elevation:0,sx:{width:"100%",position:"sticky",color:"primary.contrastText",backgroundColor:"primary.main",display:"flex",alignItems:"center",gap:2,flexShrink:0,height:t,zIndex:l?0:d.zIndex.drawer+101},children:[o.jsx(i.IconButton,{size:"medium",color:"inherit",sx:{padding:1.5,marginLeft:"12px"},onClick:a,children:o.jsx(Y.ViewHeadline,{fontSize:"medium"})}),o.jsx(i.Typography,{className:$t.titleText,variant:"h6",component:"h1",children:e}),r]})})}function Mt({children:e,initialTitleText:t,initialNavBarOpen:n,pageContainerProps:r,pageContentDataTestId:s,topBarDataTestId:a,navBarDataTestId:d,navBarMiddle:l,navBarBottom:c,user:p,domainCode:x,useNewAvatar:w=!1}){Je.useHydrateAtoms([[H,n!=null?n:!0],[K,t!=null?t:""]]);const y=k.useAtomValue(H),[m]=k.useAtom(Fe),[j]=k.useAtom(Ie),D=k.useAtomValue(K),[h]=k.useAtom(Ne),[b]=k.useAtom(Te),[E]=k.useAtom($e);return o.jsxs(ce.default,{children:[o.jsx(we.default,{}),o.jsx(Lt,{titleText:D,"data-testid":a,height:h,middle:b}),o.jsxs(ce.default,{sx:{display:"flex"},children:[o.jsx(It,{open:y,top:E,middle:l,bottom:c,user:p,domainCode:x,widthOpen:m,widthClosed:j,offsetTop:h,"data-testid":d,useNewAvatar:w}),o.jsx(Tt,B(u({"data-testid":s,topBarHeight:h},r),{children:e}))]})]})}const te=({isOpen:e,dialogTitle:t,children:n,maxWidth:r,primaryButton:s,secondaryButton:a,additionalButtons:d,onClose:l,sx:c,"data-testid":p,disableCloseOnBackdropOrEscape:x=!1,isLoading:w=!1})=>{var j,D;const[y,m]=f.useState(!1);return o.jsxs(i.Dialog,{open:e,onClose:(h,b)=>I(null,null,function*(){x&&(b==="backdropClick"||b==="escapeKeyDown")||y||(a!=null&&a.onClick?yield a.onClick():l())}),fullWidth:!0,maxWidth:r!=null?r:"xs","data-testid":p,sx:c,children:[w&&o.jsx(i.LinearProgress,{sx:{height:"4px",marginBottom:"-4px"}}),o.jsx(i.DialogTitle,{children:t}),o.jsx(i.DialogContent,{sx:{"& > :last-child":{marginBottom:0}},children:n}),o.jsxs(i.DialogActions,{children:[o.jsx(i.Button,{onClick:(j=a==null?void 0:a.onClick)!=null?j:l,"data-testid":a==null?void 0:a.testId,disabled:(a==null?void 0:a.disabled)||y,color:a==null?void 0:a.buttonColor,children:(D=a==null?void 0:a.text)!=null?D:"Cancel"}),d&&d.map((h,b)=>{var E;return o.jsx(i.Button,{onClick:h==null?void 0:h.onClick,"data-testid":h==null?void 0:h.testId,disabled:(h==null?void 0:h.disabled)||y,color:h==null?void 0:h.buttonColor,children:(E=h.text)!=null?E:`Button ${b}`},b)}),s&&o.jsx(i.Button,{onClick:()=>I(null,null,function*(){var h;m(!0),yield(h=s.onClick)==null?void 0:h.call(s),m(!1)}),"data-testid":s.testId,disabled:s.disabled||y,color:s==null?void 0:s.buttonColor,children:s.text})]})]})},oe=({minLength:e,preLoadedOptions:t,lookup:n,label:r,inputValue:s})=>Se.useQuery({queryFn:()=>e&&s.length<e?t!=null?t:[]:t?t.filter(a=>a.label.toLowerCase().includes(s.toLowerCase())):n(s),queryKey:["autocomplete",r,s]});function Pt({lookup:e=()=>I(null,null,function*(){}),enableHighlighting:t=!0,onChange:n,minLength:r=0,label:s,value:a,"data-testid":d,sx:l,boxSx:c,textFieldColor:p,textFieldVariant:x="filled",loadingText:w="Loading...",noOptionsText:y="No options",popupIcon:m=o.jsx(Y.ArrowDropDown,{}),error:j=!1,helperText:D="",preLoadedOptions:h=void 0,disablePortal:b=!1,disableIconFlip:E=!1}){const[F,O]=f.useState(""),M=(g,v)=>{const C=a.filter(S=>S.id!==v);n(C,"delete",g)},{data:A,isLoading:_}=oe({inputValue:F,label:s,lookup:e,minLength:r,preLoadedOptions:h}),P=F.length>=r;return o.jsxs("div",{"data-testid":d,children:[o.jsx(i.Autocomplete,{sx:u(u({},l),E?{".MuiAutocomplete-popupIndicatorOpen":{transform:"rotate(0deg)"}}:{}),"data-testid":d?`${d}:Autocomplete`:void 0,disablePortal:b,multiple:!0,getOptionLabel:g=>typeof g=="string"?g:g.label,loading:P?_:!1,options:[...a,...A!=null?A:[]],filterSelectedOptions:!0,includeInputInList:!0,value:a,onChange:(g,v,C)=>{n(v,C,g)},onInputChange:(g,v)=>O(v),noOptionsText:P?y:"Start typing to search",loadingText:w,popupIcon:m,renderInput:g=>o.jsx(i.TextField,B(u({},g),{label:s,fullWidth:!0,variant:x,error:j,helperText:D,InputProps:B(u({},g.InputProps),{endAdornment:o.jsxs(o.Fragment,{children:[_?o.jsx(i.CircularProgress,{color:"inherit",size:20}):null,g.InputProps.endAdornment]})}),"data-testid":d?`${d}:Autocomplete:TextField`:void 0,onKeyDown:v=>{(v.key==="Backspace"||v.key==="Delete")&&v.stopPropagation()},color:p})),renderTags:()=>null,isOptionEqualToValue:(g,v)=>g.id===v.id,renderOption:(g,v,C)=>{if(t){const S=rt.default(v.label,C.inputValue,{insideWords:!0,findAllOccurrences:!0}),G=it.default(v.label,S);return f.createElement("li",B(u({},g),{key:v.id,"data-testid":d?`${d}:Autocomplete:option(${v.id.toString()})`:void 0}),o.jsx("div",{children:G.map((re,We)=>o.jsx("span",{style:{fontWeight:re.highlight?700:400},children:re.text},We))}))}else return f.createElement("li",B(u({},g),{key:v.id,"data-testid":d?`${d}:option(${v.id.toString()})`:void 0}),v.label)}}),a.length>0&&o.jsx(i.Box,{sx:c,children:a.map(g=>o.jsx(i.Chip,{sx:{marginTop:1,marginRight:1,height:"auto"},label:o.jsx(i.Tooltip,{title:g.tooltipContent||"",placement:"bottom-start",PopperProps:{modifiers:[{name:"offset",options:{offset:[115,-15]}}]},children:o.jsx(i.Typography,{style:{whiteSpace:"normal"},children:g.chipLabel?g.chipLabel:g.label})}),"data-testid":d?`${d}:Chip(${g.id.toString()})`:void 0,onDelete:v=>M(v,g.id),deleteIcon:o.jsx(Y.Cancel,{"data-testid":d?`${d}:Chip(${g.id.toString()}):deleteIcon`:void 0})},g.id))})]})}const Rt=/MUI: The value provided to.*is invalid/i,Ot=({lookup:e=()=>I(null,null,function*(){}),onChange:t,label:n,value:r,sx:s,textFieldColor:a,textFieldVariant:d="filled",error:l=!1,"data-testid":c,noOptionsText:p="No options",minLength:x=3,disablePortal:w=!1,preLoadedOptions:y,helperText:m="",disabled:j,popupIcon:D,disableIconFlip:h})=>{const[b,E]=f.useState(""),{data:F,isLoading:O}=oe({inputValue:b,label:n,lookup:e,minLength:x!=null?x:0,preLoadedOptions:y}),M=b.length>=x;return o.jsx("div",{"data-testid":c,children:o.jsx(i.Stack,{direction:"row",spacing:1,children:o.jsx(i.Autocomplete,{sx:u(u({},s),h?{".MuiAutocomplete-popupIndicatorOpen":{transform:"rotate(0deg)"}}:{}),"data-testid":c?`${c}:Autocomplete`:void 0,loading:M?O:!1,options:F!=null?F:[],onChange:(A,_,P)=>{t(A,_,P)},disablePortal:w,filterOptions:A=>A,value:r,noOptionsText:M?p:"Start typing to search",getOptionLabel:A=>A.label,popupIcon:D,renderInput:A=>o.jsx(i.TextField,B(u({"data-testid":c?`${c}:Autocomplete:TextField`:void 0},A),{variant:d,label:n,color:a,error:l,helperText:m})),isOptionEqualToValue:(A,_)=>A.id===_.id,onInputChange:(A,_)=>{E(_)},renderOption:(A,_)=>f.createElement("li",B(u({},A),{key:_.id,"data-testid":c?`${c}:Autocomplete:option(${_.id.toString()})`:void 0}),_.label),disabled:j})})})},Re=e=>{if(!e)return-1;try{const n=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(ot.Buffer.from(n,"base64").toString("utf8").split("").map(function(a){return"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)}).join("")),s=JSON.parse(r);return s!=null&&s.exp?s.exp:-1}catch(t){return-1}},qt=({open:e=!1,closeHandler:t,setAuth0ExpiryTime:n})=>{const{logout:r,getAccessTokenSilently:s}=J.useAuth0(),[a,d]=f.useState(0),l=()=>I(null,null,function*(){r({logoutParams:{returnTo:`${window.location.origin}`}})}),c=()=>I(null,null,function*(){d(a+1),t()});f.useEffect(()=>{I(null,null,function*(){if(a>0){const y=yield s({cacheMode:"off"}),m=Re(y)*1e3;n(m)}})},[a,s,n]);const p={text:"Continue",onClick:c,disabled:!1,testId:"PreferencesDialog",buttonColor:"secondary"},x={text:"Log out",onClick:l,disabled:!1,testId:"PreferencesDialog",buttonColor:"secondary"};return o.jsx(te,{isOpen:e,primaryButton:p,secondaryButton:x,onClose:t,dialogTitle:"Session expiry",disableCloseOnBackdropOrEscape:!0,children:o.jsx("p",{style:{marginBottom:0},children:"Your session is about to time out due to inactivity. Do you want to continue?"})})};function Ht(e){return"error"in e}function Ut(e){var r;const t=e.error,n=(r=e==null?void 0:e.error_description)!=null?r:"";return t==="access_denied"&&n.startsWith("You do not have the required authorization")}function Wt(e){var r;const t=e.error,n=(r=e==null?void 0:e.error_description)!=null?r:"";return t==="access_denied"&&n.startsWith("User did not authorize the request")}function Vt(e){var r;const t=e.error,n=(r=e==null?void 0:e.error_description)!=null?r:"";return t==="access_denied"&&n.match(/Script.*time.*exceeded/)}function zt({children:e,appName:t="the app",throwErrors:n="none",disableConsoleLogging:r=!1,onError:s=()=>{}}){var w,y;const{isAuthenticated:a,isLoading:d,error:l,loginWithRedirect:c,logout:p}=J.useAuth0();f.useEffect(()=>{l&&s(l)},[l,s]);const x=f.useMemo(()=>({appState:{returnTo:`${window.location.pathname}${window.location.search}`}}),[]);if(f.useEffect(()=>{d||a||l||c(x)},[d,a,l,c,s,x]),l){if(r||console.error(`Error detected in AuthGuard [isAuthenticated=${a},isLoading=${d}]`,l),n==="all")throw l;if(Ht(l)){let m="Auth error",j="An unknown Auth0 error occurred.";if(Ut(l))m="Unauthorised",j=`You are not authorised to access ${t}.`;else if(Wt(l))m="App not authorised",j=`You have not authorised ${t} to access your user profile. This is necessary to use ${t}.`;else if(Vt(l))m="Auth0 script execution time exceeded",j="The Auth0 login flow exceeded the time limit (20s). Try again in a minute by clicking the RELOAD button below.";else if(l.message==="Invalid state"){const D=localStorage.getItem("auth0_redirect_count");D?D&&parseInt(D)<2&&(localStorage.setItem("auth0_redirect_count",String(parseInt(D)+1)),c(x)):(localStorage.setItem("auth0_redirect_count","1"),c(x))}else if(n==="unknown")throw l;return o.jsxs(i.Dialog,{open:!0,children:[o.jsx(i.DialogTitle,{children:m}),o.jsxs(i.DialogContent,{children:[o.jsx(i.Typography,{children:j}),o.jsx("br",{}),o.jsx(i.Typography,{variant:"subtitle2",children:"Details from Auth0"}),o.jsxs(i.Typography,{variant:"body2",children:["error: ",(w=l==null?void 0:l.error)!=null?w:"N/A"]}),o.jsxs(i.Typography,{variant:"body2",children:["description: ",(y=l==null?void 0:l.error_description)!=null?y:"N/A"]})]}),o.jsxs(i.DialogActions,{children:[m==="Auth0 script execution time exceeded"&&o.jsx(i.Button,{href:window.location.origin+window.location.pathname,children:"Reload"}),o.jsx(i.Button,{onClick:()=>p({logoutParams:{returnTo:window.location.origin}}),children:"Logout"})]})]})}else if(n==="unknown")throw l}return a?(localStorage.removeItem("auth0_redirect_count"),o.jsx(o.Fragment,{children:e})):o.jsx(st.default,{variant:"rectangular",animation:"pulse",height:"100vh",width:"100vw"})}const Gt={autoHideDuration:6e3,anchorOrigin:{vertical:"top",horizontal:"center"},disableWindowBlurListener:!1},Xt={shouldClose:(e,t)=>t!=="clickaway"},fe={message:"",severity:"info",variant:"standard",progressIndicator:void 0},Ae=100,ve=2e3,Yt=2e3,Kt=(()=>{let e=0;return()=>(e+=1,e)})(),Qt={borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},Jt={},Zt={},ne=f.createContext(null);function Oe(a){var d=a,{overrideState:e=Jt,overrideActions:t=Zt,shouldClose:n=Xt.shouldClose,children:r}=d,s=ae(d,["overrideState","overrideActions","shouldClose","children"]);var v;const[{open:l},c]=f.useState({open:!1}),p=f.useRef([]),x=f.useRef(Date.now()),w=f.useRef(0),y=f.useCallback(C=>{c({open:C})},[]),m=f.useCallback((C={})=>{w.current+=1,p.current.length>=Ae&&Date.now()-x.current>=ve&&(x.current=Date.now(),console.error(`SaladBarProvider: MAX_QUEUE_LENGTH (${Ae}) hit ${w.current} times in last ${ve}ms)`),w.current=0);const S=u(B(u({},fe),{key:Kt()}),C);return p.current.push(S),p.current.length===1&&c({open:!0}),S.key},[]),j=(C="",S={})=>m(u({message:C,severity:"success"},S)),D=(C="",S={})=>m(u({message:C,severity:"info"},S)),h=(C="",S={})=>m(u({message:C,severity:"warning"},S)),b=(C="",S={})=>m(u({message:C,severity:"error"},S)),E=C=>{const S=p.current.findIndex(G=>G.key===C);if(S!==-1)return S===0?(c({open:!1}),p.current[0]):p.current.splice(S,1)},F=(C,S)=>{n(C,S)&&c({open:!1})},O=()=>{},M=()=>{p.current.shift(),p.current.length>0&&c({open:!0})},A=(v=p.current[0])!=null?v:u({},fe),_={};"autoHideDuration"in A&&(_.autoHideDuration=A.autoHideDuration);const P=u(u({},Gt),s),g=u(u({open:l,setOpen:y,enqueueNotification:m,enqueueSuccessNotification:j,enqueueInfoNotification:D,enqueueWarningNotification:h,enqueueErrorNotification:b,removeNotification:E},e),t);return o.jsxs(ne.Provider,{value:g,children:[r,o.jsx(i.Snackbar,B(u(u({},P),_),{open:l,onClose:F,TransitionProps:{onExited:M,onExit:O},sx:{zIndex:Yt},children:o.jsxs("div",{children:[o.jsx(i.Alert,{onClose:C=>F(C,"closeAlert"),severity:A.severity,variant:"filled",icon:A.progressIndicator==="circular"?o.jsx(i.CircularProgress,{size:"1em"}):void 0,style:A.progressIndicator==="linear"?Qt:void 0,children:A.message}),A.progressIndicator==="linear"&&o.jsx(i.LinearProgress,{color:"primary"})]})}))]})}function qe(){const e=f.useContext(ne);if(e===null)throw new z("Error: Tried to useSaladBar outside of a <SaladBarProvider>");return e}const eo=Q.createHelper((e={autoHideDuration:1},t={},n={})=>({children:r})=>o.jsx(Oe,B(u({},e),{overrideState:t,overrideActions:n,children:o.jsx(o.Fragment,{children:r})}))),He="domainCode";var ye;const Ce=k.atom(JSON.parse((ye=localStorage.getItem(He))!=null?ye:'{"domainCode": ""}').domainCode),Ue=k.atom(e=>e(Ce),(e,t,n)=>{t(Ce,n),localStorage.setItem(He,JSON.stringify({domainCode:n}))}),to={act:"ACT",nsw:"NSW",nt:"NT",qld:"QLD",sa:"SA",tas:"TAS",vic:"VIC",wa:"WA",ag:"AG",fedmps:"Fedmps","":""},oo=e=>{var t;return e===null?"N/A":(t=to[e])!=null?t:""},no=({isLoading:e,isOpen:t,onClose:n,onDomainChange:r,domainOptions:s,applicationName:a,handleLogout:d})=>{const[l,c]=k.useAtom(Ue),[p,x]=f.useState(l),{enqueueSuccessNotification:w}=qe(),y=s.length===0,m=!!l&&!s.includes(l)&&!s.includes(p),j=!l||y||m,D=()=>I(null,null,function*(){p?(c(p),r==null||r(p),w(`Set organisation to ${p}`),n()):(c(""),r==null||r(""))}),h=()=>I(null,null,function*(){l&&!y&&!m?(x(l),n()):j&&d()});let b;return y?b="Unable to retrieve your active organisations. Try logging in again.":m&&(b="You no longer have any roles in your chosen organisation. Please choose another."),o.jsxs(te,{isOpen:t,dialogTitle:"Select an organisation",primaryButton:{text:"Confirm",onClick:D,disabled:!p||y||m,buttonColor:"primary"},secondaryButton:{text:j?"Logout":"Cancel",onClick:h},onClose:j?()=>{}:n,children:[o.jsxs(i.Typography,{marginBottom:2,children:["Select the default organisation that you want to use with the ",a,"."]}),o.jsx(i.Autocomplete,{loading:e,multiple:!1,disableClearable:!1,value:p!==""?p:null,onChange:(E,F)=>x(F!=null?F:""),getOptionLabel:oo,options:[...s],renderInput:E=>o.jsx(i.TextField,B(u({},E),{variant:"filled",label:"Select organisation",InputProps:B(u({},E.InputProps),{endAdornment:o.jsxs(o.Fragment,{children:[e?o.jsx(i.CircularProgress,{color:"inherit",size:20,sx:{marginTop:"-20px"}}):null,E.InputProps.endAdornment]})})}))}),b&&o.jsx(i.FormHelperText,{error:!0,children:b})]})},ro=T.createTheme({palette:{primary:{dark:"#00A651",light:"#A3D39C",main:"#007236",contrastText:"#FFF"},warning:{main:"#F5871F",light:"#FCC589",dark:"#A2590A",contrastText:"#FFF"},secondary:{main:"#662D91",light:"#BD8CBF",dark:"#440E62",contrastText:"#FFF"},error:{main:"#D43C95",light:"#8F2064",dark:"#F9CDE0",contrastText:"#FFF"},info:{main:"#00A88D",light:"#ADDCCF",dark:"#005243",contrastText:"#FFF"},success:{main:"#00A651",light:"#A3D39C",dark:"#007236",contrastText:"#FFF"}},typography:{explainer:{fontSize:"14px",marginBlockStart:"1em"}},navBar:{backgroundColor:"#E8E8E8"}}),io=T.createTheme({palette:{primary:{main:"#007236",dark:"#005221",light:"#00A04E",contrastText:"#FFFFFF"},secondary:{main:"#662D91",dark:"#440E62",light:"#93268F",contrastText:"#FFFFFF"},error:{main:"#D32F2F",dark:"#C62828",light:"#EF5350"},info:{main:"#0288D1",dark:"#01579B",light:"#03A9F4"},success:{main:"#0288D1",dark:"#01579B",light:"#03A9F4"}},components:{MuiTextField:{defaultProps:{color:"secondary"}},MuiToggleButtonGroup:{defaultProps:{color:"secondary"}},MuiCheckbox:{defaultProps:{color:"secondary"}},MuiSelect:{defaultProps:{color:"secondary"}},MuiSwitch:{defaultProps:{color:"secondary"}},MuiFormControl:{defaultProps:{color:"secondary"}},MuiMenuItem:{styleOverrides:{root:({theme:e})=>({"&.Mui-selected":{backgroundColor:T.alpha(e.palette.secondary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:T.alpha(e.palette.secondary.main,e.palette.action.selectedOpacity)},"&.Mui-focusVisible":{backgroundColor:T.alpha(e.palette.secondary.main,e.palette.action.focusOpacity)}}})}}},typography:{h4:{fontSize:"1.88rem",fontWeight:500},h5:{fontWeight:500},explainer:{fontSize:"14px",marginBlockStart:"1em"}},navBar:{backgroundColor:"#E8E8E8"}});exports.AgDialog=te;exports.AppLayout=Mt;exports.AuthGuard=zt;exports.Context=ne;exports.ContextError=z;exports.DomainCodeDialog=no;exports.ExampleComponent=at;exports.FetchAutocomplete=Pt;exports.MUI_AUTOCOMPLETE_VALUE_WARNING_REGEX=Rt;exports.NAVBAR_WIDTH_CLOSED=ee;exports.NAVBAR_WIDTH_OPENED=Z;exports.NavBar=At;exports.NavBarDarkStyledList=mt;exports.NavBarLightStyledList=ft;exports.NavBarProvider=De;exports.SaladBarProvider=Oe;exports.SessionExpiryDialog=qt;exports.SingleAutocomplete=Ot;exports.buildNavBarState=Ee;exports.determineUserLevelFromClaims=kt;exports.domainCodeAtom=Ue;exports.fed21Theme=ro;exports.getAuth0Expiry=Re;exports.getValidBusinessRoles=Bt;exports.internalAgSystemsTheme=io;exports.navBarClasses=$;exports.navBarOpenAtom=H;exports.navBarTopAtom=$e;exports.navBarWidthClosedAtom=Ie;exports.navBarWidthOpenAtom=Fe;exports.simpleHashCode=Pe;exports.suppressConsole=Et;exports.titleTextAtom=K;exports.topBarHeightAtom=Ne;exports.topBarMiddleAtom=Te;exports.unsuppressConsole=_t;exports.useAutocompleteOptions=oe;exports.useNavBar=Be;exports.useSaladBar=qe;exports.useValidDomains=Dt;exports.withBrowserRouter=xt;exports.withNavBarProvider=gt;exports.withSaladBarProvider=eo;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|