spry-apps-dropdown 3.0.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accountStorage.d.ts +4 -34
- package/dist/constants.d.ts +0 -4
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2319 -2310
- package/dist/index.js.map +1 -1
- package/dist/keycloakLogout.d.ts +0 -12
- package/dist/useAccountManager.d.ts +7 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("react/jsx-runtime"),_=require("react"),I=require("@mui/material"),sr=require("framer-motion"),Pn=require("@emotion/styled");require("@emotion/react");const Lt=require("@mui/icons-material"),Ge=require("oidc-client-ts");function Nn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ae=Nn(_);function Vr({apps:e,open:t,onClose:r,buttonRef:n,isLoading:o=!1,error:i=null,onRetry:c,excludeAppId:l}){const f=_.useRef(null),[u,y]=_.useState("64px"),d=()=>{const h=window.location.origin;return e.find(a=>a.url.startsWith(h))?.id},g=e.filter(h=>{if(l&&h.id===l)return!1;const a=d();return!(a&&h.id===a)});_.useLayoutEffect(()=>{if(t&&n?.current){const h=n.current.getBoundingClientRect();y(`${h.bottom+8}px`)}},[t,n]),_.useEffect(()=>{const h=a=>{f.current&&!f.current.contains(a.target)&&n?.current&&!n.current.contains(a.target)&&r()};return t&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[t,r,n]);const v=h=>{window.open(h,"_blank"),r()};return w.jsx(sr.AnimatePresence,{children:t&&w.jsx(sr.motion.div,{ref:f,initial:{opacity:0,scaleX:.6,scaleY:.6,y:-8},animate:{opacity:1,scaleX:1,scaleY:1,y:0},exit:{opacity:0,scaleX:.6,scaleY:.6,y:-8},transition:{duration:.18,ease:"easeOut"},style:{position:"absolute",top:u,right:"16px",zIndex:1e3,transformOrigin:"top right"},children:w.jsxs(I.Box,{sx:{bgcolor:"#E8F0FE",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",p:2,width:"320px",minHeight:"100px"},onClick:h=>h.stopPropagation(),children:[o&&g.length===0&&w.jsx(I.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px"},children:w.jsx(I.CircularProgress,{size:32})}),i&&g.length===0&&w.jsxs(I.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",gap:1},children:[w.jsx(I.Typography,{sx:{fontSize:"0.875rem",color:"#ea4335",textAlign:"center"},children:"Failed to load apps"}),c&&w.jsx(I.Link,{component:"button",onClick:c,sx:{fontSize:"0.875rem",color:"#1a73e8",cursor:"pointer",textDecoration:"underline"},children:"Retry"})]}),g.length>0&&w.jsx(I.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:1},children:g.map(h=>w.jsxs(I.Link,{onClick:()=>v(h.url),sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",p:1.5,borderRadius:"12px",cursor:"pointer",textDecoration:"none",transition:"background-color 200ms","&:hover":{bgcolor:"#f1f3f4"}},title:h.description,children:[w.jsx(I.Box,{sx:{pb:1},children:h.iconUrl?w.jsx(I.Box,{component:"img",src:h.iconUrl,alt:h.name,sx:{width:"32px",height:"32px",objectFit:"contain"}}):w.jsx(I.Box,{sx:{width:"32px",height:"32px",borderRadius:"6px",bgcolor:h.color||"#4285f4",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.5rem"},children:h.name.charAt(0)})}),w.jsx(I.Typography,{sx:{fontSize:"0.75rem",fontWeight:500,color:"#202124",textAlign:"center",lineHeight:1.2},children:h.name})]},h.id))})]})})})}const xt="spry_apps_cache",Un=300*1e3,Dn=300*1e3;function Wr(e,t={}){const{refetchInterval:r=Un,cacheTime:n=Dn}=t,[o,i]=_.useState([]),[c,l]=_.useState(!0),[f,u]=_.useState(null),y=_.useRef(null),d=_.useRef(null),g=_.useCallback(()=>{try{const a=localStorage.getItem(xt);if(!a)return null;const b=JSON.parse(a);return Date.now()-b.timestamp<n?b.apps:(localStorage.removeItem(xt),null)}catch(a){return console.error("Error loading from cache:",a),null}},[n]),v=_.useCallback(a=>{try{const b={apps:a,timestamp:Date.now()};localStorage.setItem(xt,JSON.stringify(b))}catch(b){console.error("Error saving to cache:",b)}},[]),h=_.useCallback(async()=>{d.current&&d.current.abort(),d.current=new AbortController;try{l(!0),u(null);const a=await fetch(`${e}/api/apps`,{signal:d.current.signal,headers:{Accept:"application/json"}});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const b=await a.json();i(b.apps),v(b.apps),u(null)}catch(a){if(a instanceof Error&&a.name==="AbortError")return;const b=a instanceof Error?a.message:"Failed to fetch apps";u(b),console.error("Error fetching apps:",a);const x=g();x&&i(x)}finally{l(!1)}},[e,g,v]);return _.useEffect(()=>{const a=g();return a&&(i(a),l(!1)),h(),r>0&&(y.current=window.setInterval(()=>{h()},r)),()=>{y.current&&window.clearInterval(y.current),d.current&&d.current.abort()}},[e,r,n]),{apps:o,isLoading:c,error:f,refetch:h}}function Mn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qe={exports:{}},H={};var ar;function jn(){if(ar)return H;ar=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),v=Symbol.for("react.client.reference");function h(a){if(typeof a=="object"&&a!==null){var b=a.$$typeof;switch(b){case e:switch(a=a.type,a){case r:case o:case n:case f:case u:case g:return a;default:switch(a=a&&a.$$typeof,a){case c:case l:case d:case y:return a;case i:return a;default:return b}}case t:return b}}}return H.ContextConsumer=i,H.ContextProvider=c,H.Element=e,H.ForwardRef=l,H.Fragment=r,H.Lazy=d,H.Memo=y,H.Portal=t,H.Profiler=o,H.StrictMode=n,H.Suspense=f,H.SuspenseList=u,H.isContextConsumer=function(a){return h(a)===i},H.isContextProvider=function(a){return h(a)===c},H.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===e},H.isForwardRef=function(a){return h(a)===l},H.isFragment=function(a){return h(a)===r},H.isLazy=function(a){return h(a)===d},H.isMemo=function(a){return h(a)===y},H.isPortal=function(a){return h(a)===t},H.isProfiler=function(a){return h(a)===o},H.isStrictMode=function(a){return h(a)===n},H.isSuspense=function(a){return h(a)===f},H.isSuspenseList=function(a){return h(a)===u},H.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===r||a===o||a===n||a===f||a===u||typeof a=="object"&&a!==null&&(a.$$typeof===d||a.$$typeof===y||a.$$typeof===c||a.$$typeof===i||a.$$typeof===l||a.$$typeof===v||a.getModuleId!==void 0)},H.typeOf=h,H}var J={};var cr;function Ln(){return cr||(cr=1,process.env.NODE_ENV!=="production"&&(function(){function e(a){if(typeof a=="object"&&a!==null){var b=a.$$typeof;switch(b){case t:switch(a=a.type,a){case n:case i:case o:case u:case y:case v:return a;default:switch(a=a&&a.$$typeof,a){case l:case f:case g:case d:return a;case c:return a;default:return b}}case r:return b}}}var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.view_transition"),h=Symbol.for("react.client.reference");J.ContextConsumer=c,J.ContextProvider=l,J.Element=t,J.ForwardRef=f,J.Fragment=n,J.Lazy=g,J.Memo=d,J.Portal=r,J.Profiler=i,J.StrictMode=o,J.Suspense=u,J.SuspenseList=y,J.isContextConsumer=function(a){return e(a)===c},J.isContextProvider=function(a){return e(a)===l},J.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===t},J.isForwardRef=function(a){return e(a)===f},J.isFragment=function(a){return e(a)===n},J.isLazy=function(a){return e(a)===g},J.isMemo=function(a){return e(a)===d},J.isPortal=function(a){return e(a)===r},J.isProfiler=function(a){return e(a)===i},J.isStrictMode=function(a){return e(a)===o},J.isSuspense=function(a){return e(a)===u},J.isSuspenseList=function(a){return e(a)===y},J.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===n||a===i||a===o||a===u||a===y||typeof a=="object"&&a!==null&&(a.$$typeof===g||a.$$typeof===d||a.$$typeof===l||a.$$typeof===c||a.$$typeof===f||a.$$typeof===h||a.getModuleId!==void 0)},J.typeOf=e})()),J}var lr;function Bn(){return lr||(lr=1,process.env.NODE_ENV==="production"?Qe.exports=jn():Qe.exports=Ln()),Qe.exports}var st=Bn();function ve(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Gr(e){if(Ae.isValidElement(e)||st.isValidElementType(e)||!ve(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Gr(e[r])}),t}function fe(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return ve(e)&&ve(t)&&Object.keys(t).forEach(o=>{Ae.isValidElement(t[o])||st.isValidElementType(t[o])?n[o]=t[o]:ve(t[o])&&Object.prototype.hasOwnProperty.call(e,o)&&ve(e[o])?n[o]=fe(e[o],t[o],r):r.clone?n[o]=ve(t[o])?Gr(t[o]):t[o]:n[o]=t[o]}),n}var Ze={exports:{}},et={exports:{}},Y={};var ur;function Fn(){if(ur)return Y;ur=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,y=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,a=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,T=e?Symbol.for("react.scope"):60119;function C(p){if(typeof p=="object"&&p!==null){var E=p.$$typeof;switch(E){case t:switch(p=p.type,p){case f:case u:case n:case i:case o:case d:return p;default:switch(p=p&&p.$$typeof,p){case l:case y:case h:case v:case c:return p;default:return E}}case r:return E}}}function m(p){return C(p)===u}return Y.AsyncMode=f,Y.ConcurrentMode=u,Y.ContextConsumer=l,Y.ContextProvider=c,Y.Element=t,Y.ForwardRef=y,Y.Fragment=n,Y.Lazy=h,Y.Memo=v,Y.Portal=r,Y.Profiler=i,Y.StrictMode=o,Y.Suspense=d,Y.isAsyncMode=function(p){return m(p)||C(p)===f},Y.isConcurrentMode=m,Y.isContextConsumer=function(p){return C(p)===l},Y.isContextProvider=function(p){return C(p)===c},Y.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===t},Y.isForwardRef=function(p){return C(p)===y},Y.isFragment=function(p){return C(p)===n},Y.isLazy=function(p){return C(p)===h},Y.isMemo=function(p){return C(p)===v},Y.isPortal=function(p){return C(p)===r},Y.isProfiler=function(p){return C(p)===i},Y.isStrictMode=function(p){return C(p)===o},Y.isSuspense=function(p){return C(p)===d},Y.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===u||p===i||p===o||p===d||p===g||typeof p=="object"&&p!==null&&(p.$$typeof===h||p.$$typeof===v||p.$$typeof===c||p.$$typeof===l||p.$$typeof===y||p.$$typeof===b||p.$$typeof===x||p.$$typeof===T||p.$$typeof===a)},Y.typeOf=C,Y}var K={};var fr;function zn(){return fr||(fr=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,y=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,a=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,T=e?Symbol.for("react.scope"):60119;function C(R){return typeof R=="string"||typeof R=="function"||R===n||R===u||R===i||R===o||R===d||R===g||typeof R=="object"&&R!==null&&(R.$$typeof===h||R.$$typeof===v||R.$$typeof===c||R.$$typeof===l||R.$$typeof===y||R.$$typeof===b||R.$$typeof===x||R.$$typeof===T||R.$$typeof===a)}function m(R){if(typeof R=="object"&&R!==null){var ye=R.$$typeof;switch(ye){case t:var Xe=R.type;switch(Xe){case f:case u:case n:case i:case o:case d:return Xe;default:var ir=Xe&&Xe.$$typeof;switch(ir){case l:case y:case h:case v:case c:return ir;default:return ye}}case r:return ye}}}var p=f,E=u,k=l,N=c,P=t,s=y,$=n,L=h,G=v,ae=r,oe=i,ce=o,he=d,Je=!1;function Ct(R){return Je||(Je=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),A(R)||m(R)===f}function A(R){return m(R)===u}function O(R){return m(R)===l}function B(R){return m(R)===c}function M(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function U(R){return m(R)===y}function F(R){return m(R)===n}function D(R){return m(R)===h}function j(R){return m(R)===v}function z(R){return m(R)===r}function q(R){return m(R)===i}function V(R){return m(R)===o}function ie(R){return m(R)===d}K.AsyncMode=p,K.ConcurrentMode=E,K.ContextConsumer=k,K.ContextProvider=N,K.Element=P,K.ForwardRef=s,K.Fragment=$,K.Lazy=L,K.Memo=G,K.Portal=ae,K.Profiler=oe,K.StrictMode=ce,K.Suspense=he,K.isAsyncMode=Ct,K.isConcurrentMode=A,K.isContextConsumer=O,K.isContextProvider=B,K.isElement=M,K.isForwardRef=U,K.isFragment=F,K.isLazy=D,K.isMemo=j,K.isPortal=z,K.isProfiler=q,K.isStrictMode=V,K.isSuspense=ie,K.isValidElementType=C,K.typeOf=m})()),K}var dr;function Yr(){return dr||(dr=1,process.env.NODE_ENV==="production"?et.exports=Fn():et.exports=zn()),et.exports}var Tt,pr;function Vn(){if(pr)return Tt;pr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var c={},l=0;l<10;l++)c["_"+String.fromCharCode(l)]=l;var f=Object.getOwnPropertyNames(c).map(function(y){return c[y]});if(f.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(y){u[y]=y}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Tt=o()?Object.assign:function(i,c){for(var l,f=n(i),u,y=1;y<arguments.length;y++){l=Object(arguments[y]);for(var d in l)t.call(l,d)&&(f[d]=l[d]);if(e){u=e(l);for(var g=0;g<u.length;g++)r.call(l,u[g])&&(f[u[g]]=l[u[g]])}}return f},Tt}var _t,mr;function Yt(){if(mr)return _t;mr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _t=e,_t}var Rt,gr;function Kr(){return gr||(gr=1,Rt=Function.call.bind(Object.prototype.hasOwnProperty)),Rt}var Ot,hr;function Wn(){if(hr)return Ot;hr=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Yt(),r={},n=Kr();e=function(i){var c="Warning: "+i;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}}}function o(i,c,l,f,u){if(process.env.NODE_ENV!=="production"){for(var y in i)if(n(i,y)){var d;try{if(typeof i[y]!="function"){var g=Error((f||"React class")+": "+l+" type `"+y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=i[y](c,y,f,l,null,t)}catch(h){d=h}if(d&&!(d instanceof Error)&&e((f||"React class")+": type specification of "+l+" `"+y+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in r)){r[d.message]=!0;var v=u?u():"";e("Failed "+l+" type: "+d.message+(v??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},Ot=o,Ot}var It,yr;function Gn(){if(yr)return It;yr=1;var e=Yr(),t=Vn(),r=Yt(),n=Kr(),o=Wn(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(l){var f="Warning: "+l;typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}});function c(){return null}return It=function(l,f){var u=typeof Symbol=="function"&&Symbol.iterator,y="@@iterator";function d(A){var O=A&&(u&&A[u]||A[y]);if(typeof O=="function")return O}var g="<<anonymous>>",v={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:T(),arrayOf:C,element:m(),elementType:p(),instanceOf:E,node:s(),objectOf:N,oneOf:k,oneOfType:P,shape:L,exact:G};function h(A,O){return A===O?A!==0||1/A===1/O:A!==A&&O!==O}function a(A,O){this.message=A,this.data=O&&typeof O=="object"?O:{},this.stack=""}a.prototype=Error.prototype;function b(A){if(process.env.NODE_ENV!=="production")var O={},B=0;function M(F,D,j,z,q,V,ie){if(z=z||g,V=V||j,ie!==r){if(f){var R=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw R.name="Invariant Violation",R}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ye=z+":"+j;!O[ye]&&B<3&&(i("You are manually calling a React.PropTypes validation function for the `"+V+"` prop on `"+z+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),O[ye]=!0,B++)}}return D[j]==null?F?D[j]===null?new a("The "+q+" `"+V+"` is marked as required "+("in `"+z+"`, but its value is `null`.")):new a("The "+q+" `"+V+"` is marked as required in "+("`"+z+"`, but its value is `undefined`.")):null:A(D,j,z,q,V)}var U=M.bind(null,!1);return U.isRequired=M.bind(null,!0),U}function x(A){function O(B,M,U,F,D,j){var z=B[M],q=ce(z);if(q!==A){var V=he(z);return new a("Invalid "+F+" `"+D+"` of type "+("`"+V+"` supplied to `"+U+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return b(O)}function T(){return b(c)}function C(A){function O(B,M,U,F,D){if(typeof A!="function")return new a("Property `"+D+"` of component `"+U+"` has invalid PropType notation inside arrayOf.");var j=B[M];if(!Array.isArray(j)){var z=ce(j);return new a("Invalid "+F+" `"+D+"` of type "+("`"+z+"` supplied to `"+U+"`, expected an array."))}for(var q=0;q<j.length;q++){var V=A(j,q,U,F,D+"["+q+"]",r);if(V instanceof Error)return V}return null}return b(O)}function m(){function A(O,B,M,U,F){var D=O[B];if(!l(D)){var j=ce(D);return new a("Invalid "+U+" `"+F+"` of type "+("`"+j+"` supplied to `"+M+"`, expected a single ReactElement."))}return null}return b(A)}function p(){function A(O,B,M,U,F){var D=O[B];if(!e.isValidElementType(D)){var j=ce(D);return new a("Invalid "+U+" `"+F+"` of type "+("`"+j+"` supplied to `"+M+"`, expected a single ReactElement type."))}return null}return b(A)}function E(A){function O(B,M,U,F,D){if(!(B[M]instanceof A)){var j=A.name||g,z=Ct(B[M]);return new a("Invalid "+F+" `"+D+"` of type "+("`"+z+"` supplied to `"+U+"`, expected ")+("instance of `"+j+"`."))}return null}return b(O)}function k(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),c;function O(B,M,U,F,D){for(var j=B[M],z=0;z<A.length;z++)if(h(j,A[z]))return null;var q=JSON.stringify(A,function(ie,R){var ye=he(R);return ye==="symbol"?String(R):R});return new a("Invalid "+F+" `"+D+"` of value `"+String(j)+"` "+("supplied to `"+U+"`, expected one of "+q+"."))}return b(O)}function N(A){function O(B,M,U,F,D){if(typeof A!="function")return new a("Property `"+D+"` of component `"+U+"` has invalid PropType notation inside objectOf.");var j=B[M],z=ce(j);if(z!=="object")return new a("Invalid "+F+" `"+D+"` of type "+("`"+z+"` supplied to `"+U+"`, expected an object."));for(var q in j)if(n(j,q)){var V=A(j,q,U,F,D+"."+q,r);if(V instanceof Error)return V}return null}return b(O)}function P(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),c;for(var O=0;O<A.length;O++){var B=A[O];if(typeof B!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Je(B)+" at index "+O+"."),c}function M(U,F,D,j,z){for(var q=[],V=0;V<A.length;V++){var ie=A[V],R=ie(U,F,D,j,z,r);if(R==null)return null;R.data&&n(R.data,"expectedType")&&q.push(R.data.expectedType)}var ye=q.length>0?", expected one of type ["+q.join(", ")+"]":"";return new a("Invalid "+j+" `"+z+"` supplied to "+("`"+D+"`"+ye+"."))}return b(M)}function s(){function A(O,B,M,U,F){return ae(O[B])?null:new a("Invalid "+U+" `"+F+"` supplied to "+("`"+M+"`, expected a ReactNode."))}return b(A)}function $(A,O,B,M,U){return new a((A||"React class")+": "+O+" type `"+B+"."+M+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+U+"`.")}function L(A){function O(B,M,U,F,D){var j=B[M],z=ce(j);if(z!=="object")return new a("Invalid "+F+" `"+D+"` of type `"+z+"` "+("supplied to `"+U+"`, expected `object`."));for(var q in A){var V=A[q];if(typeof V!="function")return $(U,F,D,q,he(V));var ie=V(j,q,U,F,D+"."+q,r);if(ie)return ie}return null}return b(O)}function G(A){function O(B,M,U,F,D){var j=B[M],z=ce(j);if(z!=="object")return new a("Invalid "+F+" `"+D+"` of type `"+z+"` "+("supplied to `"+U+"`, expected `object`."));var q=t({},B[M],A);for(var V in q){var ie=A[V];if(n(A,V)&&typeof ie!="function")return $(U,F,D,V,he(ie));if(!ie)return new a("Invalid "+F+" `"+D+"` key `"+V+"` supplied to `"+U+"`.\nBad object: "+JSON.stringify(B[M],null," ")+`
|
|
2
|
-
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var
|
|
3
|
-
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("react/jsx-runtime"),T=require("react"),R=require("@mui/material"),rr=require("framer-motion"),xn=require("@emotion/styled");require("@emotion/react");const We=require("oidc-client-ts"),Lt=require("@mui/icons-material");function An(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const we=An(T);function jr({apps:e,open:t,onClose:r,buttonRef:n,isLoading:o=!1,error:i=null,onRetry:s,excludeAppId:u}){const f=T.useRef(null),[l,g]=T.useState("64px"),p=()=>{const y=window.location.origin;return e.find(c=>c.url.startsWith(y))?.id},d=e.filter(y=>{if(u&&y.id===u)return!1;const c=p();return!(c&&y.id===c)});T.useLayoutEffect(()=>{if(t&&n?.current){const y=n.current.getBoundingClientRect();g(`${y.bottom+8}px`)}},[t,n]),T.useEffect(()=>{const y=c=>{f.current&&!f.current.contains(c.target)&&n?.current&&!n.current.contains(c.target)&&r()};return t&&document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[t,r,n]);const S=y=>{window.open(y,"_blank"),r()};return x.jsx(rr.AnimatePresence,{children:t&&x.jsx(rr.motion.div,{ref:f,initial:{opacity:0,scaleX:.6,scaleY:.6,y:-8},animate:{opacity:1,scaleX:1,scaleY:1,y:0},exit:{opacity:0,scaleX:.6,scaleY:.6,y:-8},transition:{duration:.18,ease:"easeOut"},style:{position:"absolute",top:l,right:"16px",zIndex:1e3,transformOrigin:"top right"},children:x.jsxs(R.Box,{sx:{bgcolor:"#E8F0FE",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",p:2,width:"320px",minHeight:"100px"},onClick:y=>y.stopPropagation(),children:[o&&d.length===0&&x.jsx(R.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px"},children:x.jsx(R.CircularProgress,{size:32})}),i&&d.length===0&&x.jsxs(R.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",gap:1},children:[x.jsx(R.Typography,{sx:{fontSize:"0.875rem",color:"#ea4335",textAlign:"center"},children:"Failed to load apps"}),s&&x.jsx(R.Link,{component:"button",onClick:s,sx:{fontSize:"0.875rem",color:"#1a73e8",cursor:"pointer",textDecoration:"underline"},children:"Retry"})]}),d.length>0&&x.jsx(R.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:1},children:d.map(y=>x.jsxs(R.Link,{onClick:()=>S(y.url),sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",p:1.5,borderRadius:"12px",cursor:"pointer",textDecoration:"none",transition:"background-color 200ms","&:hover":{bgcolor:"#f1f3f4"}},title:y.description,children:[x.jsx(R.Box,{sx:{pb:1},children:y.iconUrl?x.jsx(R.Box,{component:"img",src:y.iconUrl,alt:y.name,sx:{width:"32px",height:"32px",objectFit:"contain"}}):x.jsx(R.Box,{sx:{width:"32px",height:"32px",borderRadius:"6px",bgcolor:y.color||"#4285f4",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.5rem"},children:y.name.charAt(0)})}),x.jsx(R.Typography,{sx:{fontSize:"0.75rem",fontWeight:500,color:"#202124",textAlign:"center",lineHeight:1.2},children:y.name})]},y.id))})]})})})}const At="spry_apps_cache",Cn=300*1e3,Tn=300*1e3;function Mr(e,t={}){const{refetchInterval:r=Cn,cacheTime:n=Tn}=t,[o,i]=T.useState([]),[s,u]=T.useState(!0),[f,l]=T.useState(null),g=T.useRef(null),p=T.useRef(null),d=T.useCallback(()=>{try{const c=localStorage.getItem(At);if(!c)return null;const E=JSON.parse(c);return Date.now()-E.timestamp<n?E.apps:(localStorage.removeItem(At),null)}catch(c){return console.error("Error loading from cache:",c),null}},[n]),S=T.useCallback(c=>{try{const E={apps:c,timestamp:Date.now()};localStorage.setItem(At,JSON.stringify(E))}catch(E){console.error("Error saving to cache:",E)}},[]),y=T.useCallback(async()=>{p.current&&p.current.abort(),p.current=new AbortController;try{u(!0),l(null);const c=await fetch(`${e}/api/apps`,{signal:p.current.signal,headers:{Accept:"application/json"}});if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);const E=await c.json();i(E.apps),S(E.apps),l(null)}catch(c){if(c instanceof Error&&c.name==="AbortError")return;const E=c instanceof Error?c.message:"Failed to fetch apps";l(E),console.error("Error fetching apps:",c);const w=d();w&&i(w)}finally{u(!1)}},[e,d,S]);return T.useEffect(()=>{const c=d();return c&&(i(c),u(!1)),y(),r>0&&(g.current=window.setInterval(()=>{y()},r)),()=>{g.current&&window.clearInterval(g.current),p.current&&p.current.abort()}},[e,r,n]),{apps:o,isLoading:s,error:f,refetch:y}}function _n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xe={exports:{}},H={};var nr;function On(){if(nr)return H;nr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.view_transition"),S=Symbol.for("react.client.reference");function y(c){if(typeof c=="object"&&c!==null){var E=c.$$typeof;switch(E){case e:switch(c=c.type,c){case r:case o:case n:case f:case l:case d:return c;default:switch(c=c&&c.$$typeof,c){case s:case u:case p:case g:return c;case i:return c;default:return E}}case t:return E}}}return H.ContextConsumer=i,H.ContextProvider=s,H.Element=e,H.ForwardRef=u,H.Fragment=r,H.Lazy=p,H.Memo=g,H.Portal=t,H.Profiler=o,H.StrictMode=n,H.Suspense=f,H.SuspenseList=l,H.isContextConsumer=function(c){return y(c)===i},H.isContextProvider=function(c){return y(c)===s},H.isElement=function(c){return typeof c=="object"&&c!==null&&c.$$typeof===e},H.isForwardRef=function(c){return y(c)===u},H.isFragment=function(c){return y(c)===r},H.isLazy=function(c){return y(c)===p},H.isMemo=function(c){return y(c)===g},H.isPortal=function(c){return y(c)===t},H.isProfiler=function(c){return y(c)===o},H.isStrictMode=function(c){return y(c)===n},H.isSuspense=function(c){return y(c)===f},H.isSuspenseList=function(c){return y(c)===l},H.isValidElementType=function(c){return typeof c=="string"||typeof c=="function"||c===r||c===o||c===n||c===f||c===l||typeof c=="object"&&c!==null&&(c.$$typeof===p||c.$$typeof===g||c.$$typeof===s||c.$$typeof===i||c.$$typeof===u||c.$$typeof===S||c.getModuleId!==void 0)},H.typeOf=y,H}var J={};var or;function Rn(){return or||(or=1,process.env.NODE_ENV!=="production"&&(function(){function e(c){if(typeof c=="object"&&c!==null){var E=c.$$typeof;switch(E){case t:switch(c=c.type,c){case n:case i:case o:case l:case g:case S:return c;default:switch(c=c&&c.$$typeof,c){case u:case f:case d:case p:return c;case s:return c;default:return E}}case r:return E}}}var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),S=Symbol.for("react.view_transition"),y=Symbol.for("react.client.reference");J.ContextConsumer=s,J.ContextProvider=u,J.Element=t,J.ForwardRef=f,J.Fragment=n,J.Lazy=d,J.Memo=p,J.Portal=r,J.Profiler=i,J.StrictMode=o,J.Suspense=l,J.SuspenseList=g,J.isContextConsumer=function(c){return e(c)===s},J.isContextProvider=function(c){return e(c)===u},J.isElement=function(c){return typeof c=="object"&&c!==null&&c.$$typeof===t},J.isForwardRef=function(c){return e(c)===f},J.isFragment=function(c){return e(c)===n},J.isLazy=function(c){return e(c)===d},J.isMemo=function(c){return e(c)===p},J.isPortal=function(c){return e(c)===r},J.isProfiler=function(c){return e(c)===i},J.isStrictMode=function(c){return e(c)===o},J.isSuspense=function(c){return e(c)===l},J.isSuspenseList=function(c){return e(c)===g},J.isValidElementType=function(c){return typeof c=="string"||typeof c=="function"||c===n||c===i||c===o||c===l||c===g||typeof c=="object"&&c!==null&&(c.$$typeof===d||c.$$typeof===p||c.$$typeof===u||c.$$typeof===s||c.$$typeof===f||c.$$typeof===y||c.getModuleId!==void 0)},J.typeOf=e})()),J}var ir;function In(){return ir||(ir=1,process.env.NODE_ENV==="production"?Xe.exports=On():Xe.exports=Rn()),Xe.exports}var ot=In();function ve(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Lr(e){if(we.isValidElement(e)||ot.isValidElementType(e)||!ve(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Lr(e[r])}),t}function ue(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return ve(e)&&ve(t)&&Object.keys(t).forEach(o=>{we.isValidElement(t[o])||ot.isValidElementType(t[o])?n[o]=t[o]:ve(t[o])&&Object.prototype.hasOwnProperty.call(e,o)&&ve(e[o])?n[o]=ue(e[o],t[o],r):r.clone?n[o]=ve(t[o])?Lr(t[o]):t[o]:n[o]=t[o]}),n}var Qe={exports:{}},Ze={exports:{}},G={};var sr;function kn(){if(sr)return G;sr=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,g=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,S=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,c=e?Symbol.for("react.block"):60121,E=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function h(m){if(typeof m=="object"&&m!==null){var I=m.$$typeof;switch(I){case t:switch(m=m.type,m){case f:case l:case n:case i:case o:case p:return m;default:switch(m=m&&m.$$typeof,m){case u:case g:case y:case S:case s:return m;default:return I}}case r:return I}}}function b(m){return h(m)===l}return G.AsyncMode=f,G.ConcurrentMode=l,G.ContextConsumer=u,G.ContextProvider=s,G.Element=t,G.ForwardRef=g,G.Fragment=n,G.Lazy=y,G.Memo=S,G.Portal=r,G.Profiler=i,G.StrictMode=o,G.Suspense=p,G.isAsyncMode=function(m){return b(m)||h(m)===f},G.isConcurrentMode=b,G.isContextConsumer=function(m){return h(m)===u},G.isContextProvider=function(m){return h(m)===s},G.isElement=function(m){return typeof m=="object"&&m!==null&&m.$$typeof===t},G.isForwardRef=function(m){return h(m)===g},G.isFragment=function(m){return h(m)===n},G.isLazy=function(m){return h(m)===y},G.isMemo=function(m){return h(m)===S},G.isPortal=function(m){return h(m)===r},G.isProfiler=function(m){return h(m)===i},G.isStrictMode=function(m){return h(m)===o},G.isSuspense=function(m){return h(m)===p},G.isValidElementType=function(m){return typeof m=="string"||typeof m=="function"||m===n||m===l||m===i||m===o||m===p||m===d||typeof m=="object"&&m!==null&&(m.$$typeof===y||m.$$typeof===S||m.$$typeof===s||m.$$typeof===u||m.$$typeof===g||m.$$typeof===E||m.$$typeof===w||m.$$typeof===C||m.$$typeof===c)},G.typeOf=h,G}var K={};var ar;function $n(){return ar||(ar=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,g=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,S=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,c=e?Symbol.for("react.block"):60121,E=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function h(_){return typeof _=="string"||typeof _=="function"||_===n||_===l||_===i||_===o||_===p||_===d||typeof _=="object"&&_!==null&&(_.$$typeof===y||_.$$typeof===S||_.$$typeof===s||_.$$typeof===u||_.$$typeof===g||_.$$typeof===E||_.$$typeof===w||_.$$typeof===C||_.$$typeof===c)}function b(_){if(typeof _=="object"&&_!==null){var ge=_.$$typeof;switch(ge){case t:var Je=_.type;switch(Je){case f:case l:case n:case i:case o:case p:return Je;default:var tr=Je&&Je.$$typeof;switch(tr){case u:case g:case y:case S:case s:return tr;default:return ge}}case r:return ge}}}var m=f,I=l,$=u,M=s,P=t,a=g,k=n,Y=y,W=S,se=r,oe=i,ae=o,he=p,He=!1;function xt(_){return He||(He=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),A(_)||b(_)===f}function A(_){return b(_)===l}function O(_){return b(_)===u}function L(_){return b(_)===s}function D(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function N(_){return b(_)===g}function B(_){return b(_)===n}function U(_){return b(_)===y}function j(_){return b(_)===S}function F(_){return b(_)===r}function q(_){return b(_)===i}function z(_){return b(_)===o}function ie(_){return b(_)===p}K.AsyncMode=m,K.ConcurrentMode=I,K.ContextConsumer=$,K.ContextProvider=M,K.Element=P,K.ForwardRef=a,K.Fragment=k,K.Lazy=Y,K.Memo=W,K.Portal=se,K.Profiler=oe,K.StrictMode=ae,K.Suspense=he,K.isAsyncMode=xt,K.isConcurrentMode=A,K.isContextConsumer=O,K.isContextProvider=L,K.isElement=D,K.isForwardRef=N,K.isFragment=B,K.isLazy=U,K.isMemo=j,K.isPortal=F,K.isProfiler=q,K.isStrictMode=z,K.isSuspense=ie,K.isValidElementType=h,K.typeOf=b})()),K}var cr;function Br(){return cr||(cr=1,process.env.NODE_ENV==="production"?Ze.exports=kn():Ze.exports=$n()),Ze.exports}var Ct,ur;function Pn(){if(ur)return Ct;ur=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},u=0;u<10;u++)s["_"+String.fromCharCode(u)]=u;var f=Object.getOwnPropertyNames(s).map(function(g){return s[g]});if(f.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(g){l[g]=g}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ct=o()?Object.assign:function(i,s){for(var u,f=n(i),l,g=1;g<arguments.length;g++){u=Object(arguments[g]);for(var p in u)t.call(u,p)&&(f[p]=u[p]);if(e){l=e(u);for(var d=0;d<l.length;d++)r.call(u,l[d])&&(f[l[d]]=u[l[d]])}}return f},Ct}var Tt,lr;function Vt(){if(lr)return Tt;lr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Tt=e,Tt}var _t,fr;function Fr(){return fr||(fr=1,_t=Function.call.bind(Object.prototype.hasOwnProperty)),_t}var Ot,dr;function Nn(){if(dr)return Ot;dr=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Vt(),r={},n=Fr();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,u,f,l){if(process.env.NODE_ENV!=="production"){for(var g in i)if(n(i,g)){var p;try{if(typeof i[g]!="function"){var d=Error((f||"React class")+": "+u+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}p=i[g](s,g,f,u,null,t)}catch(y){p=y}if(p&&!(p instanceof Error)&&e((f||"React class")+": type specification of "+u+" `"+g+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof p+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),p instanceof Error&&!(p.message in r)){r[p.message]=!0;var S=l?l():"";e("Failed "+u+" type: "+p.message+(S??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},Ot=o,Ot}var Rt,pr;function Un(){if(pr)return Rt;pr=1;var e=Br(),t=Pn(),r=Vt(),n=Fr(),o=Nn(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(u){var f="Warning: "+u;typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}});function s(){return null}return Rt=function(u,f){var l=typeof Symbol=="function"&&Symbol.iterator,g="@@iterator";function p(A){var O=A&&(l&&A[l]||A[g]);if(typeof O=="function")return O}var d="<<anonymous>>",S={array:w("array"),bigint:w("bigint"),bool:w("boolean"),func:w("function"),number:w("number"),object:w("object"),string:w("string"),symbol:w("symbol"),any:C(),arrayOf:h,element:b(),elementType:m(),instanceOf:I,node:a(),objectOf:M,oneOf:$,oneOfType:P,shape:Y,exact:W};function y(A,O){return A===O?A!==0||1/A===1/O:A!==A&&O!==O}function c(A,O){this.message=A,this.data=O&&typeof O=="object"?O:{},this.stack=""}c.prototype=Error.prototype;function E(A){if(process.env.NODE_ENV!=="production")var O={},L=0;function D(B,U,j,F,q,z,ie){if(F=F||d,z=z||j,ie!==r){if(f){var _=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw _.name="Invariant Violation",_}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ge=F+":"+j;!O[ge]&&L<3&&(i("You are manually calling a React.PropTypes validation function for the `"+z+"` prop on `"+F+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),O[ge]=!0,L++)}}return U[j]==null?B?U[j]===null?new c("The "+q+" `"+z+"` is marked as required "+("in `"+F+"`, but its value is `null`.")):new c("The "+q+" `"+z+"` is marked as required in "+("`"+F+"`, but its value is `undefined`.")):null:A(U,j,F,q,z)}var N=D.bind(null,!1);return N.isRequired=D.bind(null,!0),N}function w(A){function O(L,D,N,B,U,j){var F=L[D],q=ae(F);if(q!==A){var z=he(F);return new c("Invalid "+B+" `"+U+"` of type "+("`"+z+"` supplied to `"+N+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return E(O)}function C(){return E(s)}function h(A){function O(L,D,N,B,U){if(typeof A!="function")return new c("Property `"+U+"` of component `"+N+"` has invalid PropType notation inside arrayOf.");var j=L[D];if(!Array.isArray(j)){var F=ae(j);return new c("Invalid "+B+" `"+U+"` of type "+("`"+F+"` supplied to `"+N+"`, expected an array."))}for(var q=0;q<j.length;q++){var z=A(j,q,N,B,U+"["+q+"]",r);if(z instanceof Error)return z}return null}return E(O)}function b(){function A(O,L,D,N,B){var U=O[L];if(!u(U)){var j=ae(U);return new c("Invalid "+N+" `"+B+"` of type "+("`"+j+"` supplied to `"+D+"`, expected a single ReactElement."))}return null}return E(A)}function m(){function A(O,L,D,N,B){var U=O[L];if(!e.isValidElementType(U)){var j=ae(U);return new c("Invalid "+N+" `"+B+"` of type "+("`"+j+"` supplied to `"+D+"`, expected a single ReactElement type."))}return null}return E(A)}function I(A){function O(L,D,N,B,U){if(!(L[D]instanceof A)){var j=A.name||d,F=xt(L[D]);return new c("Invalid "+B+" `"+U+"` of type "+("`"+F+"` supplied to `"+N+"`, expected ")+("instance of `"+j+"`."))}return null}return E(O)}function $(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function O(L,D,N,B,U){for(var j=L[D],F=0;F<A.length;F++)if(y(j,A[F]))return null;var q=JSON.stringify(A,function(ie,_){var ge=he(_);return ge==="symbol"?String(_):_});return new c("Invalid "+B+" `"+U+"` of value `"+String(j)+"` "+("supplied to `"+N+"`, expected one of "+q+"."))}return E(O)}function M(A){function O(L,D,N,B,U){if(typeof A!="function")return new c("Property `"+U+"` of component `"+N+"` has invalid PropType notation inside objectOf.");var j=L[D],F=ae(j);if(F!=="object")return new c("Invalid "+B+" `"+U+"` of type "+("`"+F+"` supplied to `"+N+"`, expected an object."));for(var q in j)if(n(j,q)){var z=A(j,q,N,B,U+"."+q,r);if(z instanceof Error)return z}return null}return E(O)}function P(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var O=0;O<A.length;O++){var L=A[O];if(typeof L!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+He(L)+" at index "+O+"."),s}function D(N,B,U,j,F){for(var q=[],z=0;z<A.length;z++){var ie=A[z],_=ie(N,B,U,j,F,r);if(_==null)return null;_.data&&n(_.data,"expectedType")&&q.push(_.data.expectedType)}var ge=q.length>0?", expected one of type ["+q.join(", ")+"]":"";return new c("Invalid "+j+" `"+F+"` supplied to "+("`"+U+"`"+ge+"."))}return E(D)}function a(){function A(O,L,D,N,B){return se(O[L])?null:new c("Invalid "+N+" `"+B+"` supplied to "+("`"+D+"`, expected a ReactNode."))}return E(A)}function k(A,O,L,D,N){return new c((A||"React class")+": "+O+" type `"+L+"."+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+N+"`.")}function Y(A){function O(L,D,N,B,U){var j=L[D],F=ae(j);if(F!=="object")return new c("Invalid "+B+" `"+U+"` of type `"+F+"` "+("supplied to `"+N+"`, expected `object`."));for(var q in A){var z=A[q];if(typeof z!="function")return k(N,B,U,q,he(z));var ie=z(j,q,N,B,U+"."+q,r);if(ie)return ie}return null}return E(O)}function W(A){function O(L,D,N,B,U){var j=L[D],F=ae(j);if(F!=="object")return new c("Invalid "+B+" `"+U+"` of type `"+F+"` "+("supplied to `"+N+"`, expected `object`."));var q=t({},L[D],A);for(var z in q){var ie=A[z];if(n(A,z)&&typeof ie!="function")return k(N,B,U,z,he(ie));if(!ie)return new c("Invalid "+B+" `"+U+"` key `"+z+"` supplied to `"+N+"`.\nBad object: "+JSON.stringify(L[D],null," ")+`
|
|
2
|
+
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var _=ie(j,z,N,B,U+"."+z,r);if(_)return _}return null}return E(O)}function se(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(se);if(A===null||u(A))return!0;var O=p(A);if(O){var L=O.call(A),D;if(O!==A.entries){for(;!(D=L.next()).done;)if(!se(D.value))return!1}else for(;!(D=L.next()).done;){var N=D.value;if(N&&!se(N[1]))return!1}}else return!1;return!0;default:return!1}}function oe(A,O){return A==="symbol"?!0:O?O["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&O instanceof Symbol:!1}function ae(A){var O=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":oe(O,A)?"symbol":O}function he(A){if(typeof A>"u"||A===null)return""+A;var O=ae(A);if(O==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return O}function He(A){var O=he(A);switch(O){case"array":case"object":return"an "+O;case"boolean":case"date":case"regexp":return"a "+O;default:return O}}function xt(A){return!A.constructor||!A.constructor.name?d:A.constructor.name}return S.checkPropTypes=o,S.resetWarningCache=o.resetWarningCache,S.PropTypes=S,S},Rt}var It,mr;function Dn(){if(mr)return It;mr=1;var e=Vt();function t(){}function r(){}return r.resetWarningCache=t,It=function(){function n(s,u,f,l,g,p){if(p!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}n.isRequired=n;function o(){return n}var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i},It}var hr;function jn(){if(hr)return Qe.exports;if(hr=1,process.env.NODE_ENV!=="production"){var e=Br(),t=!0;Qe.exports=Un()(e.isElement,t)}else Qe.exports=Dn()();return Qe.exports}var Mn=jn();const V=_n(Mn);function xe(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}function zr(e,t=""){return e.displayName||e.name||t}function gr(e,t,r){const n=zr(t);return e.displayName||(n!==""?`${r}(${n})`:r)}function Ln(e){if(e!=null){if(typeof e=="string")return e;if(typeof e=="function")return zr(e,"Component");if(typeof e=="object")switch(e.$$typeof){case ot.ForwardRef:return gr(e,e.render,"ForwardRef");case ot.Memo:return gr(e,e.type,"memo");default:return}}}function Ie(e){if(typeof e!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":xe(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Bt(e,t){const r={...t};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const o=n;if(o==="components"||o==="slots")r[o]={...e[o],...r[o]};else if(o==="componentsProps"||o==="slotProps"){const i=e[o],s=t[o];if(!s)r[o]=i||{};else if(!i)r[o]=s;else{r[o]={...s};for(const u in i)if(Object.prototype.hasOwnProperty.call(i,u)){const f=u;r[o][f]=Bt(i[f],s[f])}}}else r[o]===void 0&&(r[o]=e[o])}return r}function Bn(e,t,r=void 0){const n={};for(const o in e){const i=e[o];let s="",u=!0;for(let f=0;f<i.length;f+=1){const l=i[f];l&&(s+=(u===!0?"":" ")+t(l),u=!1,r&&r[l]&&(s+=" "+r[l]))}n[o]=s}return n}const yr=e=>e,Fn=()=>{let e=yr;return{configure(t){e=t},generate(t){return e(t)},reset(){e=yr}}},zn=Fn(),Vn={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Wt(e,t,r="Mui"){const n=Vn[t];return n?`${r}-${n}`:`${zn.generate(e)}-${t}`}function Wn(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=Wt(e,o,r)}),n}function Yn(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function Vr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Vr(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Gn(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Vr(e))&&(n&&(n+=" "),n+=t);return n}function Ve(e,t){return t?ue(e,t,{clone:!1}):e}const Te=process.env.NODE_ENV!=="production"?V.oneOfType([V.number,V.string,V.object,V.array]):{};function br(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(n=>n.startsWith("@container")).sort((n,o)=>{const i=/min-width:\s*([0-9.]+)/;return+(n.match(i)?.[1]||0)-+(o.match(i)?.[1]||0)});return r.length?r.reduce((n,o)=>{const i=t[o];return delete n[o],n[o]=i,n},{...t}):t}function Kn(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function qn(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The provided shorthand ${`(${t})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
3
|
+
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:xe(18,`(${t})`));return null}const[,n,o]=r,i=Number.isNaN(+n)?n||0:+n;return e.containerQueries(o).up(i)}function Hn(e){const t=(i,s)=>i.replace("@media",s?`@container ${s}`:"@container");function r(i,s){i.up=(...u)=>t(e.breakpoints.up(...u),s),i.down=(...u)=>t(e.breakpoints.down(...u),s),i.between=(...u)=>t(e.breakpoints.between(...u),s),i.only=(...u)=>t(e.breakpoints.only(...u),s),i.not=(...u)=>{const f=t(e.breakpoints.not(...u),s);return f.includes("not all and")?f.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):f}}const n={},o=i=>(r(n,i),n);return r(o),{...e,containerQueries:o}}const ct={xs:0,sm:600,md:900,lg:1200,xl:1536},vr={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${ct[e]}px)`},Jn={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:ct[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function Se(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const i=n.breakpoints||vr;return t.reduce((s,u,f)=>(s[i.up(i.keys[f])]=r(t[f]),s),{})}if(typeof t=="object"){const i=n.breakpoints||vr;return Object.keys(t).reduce((s,u)=>{if(Kn(i.keys,u)){const f=qn(n.containerQueries?n:Jn,u);f&&(s[f]=r(t[u],u))}else if(Object.keys(i.values||ct).includes(u)){const f=i.up(u);s[f]=r(t[u],u)}else{const f=u;s[f]=t[f]}return s},{})}return r(t)}function Xn(e={}){return e.keys?.reduce((r,n)=>{const o=e.up(n);return r[o]={},r},{})||{}}function Sr(e,t){return e.reduce((r,n)=>{const o=r[n];return(!o||Object.keys(o).length===0)&&delete r[n],r},t)}function ut(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const n=`vars.${t}`.split(".").reduce((o,i)=>o&&o[i]?o[i]:null,e);if(n!=null)return n}return t.split(".").reduce((n,o)=>n&&n[o]!=null?n[o]:null,e)}function it(e,t,r,n=r){let o;return typeof e=="function"?o=e(r):Array.isArray(e)?o=e[r]||n:o=ut(e,r)||n,t&&(o=t(o,n,e)),o}function ne(e){const{prop:t,cssProperty:r=e.prop,themeKey:n,transform:o}=e,i=s=>{if(s[t]==null)return null;const u=s[t],f=s.theme,l=ut(f,n)||{};return Se(s,u,p=>{let d=it(l,o,p);return p===d&&typeof p=="string"&&(d=it(l,o,`${t}${p==="default"?"":Ie(p)}`,p)),r===!1?d:{[r]:d}})};return i.propTypes=process.env.NODE_ENV!=="production"?{[t]:Te}:{},i.filterProps=[t],i}function Qn(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const Zn={m:"margin",p:"padding"},eo={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},Er={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},to=Qn(e=>{if(e.length>2)if(Er[e])e=Er[e];else return[e];const[t,r]=e.split(""),n=Zn[t],o=eo[r]||"";return Array.isArray(o)?o.map(i=>n+i):[n+o]}),lt=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],ft=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],ro=[...lt,...ft];function Ge(e,t,r,n){const o=ut(e,t,!0)??r;return typeof o=="number"||typeof o=="string"?i=>typeof i=="string"?i:(process.env.NODE_ENV!=="production"&&typeof i!="number"&&console.error(`MUI: Expected ${n} argument to be a number or a string, got ${i}.`),typeof o=="string"?`calc(${i} * ${o})`:o*i):Array.isArray(o)?i=>{if(typeof i=="string")return i;const s=Math.abs(i);process.env.NODE_ENV!=="production"&&(Number.isInteger(s)?s>o.length-1&&console.error([`MUI: The value provided (${s}) overflows.`,`The supported values are: ${JSON.stringify(o)}.`,`${s} > ${o.length-1}, you need to add the missing values.`].join(`
|
|
4
4
|
`)):console.error([`MUI: The \`theme.${t}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${t}\` as a number.`].join(`
|
|
5
|
-
`)));const
|
|
6
|
-
`)),()=>{})}function qt(e){return Ke(e,"spacing",8,"spacing")}function qe(e,t){return typeof t=="string"||t==null?t:e(t)}function mo(e,t){return r=>e.reduce((n,o)=>(n[o]=qe(t,r),n),{})}function go(e,t,r,n){if(!t.includes(r))return null;const o=fo(r),i=mo(o,n),c=e[r];return Ee(e,c,i)}function Jr(e,t){const r=qt(e.theme);return Object.keys(e).map(n=>go(e,t,n,r)).reduce(We,{})}function ee(e){return Jr(e,dt)}ee.propTypes=process.env.NODE_ENV!=="production"?dt.reduce((e,t)=>(e[t]=Te,e),{}):{};ee.filterProps=dt;function te(e){return Jr(e,pt)}te.propTypes=process.env.NODE_ENV!=="production"?pt.reduce((e,t)=>(e[t]=Te,e),{}):{};te.filterProps=pt;process.env.NODE_ENV!=="production"&&po.reduce((e,t)=>(e[t]=Te,e),{});function mt(...e){const t=e.reduce((n,o)=>(o.filterProps.forEach(i=>{n[i]=o}),n),{}),r=n=>Object.keys(n).reduce((o,i)=>t[i]?We(o,t[i](n)):o,{});return r.propTypes=process.env.NODE_ENV!=="production"?e.reduce((n,o)=>Object.assign(n,o.propTypes),{}):{},r.filterProps=e.reduce((n,o)=>n.concat(o.filterProps),[]),r}function pe(e){return typeof e!="number"?e:`${e}px solid`}function ge(e,t){return ne({prop:e,themeKey:"borders",transform:t})}const ho=ge("border",pe),yo=ge("borderTop",pe),So=ge("borderRight",pe),bo=ge("borderBottom",pe),vo=ge("borderLeft",pe),Eo=ge("borderColor"),wo=ge("borderTopColor"),Ao=ge("borderRightColor"),Co=ge("borderBottomColor"),xo=ge("borderLeftColor"),To=ge("outline",pe),_o=ge("outlineColor"),gt=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ke(e.theme,"shape.borderRadius",4,"borderRadius"),r=n=>({borderRadius:qe(t,n)});return Ee(e,e.borderRadius,r)}return null};gt.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:Te}:{};gt.filterProps=["borderRadius"];mt(ho,yo,So,bo,vo,Eo,wo,Ao,Co,xo,gt,To,_o);const ht=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ke(e.theme,"spacing",8,"gap"),r=n=>({gap:qe(t,n)});return Ee(e,e.gap,r)}return null};ht.propTypes=process.env.NODE_ENV!=="production"?{gap:Te}:{};ht.filterProps=["gap"];const yt=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ke(e.theme,"spacing",8,"columnGap"),r=n=>({columnGap:qe(t,n)});return Ee(e,e.columnGap,r)}return null};yt.propTypes=process.env.NODE_ENV!=="production"?{columnGap:Te}:{};yt.filterProps=["columnGap"];const St=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ke(e.theme,"spacing",8,"rowGap"),r=n=>({rowGap:qe(t,n)});return Ee(e,e.rowGap,r)}return null};St.propTypes=process.env.NODE_ENV!=="production"?{rowGap:Te}:{};St.filterProps=["rowGap"];const Ro=ne({prop:"gridColumn"}),Oo=ne({prop:"gridRow"}),Io=ne({prop:"gridAutoFlow"}),$o=ne({prop:"gridAutoColumns"}),ko=ne({prop:"gridAutoRows"}),Po=ne({prop:"gridTemplateColumns"}),No=ne({prop:"gridTemplateRows"}),Uo=ne({prop:"gridTemplateAreas"}),Do=ne({prop:"gridArea"});mt(ht,yt,St,Ro,Oo,Io,$o,ko,Po,No,Uo,Do);function je(e,t){return t==="grey"?t:e}const Mo=ne({prop:"color",themeKey:"palette",transform:je}),jo=ne({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:je}),Lo=ne({prop:"backgroundColor",themeKey:"palette",transform:je});mt(Mo,jo,Lo);function ue(e){return e<=1&&e!==0?`${e*100}%`:e}const Bo=ne({prop:"width",transform:ue}),Ht=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||ut[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:ue(r)}};return Ee(e,e.maxWidth,t)}return null};Ht.filterProps=["maxWidth"];const Fo=ne({prop:"minWidth",transform:ue}),zo=ne({prop:"height",transform:ue}),Vo=ne({prop:"maxHeight",transform:ue}),Wo=ne({prop:"minHeight",transform:ue});ne({prop:"size",cssProperty:"width",transform:ue});ne({prop:"size",cssProperty:"height",transform:ue});const Go=ne({prop:"boxSizing"});mt(Bo,Ht,Fo,zo,Vo,Wo,Go);const bt={border:{themeKey:"borders",transform:pe},borderTop:{themeKey:"borders",transform:pe},borderRight:{themeKey:"borders",transform:pe},borderBottom:{themeKey:"borders",transform:pe},borderLeft:{themeKey:"borders",transform:pe},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:pe},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:gt},color:{themeKey:"palette",transform:je},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:je},backgroundColor:{themeKey:"palette",transform:je},p:{style:te},pt:{style:te},pr:{style:te},pb:{style:te},pl:{style:te},px:{style:te},py:{style:te},padding:{style:te},paddingTop:{style:te},paddingRight:{style:te},paddingBottom:{style:te},paddingLeft:{style:te},paddingX:{style:te},paddingY:{style:te},paddingInline:{style:te},paddingInlineStart:{style:te},paddingInlineEnd:{style:te},paddingBlock:{style:te},paddingBlockStart:{style:te},paddingBlockEnd:{style:te},m:{style:ee},mt:{style:ee},mr:{style:ee},mb:{style:ee},ml:{style:ee},mx:{style:ee},my:{style:ee},margin:{style:ee},marginTop:{style:ee},marginRight:{style:ee},marginBottom:{style:ee},marginLeft:{style:ee},marginX:{style:ee},marginY:{style:ee},marginInline:{style:ee},marginInlineStart:{style:ee},marginInlineEnd:{style:ee},marginBlock:{style:ee},marginBlockStart:{style:ee},marginBlockEnd:{style:ee},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:ht},rowGap:{style:St},columnGap:{style:yt},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:ue},maxWidth:{style:Ht},minWidth:{transform:ue},height:{transform:ue},maxHeight:{transform:ue},minHeight:{transform:ue},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Yo(...e){const t=e.reduce((n,o)=>n.concat(Object.keys(o)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function Ko(e,t){return typeof e=="function"?e(t):e}function qo(){function e(r,n,o,i){const c={[r]:n,theme:o},l=i[r];if(!l)return{[r]:n};const{cssProperty:f=r,themeKey:u,transform:y,style:d}=l;if(n==null)return null;if(u==="typography"&&n==="inherit")return{[r]:n};const g=ft(o,u)||{};return d?d(c):Ee(c,n,h=>{let a=at(g,y,h);return h===a&&typeof h=="string"&&(a=at(g,y,`${r}${h==="default"?"":Oe(h)}`,h)),f===!1?a:{[f]:a}})}function t(r){const{sx:n,theme:o={},nested:i}=r||{};if(!n)return null;const c=o.unstable_sxConfig??bt;function l(f){let u=f;if(typeof f=="function")u=f(o);else if(typeof f!="object")return f;if(!u)return null;const y=ao(o.breakpoints),d=Object.keys(y);let g=y;return Object.keys(u).forEach(v=>{const h=Ko(u[v],o);if(h!=null)if(typeof h=="object")if(c[v])g=We(g,e(v,h,o,c));else{const a=Ee({theme:o},h,b=>({[v]:b}));Yo(a,h)?g[v]=t({sx:h,theme:o,nested:!0}):g=We(g,a)}else g=We(g,e(v,h,o,c))}),!i&&o.modularCssLayers?{"@layer sx":wr(o,Cr(d,g))}:wr(o,Cr(d,g))}return Array.isArray(n)?n.map(l):l(n)}return t}const Le=qo();Le.filterProps=["sx"];function Ho(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Jo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Xo(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Qo=/[A-Z]|^ms/g,Zo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Xr=function(t){return t.charCodeAt(1)===45},Tr=function(t){return t!=null&&typeof t!="boolean"},kt=Xo(function(e){return Xr(e)?e:e.replace(Qo,"-$&").toLowerCase()}),_r=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(Zo,function(n,o,i){return we={name:o,styles:i,next:we},o})}return Jo[t]!==1&&!Xr(t)&&typeof r=="number"&&r!==0?r+"px":r};function ct(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var o=r;if(o.anim===1)return we={name:o.name,styles:o.styles,next:we},o.name;var i=r;if(i.styles!==void 0){var c=i.next;if(c!==void 0)for(;c!==void 0;)we={name:c.name,styles:c.styles,next:we},c=c.next;var l=i.styles+";";return l}return ei(e,t,r)}}var f=r;return f}function ei(e,t,r){var n="";if(Array.isArray(r))for(var o=0;o<r.length;o++)n+=ct(e,t,r[o])+";";else for(var i in r){var c=r[i];if(typeof c!="object"){var l=c;Tr(l)&&(n+=kt(i)+":"+_r(i,l)+";")}else if(Array.isArray(c)&&typeof c[0]=="string"&&t==null)for(var f=0;f<c.length;f++)Tr(c[f])&&(n+=kt(i)+":"+_r(i,c[f])+";");else{var u=ct(e,t,c);switch(i){case"animation":case"animationName":{n+=kt(i)+":"+u+";";break}default:n+=i+"{"+u+"}"}}}return n}var Rr=/label:\s*([^\s;{]+)\s*(;|$)/g,we;function ti(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,o="";we=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=ct(r,t,i);else{var c=i;o+=c[0]}for(var l=1;l<e.length;l++)if(o+=ct(r,t,e[l]),n){var f=i;o+=f[l]}Rr.lastIndex=0;for(var u="",y;(y=Rr.exec(o))!==null;)u+="-"+y[1];var d=Ho(o)+u;return{name:d,styles:o,next:we}}function ri(e,t){const r=Pn(e,t);return process.env.NODE_ENV!=="production"?(...n)=>{const o=typeof e=="string"?`"${e}"`:"component";return n.length===0?console.error([`MUI: Seems like you called \`styled(${o})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
|
|
7
|
-
`)):n.some(i=>i===void 0)&&console.error(`MUI: the styled(${o})(...args) API requires all its args to be defined.`),r(...n)}:r}function
|
|
8
|
-
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:
|
|
9
|
-
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:
|
|
10
|
-
`))}return
|
|
11
|
-
The color object needs to have a \`main\` property or a \`${
|
|
12
|
-
\`color.main\` should be a string, but \`${JSON.stringify(
|
|
5
|
+
`)));const u=o[s];return i>=0?u:typeof u=="number"?-u:`-${u}`}:typeof o=="function"?o:(process.env.NODE_ENV!=="production"&&console.error([`MUI: The \`theme.${t}\` value (${o}) is invalid.`,"It should be a number, an array or a function."].join(`
|
|
6
|
+
`)),()=>{})}function Yt(e){return Ge(e,"spacing",8,"spacing")}function Ke(e,t){return typeof t=="string"||t==null?t:e(t)}function no(e,t){return r=>e.reduce((n,o)=>(n[o]=Ke(t,r),n),{})}function oo(e,t,r,n){if(!t.includes(r))return null;const o=to(r),i=no(o,n),s=e[r];return Se(e,s,i)}function Wr(e,t){const r=Yt(e.theme);return Object.keys(e).map(n=>oo(e,t,n,r)).reduce(Ve,{})}function ee(e){return Wr(e,lt)}ee.propTypes=process.env.NODE_ENV!=="production"?lt.reduce((e,t)=>(e[t]=Te,e),{}):{};ee.filterProps=lt;function te(e){return Wr(e,ft)}te.propTypes=process.env.NODE_ENV!=="production"?ft.reduce((e,t)=>(e[t]=Te,e),{}):{};te.filterProps=ft;process.env.NODE_ENV!=="production"&&ro.reduce((e,t)=>(e[t]=Te,e),{});function dt(...e){const t=e.reduce((n,o)=>(o.filterProps.forEach(i=>{n[i]=o}),n),{}),r=n=>Object.keys(n).reduce((o,i)=>t[i]?Ve(o,t[i](n)):o,{});return r.propTypes=process.env.NODE_ENV!=="production"?e.reduce((n,o)=>Object.assign(n,o.propTypes),{}):{},r.filterProps=e.reduce((n,o)=>n.concat(o.filterProps),[]),r}function le(e){return typeof e!="number"?e:`${e}px solid`}function pe(e,t){return ne({prop:e,themeKey:"borders",transform:t})}const io=pe("border",le),so=pe("borderTop",le),ao=pe("borderRight",le),co=pe("borderBottom",le),uo=pe("borderLeft",le),lo=pe("borderColor"),fo=pe("borderTopColor"),po=pe("borderRightColor"),mo=pe("borderBottomColor"),ho=pe("borderLeftColor"),go=pe("outline",le),yo=pe("outlineColor"),pt=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ge(e.theme,"shape.borderRadius",4,"borderRadius"),r=n=>({borderRadius:Ke(t,n)});return Se(e,e.borderRadius,r)}return null};pt.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:Te}:{};pt.filterProps=["borderRadius"];dt(io,so,ao,co,uo,lo,fo,po,mo,ho,pt,go,yo);const mt=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ge(e.theme,"spacing",8,"gap"),r=n=>({gap:Ke(t,n)});return Se(e,e.gap,r)}return null};mt.propTypes=process.env.NODE_ENV!=="production"?{gap:Te}:{};mt.filterProps=["gap"];const ht=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ge(e.theme,"spacing",8,"columnGap"),r=n=>({columnGap:Ke(t,n)});return Se(e,e.columnGap,r)}return null};ht.propTypes=process.env.NODE_ENV!=="production"?{columnGap:Te}:{};ht.filterProps=["columnGap"];const gt=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ge(e.theme,"spacing",8,"rowGap"),r=n=>({rowGap:Ke(t,n)});return Se(e,e.rowGap,r)}return null};gt.propTypes=process.env.NODE_ENV!=="production"?{rowGap:Te}:{};gt.filterProps=["rowGap"];const bo=ne({prop:"gridColumn"}),vo=ne({prop:"gridRow"}),So=ne({prop:"gridAutoFlow"}),Eo=ne({prop:"gridAutoColumns"}),wo=ne({prop:"gridAutoRows"}),xo=ne({prop:"gridTemplateColumns"}),Ao=ne({prop:"gridTemplateRows"}),Co=ne({prop:"gridTemplateAreas"}),To=ne({prop:"gridArea"});dt(mt,ht,gt,bo,vo,So,Eo,wo,xo,Ao,Co,To);function De(e,t){return t==="grey"?t:e}const _o=ne({prop:"color",themeKey:"palette",transform:De}),Oo=ne({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:De}),Ro=ne({prop:"backgroundColor",themeKey:"palette",transform:De});dt(_o,Oo,Ro);function ce(e){return e<=1&&e!==0?`${e*100}%`:e}const Io=ne({prop:"width",transform:ce}),Gt=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||ct[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:ce(r)}};return Se(e,e.maxWidth,t)}return null};Gt.filterProps=["maxWidth"];const ko=ne({prop:"minWidth",transform:ce}),$o=ne({prop:"height",transform:ce}),Po=ne({prop:"maxHeight",transform:ce}),No=ne({prop:"minHeight",transform:ce});ne({prop:"size",cssProperty:"width",transform:ce});ne({prop:"size",cssProperty:"height",transform:ce});const Uo=ne({prop:"boxSizing"});dt(Io,Gt,ko,$o,Po,No,Uo);const yt={border:{themeKey:"borders",transform:le},borderTop:{themeKey:"borders",transform:le},borderRight:{themeKey:"borders",transform:le},borderBottom:{themeKey:"borders",transform:le},borderLeft:{themeKey:"borders",transform:le},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:le},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:pt},color:{themeKey:"palette",transform:De},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:De},backgroundColor:{themeKey:"palette",transform:De},p:{style:te},pt:{style:te},pr:{style:te},pb:{style:te},pl:{style:te},px:{style:te},py:{style:te},padding:{style:te},paddingTop:{style:te},paddingRight:{style:te},paddingBottom:{style:te},paddingLeft:{style:te},paddingX:{style:te},paddingY:{style:te},paddingInline:{style:te},paddingInlineStart:{style:te},paddingInlineEnd:{style:te},paddingBlock:{style:te},paddingBlockStart:{style:te},paddingBlockEnd:{style:te},m:{style:ee},mt:{style:ee},mr:{style:ee},mb:{style:ee},ml:{style:ee},mx:{style:ee},my:{style:ee},margin:{style:ee},marginTop:{style:ee},marginRight:{style:ee},marginBottom:{style:ee},marginLeft:{style:ee},marginX:{style:ee},marginY:{style:ee},marginInline:{style:ee},marginInlineStart:{style:ee},marginInlineEnd:{style:ee},marginBlock:{style:ee},marginBlockStart:{style:ee},marginBlockEnd:{style:ee},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:mt},rowGap:{style:gt},columnGap:{style:ht},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:ce},maxWidth:{style:Gt},minWidth:{transform:ce},height:{transform:ce},maxHeight:{transform:ce},minHeight:{transform:ce},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Do(...e){const t=e.reduce((n,o)=>n.concat(Object.keys(o)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function jo(e,t){return typeof e=="function"?e(t):e}function Mo(){function e(r,n,o,i){const s={[r]:n,theme:o},u=i[r];if(!u)return{[r]:n};const{cssProperty:f=r,themeKey:l,transform:g,style:p}=u;if(n==null)return null;if(l==="typography"&&n==="inherit")return{[r]:n};const d=ut(o,l)||{};return p?p(s):Se(s,n,y=>{let c=it(d,g,y);return y===c&&typeof y=="string"&&(c=it(d,g,`${r}${y==="default"?"":Ie(y)}`,y)),f===!1?c:{[f]:c}})}function t(r){const{sx:n,theme:o={},nested:i}=r||{};if(!n)return null;const s=o.unstable_sxConfig??yt;function u(f){let l=f;if(typeof f=="function")l=f(o);else if(typeof f!="object")return f;if(!l)return null;const g=Xn(o.breakpoints),p=Object.keys(g);let d=g;return Object.keys(l).forEach(S=>{const y=jo(l[S],o);if(y!=null)if(typeof y=="object")if(s[S])d=Ve(d,e(S,y,o,s));else{const c=Se({theme:o},y,E=>({[S]:E}));Do(c,y)?d[S]=t({sx:y,theme:o,nested:!0}):d=Ve(d,c)}else d=Ve(d,e(S,y,o,s))}),!i&&o.modularCssLayers?{"@layer sx":br(o,Sr(p,d))}:br(o,Sr(p,d))}return Array.isArray(n)?n.map(u):u(n)}return t}const je=Mo();je.filterProps=["sx"];function Lo(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Bo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Fo(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var zo=/[A-Z]|^ms/g,Vo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Yr=function(t){return t.charCodeAt(1)===45},wr=function(t){return t!=null&&typeof t!="boolean"},kt=Fo(function(e){return Yr(e)?e:e.replace(zo,"-$&").toLowerCase()}),xr=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(Vo,function(n,o,i){return Ee={name:o,styles:i,next:Ee},o})}return Bo[t]!==1&&!Yr(t)&&typeof r=="number"&&r!==0?r+"px":r};function st(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var o=r;if(o.anim===1)return Ee={name:o.name,styles:o.styles,next:Ee},o.name;var i=r;if(i.styles!==void 0){var s=i.next;if(s!==void 0)for(;s!==void 0;)Ee={name:s.name,styles:s.styles,next:Ee},s=s.next;var u=i.styles+";";return u}return Wo(e,t,r)}}var f=r;return f}function Wo(e,t,r){var n="";if(Array.isArray(r))for(var o=0;o<r.length;o++)n+=st(e,t,r[o])+";";else for(var i in r){var s=r[i];if(typeof s!="object"){var u=s;wr(u)&&(n+=kt(i)+":"+xr(i,u)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&t==null)for(var f=0;f<s.length;f++)wr(s[f])&&(n+=kt(i)+":"+xr(i,s[f])+";");else{var l=st(e,t,s);switch(i){case"animation":case"animationName":{n+=kt(i)+":"+l+";";break}default:n+=i+"{"+l+"}"}}}return n}var Ar=/label:\s*([^\s;{]+)\s*(;|$)/g,Ee;function Yo(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,o="";Ee=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=st(r,t,i);else{var s=i;o+=s[0]}for(var u=1;u<e.length;u++)if(o+=st(r,t,e[u]),n){var f=i;o+=f[u]}Ar.lastIndex=0;for(var l="",g;(g=Ar.exec(o))!==null;)l+="-"+g[1];var p=Lo(o)+l;return{name:p,styles:o,next:Ee}}function Go(e,t){const r=xn(e,t);return process.env.NODE_ENV!=="production"?(...n)=>{const o=typeof e=="string"?`"${e}"`:"component";return n.length===0?console.error([`MUI: Seems like you called \`styled(${o})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
|
|
7
|
+
`)):n.some(i=>i===void 0)&&console.error(`MUI: the styled(${o})(...args) API requires all its args to be defined.`),r(...n)}:r}function Ko(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Cr=[];function Re(e){return Cr[0]=e,Yo(Cr)}const qo=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,n)=>r.val-n.val),t.reduce((r,n)=>({...r,[n.key]:n.val}),{})};function Ho(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...o}=e,i=qo(t),s=Object.keys(i);function u(d){return`@media (min-width:${typeof t[d]=="number"?t[d]:d}${r})`}function f(d){return`@media (max-width:${(typeof t[d]=="number"?t[d]:d)-n/100}${r})`}function l(d,S){const y=s.indexOf(S);return`@media (min-width:${typeof t[d]=="number"?t[d]:d}${r}) and (max-width:${(y!==-1&&typeof t[s[y]]=="number"?t[s[y]]:S)-n/100}${r})`}function g(d){return s.indexOf(d)+1<s.length?l(d,s[s.indexOf(d)+1]):u(d)}function p(d){const S=s.indexOf(d);return S===0?u(s[1]):S===s.length-1?f(s[S]):l(d,s[s.indexOf(d)+1]).replace("@media","@media not all and")}return{keys:s,values:i,up:u,down:f,between:l,only:g,not:p,unit:r,...o}}const Jo={borderRadius:4};function Gr(e=8,t=Yt({spacing:e})){if(e.mui)return e;const r=(...n)=>(process.env.NODE_ENV!=="production"&&(n.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${n.length}`)),(n.length===0?[1]:n).map(i=>{const s=t(i);return typeof s=="number"?`${s}px`:s}).join(" "));return r.mui=!0,r}function Xo(e,t){const r=this;if(r.vars){if(!r.colorSchemes?.[e]||typeof r.getColorSchemeSelector!="function")return{};let n=r.getColorSchemeSelector(e);return n==="&"?t:((n.includes("data-")||n.includes("."))&&(n=`*:where(${n.replace(/\s*&$/,"")}) &`),{[n]:t})}return r.palette.mode===e?t:{}}function Kr(e={},...t){const{breakpoints:r={},palette:n={},spacing:o,shape:i={},...s}=e,u=Ho(r),f=Gr(o);let l=ue({breakpoints:u,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:f,shape:{...Jo,...i}},s);return l=Hn(l),l.applyStyles=Xo,l=t.reduce((g,p)=>ue(g,p),l),l.unstable_sxConfig={...yt,...s?.unstable_sxConfig},l.unstable_sx=function(p){return je({sx:p,theme:this})},l}function qr(e){const{variants:t,...r}=e,n={variants:t,style:Re(r),isProcessed:!0};return n.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=Re(o.style))}),n}const Qo=Kr();function $t(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Oe(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function Zo(e){return e?(t,r)=>r[e]:null}function ei(e,t,r){e.theme=oi(e.theme)?r:e.theme[t]||e.theme}function rt(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(o=>rt(e,o,r));if(Array.isArray(n?.variants)){let o;if(n.isProcessed)o=r?Oe(n.style,r):n.style;else{const{variants:i,...s}=n;o=r?Oe(Re(s),r):s}return Hr(e,n.variants,[o],r)}return n?.isProcessed?r?Oe(Re(n.style),r):n.style:r?Oe(Re(n),r):n}function Hr(e,t,r=[],n=void 0){let o;e:for(let i=0;i<t.length;i+=1){const s=t[i];if(typeof s.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!s.props(o))continue}else for(const u in s.props)if(e[u]!==s.props[u]&&e.ownerState?.[u]!==s.props[u])continue e;typeof s.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?Oe(Re(s.style(o)),n):s.style(o))):r.push(n?Oe(Re(s.style),n):s.style)}return r}function ti(e={}){const{themeId:t,defaultTheme:r=Qo,rootShouldForwardProp:n=$t,slotShouldForwardProp:o=$t}=e;function i(u){ei(u,t,r)}return(u,f={})=>{Ko(u,I=>I.filter($=>$!==je));const{name:l,slot:g,skipVariantsResolver:p,skipSx:d,overridesResolver:S=Zo(Jr(g)),...y}=f,c=l&&l.startsWith("Mui")||g?"components":"custom",E=p!==void 0?p:g&&g!=="Root"&&g!=="root"||!1,w=d||!1;let C=$t;g==="Root"||g==="root"?C=n:g?C=o:ii(u)&&(C=void 0);const h=Go(u,{shouldForwardProp:C,label:ni(l,g),...y}),b=I=>{if(I.__emotion_real===I)return I;if(typeof I=="function")return function(M){return rt(M,I,M.theme.modularCssLayers?c:void 0)};if(ve(I)){const $=qr(I);return function(P){return $.variants?rt(P,$,P.theme.modularCssLayers?c:void 0):P.theme.modularCssLayers?Oe($.style,c):$.style}}return I},m=(...I)=>{const $=[],M=I.map(b),P=[];if($.push(i),l&&S&&P.push(function(W){const oe=W.theme.components?.[l]?.styleOverrides;if(!oe)return null;const ae={};for(const he in oe)ae[he]=rt(W,oe[he],W.theme.modularCssLayers?"theme":void 0);return S(W,ae)}),l&&!E&&P.push(function(W){const oe=W.theme?.components?.[l]?.variants;return oe?Hr(W,oe,[],W.theme.modularCssLayers?"theme":void 0):null}),w||P.push(je),Array.isArray(M[0])){const Y=M.shift(),W=new Array($.length).fill(""),se=new Array(P.length).fill("");let oe;oe=[...W,...Y,...se],oe.raw=[...W,...Y.raw,...se],$.unshift(oe)}const a=[...$,...M,...P],k=h(...a);return u.muiName&&(k.muiName=u.muiName),process.env.NODE_ENV!=="production"&&(k.displayName=ri(l,g,u)),k};return h.withConfig&&(m.withConfig=h.withConfig),m}}function ri(e,t,r){return e?`${e}${Ie(t||"")}`:`Styled(${Ln(r)})`}function ni(e,t){let r;return process.env.NODE_ENV!=="production"&&e&&(r=`${e}-${Jr(t||"Root")}`),r}function oi(e){for(const t in e)return!1;return!0}function ii(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Jr(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function Kt(e,t=0,r=1){return process.env.NODE_ENV!=="production"&&(e<t||e>r)&&console.error(`MUI: The value provided ${e} is out of range [${t}, ${r}].`),Yn(e,t,r)}function si(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),process.env.NODE_ENV!=="production"&&e.length!==e.trim().length&&console.error(`MUI: The color: "${e}" is invalid. Make sure the color input doesn't contain leading/trailing space.`),r?`rgb${r.length===4?"a":""}(${r.map((n,o)=>o<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function Ae(e){if(e.type)return e;if(e.charAt(0)==="#")return Ae(si(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(process.env.NODE_ENV!=="production"?`MUI: Unsupported \`${e}\` color.
|
|
8
|
+
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:xe(9,e));let n=e.substring(t+1,e.length-1),o;if(r==="color"){if(n=n.split(" "),o=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(o))throw new Error(process.env.NODE_ENV!=="production"?`MUI: unsupported \`${o}\` color space.
|
|
9
|
+
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:xe(10,o))}else n=n.split(",");return n=n.map(i=>parseFloat(i)),{type:r,values:n,colorSpace:o}}const ai=e=>{const t=Ae(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},Be=(e,t)=>{try{return ai(e)}catch{return t&&process.env.NODE_ENV!=="production"&&console.warn(t),e}};function bt(e){const{type:t,colorSpace:r}=e;let{values:n}=e;return t.includes("rgb")?n=n.map((o,i)=>i<3?parseInt(o,10):o):t.includes("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),t.includes("color")?n=`${r} ${n.join(" ")}`:n=`${n.join(", ")}`,`${t}(${n})`}function Xr(e){e=Ae(e);const{values:t}=e,r=t[0],n=t[1]/100,o=t[2]/100,i=n*Math.min(o,1-o),s=(l,g=(l+r/30)%12)=>o-i*Math.max(Math.min(g-3,9-g,1),-1);let u="rgb";const f=[Math.round(s(0)*255),Math.round(s(8)*255),Math.round(s(4)*255)];return e.type==="hsla"&&(u+="a",f.push(t[3])),bt({type:u,values:f})}function Ft(e){e=Ae(e);let t=e.type==="hsl"||e.type==="hsla"?Ae(Xr(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function Tr(e,t){const r=Ft(e),n=Ft(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function ci(e,t){return e=Ae(e),t=Kt(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,bt(e)}function et(e,t,r){try{return ci(e,t)}catch{return e}}function qt(e,t){if(e=Ae(e),t=Kt(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return bt(e)}function X(e,t,r){try{return qt(e,t)}catch{return e}}function Ht(e,t){if(e=Ae(e),t=Kt(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return bt(e)}function Q(e,t,r){try{return Ht(e,t)}catch{return e}}function ui(e,t=.15){return Ft(e)>.5?qt(e,t):Ht(e,t)}function tt(e,t,r){try{return ui(e,t)}catch{return e}}const li=we.createContext(void 0);process.env.NODE_ENV!=="production"&&(V.node,V.object);function fi(e){const{theme:t,name:r,props:n}=e;if(!t||!t.components||!t.components[r])return n;const o=t.components[r];return o.defaultProps?Bt(o.defaultProps,n):!o.styleOverrides&&!o.variants?Bt(o,n):n}function di({props:e,name:t}){const r=we.useContext(li);return fi({props:e,name:t,theme:{components:r}})}const _r={theme:void 0};function pi(e){let t,r;return function(o){let i=t;return(i===void 0||o.theme!==r)&&(_r.theme=o.theme,i=qr(e(_r)),t=i,r=o.theme),i}}function mi(e=""){function t(...n){if(!n.length)return"";const o=n[0];return typeof o=="string"&&!o.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${e?`${e}-`:""}${o}${t(...n.slice(1))})`:`, ${o}`}return(n,...o)=>`var(--${e?`${e}-`:""}${n}${t(...o)})`}const Or=(e,t,r,n=[])=>{let o=e;t.forEach((i,s)=>{s===t.length-1?Array.isArray(o)?o[Number(i)]=r:o&&typeof o=="object"&&(o[i]=r):o&&typeof o=="object"&&(o[i]||(o[i]=n.includes(i)?[]:{}),o=o[i])})},hi=(e,t,r)=>{function n(o,i=[],s=[]){Object.entries(o).forEach(([u,f])=>{(!r||r&&!r([...i,u]))&&f!=null&&(typeof f=="object"&&Object.keys(f).length>0?n(f,[...i,u],Array.isArray(f)?[...s,u]:s):t([...i,u],f,s))})}n(e)},gi=(e,t)=>typeof t=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(n=>e.includes(n))||e[e.length-1].toLowerCase().includes("opacity")?t:`${t}px`:t;function Pt(e,t){const{prefix:r,shouldSkipGeneratingVar:n}=t||{},o={},i={},s={};return hi(e,(u,f,l)=>{if((typeof f=="string"||typeof f=="number")&&(!n||!n(u,f))){const g=`--${r?`${r}-`:""}${u.join("-")}`,p=gi(u,f);Object.assign(o,{[g]:p}),Or(i,u,`var(${g})`,l),Or(s,u,`var(${g}, ${p})`,l)}},u=>u[0]==="vars"),{css:o,vars:i,varsWithDefaults:s}}function yi(e,t={}){const{getSelector:r=E,disableCssColorScheme:n,colorSchemeSelector:o}=t,{colorSchemes:i={},components:s,defaultColorScheme:u="light",...f}=e,{vars:l,css:g,varsWithDefaults:p}=Pt(f,t);let d=p;const S={},{[u]:y,...c}=i;if(Object.entries(c||{}).forEach(([h,b])=>{const{vars:m,css:I,varsWithDefaults:$}=Pt(b,t);d=ue(d,$),S[h]={css:I,vars:m}}),y){const{css:h,vars:b,varsWithDefaults:m}=Pt(y,t);d=ue(d,m),S[u]={css:h,vars:b}}function E(h,b){let m=o;if(o==="class"&&(m=".%s"),o==="data"&&(m="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(m=`[${o}="%s"]`),h){if(m==="media")return e.defaultColorScheme===h?":root":{[`@media (prefers-color-scheme: ${i[h]?.palette?.mode||h})`]:{":root":b}};if(m)return e.defaultColorScheme===h?`:root, ${m.replace("%s",String(h))}`:m.replace("%s",String(h))}return":root"}return{vars:d,generateThemeVars:()=>{let h={...l};return Object.entries(S).forEach(([,{vars:b}])=>{h=ue(h,b)}),h},generateStyleSheets:()=>{const h=[],b=e.defaultColorScheme||"light";function m(M,P){Object.keys(P).length&&h.push(typeof M=="string"?{[M]:{...P}}:M)}m(r(void 0,{...g}),g);const{[b]:I,...$}=S;if(I){const{css:M}=I,P=i[b]?.palette?.mode,a=!n&&P?{colorScheme:P,...M}:{...M};m(r(b,{...a}),a)}return Object.entries($).forEach(([M,{css:P}])=>{const a=i[M]?.palette?.mode,k=!n&&a?{colorScheme:a,...P}:{...P};m(r(M,{...k}),k)}),h}}}function bi(e){return function(r){return e==="media"?(process.env.NODE_ENV!=="production"&&r!=="light"&&r!=="dark"&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${r}'.`),`@media (prefers-color-scheme: ${r})`):e?e.startsWith("data-")&&!e.includes("%s")?`[${e}="${r}"] &`:e==="class"?`.${r} &`:e==="data"?`[data-${r}] &`:`${e.replace("%s",r)} &`:"&"}}const Ye={black:"#000",white:"#fff"},vi={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},ke={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},$e={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Le={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Pe={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Ne={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},Ue={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function Qr(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Ye.white,default:Ye.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const Si=Qr();function Zr(){return{text:{primary:Ye.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Ye.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const Rr=Zr();function Ir(e,t,r,n){const o=n.light||n,i=n.dark||n*1.5;e[t]||(e.hasOwnProperty(r)?e[t]=e[r]:t==="light"?e.light=Ht(e.main,o):t==="dark"&&(e.dark=qt(e.main,i)))}function Ei(e="light"){return e==="dark"?{main:Pe[200],light:Pe[50],dark:Pe[400]}:{main:Pe[700],light:Pe[400],dark:Pe[800]}}function wi(e="light"){return e==="dark"?{main:ke[200],light:ke[50],dark:ke[400]}:{main:ke[500],light:ke[300],dark:ke[700]}}function xi(e="light"){return e==="dark"?{main:$e[500],light:$e[300],dark:$e[700]}:{main:$e[700],light:$e[400],dark:$e[800]}}function Ai(e="light"){return e==="dark"?{main:Ne[400],light:Ne[300],dark:Ne[700]}:{main:Ne[700],light:Ne[500],dark:Ne[900]}}function Ci(e="light"){return e==="dark"?{main:Ue[400],light:Ue[300],dark:Ue[700]}:{main:Ue[800],light:Ue[500],dark:Ue[900]}}function Ti(e="light"){return e==="dark"?{main:Le[400],light:Le[300],dark:Le[700]}:{main:"#ed6c02",light:Le[500],dark:Le[900]}}function Jt(e){const{mode:t="light",contrastThreshold:r=3,tonalOffset:n=.2,...o}=e,i=e.primary||Ei(t),s=e.secondary||wi(t),u=e.error||xi(t),f=e.info||Ai(t),l=e.success||Ci(t),g=e.warning||Ti(t);function p(c){const E=Tr(c,Rr.text.primary)>=r?Rr.text.primary:Si.text.primary;if(process.env.NODE_ENV!=="production"){const w=Tr(c,E);w<3&&console.error([`MUI: The contrast ratio of ${w}:1 for ${E} on ${c}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join(`
|
|
10
|
+
`))}return E}const d=({color:c,name:E,mainShade:w=500,lightShade:C=300,darkShade:h=700})=>{if(c={...c},!c.main&&c[w]&&(c.main=c[w]),!c.hasOwnProperty("main"))throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${E?` (${E})`:""} provided to augmentColor(color) is invalid.
|
|
11
|
+
The color object needs to have a \`main\` property or a \`${w}\` property.`:xe(11,E?` (${E})`:"",w));if(typeof c.main!="string")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${E?` (${E})`:""} provided to augmentColor(color) is invalid.
|
|
12
|
+
\`color.main\` should be a string, but \`${JSON.stringify(c.main)}\` was provided instead.
|
|
13
13
|
|
|
14
14
|
Did you intend to use one of the following approaches?
|
|
15
15
|
|
|
@@ -21,15 +21,15 @@ const theme1 = createTheme({ palette: {
|
|
|
21
21
|
|
|
22
22
|
const theme2 = createTheme({ palette: {
|
|
23
23
|
primary: { main: green[500] },
|
|
24
|
-
} });`:
|
|
25
|
-
`)),Object.keys(
|
|
24
|
+
} });`:xe(12,E?` (${E})`:"",JSON.stringify(c.main)));return Ir(c,"light",C,n),Ir(c,"dark",h,n),c.contrastText||(c.contrastText=p(c.main)),c};let S;return t==="light"?S=Qr():t==="dark"&&(S=Zr()),process.env.NODE_ENV!=="production"&&(S||console.error(`MUI: The palette mode \`${t}\` is not supported.`)),ue({common:{...Ye},mode:t,primary:d({color:i,name:"primary"}),secondary:d({color:s,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:d({color:u,name:"error"}),warning:d({color:g,name:"warning"}),info:d({color:f,name:"info"}),success:d({color:l,name:"success"}),grey:vi,contrastThreshold:r,getContrastText:p,augmentColor:d,tonalOffset:n,...S},o)}function _i(e){const t={};return Object.entries(e).forEach(n=>{const[o,i]=n;typeof i=="object"&&(t[o]=`${i.fontStyle?`${i.fontStyle} `:""}${i.fontVariant?`${i.fontVariant} `:""}${i.fontWeight?`${i.fontWeight} `:""}${i.fontStretch?`${i.fontStretch} `:""}${i.fontSize||""}${i.lineHeight?`/${i.lineHeight} `:""}${i.fontFamily||""}`)}),t}function Oi(e,t){return{toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}},...t}}function Ri(e){return Math.round(e*1e5)/1e5}const kr={textTransform:"uppercase"},$r='"Roboto", "Helvetica", "Arial", sans-serif';function Ii(e,t){const{fontFamily:r=$r,fontSize:n=14,fontWeightLight:o=300,fontWeightRegular:i=400,fontWeightMedium:s=500,fontWeightBold:u=700,htmlFontSize:f=16,allVariants:l,pxToRem:g,...p}=typeof t=="function"?t(e):t;process.env.NODE_ENV!=="production"&&(typeof n!="number"&&console.error("MUI: `fontSize` is required to be a number."),typeof f!="number"&&console.error("MUI: `htmlFontSize` is required to be a number."));const d=n/14,S=g||(E=>`${E/f*d}rem`),y=(E,w,C,h,b)=>({fontFamily:r,fontWeight:E,fontSize:S(w),lineHeight:C,...r===$r?{letterSpacing:`${Ri(h/w)}em`}:{},...b,...l}),c={h1:y(o,96,1.167,-1.5),h2:y(o,60,1.2,-.5),h3:y(i,48,1.167,0),h4:y(i,34,1.235,.25),h5:y(i,24,1.334,0),h6:y(s,20,1.6,.15),subtitle1:y(i,16,1.75,.15),subtitle2:y(s,14,1.57,.1),body1:y(i,16,1.5,.15),body2:y(i,14,1.43,.15),button:y(s,14,1.75,.4,kr),caption:y(i,12,1.66,.4),overline:y(i,12,2.66,1,kr),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return ue({htmlFontSize:f,pxToRem:S,fontFamily:r,fontSize:n,fontWeightLight:o,fontWeightRegular:i,fontWeightMedium:s,fontWeightBold:u,...c},p,{clone:!1})}const ki=.2,$i=.14,Pi=.12;function Z(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${ki})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${$i})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Pi})`].join(",")}const Ni=["none",Z(0,2,1,-1,0,1,1,0,0,1,3,0),Z(0,3,1,-2,0,2,2,0,0,1,5,0),Z(0,3,3,-2,0,3,4,0,0,1,8,0),Z(0,2,4,-1,0,4,5,0,0,1,10,0),Z(0,3,5,-1,0,5,8,0,0,1,14,0),Z(0,3,5,-1,0,6,10,0,0,1,18,0),Z(0,4,5,-2,0,7,10,1,0,2,16,1),Z(0,5,5,-3,0,8,10,1,0,3,14,2),Z(0,5,6,-3,0,9,12,1,0,3,16,2),Z(0,6,6,-3,0,10,14,1,0,4,18,3),Z(0,6,7,-4,0,11,15,1,0,4,20,3),Z(0,7,8,-4,0,12,17,2,0,5,22,4),Z(0,7,8,-4,0,13,19,2,0,5,24,4),Z(0,7,9,-4,0,14,21,2,0,5,26,4),Z(0,8,9,-5,0,15,22,2,0,6,28,5),Z(0,8,10,-5,0,16,24,2,0,6,30,5),Z(0,8,11,-5,0,17,26,2,0,6,32,5),Z(0,9,11,-5,0,18,28,2,0,7,34,6),Z(0,9,12,-6,0,19,29,2,0,7,36,6),Z(0,10,13,-6,0,20,31,3,0,8,38,7),Z(0,10,13,-6,0,21,33,3,0,8,40,7),Z(0,10,14,-6,0,22,35,3,0,8,42,7),Z(0,11,14,-7,0,23,36,3,0,9,44,8),Z(0,11,15,-7,0,24,38,3,0,9,46,8)],Ui={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Di={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Pr(e){return`${Math.round(e)}ms`}function ji(e){if(!e)return 0;const t=e/36;return Math.min(Math.round((4+15*t**.25+t/5)*10),3e3)}function Mi(e){const t={...Ui,...e.easing},r={...Di,...e.duration};return{getAutoHeightDuration:ji,create:(o=["all"],i={})=>{const{duration:s=r.standard,easing:u=t.easeInOut,delay:f=0,...l}=i;if(process.env.NODE_ENV!=="production"){const g=d=>typeof d=="string",p=d=>!Number.isNaN(parseFloat(d));!g(o)&&!Array.isArray(o)&&console.error('MUI: Argument "props" must be a string or Array.'),!p(s)&&!g(s)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${s}.`),g(u)||console.error('MUI: Argument "easing" must be a string.'),!p(f)&&!g(f)&&console.error('MUI: Argument "delay" must be a number or a string.'),typeof i!="object"&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join(`
|
|
25
|
+
`)),Object.keys(l).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(l).join(",")}].`)}return(Array.isArray(o)?o:[o]).map(g=>`${g} ${typeof s=="string"?s:Pr(s)} ${u} ${typeof f=="string"?f:Pr(f)}`).join(",")},...e,easing:t,duration:r}}const Li={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function Bi(e){return ve(e)||typeof e>"u"||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||Array.isArray(e)}function en(e={}){const t={...e};function r(n){const o=Object.entries(n);for(let i=0;i<o.length;i++){const[s,u]=o[i];!Bi(u)||s.startsWith("unstable_")?delete n[s]:ve(u)&&(n[s]={...u},r(n[s]))}}return r(t),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
|
|
26
26
|
|
|
27
27
|
const theme = ${JSON.stringify(t,null,2)};
|
|
28
28
|
|
|
29
29
|
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
30
30
|
theme.transitions = createTransitions(theme.transitions || {});
|
|
31
31
|
|
|
32
|
-
export default theme;`}function zt(e={},...t){const{breakpoints:r,mixins:n={},spacing:o,palette:i={},transitions:
|
|
33
|
-
`))}
|
|
34
|
-
To suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function os(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const Se=e=>{try{return e()}catch{}},is=(e="mui")=>Ci(e);function Ut(e,t,r,n){if(!t)return;t=t===!0?{}:t;const o=n==="dark"?"dark":"light";if(!r){e[n]=Zi({...t,palette:{mode:o,...t?.palette}});return}const{palette:i,...c}=zt({...r,palette:{mode:o,...t?.palette}});return e[n]={...t,palette:i,opacity:{...cn(o),...t?.opacity},overlays:t?.overlays||ln(o)},c}function ss(e={},...t){const{colorSchemes:r={light:!0},defaultColorScheme:n,disableCssColorScheme:o=!1,cssVarPrefix:i="mui",shouldSkipGeneratingVar:c=es,colorSchemeSelector:l=r.light&&r.dark?"media":void 0,rootSelector:f=":root",...u}=e,y=Object.keys(r)[0],d=n||(r.light&&y!=="light"?"light":y),g=is(i),{[d]:v,light:h,dark:a,...b}=r,x={...b};let T=v;if((d==="dark"&&!("dark"in r)||d==="light"&&!("light"in r))&&(T=!0),!T)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${d}\` option is either missing or invalid.`:Ce(21,d));const C=Ut(x,T,u,d);h&&!x.light&&Ut(x,h,void 0,"light"),a&&!x.dark&&Ut(x,a,void 0,"dark");let m={defaultColorScheme:d,...C,cssVarPrefix:i,colorSchemeSelector:l,rootSelector:f,getCssVar:g,colorSchemes:x,font:{...Mi(C.typography),...C.font},spacing:os(u.spacing)};Object.keys(m.colorSchemes).forEach(P=>{const s=m.colorSchemes[P].palette,$=L=>{const G=L.split("-"),ae=G[1],oe=G[2];return g(L,s[ae][oe])};if(s.mode==="light"&&(S(s.common,"background","#fff"),S(s.common,"onBackground","#000")),s.mode==="dark"&&(S(s.common,"background","#000"),S(s.common,"onBackground","#fff")),ns(s,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),s.mode==="light"){S(s.Alert,"errorColor",X(s.error.light,.6)),S(s.Alert,"infoColor",X(s.info.light,.6)),S(s.Alert,"successColor",X(s.success.light,.6)),S(s.Alert,"warningColor",X(s.warning.light,.6)),S(s.Alert,"errorFilledBg",$("palette-error-main")),S(s.Alert,"infoFilledBg",$("palette-info-main")),S(s.Alert,"successFilledBg",$("palette-success-main")),S(s.Alert,"warningFilledBg",$("palette-warning-main")),S(s.Alert,"errorFilledColor",Se(()=>s.getContrastText(s.error.main))),S(s.Alert,"infoFilledColor",Se(()=>s.getContrastText(s.info.main))),S(s.Alert,"successFilledColor",Se(()=>s.getContrastText(s.success.main))),S(s.Alert,"warningFilledColor",Se(()=>s.getContrastText(s.warning.main))),S(s.Alert,"errorStandardBg",Q(s.error.light,.9)),S(s.Alert,"infoStandardBg",Q(s.info.light,.9)),S(s.Alert,"successStandardBg",Q(s.success.light,.9)),S(s.Alert,"warningStandardBg",Q(s.warning.light,.9)),S(s.Alert,"errorIconColor",$("palette-error-main")),S(s.Alert,"infoIconColor",$("palette-info-main")),S(s.Alert,"successIconColor",$("palette-success-main")),S(s.Alert,"warningIconColor",$("palette-warning-main")),S(s.AppBar,"defaultBg",$("palette-grey-100")),S(s.Avatar,"defaultBg",$("palette-grey-400")),S(s.Button,"inheritContainedBg",$("palette-grey-300")),S(s.Button,"inheritContainedHoverBg",$("palette-grey-A100")),S(s.Chip,"defaultBorder",$("palette-grey-400")),S(s.Chip,"defaultAvatarColor",$("palette-grey-700")),S(s.Chip,"defaultIconColor",$("palette-grey-700")),S(s.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),S(s.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),S(s.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),S(s.LinearProgress,"primaryBg",Q(s.primary.main,.62)),S(s.LinearProgress,"secondaryBg",Q(s.secondary.main,.62)),S(s.LinearProgress,"errorBg",Q(s.error.main,.62)),S(s.LinearProgress,"infoBg",Q(s.info.main,.62)),S(s.LinearProgress,"successBg",Q(s.success.main,.62)),S(s.LinearProgress,"warningBg",Q(s.warning.main,.62)),S(s.Skeleton,"bg",`rgba(${$("palette-text-primaryChannel")} / 0.11)`),S(s.Slider,"primaryTrack",Q(s.primary.main,.62)),S(s.Slider,"secondaryTrack",Q(s.secondary.main,.62)),S(s.Slider,"errorTrack",Q(s.error.main,.62)),S(s.Slider,"infoTrack",Q(s.info.main,.62)),S(s.Slider,"successTrack",Q(s.success.main,.62)),S(s.Slider,"warningTrack",Q(s.warning.main,.62));const L=rt(s.background.default,.8);S(s.SnackbarContent,"bg",L),S(s.SnackbarContent,"color",Se(()=>s.getContrastText(L))),S(s.SpeedDialAction,"fabHoverBg",rt(s.background.paper,.15)),S(s.StepConnector,"border",$("palette-grey-400")),S(s.StepContent,"border",$("palette-grey-400")),S(s.Switch,"defaultColor",$("palette-common-white")),S(s.Switch,"defaultDisabledColor",$("palette-grey-100")),S(s.Switch,"primaryDisabledColor",Q(s.primary.main,.62)),S(s.Switch,"secondaryDisabledColor",Q(s.secondary.main,.62)),S(s.Switch,"errorDisabledColor",Q(s.error.main,.62)),S(s.Switch,"infoDisabledColor",Q(s.info.main,.62)),S(s.Switch,"successDisabledColor",Q(s.success.main,.62)),S(s.Switch,"warningDisabledColor",Q(s.warning.main,.62)),S(s.TableCell,"border",Q(tt(s.divider,1),.88)),S(s.Tooltip,"bg",tt(s.grey[700],.92))}if(s.mode==="dark"){S(s.Alert,"errorColor",Q(s.error.light,.6)),S(s.Alert,"infoColor",Q(s.info.light,.6)),S(s.Alert,"successColor",Q(s.success.light,.6)),S(s.Alert,"warningColor",Q(s.warning.light,.6)),S(s.Alert,"errorFilledBg",$("palette-error-dark")),S(s.Alert,"infoFilledBg",$("palette-info-dark")),S(s.Alert,"successFilledBg",$("palette-success-dark")),S(s.Alert,"warningFilledBg",$("palette-warning-dark")),S(s.Alert,"errorFilledColor",Se(()=>s.getContrastText(s.error.dark))),S(s.Alert,"infoFilledColor",Se(()=>s.getContrastText(s.info.dark))),S(s.Alert,"successFilledColor",Se(()=>s.getContrastText(s.success.dark))),S(s.Alert,"warningFilledColor",Se(()=>s.getContrastText(s.warning.dark))),S(s.Alert,"errorStandardBg",X(s.error.light,.9)),S(s.Alert,"infoStandardBg",X(s.info.light,.9)),S(s.Alert,"successStandardBg",X(s.success.light,.9)),S(s.Alert,"warningStandardBg",X(s.warning.light,.9)),S(s.Alert,"errorIconColor",$("palette-error-main")),S(s.Alert,"infoIconColor",$("palette-info-main")),S(s.Alert,"successIconColor",$("palette-success-main")),S(s.Alert,"warningIconColor",$("palette-warning-main")),S(s.AppBar,"defaultBg",$("palette-grey-900")),S(s.AppBar,"darkBg",$("palette-background-paper")),S(s.AppBar,"darkColor",$("palette-text-primary")),S(s.Avatar,"defaultBg",$("palette-grey-600")),S(s.Button,"inheritContainedBg",$("palette-grey-800")),S(s.Button,"inheritContainedHoverBg",$("palette-grey-700")),S(s.Chip,"defaultBorder",$("palette-grey-700")),S(s.Chip,"defaultAvatarColor",$("palette-grey-300")),S(s.Chip,"defaultIconColor",$("palette-grey-300")),S(s.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),S(s.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),S(s.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),S(s.LinearProgress,"primaryBg",X(s.primary.main,.5)),S(s.LinearProgress,"secondaryBg",X(s.secondary.main,.5)),S(s.LinearProgress,"errorBg",X(s.error.main,.5)),S(s.LinearProgress,"infoBg",X(s.info.main,.5)),S(s.LinearProgress,"successBg",X(s.success.main,.5)),S(s.LinearProgress,"warningBg",X(s.warning.main,.5)),S(s.Skeleton,"bg",`rgba(${$("palette-text-primaryChannel")} / 0.13)`),S(s.Slider,"primaryTrack",X(s.primary.main,.5)),S(s.Slider,"secondaryTrack",X(s.secondary.main,.5)),S(s.Slider,"errorTrack",X(s.error.main,.5)),S(s.Slider,"infoTrack",X(s.info.main,.5)),S(s.Slider,"successTrack",X(s.success.main,.5)),S(s.Slider,"warningTrack",X(s.warning.main,.5));const L=rt(s.background.default,.98);S(s.SnackbarContent,"bg",L),S(s.SnackbarContent,"color",Se(()=>s.getContrastText(L))),S(s.SpeedDialAction,"fabHoverBg",rt(s.background.paper,.15)),S(s.StepConnector,"border",$("palette-grey-600")),S(s.StepContent,"border",$("palette-grey-600")),S(s.Switch,"defaultColor",$("palette-grey-300")),S(s.Switch,"defaultDisabledColor",$("palette-grey-600")),S(s.Switch,"primaryDisabledColor",X(s.primary.main,.55)),S(s.Switch,"secondaryDisabledColor",X(s.secondary.main,.55)),S(s.Switch,"errorDisabledColor",X(s.error.main,.55)),S(s.Switch,"infoDisabledColor",X(s.info.main,.55)),S(s.Switch,"successDisabledColor",X(s.success.main,.55)),S(s.Switch,"warningDisabledColor",X(s.warning.main,.55)),S(s.TableCell,"border",X(tt(s.divider,1),.68)),S(s.Tooltip,"bg",tt(s.grey[700],.92))}be(s.background,"default"),be(s.background,"paper"),be(s.common,"background"),be(s.common,"onBackground"),be(s,"divider"),Object.keys(s).forEach(L=>{const G=s[L];L!=="tonalOffset"&&G&&typeof G=="object"&&(G.main&&S(s[L],"mainChannel",ze(Ve(G.main))),G.light&&S(s[L],"lightChannel",ze(Ve(G.light))),G.dark&&S(s[L],"darkChannel",ze(Ve(G.dark))),G.contrastText&&S(s[L],"contrastTextChannel",ze(Ve(G.contrastText))),L==="text"&&(be(s[L],"primary"),be(s[L],"secondary")),L==="action"&&(G.active&&be(s[L],"active"),G.selected&&be(s[L],"selected")))})}),m=t.reduce((P,s)=>fe(P,s),m);const p={prefix:i,disableCssColorScheme:o,shouldSkipGeneratingVar:c,getSelector:rs(m)},{vars:E,generateThemeVars:k,generateStyleSheets:N}=_i(m,p);return m.vars=E,Object.entries(m.colorSchemes[m.defaultColorScheme]).forEach(([P,s])=>{m[P]=s}),m.generateThemeVars=k,m.generateStyleSheets=N,m.generateSpacing=function(){return Qr(u.spacing,qt(this))},m.getColorSchemeSelector=Ri(l),m.spacing=m.generateSpacing(),m.shouldSkipGeneratingVar=c,m.unstable_sxConfig={...bt,...u?.unstable_sxConfig},m.unstable_sx=function(s){return Le({sx:s,theme:this})},m.toRuntimeSource=an,m}function jr(e,t,r){e.colorSchemes&&r&&(e.colorSchemes[t]={...r!==!0&&r,palette:Zt({...r===!0?{}:r.palette,mode:t})})}function as(e={},...t){const{palette:r,cssVariables:n=!1,colorSchemes:o=r?void 0:{light:!0},defaultColorScheme:i=r?.mode,...c}=e,l=i||"light",f=o?.[l],u={...o,...r?{[l]:{...typeof f!="boolean"&&f,palette:r}}:void 0};if(n===!1){if(!("colorSchemes"in e))return zt(e,...t);let y=r;"palette"in e||u[l]&&(u[l]!==!0?y=u[l].palette:l==="dark"&&(y={mode:"dark"}));const d=zt({...e,palette:y},...t);return d.defaultColorScheme=l,d.colorSchemes=u,d.palette.mode==="light"&&(d.colorSchemes.light={...u.light!==!0&&u.light,palette:d.palette},jr(d,"dark",u.dark)),d.palette.mode==="dark"&&(d.colorSchemes.dark={...u.dark!==!0&&u.dark,palette:d.palette},jr(d,"light",u.light)),d}return!r&&!("light"in u)&&l==="light"&&(u.light=!0),ss({...c,colorSchemes:u,defaultColorScheme:l,...typeof n!="boolean"&&n},...t)}const cs=as(),ls="$$material";function us(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const fs=e=>us(e)&&e!=="classes",ds=fi({themeId:ls,defaultTheme:cs,rootShouldForwardProp:fs}),ps=Ai;process.env.NODE_ENV!=="production"&&(W.node,W.object.isRequired);function ms(e){return wi(e)}function gs(e){return Kt("MuiSvgIcon",e)}eo("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const hs=e=>{const{color:t,fontSize:r,classes:n}=e,o={root:["root",t!=="inherit"&&`color${Oe(t)}`,`fontSize${Oe(r)}`]};return Jn(o,gs,n)},ys=ds("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.color!=="inherit"&&t[`color${Oe(r.color)}`],t[`fontSize${Oe(r.fontSize)}`]]}})(ps(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),lt=Ae.forwardRef(function(t,r){const n=ms({props:t,name:"MuiSvgIcon"}),{children:o,className:i,color:c="inherit",component:l="svg",fontSize:f="medium",htmlColor:u,inheritViewBox:y=!1,titleAccess:d,viewBox:g="0 0 24 24",...v}=n,h=Ae.isValidElement(o)&&o.type==="svg",a={...n,color:c,component:l,fontSize:f,instanceFontSize:t.fontSize,inheritViewBox:y,viewBox:g,hasSvgAsChild:h},b={};y||(b.viewBox=g);const x=hs(a);return w.jsxs(ys,{as:l,className:ro(x.root,i),focusable:"false",color:u,"aria-hidden":d?void 0:!0,role:d?"img":void 0,ref:r,...b,...v,...h&&o.props,ownerState:a,children:[h?o.props.children:o,d?w.jsx("title",{children:d}):null]})});process.env.NODE_ENV!=="production"&&(lt.propTypes={children:W.node,classes:W.object,className:W.string,color:W.oneOfType([W.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),W.string]),component:W.elementType,fontSize:W.oneOfType([W.oneOf(["inherit","large","medium","small"]),W.string]),htmlColor:W.string,inheritViewBox:W.bool,shapeRendering:W.string,sx:W.oneOfType([W.arrayOf(W.oneOfType([W.func,W.object,W.bool])),W.func,W.object]),titleAccess:W.string,viewBox:W.string});lt.muiName="SvgIcon";function un(e,t){function r(n,o){return w.jsx(lt,{"data-testid":`${t}Icon`,ref:o,...n,children:e})}return process.env.NODE_ENV!=="production"&&(r.displayName=`${t}Icon`),r.muiName=lt.muiName,Ae.memo(Ae.forwardRef(r))}const Ss=un(w.jsx("path",{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z"}),"Logout"),de={ACCOUNTS:"spry_accounts",BRIDGE_ACCOUNTS:"spry_accounts_shared_state",ADD_ACCOUNT_IN_PROGRESS:"spry_add_account_in_progress",RETURN_URL:"spry_return_url",TEMP_CURRENT_USER:"spry_temp_current_user"},He={ACCESS_TOKEN_BUFFER_SECONDS:60,REFRESH_TOKEN_BUFFER_SECONDS:300,STALE_CHECK_INTERVAL_MS:1e3},me={INVALID_TOKEN:"Invalid or malformed token",TOKEN_DECODE_FAILED:"Failed to decode token",ACCOUNT_NOT_FOUND:"Account not found",SIGNIN_REDIRECT_FAILED:"Failed to initiate sign-in redirect",LOGOUT_FAILED:"Failed to logout from Keycloak, but account will be removed locally.",TOKEN_REFRESH_FAILED:"Failed to refresh token for account",SSO_CLEAR_FAILED:"Failed to clear SSO session. Please sign out first if prompted by Keycloak."},fn={LOCALSTORAGE_XSS_WARNING:"⚠️ Tokens stored in localStorage are vulnerable to XSS. Ensure CSP headers are configured.",ACCOUNT_MARKED_STALE:"Account refresh token expired. Click to re-authenticate.",NO_ACCOUNTS:"No additional accounts stored. Your primary auth remains active.",REDIRECT_IN_PROGRESS:"Redirecting to Keycloak for authentication..."},dn="https://sprylogin.com/apps-api/sync-bridge.html";function Be(e){try{const t=e.split(".");if(t.length!==3)return console.warn(me.INVALID_TOKEN),null;const r=t[1];return JSON.parse(decodeURIComponent(atob(r).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(t){return console.warn(me.TOKEN_DECODE_FAILED,t),null}}function Et(e,t=He.ACCESS_TOKEN_BUFFER_SECONDS){if(!e)return!0;const r=Be(e);if(!r||typeof r.exp!="number")return!0;const n=r.exp*1e3,o=Date.now(),i=t*1e3;return o>=n-i}function er(e,t=He.REFRESH_TOKEN_BUFFER_SECONDS){if(!e)return!0;const r=Be(e);if(!r||typeof r.exp!="number")return!0;const n=r.exp*1e3,o=Date.now(),i=t*1e3;return o>=n-i}function bs(e){if(!e)return null;const t=Be(e);return!t||typeof t.exp!="number"?null:t.exp*1e3}function vs(e){if(!e)return-1;const t=Be(e);if(!t||typeof t.exp!="number")return-1;const r=t.exp*1e3,n=Date.now(),o=r-n;return Math.max(0,o/1e3)}function Me(e){const t=e.profile||{},r=t.email||"unknown@example.com",n=t.given_name,o=t.name||n||r.split("@")[0],i=t.picture;return{email:r,name:o,avatar:i}}function pn(e){return!!(e.isStale||er(e.user.refresh_token)||!e.user.refresh_token&&Et(e.user.access_token))}function Es(e){return Et(e,He.ACCESS_TOKEN_BUFFER_SECONDS)}function ws(e){return er(e,He.REFRESH_TOKEN_BUFFER_SECONDS)}function As(e){if(!e)return!1;const t=Be(e);if(!t||typeof t.exp!="number")return!1;const r=t.exp*1e3;return Date.now()<r}function Cs({account:e,isActive:t,isLoading:r,onSwitch:n,onRemove:o,onRefresh:i}){const{email:c,name:l,avatar:f}=Me(e.user),[u,y]=_.useState(!1),[d,g]=_.useState(!1),v=async b=>{b.stopPropagation(),y(!0);try{await o()}finally{y(!1)}},h=async b=>{b.stopPropagation(),g(!0);try{await i()}finally{g(!1)}},a=async()=>{r||await n()};return w.jsx(_.Fragment,{children:w.jsxs(I.ListItemButton,{selected:t,onClick:a,disabled:r,sx:{opacity:t?1:.8,backgroundColor:t?"action.selected":"inherit","&:hover":{backgroundColor:t?"action.selected":"action.hover"}},children:[w.jsx(I.ListItemIcon,{children:w.jsx(I.Avatar,{src:f,alt:l,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:"0.875rem"},children:l.charAt(0).toUpperCase()})}),w.jsx(I.ListItemText,{primary:w.jsxs(I.Box,{display:"flex",alignItems:"center",gap:1,children:[w.jsx("span",{children:l}),t&&w.jsx(I.Chip,{label:"Active",size:"small",color:"primary",variant:"outlined",sx:{height:20}}),e.isStale&&!t&&w.jsx(I.Chip,{label:"Stale",size:"small",color:"warning",variant:"filled",sx:{height:20}})]}),secondary:c,secondaryTypographyProps:{noWrap:!0}}),!t&&w.jsxs(I.ListItemSecondaryAction,{children:[e.isStale&&w.jsx(I.IconButton,{edge:"end",size:"small",onClick:h,disabled:d||r,title:"Re-authenticate this account",children:d?w.jsx(I.CircularProgress,{size:20}):w.jsx(Lt.Refresh,{fontSize:"small"})}),w.jsx(I.IconButton,{edge:"end",size:"small",onClick:v,disabled:u||r,title:"Remove this account",children:u?w.jsx(I.CircularProgress,{size:20}):w.jsx(Lt.Close,{fontSize:"small"})})]})]})},e.accountId)}const tr=_.forwardRef(({accounts:e,activeAccountId:t,isLoading:r=!1,onSwitchAccount:n,onAddAccount:o,onRemoveAccount:i,onRefreshAccount:c},l)=>{const[f,u]=_.useState(!1),y=async()=>{u(!0);try{await o()}finally{u(!1)}};return w.jsx(I.Box,{ref:l,sx:{width:"100%",maxWidth:360,bgcolor:"background.paper"},children:e.length===0?w.jsxs(I.Box,{sx:{p:2,textAlign:"center"},children:[w.jsx(I.Typography,{variant:"body2",color:"textSecondary",sx:{mb:2},children:"No additional accounts logged in"}),w.jsx("button",{onClick:y,disabled:f||r,style:{padding:"8px 16px",borderRadius:"4px",border:"1px solid #ccc",background:"#fff",cursor:"pointer"},children:f?"Adding Account...":"Add Account"})]}):w.jsxs(w.Fragment,{children:[w.jsx(I.List,{children:e.map(d=>w.jsx(Cs,{account:d,isActive:d.accountId===t,isLoading:r,onSwitch:()=>n(d.accountId),onRemove:()=>i(d.accountId),onRefresh:()=>c(d.accountId)},d.accountId))}),w.jsx(I.Divider,{sx:{my:1}}),w.jsx(I.Box,{sx:{p:1},children:w.jsxs(I.ListItemButton,{onClick:y,disabled:f||r,sx:{justifyContent:"center",py:1},children:[w.jsx(Lt.Add,{sx:{mr:1},fontSize:"small"}),w.jsx(I.Typography,{variant:"button",sx:{fontSize:"0.875rem"},children:f?"Adding...":"Add Another Account"})]})})]})})});tr.displayName="AccountList";function mn({profile:e,isLoading:t,onSignOut:r,onManageAccount:n,accountManager:o}){const i="https://sprylogin.com/my-account/",[c,l]=_.useState(null),[f,u]=_.useState(!1),y=o?.accounts.length??0,d=m=>{l(m.currentTarget)},g=()=>{l(null),u(!1)},v=()=>{o&&o.activeAccount?o.removeAccount(o.activeAccount.accountId):(g(),r&&r()),g()},h=()=>{g(),n?n():e?.manageAccountUrl?window.location.href=e.manageAccountUrl:window.location.href=i},a=!!c,b=()=>{if(o?.activeAccount){const{name:m,email:p}=Me(o.activeAccount.user);if(m)return m.split(" ").map(E=>E[0]).join("").slice(0,2).toUpperCase();if(p)return p[0].toUpperCase()}return e?.firstName&&e?.lastName?`${e.firstName[0]}${e.lastName[0]}`.toUpperCase():e?.firstName?e.firstName[0].toUpperCase():e?.email?e.email[0].toUpperCase():"?"},x=()=>{if(o?.activeAccount){const{name:m}=Me(o.activeAccount.user);return m}return e?.firstName&&e?.lastName?`${e.firstName} ${e.lastName}`:e?.firstName?e.firstName:e?.email?e.email.split("@")[0]:"User"},T=()=>{if(o?.activeAccount){const{email:m}=Me(o.activeAccount.user);return m}return e?.email||"No email"},C=()=>{if(o?.activeAccount){const{avatar:m}=Me(o.activeAccount.user);return m||null}return e?.avatar||null};return w.jsxs(w.Fragment,{children:[w.jsx(I.IconButton,{onClick:d,sx:{p:.5,"&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},disabled:t&&!e,children:t&&!e?w.jsx(I.CircularProgress,{size:32}):w.jsx(I.Avatar,{src:C()||void 0,sx:{width:32,height:32,bgcolor:"#1a73e8",fontSize:"0.875rem",fontWeight:500},children:b()})}),w.jsx(I.Menu,{anchorEl:c,open:a,onClose:g,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:300,mt:.5,overflow:"visible",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",borderRadius:"8px"}}},children:f?w.jsxs(I.Box,{children:[w.jsxs(I.Box,{sx:{px:1.5,py:1.25,display:"flex",alignItems:"center",gap:.75},children:[w.jsx(I.Button,{size:"small",onClick:()=>u(!1),sx:{textTransform:"none",color:"#1a73e8",fontSize:"0.75rem",p:.5,minWidth:"auto"},children:"← Back"}),w.jsx(I.Typography,{variant:"caption",sx:{fontWeight:600,flex:1,fontSize:"0.75rem"},children:"Accounts"})]}),w.jsx(I.Divider,{sx:{my:0}}),w.jsx(I.Box,{sx:{px:.75,py:.75},children:o&&w.jsx(tr,{accounts:o.accounts,activeAccountId:o.activeAccount?.accountId||null,isLoading:!1,onSwitchAccount:o.switchAccount,onAddAccount:o.addNewAccount,onRemoveAccount:o.removeAccount,onRefreshAccount:o.refreshAccountToken})})]}):w.jsxs(I.Box,{children:[w.jsxs(I.Box,{sx:{px:1.5,py:1.5},children:[w.jsxs(I.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",mb:1.25},children:[w.jsx(I.Avatar,{src:C()||void 0,sx:{width:56,height:56,bgcolor:"#1a73e8",fontSize:"1.25rem",fontWeight:500,mb:1},children:b()},o?.activeAccount?.accountId||"profile-avatar"),w.jsx(I.Typography,{sx:{fontWeight:500,color:"text.primary",textAlign:"center",mb:.25,fontSize:"0.9rem"},children:x()}),w.jsx(I.Typography,{sx:{color:"text.secondary",textAlign:"center",wordBreak:"break-all",fontSize:"0.75rem"},children:T()})]}),w.jsx(I.Button,{variant:"outlined",fullWidth:!0,onClick:h,sx:{borderRadius:"20px",textTransform:"none",borderColor:"#dadce0",color:"#3c4043",fontWeight:500,fontSize:"0.8125rem",py:.55,"&:hover":{backgroundColor:"rgba(66, 133, 244, 0.04)",borderColor:"#dadce0"}},children:"Manage your Account"})]}),w.jsx(I.Divider,{sx:{my:0}}),o&&w.jsxs(w.Fragment,{children:[w.jsx(I.MenuItem,{onClick:()=>u(!0),sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:w.jsx(I.Typography,{sx:{color:"#3c4043",width:"100%",fontSize:"0.8125rem"},children:y>0?`Accounts (${y})`:"Accounts"})}),w.jsx(I.Divider,{sx:{my:0}})]}),o?.addNewAccount&&w.jsx(I.Box,{sx:{px:1.5,py:.5}}),w.jsxs(I.MenuItem,{onClick:v,sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[w.jsx(I.ListItemIcon,{sx:{minWidth:32,mr:.5},children:w.jsx(Ss,{sx:{fontSize:"1rem",color:"#5f6368"}})}),w.jsx(I.Typography,{sx:{color:"#3c4043",fontSize:"0.8125rem"},children:"Sign out"})]})]})})]})}const Dt="spry_profile_cache",xs=300*1e3,Ts=300*1e3;function gn(e,t={}){const{refetchInterval:r=xs,cacheTime:n=Ts,getAuthToken:o,headers:i={}}=t,[c,l]=_.useState(null),[f,u]=_.useState(!0),[y,d]=_.useState(null),g=_.useRef(null),v=_.useRef(null),h=_.useCallback(()=>{try{const x=localStorage.getItem(Dt);if(!x)return null;const T=JSON.parse(x);return Date.now()-T.timestamp<n?T.profile:(localStorage.removeItem(Dt),null)}catch(x){return console.error("Error loading profile from cache:",x),null}},[n]),a=_.useCallback(x=>{try{const T={profile:x,timestamp:Date.now()};localStorage.setItem(Dt,JSON.stringify(T))}catch(T){console.error("Error saving profile to cache:",T)}},[]),b=_.useCallback(async()=>{v.current&&v.current.abort(),v.current=new AbortController;try{u(!0),d(null);let x=null;o&&(x=await Promise.resolve(o()));const T={Accept:"application/json",...i};x&&(T.Authorization=`Bearer ${x}`);const C=await fetch(`${e}/api/profile`,{signal:v.current.signal,headers:T});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`);const m=await C.json();l(m),a(m),d(null)}catch(x){if(x instanceof Error&&x.name==="AbortError")return;const T=x instanceof Error?x.message:"Failed to fetch profile";d(T),console.error("Error fetching profile:",x);const C=h();C&&l(C)}finally{u(!1)}},[e,o,i,h,a]);return _.useEffect(()=>{const x=h();return x&&(l(x),u(!1)),b(),r>0&&(g.current=window.setInterval(()=>{b()},r)),()=>{g.current&&window.clearInterval(g.current),v.current&&v.current.abort()}},[e,r,n]),{profile:c,isLoading:f,error:y,refetch:b}}function hn({apiUrl:e,onSignOut:t,onManageAccount:r,accountManager:n,...o}){const{profile:i,isLoading:c,error:l}=gn(e,o);return l&&console.error("Error loading profile:",l),w.jsx(mn,{profile:i,isLoading:c,onSignOut:t,onManageAccount:r,accountManager:n})}const _s=un(w.jsx("path",{d:"M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z"}),"Apps");function Rs({apiUrl:e,profileApiUrl:t,onSignOut:r,getAuthToken:n,profileHeaders:o,showAppsDropdown:i=!0,showProfileMenu:c=!0,appsRefetchInterval:l=300*1e3,appsCacheTime:f=300*1e3,profileRefetchInterval:u=300*1e3,profileCacheTime:y=300*1e3,accountManager:d}){const[g,v]=_.useState(!1),h=_.useRef(null),a=t||e;return w.jsxs(I.Stack,{direction:"row",spacing:1,alignItems:"center",children:[i&&w.jsxs(w.Fragment,{children:[w.jsx(I.IconButton,{ref:h,onClick:()=>v(!g),sx:{color:"#5f6368","&:hover":{bgcolor:"rgba(60, 64, 67, 0.08)"}},"aria-label":"Google apps",children:w.jsx(_s,{})}),w.jsx(or,{apiUrl:e,open:g,onClose:()=>v(!1),buttonRef:h,refetchInterval:l,cacheTime:f})]}),c&&w.jsx(hn,{apiUrl:a,onSignOut:r,refetchInterval:u,cacheTime:y,getAuthToken:n,headers:o,accountManager:d})]})}var rr=_.createContext(void 0);rr.displayName="AuthContext";var Os={isLoading:!0,isAuthenticated:!1},Is=(e,t)=>{switch(t.type){case"INITIALISED":case"USER_LOADED":return{...e,user:t.user,isLoading:!1,isAuthenticated:t.user?!t.user.expired:!1,error:void 0};case"USER_SIGNED_OUT":case"USER_UNLOADED":return{...e,user:void 0,isAuthenticated:!1};case"NAVIGATOR_INIT":return{...e,isLoading:!0,activeNavigator:t.method};case"NAVIGATOR_CLOSE":return{...e,isLoading:!1,activeNavigator:void 0};case"ERROR":{const r=t.error;return r.toString=()=>`${r.name}: ${r.message}`,{...e,isLoading:!1,error:r}}default:{const r=new TypeError(`unknown type ${t.type}`),n={name:r.name,message:r.message,innerError:r,stack:r.stack,source:"unknown"};return n.toString=()=>`${n.name}: ${n.message}`,{...e,isLoading:!1,error:n}}}},$s=(e=window.location)=>{let t=new URLSearchParams(e.search);return!!((t.get("code")||t.get("error"))&&t.get("state")||(t=new URLSearchParams(e.hash.replace("#","?")),(t.get("code")||t.get("error"))&&t.get("state")))},ks=nr("signinCallback","Sign-in failed"),Ps=nr("signoutCallback","Sign-out failed"),Ns=nr("renewSilent","Renew silent failed");function yn(e,t){return{name:Mt(e,"name",()=>"Error"),message:Mt(e,"message",()=>t),stack:Mt(e,"stack",()=>new Error().stack),innerError:e}}function nr(e,t){return r=>({...yn(r,t),source:e})}function Mt(e,t,r){if(e&&typeof e=="object"){const n=e[t];if(typeof n=="string")return n}return r()}var Us=["clearStaleState","querySessionStatus","revokeTokens","startSilentRenew","stopSilentRenew"],Ds=["signinPopup","signinSilent","signinRedirect","signinResourceOwnerCredentials","signoutPopup","signoutRedirect","signoutSilent"],Lr=e=>()=>{throw new Error(`UserManager#${e} was called from an unsupported context. If this is a server-rendered page, defer this call with useEffect() or pass a custom UserManager implementation.`)},Br=typeof window>"u"?null:Ge.UserManager,Ms=e=>{const{children:t,onSigninCallback:r,skipSigninCallback:n,matchSignoutCallback:o,onSignoutCallback:i,onRemoveUser:c,userManager:l=null,...f}=e,[u]=_.useState(()=>l??(Br?new Br(f):{settings:f})),[y,d]=_.useReducer(Is,Os),g=_.useMemo(()=>Object.assign({settings:u.settings,events:u.events},Object.fromEntries(Us.map(b=>{var x,T;return[b,(T=(x=u[b])==null?void 0:x.bind(u))!=null?T:Lr(b)]})),Object.fromEntries(Ds.map(b=>[b,u[b]?async x=>{d({type:"NAVIGATOR_INIT",method:b});try{return await u[b](x)}catch(T){return d({type:"ERROR",error:{...yn(T,`Unknown error while executing ${b}(...).`),source:b,args:x}}),null}finally{d({type:"NAVIGATOR_CLOSE"})}}:Lr(b)]))),[u]),v=_.useRef(!1);_.useEffect(()=>{!u||v.current||(v.current=!0,(async()=>{try{let b=null;$s()&&!n&&(b=await u.signinCallback(),r&&await r(b)),b=b||await u.getUser(),d({type:"INITIALISED",user:b})}catch(b){d({type:"ERROR",error:ks(b)})}try{if(o&&o(u.settings)){const b=await u.signoutCallback();i&&await i(b)}}catch(b){d({type:"ERROR",error:Ps(b)})}})())},[u,n,r,i,o]),_.useEffect(()=>{if(!u)return;const b=m=>{d({type:"USER_LOADED",user:m})};u.events.addUserLoaded(b);const x=()=>{d({type:"USER_UNLOADED"})};u.events.addUserUnloaded(x);const T=()=>{d({type:"USER_SIGNED_OUT"})};u.events.addUserSignedOut(T);const C=m=>{d({type:"ERROR",error:Ns(m)})};return u.events.addSilentRenewError(C),()=>{u.events.removeUserLoaded(b),u.events.removeUserUnloaded(x),u.events.removeUserSignedOut(T),u.events.removeSilentRenewError(C)}},[u]);const h=_.useCallback(async()=>{await u.removeUser(),c&&await c()},[u,c]),a=_.useMemo(()=>({...y,...g,removeUser:h}),[y,g,h]);return _.createElement(rr.Provider,{value:a},t)},Sn=()=>{const e=_.useContext(rr);return e||console.warn("AuthProvider context is undefined, please verify you are calling useAuth() as child of a <AuthProvider> component."),e};const bn=_.createContext(null),js=()=>{typeof window>"u"||window.history.replaceState({},document.title,window.location.pathname)},Ls=e=>{if(typeof window>"u")return!1;const t=e.post_logout_redirect_uri||e.redirect_uri;return t?window.location.href.startsWith(t):!1},Bs=e=>{if(typeof window>"u")return;const t=e.post_logout_redirect_uri||e.redirect_uri||window.location.origin;window.location.href!==t?window.history.replaceState({},document.title,t):window.history.replaceState({},document.title,window.location.pathname)};function Fs({children:e,config:t,onSigninCallback:r,matchSignoutCallback:n,onSignoutCallback:o,onRemoveUser:i,skipSigninCallback:c}){const l=_.useMemo(()=>({...t,post_logout_redirect_uri:t.post_logout_redirect_uri||t.redirect_uri||(typeof window<"u"?window.location.origin:void 0)}),[t]),f=_.useMemo(()=>new Ge.UserManager(l),[l]),u=_.useMemo(()=>({authority:l.authority,client_id:l.client_id,redirect_uri:l.redirect_uri,post_logout_redirect_uri:l.post_logout_redirect_uri}),[l]),y=r||js,d=n||Ls,g=o||(()=>Bs(l));return w.jsx(bn.Provider,{value:{keycloakConfig:u,userManager:f,syncBridgeUrl:dn},children:w.jsx(Ms,{userManager:f,onSigninCallback:y,matchSignoutCallback:d,onSignoutCallback:g,onRemoveUser:i,skipSigninCallback:c,children:e})})}function vn(){const e=_.useContext(bn);if(!e)throw new Error("useSpryAuthContext must be used within SpryAuthProvider");return e}function zs(e){const t=e.profile?.email||e.profile?.sub||"unknown",r=Date.now();return`account_${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_${r}`}function re(){try{const e=localStorage.getItem(de.ACCOUNTS);return e?JSON.parse(e):{accounts:[],activeAccountId:null,lastUpdated:Date.now()}}catch(e){return console.error("Failed to read accounts from localStorage:",e),{accounts:[],activeAccountId:null,lastUpdated:Date.now()}}}function le(){return re().accounts}function Ie(e){try{localStorage.setItem(de.ACCOUNTS,JSON.stringify(e))}catch(t){console.error("Failed to save accounts to localStorage:",t)}}function En(e,t=null){const r=re(),n={accounts:e,activeAccountId:t??r.activeAccountId,lastUpdated:Date.now()};Ie(n)}function De(e){const t=re(),r=zs(e),n=e.profile?.sub,o=e.profile?.email,i=t.accounts.findIndex(f=>n&&f.user.profile?.sub?f.user.profile.sub===n:o&&f.user.profile?.email?f.user.profile.email===o:!1),l={...{accountId:r,lastUsed:Date.now(),isStale:!1,createdAt:Date.now()},user:e};return i>=0?t.accounts[i]=l:t.accounts.push(l),t.lastUpdated=Date.now(),Ie(t),r}function wt(e){const t=re();t.accounts=t.accounts.filter(r=>r.accountId!==e),t.activeAccountId===e&&(t.activeAccountId=null),t.lastUpdated=Date.now(),Ie(t)}function se(e){const t=re();t.activeAccountId=e,t.lastUpdated=Date.now(),Ie(t)}function wn(){const e=re();return e.activeAccountId&&e.accounts.find(t=>t.accountId===e.activeAccountId)||null}function An(){return re().activeAccountId}function Cn(e,t){const r=re(),n=r.accounts.find(o=>o.accountId===e);n&&(n.user=t,n.lastUsed=Date.now(),n.isStale=!1,r.lastUpdated=Date.now(),Ie(r))}function xn(e){const t=re(),r=t.accounts.find(n=>n.accountId===e);r&&(r.isStale=!0,t.lastUpdated=Date.now(),Ie(t))}function Vs(){localStorage.removeItem(de.ACCOUNTS)}function Ws(e){const r=re().accounts.find(n=>n.accountId===e);return r?{accountId:r.accountId,lastUsed:r.lastUsed,isStale:r.isStale,createdAt:r.createdAt}:null}function ot(e){e?localStorage.setItem(de.ADD_ACCOUNT_IN_PROGRESS,"true"):localStorage.removeItem(de.ADD_ACCOUNT_IN_PROGRESS)}function it(){return localStorage.getItem(de.ADD_ACCOUNT_IN_PROGRESS)==="true"}function Tn(e){localStorage.setItem(de.RETURN_URL,e)}function _n(){return localStorage.getItem(de.RETURN_URL)}function Vt(){localStorage.removeItem(de.RETURN_URL)}function Rn(e){localStorage.setItem(de.TEMP_CURRENT_USER,JSON.stringify(e))}function Gs(){try{const e=localStorage.getItem(de.TEMP_CURRENT_USER);return e?JSON.parse(e):null}catch{return null}}function Wt(){localStorage.removeItem(de.TEMP_CURRENT_USER)}async function On(e,t){try{const r=`${t.authority.replace(/\/$/,"")}/soft-logout`,n="openid profile email offline_access",o=t.redirect_uri||window.location.origin,i=`${t.authority.replace(/\/$/,"")}/protocol/openid-connect/auth?client_id=${encodeURIComponent(t.client_id)}&redirect_uri=${encodeURIComponent(o)}&response_type=code&scope=${encodeURIComponent(n)}`;return window.location.href=`${r}?post_logout_redirect_uri=${encodeURIComponent(i)}`,!0}catch(r){return console.error("Failed to clear SSO session:",r),console.warn(me.SSO_CLEAR_FAILED),!1}}async function In(e,t,r){try{const o=le().length===1;if(!await Js(e,t)&&o)return console.warn("Token revocation failed for last account, falling back to redirect logout"),await $n(e,t,r),{success:!0,message:"Redirecting to logout...",remainingAccounts:0};wt(r),At.remove(r);const c=le(),f=c.sort((u,y)=>y.lastUsed-u.lastUsed)[0]||null;return f?(se(f.accountId),{success:!0,message:`Logged out. Switched to ${f.user.profile?.email||f.user.profile?.sub}`,remainingAccounts:c.length}):(se(null),{success:!0,message:"Logged out. No other accounts available.",remainingAccounts:0})}catch(n){return console.error("Error during logout:",n),{success:!1,message:`Logout failed: ${n instanceof Error?n.message:"Unknown error"}`,remainingAccounts:le().length}}}async function Ys(e,t){const r=e.map(n=>$n(n.user,t,n.accountId).catch(o=>{console.warn(`Failed to logout ${n.accountId}:`,o)}));return await Promise.all(r),e.forEach(n=>{wt(n.accountId),At.remove(n.accountId)}),se(null),{success:!0,message:"All accounts logged out.",remainingAccounts:0}}function Ks(e){wt(e);const t=le();if(t.length>0){const n=t.sort((o,i)=>i.lastUsed-o.lastUsed)[0];return se(n.accountId),{success:!0,message:`Account removed locally. Switched to ${n.user.profile?.email||n.user.profile?.sub}`,remainingAccounts:t.length-1}}else return se(null),{success:!0,message:"Account removed. No other accounts available.",remainingAccounts:0}}async function qs(e,t){try{return new Ge.UserManager({authority:e.authority,client_id:e.client_id,redirect_uri:e.redirect_uri||window.location.origin,post_logout_redirect_uri:e.post_logout_redirect_uri||e.redirect_uri||window.location.origin,response_type:"code",scope:"openid profile email offline_access",userStore:new Ge.WebStorageStateStore({prefix:`oidc_${t}`})})}catch(r){throw console.error("Failed to create UserManager:",r),new Error("oidc-client-ts library not found. Ensure it is installed in consuming app.")}}class Hs{pool=new Map;async getOrCreate(t,r){if(!this.pool.has(r)){const o=await qs(t,r);this.pool.set(r,o)}const n=this.pool.get(r);if(!n)throw new Error(`UserManager not found for ${r}`);return n}remove(t){this.pool.delete(t)}clear(){this.pool.clear()}has(t){return this.pool.has(t)}}const At=new Hs;async function Gt(e,t,r){if(!t.refresh_token)return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}): missing refresh token`),null;const n=`${r.authority.replace(/\/$/,"")}/protocol/openid-connect/token`;try{const o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",client_id:r.client_id,refresh_token:t.refresh_token}).toString()});if(!o.ok){const l=await o.text();return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}):`,l),null}const i=await o.json(),c={access_token:i.access_token,refresh_token:i.refresh_token||t.refresh_token,id_token:i.id_token||t.id_token,expires_in:i.expires_in||t.expires_in,profile:t.profile};return Cn(e,c),c}catch(o){return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}):`,o),null}}async function Fr(e,t){try{await(await At.getOrCreate(e,t)).signinRedirect()}catch(r){throw console.error(me.SIGNIN_REDIRECT_FAILED,r),r}}async function Js(e,t){try{if(!e.refresh_token)return console.warn("No refresh token available for revocation"),!1;const r=`${t.authority.replace(/\/$/,"")}/protocol/openid-connect/revoke`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t.client_id,token:e.refresh_token,token_type_hint:"refresh_token"}).toString()});return!n.ok&&n.status!==204?(console.warn(`Token revocation returned ${n.status}`),!1):(console.log("✅ Token revoked successfully"),!0)}catch(r){return console.warn("Failed to revoke token:",r),!1}}async function $n(e,t,r){try{await(await At.getOrCreate(t,r)).signoutRedirect({id_token_hint:e.id_token,post_logout_redirect_uri:t.post_logout_redirect_uri||t.redirect_uri||window.location.origin})}catch(n){console.warn(me.LOGOUT_FAILED,n)}}function kn(e){const{keycloakConfig:t,initialUser:r,onAccountSwitch:n,signinRedirect:o,syncBridge:i}=e,[c,l]=_.useState([]),[f,u]=_.useState(null),y=_.useRef(!1),d=_.useRef(!1),g=_.useRef(!1),v=_.useRef(null),h=_.useCallback(m=>{const p=m.accounts;let E=m.activeAccountId;if(E&&!p.find(k=>k.accountId===E)&&(E=p[0]?.accountId||null),l(p),u(E),E){const k=p.find(N=>N.accountId===E);k&&n(k.user)}},[n]);_.useEffect(()=>{!i||g.current||(g.current=!0,i.getAccountsState().then(m=>{if(!m||!m.accounts.length)return;m.accounts.forEach(E=>{De(E.user)}),m.activeAccountId&&se(m.activeAccountId);const p=re();h(p)}))},[h,i]),_.useEffect(()=>{if(d.current)return;if(it())if(console.log("🔄 Detected redirect callback for add account flow"),r){const p=le(),E=r.profile?.sub,k=r.profile?.email;if(p.some(L=>E&&L.user.profile?.sub?L.user.profile.sub===E:k&&L.user.profile?.email?L.user.profile.email===k:!1)){console.log("⏳ initialUser matches an existing account, waiting for new user...");return}d.current=!0,console.log("✅ Primary auth populated initialUser, processing new account...");const P=De(r);console.log(`✅ Added new account: ${P}`),se(P),ot(!1);const s=_n();Wt(),Vt();const $=re();l($.accounts),u(P),i&&i.setAccountsState($),n(r),console.log("✅ Account switch completed"),s&&s!==window.location.href&&(console.log(`🔄 Navigating back to: ${s}`),window.location.assign(s))}else console.log("⏳ Waiting for primary auth to populate initialUser...")},[r,n]),_.useEffect(()=>{(async()=>{const m=async()=>!(localStorage.getItem("spry_add_account_pending")!=="1"||d.current);let p=0;for(;p<10&&!await m();)await new Promise(E=>setTimeout(E,150)),p++;if(await m())if(localStorage.removeItem("spry_add_account_pending"),console.log("🔄 Soft-logout completed, initiating signinRedirect..."),o)o().catch(E=>{console.error("signinRedirect failed:",E)});else{const E=`temp_add_${Date.now()}`;Fr(t,E).catch(k=>{console.error("signinRedirectForNewAccount failed:",k)})}})()},[t,o]),_.useEffect(()=>{if(!y.current&&!d.current){y.current=!0;try{const m=re();let p=m.accounts,E=m.activeAccountId;if(p.length===0&&r){const k=De(r);p=le(),E=k,se(k)}E&&!p.find(k=>k.accountId===E)&&(E=p[0]?.accountId||null,E&&se(E)),h({accounts:p,activeAccountId:E,lastUpdated:m.lastUpdated}),i&&i.setAccountsState({accounts:p,activeAccountId:E,lastUpdated:m.lastUpdated}),console.log(`📦 Loaded ${p.length} accounts from localStorage`)}catch(m){const p=m instanceof Error?m.message:"Unknown initialization error";console.error("Failed to initialize account manager:",p)}}},[h,r,n,i]),_.useEffect(()=>{if(d.current||!r||re().accounts.length>0||it())return;const p=De(r);se(p);const E=re();h(E),i&&i.setAccountsState(E),console.log("✅ Seeded initial account after auth became available")},[h,r,n,i]),_.useEffect(()=>{if(!r||d.current||it())return;const m=le(),p=r.profile?.sub,E=r.profile?.email;if(m.some(s=>p&&s.user.profile?.sub?s.user.profile.sub===p:E&&s.user.profile?.email?s.user.profile.email===E:!1))return;const N=De(r);se(N);const P=re();h(P),i&&i.setAccountsState(P),console.log("✅ Added account from auth state update")},[h,r,n,i]),_.useEffect(()=>{const m=p=>{if(p.key==="spry_accounts"){console.log("🔄 Detected cross-tab localStorage change, reloading accounts...");const E=re();h(E)}};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}},[h]);const a=_.useCallback(async m=>{try{const E=le().find(N=>N.accountId===m);if(!E){console.error(me.ACCOUNT_NOT_FOUND);return}const k=v.current===m;Et(E.user.access_token)&&(console.warn("Access token expired for account:",m),xn(m)),se(m),u(m),await n(E.user),i&&await i.setAccountsState(re()),console.log(`✅ Switched to account: ${E.user.profile?.email||m}`),k?v.current=null:(v.current=m,setTimeout(async()=>{if(v.current===m){const P=le().find(s=>s.accountId===m);P&&(se(m),u(m),await n(P.user),i&&await i.setAccountsState(re())),v.current=null}},100))}catch(p){const E=p instanceof Error?p.message:"Failed to switch account";console.error(E,p),v.current=null}},[n,i]),b=_.useCallback(async()=>{try{if(console.log("🔄 Starting add new account flow..."),console.log("📦 Saving state flags to localStorage..."),r&&Rn(r),ot(!0),localStorage.setItem("spry_add_account_pending","1"),Tn(window.location.href),console.log("🔄 Clearing SSO session..."),await On(r||null,t),await new Promise(m=>setTimeout(m,1200)),console.log(fn.REDIRECT_IN_PROGRESS),o)await o();else{const m=`temp_add_${Date.now()}`;await Fr(t,m)}}catch(m){const p=m instanceof Error?m.message:"Failed to add new account";console.error(p,m),ot(!1),Vt(),Wt(),localStorage.removeItem("spry_add_account_pending")}},[t,r]),x=_.useCallback(async m=>{try{const E=le().find(P=>P.accountId===m);if(!E){console.error(me.ACCOUNT_NOT_FOUND);return}const k=await In(E.user,t,m);k.success||console.warn("Keycloak logout failed, but account removed locally:",k.message);const N=re();h(N),i&&i.setAccountsState(N)}catch(p){const E=p instanceof Error?p.message:"Failed to remove account";console.error(E,p)}},[t,h,i]),T=_.useCallback(async m=>{try{const E=le().find(P=>P.accountId===m);if(!E){console.error(me.ACCOUNT_NOT_FOUND);return}if(!await Gt(m,E.user,t)){console.error(`No refreshed user returned for ${m}`);return}const N=re();h(N),i&&i.setAccountsState(N)}catch(p){const E=p instanceof Error?p.message:"Failed to refresh token";console.error(E,p)}},[t,h,i]);_.useEffect(()=>{const m=()=>{const p=c.map(k=>({...k,isStale:pn(k)}));p.some((k,N)=>k.isStale!==c[N]?.isStale)&&(En(p),l(p))};c.length>0&&m()},[c]);const C=f&&c.find(m=>m.accountId===f)||null;return{accounts:c,activeAccount:C,switchAccount:a,addNewAccount:b,removeAccount:x,refreshAccountToken:T}}const Xs=2e3,jt=new Map;function Qs(e){if(!e?.bridgeUrl||typeof window>"u"||typeof document>"u")return null;if(jt.has(e.bridgeUrl))return jt.get(e.bridgeUrl)||null;const t=e.bridgeUrl,r=new URL(t).origin,n=e.timeoutMs??Xs;let o=null,i=!1,c=null,l=null;const f=new Map,u=()=>{o||(o=document.createElement("iframe"),o.src=t,o.title="Spry Sync Bridge",o.style.width="0",o.style.height="0",o.style.border="0",o.style.position="absolute",o.style.left="-9999px",o.style.top="-9999px",o.setAttribute("aria-hidden","true"),o.addEventListener("load",()=>{i=!0}),document.body.appendChild(o))},y=()=>(u(),i?Promise.resolve():c||(c=new Promise((T,C)=>{if(!o){c=null,C(new Error("Bridge iframe not available"));return}const m=()=>{if(i=!0,d()){E(),T();return}E(),C(new Error("Bridge iframe did not load the expected origin"))},p=()=>{E(),C(new Error("Bridge iframe failed to load"))},E=()=>{o?.removeEventListener("load",m),o?.removeEventListener("error",p),c=null};o.addEventListener("load",m),o.addEventListener("error",p)}),c)),d=()=>{if(!o||!o.contentWindow)return!1;try{const T=o.contentWindow.location.href;return!T||T==="about:blank"?!1:T.startsWith(t)}catch{return!0}},g=T=>{if(T.origin!==r)return;const C=T.data;if(!C||typeof C!="object")return;const m=C.requestId;if(!m||typeof m!="string")return;const p=f.get(m);if(p){if(f.delete(m),window.clearTimeout(p.timeoutId),C.type==="ERROR"){p.reject(new Error(C.error||"Bridge error"));return}p.resolve(C.payload??null)}},v=(T,C,m)=>m?a(T,C):b().then(()=>a(T,C)),h=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}_${Math.random().toString(16).slice(2)}`,a=(T,C)=>y().then(()=>new Promise((m,p)=>{const E=h(),k=window.setTimeout(()=>{f.delete(E),p(new Error(`Bridge request timed out: ${T}`))},n);f.set(E,{resolve:m,reject:p,timeoutId:k});try{o?.contentWindow?.postMessage({type:T,requestId:E,payload:C},"*")}catch{f.delete(E),window.clearTimeout(k),p(new Error("Bridge postMessage failed"))}})),b=()=>l||(l=v("PING",null,!0).then(()=>{}).catch(T=>{throw l=null,T}),l);window.addEventListener("message",g);const x={getAccountsState:async()=>{try{const T=await v("GET_ACCOUNTS");return!T||!Array.isArray(T.accounts)?null:{accounts:T.accounts,activeAccountId:T.activeAccountId??null,lastUpdated:Number(T.lastUpdated)||0}}catch(T){return console.warn("Sync bridge unavailable for GET_ACCOUNTS:",T),null}},setAccountsState:async T=>{try{await v("SET_ACCOUNTS",{accounts:T.accounts,activeAccountId:T.activeAccountId??null,lastUpdated:T.lastUpdated??Date.now()})}catch(C){console.warn("Sync bridge unavailable for SET_ACCOUNTS:",C)}}};return jt.set(t,x),x}function Zs(e){if(e)return{access_token:e.access_token,refresh_token:e.refresh_token,id_token:e.id_token,expires_in:e.expires_in,profile:e.profile}}function zr(e){const t=Math.floor(Date.now()/1e3),r=e.expires_in?t+e.expires_in:void 0;return new Ge.User({...e,token_type:"Bearer",profile:e.profile||{sub:""},expires_at:r})}function ea(){const e=Sn(),{keycloakConfig:t,userManager:r,syncBridgeUrl:n}=vn(),o=_.useRef(!1),i=_.useMemo(()=>Qs(n?{bridgeUrl:n}:null),[n]),c=kn({keycloakConfig:t,initialUser:Zs(e.user),signinRedirect:e.signinRedirect,syncBridge:i,onAccountSwitch:async f=>{let u=f;const y=le(),d=f.profile?.sub,g=f.profile?.email,v=y.find(a=>d&&a.user.profile?.sub?a.user.profile.sub===d:g&&a.user.profile?.email?a.user.profile.email===g:!1);if(v&&f.refresh_token){const a=await Gt(v.accountId,f,t);a&&(u=a)}const h=zr(u);await r.storeUser(h),await r.events.load(h),window.dispatchEvent(new CustomEvent("auth:account-switched",{detail:{user:u}}))}});_.useEffect(()=>{if(o.current||e.isAuthenticated||e.isLoading||e.activeNavigator)return;const f=wn();if(!f)return;o.current=!0,(async()=>{let y=f.user;if(y.refresh_token){const g=await Gt(f.accountId,y,t);g&&(y=g)}const d=zr(y);await r.storeUser(d),await r.events.load(d)})().catch(y=>{console.log("Restore from stored account failed:",y)})},[c.accounts.length,e,t,r]);const l=_.useCallback(async f=>{await c.removeAccount(f),An()||await r.removeUser()},[c,r]);return _.useMemo(()=>({...c,removeAccount:l}),[c,l])}function ta(){return Sn()}function or({apiUrl:e,open:t,onClose:r,buttonRef:n,refetchInterval:o,cacheTime:i}){const{apps:c,isLoading:l,error:f,refetch:u}=Wr(e,{refetchInterval:o,cacheTime:i});return w.jsx(Vr,{apps:c,open:t,onClose:r,buttonRef:n,isLoading:l,error:f,onRetry:u})}exports.AccountList=tr;exports.AppsDropdown=Vr;exports.AppsDropdownConnected=or;exports.ERROR_MESSAGES=me;exports.INFO_MESSAGES=fn;exports.ProfileMenu=mn;exports.ProfileMenuConnected=hn;exports.STORAGE_KEYS=de;exports.SYNC_BRIDGE_URL=dn;exports.SpryAuthProvider=Fs;exports.TOKEN_VALIDATION=He;exports.TopBar=Rs;exports.addAccount=De;exports.clearAllAccounts=Vs;exports.clearReturnUrl=Vt;exports.clearSSOSessionBeforeAddAccount=On;exports.clearTempCurrentUser=Wt;exports.decodeToken=Be;exports.default=or;exports.extractUserInfo=Me;exports.getAccountMetadata=Ws;exports.getAccounts=le;exports.getAccountsState=re;exports.getActiveAccount=wn;exports.getActiveAccountId=An;exports.getReturnUrl=_n;exports.getTempCurrentUser=Gs;exports.getTokenExpiryTime=bs;exports.getTokenTimeRemaining=vs;exports.isAccessTokenValid=As;exports.isAccountStale=pn;exports.isAddAccountInProgress=it;exports.isRefreshTokenExpired=er;exports.isTokenExpired=Et;exports.logoutAccount=In;exports.logoutAccountLocally=Ks;exports.logoutAllAccounts=Ys;exports.markAccountStale=xn;exports.removeAccount=wt;exports.saveAccounts=En;exports.saveAccountsState=Ie;exports.saveTempCurrentUser=Rn;exports.setActiveAccount=se;exports.setAddAccountInProgress=ot;exports.setReturnUrl=Tn;exports.shouldRefreshAccessToken=Es;exports.shouldRefreshRefreshToken=ws;exports.updateAccountTokens=Cn;exports.useAccountManager=kn;exports.useAppsData=Wr;exports.useProfileData=gn;exports.useSpryAccountManager=ea;exports.useSpryAuth=ta;exports.useSpryAuthContext=vn;
|
|
32
|
+
export default theme;`}function zt(e={},...t){const{breakpoints:r,mixins:n={},spacing:o,palette:i={},transitions:s={},typography:u={},shape:f,...l}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.":xe(20));const g=Jt(i),p=Kr(e);let d=ue(p,{mixins:Oi(p.breakpoints,n),palette:g,shadows:Ni.slice(),typography:Ii(g,u),transitions:Mi(s),zIndex:{...Li}});if(d=ue(d,l),d=t.reduce((S,y)=>ue(S,y),d),process.env.NODE_ENV!=="production"){const S=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],y=(c,E)=>{let w;for(w in c){const C=c[w];if(S.includes(w)&&Object.keys(C).length>0){if(process.env.NODE_ENV!=="production"){const h=Wt("",w);console.error([`MUI: The \`${E}\` component increases the CSS specificity of the \`${w}\` internal state.`,"You can not override it like this: ",JSON.stringify(c,null,2),"",`Instead, you need to use the '&.${h}' syntax:`,JSON.stringify({root:{[`&.${h}`]:C}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
33
|
+
`))}c[w]={}}}};Object.keys(d.components).forEach(c=>{const E=d.components[c].styleOverrides;E&&c.startsWith("Mui")&&y(E,c)})}return d.unstable_sxConfig={...yt,...l?.unstable_sxConfig},d.unstable_sx=function(y){return je({sx:y,theme:this})},d.toRuntimeSource=en,d}function Fi(e){let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}const zi=[...Array(25)].map((e,t)=>{if(t===0)return"none";const r=Fi(t);return`linear-gradient(rgba(255 255 255 / ${r}), rgba(255 255 255 / ${r}))`});function tn(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function rn(e){return e==="dark"?zi:[]}function Vi(e){const{palette:t={mode:"light"},opacity:r,overlays:n,...o}=e,i=Jt(t);return{palette:i,opacity:{...tn(i.mode),...r},overlays:n||rn(i.mode),...o}}function Wi(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}const Yi=e=>[...[...Array(25)].map((t,r)=>`--${e?`${e}-`:""}overlays-${r}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],Gi=e=>(t,r)=>{const n=e.rootSelector||":root",o=e.colorSchemeSelector;let i=o;if(o==="class"&&(i=".%s"),o==="data"&&(i="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(i=`[${o}="%s"]`),e.defaultColorScheme===t){if(t==="dark"){const s={};return Yi(e.cssVarPrefix).forEach(u=>{s[u]=r[u],delete r[u]}),i==="media"?{[n]:r,"@media (prefers-color-scheme: dark)":{[n]:s}}:i?{[i.replace("%s",t)]:s,[`${n}, ${i.replace("%s",t)}`]:r}:{[n]:{...r,...s}}}if(i&&i!=="media")return`${n}, ${i.replace("%s",String(t))}`}else if(t){if(i==="media")return{[`@media (prefers-color-scheme: ${String(t)})`]:{[n]:r}};if(i)return i.replace("%s",String(t))}return n};function Ki(e,t){t.forEach(r=>{e[r]||(e[r]={})})}function v(e,t,r){!e[t]&&r&&(e[t]=r)}function Fe(e){return typeof e!="string"||!e.startsWith("hsl")?e:Xr(e)}function be(e,t){`${t}Channel`in e||(e[`${t}Channel`]=Be(Fe(e[t]),`MUI: Can't create \`palette.${t}Channel\` because \`palette.${t}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
|
|
34
|
+
To suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function qi(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const ye=e=>{try{return e()}catch{}},Hi=(e="mui")=>mi(e);function Nt(e,t,r,n){if(!t)return;t=t===!0?{}:t;const o=n==="dark"?"dark":"light";if(!r){e[n]=Vi({...t,palette:{mode:o,...t?.palette}});return}const{palette:i,...s}=zt({...r,palette:{mode:o,...t?.palette}});return e[n]={...t,palette:i,opacity:{...tn(o),...t?.opacity},overlays:t?.overlays||rn(o)},s}function Ji(e={},...t){const{colorSchemes:r={light:!0},defaultColorScheme:n,disableCssColorScheme:o=!1,cssVarPrefix:i="mui",shouldSkipGeneratingVar:s=Wi,colorSchemeSelector:u=r.light&&r.dark?"media":void 0,rootSelector:f=":root",...l}=e,g=Object.keys(r)[0],p=n||(r.light&&g!=="light"?"light":g),d=Hi(i),{[p]:S,light:y,dark:c,...E}=r,w={...E};let C=S;if((p==="dark"&&!("dark"in r)||p==="light"&&!("light"in r))&&(C=!0),!C)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${p}\` option is either missing or invalid.`:xe(21,p));const h=Nt(w,C,l,p);y&&!w.light&&Nt(w,y,void 0,"light"),c&&!w.dark&&Nt(w,c,void 0,"dark");let b={defaultColorScheme:p,...h,cssVarPrefix:i,colorSchemeSelector:u,rootSelector:f,getCssVar:d,colorSchemes:w,font:{..._i(h.typography),...h.font},spacing:qi(l.spacing)};Object.keys(b.colorSchemes).forEach(P=>{const a=b.colorSchemes[P].palette,k=Y=>{const W=Y.split("-"),se=W[1],oe=W[2];return d(Y,a[se][oe])};if(a.mode==="light"&&(v(a.common,"background","#fff"),v(a.common,"onBackground","#000")),a.mode==="dark"&&(v(a.common,"background","#000"),v(a.common,"onBackground","#fff")),Ki(a,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),a.mode==="light"){v(a.Alert,"errorColor",X(a.error.light,.6)),v(a.Alert,"infoColor",X(a.info.light,.6)),v(a.Alert,"successColor",X(a.success.light,.6)),v(a.Alert,"warningColor",X(a.warning.light,.6)),v(a.Alert,"errorFilledBg",k("palette-error-main")),v(a.Alert,"infoFilledBg",k("palette-info-main")),v(a.Alert,"successFilledBg",k("palette-success-main")),v(a.Alert,"warningFilledBg",k("palette-warning-main")),v(a.Alert,"errorFilledColor",ye(()=>a.getContrastText(a.error.main))),v(a.Alert,"infoFilledColor",ye(()=>a.getContrastText(a.info.main))),v(a.Alert,"successFilledColor",ye(()=>a.getContrastText(a.success.main))),v(a.Alert,"warningFilledColor",ye(()=>a.getContrastText(a.warning.main))),v(a.Alert,"errorStandardBg",Q(a.error.light,.9)),v(a.Alert,"infoStandardBg",Q(a.info.light,.9)),v(a.Alert,"successStandardBg",Q(a.success.light,.9)),v(a.Alert,"warningStandardBg",Q(a.warning.light,.9)),v(a.Alert,"errorIconColor",k("palette-error-main")),v(a.Alert,"infoIconColor",k("palette-info-main")),v(a.Alert,"successIconColor",k("palette-success-main")),v(a.Alert,"warningIconColor",k("palette-warning-main")),v(a.AppBar,"defaultBg",k("palette-grey-100")),v(a.Avatar,"defaultBg",k("palette-grey-400")),v(a.Button,"inheritContainedBg",k("palette-grey-300")),v(a.Button,"inheritContainedHoverBg",k("palette-grey-A100")),v(a.Chip,"defaultBorder",k("palette-grey-400")),v(a.Chip,"defaultAvatarColor",k("palette-grey-700")),v(a.Chip,"defaultIconColor",k("palette-grey-700")),v(a.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),v(a.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),v(a.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),v(a.LinearProgress,"primaryBg",Q(a.primary.main,.62)),v(a.LinearProgress,"secondaryBg",Q(a.secondary.main,.62)),v(a.LinearProgress,"errorBg",Q(a.error.main,.62)),v(a.LinearProgress,"infoBg",Q(a.info.main,.62)),v(a.LinearProgress,"successBg",Q(a.success.main,.62)),v(a.LinearProgress,"warningBg",Q(a.warning.main,.62)),v(a.Skeleton,"bg",`rgba(${k("palette-text-primaryChannel")} / 0.11)`),v(a.Slider,"primaryTrack",Q(a.primary.main,.62)),v(a.Slider,"secondaryTrack",Q(a.secondary.main,.62)),v(a.Slider,"errorTrack",Q(a.error.main,.62)),v(a.Slider,"infoTrack",Q(a.info.main,.62)),v(a.Slider,"successTrack",Q(a.success.main,.62)),v(a.Slider,"warningTrack",Q(a.warning.main,.62));const Y=tt(a.background.default,.8);v(a.SnackbarContent,"bg",Y),v(a.SnackbarContent,"color",ye(()=>a.getContrastText(Y))),v(a.SpeedDialAction,"fabHoverBg",tt(a.background.paper,.15)),v(a.StepConnector,"border",k("palette-grey-400")),v(a.StepContent,"border",k("palette-grey-400")),v(a.Switch,"defaultColor",k("palette-common-white")),v(a.Switch,"defaultDisabledColor",k("palette-grey-100")),v(a.Switch,"primaryDisabledColor",Q(a.primary.main,.62)),v(a.Switch,"secondaryDisabledColor",Q(a.secondary.main,.62)),v(a.Switch,"errorDisabledColor",Q(a.error.main,.62)),v(a.Switch,"infoDisabledColor",Q(a.info.main,.62)),v(a.Switch,"successDisabledColor",Q(a.success.main,.62)),v(a.Switch,"warningDisabledColor",Q(a.warning.main,.62)),v(a.TableCell,"border",Q(et(a.divider,1),.88)),v(a.Tooltip,"bg",et(a.grey[700],.92))}if(a.mode==="dark"){v(a.Alert,"errorColor",Q(a.error.light,.6)),v(a.Alert,"infoColor",Q(a.info.light,.6)),v(a.Alert,"successColor",Q(a.success.light,.6)),v(a.Alert,"warningColor",Q(a.warning.light,.6)),v(a.Alert,"errorFilledBg",k("palette-error-dark")),v(a.Alert,"infoFilledBg",k("palette-info-dark")),v(a.Alert,"successFilledBg",k("palette-success-dark")),v(a.Alert,"warningFilledBg",k("palette-warning-dark")),v(a.Alert,"errorFilledColor",ye(()=>a.getContrastText(a.error.dark))),v(a.Alert,"infoFilledColor",ye(()=>a.getContrastText(a.info.dark))),v(a.Alert,"successFilledColor",ye(()=>a.getContrastText(a.success.dark))),v(a.Alert,"warningFilledColor",ye(()=>a.getContrastText(a.warning.dark))),v(a.Alert,"errorStandardBg",X(a.error.light,.9)),v(a.Alert,"infoStandardBg",X(a.info.light,.9)),v(a.Alert,"successStandardBg",X(a.success.light,.9)),v(a.Alert,"warningStandardBg",X(a.warning.light,.9)),v(a.Alert,"errorIconColor",k("palette-error-main")),v(a.Alert,"infoIconColor",k("palette-info-main")),v(a.Alert,"successIconColor",k("palette-success-main")),v(a.Alert,"warningIconColor",k("palette-warning-main")),v(a.AppBar,"defaultBg",k("palette-grey-900")),v(a.AppBar,"darkBg",k("palette-background-paper")),v(a.AppBar,"darkColor",k("palette-text-primary")),v(a.Avatar,"defaultBg",k("palette-grey-600")),v(a.Button,"inheritContainedBg",k("palette-grey-800")),v(a.Button,"inheritContainedHoverBg",k("palette-grey-700")),v(a.Chip,"defaultBorder",k("palette-grey-700")),v(a.Chip,"defaultAvatarColor",k("palette-grey-300")),v(a.Chip,"defaultIconColor",k("palette-grey-300")),v(a.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),v(a.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),v(a.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),v(a.LinearProgress,"primaryBg",X(a.primary.main,.5)),v(a.LinearProgress,"secondaryBg",X(a.secondary.main,.5)),v(a.LinearProgress,"errorBg",X(a.error.main,.5)),v(a.LinearProgress,"infoBg",X(a.info.main,.5)),v(a.LinearProgress,"successBg",X(a.success.main,.5)),v(a.LinearProgress,"warningBg",X(a.warning.main,.5)),v(a.Skeleton,"bg",`rgba(${k("palette-text-primaryChannel")} / 0.13)`),v(a.Slider,"primaryTrack",X(a.primary.main,.5)),v(a.Slider,"secondaryTrack",X(a.secondary.main,.5)),v(a.Slider,"errorTrack",X(a.error.main,.5)),v(a.Slider,"infoTrack",X(a.info.main,.5)),v(a.Slider,"successTrack",X(a.success.main,.5)),v(a.Slider,"warningTrack",X(a.warning.main,.5));const Y=tt(a.background.default,.98);v(a.SnackbarContent,"bg",Y),v(a.SnackbarContent,"color",ye(()=>a.getContrastText(Y))),v(a.SpeedDialAction,"fabHoverBg",tt(a.background.paper,.15)),v(a.StepConnector,"border",k("palette-grey-600")),v(a.StepContent,"border",k("palette-grey-600")),v(a.Switch,"defaultColor",k("palette-grey-300")),v(a.Switch,"defaultDisabledColor",k("palette-grey-600")),v(a.Switch,"primaryDisabledColor",X(a.primary.main,.55)),v(a.Switch,"secondaryDisabledColor",X(a.secondary.main,.55)),v(a.Switch,"errorDisabledColor",X(a.error.main,.55)),v(a.Switch,"infoDisabledColor",X(a.info.main,.55)),v(a.Switch,"successDisabledColor",X(a.success.main,.55)),v(a.Switch,"warningDisabledColor",X(a.warning.main,.55)),v(a.TableCell,"border",X(et(a.divider,1),.68)),v(a.Tooltip,"bg",et(a.grey[700],.92))}be(a.background,"default"),be(a.background,"paper"),be(a.common,"background"),be(a.common,"onBackground"),be(a,"divider"),Object.keys(a).forEach(Y=>{const W=a[Y];Y!=="tonalOffset"&&W&&typeof W=="object"&&(W.main&&v(a[Y],"mainChannel",Be(Fe(W.main))),W.light&&v(a[Y],"lightChannel",Be(Fe(W.light))),W.dark&&v(a[Y],"darkChannel",Be(Fe(W.dark))),W.contrastText&&v(a[Y],"contrastTextChannel",Be(Fe(W.contrastText))),Y==="text"&&(be(a[Y],"primary"),be(a[Y],"secondary")),Y==="action"&&(W.active&&be(a[Y],"active"),W.selected&&be(a[Y],"selected")))})}),b=t.reduce((P,a)=>ue(P,a),b);const m={prefix:i,disableCssColorScheme:o,shouldSkipGeneratingVar:s,getSelector:Gi(b)},{vars:I,generateThemeVars:$,generateStyleSheets:M}=yi(b,m);return b.vars=I,Object.entries(b.colorSchemes[b.defaultColorScheme]).forEach(([P,a])=>{b[P]=a}),b.generateThemeVars=$,b.generateStyleSheets=M,b.generateSpacing=function(){return Gr(l.spacing,Yt(this))},b.getColorSchemeSelector=bi(u),b.spacing=b.generateSpacing(),b.shouldSkipGeneratingVar=s,b.unstable_sxConfig={...yt,...l?.unstable_sxConfig},b.unstable_sx=function(a){return je({sx:a,theme:this})},b.toRuntimeSource=en,b}function Nr(e,t,r){e.colorSchemes&&r&&(e.colorSchemes[t]={...r!==!0&&r,palette:Jt({...r===!0?{}:r.palette,mode:t})})}function Xi(e={},...t){const{palette:r,cssVariables:n=!1,colorSchemes:o=r?void 0:{light:!0},defaultColorScheme:i=r?.mode,...s}=e,u=i||"light",f=o?.[u],l={...o,...r?{[u]:{...typeof f!="boolean"&&f,palette:r}}:void 0};if(n===!1){if(!("colorSchemes"in e))return zt(e,...t);let g=r;"palette"in e||l[u]&&(l[u]!==!0?g=l[u].palette:u==="dark"&&(g={mode:"dark"}));const p=zt({...e,palette:g},...t);return p.defaultColorScheme=u,p.colorSchemes=l,p.palette.mode==="light"&&(p.colorSchemes.light={...l.light!==!0&&l.light,palette:p.palette},Nr(p,"dark",l.dark)),p.palette.mode==="dark"&&(p.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:p.palette},Nr(p,"light",l.light)),p}return!r&&!("light"in l)&&u==="light"&&(l.light=!0),Ji({...s,colorSchemes:l,defaultColorScheme:u,...typeof n!="boolean"&&n},...t)}const Qi=Xi(),Zi="$$material";function es(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const ts=e=>es(e)&&e!=="classes",rs=ti({themeId:Zi,defaultTheme:Qi,rootShouldForwardProp:ts}),ns=pi;process.env.NODE_ENV!=="production"&&(V.node,V.object.isRequired);function os(e){return di(e)}function is(e){return Wt("MuiSvgIcon",e)}Wn("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const ss=e=>{const{color:t,fontSize:r,classes:n}=e,o={root:["root",t!=="inherit"&&`color${Ie(t)}`,`fontSize${Ie(r)}`]};return Bn(o,is,n)},as=rs("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.color!=="inherit"&&t[`color${Ie(r.color)}`],t[`fontSize${Ie(r.fontSize)}`]]}})(ns(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),at=we.forwardRef(function(t,r){const n=os({props:t,name:"MuiSvgIcon"}),{children:o,className:i,color:s="inherit",component:u="svg",fontSize:f="medium",htmlColor:l,inheritViewBox:g=!1,titleAccess:p,viewBox:d="0 0 24 24",...S}=n,y=we.isValidElement(o)&&o.type==="svg",c={...n,color:s,component:u,fontSize:f,instanceFontSize:t.fontSize,inheritViewBox:g,viewBox:d,hasSvgAsChild:y},E={};g||(E.viewBox=d);const w=ss(c);return x.jsxs(as,{as:u,className:Gn(w.root,i),focusable:"false",color:l,"aria-hidden":p?void 0:!0,role:p?"img":void 0,ref:r,...E,...S,...y&&o.props,ownerState:c,children:[y?o.props.children:o,p?x.jsx("title",{children:p}):null]})});process.env.NODE_ENV!=="production"&&(at.propTypes={children:V.node,classes:V.object,className:V.string,color:V.oneOfType([V.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),V.string]),component:V.elementType,fontSize:V.oneOfType([V.oneOf(["inherit","large","medium","small"]),V.string]),htmlColor:V.string,inheritViewBox:V.bool,shapeRendering:V.string,sx:V.oneOfType([V.arrayOf(V.oneOfType([V.func,V.object,V.bool])),V.func,V.object]),titleAccess:V.string,viewBox:V.string});at.muiName="SvgIcon";function nn(e,t){function r(n,o){return x.jsx(at,{"data-testid":`${t}Icon`,ref:o,...n,children:e})}return process.env.NODE_ENV!=="production"&&(r.displayName=`${t}Icon`),r.muiName=at.muiName,we.memo(we.forwardRef(r))}const cs=nn(x.jsx("path",{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z"}),"Logout"),vt={ACCOUNTS:"spry_accounts",BRIDGE_ACCOUNTS:"spry_accounts_shared_state"},qe={ACCESS_TOKEN_BUFFER_SECONDS:60,REFRESH_TOKEN_BUFFER_SECONDS:300,STALE_CHECK_INTERVAL_MS:1e3},me={INVALID_TOKEN:"Invalid or malformed token",TOKEN_DECODE_FAILED:"Failed to decode token",ACCOUNT_NOT_FOUND:"Account not found",SIGNIN_REDIRECT_FAILED:"Failed to initiate sign-in redirect",LOGOUT_FAILED:"Failed to logout from Keycloak, but account will be removed locally.",TOKEN_REFRESH_FAILED:"Failed to refresh token for account"},us={LOCALSTORAGE_XSS_WARNING:"⚠️ Tokens stored in localStorage are vulnerable to XSS. Ensure CSP headers are configured.",ACCOUNT_MARKED_STALE:"Account refresh token expired. Click to re-authenticate.",NO_ACCOUNTS:"No additional accounts stored. Your primary auth remains active.",REDIRECT_IN_PROGRESS:"Redirecting to Keycloak for authentication..."},on="https://sprylogin.com/apps-api/sync-bridge.html";function Me(e){try{const t=e.split(".");if(t.length!==3)return console.warn(me.INVALID_TOKEN),null;const r=t[1];return JSON.parse(decodeURIComponent(atob(r).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(t){return console.warn(me.TOKEN_DECODE_FAILED,t),null}}function St(e,t=qe.ACCESS_TOKEN_BUFFER_SECONDS){if(!e)return!0;const r=Me(e);if(!r||typeof r.exp!="number")return!0;const n=r.exp*1e3,o=Date.now(),i=t*1e3;return o>=n-i}function Xt(e,t=qe.REFRESH_TOKEN_BUFFER_SECONDS){if(!e)return!0;const r=Me(e);if(!r||typeof r.exp!="number")return!0;const n=r.exp*1e3,o=Date.now(),i=t*1e3;return o>=n-i}function ls(e){if(!e)return null;const t=Me(e);return!t||typeof t.exp!="number"?null:t.exp*1e3}function fs(e){if(!e)return-1;const t=Me(e);if(!t||typeof t.exp!="number")return-1;const r=t.exp*1e3,n=Date.now(),o=r-n;return Math.max(0,o/1e3)}function _e(e){const t=e.profile||{},r=t.email||"unknown@example.com",n=t.given_name,o=t.name||n||r.split("@")[0],i=t.picture;return{email:r,name:o,avatar:i}}function sn(e){return!!(e.isStale||Xt(e.user.refresh_token)||!e.user.refresh_token&&St(e.user.access_token))}function ds(e){return St(e,qe.ACCESS_TOKEN_BUFFER_SECONDS)}function ps(e){return Xt(e,qe.REFRESH_TOKEN_BUFFER_SECONDS)}function ms(e){if(!e)return!1;const t=Me(e);if(!t||typeof t.exp!="number")return!1;const r=t.exp*1e3;return Date.now()<r}function an({profile:e,isLoading:t,onSignOut:r,onManageAccount:n,accountManager:o}){const i="https://sprylogin.com/my-account/",[s,u]=T.useState(null),f=w=>{u(w.currentTarget)},l=()=>{u(null)},g=async()=>{l(),o&&o.activeAccount?await o.removeAccount(o.activeAccount.accountId):r&&r()},p=()=>{l(),n?n():e?.manageAccountUrl?window.location.href=e.manageAccountUrl:window.location.href=i},d=!!s,S=()=>{if(o?.activeAccount){const{name:w,email:C}=_e(o.activeAccount.user);if(w)return w.split(" ").map(h=>h[0]).join("").slice(0,2).toUpperCase();if(C)return C[0].toUpperCase()}return e?.firstName&&e?.lastName?`${e.firstName[0]}${e.lastName[0]}`.toUpperCase():e?.firstName?e.firstName[0].toUpperCase():e?.email?e.email[0].toUpperCase():"?"},y=()=>{if(o?.activeAccount){const{name:w}=_e(o.activeAccount.user);return w}return e?.firstName&&e?.lastName?`${e.firstName} ${e.lastName}`:e?.firstName?e.firstName:e?.email?e.email.split("@")[0]:"User"},c=()=>{if(o?.activeAccount){const{email:w}=_e(o.activeAccount.user);return w}return e?.email||"No email"},E=()=>{if(o?.activeAccount){const{avatar:w}=_e(o.activeAccount.user);return w||null}return e?.avatar||null};return x.jsxs(x.Fragment,{children:[x.jsx(R.IconButton,{onClick:f,sx:{p:.5,"&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},disabled:t&&!e,children:t&&!e?x.jsx(R.CircularProgress,{size:32}):x.jsx(R.Avatar,{src:E()||void 0,sx:{width:32,height:32,bgcolor:"#1a73e8",fontSize:"0.875rem",fontWeight:500},children:S()})}),x.jsx(R.Menu,{anchorEl:s,open:d,onClose:l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:300,mt:.5,overflow:"visible",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",borderRadius:"8px"}}},children:x.jsxs(R.Box,{children:[x.jsxs(R.Box,{sx:{px:1.5,py:1.5},children:[x.jsxs(R.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",mb:1.25},children:[x.jsx(R.Avatar,{src:E()||void 0,sx:{width:56,height:56,bgcolor:"#1a73e8",fontSize:"1.25rem",fontWeight:500,mb:1},children:S()},o?.activeAccount?.accountId||"profile-avatar"),x.jsx(R.Typography,{sx:{fontWeight:500,color:"text.primary",textAlign:"center",mb:.25,fontSize:"0.9rem"},children:y()}),x.jsx(R.Typography,{sx:{color:"text.secondary",textAlign:"center",wordBreak:"break-all",fontSize:"0.75rem"},children:c()})]}),x.jsx(R.Button,{variant:"outlined",fullWidth:!0,onClick:p,sx:{borderRadius:"20px",textTransform:"none",borderColor:"#dadce0",color:"#3c4043",fontWeight:500,fontSize:"0.8125rem",py:.55,"&:hover":{backgroundColor:"rgba(66, 133, 244, 0.04)",borderColor:"#dadce0"}},children:"Manage your Account"})]}),x.jsx(R.Divider,{sx:{my:0}}),o&&o.accounts.length>1&&x.jsxs(x.Fragment,{children:[x.jsx(R.Box,{sx:{px:.75,py:.5},children:o.accounts.filter(w=>w.accountId!==o.activeAccount?.accountId).map(w=>{const{email:C,name:h,avatar:b}=_e(w.user);return x.jsxs(R.MenuItem,{onClick:()=>{o.switchAccount(w.accountId),l()},sx:{borderRadius:1,px:1,py:.75,mb:.25,"&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[x.jsx(R.Avatar,{src:b,sx:{width:32,height:32,mr:1.5,bgcolor:"#1a73e8",fontSize:"0.875rem"},children:h.charAt(0).toUpperCase()}),x.jsxs(R.Box,{sx:{flex:1,minWidth:0},children:[x.jsx(R.Typography,{sx:{fontSize:"0.875rem",fontWeight:500,color:"text.primary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h}),x.jsx(R.Typography,{sx:{fontSize:"0.75rem",color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C})]})]},w.accountId)})}),x.jsx(R.Divider,{sx:{my:0}})]}),o&&x.jsxs(x.Fragment,{children:[x.jsxs(R.MenuItem,{onClick:()=>{o.addNewAccount(),l()},sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[x.jsx(R.ListItemIcon,{sx:{minWidth:32,mr:.5},children:x.jsx(R.Avatar,{sx:{width:24,height:24,bgcolor:"transparent",border:"1.5px solid #5f6368",color:"#5f6368",fontSize:"0.875rem"},children:"+"})}),x.jsx(R.Typography,{sx:{color:"#3c4043",fontSize:"0.8125rem"},children:"Add another account"})]}),x.jsx(R.Divider,{sx:{my:0}})]}),x.jsxs(R.MenuItem,{onClick:g,sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[x.jsx(R.ListItemIcon,{sx:{minWidth:32,mr:.5},children:x.jsx(cs,{sx:{fontSize:"1rem",color:"#5f6368"}})}),x.jsx(R.Typography,{sx:{color:"#3c4043",fontSize:"0.8125rem"},children:"Sign out"})]})]})})]})}const Ut="spry_profile_cache",hs=300*1e3,gs=300*1e3;function cn(e,t={}){const{refetchInterval:r=hs,cacheTime:n=gs,getAuthToken:o,headers:i={}}=t,[s,u]=T.useState(null),[f,l]=T.useState(!0),[g,p]=T.useState(null),d=T.useRef(null),S=T.useRef(null),y=T.useCallback(()=>{try{const w=localStorage.getItem(Ut);if(!w)return null;const C=JSON.parse(w);return Date.now()-C.timestamp<n?C.profile:(localStorage.removeItem(Ut),null)}catch(w){return console.error("Error loading profile from cache:",w),null}},[n]),c=T.useCallback(w=>{try{const C={profile:w,timestamp:Date.now()};localStorage.setItem(Ut,JSON.stringify(C))}catch(C){console.error("Error saving profile to cache:",C)}},[]),E=T.useCallback(async()=>{S.current&&S.current.abort(),S.current=new AbortController;try{l(!0),p(null);let w=null;o&&(w=await Promise.resolve(o()));const C={Accept:"application/json",...i};w&&(C.Authorization=`Bearer ${w}`);const h=await fetch(`${e}/api/profile`,{signal:S.current.signal,headers:C});if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const b=await h.json();u(b),c(b),p(null)}catch(w){if(w instanceof Error&&w.name==="AbortError")return;const C=w instanceof Error?w.message:"Failed to fetch profile";p(C),console.error("Error fetching profile:",w);const h=y();h&&u(h)}finally{l(!1)}},[e,o,i,y,c]);return T.useEffect(()=>{const w=y();return w&&(u(w),l(!1)),E(),r>0&&(d.current=window.setInterval(()=>{E()},r)),()=>{d.current&&window.clearInterval(d.current),S.current&&S.current.abort()}},[e,r,n]),{profile:s,isLoading:f,error:g,refetch:E}}function un({apiUrl:e,onSignOut:t,onManageAccount:r,accountManager:n,...o}){const{profile:i,isLoading:s,error:u}=cn(e,o);return u&&console.error("Error loading profile:",u),x.jsx(an,{profile:i,isLoading:s,onSignOut:t,onManageAccount:r,accountManager:n})}const ys=nn(x.jsx("path",{d:"M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z"}),"Apps");function bs({apiUrl:e,profileApiUrl:t,onSignOut:r,getAuthToken:n,profileHeaders:o,showAppsDropdown:i=!0,showProfileMenu:s=!0,appsRefetchInterval:u=300*1e3,appsCacheTime:f=300*1e3,profileRefetchInterval:l=300*1e3,profileCacheTime:g=300*1e3,accountManager:p}){const[d,S]=T.useState(!1),y=T.useRef(null),c=t||e;return x.jsxs(R.Stack,{direction:"row",spacing:1,alignItems:"center",children:[i&&x.jsxs(x.Fragment,{children:[x.jsx(R.IconButton,{ref:y,onClick:()=>S(!d),sx:{color:"#5f6368","&:hover":{bgcolor:"rgba(60, 64, 67, 0.08)"}},"aria-label":"Google apps",children:x.jsx(ys,{})}),x.jsx(er,{apiUrl:e,open:d,onClose:()=>S(!1),buttonRef:y,refetchInterval:u,cacheTime:f})]}),s&&x.jsx(un,{apiUrl:c,onSignOut:r,refetchInterval:l,cacheTime:g,getAuthToken:n,headers:o,accountManager:p})]})}var Qt=T.createContext(void 0);Qt.displayName="AuthContext";var vs={isLoading:!0,isAuthenticated:!1},Ss=(e,t)=>{switch(t.type){case"INITIALISED":case"USER_LOADED":return{...e,user:t.user,isLoading:!1,isAuthenticated:t.user?!t.user.expired:!1,error:void 0};case"USER_SIGNED_OUT":case"USER_UNLOADED":return{...e,user:void 0,isAuthenticated:!1};case"NAVIGATOR_INIT":return{...e,isLoading:!0,activeNavigator:t.method};case"NAVIGATOR_CLOSE":return{...e,isLoading:!1,activeNavigator:void 0};case"ERROR":{const r=t.error;return r.toString=()=>`${r.name}: ${r.message}`,{...e,isLoading:!1,error:r}}default:{const r=new TypeError(`unknown type ${t.type}`),n={name:r.name,message:r.message,innerError:r,stack:r.stack,source:"unknown"};return n.toString=()=>`${n.name}: ${n.message}`,{...e,isLoading:!1,error:n}}}},Es=(e=window.location)=>{let t=new URLSearchParams(e.search);return!!((t.get("code")||t.get("error"))&&t.get("state")||(t=new URLSearchParams(e.hash.replace("#","?")),(t.get("code")||t.get("error"))&&t.get("state")))},ws=Zt("signinCallback","Sign-in failed"),xs=Zt("signoutCallback","Sign-out failed"),As=Zt("renewSilent","Renew silent failed");function ln(e,t){return{name:Dt(e,"name",()=>"Error"),message:Dt(e,"message",()=>t),stack:Dt(e,"stack",()=>new Error().stack),innerError:e}}function Zt(e,t){return r=>({...ln(r,t),source:e})}function Dt(e,t,r){if(e&&typeof e=="object"){const n=e[t];if(typeof n=="string")return n}return r()}var Cs=["clearStaleState","querySessionStatus","revokeTokens","startSilentRenew","stopSilentRenew"],Ts=["signinPopup","signinSilent","signinRedirect","signinResourceOwnerCredentials","signoutPopup","signoutRedirect","signoutSilent"],Ur=e=>()=>{throw new Error(`UserManager#${e} was called from an unsupported context. If this is a server-rendered page, defer this call with useEffect() or pass a custom UserManager implementation.`)},Dr=typeof window>"u"?null:We.UserManager,_s=e=>{const{children:t,onSigninCallback:r,skipSigninCallback:n,matchSignoutCallback:o,onSignoutCallback:i,onRemoveUser:s,userManager:u=null,...f}=e,[l]=T.useState(()=>u??(Dr?new Dr(f):{settings:f})),[g,p]=T.useReducer(Ss,vs),d=T.useMemo(()=>Object.assign({settings:l.settings,events:l.events},Object.fromEntries(Cs.map(E=>{var w,C;return[E,(C=(w=l[E])==null?void 0:w.bind(l))!=null?C:Ur(E)]})),Object.fromEntries(Ts.map(E=>[E,l[E]?async w=>{p({type:"NAVIGATOR_INIT",method:E});try{return await l[E](w)}catch(C){return p({type:"ERROR",error:{...ln(C,`Unknown error while executing ${E}(...).`),source:E,args:w}}),null}finally{p({type:"NAVIGATOR_CLOSE"})}}:Ur(E)]))),[l]),S=T.useRef(!1);T.useEffect(()=>{!l||S.current||(S.current=!0,(async()=>{try{let E=null;Es()&&!n&&(E=await l.signinCallback(),r&&await r(E)),E=E||await l.getUser(),p({type:"INITIALISED",user:E})}catch(E){p({type:"ERROR",error:ws(E)})}try{if(o&&o(l.settings)){const E=await l.signoutCallback();i&&await i(E)}}catch(E){p({type:"ERROR",error:xs(E)})}})())},[l,n,r,i,o]),T.useEffect(()=>{if(!l)return;const E=b=>{p({type:"USER_LOADED",user:b})};l.events.addUserLoaded(E);const w=()=>{p({type:"USER_UNLOADED"})};l.events.addUserUnloaded(w);const C=()=>{p({type:"USER_SIGNED_OUT"})};l.events.addUserSignedOut(C);const h=b=>{p({type:"ERROR",error:As(b)})};return l.events.addSilentRenewError(h),()=>{l.events.removeUserLoaded(E),l.events.removeUserUnloaded(w),l.events.removeUserSignedOut(C),l.events.removeSilentRenewError(h)}},[l]);const y=T.useCallback(async()=>{await l.removeUser(),s&&await s()},[l,s]),c=T.useMemo(()=>({...g,...d,removeUser:y}),[g,d,y]);return T.createElement(Qt.Provider,{value:c},t)},fn=()=>{const e=T.useContext(Qt);return e||console.warn("AuthProvider context is undefined, please verify you are calling useAuth() as child of a <AuthProvider> component."),e};const dn=T.createContext(null),Os=()=>{typeof window>"u"||window.history.replaceState({},document.title,window.location.pathname)},Rs=e=>{if(typeof window>"u")return!1;const t=e.post_logout_redirect_uri||e.redirect_uri;return t?window.location.href.startsWith(t):!1},Is=e=>{if(typeof window>"u")return;const t=e.post_logout_redirect_uri||e.redirect_uri||window.location.origin;window.location.href!==t?window.history.replaceState({},document.title,t):window.history.replaceState({},document.title,window.location.pathname)};function ks({children:e,config:t,onSigninCallback:r,matchSignoutCallback:n,onSignoutCallback:o,onRemoveUser:i,skipSigninCallback:s}){const u=T.useMemo(()=>({...t,post_logout_redirect_uri:t.post_logout_redirect_uri||t.redirect_uri||(typeof window<"u"?window.location.origin:void 0)}),[t]),f=T.useMemo(()=>new We.UserManager(u),[u]),l=T.useMemo(()=>({authority:u.authority,client_id:u.client_id,redirect_uri:u.redirect_uri,post_logout_redirect_uri:u.post_logout_redirect_uri}),[u]),g=r||Os,p=n||Rs,d=o||(()=>Is(u));return x.jsx(dn.Provider,{value:{keycloakConfig:l,userManager:f,syncBridgeUrl:on},children:x.jsx(_s,{userManager:f,onSigninCallback:g,matchSignoutCallback:p,onSignoutCallback:d,onRemoveUser:i,skipSigninCallback:s,children:e})})}function pn(){const e=T.useContext(dn);if(!e)throw new Error("useSpryAuthContext must be used within SpryAuthProvider");return e}function $s(e){const t=e.profile?.email||e.profile?.sub||"unknown",r=Date.now();return`account_${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_${r}`}function re(){try{const e=localStorage.getItem(vt.ACCOUNTS);return e?JSON.parse(e):{accounts:[],activeAccountId:null,lastUpdated:Date.now()}}catch(e){return console.error("Failed to read accounts from localStorage:",e),{accounts:[],activeAccountId:null,lastUpdated:Date.now()}}}function de(){return re().accounts}function Ce(e){try{localStorage.setItem(vt.ACCOUNTS,JSON.stringify(e))}catch(t){console.error("Failed to save accounts to localStorage:",t)}}function mn(e,t=null){const r=re(),n={accounts:e,activeAccountId:t??r.activeAccountId,lastUpdated:Date.now()};Ce(n)}function ze(e){const t=re(),r=e.profile?.sub,n=e.profile?.email,o=t.accounts.findIndex(s=>r&&s.user.profile?.sub?s.user.profile.sub===r:n&&s.user.profile?.email?s.user.profile.email===n:!1);if(o>=0){const s=t.accounts[o];return t.accounts[o]={...s,user:e,lastUsed:Date.now(),isStale:!1},t.lastUpdated=Date.now(),Ce(t),s.accountId}const i=$s(e);return t.accounts.push({accountId:i,user:e,lastUsed:Date.now(),isStale:!1,createdAt:Date.now()}),t.lastUpdated=Date.now(),Ce(t),i}function Et(e){const t=re(),r=t.accounts.find(n=>n.accountId===e);if(r){const n=r.user.profile?.sub,o=r.user.profile?.email;t.accounts=t.accounts.filter(i=>!(i.accountId===e||n&&i.user.profile?.sub===n||o&&i.user.profile?.email===o))}else t.accounts=t.accounts.filter(n=>n.accountId!==e);t.activeAccountId===e&&(t.activeAccountId=null),t.activeAccountId&&!t.accounts.find(n=>n.accountId===t.activeAccountId)&&(t.activeAccountId=null),t.lastUpdated=Date.now(),Ce(t)}function fe(e){const t=re();t.activeAccountId=e,t.lastUpdated=Date.now(),Ce(t)}function hn(){const e=re();return e.activeAccountId&&e.accounts.find(t=>t.accountId===e.activeAccountId)||null}function gn(){return re().activeAccountId}function yn(e,t){const r=re(),n=r.accounts.find(o=>o.accountId===e);n&&(n.user=t,n.lastUsed=Date.now(),n.isStale=!1,r.lastUpdated=Date.now(),Ce(r))}function bn(e){const t=re(),r=t.accounts.find(n=>n.accountId===e);r&&(r.isStale=!0,t.lastUpdated=Date.now(),Ce(t))}function Ps(){localStorage.removeItem(vt.ACCOUNTS)}function Ns(e){const r=re().accounts.find(n=>n.accountId===e);return r?{accountId:r.accountId,lastUsed:r.lastUsed,isStale:r.isStale,createdAt:r.createdAt}:null}async function vn(e,t,r){try{const o=de().length===1;if(!await Bs(e,t)&&o)return console.warn("Token revocation failed for last account, falling back to redirect logout"),await Sn(e,t,r),{success:!0,message:"Redirecting to logout...",remainingAccounts:0};Et(r),wt.remove(r);const s=de(),f=s.sort((l,g)=>g.lastUsed-l.lastUsed)[0]||null;return f?(fe(f.accountId),{success:!0,message:`Logged out. Switched to ${f.user.profile?.email||f.user.profile?.sub}`,remainingAccounts:s.length}):(fe(null),{success:!0,message:"Logged out. No other accounts available.",remainingAccounts:0})}catch(n){return console.error("Error during logout:",n),{success:!1,message:`Logout failed: ${n instanceof Error?n.message:"Unknown error"}`,remainingAccounts:de().length}}}async function Us(e,t){const r=e.map(n=>Sn(n.user,t,n.accountId).catch(o=>{console.warn(`Failed to logout ${n.accountId}:`,o)}));return await Promise.all(r),e.forEach(n=>{Et(n.accountId),wt.remove(n.accountId)}),fe(null),{success:!0,message:"All accounts logged out.",remainingAccounts:0}}function Ds(e){Et(e);const t=de();if(t.length>0){const n=t.sort((o,i)=>i.lastUsed-o.lastUsed)[0];return fe(n.accountId),{success:!0,message:`Account removed locally. Switched to ${n.user.profile?.email||n.user.profile?.sub}`,remainingAccounts:t.length-1}}else return fe(null),{success:!0,message:"Account removed. No other accounts available.",remainingAccounts:0}}async function js(e,t){try{return new We.UserManager({authority:e.authority,client_id:e.client_id,redirect_uri:e.redirect_uri||window.location.origin,post_logout_redirect_uri:e.post_logout_redirect_uri||e.redirect_uri||window.location.origin,response_type:"code",scope:"openid profile email offline_access",userStore:new We.WebStorageStateStore({prefix:`oidc_${t}`})})}catch(r){throw console.error("Failed to create UserManager:",r),new Error("oidc-client-ts library not found. Ensure it is installed in consuming app.")}}class Ms{pool=new Map;async getOrCreate(t,r){if(!this.pool.has(r)){const o=await js(t,r);this.pool.set(r,o)}const n=this.pool.get(r);if(!n)throw new Error(`UserManager not found for ${r}`);return n}remove(t){this.pool.delete(t)}clear(){this.pool.clear()}has(t){return this.pool.has(t)}}const wt=new Ms;async function nt(e,t,r){if(!t.refresh_token)return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}): missing refresh token`),null;const n=`${r.authority.replace(/\/$/,"")}/protocol/openid-connect/token`;try{const o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",client_id:r.client_id,refresh_token:t.refresh_token}).toString()});if(!o.ok){const u=await o.text();return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}):`,u),null}const i=await o.json(),s={access_token:i.access_token,refresh_token:i.refresh_token||t.refresh_token,id_token:i.id_token||t.id_token,expires_in:i.expires_in||t.expires_in,profile:t.profile};return yn(e,s),s}catch(o){return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}):`,o),null}}async function Ls(e,t){try{await(await wt.getOrCreate(e,t)).signinRedirect({prompt:"select_account"})}catch(r){throw console.error(me.SIGNIN_REDIRECT_FAILED,r),r}}async function Bs(e,t){try{if(!e.refresh_token)return console.warn("No refresh token available for revocation"),!1;const r=`${t.authority.replace(/\/$/,"")}/protocol/openid-connect/revoke`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t.client_id,token:e.refresh_token,token_type_hint:"refresh_token"}).toString()});return!n.ok&&n.status!==204?(console.warn(`Token revocation returned ${n.status}`),!1):(console.log("✅ Token revoked successfully"),!0)}catch(r){return console.warn("Failed to revoke token:",r),!1}}async function Sn(e,t,r){try{await(await wt.getOrCreate(t,r)).signoutRedirect({id_token_hint:e.id_token,post_logout_redirect_uri:t.post_logout_redirect_uri||t.redirect_uri||window.location.origin})}catch(n){console.warn(me.LOGOUT_FAILED,n)}}function En(e){const{keycloakConfig:t,initialUser:r,onAccountSwitch:n,signinRedirect:o,syncBridge:i}=e,[s,u]=T.useState([]),[f,l]=T.useState(null),g=T.useRef(!1),p=T.useRef(!1),d=T.useRef(new Set),S=T.useCallback(h=>{const b=h.accounts;let m=h.activeAccountId;m&&!b.find($=>$.accountId===m)&&(m=b[0]?.accountId||null);const I=f!==m;if(u(b),l(m),I&&m){const $=b.find(M=>M.accountId===m);$&&n($.user)}},[n,f]);T.useEffect(()=>{localStorage.removeItem("spry_add_account_in_progress"),localStorage.removeItem("spry_add_account_pending"),localStorage.removeItem("spry_temp_current_user"),localStorage.removeItem("spry_return_url")},[]),T.useEffect(()=>{!i||p.current||(p.current=!0,i.getAccountsState().then(h=>{if(!h||!h.accounts.length)return;const b=re();if(h.lastUpdated&&b.lastUpdated&&h.lastUpdated<=b.lastUpdated){i.setAccountsState(b);return}h.accounts.forEach(I=>{ze(I.user)}),h.activeAccountId&&fe(h.activeAccountId);const m=re();S(m)}))},[S,i]),T.useEffect(()=>{if(!g.current){g.current=!0;try{const h=re();let b=h.accounts,m=h.activeAccountId;if(b.length===0&&r){const I=r.profile?.sub,$=r.profile?.email;if(!(I&&d.current.has(I)||$&&d.current.has($))){const P=ze(r);b=de(),m=P,fe(P)}}m&&!b.find(I=>I.accountId===m)&&(m=b[0]?.accountId||null,m&&fe(m)),S({accounts:b,activeAccountId:m,lastUpdated:h.lastUpdated}),i&&i.setAccountsState({accounts:b,activeAccountId:m,lastUpdated:h.lastUpdated})}catch(h){const b=h instanceof Error?h.message:"Unknown initialization error";console.error("Failed to initialize account manager:",b)}}},[S,r,n,i,t.authority]),T.useEffect(()=>{if(!r)return;const h=r.profile?.sub,b=r.profile?.email;if(h&&d.current.has(h)||b&&d.current.has(b)||re().accounts.length>0)return;const I=ze(r);fe(I);const $=re();S($),i&&i.setAccountsState($)},[S,r,n,i,t.authority]),T.useEffect(()=>{if(!r)return;const h=r.profile?.sub,b=r.profile?.email;if(h&&d.current.has(h)){d.current.delete(h);return}if(b&&d.current.has(b)){d.current.delete(b);return}if(de().some(P=>h&&P.user.profile?.sub?P.user.profile.sub===h:b&&P.user.profile?.email?P.user.profile.email===b:!1))return;const $=ze(r);fe($);const M=re();S(M),i&&i.setAccountsState(M)},[S,r,n,i,t.authority]),T.useEffect(()=>{const h=b=>{if(b.key==="spry_accounts"){const m=re();S(m)}};return window.addEventListener("storage",h),()=>{window.removeEventListener("storage",h)}},[S]);const y=T.useCallback(async h=>{try{const m=de().find(I=>I.accountId===h);if(!m){console.error(me.ACCOUNT_NOT_FOUND);return}St(m.user.access_token)&&(console.warn("Access token expired for account:",h),bn(h)),fe(h),l(h),await n(m.user),i&&await i.setAccountsState(re())}catch(b){const m=b instanceof Error?b.message:"Failed to switch account";console.error(m,b)}},[n,i]),c=T.useCallback(async()=>{try{if(o)await o({prompt:"select_account"});else{const h=`temp_add_${Date.now()}`;await Ls(t,h)}}catch(h){const b=h instanceof Error?h.message:"Failed to add new account";console.error(b,h)}},[t,o]),E=T.useCallback(async h=>{try{const m=de().find(a=>a.accountId===h);if(!m){console.error(me.ACCOUNT_NOT_FOUND);return}const I=m.user.profile?.sub,$=m.user.profile?.email;I&&d.current.add(I),$&&d.current.add($);const M=await vn(m.user,t,h);M.success||console.warn("Keycloak logout failed, but account removed locally:",M.message);const P=re();u(P.accounts),l(P.activeAccountId),i&&await i.setAccountsState(P)}catch(b){const m=b instanceof Error?b.message:"Failed to remove account";console.error(m,b)}},[t,i]),w=T.useCallback(async h=>{try{const m=de().find(M=>M.accountId===h);if(!m){console.error(me.ACCOUNT_NOT_FOUND);return}if(!await nt(h,m.user,t)){console.error(`No refreshed user returned for ${h}`);return}const $=re();S($),i&&i.setAccountsState($)}catch(b){const m=b instanceof Error?b.message:"Failed to refresh token";console.error(m,b)}},[t,S,i]);T.useEffect(()=>{const h=()=>{const b=s.map(I=>({...I,isStale:sn(I)}));b.some((I,$)=>I.isStale!==s[$]?.isStale)&&(mn(b),u(b))};s.length>0&&h()},[s]);const C=f&&s.find(h=>h.accountId===f)||null;return{accounts:s,activeAccount:C,switchAccount:y,addNewAccount:c,removeAccount:E,refreshAccountToken:w}}const Fs=2e3,jt=new Map;function zs(e){if(!e?.bridgeUrl||typeof window>"u"||typeof document>"u")return null;if(jt.has(e.bridgeUrl))return jt.get(e.bridgeUrl)||null;const t=e.bridgeUrl,r=new URL(t).origin,n=e.timeoutMs??Fs;let o=null,i=!1,s=null,u=null;const f=new Map,l=()=>{o||(o=document.createElement("iframe"),o.src=t,o.title="Spry Sync Bridge",o.style.width="0",o.style.height="0",o.style.border="0",o.style.position="absolute",o.style.left="-9999px",o.style.top="-9999px",o.setAttribute("aria-hidden","true"),o.addEventListener("load",()=>{i=!0}),document.body.appendChild(o))},g=()=>(l(),i?Promise.resolve():s||(s=new Promise((C,h)=>{if(!o){s=null,h(new Error("Bridge iframe not available"));return}const b=()=>{if(i=!0,p()){I(),C();return}I(),h(new Error("Bridge iframe did not load the expected origin"))},m=()=>{I(),h(new Error("Bridge iframe failed to load"))},I=()=>{o?.removeEventListener("load",b),o?.removeEventListener("error",m),s=null};o.addEventListener("load",b),o.addEventListener("error",m)}),s)),p=()=>{if(!o||!o.contentWindow)return!1;try{const C=o.contentWindow.location.href;return!C||C==="about:blank"?!1:C.startsWith(t)}catch{return!0}},d=C=>{if(C.origin!==r)return;const h=C.data;if(!h||typeof h!="object")return;const b=h.requestId;if(!b||typeof b!="string")return;const m=f.get(b);if(m){if(f.delete(b),window.clearTimeout(m.timeoutId),h.type==="ERROR"){m.reject(new Error(h.error||"Bridge error"));return}m.resolve(h.payload??null)}},S=(C,h,b)=>b?c(C,h):E().then(()=>c(C,h)),y=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}_${Math.random().toString(16).slice(2)}`,c=(C,h)=>g().then(()=>new Promise((b,m)=>{const I=y(),$=window.setTimeout(()=>{f.delete(I),m(new Error(`Bridge request timed out: ${C}`))},n);f.set(I,{resolve:b,reject:m,timeoutId:$});try{o?.contentWindow?.postMessage({type:C,requestId:I,payload:h},"*")}catch{f.delete(I),window.clearTimeout($),m(new Error("Bridge postMessage failed"))}})),E=()=>u||(u=S("PING",null,!0).then(()=>{}).catch(C=>{throw u=null,C}),u);window.addEventListener("message",d);const w={getAccountsState:async()=>{try{const C=await S("GET_ACCOUNTS");return!C||!Array.isArray(C.accounts)?null:{accounts:C.accounts,activeAccountId:C.activeAccountId??null,lastUpdated:Number(C.lastUpdated)||0}}catch(C){return console.warn("Sync bridge unavailable for GET_ACCOUNTS:",C),null}},setAccountsState:async C=>{try{await S("SET_ACCOUNTS",{accounts:C.accounts,activeAccountId:C.activeAccountId??null,lastUpdated:C.lastUpdated??Date.now()})}catch(h){console.warn("Sync bridge unavailable for SET_ACCOUNTS:",h)}}};return jt.set(t,w),w}function Vs(e){if(e)return{access_token:e.access_token,refresh_token:e.refresh_token,id_token:e.id_token,expires_in:e.expires_in,profile:e.profile}}function Mt(e){const t=Math.floor(Date.now()/1e3),r=e.expires_in?t+e.expires_in:void 0;return new We.User({...e,token_type:"Bearer",profile:e.profile||{sub:""},expires_at:r})}function Ws(){const e=fn(),{keycloakConfig:t,userManager:r,syncBridgeUrl:n}=pn(),o=T.useRef(!1),i=T.useMemo(()=>zs(n?{bridgeUrl:n}:null),[n]),s=En({keycloakConfig:t,initialUser:Vs(e.user),signinRedirect:e.signinRedirect,syncBridge:i,onAccountSwitch:async f=>{let l=f;const g=de(),p=f.profile?.sub,d=f.profile?.email,S=g.find(c=>p&&c.user.profile?.sub?c.user.profile.sub===p:d&&c.user.profile?.email?c.user.profile.email===d:!1);if(S&&f.refresh_token){const c=await nt(S.accountId,f,t);c&&(l=c)}const y=Mt(l);await r.storeUser(y),await r.events.load(y),window.dispatchEvent(new CustomEvent("auth:account-switched",{detail:{user:l}}))}});T.useEffect(()=>{if(o.current||e.isLoading||e.activeNavigator)return;const f=hn();if(!f)return;const l=e.user?.profile?.sub,g=f.user.profile?.sub;if(l&&g&&l===g){o.current=!0;return}o.current=!0,(async()=>{let d=f.user;if(d.refresh_token){const y=await nt(f.accountId,d,t);y&&(d=y)}const S=Mt(d);await r.storeUser(S),await r.events.load(S)})().catch(d=>{console.log("Restore from stored account failed:",d)})},[s.accounts.length,e,t,r]);const u=T.useCallback(async f=>{await s.removeAccount(f);const l=gn();if(l){const p=de().find(d=>d.accountId===l);if(p){let d=p.user;if(d.refresh_token){const y=await nt(l,d,t);y&&(d=y)}const S=Mt(d);await r.storeUser(S),await r.events.load(S),window.dispatchEvent(new CustomEvent("auth:account-switched",{detail:{user:d}}))}}else await r.removeUser()},[s,r,t]);return T.useMemo(()=>({...s,removeAccount:u}),[s,u])}function Ys(){return fn()}function Gs({account:e,isActive:t,isLoading:r,onSwitch:n,onRemove:o,onRefresh:i}){const{email:s,name:u,avatar:f}=_e(e.user),[l,g]=T.useState(!1),[p,d]=T.useState(!1),S=async E=>{E.stopPropagation(),g(!0);try{await o()}finally{g(!1)}},y=async E=>{E.stopPropagation(),d(!0);try{await i()}finally{d(!1)}},c=async()=>{r||await n()};return x.jsx(T.Fragment,{children:x.jsxs(R.ListItemButton,{selected:t,onClick:c,disabled:r,sx:{opacity:t?1:.8,backgroundColor:t?"action.selected":"inherit","&:hover":{backgroundColor:t?"action.selected":"action.hover"}},children:[x.jsx(R.ListItemIcon,{children:x.jsx(R.Avatar,{src:f,alt:u,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:"0.875rem"},children:u.charAt(0).toUpperCase()})}),x.jsx(R.ListItemText,{primary:x.jsxs(R.Box,{display:"flex",alignItems:"center",gap:1,children:[x.jsx("span",{children:u}),t&&x.jsx(R.Chip,{label:"Active",size:"small",color:"primary",variant:"outlined",sx:{height:20}}),e.isStale&&!t&&x.jsx(R.Chip,{label:"Stale",size:"small",color:"warning",variant:"filled",sx:{height:20}})]}),secondary:s,secondaryTypographyProps:{noWrap:!0}}),!t&&x.jsxs(R.ListItemSecondaryAction,{children:[e.isStale&&x.jsx(R.IconButton,{edge:"end",size:"small",onClick:y,disabled:p||r,title:"Re-authenticate this account",children:p?x.jsx(R.CircularProgress,{size:20}):x.jsx(Lt.Refresh,{fontSize:"small"})}),x.jsx(R.IconButton,{edge:"end",size:"small",onClick:S,disabled:l||r,title:"Remove this account",children:l?x.jsx(R.CircularProgress,{size:20}):x.jsx(Lt.Close,{fontSize:"small"})})]})]})},e.accountId)}const wn=T.forwardRef(({accounts:e,activeAccountId:t,isLoading:r=!1,onSwitchAccount:n,onAddAccount:o,onRemoveAccount:i,onRefreshAccount:s},u)=>{const[f,l]=T.useState(!1),g=async()=>{l(!0);try{await o()}finally{l(!1)}};return x.jsx(R.Box,{ref:u,sx:{width:"100%",maxWidth:360,bgcolor:"background.paper"},children:e.length===0?x.jsxs(R.Box,{sx:{p:2,textAlign:"center"},children:[x.jsx(R.Typography,{variant:"body2",color:"textSecondary",sx:{mb:2},children:"No additional accounts logged in"}),x.jsx("button",{onClick:g,disabled:f||r,style:{padding:"8px 16px",borderRadius:"4px",border:"1px solid #ccc",background:"#fff",cursor:"pointer"},children:f?"Adding Account...":"Add Account"})]}):x.jsxs(x.Fragment,{children:[x.jsx(R.List,{children:e.map(p=>x.jsx(Gs,{account:p,isActive:p.accountId===t,isLoading:r,onSwitch:()=>n(p.accountId),onRemove:()=>i(p.accountId),onRefresh:()=>s(p.accountId)},p.accountId))}),x.jsx(R.Divider,{sx:{my:1}}),x.jsx(R.Box,{sx:{p:1},children:x.jsxs(R.ListItemButton,{onClick:g,disabled:f||r,sx:{justifyContent:"center",py:1},children:[x.jsx(Lt.Add,{sx:{mr:1},fontSize:"small"}),x.jsx(R.Typography,{variant:"button",sx:{fontSize:"0.875rem"},children:f?"Adding...":"Add Another Account"})]})})]})})});wn.displayName="AccountList";function er({apiUrl:e,open:t,onClose:r,buttonRef:n,refetchInterval:o,cacheTime:i}){const{apps:s,isLoading:u,error:f,refetch:l}=Mr(e,{refetchInterval:o,cacheTime:i});return x.jsx(jr,{apps:s,open:t,onClose:r,buttonRef:n,isLoading:u,error:f,onRetry:l})}exports.AccountList=wn;exports.AppsDropdown=jr;exports.AppsDropdownConnected=er;exports.ERROR_MESSAGES=me;exports.INFO_MESSAGES=us;exports.ProfileMenu=an;exports.ProfileMenuConnected=un;exports.STORAGE_KEYS=vt;exports.SYNC_BRIDGE_URL=on;exports.SpryAuthProvider=ks;exports.TOKEN_VALIDATION=qe;exports.TopBar=bs;exports.addAccount=ze;exports.clearAllAccounts=Ps;exports.decodeToken=Me;exports.default=er;exports.extractUserInfo=_e;exports.getAccountMetadata=Ns;exports.getAccounts=de;exports.getAccountsState=re;exports.getActiveAccount=hn;exports.getActiveAccountId=gn;exports.getTokenExpiryTime=ls;exports.getTokenTimeRemaining=fs;exports.isAccessTokenValid=ms;exports.isAccountStale=sn;exports.isRefreshTokenExpired=Xt;exports.isTokenExpired=St;exports.logoutAccount=vn;exports.logoutAccountLocally=Ds;exports.logoutAllAccounts=Us;exports.markAccountStale=bn;exports.removeAccount=Et;exports.saveAccounts=mn;exports.saveAccountsState=Ce;exports.setActiveAccount=fe;exports.shouldRefreshAccessToken=ds;exports.shouldRefreshRefreshToken=ps;exports.updateAccountTokens=yn;exports.useAccountManager=En;exports.useAppsData=Mr;exports.useProfileData=cn;exports.useSpryAccountManager=Ws;exports.useSpryAuth=Ys;exports.useSpryAuthContext=pn;
|
|
35
35
|
//# sourceMappingURL=index.cjs.map
|