@crystaltech/hsms-shared-ui 0.0.2-alpha-0.0.12 → 0.0.2-alpha-0.0.14

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/index.es.js CHANGED
@@ -52889,7 +52889,7 @@ const VR = it(/* @__PURE__ */ v.jsx("path", {
52889
52889
  alignItems: "center",
52890
52890
  justifyContent: "center",
52891
52891
  overflow: "hidden",
52892
- backgroundImage: "url('/images/medical-care.jpg')",
52892
+ backgroundImage: "url('/src/assets/medical-care.jpg')",
52893
52893
  backgroundSize: "cover",
52894
52894
  backgroundPosition: "center"
52895
52895
  },
package/dist/index.js CHANGED
@@ -489,4 +489,4 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
489
489
  * @license MIT
490
490
  */function Kt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ar(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Uh({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Kg(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function QE(e,t,n="/"){return DG(e,t,n,!1)}function DG(e,t,n,r){let o=typeof t=="string"?Kg(t):t,i=Ao(o.pathname||"/",n);if(i==null)return null;let s=ZE(e);$G(s);let l=null;for(let c=0;l==null&&c<s.length;++c){let u=HG(i);l=qG(s[c],u,r)}return l}function ZE(e,t=[],n=[],r=""){let o=(i,s,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};c.relativePath.startsWith("/")&&(Kt(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length));let u=Rr([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(Kt(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),ZE(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:zG(u,i.index),routesMeta:d})};return e.forEach((i,s)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))o(i,s);else for(let c of eR(i.path))o(i,s,c)}),t}function eR(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=eR(r.join("/")),l=[];return l.push(...s.map(c=>c===""?i:[i,c].join("/"))),o&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function $G(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:WG(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var NG=/^:[\w-]+$/,_G=3,FG=2,LG=1,BG=10,VG=-2,i1=e=>e==="*";function zG(e,t){let n=e.split("/"),r=n.length;return n.some(i1)&&(r+=VG),t&&(r+=FG),n.filter(o=>!i1(o)).reduce((o,i)=>o+(NG.test(i)?_G:i===""?LG:BG),r)}function WG(e,t){return e.length===t.length&&e.slice(0,-1).every((n,r)=>n===t[r])?e[e.length-1]-t[t.length-1]:0}function qG(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",s=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=i==="/"?t:t.slice(i.length)||"/",p=ec({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),h=c.route;if(!p&&u&&n&&!r[r.length-1].route.index&&(p=ec({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!p)return null;Object.assign(o,p.params),s.push({params:o,pathname:Rr([i,p.pathname]),pathnameBase:XG(Rr([i,p.pathnameBase])),route:h}),p.pathnameBase!=="/"&&(i=Rr([i,p.pathnameBase]))}return s}function ec(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=UG(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((c,{paramName:u,isOptional:d},p)=>{if(u==="*"){let m=l[p]||"";s=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const h=l[p];return d&&!h?c[u]=void 0:c[u]=(h||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:s,pattern:e}}function UG(e,t=!1,n=!0){Ar(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,l)=>(r.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function HG(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ar(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ao(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function GG(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Kg(e):e;return{pathname:n?n.startsWith("/")?n:YG(n,t):t,search:JG(r),hash:QG(o)}}function YG(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function ch(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function KG(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function tR(e){let t=KG(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function nR(e,t,n,r=!1){let o;typeof e=="string"?o=Kg(e):(o={...e},Kt(!o.pathname||!o.pathname.includes("?"),ch("?","pathname","search",o)),Kt(!o.pathname||!o.pathname.includes("#"),ch("#","pathname","hash",o)),Kt(!o.search||!o.search.includes("#"),ch("#","search","hash",o)));let i=e===""||o.pathname==="",s=i?"/":o.pathname,l;if(s==null)l=n;else{let p=t.length-1;if(!r&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),p-=1;o.pathname=h.join("/")}l=p>=0?t[p]:"/"}let c=GG(o,l),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var Rr=e=>e.join("/").replace(/\/\/+/g,"/"),XG=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),JG=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,QG=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ZG(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var rR=["POST","PUT","PATCH","DELETE"];new Set(rR);var eY=["GET",...rR];new Set(eY);var ei=x.createContext(null);ei.displayName="DataRouter";var wu=x.createContext(null);wu.displayName="DataRouterState";var oR=x.createContext({isTransitioning:!1});oR.displayName="ViewTransition";var tY=x.createContext(new Map);tY.displayName="Fetchers";var nY=x.createContext(null);nY.displayName="Await";var Fr=x.createContext(null);Fr.displayName="Navigation";var Xg=x.createContext(null);Xg.displayName="Location";var Lr=x.createContext({outlet:null,matches:[],isDataRoute:!1});Lr.displayName="Route";var Jg=x.createContext(null);Jg.displayName="RouteError";function rY(e,{relative:t}={}){Kt(Su(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=x.useContext(Fr),{hash:o,pathname:i,search:s}=$s(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:Rr([n,i])),r.createHref({pathname:l,search:s,hash:o})}function Su(){return x.useContext(Xg)!=null}function Vo(){return Kt(Su(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Xg).location}var aR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function iR(e){x.useContext(Fr).static||x.useLayoutEffect(e)}function oY(){let{isDataRoute:e}=x.useContext(Lr);return e?bY():aY()}function aY(){Kt(Su(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(ei),{basename:t,navigator:n}=x.useContext(Fr),{matches:r}=x.useContext(Lr),{pathname:o}=Vo(),i=JSON.stringify(tR(r)),s=x.useRef(!1);return iR(()=>{s.current=!0}),x.useCallback((l,c={})=>{if(Ar(s.current,aR),!s.current)return;if(typeof l=="number"){n.go(l);return}let u=nR(l,JSON.parse(i),o,c.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:Rr([t,u.pathname])),(c.replace?n.replace:n.push)(u,c.state,c)},[t,n,i,o,e])}x.createContext(null);function $s(e,{relative:t}={}){let{matches:n}=x.useContext(Lr),{pathname:r}=Vo(),o=JSON.stringify(tR(n));return x.useMemo(()=>nR(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function iY(e,t,n,r){Kt(Su(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o,static:i}=x.useContext(Fr),{matches:s}=x.useContext(Lr),l=s[s.length-1],c=l?l.params:{},u=l?l.pathname:"/",d=l?l.pathnameBase:"/",p=l&&l.route;{let w=p&&p.path||"";sR(u,!p||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
491
491
 
492
- Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let h=Vo(),m;m=h;let g=m.pathname||"/",f=g;if(d!=="/"){let w=d.replace(/^\//,"").split("/");f="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let y=!i&&n&&n.matches&&n.matches.length>0?n.matches:QE(e,{pathname:f});return Ar(p||y!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Ar(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),dY(y&&y.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Rr([d,o.encodeLocation?o.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?d:Rr([d,o.encodeLocation?o.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,n,r)}function sY(){let e=gY(),t=ZG(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:i},"ErrorBoundary")," or"," ",x.createElement("code",{style:i},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:o},n):null,s)}var lY=x.createElement(sY,null),cY=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?x.createElement(Lr.Provider,{value:this.props.routeContext},x.createElement(Jg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function uY({routeContext:e,match:t,children:n}){let r=x.useContext(ei);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(Lr.Provider,{value:e},n)}function dY(e,t=[],n=null,r=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n==null?void 0:n.errors;if(i!=null){let c=o.findIndex(u=>u.route.id&&(i==null?void 0:i[u.route.id])!==void 0);Kt(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,c+1))}let s=!1,l=-1;if(n)for(let c=0;c<o.length;c++){let u=o[c];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=c),u.route.id){let{loaderData:d,errors:p}=n,h=u.route.loader&&!d.hasOwnProperty(u.route.id)&&(!p||p[u.route.id]===void 0);if(u.route.lazy||h){s=!0,l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}return o.reduceRight((c,u,d)=>{let p,h=!1,m=null,g=null;n&&(p=i&&u.route.id?i[u.route.id]:void 0,m=u.route.errorElement||lY,s&&(l<0&&d===0?(sR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,g=null):l===d&&(h=!0,g=u.route.hydrateFallbackElement||null)));let f=t.concat(o.slice(0,d+1)),y=()=>{let w;return p?w=m:h?w=g:u.route.Component?w=x.createElement(u.route.Component,null):u.route.element?w=u.route.element:w=c,x.createElement(uY,{match:u,routeContext:{outlet:c,matches:f,isDataRoute:n!=null},children:w})};return n&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?x.createElement(cY,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:y(),routeContext:{outlet:null,matches:f,isDataRoute:!0}}):y()},null)}function Qg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pY(e){let t=x.useContext(ei);return Kt(t,Qg(e)),t}function fY(e){let t=x.useContext(wu);return Kt(t,Qg(e)),t}function hY(e){let t=x.useContext(Lr);return Kt(t,Qg(e)),t}function Zg(e){let t=hY(e),n=t.matches[t.matches.length-1];return Kt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function mY(){return Zg("useRouteId")}function gY(){var e;let t=x.useContext(Jg),n=fY("useRouteError"),r=Zg("useRouteError");return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function bY(){let{router:e}=pY("useNavigate"),t=Zg("useNavigate"),n=x.useRef(!1);return iR(()=>{n.current=!0}),x.useCallback(async(r,o={})=>{Ar(n.current,aR),n.current&&(typeof r=="number"?e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var s1={};function sR(e,t,n){!t&&!s1[e]&&(s1[e]=!0,Ar(!1,n))}x.memo(yY);function yY({routes:e,future:t,state:n}){return iY(e,void 0,n,t)}var Ol="get",Tl="application/x-www-form-urlencoded";function Cu(e){return e!=null&&typeof e.tagName=="string"}function vY(e){return Cu(e)&&e.tagName.toLowerCase()==="button"}function xY(e){return Cu(e)&&e.tagName.toLowerCase()==="form"}function wY(e){return Cu(e)&&e.tagName.toLowerCase()==="input"}function SY(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function CY(e,t){return e.button===0&&(!t||t==="_self")&&!SY(e)}var ll=null;function OY(){if(ll===null)try{new FormData(document.createElement("form"),0),ll=!1}catch{ll=!0}return ll}var TY=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function uh(e){return e!=null&&!TY.has(e)?(Ar(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tl}"`),null):e}function EY(e,t){let n,r,o,i,s;if(xY(e)){let l=e.getAttribute("action");r=l?Ao(l,t):null,n=e.getAttribute("method")||Ol,o=uh(e.getAttribute("enctype"))||Tl,i=new FormData(e)}else if(vY(e)||wY(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?Ao(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Ol,o=uh(e.getAttribute("formenctype"))||uh(l.getAttribute("enctype"))||Tl,i=new FormData(l,e),!OY()){let{name:u,type:d,value:p}=e;if(d==="image"){let h=u?`${u}.`:"";i.append(`${h}x`,"0"),i.append(`${h}y`,"0")}else u&&i.append(u,p)}}else{if(Cu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ol,r=null,o=Tl,s=e}return i&&o==="text/plain"&&(s=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:s}}function eb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function RY(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function kY(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function PY(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let s=await RY(i,n);return s.links?s.links():[]}return[]}));return jY(r.flat(1).filter(kY).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function l1(e,t,n,r,o,i){let s=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var d;return n[u].pathname!==c.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>s(c,u)||l(c,u)):i==="data"?t.filter((c,u)=>{var d;let p=r.routes[c.route.id];if(!p||!p.hasLoader)return!1;if(s(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let h=c.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((d=n[0])==null?void 0:d.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function IY(e,t,{includeHydrateFallback:n}={}){return MY(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function MY(e){return[...new Set(e)]}function AY(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function jY(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(AY(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function DY(e){let t=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return t.pathname==="/"?t.pathname="_root.data":t.pathname=`${t.pathname.replace(/\/$/,"")}.data`,t}function $Y(){let e=x.useContext(ei);return eb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function NY(){let e=x.useContext(wu);return eb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var tb=x.createContext(void 0);tb.displayName="FrameworkContext";function lR(){let e=x.useContext(tb);return eb(e,"You must render this element inside a <HydratedRouter> element"),e}function _Y(e,t){let n=x.useContext(tb),[r,o]=x.useState(!1),[i,s]=x.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,h=x.useRef(null);x.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let f=w=>{w.forEach(O=>{s(O.isIntersecting)})},y=new IntersectionObserver(f,{threshold:.5});return h.current&&y.observe(h.current),()=>{y.disconnect()}}},[e]),x.useEffect(()=>{if(r){let f=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(f)}}},[r]);let m=()=>{o(!0)},g=()=>{o(!1),s(!1)};return n?e!=="intent"?[i,h,{}]:[i,h,{onFocus:Ti(l,m),onBlur:Ti(c,g),onMouseEnter:Ti(u,m),onMouseLeave:Ti(d,g),onTouchStart:Ti(p,m)}]:[!1,h,{}]}function Ti(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function FY({page:e,...t}){let{router:n}=$Y(),r=x.useMemo(()=>QE(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?x.createElement(BY,{page:e,matches:r,...t}):null}function LY(e){let{manifest:t,routeModules:n}=lR(),[r,o]=x.useState([]);return x.useEffect(()=>{let i=!1;return PY(e,t,n).then(s=>{i||o(s)}),()=>{i=!0}},[e,t,n]),r}function BY({page:e,matches:t,...n}){let r=Vo(),{manifest:o,routeModules:i}=lR(),{loaderData:s,matches:l}=NY(),c=x.useMemo(()=>l1(e,t,l,o,r,"data"),[e,t,l,o,r]),u=x.useMemo(()=>l1(e,t,l,o,r,"assets"),[e,t,l,o,r]),d=x.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let m=new Set,g=!1;if(t.forEach(y=>{var w;let O=o.routes[y.route.id];!O||!O.hasLoader||(!c.some(C=>C.route.id===y.route.id)&&y.route.id in s&&(w=i[y.route.id])!=null&&w.shouldRevalidate||O.hasClientLoader?g=!0:m.add(y.route.id))}),m.size===0)return[];let f=DY(e);return g&&m.size>0&&f.searchParams.set("_routes",t.filter(y=>m.has(y.route.id)).map(y=>y.route.id).join(",")),[f.pathname+f.search]},[s,r,o,c,t,e,i]),p=x.useMemo(()=>IY(u,o),[u,o]),h=LY(u);return x.createElement(x.Fragment,null,d.map(m=>x.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),p.map(m=>x.createElement("link",{key:m,rel:"modulepreload",href:m,...n})),h.map(({key:m,link:g})=>x.createElement("link",{key:m,...g})))}function VY(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var cR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{cR&&(window.__reactRouterVersion="7.2.0")}catch{}var uR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dR=x.forwardRef(function({onClick:e,discover:t="render",prefetch:n="none",relative:r,reloadDocument:o,replace:i,state:s,target:l,to:c,preventScrollReset:u,viewTransition:d,...p},h){let{basename:m}=x.useContext(Fr),g=typeof c=="string"&&uR.test(c),f,y=!1;if(typeof c=="string"&&g&&(f=c,cR))try{let P=new URL(window.location.href),D=c.startsWith("//")?new URL(P.protocol+c):new URL(c),b=Ao(D.pathname,m);D.origin===P.origin&&b!=null?c=b+D.search+D.hash:y=!0}catch{Ar(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let w=rY(c,{relative:r}),[O,C,S]=_Y(n,p),T=UY(c,{replace:i,state:s,target:l,preventScrollReset:u,relative:r,viewTransition:d});function k(P){e&&e(P),P.defaultPrevented||T(P)}let A=x.createElement("a",{...p,...S,href:f||w,onClick:y||o?e:k,ref:VY(h,C),target:l,"data-discover":!g&&t==="render"?"true":void 0});return O&&!g?x.createElement(x.Fragment,null,A,x.createElement(FY,{page:w})):A});dR.displayName="Link";var zY=x.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:r=!1,style:o,to:i,viewTransition:s,children:l,...c},u){let d=$s(i,{relative:c.relative}),p=Vo(),h=x.useContext(wu),{navigator:m,basename:g}=x.useContext(Fr),f=h!=null&&XY(d)&&s===!0,y=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,w=p.pathname,O=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;t||(w=w.toLowerCase(),O=O?O.toLowerCase():null,y=y.toLowerCase()),O&&g&&(O=Ao(O,g)||O);const C=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let S=w===y||!r&&w.startsWith(y)&&w.charAt(C)==="/",T=O!=null&&(O===y||!r&&O.startsWith(y)&&O.charAt(y.length)==="/"),k={isActive:S,isPending:T,isTransitioning:f},A=S?e:void 0,P;typeof n=="function"?P=n(k):P=[n,S?"active":null,T?"pending":null,f?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o(k):o;return x.createElement(dR,{...c,"aria-current":A,className:P,ref:u,style:D,to:i,viewTransition:s},typeof l=="function"?l(k):l)});zY.displayName="NavLink";var WY=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:s=Ol,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:p,...h},m)=>{let g=YY(),f=KY(l,{relative:u}),y=s.toLowerCase()==="get"?"get":"post",w=typeof l=="string"&&uR.test(l),O=C=>{if(c&&c(C),C.defaultPrevented)return;C.preventDefault();let S=C.nativeEvent.submitter,T=(S==null?void 0:S.getAttribute("formmethod"))||s;g(S||C.currentTarget,{fetcherKey:t,method:T,navigate:n,replace:o,state:i,relative:u,preventScrollReset:d,viewTransition:p})};return x.createElement("form",{ref:m,method:y,action:f,onSubmit:r?c:O,...h,"data-discover":!w&&e==="render"?"true":void 0})});WY.displayName="Form";function qY(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pR(e){let t=x.useContext(ei);return Kt(t,qY(e)),t}function UY(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:i,viewTransition:s}={}){let l=oY(),c=Vo(),u=$s(e,{relative:i});return x.useCallback(d=>{if(CY(d,t)){d.preventDefault();let p=n!==void 0?n:Uh(c)===Uh(u);l(e,{replace:p,state:r,preventScrollReset:o,relative:i,viewTransition:s})}},[c,l,u,n,r,t,e,o,i,s])}var HY=0,GY=()=>`__${String(++HY)}__`;function YY(){let{router:e}=pR("useSubmit"),{basename:t}=x.useContext(Fr),n=mY();return x.useCallback(async(r,o={})=>{let{action:i,method:s,encType:l,formData:c,body:u}=EY(r,t);if(o.navigate===!1){let d=o.fetcherKey||GY();await e.fetch(d,n,o.action||i,{preventScrollReset:o.preventScrollReset,formData:c,body:u,formMethod:o.method||s,formEncType:o.encType||l,flushSync:o.flushSync})}else await e.navigate(o.action||i,{preventScrollReset:o.preventScrollReset,formData:c,body:u,formMethod:o.method||s,formEncType:o.encType||l,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[e,t,n])}function KY(e,{relative:t}={}){let{basename:n}=x.useContext(Fr),r=x.useContext(Lr);Kt(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...$s(e||".",{relative:t})},s=Vo();if(e==null){i.search=s.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(u=>u==="")){l.delete("index"),c.filter(d=>d).forEach(d=>l.append("index",d));let u=l.toString();i.search=u?`?${u}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:Rr([n,i.pathname])),Uh(i)}function XY(e,t={}){let n=x.useContext(oR);Kt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=pR("useViewTransitionState"),o=$s(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Ao(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=Ao(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ec(o.pathname,s)!=null||ec(o.pathname,i)!=null}new TextEncoder;const fR=st(v.jsx("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"}),"Login"),JY=({userManage:e})=>{const[t,n]=M.useState(null),[r,o]=M.useState(!1),{user:i,redirectUrl:s}=e,l="",{logout:c,authenticated:u}=Yg(l);console.log(u);const d=h=>{n(h.currentTarget),o(!0)},p=()=>{o(!1)};return v.jsxs(v.Fragment,{children:[v.jsx(ne.IconButton,{onClick:d,children:v.jsx(ne.Avatar,{src:i.image,alt:i==null?void 0:i.name})}),v.jsx(ne.Popover,{open:r,anchorEl:t,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:v.jsxs(ne.List,{sx:{padding:2,width:200},children:[v.jsx(Ut.Link,{to:s,style:{textDecoration:"none",color:"inherit"},children:v.jsx(ne.ListItemButton,{children:v.jsxs(ne.Box,{children:[v.jsx(ne.Typography,{variant:"subtitle1",children:i==null?void 0:i.name}),v.jsx(ne.Typography,{variant:"body2",sx:{color:"gray"},children:i==null?void 0:i.email})]})})}),v.jsx(ne.ListItemButton,{disableGutters:!0,sx:{py:0},children:v.jsx(ws,{fullWidth:!0,variant:"contained",size:"large",onClick:c,startIcon:v.jsx(fR,{}),children:"Logout"})})]})})]})},nb=({children:e,layoutConfig:t})=>{var h,m;const[n,r]=M.useState(!1),[o,i]=M.useState(t.sideDrawer.isMinimized),s=ne.useMediaQuery(g=>g.breakpoints.up("md")),l=t.navbar.showHamburgerInMobile&&!s,c=s?"permanent":"temporary",u=o?60:t.sideDrawer.drawerWidth,d=()=>{r(!n)},p=()=>{i(!o)};return v.jsxs(ne.Box,{children:[v.jsxs(ne.Box,{component:"main",sx:{flexGrow:1,ml:{md:`${u}px`}},children:[v.jsx(OU,{children:v.jsxs(ne.Stack,{direction:"row",spacing:2,alignItems:"center",justifyContent:"space-between",width:"100%",children:[l&&v.jsxs(ne.Stack,{direction:"row",alignItems:"center",justifyContent:"center",children:[v.jsx(jc,{"aria-label":"menu",onClick:d,sx:{mr:"8px"},children:v.jsx(vU,{})}),v.jsx(Ut.Link,{to:"/",style:{textDecoration:"none",color:"inherit"},children:v.jsx(ne.Typography,{variant:"h5",color:"primary",children:Xn==null?void 0:Xn.moduleName})})]}),!l&&v.jsx(Ut.Link,{to:"/",style:{textDecoration:"none",color:"inherit"},children:v.jsx(ne.Typography,{variant:"h5",color:"primary",children:Xn.moduleName})}),v.jsx(ne.Box,{}),((h=t==null?void 0:t.navbar)==null?void 0:h.userManage)&&v.jsx(JY,{userManage:(m=t==null?void 0:t.navbar)==null?void 0:m.userManage})]})}),v.jsx(xU,{fixed:!0,children:e}),v.jsx(CU,{footerText:t.footerText})]}),v.jsx(PU,{isSidebarOpen:n,toggleSidebar:d,variant:c,drawerWidth:u,menuConfig:t.sideDrawer.menuConfig,showOnlyIcons:o,toggleSidebarDesktop:p})]})},QY=({children:e,layoutConfig:t})=>v.jsx(Ut.BrowserRouter,{children:v.jsx(nb,{layoutConfig:t,children:e})}),ZY=st(v.jsx("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList"),c1=st(v.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),eK=st(v.jsx("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"}),"Done"),tK=({data:e,handleColumnVisibility:t})=>{const[n,r]=M.useState(null),[o,i]=M.useState(!1),s=m=>{r(m.currentTarget)},l=()=>{i(!1),r(null)},c=!!n,u=c?"simple-popover":void 0,d=e[0].filter(m=>m.isVisible),p=e[0].filter(m=>!m.isVisible),h=m=>{const g=e.map(f=>f.map(y=>y.id===m?{...y,isVisible:!y.isVisible}:y));console.log(g),t(g)};return console.log(e),v.jsxs(v.Fragment,{children:[v.jsx(ne.Tooltip,{title:"Add new",arrow:!0,children:v.jsx(ws,{variant:"text",onClick:s,children:v.jsx(c1,{})})}),v.jsx(ig,{id:u,open:c,anchorEl:n,onClose:l,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:v.jsx(ne.Paper,{elevation:3,style:{padding:"16px",minWidth:"200px"},children:v.jsx(v.Fragment,{children:o?v.jsx(v.Fragment,{}):v.jsxs(v.Fragment,{children:[v.jsx(ne.Typography,{variant:"h6",fontWeight:"bold",children:"Visible Items"}),v.jsx(ne.List,{children:d.map(m=>v.jsxs(ne.ListItemButton,{onClick:()=>h(m.id),children:[v.jsx(ne.ListItemIcon,{sx:{minWidth:"32px"},children:v.jsx(eK,{})}),v.jsx(ne.ListItemText,{slotProps:{primary:{variant:"body2"}},primary:`${m.fieldName}`})]},m.id))}),v.jsx(ne.Typography,{variant:"h6",fontWeight:"bold",children:"Not Visible Items"}),v.jsx(ne.List,{children:p.map(m=>v.jsxs(ne.ListItemButton,{onClick:()=>h(m.id),children:[v.jsx(ne.ListItemIcon,{sx:{minWidth:"32px"},children:v.jsx(c1,{})}),v.jsx(ne.ListItemText,{slotProps:{primary:{variant:"body2"}},primary:`${m.fieldName}`})]},m.id))})]})})})})]})},nK=ee(Ut.Link)(({theme:e})=>({textDecoration:"none",color:"inherit","&:hover":{color:e.palette.primary.main}})),rK=({item:e,itemIndex:t,rowIndex:n})=>v.jsxs(ne.Grid2,{container:!0,spacing:2,children:[t===0&&v.jsx(ne.Grid2,{size:{xs:2},children:n+1}),e.isVisible&&v.jsxs(ne.Grid2,{size:{xs:10},children:[e.fieldType==="link"&&v.jsx(nK,{to:e.to||"/",children:e.fieldContent}),e.fieldType==="label"&&v.jsx(ne.Chip,{label:typeof e.fieldContent=="string"?e.fieldContent:"",color:"primary",variant:"outlined"}),e.fieldType==="text"&&v.jsx(ne.Typography,{variant:"body2",children:e.fieldContent}),e.fieldType==="date"&&v.jsx(ne.Typography,{variant:"body2",color:"primary",children:e.fieldContent}),e.fieldType==="actions"&&v.jsx(ne.Grid2,{container:!0,spacing:2,children:Array.isArray(e.fieldContent)&&e.fieldContent.length>0&&e.fieldContent.map((r,o)=>v.jsx(ne.Grid2,{children:v.jsx(ne.Chip,{label:r.label,onClick:()=>r.onClick(e),icon:r.icon,color:"primary",variant:r.variant})},o))}),e.fieldType==="date-picker"&&v.jsx(jT,{label:"Date",initialValue:e.fieldContent.date,onChange:r=>{e.fieldContent.onChange&&r&&e.fieldContent.onChange(e,r.toDate())}})]})]}),oK=(e,t)=>t?e.filter(n=>n.some(r=>r.isVisible&&typeof r.fieldContent=="string"&&r.fieldContent.toLowerCase().includes(t.toLowerCase()))):e,cl=ee(ne.TableCell)(({theme:e})=>({minWidth:240,maxWidth:580,borderTop:"1px solid",borderBottom:"1px solid",borderTopColor:e.palette.neutral[200],borderBottomColor:e.palette.neutral[200],wordWrap:"break-word",minHeight:"35px"})),aK=({tableData:e,rowsPerPage:t,page:n,handleChangePage:r,handleChangeRowsPerPage:o})=>{const[i,s]=M.useState([]),[l,c]=M.useState([]),[u,d]=M.useState([]);M.useEffect(()=>{if(e.length>0){s(e),c(e);const g=e[0].map(f=>f);d(g)}},[e]);const p=g=>{const f=oK(l,g);s(f)},h=()=>{s(l)},m=g=>{const f=g[0].map(y=>y);d(f),s(g),c(g)};return v.jsxs(ne.TableContainer,{component:ne.Paper,sx:{minHeight:"80vh",width:"100%",overflow:"auto"},children:[v.jsx(ne.Box,{sx:{width:"100%"},children:v.jsx($T,{startIcon:v.jsx(ZY,{}),placeholder:"Filter by keyword or field",count:i.length,onChange:p,onClear:h})}),v.jsxs(ne.Table,{stickyHeader:!0,"aria-label":"sticky table",sx:{minWidth:650,width:"100%"},children:[v.jsx(ne.TableHead,{children:v.jsxs(ne.TableRow,{children:[u.length>0&&u.map((g,f)=>g.isVisible?v.jsx(cl,{sx:{height:"30px"},children:v.jsxs(ne.Grid,{container:!0,spacing:2,children:[f===0&&v.jsx(ne.Grid,{item:!0,xs:2}),g.isVisible&&v.jsx(ne.Grid,{item:!0,xs:10,children:v.jsx(ne.Typography,{variant:"body2",fontWeight:"bold",children:g.fieldName})})]})},f):null),v.jsx(cl,{sx:{width:20},align:"center",children:i.length>0&&v.jsx(tK,{data:i,handleColumnVisibility:m})})]})}),v.jsx(ne.TableBody,{children:i.slice(n*t,n*t+t).map((g,f)=>v.jsxs(ne.TableRow,{hover:!0,children:[g.length>0&&g.map((y,w)=>y.isVisible?v.jsx(cl,{children:v.jsx(rK,{item:y,itemIndex:w,rowIndex:f})},`${y.fieldName}-${w}`):null),v.jsx(cl,{align:"center"})]},f))})]}),v.jsx(ne.TablePagination,{rowsPerPageOptions:[5,10,25],component:"div",count:i.length,rowsPerPage:t,page:n,onPageChange:r,onRowsPerPageChange:o})]})},iK=ne.styled(ne.Paper)(({theme:e})=>({padding:e.spacing(4),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.paper})),sK=ne.styled(ne.Avatar)(({theme:e})=>({width:e.spacing(12),height:e.spacing(12),marginBottom:e.spacing(2),border:`4px solid ${e.palette.background.paper}`})),lK=ne.styled(ne.Box)(({theme:e})=>({textAlign:"left",marginTop:e.spacing(2),"& .MuiTypography-root":{marginBottom:e.spacing(1)}})),cK=ne.styled(ne.Button)(({theme:e})=>({marginTop:e.spacing(2),backgroundColor:e.palette.primary.main,"&:hover":{backgroundColor:e.palette.primary.dark}})),u1=({profileData:e,onEditClick:t})=>{const{imageUrl:n,name:r,bio:o,email:i,location:s,phoneNumber:l}=e;return v.jsxs(iK,{elevation:4,children:[v.jsxs(ne.Stack,{spacing:4,direction:"column",sx:{width:"100%"},alignItems:"center",justifyContent:"center",children:[v.jsx(sK,{alt:r,src:n}),v.jsx(ne.Typography,{variant:"h5",color:"text.primary",children:r}),v.jsx(ne.Typography,{variant:"body1",color:"text.secondary",children:o})]}),v.jsx(ne.Divider,{sx:{marginY:3}}),v.jsxs(lK,{children:[v.jsxs(ne.Typography,{variant:"body2",color:"text.primary",children:[v.jsx("strong",{children:"Email:"})," ",i]}),v.jsxs(ne.Typography,{variant:"body2",color:"text.primary",children:[v.jsx("strong",{children:"Location:"})," ",s]}),v.jsxs(ne.Typography,{variant:"body2",color:"text.primary",children:[v.jsx("strong",{children:"Phone:"})," ",l]})]}),t&&v.jsx(cK,{variant:"contained",fullWidth:!0,onClick:t,children:"Edit Profile"})]})},uK=()=>{const e={imageUrl:"https://www.w3schools.com/w3images/avatar2.png",name:"Abul Kalam",bio:"Senior consultant SKH",email:"abulkalam@example.com",location:"Dhaka, Bangladesh",phoneNumber:"123-456-7890"},t={imageUrl:"https://www.w3schools.com/w3images/avatar1.png",name:"Abul Kalam Azad",bio:"Senior consultant SKH",email:"abulkalam@example.com",location:"Dhaka, Bangladesh",phoneNumber:"123-456-7890"},n=()=>{alert("Edit button clicked!")};return v.jsxs(ne.Stack,{spacing:4,direction:"column",sx:{width:"100%"},children:[v.jsx(u1,{profileData:e,onEditClick:n}),v.jsx(u1,{profileData:t,onEditClick:n})]})},dK="/images/logo.png",pK=V1(ne.Box)({width:"90%",maxWidth:"400px",padding:"20px",backgroundColor:"white",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",borderRadius:"12px",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.2)"}),fK=({backendUrl:e})=>{const{login:t}=Yg(e);return v.jsx(ne.Box,{sx:{width:"100%",height:"100vh",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url('/images/medical-care.jpg')",backgroundSize:"cover",backgroundPosition:"center"},children:v.jsxs(pK,{children:[v.jsx("img",{src:dK,alt:"logo",style:{width:"56px"}}),v.jsxs(ne.Typography,{variant:"h6",sx:{fontWeight:"bold",my:1},color:"black",textAlign:"center",children:["Please login with your ",v.jsx("span",{children:"HSMS"})," account"]}),v.jsx(ws,{fullWidth:!0,variant:"contained",size:"large",onClick:t,startIcon:v.jsx(fR,{}),children:"Login"})]})})},hK=({backendUrl:e,children:t,redirectPath:n="/login",roles:r=[]})=>{var l;const{authenticated:o,user:i}=Yg(e),s=Ut.useLocation();return o?r.length>0&&((l=i==null?void 0:i.realm_access)!=null&&l.roles)&&!r.some(u=>{var d,p;return(p=(d=i==null?void 0:i.realm_access)==null?void 0:d.roles)==null?void 0:p.includes(u)})?v.jsx(Ut.Navigate,{to:n,replace:!0,state:{from:s}}):v.jsx(v.Fragment,{children:t}):v.jsx(Ut.Navigate,{to:n,replace:!0,state:{from:s}})},mK=e=>{var n,r,o,i;const t=[];for(const s of Object.keys(e)){let l=(n=s.match(/\/pages\/(.*)\.tsx$/))==null?void 0:n[1];if(!l)continue;l=l.replace(/\((.*?)\)\//g,""),l.endsWith("/index")&&(l=l.replace(/\/index$/,""));const c=l.replace(/\$/g,":");t.push({path:l==="index"?"/":`${c.toLowerCase()}`,Element:e[s].default,loader:(r=e[s])==null?void 0:r.loader,action:(o=e[s])==null?void 0:o.action,ErrorBoundary:(i=e[s])==null?void 0:i.ErrorBoundary})}return t};function gK(){return v.jsx(ne.Container,{maxWidth:"md",children:v.jsx(ne.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"80vh"},children:v.jsxs(Qr,{container:!0,children:[v.jsxs(Qr,{size:{xs:12,md:6},children:[v.jsx(ne.Typography,{fontWeight:"bold",variant:"h4",children:"Invalid Request"}),v.jsx(ne.Typography,{variant:"h6",children:"The page you are requested does not exist."}),v.jsx(Ut.Link,{to:"/",children:v.jsx(ne.Button,{variant:"contained",children:"Back Home"})})]}),v.jsx(Qr,{size:{xs:12,md:6},children:v.jsx("img",{src:"",alt:"Not Found",width:300,height:200})})]})})})}const bK=({user:e,pages:t,Layout:n,mainLayoutConfig:r,NotFoundPage:o,backendUrl:i})=>{const s=mK(t),l=u=>v.jsx(v.Fragment,{children:e?v.jsx(ne.Box,{sx:{display:"contents",position:"absolute"},children:v.jsx(M.Suspense,{fallback:v.jsx(ne.CircularProgress,{size:40,sx:{ml:"45%"},color:"primary"}),children:v.jsx(u,{})})}):v.jsx(ne.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"300px",padding:5},children:v.jsx(ne.CircularProgress,{color:"inherit",thickness:2,size:70,disableShrink:!0})})}),c=u=>n?v.jsx(n,{children:l(u)}):v.jsx(nb,{layoutConfig:r,children:l(u)});return v.jsx(Ut.BrowserRouter,{children:v.jsxs(Ut.Routes,{children:[v.jsx(Ut.Route,{path:"/login",element:v.jsx(fK,{backendUrl:i})}),s.length===0?v.jsx(Ut.Route,{path:"*",element:v.jsxs(ne.Paper,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:["No Routes page found inside src/pages"," "]})}):s.map(({Element:u,path:d})=>v.jsx(Ut.Route,{path:d,element:v.jsx(hK,{backendUrl:i,roles:["admin"],redirectPath:"/login",children:c(u)})},d)),v.jsx(Ut.Route,{path:"*",element:o?v.jsx(o,{children:null}):v.jsx(gK,{})})]})})},yK={typography:{fontFamily:"Segoe UI"},components:{MuiButton:{styleOverrides:{root:{borderRadius:5}}},MuiTextField:{defaultProps:{variant:"outlined",size:"small"}}}},vK=({children:e,defaultTheme:t})=>{const[n,r]=M.useState(null),[o,i]=M.useState(!0);return M.useEffect(()=>{const s=localStorage.getItem("theme");if(s){const l=JSON.parse(s);r(l)}else localStorage.setItem("theme",JSON.stringify(t)),r(ne.createTheme(yK,t));i(!1)},[]),o?v.jsx("div",{children:v.jsx(ne.CircularProgress,{})}):v.jsx(ne.StyledEngineProvider,{injectFirst:!0,children:n&&v.jsxs(ne.ThemeProvider,{theme:ne.createTheme(n),children:[v.jsx(ne.CssBaseline,{enableColorScheme:!0}),e]})})};exports.AsyncAutocomplete=pV;exports.CheckboxListWithAvatar=nz;exports.ControlledDatePicker=jT;exports.CustomButton=ws;exports.CustomCheckbox=o3;exports.CustomColorPicker=rO;exports.CustomDatePicker=b3;exports.CustomIconButton=jc;exports.CustomInput=$T;exports.CustomRadioGroup=L3;exports.CustomScrollbar=J3;exports.CustomSelect=cU;exports.CustomSelectableList=uU;exports.CustomSwitch=bU;exports.CustomTabs=FO;exports.CustomTextField=yU;exports.MainLayout=nb;exports.MainlayoutWithWrapper=QY;exports.MultiDynamicTable=aK;exports.ProfilePages=uK;exports.RoutesConfigLayout=bK;exports.ThemeCustomization=vK;exports.ThemeSetting=dV;
492
+ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let h=Vo(),m;m=h;let g=m.pathname||"/",f=g;if(d!=="/"){let w=d.replace(/^\//,"").split("/");f="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let y=!i&&n&&n.matches&&n.matches.length>0?n.matches:QE(e,{pathname:f});return Ar(p||y!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Ar(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),dY(y&&y.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Rr([d,o.encodeLocation?o.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?d:Rr([d,o.encodeLocation?o.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,n,r)}function sY(){let e=gY(),t=ZG(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:i},"ErrorBoundary")," or"," ",x.createElement("code",{style:i},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:o},n):null,s)}var lY=x.createElement(sY,null),cY=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?x.createElement(Lr.Provider,{value:this.props.routeContext},x.createElement(Jg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function uY({routeContext:e,match:t,children:n}){let r=x.useContext(ei);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(Lr.Provider,{value:e},n)}function dY(e,t=[],n=null,r=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n==null?void 0:n.errors;if(i!=null){let c=o.findIndex(u=>u.route.id&&(i==null?void 0:i[u.route.id])!==void 0);Kt(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,c+1))}let s=!1,l=-1;if(n)for(let c=0;c<o.length;c++){let u=o[c];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=c),u.route.id){let{loaderData:d,errors:p}=n,h=u.route.loader&&!d.hasOwnProperty(u.route.id)&&(!p||p[u.route.id]===void 0);if(u.route.lazy||h){s=!0,l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}return o.reduceRight((c,u,d)=>{let p,h=!1,m=null,g=null;n&&(p=i&&u.route.id?i[u.route.id]:void 0,m=u.route.errorElement||lY,s&&(l<0&&d===0?(sR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,g=null):l===d&&(h=!0,g=u.route.hydrateFallbackElement||null)));let f=t.concat(o.slice(0,d+1)),y=()=>{let w;return p?w=m:h?w=g:u.route.Component?w=x.createElement(u.route.Component,null):u.route.element?w=u.route.element:w=c,x.createElement(uY,{match:u,routeContext:{outlet:c,matches:f,isDataRoute:n!=null},children:w})};return n&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?x.createElement(cY,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:y(),routeContext:{outlet:null,matches:f,isDataRoute:!0}}):y()},null)}function Qg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pY(e){let t=x.useContext(ei);return Kt(t,Qg(e)),t}function fY(e){let t=x.useContext(wu);return Kt(t,Qg(e)),t}function hY(e){let t=x.useContext(Lr);return Kt(t,Qg(e)),t}function Zg(e){let t=hY(e),n=t.matches[t.matches.length-1];return Kt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function mY(){return Zg("useRouteId")}function gY(){var e;let t=x.useContext(Jg),n=fY("useRouteError"),r=Zg("useRouteError");return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function bY(){let{router:e}=pY("useNavigate"),t=Zg("useNavigate"),n=x.useRef(!1);return iR(()=>{n.current=!0}),x.useCallback(async(r,o={})=>{Ar(n.current,aR),n.current&&(typeof r=="number"?e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var s1={};function sR(e,t,n){!t&&!s1[e]&&(s1[e]=!0,Ar(!1,n))}x.memo(yY);function yY({routes:e,future:t,state:n}){return iY(e,void 0,n,t)}var Ol="get",Tl="application/x-www-form-urlencoded";function Cu(e){return e!=null&&typeof e.tagName=="string"}function vY(e){return Cu(e)&&e.tagName.toLowerCase()==="button"}function xY(e){return Cu(e)&&e.tagName.toLowerCase()==="form"}function wY(e){return Cu(e)&&e.tagName.toLowerCase()==="input"}function SY(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function CY(e,t){return e.button===0&&(!t||t==="_self")&&!SY(e)}var ll=null;function OY(){if(ll===null)try{new FormData(document.createElement("form"),0),ll=!1}catch{ll=!0}return ll}var TY=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function uh(e){return e!=null&&!TY.has(e)?(Ar(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tl}"`),null):e}function EY(e,t){let n,r,o,i,s;if(xY(e)){let l=e.getAttribute("action");r=l?Ao(l,t):null,n=e.getAttribute("method")||Ol,o=uh(e.getAttribute("enctype"))||Tl,i=new FormData(e)}else if(vY(e)||wY(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?Ao(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Ol,o=uh(e.getAttribute("formenctype"))||uh(l.getAttribute("enctype"))||Tl,i=new FormData(l,e),!OY()){let{name:u,type:d,value:p}=e;if(d==="image"){let h=u?`${u}.`:"";i.append(`${h}x`,"0"),i.append(`${h}y`,"0")}else u&&i.append(u,p)}}else{if(Cu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ol,r=null,o=Tl,s=e}return i&&o==="text/plain"&&(s=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:s}}function eb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function RY(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function kY(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function PY(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let s=await RY(i,n);return s.links?s.links():[]}return[]}));return jY(r.flat(1).filter(kY).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function l1(e,t,n,r,o,i){let s=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var d;return n[u].pathname!==c.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>s(c,u)||l(c,u)):i==="data"?t.filter((c,u)=>{var d;let p=r.routes[c.route.id];if(!p||!p.hasLoader)return!1;if(s(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let h=c.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((d=n[0])==null?void 0:d.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function IY(e,t,{includeHydrateFallback:n}={}){return MY(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function MY(e){return[...new Set(e)]}function AY(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function jY(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(AY(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function DY(e){let t=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return t.pathname==="/"?t.pathname="_root.data":t.pathname=`${t.pathname.replace(/\/$/,"")}.data`,t}function $Y(){let e=x.useContext(ei);return eb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function NY(){let e=x.useContext(wu);return eb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var tb=x.createContext(void 0);tb.displayName="FrameworkContext";function lR(){let e=x.useContext(tb);return eb(e,"You must render this element inside a <HydratedRouter> element"),e}function _Y(e,t){let n=x.useContext(tb),[r,o]=x.useState(!1),[i,s]=x.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,h=x.useRef(null);x.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let f=w=>{w.forEach(O=>{s(O.isIntersecting)})},y=new IntersectionObserver(f,{threshold:.5});return h.current&&y.observe(h.current),()=>{y.disconnect()}}},[e]),x.useEffect(()=>{if(r){let f=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(f)}}},[r]);let m=()=>{o(!0)},g=()=>{o(!1),s(!1)};return n?e!=="intent"?[i,h,{}]:[i,h,{onFocus:Ti(l,m),onBlur:Ti(c,g),onMouseEnter:Ti(u,m),onMouseLeave:Ti(d,g),onTouchStart:Ti(p,m)}]:[!1,h,{}]}function Ti(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function FY({page:e,...t}){let{router:n}=$Y(),r=x.useMemo(()=>QE(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?x.createElement(BY,{page:e,matches:r,...t}):null}function LY(e){let{manifest:t,routeModules:n}=lR(),[r,o]=x.useState([]);return x.useEffect(()=>{let i=!1;return PY(e,t,n).then(s=>{i||o(s)}),()=>{i=!0}},[e,t,n]),r}function BY({page:e,matches:t,...n}){let r=Vo(),{manifest:o,routeModules:i}=lR(),{loaderData:s,matches:l}=NY(),c=x.useMemo(()=>l1(e,t,l,o,r,"data"),[e,t,l,o,r]),u=x.useMemo(()=>l1(e,t,l,o,r,"assets"),[e,t,l,o,r]),d=x.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let m=new Set,g=!1;if(t.forEach(y=>{var w;let O=o.routes[y.route.id];!O||!O.hasLoader||(!c.some(C=>C.route.id===y.route.id)&&y.route.id in s&&(w=i[y.route.id])!=null&&w.shouldRevalidate||O.hasClientLoader?g=!0:m.add(y.route.id))}),m.size===0)return[];let f=DY(e);return g&&m.size>0&&f.searchParams.set("_routes",t.filter(y=>m.has(y.route.id)).map(y=>y.route.id).join(",")),[f.pathname+f.search]},[s,r,o,c,t,e,i]),p=x.useMemo(()=>IY(u,o),[u,o]),h=LY(u);return x.createElement(x.Fragment,null,d.map(m=>x.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),p.map(m=>x.createElement("link",{key:m,rel:"modulepreload",href:m,...n})),h.map(({key:m,link:g})=>x.createElement("link",{key:m,...g})))}function VY(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var cR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{cR&&(window.__reactRouterVersion="7.2.0")}catch{}var uR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dR=x.forwardRef(function({onClick:e,discover:t="render",prefetch:n="none",relative:r,reloadDocument:o,replace:i,state:s,target:l,to:c,preventScrollReset:u,viewTransition:d,...p},h){let{basename:m}=x.useContext(Fr),g=typeof c=="string"&&uR.test(c),f,y=!1;if(typeof c=="string"&&g&&(f=c,cR))try{let P=new URL(window.location.href),D=c.startsWith("//")?new URL(P.protocol+c):new URL(c),b=Ao(D.pathname,m);D.origin===P.origin&&b!=null?c=b+D.search+D.hash:y=!0}catch{Ar(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let w=rY(c,{relative:r}),[O,C,S]=_Y(n,p),T=UY(c,{replace:i,state:s,target:l,preventScrollReset:u,relative:r,viewTransition:d});function k(P){e&&e(P),P.defaultPrevented||T(P)}let A=x.createElement("a",{...p,...S,href:f||w,onClick:y||o?e:k,ref:VY(h,C),target:l,"data-discover":!g&&t==="render"?"true":void 0});return O&&!g?x.createElement(x.Fragment,null,A,x.createElement(FY,{page:w})):A});dR.displayName="Link";var zY=x.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:r=!1,style:o,to:i,viewTransition:s,children:l,...c},u){let d=$s(i,{relative:c.relative}),p=Vo(),h=x.useContext(wu),{navigator:m,basename:g}=x.useContext(Fr),f=h!=null&&XY(d)&&s===!0,y=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,w=p.pathname,O=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;t||(w=w.toLowerCase(),O=O?O.toLowerCase():null,y=y.toLowerCase()),O&&g&&(O=Ao(O,g)||O);const C=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let S=w===y||!r&&w.startsWith(y)&&w.charAt(C)==="/",T=O!=null&&(O===y||!r&&O.startsWith(y)&&O.charAt(y.length)==="/"),k={isActive:S,isPending:T,isTransitioning:f},A=S?e:void 0,P;typeof n=="function"?P=n(k):P=[n,S?"active":null,T?"pending":null,f?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o(k):o;return x.createElement(dR,{...c,"aria-current":A,className:P,ref:u,style:D,to:i,viewTransition:s},typeof l=="function"?l(k):l)});zY.displayName="NavLink";var WY=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:s=Ol,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:p,...h},m)=>{let g=YY(),f=KY(l,{relative:u}),y=s.toLowerCase()==="get"?"get":"post",w=typeof l=="string"&&uR.test(l),O=C=>{if(c&&c(C),C.defaultPrevented)return;C.preventDefault();let S=C.nativeEvent.submitter,T=(S==null?void 0:S.getAttribute("formmethod"))||s;g(S||C.currentTarget,{fetcherKey:t,method:T,navigate:n,replace:o,state:i,relative:u,preventScrollReset:d,viewTransition:p})};return x.createElement("form",{ref:m,method:y,action:f,onSubmit:r?c:O,...h,"data-discover":!w&&e==="render"?"true":void 0})});WY.displayName="Form";function qY(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pR(e){let t=x.useContext(ei);return Kt(t,qY(e)),t}function UY(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:i,viewTransition:s}={}){let l=oY(),c=Vo(),u=$s(e,{relative:i});return x.useCallback(d=>{if(CY(d,t)){d.preventDefault();let p=n!==void 0?n:Uh(c)===Uh(u);l(e,{replace:p,state:r,preventScrollReset:o,relative:i,viewTransition:s})}},[c,l,u,n,r,t,e,o,i,s])}var HY=0,GY=()=>`__${String(++HY)}__`;function YY(){let{router:e}=pR("useSubmit"),{basename:t}=x.useContext(Fr),n=mY();return x.useCallback(async(r,o={})=>{let{action:i,method:s,encType:l,formData:c,body:u}=EY(r,t);if(o.navigate===!1){let d=o.fetcherKey||GY();await e.fetch(d,n,o.action||i,{preventScrollReset:o.preventScrollReset,formData:c,body:u,formMethod:o.method||s,formEncType:o.encType||l,flushSync:o.flushSync})}else await e.navigate(o.action||i,{preventScrollReset:o.preventScrollReset,formData:c,body:u,formMethod:o.method||s,formEncType:o.encType||l,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[e,t,n])}function KY(e,{relative:t}={}){let{basename:n}=x.useContext(Fr),r=x.useContext(Lr);Kt(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...$s(e||".",{relative:t})},s=Vo();if(e==null){i.search=s.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(u=>u==="")){l.delete("index"),c.filter(d=>d).forEach(d=>l.append("index",d));let u=l.toString();i.search=u?`?${u}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:Rr([n,i.pathname])),Uh(i)}function XY(e,t={}){let n=x.useContext(oR);Kt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=pR("useViewTransitionState"),o=$s(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Ao(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=Ao(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ec(o.pathname,s)!=null||ec(o.pathname,i)!=null}new TextEncoder;const fR=st(v.jsx("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"}),"Login"),JY=({userManage:e})=>{const[t,n]=M.useState(null),[r,o]=M.useState(!1),{user:i,redirectUrl:s}=e,l="",{logout:c,authenticated:u}=Yg(l);console.log(u);const d=h=>{n(h.currentTarget),o(!0)},p=()=>{o(!1)};return v.jsxs(v.Fragment,{children:[v.jsx(ne.IconButton,{onClick:d,children:v.jsx(ne.Avatar,{src:i.image,alt:i==null?void 0:i.name})}),v.jsx(ne.Popover,{open:r,anchorEl:t,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:v.jsxs(ne.List,{sx:{padding:2,width:200},children:[v.jsx(Ut.Link,{to:s,style:{textDecoration:"none",color:"inherit"},children:v.jsx(ne.ListItemButton,{children:v.jsxs(ne.Box,{children:[v.jsx(ne.Typography,{variant:"subtitle1",children:i==null?void 0:i.name}),v.jsx(ne.Typography,{variant:"body2",sx:{color:"gray"},children:i==null?void 0:i.email})]})})}),v.jsx(ne.ListItemButton,{disableGutters:!0,sx:{py:0},children:v.jsx(ws,{fullWidth:!0,variant:"contained",size:"large",onClick:c,startIcon:v.jsx(fR,{}),children:"Logout"})})]})})]})},nb=({children:e,layoutConfig:t})=>{var h,m;const[n,r]=M.useState(!1),[o,i]=M.useState(t.sideDrawer.isMinimized),s=ne.useMediaQuery(g=>g.breakpoints.up("md")),l=t.navbar.showHamburgerInMobile&&!s,c=s?"permanent":"temporary",u=o?60:t.sideDrawer.drawerWidth,d=()=>{r(!n)},p=()=>{i(!o)};return v.jsxs(ne.Box,{children:[v.jsxs(ne.Box,{component:"main",sx:{flexGrow:1,ml:{md:`${u}px`}},children:[v.jsx(OU,{children:v.jsxs(ne.Stack,{direction:"row",spacing:2,alignItems:"center",justifyContent:"space-between",width:"100%",children:[l&&v.jsxs(ne.Stack,{direction:"row",alignItems:"center",justifyContent:"center",children:[v.jsx(jc,{"aria-label":"menu",onClick:d,sx:{mr:"8px"},children:v.jsx(vU,{})}),v.jsx(Ut.Link,{to:"/",style:{textDecoration:"none",color:"inherit"},children:v.jsx(ne.Typography,{variant:"h5",color:"primary",children:Xn==null?void 0:Xn.moduleName})})]}),!l&&v.jsx(Ut.Link,{to:"/",style:{textDecoration:"none",color:"inherit"},children:v.jsx(ne.Typography,{variant:"h5",color:"primary",children:Xn.moduleName})}),v.jsx(ne.Box,{}),((h=t==null?void 0:t.navbar)==null?void 0:h.userManage)&&v.jsx(JY,{userManage:(m=t==null?void 0:t.navbar)==null?void 0:m.userManage})]})}),v.jsx(xU,{fixed:!0,children:e}),v.jsx(CU,{footerText:t.footerText})]}),v.jsx(PU,{isSidebarOpen:n,toggleSidebar:d,variant:c,drawerWidth:u,menuConfig:t.sideDrawer.menuConfig,showOnlyIcons:o,toggleSidebarDesktop:p})]})},QY=({children:e,layoutConfig:t})=>v.jsx(Ut.BrowserRouter,{children:v.jsx(nb,{layoutConfig:t,children:e})}),ZY=st(v.jsx("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList"),c1=st(v.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),eK=st(v.jsx("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z"}),"Done"),tK=({data:e,handleColumnVisibility:t})=>{const[n,r]=M.useState(null),[o,i]=M.useState(!1),s=m=>{r(m.currentTarget)},l=()=>{i(!1),r(null)},c=!!n,u=c?"simple-popover":void 0,d=e[0].filter(m=>m.isVisible),p=e[0].filter(m=>!m.isVisible),h=m=>{const g=e.map(f=>f.map(y=>y.id===m?{...y,isVisible:!y.isVisible}:y));console.log(g),t(g)};return console.log(e),v.jsxs(v.Fragment,{children:[v.jsx(ne.Tooltip,{title:"Add new",arrow:!0,children:v.jsx(ws,{variant:"text",onClick:s,children:v.jsx(c1,{})})}),v.jsx(ig,{id:u,open:c,anchorEl:n,onClose:l,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:v.jsx(ne.Paper,{elevation:3,style:{padding:"16px",minWidth:"200px"},children:v.jsx(v.Fragment,{children:o?v.jsx(v.Fragment,{}):v.jsxs(v.Fragment,{children:[v.jsx(ne.Typography,{variant:"h6",fontWeight:"bold",children:"Visible Items"}),v.jsx(ne.List,{children:d.map(m=>v.jsxs(ne.ListItemButton,{onClick:()=>h(m.id),children:[v.jsx(ne.ListItemIcon,{sx:{minWidth:"32px"},children:v.jsx(eK,{})}),v.jsx(ne.ListItemText,{slotProps:{primary:{variant:"body2"}},primary:`${m.fieldName}`})]},m.id))}),v.jsx(ne.Typography,{variant:"h6",fontWeight:"bold",children:"Not Visible Items"}),v.jsx(ne.List,{children:p.map(m=>v.jsxs(ne.ListItemButton,{onClick:()=>h(m.id),children:[v.jsx(ne.ListItemIcon,{sx:{minWidth:"32px"},children:v.jsx(c1,{})}),v.jsx(ne.ListItemText,{slotProps:{primary:{variant:"body2"}},primary:`${m.fieldName}`})]},m.id))})]})})})})]})},nK=ee(Ut.Link)(({theme:e})=>({textDecoration:"none",color:"inherit","&:hover":{color:e.palette.primary.main}})),rK=({item:e,itemIndex:t,rowIndex:n})=>v.jsxs(ne.Grid2,{container:!0,spacing:2,children:[t===0&&v.jsx(ne.Grid2,{size:{xs:2},children:n+1}),e.isVisible&&v.jsxs(ne.Grid2,{size:{xs:10},children:[e.fieldType==="link"&&v.jsx(nK,{to:e.to||"/",children:e.fieldContent}),e.fieldType==="label"&&v.jsx(ne.Chip,{label:typeof e.fieldContent=="string"?e.fieldContent:"",color:"primary",variant:"outlined"}),e.fieldType==="text"&&v.jsx(ne.Typography,{variant:"body2",children:e.fieldContent}),e.fieldType==="date"&&v.jsx(ne.Typography,{variant:"body2",color:"primary",children:e.fieldContent}),e.fieldType==="actions"&&v.jsx(ne.Grid2,{container:!0,spacing:2,children:Array.isArray(e.fieldContent)&&e.fieldContent.length>0&&e.fieldContent.map((r,o)=>v.jsx(ne.Grid2,{children:v.jsx(ne.Chip,{label:r.label,onClick:()=>r.onClick(e),icon:r.icon,color:"primary",variant:r.variant})},o))}),e.fieldType==="date-picker"&&v.jsx(jT,{label:"Date",initialValue:e.fieldContent.date,onChange:r=>{e.fieldContent.onChange&&r&&e.fieldContent.onChange(e,r.toDate())}})]})]}),oK=(e,t)=>t?e.filter(n=>n.some(r=>r.isVisible&&typeof r.fieldContent=="string"&&r.fieldContent.toLowerCase().includes(t.toLowerCase()))):e,cl=ee(ne.TableCell)(({theme:e})=>({minWidth:240,maxWidth:580,borderTop:"1px solid",borderBottom:"1px solid",borderTopColor:e.palette.neutral[200],borderBottomColor:e.palette.neutral[200],wordWrap:"break-word",minHeight:"35px"})),aK=({tableData:e,rowsPerPage:t,page:n,handleChangePage:r,handleChangeRowsPerPage:o})=>{const[i,s]=M.useState([]),[l,c]=M.useState([]),[u,d]=M.useState([]);M.useEffect(()=>{if(e.length>0){s(e),c(e);const g=e[0].map(f=>f);d(g)}},[e]);const p=g=>{const f=oK(l,g);s(f)},h=()=>{s(l)},m=g=>{const f=g[0].map(y=>y);d(f),s(g),c(g)};return v.jsxs(ne.TableContainer,{component:ne.Paper,sx:{minHeight:"80vh",width:"100%",overflow:"auto"},children:[v.jsx(ne.Box,{sx:{width:"100%"},children:v.jsx($T,{startIcon:v.jsx(ZY,{}),placeholder:"Filter by keyword or field",count:i.length,onChange:p,onClear:h})}),v.jsxs(ne.Table,{stickyHeader:!0,"aria-label":"sticky table",sx:{minWidth:650,width:"100%"},children:[v.jsx(ne.TableHead,{children:v.jsxs(ne.TableRow,{children:[u.length>0&&u.map((g,f)=>g.isVisible?v.jsx(cl,{sx:{height:"30px"},children:v.jsxs(ne.Grid,{container:!0,spacing:2,children:[f===0&&v.jsx(ne.Grid,{item:!0,xs:2}),g.isVisible&&v.jsx(ne.Grid,{item:!0,xs:10,children:v.jsx(ne.Typography,{variant:"body2",fontWeight:"bold",children:g.fieldName})})]})},f):null),v.jsx(cl,{sx:{width:20},align:"center",children:i.length>0&&v.jsx(tK,{data:i,handleColumnVisibility:m})})]})}),v.jsx(ne.TableBody,{children:i.slice(n*t,n*t+t).map((g,f)=>v.jsxs(ne.TableRow,{hover:!0,children:[g.length>0&&g.map((y,w)=>y.isVisible?v.jsx(cl,{children:v.jsx(rK,{item:y,itemIndex:w,rowIndex:f})},`${y.fieldName}-${w}`):null),v.jsx(cl,{align:"center"})]},f))})]}),v.jsx(ne.TablePagination,{rowsPerPageOptions:[5,10,25],component:"div",count:i.length,rowsPerPage:t,page:n,onPageChange:r,onRowsPerPageChange:o})]})},iK=ne.styled(ne.Paper)(({theme:e})=>({padding:e.spacing(4),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.paper})),sK=ne.styled(ne.Avatar)(({theme:e})=>({width:e.spacing(12),height:e.spacing(12),marginBottom:e.spacing(2),border:`4px solid ${e.palette.background.paper}`})),lK=ne.styled(ne.Box)(({theme:e})=>({textAlign:"left",marginTop:e.spacing(2),"& .MuiTypography-root":{marginBottom:e.spacing(1)}})),cK=ne.styled(ne.Button)(({theme:e})=>({marginTop:e.spacing(2),backgroundColor:e.palette.primary.main,"&:hover":{backgroundColor:e.palette.primary.dark}})),u1=({profileData:e,onEditClick:t})=>{const{imageUrl:n,name:r,bio:o,email:i,location:s,phoneNumber:l}=e;return v.jsxs(iK,{elevation:4,children:[v.jsxs(ne.Stack,{spacing:4,direction:"column",sx:{width:"100%"},alignItems:"center",justifyContent:"center",children:[v.jsx(sK,{alt:r,src:n}),v.jsx(ne.Typography,{variant:"h5",color:"text.primary",children:r}),v.jsx(ne.Typography,{variant:"body1",color:"text.secondary",children:o})]}),v.jsx(ne.Divider,{sx:{marginY:3}}),v.jsxs(lK,{children:[v.jsxs(ne.Typography,{variant:"body2",color:"text.primary",children:[v.jsx("strong",{children:"Email:"})," ",i]}),v.jsxs(ne.Typography,{variant:"body2",color:"text.primary",children:[v.jsx("strong",{children:"Location:"})," ",s]}),v.jsxs(ne.Typography,{variant:"body2",color:"text.primary",children:[v.jsx("strong",{children:"Phone:"})," ",l]})]}),t&&v.jsx(cK,{variant:"contained",fullWidth:!0,onClick:t,children:"Edit Profile"})]})},uK=()=>{const e={imageUrl:"https://www.w3schools.com/w3images/avatar2.png",name:"Abul Kalam",bio:"Senior consultant SKH",email:"abulkalam@example.com",location:"Dhaka, Bangladesh",phoneNumber:"123-456-7890"},t={imageUrl:"https://www.w3schools.com/w3images/avatar1.png",name:"Abul Kalam Azad",bio:"Senior consultant SKH",email:"abulkalam@example.com",location:"Dhaka, Bangladesh",phoneNumber:"123-456-7890"},n=()=>{alert("Edit button clicked!")};return v.jsxs(ne.Stack,{spacing:4,direction:"column",sx:{width:"100%"},children:[v.jsx(u1,{profileData:e,onEditClick:n}),v.jsx(u1,{profileData:t,onEditClick:n})]})},dK="/images/logo.png",pK=V1(ne.Box)({width:"90%",maxWidth:"400px",padding:"20px",backgroundColor:"white",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",borderRadius:"12px",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.2)"}),fK=({backendUrl:e})=>{const{login:t}=Yg(e);return v.jsx(ne.Box,{sx:{width:"100%",height:"100vh",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url('/src/assets/medical-care.jpg')",backgroundSize:"cover",backgroundPosition:"center"},children:v.jsxs(pK,{children:[v.jsx("img",{src:dK,alt:"logo",style:{width:"56px"}}),v.jsxs(ne.Typography,{variant:"h6",sx:{fontWeight:"bold",my:1},color:"black",textAlign:"center",children:["Please login with your ",v.jsx("span",{children:"HSMS"})," account"]}),v.jsx(ws,{fullWidth:!0,variant:"contained",size:"large",onClick:t,startIcon:v.jsx(fR,{}),children:"Login"})]})})},hK=({backendUrl:e,children:t,redirectPath:n="/login",roles:r=[]})=>{var l;const{authenticated:o,user:i}=Yg(e),s=Ut.useLocation();return o?r.length>0&&((l=i==null?void 0:i.realm_access)!=null&&l.roles)&&!r.some(u=>{var d,p;return(p=(d=i==null?void 0:i.realm_access)==null?void 0:d.roles)==null?void 0:p.includes(u)})?v.jsx(Ut.Navigate,{to:n,replace:!0,state:{from:s}}):v.jsx(v.Fragment,{children:t}):v.jsx(Ut.Navigate,{to:n,replace:!0,state:{from:s}})},mK=e=>{var n,r,o,i;const t=[];for(const s of Object.keys(e)){let l=(n=s.match(/\/pages\/(.*)\.tsx$/))==null?void 0:n[1];if(!l)continue;l=l.replace(/\((.*?)\)\//g,""),l.endsWith("/index")&&(l=l.replace(/\/index$/,""));const c=l.replace(/\$/g,":");t.push({path:l==="index"?"/":`${c.toLowerCase()}`,Element:e[s].default,loader:(r=e[s])==null?void 0:r.loader,action:(o=e[s])==null?void 0:o.action,ErrorBoundary:(i=e[s])==null?void 0:i.ErrorBoundary})}return t};function gK(){return v.jsx(ne.Container,{maxWidth:"md",children:v.jsx(ne.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"80vh"},children:v.jsxs(Qr,{container:!0,children:[v.jsxs(Qr,{size:{xs:12,md:6},children:[v.jsx(ne.Typography,{fontWeight:"bold",variant:"h4",children:"Invalid Request"}),v.jsx(ne.Typography,{variant:"h6",children:"The page you are requested does not exist."}),v.jsx(Ut.Link,{to:"/",children:v.jsx(ne.Button,{variant:"contained",children:"Back Home"})})]}),v.jsx(Qr,{size:{xs:12,md:6},children:v.jsx("img",{src:"",alt:"Not Found",width:300,height:200})})]})})})}const bK=({user:e,pages:t,Layout:n,mainLayoutConfig:r,NotFoundPage:o,backendUrl:i})=>{const s=mK(t),l=u=>v.jsx(v.Fragment,{children:e?v.jsx(ne.Box,{sx:{display:"contents",position:"absolute"},children:v.jsx(M.Suspense,{fallback:v.jsx(ne.CircularProgress,{size:40,sx:{ml:"45%"},color:"primary"}),children:v.jsx(u,{})})}):v.jsx(ne.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"300px",padding:5},children:v.jsx(ne.CircularProgress,{color:"inherit",thickness:2,size:70,disableShrink:!0})})}),c=u=>n?v.jsx(n,{children:l(u)}):v.jsx(nb,{layoutConfig:r,children:l(u)});return v.jsx(Ut.BrowserRouter,{children:v.jsxs(Ut.Routes,{children:[v.jsx(Ut.Route,{path:"/login",element:v.jsx(fK,{backendUrl:i})}),s.length===0?v.jsx(Ut.Route,{path:"*",element:v.jsxs(ne.Paper,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:["No Routes page found inside src/pages"," "]})}):s.map(({Element:u,path:d})=>v.jsx(Ut.Route,{path:d,element:v.jsx(hK,{backendUrl:i,roles:["admin"],redirectPath:"/login",children:c(u)})},d)),v.jsx(Ut.Route,{path:"*",element:o?v.jsx(o,{children:null}):v.jsx(gK,{})})]})})},yK={typography:{fontFamily:"Segoe UI"},components:{MuiButton:{styleOverrides:{root:{borderRadius:5}}},MuiTextField:{defaultProps:{variant:"outlined",size:"small"}}}},vK=({children:e,defaultTheme:t})=>{const[n,r]=M.useState(null),[o,i]=M.useState(!0);return M.useEffect(()=>{const s=localStorage.getItem("theme");if(s){const l=JSON.parse(s);r(l)}else localStorage.setItem("theme",JSON.stringify(t)),r(ne.createTheme(yK,t));i(!1)},[]),o?v.jsx("div",{children:v.jsx(ne.CircularProgress,{})}):v.jsx(ne.StyledEngineProvider,{injectFirst:!0,children:n&&v.jsxs(ne.ThemeProvider,{theme:ne.createTheme(n),children:[v.jsx(ne.CssBaseline,{enableColorScheme:!0}),e]})})};exports.AsyncAutocomplete=pV;exports.CheckboxListWithAvatar=nz;exports.ControlledDatePicker=jT;exports.CustomButton=ws;exports.CustomCheckbox=o3;exports.CustomColorPicker=rO;exports.CustomDatePicker=b3;exports.CustomIconButton=jc;exports.CustomInput=$T;exports.CustomRadioGroup=L3;exports.CustomScrollbar=J3;exports.CustomSelect=cU;exports.CustomSelectableList=uU;exports.CustomSwitch=bU;exports.CustomTabs=FO;exports.CustomTextField=yU;exports.MainLayout=nb;exports.MainlayoutWithWrapper=QY;exports.MultiDynamicTable=aK;exports.ProfilePages=uK;exports.RoutesConfigLayout=bK;exports.ThemeCustomization=vK;exports.ThemeSetting=dV;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@crystaltech/hsms-shared-ui",
3
3
  "private": false,
4
- "version": "0.0.2-alpha-0.0.12",
4
+ "version": "0.0.2-alpha-0.0.14",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
Binary file