spry-apps-dropdown 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1938 -1854
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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(
|
|
3
|
-
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:Ce(18,`(${t})`));return null}const[,n,o]=r,i=Number.isNaN(+n)?n||0:+n;return e.containerQueries(o).up(i)}function io(e){const t=(i,c)=>i.replace("@media",c?`@container ${c}`:"@container");function r(i,c){i.up=(...l)=>t(e.breakpoints.up(...l),c),i.down=(...l)=>t(e.breakpoints.down(...l),c),i.between=(...l)=>t(e.breakpoints.between(...l),c),i.only=(...l)=>t(e.breakpoints.only(...l),c),i.not=(...l)=>{const f=t(e.breakpoints.not(...l),c);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
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("react/jsx-runtime"),_=require("react"),I=require("@mui/material"),sr=require("framer-motion"),Pn=require("@emotion/styled");require("@emotion/react");const Ye=require("oidc-client-ts"),Ft=require("@mui/icons-material");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 zr({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 m=window.location.origin;return e.find(a=>a.url.startsWith(m))?.id},p=e.filter(m=>{if(l&&m.id===l)return!1;const a=d();return!(a&&m.id===a)});_.useLayoutEffect(()=>{if(t&&n?.current){const m=n.current.getBoundingClientRect();y(`${m.bottom+8}px`)}},[t,n]),_.useEffect(()=>{const m=a=>{f.current&&!f.current.contains(a.target)&&n?.current&&!n.current.contains(a.target)&&r()};return t&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[t,r,n]);const v=m=>{window.open(m,"_blank"),r()};return E.jsx(sr.AnimatePresence,{children:t&&E.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:E.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:m=>m.stopPropagation(),children:[o&&p.length===0&&E.jsx(I.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px"},children:E.jsx(I.CircularProgress,{size:32})}),i&&p.length===0&&E.jsxs(I.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100px",gap:1},children:[E.jsx(I.Typography,{sx:{fontSize:"0.875rem",color:"#ea4335",textAlign:"center"},children:"Failed to load apps"}),c&&E.jsx(I.Link,{component:"button",onClick:c,sx:{fontSize:"0.875rem",color:"#1a73e8",cursor:"pointer",textDecoration:"underline"},children:"Retry"})]}),p.length>0&&E.jsx(I.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:1},children:p.map(m=>E.jsxs(I.Link,{onClick:()=>v(m.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:m.description,children:[E.jsx(I.Box,{sx:{pb:1},children:m.iconUrl?E.jsx(I.Box,{component:"img",src:m.iconUrl,alt:m.name,sx:{width:"32px",height:"32px",objectFit:"contain"}}):E.jsx(I.Box,{sx:{width:"32px",height:"32px",borderRadius:"6px",bgcolor:m.color||"#4285f4",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.5rem"},children:m.name.charAt(0)})}),E.jsx(I.Typography,{sx:{fontSize:"0.75rem",fontWeight:500,color:"#202124",textAlign:"center",lineHeight:1.2},children:m.name})]},m.id))})]})})})}const _t="spry_apps_cache",Un=300*1e3,Dn=300*1e3;function Vr(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),p=_.useCallback(()=>{try{const a=localStorage.getItem(_t);if(!a)return null;const b=JSON.parse(a);return Date.now()-b.timestamp<n?b.apps:(localStorage.removeItem(_t),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(_t,JSON.stringify(b))}catch(b){console.error("Error saving to cache:",b)}},[]),m=_.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 w=p();w&&i(w)}finally{l(!1)}},[e,p,v]);return _.useEffect(()=>{const a=p();return a&&(i(a),l(!1)),m(),r>0&&(y.current=window.setInterval(()=>{m()},r)),()=>{y.current&&window.clearInterval(y.current),d.current&&d.current.abort()}},[e,r,n]),{apps:o,isLoading:c,error:f,refetch:m}}function Mn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ze={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"),p=Symbol.for("react.view_transition"),v=Symbol.for("react.client.reference");function m(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 p: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 m(a)===i},H.isContextProvider=function(a){return m(a)===c},H.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===e},H.isForwardRef=function(a){return m(a)===l},H.isFragment=function(a){return m(a)===r},H.isLazy=function(a){return m(a)===d},H.isMemo=function(a){return m(a)===y},H.isPortal=function(a){return m(a)===t},H.isProfiler=function(a){return m(a)===o},H.isStrictMode=function(a){return m(a)===n},H.isSuspense=function(a){return m(a)===f},H.isSuspenseList=function(a){return m(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=m,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 p: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"),p=Symbol.for("react.lazy"),v=Symbol.for("react.view_transition"),m=Symbol.for("react.client.reference");J.ContextConsumer=c,J.ContextProvider=l,J.Element=t,J.ForwardRef=f,J.Fragment=n,J.Lazy=p,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)===p},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===p||a.$$typeof===d||a.$$typeof===l||a.$$typeof===c||a.$$typeof===f||a.$$typeof===m||a.getModuleId!==void 0)},J.typeOf=e})()),J}var lr;function Bn(){return lr||(lr=1,process.env.NODE_ENV==="production"?Ze.exports=jn():Ze.exports=Ln()),Ze.exports}var ct=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 Wr(e){if(Ae.isValidElement(e)||ct.isValidElementType(e)||!ve(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Wr(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])||ct.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])?Wr(t[o]):t[o]:n[o]=t[o]}),n}var et={exports:{}},tt={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,p=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,a=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,T=e?Symbol.for("react.scope"):60119;function C(g){if(typeof g=="object"&&g!==null){var A=g.$$typeof;switch(A){case t:switch(g=g.type,g){case f:case u:case n:case i:case o:case d:return g;default:switch(g=g&&g.$$typeof,g){case l:case y:case m:case v:case c:return g;default:return A}}case r:return A}}}function h(g){return C(g)===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=m,Y.Memo=v,Y.Portal=r,Y.Profiler=i,Y.StrictMode=o,Y.Suspense=d,Y.isAsyncMode=function(g){return h(g)||C(g)===f},Y.isConcurrentMode=h,Y.isContextConsumer=function(g){return C(g)===l},Y.isContextProvider=function(g){return C(g)===c},Y.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===t},Y.isForwardRef=function(g){return C(g)===y},Y.isFragment=function(g){return C(g)===n},Y.isLazy=function(g){return C(g)===m},Y.isMemo=function(g){return C(g)===v},Y.isPortal=function(g){return C(g)===r},Y.isProfiler=function(g){return C(g)===i},Y.isStrictMode=function(g){return C(g)===o},Y.isSuspense=function(g){return C(g)===d},Y.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===u||g===i||g===o||g===d||g===p||typeof g=="object"&&g!==null&&(g.$$typeof===m||g.$$typeof===v||g.$$typeof===c||g.$$typeof===l||g.$$typeof===y||g.$$typeof===b||g.$$typeof===w||g.$$typeof===T||g.$$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,p=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,a=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,w=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===p||typeof R=="object"&&R!==null&&(R.$$typeof===m||R.$$typeof===v||R.$$typeof===c||R.$$typeof===l||R.$$typeof===y||R.$$typeof===b||R.$$typeof===w||R.$$typeof===T||R.$$typeof===a)}function h(R){if(typeof R=="object"&&R!==null){var ye=R.$$typeof;switch(ye){case t:var Qe=R.type;switch(Qe){case f:case u:case n:case i:case o:case d:return Qe;default:var ir=Qe&&Qe.$$typeof;switch(ir){case l:case y:case m:case v:case c:return ir;default:return ye}}case r:return ye}}}var g=f,A=u,k=l,N=c,P=t,s=y,$=n,M=m,F=v,se=r,oe=i,le=o,he=d,Xe=!1;function Tt(R){return Xe||(Xe=!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.")),x(R)||h(R)===f}function x(R){return h(R)===u}function O(R){return h(R)===l}function B(R){return h(R)===c}function j(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function U(R){return h(R)===y}function z(R){return h(R)===n}function D(R){return h(R)===m}function L(R){return h(R)===v}function V(R){return h(R)===r}function q(R){return h(R)===i}function W(R){return h(R)===o}function ae(R){return h(R)===d}K.AsyncMode=g,K.ConcurrentMode=A,K.ContextConsumer=k,K.ContextProvider=N,K.Element=P,K.ForwardRef=s,K.Fragment=$,K.Lazy=M,K.Memo=F,K.Portal=se,K.Profiler=oe,K.StrictMode=le,K.Suspense=he,K.isAsyncMode=Tt,K.isConcurrentMode=x,K.isContextConsumer=O,K.isContextProvider=B,K.isElement=j,K.isForwardRef=U,K.isFragment=z,K.isLazy=D,K.isMemo=L,K.isPortal=V,K.isProfiler=q,K.isStrictMode=W,K.isSuspense=ae,K.isValidElementType=C,K.typeOf=h})()),K}var dr;function Gr(){return dr||(dr=1,process.env.NODE_ENV==="production"?tt.exports=Fn():tt.exports=zn()),tt.exports}var Rt,pr;function Vn(){if(pr)return Rt;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 Rt=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 p=0;p<u.length;p++)r.call(l,u[p])&&(f[u[p]]=l[u[p]])}}return f},Rt}var Ot,mr;function Kt(){if(mr)return Ot;mr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ot=e,Ot}var It,gr;function Yr(){return gr||(gr=1,It=Function.call.bind(Object.prototype.hasOwnProperty)),It}var $t,hr;function Wn(){if(hr)return $t;hr=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Kt(),r={},n=Yr();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 p=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 p.name="Invariant Violation",p}d=i[y](c,y,f,l,null,t)}catch(m){d=m}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={})},$t=o,$t}var kt,yr;function Gn(){if(yr)return kt;yr=1;var e=Gr(),t=Vn(),r=Kt(),n=Yr(),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 kt=function(l,f){var u=typeof Symbol=="function"&&Symbol.iterator,y="@@iterator";function d(x){var O=x&&(u&&x[u]||x[y]);if(typeof O=="function")return O}var p="<<anonymous>>",v={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:T(),arrayOf:C,element:h(),elementType:g(),instanceOf:A,node:s(),objectOf:N,oneOf:k,oneOfType:P,shape:M,exact:F};function m(x,O){return x===O?x!==0||1/x===1/O:x!==x&&O!==O}function a(x,O){this.message=x,this.data=O&&typeof O=="object"?O:{},this.stack=""}a.prototype=Error.prototype;function b(x){if(process.env.NODE_ENV!=="production")var O={},B=0;function j(z,D,L,V,q,W,ae){if(V=V||p,W=W||L,ae!==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=V+":"+L;!O[ye]&&B<3&&(i("You are manually calling a React.PropTypes validation function for the `"+W+"` prop on `"+V+"`. 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[L]==null?z?D[L]===null?new a("The "+q+" `"+W+"` is marked as required "+("in `"+V+"`, but its value is `null`.")):new a("The "+q+" `"+W+"` is marked as required in "+("`"+V+"`, but its value is `undefined`.")):null:x(D,L,V,q,W)}var U=j.bind(null,!1);return U.isRequired=j.bind(null,!0),U}function w(x){function O(B,j,U,z,D,L){var V=B[j],q=le(V);if(q!==x){var W=he(V);return new a("Invalid "+z+" `"+D+"` of type "+("`"+W+"` supplied to `"+U+"`, expected ")+("`"+x+"`."),{expectedType:x})}return null}return b(O)}function T(){return b(c)}function C(x){function O(B,j,U,z,D){if(typeof x!="function")return new a("Property `"+D+"` of component `"+U+"` has invalid PropType notation inside arrayOf.");var L=B[j];if(!Array.isArray(L)){var V=le(L);return new a("Invalid "+z+" `"+D+"` of type "+("`"+V+"` supplied to `"+U+"`, expected an array."))}for(var q=0;q<L.length;q++){var W=x(L,q,U,z,D+"["+q+"]",r);if(W instanceof Error)return W}return null}return b(O)}function h(){function x(O,B,j,U,z){var D=O[B];if(!l(D)){var L=le(D);return new a("Invalid "+U+" `"+z+"` of type "+("`"+L+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return b(x)}function g(){function x(O,B,j,U,z){var D=O[B];if(!e.isValidElementType(D)){var L=le(D);return new a("Invalid "+U+" `"+z+"` of type "+("`"+L+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return b(x)}function A(x){function O(B,j,U,z,D){if(!(B[j]instanceof x)){var L=x.name||p,V=Tt(B[j]);return new a("Invalid "+z+" `"+D+"` of type "+("`"+V+"` supplied to `"+U+"`, expected ")+("instance of `"+L+"`."))}return null}return b(O)}function k(x){if(!Array.isArray(x))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,j,U,z,D){for(var L=B[j],V=0;V<x.length;V++)if(m(L,x[V]))return null;var q=JSON.stringify(x,function(ae,R){var ye=he(R);return ye==="symbol"?String(R):R});return new a("Invalid "+z+" `"+D+"` of value `"+String(L)+"` "+("supplied to `"+U+"`, expected one of "+q+"."))}return b(O)}function N(x){function O(B,j,U,z,D){if(typeof x!="function")return new a("Property `"+D+"` of component `"+U+"` has invalid PropType notation inside objectOf.");var L=B[j],V=le(L);if(V!=="object")return new a("Invalid "+z+" `"+D+"` of type "+("`"+V+"` supplied to `"+U+"`, expected an object."));for(var q in L)if(n(L,q)){var W=x(L,q,U,z,D+"."+q,r);if(W instanceof Error)return W}return null}return b(O)}function P(x){if(!Array.isArray(x))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),c;for(var O=0;O<x.length;O++){var B=x[O];if(typeof B!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Xe(B)+" at index "+O+"."),c}function j(U,z,D,L,V){for(var q=[],W=0;W<x.length;W++){var ae=x[W],R=ae(U,z,D,L,V,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 "+L+" `"+V+"` supplied to "+("`"+D+"`"+ye+"."))}return b(j)}function s(){function x(O,B,j,U,z){return se(O[B])?null:new a("Invalid "+U+" `"+z+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return b(x)}function $(x,O,B,j,U){return new a((x||"React class")+": "+O+" type `"+B+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+U+"`.")}function M(x){function O(B,j,U,z,D){var L=B[j],V=le(L);if(V!=="object")return new a("Invalid "+z+" `"+D+"` of type `"+V+"` "+("supplied to `"+U+"`, expected `object`."));for(var q in x){var W=x[q];if(typeof W!="function")return $(U,z,D,q,he(W));var ae=W(L,q,U,z,D+"."+q,r);if(ae)return ae}return null}return b(O)}function F(x){function O(B,j,U,z,D){var L=B[j],V=le(L);if(V!=="object")return new a("Invalid "+z+" `"+D+"` of type `"+V+"` "+("supplied to `"+U+"`, expected `object`."));var q=t({},B[j],x);for(var W in q){var ae=x[W];if(n(x,W)&&typeof ae!="function")return $(U,z,D,W,he(ae));if(!ae)return new a("Invalid "+z+" `"+D+"` key `"+W+"` supplied to `"+U+"`.\nBad object: "+JSON.stringify(B[j],null," ")+`
|
|
2
|
+
Valid keys: `+JSON.stringify(Object.keys(x),null," "));var R=ae(L,W,U,z,D+"."+W,r);if(R)return R}return null}return b(O)}function se(x){switch(typeof x){case"number":case"string":case"undefined":return!0;case"boolean":return!x;case"object":if(Array.isArray(x))return x.every(se);if(x===null||l(x))return!0;var O=d(x);if(O){var B=O.call(x),j;if(O!==x.entries){for(;!(j=B.next()).done;)if(!se(j.value))return!1}else for(;!(j=B.next()).done;){var U=j.value;if(U&&!se(U[1]))return!1}}else return!1;return!0;default:return!1}}function oe(x,O){return x==="symbol"?!0:O?O["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&O instanceof Symbol:!1}function le(x){var O=typeof x;return Array.isArray(x)?"array":x instanceof RegExp?"object":oe(O,x)?"symbol":O}function he(x){if(typeof x>"u"||x===null)return""+x;var O=le(x);if(O==="object"){if(x instanceof Date)return"date";if(x instanceof RegExp)return"regexp"}return O}function Xe(x){var O=he(x);switch(O){case"array":case"object":return"an "+O;case"boolean":case"date":case"regexp":return"a "+O;default:return O}}function Tt(x){return!x.constructor||!x.constructor.name?p:x.constructor.name}return v.checkPropTypes=o,v.resetWarningCache=o.resetWarningCache,v.PropTypes=v,v},kt}var Pt,Sr;function Yn(){if(Sr)return Pt;Sr=1;var e=Kt();function t(){}function r(){}return r.resetWarningCache=t,Pt=function(){function n(c,l,f,u,y,d){if(d!==e){var p=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 p.name="Invariant Violation",p}}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},Pt}var br;function Kn(){if(br)return et.exports;if(br=1,process.env.NODE_ENV!=="production"){var e=Gr(),t=!0;et.exports=Gn()(e.isElement,t)}else et.exports=Yn()();return et.exports}var qn=Kn();const G=Mn(qn);function Ce(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 Kr(e,t=""){return e.displayName||e.name||t}function vr(e,t,r){const n=Kr(t);return e.displayName||(n!==""?`${r}(${n})`:r)}function Hn(e){if(e!=null){if(typeof e=="string")return e;if(typeof e=="function")return Kr(e,"Component");if(typeof e=="object")switch(e.$$typeof){case ct.ForwardRef:return vr(e,e.render,"ForwardRef");case ct.Memo:return vr(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.":Ce(7));return e.charAt(0).toUpperCase()+e.slice(1)}function zt(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],c=t[o];if(!c)r[o]=i||{};else if(!i)r[o]=c;else{r[o]={...c};for(const l in i)if(Object.prototype.hasOwnProperty.call(i,l)){const f=l;r[o][f]=zt(i[f],c[f])}}}else r[o]===void 0&&(r[o]=e[o])}return r}function Jn(e,t,r=void 0){const n={};for(const o in e){const i=e[o];let c="",l=!0;for(let f=0;f<i.length;f+=1){const u=i[f];u&&(c+=(l===!0?"":" ")+t(u),l=!1,r&&r[u]&&(c+=" "+r[u]))}n[o]=c}return n}const wr=e=>e,Xn=()=>{let e=wr;return{configure(t){e=t},generate(t){return e(t)},reset(){e=wr}}},Qn=Xn(),Zn={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 qt(e,t,r="Mui"){const n=Zn[t];return n?`${r}-${n}`:`${Qn.generate(e)}-${t}`}function eo(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=qt(e,o,r)}),n}function to(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function qr(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=qr(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ro(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=qr(e))&&(n&&(n+=" "),n+=t);return n}function Ge(e,t){return t?fe(e,t,{clone:!1}):e}const Te=process.env.NODE_ENV!=="production"?G.oneOfType([G.number,G.string,G.object,G.array]):{};function Er(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 no(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function oo(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\`.`:Ce(18,`(${t})`));return null}const[,n,o]=r,i=Number.isNaN(+n)?n||0:+n;return e.containerQueries(o).up(i)}function io(e){const t=(i,c)=>i.replace("@media",c?`@container ${c}`:"@container");function r(i,c){i.up=(...l)=>t(e.breakpoints.up(...l),c),i.down=(...l)=>t(e.breakpoints.down(...l),c),i.between=(...l)=>t(e.breakpoints.between(...l),c),i.only=(...l)=>t(e.breakpoints.only(...l),c),i.not=(...l)=>{const f=t(e.breakpoints.not(...l),c);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 dt={xs:0,sm:600,md:900,lg:1200,xl:1536},Ar={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${dt[e]}px)`},so={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:dt[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function we(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const i=n.breakpoints||Ar;return t.reduce((c,l,f)=>(c[i.up(i.keys[f])]=r(t[f]),c),{})}if(typeof t=="object"){const i=n.breakpoints||Ar;return Object.keys(t).reduce((c,l)=>{if(no(i.keys,l)){const f=oo(n.containerQueries?n:so,l);f&&(c[f]=r(t[l],l))}else if(Object.keys(i.values||dt).includes(l)){const f=i.up(l);c[f]=r(t[l],l)}else{const f=l;c[f]=t[f]}return c},{})}return r(t)}function ao(e={}){return e.keys?.reduce((r,n)=>{const o=e.up(n);return r[o]={},r},{})||{}}function Cr(e,t){return e.reduce((r,n)=>{const o=r[n];return(!o||Object.keys(o).length===0)&&delete r[n],r},t)}function pt(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 lt(e,t,r,n=r){let o;return typeof e=="function"?o=e(r):Array.isArray(e)?o=e[r]||n:o=pt(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=c=>{if(c[t]==null)return null;const l=c[t],f=c.theme,u=pt(f,n)||{};return we(c,l,d=>{let p=lt(u,o,d);return d===p&&typeof d=="string"&&(p=lt(u,o,`${t}${d==="default"?"":Ie(d)}`,d)),r===!1?p:{[r]:p}})};return i.propTypes=process.env.NODE_ENV!=="production"?{[t]:Te}:{},i.filterProps=[t],i}function co(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const lo={m:"margin",p:"padding"},uo={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},xr={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},fo=co(e=>{if(e.length>2)if(xr[e])e=xr[e];else return[e];const[t,r]=e.split(""),n=lo[t],o=uo[r]||"";return Array.isArray(o)?o.map(i=>n+i):[n+o]}),mt=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],gt=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],po=[...mt,...gt];function qe(e,t,r,n){const o=pt(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 c=Math.abs(i);process.env.NODE_ENV!=="production"&&(Number.isInteger(c)?c>o.length-1&&console.error([`MUI: The value provided (${c}) overflows.`,`The supported values are: ${JSON.stringify(o)}.`,`${c} > ${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
5
|
`)));const l=o[c];return i>=0?l:typeof l=="number"?-l:`-${l}`}: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 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 ni(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Or=[];function
|
|
6
|
+
`)),()=>{})}function Ht(e){return qe(e,"spacing",8,"spacing")}function He(e,t){return typeof t=="string"||t==null?t:e(t)}function mo(e,t){return r=>e.reduce((n,o)=>(n[o]=He(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 we(e,c,i)}function Hr(e,t){const r=Ht(e.theme);return Object.keys(e).map(n=>go(e,t,n,r)).reduce(Ge,{})}function te(e){return Hr(e,mt)}te.propTypes=process.env.NODE_ENV!=="production"?mt.reduce((e,t)=>(e[t]=Te,e),{}):{};te.filterProps=mt;function re(e){return Hr(e,gt)}re.propTypes=process.env.NODE_ENV!=="production"?gt.reduce((e,t)=>(e[t]=Te,e),{}):{};re.filterProps=gt;process.env.NODE_ENV!=="production"&&po.reduce((e,t)=>(e[t]=Te,e),{});function ht(...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]?Ge(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),wo=ge("borderColor"),Eo=ge("borderTopColor"),Ao=ge("borderRightColor"),Co=ge("borderBottomColor"),xo=ge("borderLeftColor"),To=ge("outline",pe),_o=ge("outlineColor"),yt=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=qe(e.theme,"shape.borderRadius",4,"borderRadius"),r=n=>({borderRadius:He(t,n)});return we(e,e.borderRadius,r)}return null};yt.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:Te}:{};yt.filterProps=["borderRadius"];ht(ho,yo,So,bo,vo,wo,Eo,Ao,Co,xo,yt,To,_o);const St=e=>{if(e.gap!==void 0&&e.gap!==null){const t=qe(e.theme,"spacing",8,"gap"),r=n=>({gap:He(t,n)});return we(e,e.gap,r)}return null};St.propTypes=process.env.NODE_ENV!=="production"?{gap:Te}:{};St.filterProps=["gap"];const bt=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=qe(e.theme,"spacing",8,"columnGap"),r=n=>({columnGap:He(t,n)});return we(e,e.columnGap,r)}return null};bt.propTypes=process.env.NODE_ENV!=="production"?{columnGap:Te}:{};bt.filterProps=["columnGap"];const vt=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=qe(e.theme,"spacing",8,"rowGap"),r=n=>({rowGap:He(t,n)});return we(e,e.rowGap,r)}return null};vt.propTypes=process.env.NODE_ENV!=="production"?{rowGap:Te}:{};vt.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"});ht(St,bt,vt,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});ht(Mo,jo,Lo);function ue(e){return e<=1&&e!==0?`${e*100}%`:e}const Bo=ne({prop:"width",transform:ue}),Jt=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||dt[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:ue(r)}};return we(e,e.maxWidth,t)}return null};Jt.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"});ht(Bo,Jt,Fo,zo,Vo,Wo,Go);const wt={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:yt},color:{themeKey:"palette",transform:je},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:je},backgroundColor:{themeKey:"palette",transform:je},p:{style:re},pt:{style:re},pr:{style:re},pb:{style:re},pl:{style:re},px:{style:re},py:{style:re},padding:{style:re},paddingTop:{style:re},paddingRight:{style:re},paddingBottom:{style:re},paddingLeft:{style:re},paddingX:{style:re},paddingY:{style:re},paddingInline:{style:re},paddingInlineStart:{style:re},paddingInlineEnd:{style:re},paddingBlock:{style:re},paddingBlockStart:{style:re},paddingBlockEnd:{style:re},m:{style:te},mt:{style:te},mr:{style:te},mb:{style:te},ml:{style:te},mx:{style:te},my:{style:te},margin:{style:te},marginTop:{style:te},marginRight:{style:te},marginBottom:{style:te},marginLeft:{style:te},marginX:{style:te},marginY:{style:te},marginInline:{style:te},marginInlineStart:{style:te},marginInlineEnd:{style:te},marginBlock:{style:te},marginBlockStart:{style:te},marginBlockEnd:{style:te},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:St},rowGap:{style:vt},columnGap:{style:bt},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:Jt},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 p=pt(o,u)||{};return d?d(c):we(c,n,m=>{let a=lt(p,y,m);return m===a&&typeof m=="string"&&(a=lt(p,y,`${r}${m==="default"?"":Ie(m)}`,m)),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??wt;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 p=y;return Object.keys(u).forEach(v=>{const m=Ko(u[v],o);if(m!=null)if(typeof m=="object")if(c[v])p=Ge(p,e(v,m,o,c));else{const a=we({theme:o},m,b=>({[v]:b}));Yo(a,m)?p[v]=t({sx:m,theme:o,nested:!0}):p=Ge(p,a)}else p=Ge(p,e(v,m,o,c))}),!i&&o.modularCssLayers?{"@layer sx":Er(o,Cr(d,p))}:Er(o,Cr(d,p))}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,Jr=function(t){return t.charCodeAt(1)===45},Tr=function(t){return t!=null&&typeof t!="boolean"},Nt=Xo(function(e){return Jr(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 Ee={name:o,styles:i,next:Ee},o})}return Jo[t]!==1&&!Jr(t)&&typeof r=="number"&&r!==0?r+"px":r};function ut(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 c=i.next;if(c!==void 0)for(;c!==void 0;)Ee={name:c.name,styles:c.styles,next:Ee},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+=ut(e,t,r[o])+";";else for(var i in r){var c=r[i];if(typeof c!="object"){var l=c;Tr(l)&&(n+=Nt(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+=Nt(i)+":"+_r(i,c[f])+";");else{var u=ut(e,t,c);switch(i){case"animation":case"animationName":{n+=Nt(i)+":"+u+";";break}default:n+=i+"{"+u+"}"}}}return n}var Rr=/label:\s*([^\s;{]+)\s*(;|$)/g,Ee;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="";Ee=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=ut(r,t,i);else{var c=i;o+=c[0]}for(var l=1;l<e.length;l++)if(o+=ut(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:Ee}}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 ni(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Or=[];function Oe(e){return Or[0]=e,ti(Or)}const oi=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 ii(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...o}=e,i=oi(t),c=Object.keys(i);function l(p){return`@media (min-width:${typeof t[p]=="number"?t[p]:p}${r})`}function f(p){return`@media (max-width:${(typeof t[p]=="number"?t[p]:p)-n/100}${r})`}function u(p,v){const m=c.indexOf(v);return`@media (min-width:${typeof t[p]=="number"?t[p]:p}${r}) and (max-width:${(m!==-1&&typeof t[c[m]]=="number"?t[c[m]]:v)-n/100}${r})`}function y(p){return c.indexOf(p)+1<c.length?u(p,c[c.indexOf(p)+1]):l(p)}function d(p){const v=c.indexOf(p);return v===0?l(c[1]):v===c.length-1?f(c[v]):u(p,c[c.indexOf(p)+1]).replace("@media","@media not all and")}return{keys:c,values:i,up:l,down:f,between:u,only:y,not:d,unit:r,...o}}const si={borderRadius:4};function Xr(e=8,t=Ht({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 c=t(i);return typeof c=="number"?`${c}px`:c}).join(" "));return r.mui=!0,r}function ai(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 Qr(e={},...t){const{breakpoints:r={},palette:n={},spacing:o,shape:i={},...c}=e,l=ii(r),f=Xr(o);let u=fe({breakpoints:l,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:f,shape:{...si,...i}},c);return u=io(u),u.applyStyles=ai,u=t.reduce((y,d)=>fe(y,d),u),u.unstable_sxConfig={...wt,...c?.unstable_sxConfig},u.unstable_sx=function(d){return Le({sx:d,theme:this})},u}function Zr(e){const{variants:t,...r}=e,n={variants:t,style:Oe(r),isProcessed:!0};return n.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=Oe(o.style))}),n}const ci=Qr();function Ut(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Re(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function li(e){return e?(t,r)=>r[e]:null}function ui(e,t,r){e.theme=mi(e.theme)?r:e.theme[t]||e.theme}function ot(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(o=>ot(e,o,r));if(Array.isArray(n?.variants)){let o;if(n.isProcessed)o=r?Re(n.style,r):n.style;else{const{variants:i,...c}=n;o=r?Re(Oe(c),r):c}return en(e,n.variants,[o],r)}return n?.isProcessed?r?Re(Oe(n.style),r):n.style:r?Re(Oe(n),r):n}function en(e,t,r=[],n=void 0){let o;e:for(let i=0;i<t.length;i+=1){const c=t[i];if(typeof c.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!c.props(o))continue}else for(const l in c.props)if(e[l]!==c.props[l]&&e.ownerState?.[l]!==c.props[l])continue e;typeof c.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?Re(Oe(c.style(o)),n):c.style(o))):r.push(n?Re(Oe(c.style),n):c.style)}return r}function fi(e={}){const{themeId:t,defaultTheme:r=ci,rootShouldForwardProp:n=Ut,slotShouldForwardProp:o=Ut}=e;function i(l){ui(l,t,r)}return(l,f={})=>{ni(l,A=>A.filter(k=>k!==Le));const{name:u,slot:y,skipVariantsResolver:d,skipSx:p,overridesResolver:v=li(tn(y)),...m}=f,a=u&&u.startsWith("Mui")||y?"components":"custom",b=d!==void 0?d:y&&y!=="Root"&&y!=="root"||!1,w=p||!1;let T=Ut;y==="Root"||y==="root"?T=n:y?T=o:gi(l)&&(T=void 0);const C=ri(l,{shouldForwardProp:T,label:pi(u,y),...m}),h=A=>{if(A.__emotion_real===A)return A;if(typeof A=="function")return function(N){return ot(N,A,N.theme.modularCssLayers?a:void 0)};if(ve(A)){const k=Zr(A);return function(P){return k.variants?ot(P,k,P.theme.modularCssLayers?a:void 0):P.theme.modularCssLayers?Re(k.style,a):k.style}}return A},g=(...A)=>{const k=[],N=A.map(h),P=[];if(k.push(i),u&&v&&P.push(function(F){const oe=F.theme.components?.[u]?.styleOverrides;if(!oe)return null;const le={};for(const he in oe)le[he]=ot(F,oe[he],F.theme.modularCssLayers?"theme":void 0);return v(F,le)}),u&&!b&&P.push(function(F){const oe=F.theme?.components?.[u]?.variants;return oe?en(F,oe,[],F.theme.modularCssLayers?"theme":void 0):null}),w||P.push(Le),Array.isArray(N[0])){const M=N.shift(),F=new Array(k.length).fill(""),se=new Array(P.length).fill("");let oe;oe=[...F,...M,...se],oe.raw=[...F,...M.raw,...se],k.unshift(oe)}const s=[...k,...N,...P],$=C(...s);return l.muiName&&($.muiName=l.muiName),process.env.NODE_ENV!=="production"&&($.displayName=di(u,y,l)),$};return C.withConfig&&(g.withConfig=C.withConfig),g}}function di(e,t,r){return e?`${e}${Ie(t||"")}`:`Styled(${Hn(r)})`}function pi(e,t){let r;return process.env.NODE_ENV!=="production"&&e&&(r=`${e}-${tn(t||"Root")}`),r}function mi(e){for(const t in e)return!1;return!0}function gi(e){return typeof e=="string"&&e.charCodeAt(0)>96}function tn(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function Xt(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}].`),to(e,t,r)}function hi(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 xe(e){if(e.type)return e;if(e.charAt(0)==="#")return xe(hi(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
8
|
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:Ce(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.`:Ce(10,o))}else n=n.split(",");return n=n.map(i=>parseFloat(i)),{type:r,values:n,colorSpace:o}}const yi=e=>{const t=xe(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},
|
|
10
|
-
`))}return b}const
|
|
11
|
-
The color object needs to have a \`main\` property or a \`${
|
|
9
|
+
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:Ce(10,o))}else n=n.split(",");return n=n.map(i=>parseFloat(i)),{type:r,values:n,colorSpace:o}}const yi=e=>{const t=xe(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},Ve=(e,t)=>{try{return yi(e)}catch{return t&&process.env.NODE_ENV!=="production"&&console.warn(t),e}};function Et(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 rn(e){e=xe(e);const{values:t}=e,r=t[0],n=t[1]/100,o=t[2]/100,i=n*Math.min(o,1-o),c=(u,y=(u+r/30)%12)=>o-i*Math.max(Math.min(y-3,9-y,1),-1);let l="rgb";const f=[Math.round(c(0)*255),Math.round(c(8)*255),Math.round(c(4)*255)];return e.type==="hsla"&&(l+="a",f.push(t[3])),Et({type:l,values:f})}function Vt(e){e=xe(e);let t=e.type==="hsl"||e.type==="hsla"?xe(rn(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 Ir(e,t){const r=Vt(e),n=Vt(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function Si(e,t){return e=xe(e),t=Xt(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,Et(e)}function rt(e,t,r){try{return Si(e,t)}catch{return e}}function Qt(e,t){if(e=xe(e),t=Xt(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 Et(e)}function X(e,t,r){try{return Qt(e,t)}catch{return e}}function Zt(e,t){if(e=xe(e),t=Xt(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 Et(e)}function Q(e,t,r){try{return Zt(e,t)}catch{return e}}function bi(e,t=.15){return Vt(e)>.5?Qt(e,t):Zt(e,t)}function nt(e,t,r){try{return bi(e,t)}catch{return e}}const vi=Ae.createContext(void 0);process.env.NODE_ENV!=="production"&&(G.node,G.object);function wi(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?zt(o.defaultProps,n):!o.styleOverrides&&!o.variants?zt(o,n):n}function Ei({props:e,name:t}){const r=Ae.useContext(vi);return wi({props:e,name:t,theme:{components:r}})}const $r={theme:void 0};function Ai(e){let t,r;return function(o){let i=t;return(i===void 0||o.theme!==r)&&($r.theme=o.theme,i=Zr(e($r)),t=i,r=o.theme),i}}function Ci(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 kr=(e,t,r,n=[])=>{let o=e;t.forEach((i,c)=>{c===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])})},xi=(e,t,r)=>{function n(o,i=[],c=[]){Object.entries(o).forEach(([l,f])=>{(!r||r&&!r([...i,l]))&&f!=null&&(typeof f=="object"&&Object.keys(f).length>0?n(f,[...i,l],Array.isArray(f)?[...c,l]:c):t([...i,l],f,c))})}n(e)},Ti=(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 Dt(e,t){const{prefix:r,shouldSkipGeneratingVar:n}=t||{},o={},i={},c={};return xi(e,(l,f,u)=>{if((typeof f=="string"||typeof f=="number")&&(!n||!n(l,f))){const y=`--${r?`${r}-`:""}${l.join("-")}`,d=Ti(l,f);Object.assign(o,{[y]:d}),kr(i,l,`var(${y})`,u),kr(c,l,`var(${y}, ${d})`,u)}},l=>l[0]==="vars"),{css:o,vars:i,varsWithDefaults:c}}function _i(e,t={}){const{getSelector:r=b,disableCssColorScheme:n,colorSchemeSelector:o}=t,{colorSchemes:i={},components:c,defaultColorScheme:l="light",...f}=e,{vars:u,css:y,varsWithDefaults:d}=Dt(f,t);let p=d;const v={},{[l]:m,...a}=i;if(Object.entries(a||{}).forEach(([C,h])=>{const{vars:g,css:A,varsWithDefaults:k}=Dt(h,t);p=fe(p,k),v[C]={css:A,vars:g}}),m){const{css:C,vars:h,varsWithDefaults:g}=Dt(m,t);p=fe(p,g),v[l]={css:C,vars:h}}function b(C,h){let g=o;if(o==="class"&&(g=".%s"),o==="data"&&(g="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(g=`[${o}="%s"]`),C){if(g==="media")return e.defaultColorScheme===C?":root":{[`@media (prefers-color-scheme: ${i[C]?.palette?.mode||C})`]:{":root":h}};if(g)return e.defaultColorScheme===C?`:root, ${g.replace("%s",String(C))}`:g.replace("%s",String(C))}return":root"}return{vars:p,generateThemeVars:()=>{let C={...u};return Object.entries(v).forEach(([,{vars:h}])=>{C=fe(C,h)}),C},generateStyleSheets:()=>{const C=[],h=e.defaultColorScheme||"light";function g(N,P){Object.keys(P).length&&C.push(typeof N=="string"?{[N]:{...P}}:N)}g(r(void 0,{...y}),y);const{[h]:A,...k}=v;if(A){const{css:N}=A,P=i[h]?.palette?.mode,s=!n&&P?{colorScheme:P,...N}:{...N};g(r(h,{...s}),s)}return Object.entries(k).forEach(([N,{css:P}])=>{const s=i[N]?.palette?.mode,$=!n&&s?{colorScheme:s,...P}:{...P};g(r(N,{...$}),$)}),C}}}function Ri(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 Ke={black:"#000",white:"#fff"},Oi={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"},Pe={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Fe={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Ne={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Ue={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},De={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function nn(){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:Ke.white,default:Ke.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 Ii=nn();function on(){return{text:{primary:Ke.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:Ke.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 Pr=on();function Nr(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=Zt(e.main,o):t==="dark"&&(e.dark=Qt(e.main,i)))}function $i(e="light"){return e==="dark"?{main:Ne[200],light:Ne[50],dark:Ne[400]}:{main:Ne[700],light:Ne[400],dark:Ne[800]}}function ki(e="light"){return e==="dark"?{main:ke[200],light:ke[50],dark:ke[400]}:{main:ke[500],light:ke[300],dark:ke[700]}}function Pi(e="light"){return e==="dark"?{main:Pe[500],light:Pe[300],dark:Pe[700]}:{main:Pe[700],light:Pe[400],dark:Pe[800]}}function Ni(e="light"){return e==="dark"?{main:Ue[400],light:Ue[300],dark:Ue[700]}:{main:Ue[700],light:Ue[500],dark:Ue[900]}}function Ui(e="light"){return e==="dark"?{main:De[400],light:De[300],dark:De[700]}:{main:De[800],light:De[500],dark:De[900]}}function Di(e="light"){return e==="dark"?{main:Fe[400],light:Fe[300],dark:Fe[700]}:{main:"#ed6c02",light:Fe[500],dark:Fe[900]}}function er(e){const{mode:t="light",contrastThreshold:r=3,tonalOffset:n=.2,...o}=e,i=e.primary||$i(t),c=e.secondary||ki(t),l=e.error||Pi(t),f=e.info||Ni(t),u=e.success||Ui(t),y=e.warning||Di(t);function d(a){const b=Ir(a,Pr.text.primary)>=r?Pr.text.primary:Ii.text.primary;if(process.env.NODE_ENV!=="production"){const w=Ir(a,b);w<3&&console.error([`MUI: The contrast ratio of ${w}:1 for ${b} on ${a}`,"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 b}const p=({color:a,name:b,mainShade:w=500,lightShade:T=300,darkShade:C=700})=>{if(a={...a},!a.main&&a[w]&&(a.main=a[w]),!a.hasOwnProperty("main"))throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${b?` (${b})`:""} provided to augmentColor(color) is invalid.
|
|
11
|
+
The color object needs to have a \`main\` property or a \`${w}\` property.`:Ce(11,b?` (${b})`:"",w));if(typeof a.main!="string")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${b?` (${b})`:""} provided to augmentColor(color) is invalid.
|
|
12
12
|
\`color.main\` should be a string, but \`${JSON.stringify(a.main)}\` was provided instead.
|
|
13
13
|
|
|
14
14
|
Did you intend to use one of the following approaches?
|
|
@@ -21,15 +21,15 @@ const theme1 = createTheme({ palette: {
|
|
|
21
21
|
|
|
22
22
|
const theme2 = createTheme({ palette: {
|
|
23
23
|
primary: { main: green[500] },
|
|
24
|
-
} });`:Ce(12,b?` (${b})`:"",JSON.stringify(a.main)));return Nr(a,"light",T,n),Nr(a,"dark",C,n),a.contrastText||(a.contrastText=d(a.main)),a};let v;return t==="light"?v=
|
|
25
|
-
`)),Object.keys(u).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(u).join(",")}].`)}return(Array.isArray(o)?o:[o]).map(y=>`${y} ${typeof c=="string"?c:Mr(c)} ${l} ${typeof f=="string"?f:Mr(f)}`).join(",")},...e,easing:t,duration:r}}const Hi={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function Ji(e){return ve(e)||typeof e>"u"||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||Array.isArray(e)}function
|
|
24
|
+
} });`:Ce(12,b?` (${b})`:"",JSON.stringify(a.main)));return Nr(a,"light",T,n),Nr(a,"dark",C,n),a.contrastText||(a.contrastText=d(a.main)),a};let v;return t==="light"?v=nn():t==="dark"&&(v=on()),process.env.NODE_ENV!=="production"&&(v||console.error(`MUI: The palette mode \`${t}\` is not supported.`)),fe({common:{...Ke},mode:t,primary:p({color:i,name:"primary"}),secondary:p({color:c,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:p({color:l,name:"error"}),warning:p({color:y,name:"warning"}),info:p({color:f,name:"info"}),success:p({color:u,name:"success"}),grey:Oi,contrastThreshold:r,getContrastText:d,augmentColor:p,tonalOffset:n,...v},o)}function Mi(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 ji(e,t){return{toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}},...t}}function Li(e){return Math.round(e*1e5)/1e5}const Ur={textTransform:"uppercase"},Dr='"Roboto", "Helvetica", "Arial", sans-serif';function Bi(e,t){const{fontFamily:r=Dr,fontSize:n=14,fontWeightLight:o=300,fontWeightRegular:i=400,fontWeightMedium:c=500,fontWeightBold:l=700,htmlFontSize:f=16,allVariants:u,pxToRem:y,...d}=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 p=n/14,v=y||(b=>`${b/f*p}rem`),m=(b,w,T,C,h)=>({fontFamily:r,fontWeight:b,fontSize:v(w),lineHeight:T,...r===Dr?{letterSpacing:`${Li(C/w)}em`}:{},...h,...u}),a={h1:m(o,96,1.167,-1.5),h2:m(o,60,1.2,-.5),h3:m(i,48,1.167,0),h4:m(i,34,1.235,.25),h5:m(i,24,1.334,0),h6:m(c,20,1.6,.15),subtitle1:m(i,16,1.75,.15),subtitle2:m(c,14,1.57,.1),body1:m(i,16,1.5,.15),body2:m(i,14,1.43,.15),button:m(c,14,1.75,.4,Ur),caption:m(i,12,1.66,.4),overline:m(i,12,2.66,1,Ur),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return fe({htmlFontSize:f,pxToRem:v,fontFamily:r,fontSize:n,fontWeightLight:o,fontWeightRegular:i,fontWeightMedium:c,fontWeightBold:l,...a},d,{clone:!1})}const Fi=.2,zi=.14,Vi=.12;function Z(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Fi})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${zi})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Vi})`].join(",")}const Wi=["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)],Gi={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)"},Yi={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Mr(e){return`${Math.round(e)}ms`}function Ki(e){if(!e)return 0;const t=e/36;return Math.min(Math.round((4+15*t**.25+t/5)*10),3e3)}function qi(e){const t={...Gi,...e.easing},r={...Yi,...e.duration};return{getAutoHeightDuration:Ki,create:(o=["all"],i={})=>{const{duration:c=r.standard,easing:l=t.easeInOut,delay:f=0,...u}=i;if(process.env.NODE_ENV!=="production"){const y=p=>typeof p=="string",d=p=>!Number.isNaN(parseFloat(p));!y(o)&&!Array.isArray(o)&&console.error('MUI: Argument "props" must be a string or Array.'),!d(c)&&!y(c)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${c}.`),y(l)||console.error('MUI: Argument "easing" must be a string.'),!d(f)&&!y(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(u).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(u).join(",")}].`)}return(Array.isArray(o)?o:[o]).map(y=>`${y} ${typeof c=="string"?c:Mr(c)} ${l} ${typeof f=="string"?f:Mr(f)}`).join(",")},...e,easing:t,duration:r}}const Hi={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function Ji(e){return ve(e)||typeof e>"u"||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||Array.isArray(e)}function sn(e={}){const t={...e};function r(n){const o=Object.entries(n);for(let i=0;i<o.length;i++){const[c,l]=o[i];!Ji(l)||c.startsWith("unstable_")?delete n[c]:ve(l)&&(n[c]={...l},r(n[c]))}}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
|
|
33
|
-
`))}a[
|
|
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 Wt(e={},...t){const{breakpoints:r,mixins:n={},spacing:o,palette:i={},transitions:c={},typography:l={},shape:f,...u}=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.":Ce(20));const y=er(i),d=Qr(e);let p=fe(d,{mixins:ji(d.breakpoints,n),palette:y,shadows:Wi.slice(),typography:Bi(y,l),transitions:qi(c),zIndex:{...Hi}});if(p=fe(p,u),p=t.reduce((v,m)=>fe(v,m),p),process.env.NODE_ENV!=="production"){const v=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],m=(a,b)=>{let w;for(w in a){const T=a[w];if(v.includes(w)&&Object.keys(T).length>0){if(process.env.NODE_ENV!=="production"){const C=qt("",w);console.error([`MUI: The \`${b}\` component increases the CSS specificity of the \`${w}\` internal state.`,"You can not override it like this: ",JSON.stringify(a,null,2),"",`Instead, you need to use the '&.${C}' syntax:`,JSON.stringify({root:{[`&.${C}`]:T}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
33
|
+
`))}a[w]={}}}};Object.keys(p.components).forEach(a=>{const b=p.components[a].styleOverrides;b&&a.startsWith("Mui")&&m(b,a)})}return p.unstable_sxConfig={...wt,...u?.unstable_sxConfig},p.unstable_sx=function(m){return Le({sx:m,theme:this})},p.toRuntimeSource=sn,p}function Xi(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 Qi=[...Array(25)].map((e,t)=>{if(t===0)return"none";const r=Xi(t);return`linear-gradient(rgba(255 255 255 / ${r}), rgba(255 255 255 / ${r}))`});function an(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function cn(e){return e==="dark"?Qi:[]}function Zi(e){const{palette:t={mode:"light"},opacity:r,overlays:n,...o}=e,i=er(t);return{palette:i,opacity:{...an(i.mode),...r},overlays:n||cn(i.mode),...o}}function es(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 ts=e=>[...[...Array(25)].map((t,r)=>`--${e?`${e}-`:""}overlays-${r}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],rs=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 c={};return ts(e.cssVarPrefix).forEach(l=>{c[l]=r[l],delete r[l]}),i==="media"?{[n]:r,"@media (prefers-color-scheme: dark)":{[n]:c}}:i?{[i.replace("%s",t)]:c,[`${n}, ${i.replace("%s",t)}`]:r}:{[n]:{...r,...c}}}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 ns(e,t){t.forEach(r=>{e[r]||(e[r]={})})}function S(e,t,r){!e[t]&&r&&(e[t]=r)}function We(e){return typeof e!="string"||!e.startsWith("hsl")?e:rn(e)}function be(e,t){`${t}Channel`in e||(e[`${t}Channel`]=Ve(We(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 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 Mt(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}=Wt({...r,palette:{mode:o,...t?.palette}});return e[n]={...t,palette:i,opacity:{...an(o),...t?.opacity},overlays:t?.overlays||cn(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),p=is(i),{[d]:v,light:m,dark:a,...b}=r,w={...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=Mt(w,T,u,d);m&&!w.light&&Mt(w,m,void 0,"light"),a&&!w.dark&&Mt(w,a,void 0,"dark");let h={defaultColorScheme:d,...C,cssVarPrefix:i,colorSchemeSelector:l,rootSelector:f,getCssVar:p,colorSchemes:w,font:{...Mi(C.typography),...C.font},spacing:os(u.spacing)};Object.keys(h.colorSchemes).forEach(P=>{const s=h.colorSchemes[P].palette,$=M=>{const F=M.split("-"),se=F[1],oe=F[2];return p(M,s[se][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 M=nt(s.background.default,.8);S(s.SnackbarContent,"bg",M),S(s.SnackbarContent,"color",Se(()=>s.getContrastText(M))),S(s.SpeedDialAction,"fabHoverBg",nt(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(rt(s.divider,1),.88)),S(s.Tooltip,"bg",rt(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 M=nt(s.background.default,.98);S(s.SnackbarContent,"bg",M),S(s.SnackbarContent,"color",Se(()=>s.getContrastText(M))),S(s.SpeedDialAction,"fabHoverBg",nt(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(rt(s.divider,1),.68)),S(s.Tooltip,"bg",rt(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(M=>{const F=s[M];M!=="tonalOffset"&&F&&typeof F=="object"&&(F.main&&S(s[M],"mainChannel",Ve(We(F.main))),F.light&&S(s[M],"lightChannel",Ve(We(F.light))),F.dark&&S(s[M],"darkChannel",Ve(We(F.dark))),F.contrastText&&S(s[M],"contrastTextChannel",Ve(We(F.contrastText))),M==="text"&&(be(s[M],"primary"),be(s[M],"secondary")),M==="action"&&(F.active&&be(s[M],"active"),F.selected&&be(s[M],"selected")))})}),h=t.reduce((P,s)=>fe(P,s),h);const g={prefix:i,disableCssColorScheme:o,shouldSkipGeneratingVar:c,getSelector:rs(h)},{vars:A,generateThemeVars:k,generateStyleSheets:N}=_i(h,g);return h.vars=A,Object.entries(h.colorSchemes[h.defaultColorScheme]).forEach(([P,s])=>{h[P]=s}),h.generateThemeVars=k,h.generateStyleSheets=N,h.generateSpacing=function(){return Xr(u.spacing,Ht(this))},h.getColorSchemeSelector=Ri(l),h.spacing=h.generateSpacing(),h.shouldSkipGeneratingVar=c,h.unstable_sxConfig={...wt,...u?.unstable_sxConfig},h.unstable_sx=function(s){return Le({sx:s,theme:this})},h.toRuntimeSource=sn,h}function jr(e,t,r){e.colorSchemes&&r&&(e.colorSchemes[t]={...r!==!0&&r,palette:er({...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 Wt(e,...t);let y=r;"palette"in e||u[l]&&(u[l]!==!0?y=u[l].palette:l==="dark"&&(y={mode:"dark"}));const d=Wt({...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"&&(G.node,G.object.isRequired);function ms(e){return Ei(e)}function gs(e){return qt("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${Ie(t)}`,`fontSize${Ie(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${Ie(r.color)}`],t[`fontSize${Ie(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}}]}))),ft=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:p="0 0 24 24",...v}=n,m=Ae.isValidElement(o)&&o.type==="svg",a={...n,color:c,component:l,fontSize:f,instanceFontSize:t.fontSize,inheritViewBox:y,viewBox:p,hasSvgAsChild:m},b={};y||(b.viewBox=p);const w=hs(a);return E.jsxs(ys,{as:l,className:ro(w.root,i),focusable:"false",color:u,"aria-hidden":d?void 0:!0,role:d?"img":void 0,ref:r,...b,...v,...m&&o.props,ownerState:a,children:[m?o.props.children:o,d?E.jsx("title",{children:d}):null]})});process.env.NODE_ENV!=="production"&&(ft.propTypes={children:G.node,classes:G.object,className:G.string,color:G.oneOfType([G.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),G.string]),component:G.elementType,fontSize:G.oneOfType([G.oneOf(["inherit","large","medium","small"]),G.string]),htmlColor:G.string,inheritViewBox:G.bool,shapeRendering:G.string,sx:G.oneOfType([G.arrayOf(G.oneOfType([G.func,G.object,G.bool])),G.func,G.object]),titleAccess:G.string,viewBox:G.string});ft.muiName="SvgIcon";function ln(e,t){function r(n,o){return E.jsx(ft,{"data-testid":`${t}Icon`,ref:o,...n,children:e})}return process.env.NODE_ENV!=="production"&&(r.displayName=`${t}Icon`),r.muiName=ft.muiName,Ae.memo(Ae.forwardRef(r))}const Ss=ln(E.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"},Je={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."},un={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..."},fn="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 At(e,t=Je.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 tr(e,t=Je.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 _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 dn(e){return!!(e.isStale||tr(e.user.refresh_token)||!e.user.refresh_token&&At(e.user.access_token))}function ws(e){return At(e,Je.ACCESS_TOKEN_BUFFER_SECONDS)}function Es(e){return tr(e,Je.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 pn({profile:e,isLoading:t,onSignOut:r,onManageAccount:n,accountManager:o}){const i="https://sprylogin.com/my-account/",[c,l]=_.useState(null),f=w=>{l(w.currentTarget)},u=()=>{l(null)},y=()=>{o&&o.activeAccount?o.removeAccount(o.activeAccount.accountId):(u(),r&&r()),u()},d=()=>{u(),n?n():e?.manageAccountUrl?window.location.href=e.manageAccountUrl:window.location.href=i},p=!!c,v=()=>{if(o?.activeAccount){const{name:w,email:T}=_e(o.activeAccount.user);if(w)return w.split(" ").map(C=>C[0]).join("").slice(0,2).toUpperCase();if(T)return T[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():"?"},m=()=>{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"},a=()=>{if(o?.activeAccount){const{email:w}=_e(o.activeAccount.user);return w}return e?.email||"No email"},b=()=>{if(o?.activeAccount){const{avatar:w}=_e(o.activeAccount.user);return w||null}return e?.avatar||null};return E.jsxs(E.Fragment,{children:[E.jsx(I.IconButton,{onClick:f,sx:{p:.5,"&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},disabled:t&&!e,children:t&&!e?E.jsx(I.CircularProgress,{size:32}):E.jsx(I.Avatar,{src:b()||void 0,sx:{width:32,height:32,bgcolor:"#1a73e8",fontSize:"0.875rem",fontWeight:500},children:v()})}),E.jsx(I.Menu,{anchorEl:c,open:p,onClose:u,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:E.jsxs(I.Box,{children:[E.jsxs(I.Box,{sx:{px:1.5,py:1.5},children:[E.jsxs(I.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",mb:1.25},children:[E.jsx(I.Avatar,{src:b()||void 0,sx:{width:56,height:56,bgcolor:"#1a73e8",fontSize:"1.25rem",fontWeight:500,mb:1},children:v()},o?.activeAccount?.accountId||"profile-avatar"),E.jsx(I.Typography,{sx:{fontWeight:500,color:"text.primary",textAlign:"center",mb:.25,fontSize:"0.9rem"},children:m()}),E.jsx(I.Typography,{sx:{color:"text.secondary",textAlign:"center",wordBreak:"break-all",fontSize:"0.75rem"},children:a()})]}),E.jsx(I.Button,{variant:"outlined",fullWidth:!0,onClick:d,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"})]}),E.jsx(I.Divider,{sx:{my:0}}),o&&o.accounts.length>1&&E.jsxs(E.Fragment,{children:[E.jsx(I.Box,{sx:{px:.75,py:.5},children:o.accounts.filter(w=>w.accountId!==o.activeAccount?.accountId).map(w=>{const{email:T,name:C,avatar:h}=_e(w.user);return E.jsxs(I.MenuItem,{onClick:()=>{o.switchAccount(w.accountId),u()},sx:{borderRadius:1,px:1,py:.75,mb:.25,"&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[E.jsx(I.Avatar,{src:h,sx:{width:32,height:32,mr:1.5,bgcolor:"#1a73e8",fontSize:"0.875rem"},children:C.charAt(0).toUpperCase()}),E.jsxs(I.Box,{sx:{flex:1,minWidth:0},children:[E.jsx(I.Typography,{sx:{fontSize:"0.875rem",fontWeight:500,color:"text.primary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C}),E.jsx(I.Typography,{sx:{fontSize:"0.75rem",color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T})]})]},w.accountId)})}),E.jsx(I.Divider,{sx:{my:0}})]}),o&&E.jsxs(E.Fragment,{children:[E.jsxs(I.MenuItem,{onClick:()=>{o.addNewAccount(),u()},sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[E.jsx(I.ListItemIcon,{sx:{minWidth:32,mr:.5},children:E.jsx(I.Avatar,{sx:{width:24,height:24,bgcolor:"transparent",border:"1.5px solid #5f6368",color:"#5f6368",fontSize:"0.875rem"},children:"+"})}),E.jsx(I.Typography,{sx:{color:"#3c4043",fontSize:"0.8125rem"},children:"Add another account"})]}),E.jsx(I.Divider,{sx:{my:0}})]}),E.jsxs(I.MenuItem,{onClick:y,sx:{py:.75,px:1.5,fontSize:"0.8125rem","&:hover":{backgroundColor:"rgba(60, 64, 67, 0.08)"}},children:[E.jsx(I.ListItemIcon,{sx:{minWidth:32,mr:.5},children:E.jsx(Ss,{sx:{fontSize:"1rem",color:"#5f6368"}})}),E.jsx(I.Typography,{sx:{color:"#3c4043",fontSize:"0.8125rem"},children:"Sign out"})]})]})})]})}const jt="spry_profile_cache",Cs=300*1e3,xs=300*1e3;function mn(e,t={}){const{refetchInterval:r=Cs,cacheTime:n=xs,getAuthToken:o,headers:i={}}=t,[c,l]=_.useState(null),[f,u]=_.useState(!0),[y,d]=_.useState(null),p=_.useRef(null),v=_.useRef(null),m=_.useCallback(()=>{try{const w=localStorage.getItem(jt);if(!w)return null;const T=JSON.parse(w);return Date.now()-T.timestamp<n?T.profile:(localStorage.removeItem(jt),null)}catch(w){return console.error("Error loading profile from cache:",w),null}},[n]),a=_.useCallback(w=>{try{const T={profile:w,timestamp:Date.now()};localStorage.setItem(jt,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 w=null;o&&(w=await Promise.resolve(o()));const T={Accept:"application/json",...i};w&&(T.Authorization=`Bearer ${w}`);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 h=await C.json();l(h),a(h),d(null)}catch(w){if(w instanceof Error&&w.name==="AbortError")return;const T=w instanceof Error?w.message:"Failed to fetch profile";d(T),console.error("Error fetching profile:",w);const C=m();C&&l(C)}finally{u(!1)}},[e,o,i,m,a]);return _.useEffect(()=>{const w=m();return w&&(l(w),u(!1)),b(),r>0&&(p.current=window.setInterval(()=>{b()},r)),()=>{p.current&&window.clearInterval(p.current),v.current&&v.current.abort()}},[e,r,n]),{profile:c,isLoading:f,error:y,refetch:b}}function gn({apiUrl:e,onSignOut:t,onManageAccount:r,accountManager:n,...o}){const{profile:i,isLoading:c,error:l}=mn(e,o);return l&&console.error("Error loading profile:",l),E.jsx(pn,{profile:i,isLoading:c,onSignOut:t,onManageAccount:r,accountManager:n})}const Ts=ln(E.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 _s({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[p,v]=_.useState(!1),m=_.useRef(null),a=t||e;return E.jsxs(I.Stack,{direction:"row",spacing:1,alignItems:"center",children:[i&&E.jsxs(E.Fragment,{children:[E.jsx(I.IconButton,{ref:m,onClick:()=>v(!p),sx:{color:"#5f6368","&:hover":{bgcolor:"rgba(60, 64, 67, 0.08)"}},"aria-label":"Google apps",children:E.jsx(Ts,{})}),E.jsx(or,{apiUrl:e,open:p,onClose:()=>v(!1),buttonRef:m,refetchInterval:l,cacheTime:f})]}),c&&E.jsx(gn,{apiUrl:a,onSignOut:r,refetchInterval:u,cacheTime:y,getAuthToken:n,headers:o,accountManager:d})]})}var rr=_.createContext(void 0);rr.displayName="AuthContext";var Rs={isLoading:!0,isAuthenticated:!1},Os=(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}}}},Is=(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")))},$s=nr("signinCallback","Sign-in failed"),ks=nr("signoutCallback","Sign-out failed"),Ps=nr("renewSilent","Renew silent failed");function hn(e,t){return{name:Lt(e,"name",()=>"Error"),message:Lt(e,"message",()=>t),stack:Lt(e,"stack",()=>new Error().stack),innerError:e}}function nr(e,t){return r=>({...hn(r,t),source:e})}function Lt(e,t,r){if(e&&typeof e=="object"){const n=e[t];if(typeof n=="string")return n}return r()}var Ns=["clearStaleState","querySessionStatus","revokeTokens","startSilentRenew","stopSilentRenew"],Us=["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:Ye.UserManager,Ds=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(Os,Rs),p=_.useMemo(()=>Object.assign({settings:u.settings,events:u.events},Object.fromEntries(Ns.map(b=>{var w,T;return[b,(T=(w=u[b])==null?void 0:w.bind(u))!=null?T:Lr(b)]})),Object.fromEntries(Us.map(b=>[b,u[b]?async w=>{d({type:"NAVIGATOR_INIT",method:b});try{return await u[b](w)}catch(T){return d({type:"ERROR",error:{...hn(T,`Unknown error while executing ${b}(...).`),source:b,args:w}}),null}finally{d({type:"NAVIGATOR_CLOSE"})}}:Lr(b)]))),[u]),v=_.useRef(!1);_.useEffect(()=>{!u||v.current||(v.current=!0,(async()=>{try{let b=null;Is()&&!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:$s(b)})}try{if(o&&o(u.settings)){const b=await u.signoutCallback();i&&await i(b)}}catch(b){d({type:"ERROR",error:ks(b)})}})())},[u,n,r,i,o]),_.useEffect(()=>{if(!u)return;const b=h=>{d({type:"USER_LOADED",user:h})};u.events.addUserLoaded(b);const w=()=>{d({type:"USER_UNLOADED"})};u.events.addUserUnloaded(w);const T=()=>{d({type:"USER_SIGNED_OUT"})};u.events.addUserSignedOut(T);const C=h=>{d({type:"ERROR",error:Ps(h)})};return u.events.addSilentRenewError(C),()=>{u.events.removeUserLoaded(b),u.events.removeUserUnloaded(w),u.events.removeUserSignedOut(T),u.events.removeSilentRenewError(C)}},[u]);const m=_.useCallback(async()=>{await u.removeUser(),c&&await c()},[u,c]),a=_.useMemo(()=>({...y,...p,removeUser:m}),[y,p,m]);return _.createElement(rr.Provider,{value:a},t)},yn=()=>{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 Sn=_.createContext(null),Ms=()=>{typeof window>"u"||window.history.replaceState({},document.title,window.location.pathname)},js=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},Ls=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 Bs({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 Ye.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||Ms,d=n||js,p=o||(()=>Ls(l));return E.jsx(Sn.Provider,{value:{keycloakConfig:u,userManager:f,syncBridgeUrl:fn},children:E.jsx(Ds,{userManager:f,onSigninCallback:y,matchSignoutCallback:d,onSignoutCallback:p,onRemoveUser:i,skipSigninCallback:c,children:e})})}function bn(){const e=_.useContext(Sn);if(!e)throw new Error("useSpryAuthContext must be used within SpryAuthProvider");return e}function Fs(e){const t=e.profile?.email||e.profile?.sub||"unknown",r=Date.now();return`account_${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_${r}`}function ee(){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 ie(){return ee().accounts}function $e(e){try{localStorage.setItem(de.ACCOUNTS,JSON.stringify(e))}catch(t){console.error("Failed to save accounts to localStorage:",t)}}function vn(e,t=null){const r=ee(),n={accounts:e,activeAccountId:t??r.activeAccountId,lastUpdated:Date.now()};$e(n)}function Me(e){const t=ee(),r=Fs(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(),$e(t),r}function Ct(e){const t=ee();t.accounts=t.accounts.filter(r=>r.accountId!==e),t.activeAccountId===e&&(t.activeAccountId=null),t.lastUpdated=Date.now(),$e(t)}function ce(e){const t=ee();t.activeAccountId=e,t.lastUpdated=Date.now(),$e(t)}function wn(){const e=ee();return e.activeAccountId&&e.accounts.find(t=>t.accountId===e.activeAccountId)||null}function En(){return ee().activeAccountId}function An(e,t){const r=ee(),n=r.accounts.find(o=>o.accountId===e);n&&(n.user=t,n.lastUsed=Date.now(),n.isStale=!1,r.lastUpdated=Date.now(),$e(r))}function Cn(e){const t=ee(),r=t.accounts.find(n=>n.accountId===e);r&&(r.isStale=!0,t.lastUpdated=Date.now(),$e(t))}function zs(){localStorage.removeItem(de.ACCOUNTS)}function Vs(e){const r=ee().accounts.find(n=>n.accountId===e);return r?{accountId:r.accountId,lastUsed:r.lastUsed,isStale:r.isStale,createdAt:r.createdAt}:null}function it(e){e?localStorage.setItem(de.ADD_ACCOUNT_IN_PROGRESS,"true"):localStorage.removeItem(de.ADD_ACCOUNT_IN_PROGRESS)}function st(){return localStorage.getItem(de.ADD_ACCOUNT_IN_PROGRESS)==="true"}function xn(e){localStorage.setItem(de.RETURN_URL,e)}function Tn(){return localStorage.getItem(de.RETURN_URL)}function Gt(){localStorage.removeItem(de.RETURN_URL)}function _n(e){localStorage.setItem(de.TEMP_CURRENT_USER,JSON.stringify(e))}function Ws(){try{const e=localStorage.getItem(de.TEMP_CURRENT_USER);return e?JSON.parse(e):null}catch{return null}}function Yt(){localStorage.removeItem(de.TEMP_CURRENT_USER)}async function Rn(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 On(e,t,r){try{const o=ie().length===1;if(!await Hs(e,t)&&o)return console.warn("Token revocation failed for last account, falling back to redirect logout"),await In(e,t,r),{success:!0,message:"Redirecting to logout...",remainingAccounts:0};Ct(r),xt.remove(r);const c=ie(),f=c.sort((u,y)=>y.lastUsed-u.lastUsed)[0]||null;return f?(ce(f.accountId),{success:!0,message:`Logged out. Switched to ${f.user.profile?.email||f.user.profile?.sub}`,remainingAccounts:c.length}):(ce(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:ie().length}}}async function Gs(e,t){const r=e.map(n=>In(n.user,t,n.accountId).catch(o=>{console.warn(`Failed to logout ${n.accountId}:`,o)}));return await Promise.all(r),e.forEach(n=>{Ct(n.accountId),xt.remove(n.accountId)}),ce(null),{success:!0,message:"All accounts logged out.",remainingAccounts:0}}function Ys(e){Ct(e);const t=ie();if(t.length>0){const n=t.sort((o,i)=>i.lastUsed-o.lastUsed)[0];return ce(n.accountId),{success:!0,message:`Account removed locally. Switched to ${n.user.profile?.email||n.user.profile?.sub}`,remainingAccounts:t.length-1}}else return ce(null),{success:!0,message:"Account removed. No other accounts available.",remainingAccounts:0}}async function Ks(e,t){try{return new Ye.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 Ye.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 qs{pool=new Map;async getOrCreate(t,r){if(!this.pool.has(r)){const o=await Ks(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 xt=new qs;async function at(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 An(e,c),c}catch(o){return console.warn(`${me.TOKEN_REFRESH_FAILED} (${e}):`,o),null}}async function Fr(e,t){try{await(await xt.getOrCreate(e,t)).signinRedirect()}catch(r){throw console.error(me.SIGNIN_REDIRECT_FAILED,r),r}}async function Hs(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 In(e,t,r){try{await(await xt.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 $n(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),p=_.useRef(!1),v=_.useRef(null),m=_.useCallback(h=>{const g=h.accounts;let A=h.activeAccountId;A&&!g.find(N=>N.accountId===A)&&(A=g[0]?.accountId||null);const k=f!==A;if(l(g),u(A),k&&A){const N=g.find(P=>P.accountId===A);N&&(console.log("🔄 Active account changed, calling onAccountSwitch:",N.user.profile?.email),n(N.user))}},[n,f]);_.useEffect(()=>{!i||p.current||(p.current=!0,i.getAccountsState().then(h=>{if(!h||!h.accounts.length)return;const g=ee();if(h.lastUpdated&&g.lastUpdated&&h.lastUpdated<=g.lastUpdated){console.log("🔄 Local state is newer than bridge, skipping bridge merge"),i.setAccountsState(g);return}console.log("🔄 Bridge state is newer, merging with local state"),h.accounts.forEach(k=>{Me(k.user)}),h.activeAccountId&&ce(h.activeAccountId);const A=ee();m(A)}))},[m,i]),_.useEffect(()=>{if(d.current)return;if(st())if(console.log("🔄 Detected redirect callback for add account flow"),r){const g=ie(),A=r.profile?.sub,k=r.profile?.email;if(g.some(M=>A&&M.user.profile?.sub?M.user.profile.sub===A:k&&M.user.profile?.email?M.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=Me(r);console.log(`✅ Added new account: ${P}`),ce(P),it(!1);const s=Tn();Yt(),Gt();const $=ee();l($.accounts),u(P),i&&i.setAccountsState($),n(r),console.log("✅ Account switch completed"),setTimeout(()=>{const F=ie().find(se=>se.accountId===P);F&&(n(F.user),console.log("✅ Second account switch completed (auto-retry)"))},100),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 h=async()=>!(localStorage.getItem("spry_add_account_pending")!=="1"||d.current);let g=0;for(;g<10&&!await h();)await new Promise(A=>setTimeout(A,150)),g++;if(await h())if(localStorage.removeItem("spry_add_account_pending"),console.log("🔄 Soft-logout completed, initiating signinRedirect..."),o)o().catch(A=>{console.error("signinRedirect failed:",A)});else{const A=`temp_add_${Date.now()}`;Fr(t,A).catch(k=>{console.error("signinRedirectForNewAccount failed:",k)})}})()},[t,o]),_.useEffect(()=>{if(!y.current&&!d.current){y.current=!0;try{const h=ee();let g=h.accounts,A=h.activeAccountId;if(g.length===0&&r){const k=Me(r);g=ie(),A=k,ce(k)}A&&!g.find(k=>k.accountId===A)&&(A=g[0]?.accountId||null,A&&ce(A)),m({accounts:g,activeAccountId:A,lastUpdated:h.lastUpdated}),i&&i.setAccountsState({accounts:g,activeAccountId:A,lastUpdated:h.lastUpdated}),console.log(`📦 Loaded ${g.length} accounts from localStorage`)}catch(h){const g=h instanceof Error?h.message:"Unknown initialization error";console.error("Failed to initialize account manager:",g)}}},[m,r,n,i]),_.useEffect(()=>{if(d.current||!r||ee().accounts.length>0||st())return;const g=Me(r);ce(g);const A=ee();m(A),i&&i.setAccountsState(A),console.log("✅ Seeded initial account after auth became available")},[m,r,n,i]),_.useEffect(()=>{if(!r||d.current||st())return;const h=ie(),g=r.profile?.sub,A=r.profile?.email;if(h.some(s=>g&&s.user.profile?.sub?s.user.profile.sub===g:A&&s.user.profile?.email?s.user.profile.email===A:!1))return;const N=Me(r);ce(N);const P=ee();m(P),i&&i.setAccountsState(P),console.log("✅ Added account from auth state update")},[m,r,n,i]),_.useEffect(()=>{const h=g=>{if(g.key==="spry_accounts"){console.log("🔄 Detected cross-tab localStorage change, reloading accounts...");const A=ee();m(A)}};return window.addEventListener("storage",h),()=>{window.removeEventListener("storage",h)}},[m]);const a=_.useCallback(async h=>{try{const A=ie().find(N=>N.accountId===h);if(!A){console.error(me.ACCOUNT_NOT_FOUND);return}const k=v.current===h;At(A.user.access_token)&&(console.warn("Access token expired for account:",h),Cn(h)),ce(h),u(h),await n(A.user),i&&await i.setAccountsState(ee()),console.log(`✅ Switched to account: ${A.user.profile?.email||h}`),k?v.current=null:(v.current=h,setTimeout(async()=>{if(v.current===h){const P=ie().find(s=>s.accountId===h);P&&(ce(h),u(h),await n(P.user),i&&await i.setAccountsState(ee())),v.current=null}},100))}catch(g){const A=g instanceof Error?g.message:"Failed to switch account";console.error(A,g),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&&_n(r),it(!0),localStorage.setItem("spry_add_account_pending","1"),xn(window.location.href),console.log("🔄 Clearing SSO session..."),await Rn(r||null,t),await new Promise(h=>setTimeout(h,1200)),console.log(un.REDIRECT_IN_PROGRESS),o)await o();else{const h=`temp_add_${Date.now()}`;await Fr(t,h)}}catch(h){const g=h instanceof Error?h.message:"Failed to add new account";console.error(g,h),it(!1),Gt(),Yt(),localStorage.removeItem("spry_add_account_pending")}},[t,r]),w=_.useCallback(async h=>{try{const A=ie().find(P=>P.accountId===h);if(!A){console.error(me.ACCOUNT_NOT_FOUND);return}const k=await On(A.user,t,h);k.success||console.warn("Keycloak logout failed, but account removed locally:",k.message);const N=ee();m(N),i&&i.setAccountsState(N),setTimeout(()=>{const P=ee();m(P),i&&i.setAccountsState(P),console.log("✅ Second removal sync completed (auto-retry)")},100)}catch(g){const A=g instanceof Error?g.message:"Failed to remove account";console.error(A,g)}},[t,m,i]),T=_.useCallback(async h=>{try{const A=ie().find(P=>P.accountId===h);if(!A){console.error(me.ACCOUNT_NOT_FOUND);return}if(!await at(h,A.user,t)){console.error(`No refreshed user returned for ${h}`);return}const N=ee();m(N),i&&i.setAccountsState(N)}catch(g){const A=g instanceof Error?g.message:"Failed to refresh token";console.error(A,g)}},[t,m,i]);_.useEffect(()=>{const h=()=>{const g=c.map(k=>({...k,isStale:dn(k)}));g.some((k,N)=>k.isStale!==c[N]?.isStale)&&(vn(g),l(g))};c.length>0&&h()},[c]);const C=f&&c.find(h=>h.accountId===f)||null;return{accounts:c,activeAccount:C,switchAccount:a,addNewAccount:b,removeAccount:w,refreshAccountToken:T}}const Js=2e3,Bt=new Map;function Xs(e){if(!e?.bridgeUrl||typeof window>"u"||typeof document>"u")return null;if(Bt.has(e.bridgeUrl))return Bt.get(e.bridgeUrl)||null;const t=e.bridgeUrl,r=new URL(t).origin,n=e.timeoutMs??Js;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 h=()=>{if(i=!0,d()){A(),T();return}A(),C(new Error("Bridge iframe did not load the expected origin"))},g=()=>{A(),C(new Error("Bridge iframe failed to load"))},A=()=>{o?.removeEventListener("load",h),o?.removeEventListener("error",g),c=null};o.addEventListener("load",h),o.addEventListener("error",g)}),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}},p=T=>{if(T.origin!==r)return;const C=T.data;if(!C||typeof C!="object")return;const h=C.requestId;if(!h||typeof h!="string")return;const g=f.get(h);if(g){if(f.delete(h),window.clearTimeout(g.timeoutId),C.type==="ERROR"){g.reject(new Error(C.error||"Bridge error"));return}g.resolve(C.payload??null)}},v=(T,C,h)=>h?a(T,C):b().then(()=>a(T,C)),m=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}_${Math.random().toString(16).slice(2)}`,a=(T,C)=>y().then(()=>new Promise((h,g)=>{const A=m(),k=window.setTimeout(()=>{f.delete(A),g(new Error(`Bridge request timed out: ${T}`))},n);f.set(A,{resolve:h,reject:g,timeoutId:k});try{o?.contentWindow?.postMessage({type:T,requestId:A,payload:C},"*")}catch{f.delete(A),window.clearTimeout(k),g(new Error("Bridge postMessage failed"))}})),b=()=>l||(l=v("PING",null,!0).then(()=>{}).catch(T=>{throw l=null,T}),l);window.addEventListener("message",p);const w={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 Bt.set(t,w),w}function Qs(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 ze(e){const t=Math.floor(Date.now()/1e3),r=e.expires_in?t+e.expires_in:void 0;return new Ye.User({...e,token_type:"Bearer",profile:e.profile||{sub:""},expires_at:r})}function Zs(){const e=yn(),{keycloakConfig:t,userManager:r,syncBridgeUrl:n}=bn(),o=_.useRef(!1),i=_.useMemo(()=>Xs(n?{bridgeUrl:n}:null),[n]),c=$n({keycloakConfig:t,initialUser:Qs(e.user),signinRedirect:e.signinRedirect,syncBridge:i,onAccountSwitch:async f=>{let u=f;const y=ie(),d=f.profile?.sub,p=f.profile?.email,v=y.find(a=>d&&a.user.profile?.sub?a.user.profile.sub===d:p&&a.user.profile?.email?a.user.profile.email===p:!1);if(v&&f.refresh_token){const a=await at(v.accountId,f,t);a&&(u=a)}const m=ze(u);await r.storeUser(m),await r.events.load(m),window.dispatchEvent(new CustomEvent("auth:account-switched",{detail:{user:u}}))}});_.useEffect(()=>{if(o.current||e.isLoading||e.activeNavigator)return;const f=wn();if(!f)return;const u=e.user?.profile?.sub,y=f.user.profile?.sub;if(u&&y&&u===y){o.current=!0;return}o.current=!0,(async()=>{let p=f.user;if(p.refresh_token){const m=await at(f.accountId,p,t);m&&(p=m)}const v=ze(p);await r.storeUser(v),await r.events.load(v),console.log("✅ Restored active account from localStorage:",y)})().catch(p=>{console.log("Restore from stored account failed:",p)})},[c.accounts.length,e,t,r]);const l=_.useCallback(async f=>{await c.removeAccount(f);const u=En();if(u){const d=ie().find(p=>p.accountId===u);if(d){console.log("🔄 Switching to remaining account after removal:",d.user.profile?.email);let p=d.user;if(p.refresh_token){const m=await at(u,p,t);m&&(p=m)}const v=ze(p);await r.storeUser(v),await r.events.load(v),window.dispatchEvent(new CustomEvent("auth:account-switched",{detail:{user:p}})),setTimeout(async()=>{const a=ie().find(b=>b.accountId===u);a&&(await r.storeUser(ze(a.user)),await r.events.load(ze(a.user)),console.log("✅ Second switch to remaining account completed (auto-retry)"))},100)}}else await r.removeUser(),setTimeout(async()=>{await r.removeUser(),console.log("✅ Second removeUser completed (auto-retry)")},100)},[c,r,t]);return _.useMemo(()=>({...c,removeAccount:l}),[c,l])}function ea(){return yn()}function ta({account:e,isActive:t,isLoading:r,onSwitch:n,onRemove:o,onRefresh:i}){const{email:c,name:l,avatar:f}=_e(e.user),[u,y]=_.useState(!1),[d,p]=_.useState(!1),v=async b=>{b.stopPropagation(),y(!0);try{await o()}finally{y(!1)}},m=async b=>{b.stopPropagation(),p(!0);try{await i()}finally{p(!1)}},a=async()=>{r||await n()};return E.jsx(_.Fragment,{children:E.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:[E.jsx(I.ListItemIcon,{children:E.jsx(I.Avatar,{src:f,alt:l,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:"0.875rem"},children:l.charAt(0).toUpperCase()})}),E.jsx(I.ListItemText,{primary:E.jsxs(I.Box,{display:"flex",alignItems:"center",gap:1,children:[E.jsx("span",{children:l}),t&&E.jsx(I.Chip,{label:"Active",size:"small",color:"primary",variant:"outlined",sx:{height:20}}),e.isStale&&!t&&E.jsx(I.Chip,{label:"Stale",size:"small",color:"warning",variant:"filled",sx:{height:20}})]}),secondary:c,secondaryTypographyProps:{noWrap:!0}}),!t&&E.jsxs(I.ListItemSecondaryAction,{children:[e.isStale&&E.jsx(I.IconButton,{edge:"end",size:"small",onClick:m,disabled:d||r,title:"Re-authenticate this account",children:d?E.jsx(I.CircularProgress,{size:20}):E.jsx(Ft.Refresh,{fontSize:"small"})}),E.jsx(I.IconButton,{edge:"end",size:"small",onClick:v,disabled:u||r,title:"Remove this account",children:u?E.jsx(I.CircularProgress,{size:20}):E.jsx(Ft.Close,{fontSize:"small"})})]})]})},e.accountId)}const kn=_.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 E.jsx(I.Box,{ref:l,sx:{width:"100%",maxWidth:360,bgcolor:"background.paper"},children:e.length===0?E.jsxs(I.Box,{sx:{p:2,textAlign:"center"},children:[E.jsx(I.Typography,{variant:"body2",color:"textSecondary",sx:{mb:2},children:"No additional accounts logged in"}),E.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"})]}):E.jsxs(E.Fragment,{children:[E.jsx(I.List,{children:e.map(d=>E.jsx(ta,{account:d,isActive:d.accountId===t,isLoading:r,onSwitch:()=>n(d.accountId),onRemove:()=>i(d.accountId),onRefresh:()=>c(d.accountId)},d.accountId))}),E.jsx(I.Divider,{sx:{my:1}}),E.jsx(I.Box,{sx:{p:1},children:E.jsxs(I.ListItemButton,{onClick:y,disabled:f||r,sx:{justifyContent:"center",py:1},children:[E.jsx(Ft.Add,{sx:{mr:1},fontSize:"small"}),E.jsx(I.Typography,{variant:"button",sx:{fontSize:"0.875rem"},children:f?"Adding...":"Add Another Account"})]})})]})})});kn.displayName="AccountList";function or({apiUrl:e,open:t,onClose:r,buttonRef:n,refetchInterval:o,cacheTime:i}){const{apps:c,isLoading:l,error:f,refetch:u}=Vr(e,{refetchInterval:o,cacheTime:i});return E.jsx(zr,{apps:c,open:t,onClose:r,buttonRef:n,isLoading:l,error:f,onRetry:u})}exports.AccountList=kn;exports.AppsDropdown=zr;exports.AppsDropdownConnected=or;exports.ERROR_MESSAGES=me;exports.INFO_MESSAGES=un;exports.ProfileMenu=pn;exports.ProfileMenuConnected=gn;exports.STORAGE_KEYS=de;exports.SYNC_BRIDGE_URL=fn;exports.SpryAuthProvider=Bs;exports.TOKEN_VALIDATION=Je;exports.TopBar=_s;exports.addAccount=Me;exports.clearAllAccounts=zs;exports.clearReturnUrl=Gt;exports.clearSSOSessionBeforeAddAccount=Rn;exports.clearTempCurrentUser=Yt;exports.decodeToken=Be;exports.default=or;exports.extractUserInfo=_e;exports.getAccountMetadata=Vs;exports.getAccounts=ie;exports.getAccountsState=ee;exports.getActiveAccount=wn;exports.getActiveAccountId=En;exports.getReturnUrl=Tn;exports.getTempCurrentUser=Ws;exports.getTokenExpiryTime=bs;exports.getTokenTimeRemaining=vs;exports.isAccessTokenValid=As;exports.isAccountStale=dn;exports.isAddAccountInProgress=st;exports.isRefreshTokenExpired=tr;exports.isTokenExpired=At;exports.logoutAccount=On;exports.logoutAccountLocally=Ys;exports.logoutAllAccounts=Gs;exports.markAccountStale=Cn;exports.removeAccount=Ct;exports.saveAccounts=vn;exports.saveAccountsState=$e;exports.saveTempCurrentUser=_n;exports.setActiveAccount=ce;exports.setAddAccountInProgress=it;exports.setReturnUrl=xn;exports.shouldRefreshAccessToken=ws;exports.shouldRefreshRefreshToken=Es;exports.updateAccountTokens=An;exports.useAccountManager=$n;exports.useAppsData=Vr;exports.useProfileData=mn;exports.useSpryAccountManager=Zs;exports.useSpryAuth=ea;exports.useSpryAuthContext=bn;
|
|
35
35
|
//# sourceMappingURL=index.cjs.map
|