@realtimex/email-automator 2.4.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/src/routes/emails.ts +45 -2
- package/api/src/services/eventLogger.ts +10 -2
- package/api/src/services/gmail.ts +53 -166
- package/api/src/services/intelligence.ts +3 -2
- package/api/src/services/microsoft.ts +34 -29
- package/api/src/services/processor.ts +376 -106
- package/api/src/services/storage.ts +88 -0
- package/api/src/services/supabase.ts +6 -0
- package/api/src/utils/contentCleaner.ts +11 -6
- package/dist/api/src/routes/emails.js +33 -3
- package/dist/api/src/services/eventLogger.js +12 -2
- package/dist/api/src/services/gmail.js +49 -138
- package/dist/api/src/services/intelligence.js +3 -2
- package/dist/api/src/services/microsoft.js +28 -18
- package/dist/api/src/services/processor.js +335 -96
- package/dist/api/src/services/storage.js +81 -0
- package/dist/api/src/utils/contentCleaner.js +10 -6
- package/dist/assets/index-BaETRzrd.js +97 -0
- package/dist/assets/index-Bi5YqX3d.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +3 -1
- package/supabase/functions/api-v1-accounts/index.ts +28 -7
- package/supabase/functions/api-v1-emails/index.ts +9 -1
- package/supabase/migrations/20260118000001_async_etl_storage.sql +24 -0
- package/dist/assets/index-BFNHevFw.css +0 -1
- package/dist/assets/index-BbSMDtp3.js +0 -97
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
function tx(n,a){for(var r=0;r<a.length;r++){const l=a[r];if(typeof l!="string"&&!Array.isArray(l)){for(const c in l)if(c!=="default"&&!(c in n)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(n,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();function Fd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ld={exports:{}},_i={};var og;function ax(){if(og)return _i;og=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(l,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:n,type:l,key:h,ref:c!==void 0?c:null,props:d}}return _i.Fragment=a,_i.jsx=r,_i.jsxs=r,_i}var cg;function nx(){return cg||(cg=1,ld.exports=ax()),ld.exports}var o=nx(),od={exports:{}},ve={};var ug;function sx(){if(ug)return ve;ug=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),x=Symbol.iterator;function S(T){return T===null||typeof T!="object"?null:(T=x&&T[x]||T["@@iterator"],typeof T=="function"?T:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,k={};function O(T,V,Y){this.props=T,this.context=V,this.refs=k,this.updater=Y||A}O.prototype.isReactComponent={},O.prototype.setState=function(T,V){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,V,"setState")},O.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function q(){}q.prototype=O.prototype;function B(T,V,Y){this.props=T,this.context=V,this.refs=k,this.updater=Y||A}var G=B.prototype=new q;G.constructor=B,j(G,O.prototype),G.isPureReactComponent=!0;var ee=Array.isArray;function J(){}var P={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ue(T,V,Y){var F=Y.ref;return{$$typeof:n,type:T,key:V,ref:F!==void 0?F:null,props:Y}}function Je(T,V){return ue(T.type,V,T.props)}function be(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function ge(T){var V={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(Y){return V[Y]})}var Ze=/\/+/g;function nt(T,V){return typeof T=="object"&&T!==null&&T.key!=null?ge(""+T.key):V.toString(36)}function Z(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(J,J):(T.status="pending",T.then(function(V){T.status==="pending"&&(T.status="fulfilled",T.value=V)},function(V){T.status==="pending"&&(T.status="rejected",T.reason=V)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function z(T,V,Y,F,de){var ye=typeof T;(ye==="undefined"||ye==="boolean")&&(T=null);var fe=!1;if(T===null)fe=!0;else switch(ye){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(T.$$typeof){case n:case a:fe=!0;break;case v:return fe=T._init,z(fe(T._payload),V,Y,F,de)}}if(fe)return de=de(T),fe=F===""?"."+nt(T,0):F,ee(de)?(Y="",fe!=null&&(Y=fe.replace(Ze,"$&/")+"/"),z(de,V,Y,"",function(Tt){return Tt})):de!=null&&(be(de)&&(de=Je(de,Y+(de.key==null||T&&T.key===de.key?"":(""+de.key).replace(Ze,"$&/")+"/")+fe)),V.push(de)),1;fe=0;var Ge=F===""?".":F+":";if(ee(T))for(var Be=0;Be<T.length;Be++)F=T[Be],ye=Ge+nt(F,Be),fe+=z(F,V,Y,ye,de);else if(Be=S(T),typeof Be=="function")for(T=Be.call(T),Be=0;!(F=T.next()).done;)F=F.value,ye=Ge+nt(F,Be++),fe+=z(F,V,Y,ye,de);else if(ye==="object"){if(typeof T.then=="function")return z(Z(T),V,Y,F,de);throw V=String(T),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return fe}function Q(T,V,Y){if(T==null)return T;var F=[],de=0;return z(T,F,"","",function(ye){return V.call(Y,ye,de++)}),F}function K(T){if(T._status===-1){var V=T._result;V=V(),V.then(function(Y){(T._status===0||T._status===-1)&&(T._status=1,T._result=Y)},function(Y){(T._status===0||T._status===-1)&&(T._status=2,T._result=Y)}),T._status===-1&&(T._status=0,T._result=V)}if(T._status===1)return T._result.default;throw T._result}var Se=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},Oe={map:Q,forEach:function(T,V,Y){Q(T,function(){V.apply(this,arguments)},Y)},count:function(T){var V=0;return Q(T,function(){V++}),V},toArray:function(T){return Q(T,function(V){return V})||[]},only:function(T){if(!be(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return ve.Activity=_,ve.Children=Oe,ve.Component=O,ve.Fragment=r,ve.Profiler=c,ve.PureComponent=B,ve.StrictMode=l,ve.Suspense=p,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,ve.__COMPILER_RUNTIME={__proto__:null,c:function(T){return P.H.useMemoCache(T)}},ve.cache=function(T){return function(){return T.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(T,V,Y){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var F=j({},T.props),de=T.key;if(V!=null)for(ye in V.key!==void 0&&(de=""+V.key),V)!X.call(V,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&V.ref===void 0||(F[ye]=V[ye]);var ye=arguments.length-2;if(ye===1)F.children=Y;else if(1<ye){for(var fe=Array(ye),Ge=0;Ge<ye;Ge++)fe[Ge]=arguments[Ge+2];F.children=fe}return ue(T.type,de,F)},ve.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:d,_context:T},T},ve.createElement=function(T,V,Y){var F,de={},ye=null;if(V!=null)for(F in V.key!==void 0&&(ye=""+V.key),V)X.call(V,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(de[F]=V[F]);var fe=arguments.length-2;if(fe===1)de.children=Y;else if(1<fe){for(var Ge=Array(fe),Be=0;Be<fe;Be++)Ge[Be]=arguments[Be+2];de.children=Ge}if(T&&T.defaultProps)for(F in fe=T.defaultProps,fe)de[F]===void 0&&(de[F]=fe[F]);return ue(T,ye,de)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(T){return{$$typeof:m,render:T}},ve.isValidElement=be,ve.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:K}},ve.memo=function(T,V){return{$$typeof:g,type:T,compare:V===void 0?null:V}},ve.startTransition=function(T){var V=P.T,Y={};P.T=Y;try{var F=T(),de=P.S;de!==null&&de(Y,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(J,Se)}catch(ye){Se(ye)}finally{V!==null&&Y.types!==null&&(V.types=Y.types),P.T=V}},ve.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},ve.use=function(T){return P.H.use(T)},ve.useActionState=function(T,V,Y){return P.H.useActionState(T,V,Y)},ve.useCallback=function(T,V){return P.H.useCallback(T,V)},ve.useContext=function(T){return P.H.useContext(T)},ve.useDebugValue=function(){},ve.useDeferredValue=function(T,V){return P.H.useDeferredValue(T,V)},ve.useEffect=function(T,V){return P.H.useEffect(T,V)},ve.useEffectEvent=function(T){return P.H.useEffectEvent(T)},ve.useId=function(){return P.H.useId()},ve.useImperativeHandle=function(T,V,Y){return P.H.useImperativeHandle(T,V,Y)},ve.useInsertionEffect=function(T,V){return P.H.useInsertionEffect(T,V)},ve.useLayoutEffect=function(T,V){return P.H.useLayoutEffect(T,V)},ve.useMemo=function(T,V){return P.H.useMemo(T,V)},ve.useOptimistic=function(T,V){return P.H.useOptimistic(T,V)},ve.useReducer=function(T,V,Y){return P.H.useReducer(T,V,Y)},ve.useRef=function(T){return P.H.useRef(T)},ve.useState=function(T){return P.H.useState(T)},ve.useSyncExternalStore=function(T,V,Y){return P.H.useSyncExternalStore(T,V,Y)},ve.useTransition=function(){return P.H.useTransition()},ve.version="19.2.3",ve}var dg;function Wd(){return dg||(dg=1,od.exports=sx()),od.exports}var w=Wd();const hy=Fd(w),ef=tx({__proto__:null,default:hy},[w]);var cd={exports:{}},Si={},ud={exports:{}},dd={};var fg;function rx(){return fg||(fg=1,(function(n){function a(z,Q){var K=z.length;z.push(Q);e:for(;0<K;){var Se=K-1>>>1,Oe=z[Se];if(0<c(Oe,Q))z[Se]=Q,z[K]=Oe,K=Se;else break e}}function r(z){return z.length===0?null:z[0]}function l(z){if(z.length===0)return null;var Q=z[0],K=z.pop();if(K!==Q){z[0]=K;e:for(var Se=0,Oe=z.length,T=Oe>>>1;Se<T;){var V=2*(Se+1)-1,Y=z[V],F=V+1,de=z[F];if(0>c(Y,K))F<Oe&&0>c(de,Y)?(z[Se]=de,z[F]=K,Se=F):(z[Se]=Y,z[V]=K,Se=V);else if(F<Oe&&0>c(de,K))z[Se]=de,z[F]=K,Se=F;else break e}}return Q}function c(z,Q){var K=z.sortIndex-Q.sortIndex;return K!==0?K:z.id-Q.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var p=[],g=[],v=1,_=null,x=3,S=!1,A=!1,j=!1,k=!1,O=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function G(z){for(var Q=r(g);Q!==null;){if(Q.callback===null)l(g);else if(Q.startTime<=z)l(g),Q.sortIndex=Q.expirationTime,a(p,Q);else break;Q=r(g)}}function ee(z){if(j=!1,G(z),!A)if(r(p)!==null)A=!0,J||(J=!0,ge());else{var Q=r(g);Q!==null&&Z(ee,Q.startTime-z)}}var J=!1,P=-1,X=5,ue=-1;function Je(){return k?!0:!(n.unstable_now()-ue<X)}function be(){if(k=!1,J){var z=n.unstable_now();ue=z;var Q=!0;try{e:{A=!1,j&&(j=!1,q(P),P=-1),S=!0;var K=x;try{t:{for(G(z),_=r(p);_!==null&&!(_.expirationTime>z&&Je());){var Se=_.callback;if(typeof Se=="function"){_.callback=null,x=_.priorityLevel;var Oe=Se(_.expirationTime<=z);if(z=n.unstable_now(),typeof Oe=="function"){_.callback=Oe,G(z),Q=!0;break t}_===r(p)&&l(p),G(z)}else l(p);_=r(p)}if(_!==null)Q=!0;else{var T=r(g);T!==null&&Z(ee,T.startTime-z),Q=!1}}break e}finally{_=null,x=K,S=!1}Q=void 0}}finally{Q?ge():J=!1}}}var ge;if(typeof B=="function")ge=function(){B(be)};else if(typeof MessageChannel<"u"){var Ze=new MessageChannel,nt=Ze.port2;Ze.port1.onmessage=be,ge=function(){nt.postMessage(null)}}else ge=function(){O(be,0)};function Z(z,Q){P=O(function(){z(n.unstable_now())},Q)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<z?Math.floor(1e3/z):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(z){switch(x){case 1:case 2:case 3:var Q=3;break;default:Q=x}var K=x;x=Q;try{return z()}finally{x=K}},n.unstable_requestPaint=function(){k=!0},n.unstable_runWithPriority=function(z,Q){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var K=x;x=z;try{return Q()}finally{x=K}},n.unstable_scheduleCallback=function(z,Q,K){var Se=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Se+K:Se):K=Se,z){case 1:var Oe=-1;break;case 2:Oe=250;break;case 5:Oe=1073741823;break;case 4:Oe=1e4;break;default:Oe=5e3}return Oe=K+Oe,z={id:v++,callback:Q,priorityLevel:z,startTime:K,expirationTime:Oe,sortIndex:-1},K>Se?(z.sortIndex=K,a(g,z),r(p)===null&&z===r(g)&&(j?(q(P),P=-1):j=!0,Z(ee,K-Se))):(z.sortIndex=Oe,a(p,z),A||S||(A=!0,J||(J=!0,ge()))),z},n.unstable_shouldYield=Je,n.unstable_wrapCallback=function(z){var Q=x;return function(){var K=x;x=Q;try{return z.apply(this,arguments)}finally{x=K}}}})(dd)),dd}var hg;function ix(){return hg||(hg=1,ud.exports=rx()),ud.exports}var fd={exports:{}},At={};var mg;function lx(){if(mg)return At;mg=1;var n=Wd();function a(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)g+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(a(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(p,g,v){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:_==null?null:""+_,children:p,containerInfo:g,implementation:v}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return At.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,At.createPortal=function(p,g){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(a(299));return d(p,g,null,v)},At.flushSync=function(p){var g=h.T,v=l.p;try{if(h.T=null,l.p=2,p)return p()}finally{h.T=g,l.p=v,l.d.f()}},At.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,l.d.C(p,g))},At.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},At.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var v=g.as,_=m(v,g.crossOrigin),x=typeof g.integrity=="string"?g.integrity:void 0,S=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;v==="style"?l.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:_,integrity:x,fetchPriority:S}):v==="script"&&l.d.X(p,{crossOrigin:_,integrity:x,fetchPriority:S,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},At.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var v=m(g.as,g.crossOrigin);l.d.M(p,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&l.d.M(p)},At.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var v=g.as,_=m(v,g.crossOrigin);l.d.L(p,v,{crossOrigin:_,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},At.preloadModule=function(p,g){if(typeof p=="string")if(g){var v=m(g.as,g.crossOrigin);l.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else l.d.m(p)},At.requestFormReset=function(p){l.d.r(p)},At.unstable_batchedUpdates=function(p,g){return p(g)},At.useFormState=function(p,g,v){return h.H.useFormState(p,g,v)},At.useFormStatus=function(){return h.H.useHostTransitionStatus()},At.version="19.2.3",At}var pg;function my(){if(pg)return fd.exports;pg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),fd.exports=lx(),fd.exports}var gg;function ox(){if(gg)return Si;gg=1;var n=ix(),a=Wd(),r=my();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(d(e)!==e)throw Error(l(188))}function g(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var s=e,i=t;;){var u=s.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){s=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===s)return p(u),e;if(f===i)return p(u),t;f=f.sibling}throw Error(l(188))}if(s.return!==i.return)s=u,i=f;else{for(var y=!1,b=u.child;b;){if(b===s){y=!0,s=u,i=f;break}if(b===i){y=!0,i=u,s=f;break}b=b.sibling}if(!y){for(b=f.child;b;){if(b===s){y=!0,s=f,i=u;break}if(b===i){y=!0,i=f,s=u;break}b=b.sibling}if(!y)throw Error(l(189))}}if(s.alternate!==i)throw Error(l(190))}if(s.tag!==3)throw Error(l(188));return s.stateNode.current===s?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var _=Object.assign,x=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),B=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ue=Symbol.for("react.activity"),Je=Symbol.for("react.memo_cache_sentinel"),be=Symbol.iterator;function ge(e){return e===null||typeof e!="object"?null:(e=be&&e[be]||e["@@iterator"],typeof e=="function"?e:null)}var Ze=Symbol.for("react.client.reference");function nt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ze?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case O:return"Profiler";case k:return"StrictMode";case ee:return"Suspense";case J:return"SuspenseList";case ue:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case B:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return t=e.displayName||null,t!==null?t:nt(e.type)||"Memo";case X:t=e._payload,e=e._init;try{return nt(e(t))}catch{}}return null}var Z=Array.isArray,z=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Se=[],Oe=-1;function T(e){return{current:e}}function V(e){0>Oe||(e.current=Se[Oe],Se[Oe]=null,Oe--)}function Y(e,t){Oe++,Se[Oe]=e.current,e.current=t}var F=T(null),de=T(null),ye=T(null),fe=T(null);function Ge(e,t){switch(Y(ye,t),Y(de,e),Y(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Op(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Op(t),e=Rp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(F),Y(F,e)}function Be(){V(F),V(de),V(ye)}function Tt(e){e.memoizedState!==null&&Y(fe,e);var t=F.current,s=Rp(t,e.type);t!==s&&(Y(de,e),Y(F,s))}function yt(e){de.current===e&&(V(F),V(de)),fe.current===e&&(V(fe),vi._currentValue=K)}var vt,os;function ia(e){if(vt===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);vt=t&&t[1]||"",os=-1<s.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+vt+e+os}var cs=!1;function us(e,t){if(!e||cs)return"";cs=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(L){var M=L}Reflect.construct(e,[],I)}else{try{I.call()}catch(L){M=L}e.call(I.prototype)}}else{try{throw Error()}catch(L){M=L}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(L){if(L&&M&&typeof L.stack=="string")return[L.stack,M.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=i.DetermineComponentFrameRoot(),y=f[0],b=f[1];if(y&&b){var N=y.split(`
|
|
4
|
+
`),D=b.split(`
|
|
5
|
+
`);for(u=i=0;i<N.length&&!N[i].includes("DetermineComponentFrameRoot");)i++;for(;u<D.length&&!D[u].includes("DetermineComponentFrameRoot");)u++;if(i===N.length||u===D.length)for(i=N.length-1,u=D.length-1;1<=i&&0<=u&&N[i]!==D[u];)u--;for(;1<=i&&0<=u;i--,u--)if(N[i]!==D[u]){if(i!==1||u!==1)do if(i--,u--,0>u||N[i]!==D[u]){var $=`
|
|
6
|
+
`+N[i].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=i&&0<=u);break}}}finally{cs=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?ia(s):""}function Ki(e,t){switch(e.tag){case 26:case 27:case 5:return ia(e.type);case 16:return ia("Lazy");case 13:return e.child!==t&&t!==null?ia("Suspense Fallback"):ia("Suspense");case 19:return ia("SuspenseList");case 0:case 15:return us(e.type,!1);case 11:return us(e.type.render,!1);case 1:return us(e.type,!0);case 31:return ia("Activity");default:return""}}function Or(e){try{var t="",s=null;do t+=Ki(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
|
|
7
|
+
Error generating stack: `+i.message+`
|
|
8
|
+
`+i.stack}}var Rn=Object.prototype.hasOwnProperty,en=n.unstable_scheduleCallback,ds=n.unstable_cancelCallback,Yi=n.unstable_shouldYield,Ji=n.unstable_requestPaint,mt=n.unstable_now,fs=n.unstable_getCurrentPriorityLevel,Xi=n.unstable_ImmediatePriority,Qi=n.unstable_UserBlockingPriority,hs=n.unstable_NormalPriority,Po=n.unstable_LowPriority,Zi=n.unstable_IdlePriority,Ko=n.log,Yo=n.unstable_setDisableYieldValue,Dn=null,Ct=null;function pa(e){if(typeof Ko=="function"&&Yo(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Dn,e)}catch{}}var kt=Math.clz32?Math.clz32:Xo,Jo=Math.log,Fi=Math.LN2;function Xo(e){return e>>>=0,e===0?32:31-(Jo(e)/Fi|0)|0}var ms=256,ps=262144,gs=4194304;function Aa(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function U(e,t,s){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~f,i!==0?u=Aa(i):(y&=b,y!==0?u=Aa(y):s||(s=b&~e,s!==0&&(u=Aa(s))))):(b=i&~f,b!==0?u=Aa(b):y!==0?u=Aa(y):s||(s=i&~e,s!==0&&(u=Aa(s)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,s=t&-t,f>=s||f===32&&(s&4194048)!==0)?t:u}function te(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Me(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ga(){var e=gs;return gs<<=1,(gs&62914560)===0&&(gs=4194304),e}function Rr(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function tn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ys(e,t,s,i,u,f){var y=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var b=e.entanglements,N=e.expirationTimes,D=e.hiddenUpdates;for(s=y&~s;0<s;){var $=31-kt(s),I=1<<$;b[$]=0,N[$]=-1;var M=D[$];if(M!==null)for(D[$]=null,$=0;$<M.length;$++){var L=M[$];L!==null&&(L.lane&=-536870913)}s&=~I}i!==0&&Wi(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function Wi(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-kt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|s&261930}function el(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-kt(s),u=1<<i;u&t|e[i]&t&&(e[i]|=t),s&=~u}}function pf(e,t){var s=t&-t;return s=(s&42)!==0?1:Qo(s),(s&(e.suspendedLanes|t))!==0?0:s}function Qo(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Zo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function gf(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:tg(e.type))}function yf(e,t){var s=Q.p;try{return Q.p=e,t()}finally{Q.p=s}}var an=Math.random().toString(36).slice(2),bt="__reactFiber$"+an,Rt="__reactProps$"+an,vs="__reactContainer$"+an,Fo="__reactEvents$"+an,Gv="__reactListeners$"+an,Pv="__reactHandles$"+an,vf="__reactResources$"+an,Dr="__reactMarker$"+an;function Wo(e){delete e[bt],delete e[Rt],delete e[Fo],delete e[Gv],delete e[Pv]}function bs(e){var t=e[bt];if(t)return t;for(var s=e.parentNode;s;){if(t=s[vs]||s[bt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=qp(e);e!==null;){if(s=e[bt])return s;e=qp(e)}return t}e=s,s=e.parentNode}return null}function xs(e){if(e=e[bt]||e[vs]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Mr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function ws(e){var t=e[vf];return t||(t=e[vf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pt(e){e[Dr]=!0}var bf=new Set,xf={};function Mn(e,t){_s(e,t),_s(e+"Capture",t)}function _s(e,t){for(xf[e]=t,e=0;e<t.length;e++)bf.add(t[e])}var Kv=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),wf={},_f={};function Yv(e){return Rn.call(_f,e)?!0:Rn.call(wf,e)?!1:Kv.test(e)?_f[e]=!0:(wf[e]=!0,!1)}function tl(e,t,s){if(Yv(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+s)}}function al(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+s)}}function Ca(e,t,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,""+i)}}function Qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Sf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Jv(e,t,s){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(y){s=""+y,f.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(y){s=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ec(e){if(!e._valueTracker){var t=Sf(e)?"checked":"value";e._valueTracker=Jv(e,t,""+e[t])}}function jf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=Sf(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}function nl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Xv=/[\n"\\]/g;function Zt(e){return e.replace(Xv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function tc(e,t,s,i,u,f,y,b){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Qt(t)):e.value!==""+Qt(t)&&(e.value=""+Qt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?ac(e,y,Qt(t)):s!=null?ac(e,y,Qt(s)):i!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Qt(b):e.removeAttribute("name")}function Nf(e,t,s,i,u,f,y,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||s!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){ec(e);return}s=s!=null?""+Qt(s):"",t=t!=null?""+Qt(t):s,b||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=b?e.checked:!!i,e.defaultChecked=!!i,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),ec(e)}function ac(e,t,s){t==="number"&&nl(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function Ss(e,t,s,i){if(e=e.options,t){t={};for(var u=0;u<s.length;u++)t["$"+s[u]]=!0;for(s=0;s<e.length;s++)u=t.hasOwnProperty("$"+e[s].value),e[s].selected!==u&&(e[s].selected=u),u&&i&&(e[s].defaultSelected=!0)}else{for(s=""+Qt(s),t=null,u=0;u<e.length;u++){if(e[u].value===s){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Ef(e,t,s){if(t!=null&&(t=""+Qt(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Qt(s):""}function Tf(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(l(92));if(Z(i)){if(1<i.length)throw Error(l(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=Qt(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),ec(e)}function js(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Qv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Af(e,t,s){var i=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,s):typeof s!="number"||s===0||Qv.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Cf(e,t,s){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,s!=null){for(var i in s)!s.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&s[u]!==i&&Af(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&Af(e,f,t[f])}function nc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Zv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Fv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function sl(e){return Fv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ka(){}var sc=null;function rc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ns=null,Es=null;function kf(e){var t=xs(e);if(t&&(e=t.stateNode)){var s=e[Rt]||null;e:switch(e=t.stateNode,t.type){case"input":if(tc(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Zt(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var i=s[t];if(i!==e&&i.form===e.form){var u=i[Rt]||null;if(!u)throw Error(l(90));tc(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<s.length;t++)i=s[t],i.form===e.form&&jf(i)}break e;case"textarea":Ef(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&Ss(e,!!s.multiple,t,!1)}}}var ic=!1;function Of(e,t,s){if(ic)return e(t,s);ic=!0;try{var i=e(t);return i}finally{if(ic=!1,(Ns!==null||Es!==null)&&(Pl(),Ns&&(t=Ns,e=Es,Es=Ns=null,kf(t),e)))for(t=0;t<e.length;t++)kf(e[t])}}function zr(e,t){var s=e.stateNode;if(s===null)return null;var i=s[Rt]||null;if(i===null)return null;s=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(l(231,t,typeof s));return s}var Oa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lc=!1;if(Oa)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){lc=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{lc=!1}var nn=null,oc=null,rl=null;function Rf(){if(rl)return rl;var e,t=oc,s=t.length,i,u="value"in nn?nn.value:nn.textContent,f=u.length;for(e=0;e<s&&t[e]===u[e];e++);var y=s-e;for(i=1;i<=y&&t[s-i]===u[f-i];i++);return rl=u.slice(e,1<i?1-i:void 0)}function il(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ll(){return!0}function Df(){return!1}function Dt(e){function t(s,i,u,f,y){this._reactName=s,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(s=e[b],this[b]=s?s(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?ll:Df,this.isPropagationStopped=Df,this}return _(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=ll)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=ll)},persist:function(){},isPersistent:ll}),t}var zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ol=Dt(zn),Lr=_({},zn,{view:0,detail:0}),Wv=Dt(Lr),cc,uc,Br,cl=_({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Br&&(Br&&e.type==="mousemove"?(cc=e.screenX-Br.screenX,uc=e.screenY-Br.screenY):uc=cc=0,Br=e),cc)},movementY:function(e){return"movementY"in e?e.movementY:uc}}),Mf=Dt(cl),e0=_({},cl,{dataTransfer:0}),t0=Dt(e0),a0=_({},Lr,{relatedTarget:0}),dc=Dt(a0),n0=_({},zn,{animationName:0,elapsedTime:0,pseudoElement:0}),s0=Dt(n0),r0=_({},zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),i0=Dt(r0),l0=_({},zn,{data:0}),zf=Dt(l0),o0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},c0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},u0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function d0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=u0[e])?!!t[e]:!1}function fc(){return d0}var f0=_({},Lr,{key:function(e){if(e.key){var t=o0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=il(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?c0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(e){return e.type==="keypress"?il(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?il(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),h0=Dt(f0),m0=_({},cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Uf=Dt(m0),p0=_({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),g0=Dt(p0),y0=_({},zn,{propertyName:0,elapsedTime:0,pseudoElement:0}),v0=Dt(y0),b0=_({},cl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),x0=Dt(b0),w0=_({},zn,{newState:0,oldState:0}),_0=Dt(w0),S0=[9,13,27,32],hc=Oa&&"CompositionEvent"in window,qr=null;Oa&&"documentMode"in document&&(qr=document.documentMode);var j0=Oa&&"TextEvent"in window&&!qr,Lf=Oa&&(!hc||qr&&8<qr&&11>=qr),Bf=" ",qf=!1;function $f(e,t){switch(e){case"keyup":return S0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ts=!1;function N0(e,t){switch(e){case"compositionend":return Hf(t);case"keypress":return t.which!==32?null:(qf=!0,Bf);case"textInput":return e=t.data,e===Bf&&qf?null:e;default:return null}}function E0(e,t){if(Ts)return e==="compositionend"||!hc&&$f(e,t)?(e=Rf(),rl=oc=nn=null,Ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Lf&&t.locale!=="ko"?null:t.data;default:return null}}var T0={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Vf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!T0[e.type]:t==="textarea"}function If(e,t,s,i){Ns?Es?Es.push(i):Es=[i]:Ns=i,t=Fl(t,"onChange"),0<t.length&&(s=new ol("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var $r=null,Hr=null;function A0(e){Np(e,0)}function ul(e){var t=Mr(e);if(jf(t))return e}function Gf(e,t){if(e==="change")return t}var Pf=!1;if(Oa){var mc;if(Oa){var pc="oninput"in document;if(!pc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),pc=typeof Kf.oninput=="function"}mc=pc}else mc=!1;Pf=mc&&(!document.documentMode||9<document.documentMode)}function Yf(){$r&&($r.detachEvent("onpropertychange",Jf),Hr=$r=null)}function Jf(e){if(e.propertyName==="value"&&ul(Hr)){var t=[];If(t,Hr,e,rc(e)),Of(A0,t)}}function C0(e,t,s){e==="focusin"?(Yf(),$r=t,Hr=s,$r.attachEvent("onpropertychange",Jf)):e==="focusout"&&Yf()}function k0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ul(Hr)}function O0(e,t){if(e==="click")return ul(t)}function R0(e,t){if(e==="input"||e==="change")return ul(t)}function D0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $t=typeof Object.is=="function"?Object.is:D0;function Vr(e,t){if($t(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(i=0;i<s.length;i++){var u=s[i];if(!Rn.call(t,u)||!$t(e[u],t[u]))return!1}return!0}function Xf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qf(e,t){var s=Xf(e);e=0;for(var i;s;){if(s.nodeType===3){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Xf(s)}}function Zf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ff(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=nl(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=nl(e.document)}return t}function gc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var M0=Oa&&"documentMode"in document&&11>=document.documentMode,As=null,yc=null,Ir=null,vc=!1;function Wf(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;vc||As==null||As!==nl(i)||(i=As,"selectionStart"in i&&gc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ir&&Vr(Ir,i)||(Ir=i,i=Fl(yc,"onSelect"),0<i.length&&(t=new ol("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=As)))}function Un(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Cs={animationend:Un("Animation","AnimationEnd"),animationiteration:Un("Animation","AnimationIteration"),animationstart:Un("Animation","AnimationStart"),transitionrun:Un("Transition","TransitionRun"),transitionstart:Un("Transition","TransitionStart"),transitioncancel:Un("Transition","TransitionCancel"),transitionend:Un("Transition","TransitionEnd")},bc={},eh={};Oa&&(eh=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Ln(e){if(bc[e])return bc[e];if(!Cs[e])return e;var t=Cs[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in eh)return bc[e]=t[s];return e}var th=Ln("animationend"),ah=Ln("animationiteration"),nh=Ln("animationstart"),z0=Ln("transitionrun"),U0=Ln("transitionstart"),L0=Ln("transitioncancel"),sh=Ln("transitionend"),rh=new Map,xc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");xc.push("scrollEnd");function la(e,t){rh.set(e,t),Mn(t,[e])}var dl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ft=[],ks=0,wc=0;function fl(){for(var e=ks,t=wc=ks=0;t<e;){var s=Ft[t];Ft[t++]=null;var i=Ft[t];Ft[t++]=null;var u=Ft[t];Ft[t++]=null;var f=Ft[t];if(Ft[t++]=null,i!==null&&u!==null){var y=i.pending;y===null?u.next=u:(u.next=y.next,y.next=u),i.pending=u}f!==0&&ih(s,u,f)}}function hl(e,t,s,i){Ft[ks++]=e,Ft[ks++]=t,Ft[ks++]=s,Ft[ks++]=i,wc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function _c(e,t,s,i){return hl(e,t,s,i),ml(e)}function Bn(e,t){return hl(e,null,null,t),ml(e)}function ih(e,t,s){e.lanes|=s;var i=e.alternate;i!==null&&(i.lanes|=s);for(var u=!1,f=e.return;f!==null;)f.childLanes|=s,i=f.alternate,i!==null&&(i.childLanes|=s),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-kt(s),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=s|536870912),f):null}function ml(e){if(50<di)throw di=0,Ou=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Os={};function B0(e,t,s,i){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ht(e,t,s,i){return new B0(e,t,s,i)}function Sc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ra(e,t){var s=e.alternate;return s===null?(s=Ht(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function lh(e,t){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function pl(e,t,s,i,u,f){var y=0;if(i=e,typeof e=="function")Sc(e)&&(y=1);else if(typeof e=="string")y=Ib(e,s,F.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ue:return e=Ht(31,s,t,u),e.elementType=ue,e.lanes=f,e;case j:return qn(s.children,u,f,t);case k:y=8,u|=24;break;case O:return e=Ht(12,s,t,u|2),e.elementType=O,e.lanes=f,e;case ee:return e=Ht(13,s,t,u),e.elementType=ee,e.lanes=f,e;case J:return e=Ht(19,s,t,u),e.elementType=J,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:y=10;break e;case q:y=9;break e;case G:y=11;break e;case P:y=14;break e;case X:y=16,i=null;break e}y=29,s=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=Ht(y,s,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function qn(e,t,s,i){return e=Ht(7,e,i,t),e.lanes=s,e}function jc(e,t,s){return e=Ht(6,e,null,t),e.lanes=s,e}function oh(e){var t=Ht(18,null,null,0);return t.stateNode=e,t}function Nc(e,t,s){return t=Ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ch=new WeakMap;function Wt(e,t){if(typeof e=="object"&&e!==null){var s=ch.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Or(t)},ch.set(e,t),t)}return{value:e,source:t,stack:Or(t)}}var Rs=[],Ds=0,gl=null,Gr=0,ea=[],ta=0,sn=null,ya=1,va="";function Da(e,t){Rs[Ds++]=Gr,Rs[Ds++]=gl,gl=e,Gr=t}function uh(e,t,s){ea[ta++]=ya,ea[ta++]=va,ea[ta++]=sn,sn=e;var i=ya;e=va;var u=32-kt(i)-1;i&=~(1<<u),s+=1;var f=32-kt(t)+u;if(30<f){var y=u-u%5;f=(i&(1<<y)-1).toString(32),i>>=y,u-=y,ya=1<<32-kt(t)+u|s<<u|i,va=f+e}else ya=1<<f|s<<u|i,va=e}function Ec(e){e.return!==null&&(Da(e,1),uh(e,1,0))}function Tc(e){for(;e===gl;)gl=Rs[--Ds],Rs[Ds]=null,Gr=Rs[--Ds],Rs[Ds]=null;for(;e===sn;)sn=ea[--ta],ea[ta]=null,va=ea[--ta],ea[ta]=null,ya=ea[--ta],ea[ta]=null}function dh(e,t){ea[ta++]=ya,ea[ta++]=va,ea[ta++]=sn,ya=t.id,va=t.overflow,sn=e}var xt=null,Ke=null,ke=!1,rn=null,aa=!1,Ac=Error(l(519));function ln(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Pr(Wt(t,e)),Ac}function fh(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[bt]=e,t[Rt]=i,s){case"dialog":Ne("cancel",t),Ne("close",t);break;case"iframe":case"object":case"embed":Ne("load",t);break;case"video":case"audio":for(s=0;s<hi.length;s++)Ne(hi[s],t);break;case"source":Ne("error",t);break;case"img":case"image":case"link":Ne("error",t),Ne("load",t);break;case"details":Ne("toggle",t);break;case"input":Ne("invalid",t),Nf(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ne("invalid",t);break;case"textarea":Ne("invalid",t),Tf(t,i.value,i.defaultValue,i.children)}s=i.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||i.suppressHydrationWarning===!0||Cp(t.textContent,s)?(i.popover!=null&&(Ne("beforetoggle",t),Ne("toggle",t)),i.onScroll!=null&&Ne("scroll",t),i.onScrollEnd!=null&&Ne("scrollend",t),i.onClick!=null&&(t.onclick=ka),t=!0):t=!1,t||ln(e,!0)}function hh(e){for(xt=e.return;xt;)switch(xt.tag){case 5:case 31:case 13:aa=!1;return;case 27:case 3:aa=!0;return;default:xt=xt.return}}function Ms(e){if(e!==xt)return!1;if(!ke)return hh(e),ke=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Ku(e.type,e.memoizedProps)),s=!s),s&&Ke&&ln(e),hh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=Bp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=Bp(e)}else t===27?(t=Ke,wn(e.type)?(e=Zu,Zu=null,Ke=e):Ke=t):Ke=xt?sa(e.stateNode.nextSibling):null;return!0}function $n(){Ke=xt=null,ke=!1}function Cc(){var e=rn;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),rn=null),e}function Pr(e){rn===null?rn=[e]:rn.push(e)}var kc=T(null),Hn=null,Ma=null;function on(e,t,s){Y(kc,t._currentValue),t._currentValue=s}function za(e){e._currentValue=kc.current,V(kc)}function Oc(e,t,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===s)break;e=e.return}}function Rc(e,t,s,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var b=f;f=u;for(var N=0;N<t.length;N++)if(b.context===t[N]){f.lanes|=s,b=f.alternate,b!==null&&(b.lanes|=s),Oc(f.return,s,e),i||(y=null);break e}f=b.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(l(341));y.lanes|=s,f=y.alternate,f!==null&&(f.lanes|=s),Oc(y,s,e),y=null}else y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===e){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function zs(e,t,s,i){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(l(387));if(y=y.memoizedProps,y!==null){var b=u.type;$t(u.pendingProps.value,y.value)||(e!==null?e.push(b):e=[b])}}else if(u===fe.current){if(y=u.alternate,y===null)throw Error(l(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(vi):e=[vi])}u=u.return}e!==null&&Rc(t,e,s,i),t.flags|=262144}function yl(e){for(e=e.firstContext;e!==null;){if(!$t(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Vn(e){Hn=e,Ma=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wt(e){return mh(Hn,e)}function vl(e,t){return Hn===null&&Vn(e),mh(e,t)}function mh(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},Ma===null){if(e===null)throw Error(l(308));Ma=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ma=Ma.next=t;return s}var q0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},$0=n.unstable_scheduleCallback,H0=n.unstable_NormalPriority,st={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dc(){return{controller:new q0,data:new Map,refCount:0}}function Kr(e){e.refCount--,e.refCount===0&&$0(H0,function(){e.controller.abort()})}var Yr=null,Mc=0,Us=0,Ls=null;function V0(e,t){if(Yr===null){var s=Yr=[];Mc=0,Us=Lu(),Ls={status:"pending",value:void 0,then:function(i){s.push(i)}}}return Mc++,t.then(ph,ph),t}function ph(){if(--Mc===0&&Yr!==null){Ls!==null&&(Ls.status="fulfilled");var e=Yr;Yr=null,Us=0,Ls=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function I0(e,t){var s=[],i={status:"pending",value:null,reason:null,then:function(u){s.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<s.length;u++)(0,s[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<s.length;u++)(0,s[u])(void 0)}),i}var gh=z.S;z.S=function(e,t){Wm=mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&V0(e,t),gh!==null&&gh(e,t)};var In=T(null);function zc(){var e=In.current;return e!==null?e:Ie.pooledCache}function bl(e,t){t===null?Y(In,In.current):Y(In,t.pool)}function yh(){var e=zc();return e===null?null:{parent:st._currentValue,pool:e}}var Bs=Error(l(460)),Uc=Error(l(474)),xl=Error(l(542)),wl={then:function(){}};function vh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function bh(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(ka,ka),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wh(e),e;default:if(typeof t.status=="string")t.then(ka,ka);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wh(e),e}throw Pn=t,Bs}}function Gn(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Pn=s,Bs):s}}var Pn=null;function xh(){if(Pn===null)throw Error(l(459));var e=Pn;return Pn=null,e}function wh(e){if(e===Bs||e===xl)throw Error(l(483))}var qs=null,Jr=0;function _l(e){var t=Jr;return Jr+=1,qs===null&&(qs=[]),bh(qs,e,t)}function Xr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Sl(e,t){throw t.$$typeof===x?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function _h(e){function t(C,E){if(e){var R=C.deletions;R===null?(C.deletions=[E],C.flags|=16):R.push(E)}}function s(C,E){if(!e)return null;for(;E!==null;)t(C,E),E=E.sibling;return null}function i(C){for(var E=new Map;C!==null;)C.key!==null?E.set(C.key,C):E.set(C.index,C),C=C.sibling;return E}function u(C,E){return C=Ra(C,E),C.index=0,C.sibling=null,C}function f(C,E,R){return C.index=R,e?(R=C.alternate,R!==null?(R=R.index,R<E?(C.flags|=67108866,E):R):(C.flags|=67108866,E)):(C.flags|=1048576,E)}function y(C){return e&&C.alternate===null&&(C.flags|=67108866),C}function b(C,E,R,H){return E===null||E.tag!==6?(E=jc(R,C.mode,H),E.return=C,E):(E=u(E,R),E.return=C,E)}function N(C,E,R,H){var ce=R.type;return ce===j?$(C,E,R.props.children,H,R.key):E!==null&&(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===X&&Gn(ce)===E.type)?(E=u(E,R.props),Xr(E,R),E.return=C,E):(E=pl(R.type,R.key,R.props,null,C.mode,H),Xr(E,R),E.return=C,E)}function D(C,E,R,H){return E===null||E.tag!==4||E.stateNode.containerInfo!==R.containerInfo||E.stateNode.implementation!==R.implementation?(E=Nc(R,C.mode,H),E.return=C,E):(E=u(E,R.children||[]),E.return=C,E)}function $(C,E,R,H,ce){return E===null||E.tag!==7?(E=qn(R,C.mode,H,ce),E.return=C,E):(E=u(E,R),E.return=C,E)}function I(C,E,R){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=jc(""+E,C.mode,R),E.return=C,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case S:return R=pl(E.type,E.key,E.props,null,C.mode,R),Xr(R,E),R.return=C,R;case A:return E=Nc(E,C.mode,R),E.return=C,E;case X:return E=Gn(E),I(C,E,R)}if(Z(E)||ge(E))return E=qn(E,C.mode,R,null),E.return=C,E;if(typeof E.then=="function")return I(C,_l(E),R);if(E.$$typeof===B)return I(C,vl(C,E),R);Sl(C,E)}return null}function M(C,E,R,H){var ce=E!==null?E.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return ce!==null?null:b(C,E,""+R,H);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return R.key===ce?N(C,E,R,H):null;case A:return R.key===ce?D(C,E,R,H):null;case X:return R=Gn(R),M(C,E,R,H)}if(Z(R)||ge(R))return ce!==null?null:$(C,E,R,H,null);if(typeof R.then=="function")return M(C,E,_l(R),H);if(R.$$typeof===B)return M(C,E,vl(C,R),H);Sl(C,R)}return null}function L(C,E,R,H,ce){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return C=C.get(R)||null,b(E,C,""+H,ce);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return C=C.get(H.key===null?R:H.key)||null,N(E,C,H,ce);case A:return C=C.get(H.key===null?R:H.key)||null,D(E,C,H,ce);case X:return H=Gn(H),L(C,E,R,H,ce)}if(Z(H)||ge(H))return C=C.get(R)||null,$(E,C,H,ce,null);if(typeof H.then=="function")return L(C,E,R,_l(H),ce);if(H.$$typeof===B)return L(C,E,R,vl(E,H),ce);Sl(E,H)}return null}function ae(C,E,R,H){for(var ce=null,Re=null,ie=E,we=E=0,Ae=null;ie!==null&&we<R.length;we++){ie.index>we?(Ae=ie,ie=null):Ae=ie.sibling;var De=M(C,ie,R[we],H);if(De===null){ie===null&&(ie=Ae);break}e&&ie&&De.alternate===null&&t(C,ie),E=f(De,E,we),Re===null?ce=De:Re.sibling=De,Re=De,ie=Ae}if(we===R.length)return s(C,ie),ke&&Da(C,we),ce;if(ie===null){for(;we<R.length;we++)ie=I(C,R[we],H),ie!==null&&(E=f(ie,E,we),Re===null?ce=ie:Re.sibling=ie,Re=ie);return ke&&Da(C,we),ce}for(ie=i(ie);we<R.length;we++)Ae=L(ie,C,we,R[we],H),Ae!==null&&(e&&Ae.alternate!==null&&ie.delete(Ae.key===null?we:Ae.key),E=f(Ae,E,we),Re===null?ce=Ae:Re.sibling=Ae,Re=Ae);return e&&ie.forEach(function(En){return t(C,En)}),ke&&Da(C,we),ce}function he(C,E,R,H){if(R==null)throw Error(l(151));for(var ce=null,Re=null,ie=E,we=E=0,Ae=null,De=R.next();ie!==null&&!De.done;we++,De=R.next()){ie.index>we?(Ae=ie,ie=null):Ae=ie.sibling;var En=M(C,ie,De.value,H);if(En===null){ie===null&&(ie=Ae);break}e&&ie&&En.alternate===null&&t(C,ie),E=f(En,E,we),Re===null?ce=En:Re.sibling=En,Re=En,ie=Ae}if(De.done)return s(C,ie),ke&&Da(C,we),ce;if(ie===null){for(;!De.done;we++,De=R.next())De=I(C,De.value,H),De!==null&&(E=f(De,E,we),Re===null?ce=De:Re.sibling=De,Re=De);return ke&&Da(C,we),ce}for(ie=i(ie);!De.done;we++,De=R.next())De=L(ie,C,we,De.value,H),De!==null&&(e&&De.alternate!==null&&ie.delete(De.key===null?we:De.key),E=f(De,E,we),Re===null?ce=De:Re.sibling=De,Re=De);return e&&ie.forEach(function(ex){return t(C,ex)}),ke&&Da(C,we),ce}function He(C,E,R,H){if(typeof R=="object"&&R!==null&&R.type===j&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case S:e:{for(var ce=R.key;E!==null;){if(E.key===ce){if(ce=R.type,ce===j){if(E.tag===7){s(C,E.sibling),H=u(E,R.props.children),H.return=C,C=H;break e}}else if(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===X&&Gn(ce)===E.type){s(C,E.sibling),H=u(E,R.props),Xr(H,R),H.return=C,C=H;break e}s(C,E);break}else t(C,E);E=E.sibling}R.type===j?(H=qn(R.props.children,C.mode,H,R.key),H.return=C,C=H):(H=pl(R.type,R.key,R.props,null,C.mode,H),Xr(H,R),H.return=C,C=H)}return y(C);case A:e:{for(ce=R.key;E!==null;){if(E.key===ce)if(E.tag===4&&E.stateNode.containerInfo===R.containerInfo&&E.stateNode.implementation===R.implementation){s(C,E.sibling),H=u(E,R.children||[]),H.return=C,C=H;break e}else{s(C,E);break}else t(C,E);E=E.sibling}H=Nc(R,C.mode,H),H.return=C,C=H}return y(C);case X:return R=Gn(R),He(C,E,R,H)}if(Z(R))return ae(C,E,R,H);if(ge(R)){if(ce=ge(R),typeof ce!="function")throw Error(l(150));return R=ce.call(R),he(C,E,R,H)}if(typeof R.then=="function")return He(C,E,_l(R),H);if(R.$$typeof===B)return He(C,E,vl(C,R),H);Sl(C,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,E!==null&&E.tag===6?(s(C,E.sibling),H=u(E,R),H.return=C,C=H):(s(C,E),H=jc(R,C.mode,H),H.return=C,C=H),y(C)):s(C,E)}return function(C,E,R,H){try{Jr=0;var ce=He(C,E,R,H);return qs=null,ce}catch(ie){if(ie===Bs||ie===xl)throw ie;var Re=Ht(29,ie,null,C.mode);return Re.lanes=H,Re.return=C,Re}}}var Kn=_h(!0),Sh=_h(!1),cn=!1;function Lc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function un(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function dn(e,t,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(ze&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=ml(e),ih(e,null,s),t}return hl(e,i,t,s),ml(e)}function Qr(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,el(e,s)}}function qc(e,t){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var u=null,f=null;if(s=s.firstBaseUpdate,s!==null){do{var y={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,s=s.next}while(s!==null);f===null?u=f=t:f=f.next=t}else u=f=t;s={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var $c=!1;function Zr(){if($c){var e=Ls;if(e!==null)throw e}}function Fr(e,t,s,i){$c=!1;var u=e.updateQueue;cn=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var N=b,D=N.next;N.next=null,y===null?f=D:y.next=D,y=N;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==y&&(b===null?$.firstBaseUpdate=D:b.next=D,$.lastBaseUpdate=N))}if(f!==null){var I=u.baseState;y=0,$=D=N=null,b=f;do{var M=b.lane&-536870913,L=M!==b.lane;if(L?(Te&M)===M:(i&M)===M){M!==0&&M===Us&&($c=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ae=e,he=b;M=t;var He=s;switch(he.tag){case 1:if(ae=he.payload,typeof ae=="function"){I=ae.call(He,I,M);break e}I=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=he.payload,M=typeof ae=="function"?ae.call(He,I,M):ae,M==null)break e;I=_({},I,M);break e;case 2:cn=!0}}M=b.callback,M!==null&&(e.flags|=64,L&&(e.flags|=8192),L=u.callbacks,L===null?u.callbacks=[M]:L.push(M))}else L={lane:M,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(D=$=L,N=I):$=$.next=L,y|=M;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;L=b,b=L.next,L.next=null,u.lastBaseUpdate=L,u.shared.pending=null}}while(!0);$===null&&(N=I),u.baseState=N,u.firstBaseUpdate=D,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),gn|=y,e.lanes=y,e.memoizedState=I}}function jh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Nh(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)jh(s[e],t)}var $s=T(null),jl=T(0);function Eh(e,t){e=Ga,Y(jl,e),Y($s,t),Ga=e|t.baseLanes}function Hc(){Y(jl,Ga),Y($s,$s.current)}function Vc(){Ga=jl.current,V($s),V(jl)}var Vt=T(null),na=null;function fn(e){var t=e.alternate;Y(tt,tt.current&1),Y(Vt,e),na===null&&(t===null||$s.current!==null||t.memoizedState!==null)&&(na=e)}function Ic(e){Y(tt,tt.current),Y(Vt,e),na===null&&(na=e)}function Th(e){e.tag===22?(Y(tt,tt.current),Y(Vt,e),na===null&&(na=e)):hn()}function hn(){Y(tt,tt.current),Y(Vt,Vt.current)}function It(e){V(Vt),na===e&&(na=null),V(tt)}var tt=T(0);function Nl(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Xu(s)||Qu(s)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ua=0,xe=null,qe=null,rt=null,El=!1,Hs=!1,Yn=!1,Tl=0,Wr=0,Vs=null,G0=0;function Fe(){throw Error(l(321))}function Gc(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!$t(e[s],t[s]))return!1;return!0}function Pc(e,t,s,i,u,f){return Ua=f,xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?um:iu,Yn=!1,f=s(i,u),Yn=!1,Hs&&(f=Ch(t,s,i,u)),Ah(e),f}function Ah(e){z.H=ai;var t=qe!==null&&qe.next!==null;if(Ua=0,rt=qe=xe=null,El=!1,Wr=0,Vs=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&yl(e)&&(it=!0))}function Ch(e,t,s,i){xe=e;var u=0;do{if(Hs&&(Vs=null),Wr=0,Hs=!1,25<=u)throw Error(l(301));if(u+=1,rt=qe=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}z.H=dm,f=t(s,i)}while(Hs);return f}function P0(){var e=z.H,t=e.useState()[0];return t=typeof t.then=="function"?ei(t):t,e=e.useState()[0],(qe!==null?qe.memoizedState:null)!==e&&(xe.flags|=1024),t}function Kc(){var e=Tl!==0;return Tl=0,e}function Yc(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Jc(e){if(El){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}El=!1}Ua=0,rt=qe=xe=null,Hs=!1,Wr=Tl=0,Vs=null}function Ot(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?xe.memoizedState=rt=e:rt=rt.next=e,rt}function at(){if(qe===null){var e=xe.alternate;e=e!==null?e.memoizedState:null}else e=qe.next;var t=rt===null?xe.memoizedState:rt.next;if(t!==null)rt=t,qe=e;else{if(e===null)throw xe.alternate===null?Error(l(467)):Error(l(310));qe=e,e={memoizedState:qe.memoizedState,baseState:qe.baseState,baseQueue:qe.baseQueue,queue:qe.queue,next:null},rt===null?xe.memoizedState=rt=e:rt=rt.next=e}return rt}function Al(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ei(e){var t=Wr;return Wr+=1,Vs===null&&(Vs=[]),e=bh(Vs,e,t),t=xe,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?um:iu),e}function Cl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ei(e);if(e.$$typeof===B)return wt(e)}throw Error(l(438,String(e)))}function Xc(e){var t=null,s=xe.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=xe.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=Al(),xe.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),i=0;i<e;i++)s[i]=Je;return t.index++,s}function La(e,t){return typeof t=="function"?t(e):t}function kl(e){var t=at();return Qc(t,qe,e)}function Qc(e,t,s){var i=e.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=s;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var b=y=null,N=null,D=t,$=!1;do{var I=D.lane&-536870913;if(I!==D.lane?(Te&I)===I:(Ua&I)===I){var M=D.revertLane;if(M===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null}),I===Us&&($=!0);else if((Ua&M)===M){D=D.next,M===Us&&($=!0);continue}else I={lane:0,revertLane:D.revertLane,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},N===null?(b=N=I,y=f):N=N.next=I,xe.lanes|=M,gn|=M;I=D.action,Yn&&s(f,I),f=D.hasEagerState?D.eagerState:s(f,I)}else M={lane:I,revertLane:D.revertLane,gesture:D.gesture,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},N===null?(b=N=M,y=f):N=N.next=M,xe.lanes|=I,gn|=I;D=D.next}while(D!==null&&D!==t);if(N===null?y=f:N.next=b,!$t(f,e.memoizedState)&&(it=!0,$&&(s=Ls,s!==null)))throw s;e.memoizedState=f,e.baseState=y,e.baseQueue=N,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Zc(e){var t=at(),s=t.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=e;var i=s.dispatch,u=s.pending,f=t.memoizedState;if(u!==null){s.pending=null;var y=u=u.next;do f=e(f,y.action),y=y.next;while(y!==u);$t(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),s.lastRenderedState=f}return[f,i]}function kh(e,t,s){var i=xe,u=at(),f=ke;if(f){if(s===void 0)throw Error(l(407));s=s()}else s=t();var y=!$t((qe||u).memoizedState,s);if(y&&(u.memoizedState=s,it=!0),u=u.queue,eu(Dh.bind(null,i,u,e),[e]),u.getSnapshot!==t||y||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,Is(9,{destroy:void 0},Rh.bind(null,i,u,s,t),null),Ie===null)throw Error(l(349));f||(Ua&127)!==0||Oh(i,t,s)}return s}function Oh(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=xe.updateQueue,t===null?(t=Al(),xe.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Rh(e,t,s,i){t.value=s,t.getSnapshot=i,Mh(t)&&zh(e)}function Dh(e,t,s){return s(function(){Mh(t)&&zh(e)})}function Mh(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!$t(e,s)}catch{return!0}}function zh(e){var t=Bn(e,2);t!==null&&Bt(t,e,2)}function Fc(e){var t=Ot();if(typeof e=="function"){var s=e;if(e=s(),Yn){pa(!0);try{s()}finally{pa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:e},t}function Uh(e,t,s,i){return e.baseState=s,Qc(e,qe,typeof i=="function"?i:La)}function K0(e,t,s,i,u){if(Dl(e))throw Error(l(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};z.T!==null?s(!0):f.isTransition=!1,i(f),s=t.pending,s===null?(f.next=t.pending=f,Lh(t,f)):(f.next=s.next,t.pending=s.next=f)}}function Lh(e,t){var s=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=z.T,y={};z.T=y;try{var b=s(u,i),N=z.S;N!==null&&N(y,b),Bh(e,t,b)}catch(D){Wc(e,t,D)}finally{f!==null&&y.types!==null&&(f.types=y.types),z.T=f}}else try{f=s(u,i),Bh(e,t,f)}catch(D){Wc(e,t,D)}}function Bh(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){qh(e,t,i)},function(i){return Wc(e,t,i)}):qh(e,t,s)}function qh(e,t,s){t.status="fulfilled",t.value=s,$h(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,Lh(e,s)))}function Wc(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,$h(t),t=t.next;while(t!==i)}e.action=null}function $h(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Hh(e,t){return t}function Vh(e,t){if(ke){var s=Ie.formState;if(s!==null){e:{var i=xe;if(ke){if(Ke){t:{for(var u=Ke,f=aa;u.nodeType!==8;){if(!f){u=null;break t}if(u=sa(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ke=sa(u.nextSibling),i=u.data==="F!";break e}}ln(i)}i=!1}i&&(t=s[0])}}return s=Ot(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hh,lastRenderedState:t},s.queue=i,s=lm.bind(null,xe,i),i.dispatch=s,i=Fc(!1),f=ru.bind(null,xe,!1,i.queue),i=Ot(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,s=K0.bind(null,xe,u,f,s),u.dispatch=s,i.memoizedState=e,[t,s,!1]}function Ih(e){var t=at();return Gh(t,qe,e)}function Gh(e,t,s){if(t=Qc(e,t,Hh)[0],e=kl(La)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=ei(t)}catch(y){throw y===Bs?xl:y}else i=t;t=at();var u=t.queue,f=u.dispatch;return s!==t.memoizedState&&(xe.flags|=2048,Is(9,{destroy:void 0},Y0.bind(null,u,s),null)),[i,f,e]}function Y0(e,t){e.action=t}function Ph(e){var t=at(),s=qe;if(s!==null)return Gh(t,s,e);at(),t=t.memoizedState,s=at();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function Is(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=xe.updateQueue,t===null&&(t=Al(),xe.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(i=s.next,s.next=e,e.next=i,t.lastEffect=e),e}function Kh(){return at().memoizedState}function Ol(e,t,s,i){var u=Ot();xe.flags|=e,u.memoizedState=Is(1|t,{destroy:void 0},s,i===void 0?null:i)}function Rl(e,t,s,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;qe!==null&&i!==null&&Gc(i,qe.memoizedState.deps)?u.memoizedState=Is(t,f,s,i):(xe.flags|=e,u.memoizedState=Is(1|t,f,s,i))}function Yh(e,t){Ol(8390656,8,e,t)}function eu(e,t){Rl(2048,8,e,t)}function J0(e){xe.flags|=4;var t=xe.updateQueue;if(t===null)t=Al(),xe.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function Jh(e){var t=at().memoizedState;return J0({ref:t,nextImpl:e}),function(){if((ze&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Xh(e,t){return Rl(4,2,e,t)}function Qh(e,t){return Rl(4,4,e,t)}function Zh(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Fh(e,t,s){s=s!=null?s.concat([e]):null,Rl(4,4,Zh.bind(null,t,e),s)}function tu(){}function Wh(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&Gc(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function em(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&Gc(t,i[1]))return i[0];if(i=e(),Yn){pa(!0);try{e()}finally{pa(!1)}}return s.memoizedState=[i,t],i}function au(e,t,s){return s===void 0||(Ua&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=tp(),xe.lanes|=e,gn|=e,s)}function tm(e,t,s,i){return $t(s,t)?s:$s.current!==null?(e=au(e,s,i),$t(e,t)||(it=!0),e):(Ua&42)===0||(Ua&1073741824)!==0&&(Te&261930)===0?(it=!0,e.memoizedState=s):(e=tp(),xe.lanes|=e,gn|=e,t)}function am(e,t,s,i,u){var f=Q.p;Q.p=f!==0&&8>f?f:8;var y=z.T,b={};z.T=b,ru(e,!1,t,s);try{var N=u(),D=z.S;if(D!==null&&D(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var $=I0(N,i);ti(e,t,$,Kt(e))}else ti(e,t,i,Kt(e))}catch(I){ti(e,t,{then:function(){},status:"rejected",reason:I},Kt())}finally{Q.p=f,y!==null&&b.types!==null&&(y.types=b.types),z.T=y}}function X0(){}function nu(e,t,s,i){if(e.tag!==5)throw Error(l(476));var u=nm(e).queue;am(e,u,t,K,s===null?X0:function(){return sm(e),s(i)})}function nm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:K},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function sm(e){var t=nm(e);t.next===null&&(t=e.alternate.memoizedState),ti(e,t.next.queue,{},Kt())}function su(){return wt(vi)}function rm(){return at().memoizedState}function im(){return at().memoizedState}function Q0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=Kt();e=un(s);var i=dn(t,e,s);i!==null&&(Bt(i,t,s),Qr(i,t,s)),t={cache:Dc()},e.payload=t;return}t=t.return}}function Z0(e,t,s){var i=Kt();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Dl(e)?om(t,s):(s=_c(e,t,s,i),s!==null&&(Bt(s,e,i),cm(s,t,i)))}function lm(e,t,s){var i=Kt();ti(e,t,s,i)}function ti(e,t,s,i){var u={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Dl(e))om(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var y=t.lastRenderedState,b=f(y,s);if(u.hasEagerState=!0,u.eagerState=b,$t(b,y))return hl(e,t,u,0),Ie===null&&fl(),!1}catch{}if(s=_c(e,t,u,i),s!==null)return Bt(s,e,i),cm(s,t,i),!0}return!1}function ru(e,t,s,i){if(i={lane:2,revertLane:Lu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Dl(e)){if(t)throw Error(l(479))}else t=_c(e,s,i,2),t!==null&&Bt(t,e,2)}function Dl(e){var t=e.alternate;return e===xe||t!==null&&t===xe}function om(e,t){Hs=El=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function cm(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,el(e,s)}}var ai={readContext:wt,use:Cl,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};ai.useEffectEvent=Fe;var um={readContext:wt,use:Cl,useCallback:function(e,t){return Ot().memoizedState=[e,t===void 0?null:t],e},useContext:wt,useEffect:Yh,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Ol(4194308,4,Zh.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Ol(4194308,4,e,t)},useInsertionEffect:function(e,t){Ol(4,2,e,t)},useMemo:function(e,t){var s=Ot();t=t===void 0?null:t;var i=e();if(Yn){pa(!0);try{e()}finally{pa(!1)}}return s.memoizedState=[i,t],i},useReducer:function(e,t,s){var i=Ot();if(s!==void 0){var u=s(t);if(Yn){pa(!0);try{s(t)}finally{pa(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=Z0.bind(null,xe,e),[i.memoizedState,e]},useRef:function(e){var t=Ot();return e={current:e},t.memoizedState=e},useState:function(e){e=Fc(e);var t=e.queue,s=lm.bind(null,xe,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:tu,useDeferredValue:function(e,t){var s=Ot();return au(s,e,t)},useTransition:function(){var e=Fc(!1);return e=am.bind(null,xe,e.queue,!0,!1),Ot().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=xe,u=Ot();if(ke){if(s===void 0)throw Error(l(407));s=s()}else{if(s=t(),Ie===null)throw Error(l(349));(Te&127)!==0||Oh(i,t,s)}u.memoizedState=s;var f={value:s,getSnapshot:t};return u.queue=f,Yh(Dh.bind(null,i,f,e),[e]),i.flags|=2048,Is(9,{destroy:void 0},Rh.bind(null,i,f,s,t),null),s},useId:function(){var e=Ot(),t=Ie.identifierPrefix;if(ke){var s=va,i=ya;s=(i&~(1<<32-kt(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Tl++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=G0++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:su,useFormState:Vh,useActionState:Vh,useOptimistic:function(e){var t=Ot();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=ru.bind(null,xe,!0,s),s.dispatch=t,[e,t]},useMemoCache:Xc,useCacheRefresh:function(){return Ot().memoizedState=Q0.bind(null,xe)},useEffectEvent:function(e){var t=Ot(),s={impl:e};return t.memoizedState=s,function(){if((ze&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},iu={readContext:wt,use:Cl,useCallback:Wh,useContext:wt,useEffect:eu,useImperativeHandle:Fh,useInsertionEffect:Xh,useLayoutEffect:Qh,useMemo:em,useReducer:kl,useRef:Kh,useState:function(){return kl(La)},useDebugValue:tu,useDeferredValue:function(e,t){var s=at();return tm(s,qe.memoizedState,e,t)},useTransition:function(){var e=kl(La)[0],t=at().memoizedState;return[typeof e=="boolean"?e:ei(e),t]},useSyncExternalStore:kh,useId:rm,useHostTransitionStatus:su,useFormState:Ih,useActionState:Ih,useOptimistic:function(e,t){var s=at();return Uh(s,qe,e,t)},useMemoCache:Xc,useCacheRefresh:im};iu.useEffectEvent=Jh;var dm={readContext:wt,use:Cl,useCallback:Wh,useContext:wt,useEffect:eu,useImperativeHandle:Fh,useInsertionEffect:Xh,useLayoutEffect:Qh,useMemo:em,useReducer:Zc,useRef:Kh,useState:function(){return Zc(La)},useDebugValue:tu,useDeferredValue:function(e,t){var s=at();return qe===null?au(s,e,t):tm(s,qe.memoizedState,e,t)},useTransition:function(){var e=Zc(La)[0],t=at().memoizedState;return[typeof e=="boolean"?e:ei(e),t]},useSyncExternalStore:kh,useId:rm,useHostTransitionStatus:su,useFormState:Ph,useActionState:Ph,useOptimistic:function(e,t){var s=at();return qe!==null?Uh(s,qe,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Xc,useCacheRefresh:im};dm.useEffectEvent=Jh;function lu(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:_({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var ou={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=Kt(),u=un(i);u.payload=t,s!=null&&(u.callback=s),t=dn(e,u,i),t!==null&&(Bt(t,e,i),Qr(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=Kt(),u=un(i);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=dn(e,u,i),t!==null&&(Bt(t,e,i),Qr(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Kt(),i=un(s);i.tag=2,t!=null&&(i.callback=t),t=dn(e,i,s),t!==null&&(Bt(t,e,s),Qr(t,e,s))}};function fm(e,t,s,i,u,f,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,y):t.prototype&&t.prototype.isPureReactComponent?!Vr(s,i)||!Vr(u,f):!0}function hm(e,t,s,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,i),t.state!==e&&ou.enqueueReplaceState(t,t.state,null)}function Jn(e,t){var s=t;if("ref"in t){s={};for(var i in t)i!=="ref"&&(s[i]=t[i])}if(e=e.defaultProps){s===t&&(s=_({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function mm(e){dl(e)}function pm(e){console.error(e)}function gm(e){dl(e)}function Ml(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function ym(e,t,s){try{var i=e.onCaughtError;i(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function cu(e,t,s){return s=un(s),s.tag=3,s.payload={element:null},s.callback=function(){Ml(e,t)},s}function vm(e){return e=un(e),e.tag=3,e}function bm(e,t,s,i){var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){ym(t,s,i)}}var y=s.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){ym(t,s,i),typeof u!="function"&&(yn===null?yn=new Set([this]):yn.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function F0(e,t,s,i,u){if(s.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=s.alternate,t!==null&&zs(t,s,u,!0),s=Vt.current,s!==null){switch(s.tag){case 31:case 13:return na===null?Kl():s.alternate===null&&We===0&&(We=3),s.flags&=-257,s.flags|=65536,s.lanes=u,i===wl?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),Mu(e,i,u)),!1;case 22:return s.flags|=65536,i===wl?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([i]):s.add(i)),Mu(e,i,u)),!1}throw Error(l(435,s.tag))}return Mu(e,i,u),Kl(),!1}if(ke)return t=Vt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Ac&&(e=Error(l(422),{cause:i}),Pr(Wt(e,s)))):(i!==Ac&&(t=Error(l(423),{cause:i}),Pr(Wt(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=Wt(i,s),u=cu(e.stateNode,i,u),qc(e,u),We!==4&&(We=2)),!1;var f=Error(l(520),{cause:i});if(f=Wt(f,s),ui===null?ui=[f]:ui.push(f),We!==4&&(We=2),t===null)return!0;i=Wt(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=cu(s.stateNode,i,e),qc(s,e),!1;case 1:if(t=s.type,f=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(yn===null||!yn.has(f))))return s.flags|=65536,u&=-u,s.lanes|=u,u=vm(u),bm(u,e,s,i),qc(s,u),!1}s=s.return}while(s!==null);return!1}var uu=Error(l(461)),it=!1;function _t(e,t,s,i){t.child=e===null?Sh(t,null,s,i):Kn(t,e.child,s,i)}function xm(e,t,s,i,u){s=s.render;var f=t.ref;if("ref"in i){var y={};for(var b in i)b!=="ref"&&(y[b]=i[b])}else y=i;return Vn(t),i=Pc(e,t,s,y,f,u),b=Kc(),e!==null&&!it?(Yc(e,t,u),Ba(e,t,u)):(ke&&b&&Ec(t),t.flags|=1,_t(e,t,i,u),t.child)}function wm(e,t,s,i,u){if(e===null){var f=s.type;return typeof f=="function"&&!Sc(f)&&f.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=f,_m(e,t,f,i,u)):(e=pl(s.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!vu(e,u)){var y=f.memoizedProps;if(s=s.compare,s=s!==null?s:Vr,s(y,i)&&e.ref===t.ref)return Ba(e,t,u)}return t.flags|=1,e=Ra(f,i),e.ref=t.ref,e.return=t,t.child=e}function _m(e,t,s,i,u){if(e!==null){var f=e.memoizedProps;if(Vr(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,vu(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Ba(e,t,u)}return du(e,t,s,i,u)}function Sm(e,t,s,i){var u=i.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|s:s,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~f}else i=0,t.child=null;return jm(e,t,f,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&bl(t,f!==null?f.cachePool:null),f!==null?Eh(t,f):Hc(),Th(t);else return i=t.lanes=536870912,jm(e,t,f!==null?f.baseLanes|s:s,s,i)}else f!==null?(bl(t,f.cachePool),Eh(t,f),hn(),t.memoizedState=null):(e!==null&&bl(t,null),Hc(),hn());return _t(e,t,u,s),t.child}function ni(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function jm(e,t,s,i,u){var f=zc();return f=f===null?null:{parent:st._currentValue,pool:f},t.memoizedState={baseLanes:s,cachePool:f},e!==null&&bl(t,null),Hc(),Th(t),e!==null&&zs(e,t,i,!0),t.childLanes=u,null}function zl(e,t){return t=Ll({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Nm(e,t,s){return Kn(t,e.child,null,s),e=zl(t,t.pendingProps),e.flags|=2,It(t),t.memoizedState=null,e}function W0(e,t,s){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(i.mode==="hidden")return e=zl(t,i),t.lanes=536870912,ni(null,e);if(Ic(t),(e=Ke)?(e=Lp(e,aa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:sn!==null?{id:ya,overflow:va}:null,retryLane:536870912,hydrationErrors:null},s=oh(e),s.return=t,t.child=s,xt=t,Ke=null)):e=null,e===null)throw ln(t);return t.lanes=536870912,null}return zl(t,i)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Ic(t),u)if(t.flags&256)t.flags&=-257,t=Nm(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(it||zs(e,t,s,!1),u=(s&e.childLanes)!==0,it||u){if(i=Ie,i!==null&&(y=pf(i,s),y!==0&&y!==f.retryLane))throw f.retryLane=y,Bn(e,y),Bt(i,e,y),uu;Kl(),t=Nm(e,t,s)}else e=f.treeContext,Ke=sa(y.nextSibling),xt=t,ke=!0,rn=null,aa=!1,e!==null&&dh(t,e),t=zl(t,i),t.flags|=4096;return t}return e=Ra(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ul(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(l(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function du(e,t,s,i,u){return Vn(t),s=Pc(e,t,s,i,void 0,u),i=Kc(),e!==null&&!it?(Yc(e,t,u),Ba(e,t,u)):(ke&&i&&Ec(t),t.flags|=1,_t(e,t,s,u),t.child)}function Em(e,t,s,i,u,f){return Vn(t),t.updateQueue=null,s=Ch(t,i,s,u),Ah(e),i=Kc(),e!==null&&!it?(Yc(e,t,f),Ba(e,t,f)):(ke&&i&&Ec(t),t.flags|=1,_t(e,t,s,f),t.child)}function Tm(e,t,s,i,u){if(Vn(t),t.stateNode===null){var f=Os,y=s.contextType;typeof y=="object"&&y!==null&&(f=wt(y)),f=new s(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=ou,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Lc(t),y=s.contextType,f.context=typeof y=="object"&&y!==null?wt(y):Os,f.state=t.memoizedState,y=s.getDerivedStateFromProps,typeof y=="function"&&(lu(t,s,y,i),f.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&ou.enqueueReplaceState(f,f.state,null),Fr(t,i,f,u),Zr(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var b=t.memoizedProps,N=Jn(s,b);f.props=N;var D=f.context,$=s.contextType;y=Os,typeof $=="object"&&$!==null&&(y=wt($));var I=s.getDerivedStateFromProps;$=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||D!==y)&&hm(t,f,i,y),cn=!1;var M=t.memoizedState;f.state=M,Fr(t,i,f,u),Zr(),D=t.memoizedState,b||M!==D||cn?(typeof I=="function"&&(lu(t,s,I,i),D=t.memoizedState),(N=cn||fm(t,s,N,i,M,D,y))?($||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=D),f.props=i,f.state=D,f.context=y,i=N):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Bc(e,t),y=t.memoizedProps,$=Jn(s,y),f.props=$,I=t.pendingProps,M=f.context,D=s.contextType,N=Os,typeof D=="object"&&D!==null&&(N=wt(D)),b=s.getDerivedStateFromProps,(D=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==I||M!==N)&&hm(t,f,i,N),cn=!1,M=t.memoizedState,f.state=M,Fr(t,i,f,u),Zr();var L=t.memoizedState;y!==I||M!==L||cn||e!==null&&e.dependencies!==null&&yl(e.dependencies)?(typeof b=="function"&&(lu(t,s,b,i),L=t.memoizedState),($=cn||fm(t,s,$,i,M,L,N)||e!==null&&e.dependencies!==null&&yl(e.dependencies))?(D||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,L,N),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,L,N)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=L),f.props=i,f.state=L,f.context=N,i=$):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Ul(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,s=i&&typeof s.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=Kn(t,e.child,null,u),t.child=Kn(t,null,s,u)):_t(e,t,s,u),t.memoizedState=f.state,e=t.child):e=Ba(e,t,u),e}function Am(e,t,s,i){return $n(),t.flags|=256,_t(e,t,s,i),t.child}var fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hu(e){return{baseLanes:e,cachePool:yh()}}function mu(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=Pt),e}function Cm(e,t,s){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,y;if((y=f)||(y=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),y&&(u=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(ke){if(u?fn(t):hn(),(e=Ke)?(e=Lp(e,aa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:sn!==null?{id:ya,overflow:va}:null,retryLane:536870912,hydrationErrors:null},s=oh(e),s.return=t,t.child=s,xt=t,Ke=null)):e=null,e===null)throw ln(t);return Qu(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(hn(),u=t.mode,b=Ll({mode:"hidden",children:b},u),i=qn(i,u,s,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=hu(s),i.childLanes=mu(e,y,s),t.memoizedState=fu,ni(null,i)):(fn(t),pu(t,b))}var N=e.memoizedState;if(N!==null&&(b=N.dehydrated,b!==null)){if(f)t.flags&256?(fn(t),t.flags&=-257,t=gu(e,t,s)):t.memoizedState!==null?(hn(),t.child=e.child,t.flags|=128,t=null):(hn(),b=i.fallback,u=t.mode,i=Ll({mode:"visible",children:i.children},u),b=qn(b,u,s,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,Kn(t,e.child,null,s),i=t.child,i.memoizedState=hu(s),i.childLanes=mu(e,y,s),t.memoizedState=fu,t=ni(null,i));else if(fn(t),Qu(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var D=y.dgst;y=D,i=Error(l(419)),i.stack="",i.digest=y,Pr({value:i,source:null,stack:null}),t=gu(e,t,s)}else if(it||zs(e,t,s,!1),y=(s&e.childLanes)!==0,it||y){if(y=Ie,y!==null&&(i=pf(y,s),i!==0&&i!==N.retryLane))throw N.retryLane=i,Bn(e,i),Bt(y,e,i),uu;Xu(b)||Kl(),t=gu(e,t,s)}else Xu(b)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Ke=sa(b.nextSibling),xt=t,ke=!0,rn=null,aa=!1,e!==null&&dh(t,e),t=pu(t,i.children),t.flags|=4096);return t}return u?(hn(),b=i.fallback,u=t.mode,N=e.child,D=N.sibling,i=Ra(N,{mode:"hidden",children:i.children}),i.subtreeFlags=N.subtreeFlags&65011712,D!==null?b=Ra(D,b):(b=qn(b,u,s,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,ni(null,i),i=t.child,b=e.child.memoizedState,b===null?b=hu(s):(u=b.cachePool,u!==null?(N=st._currentValue,u=u.parent!==N?{parent:N,pool:N}:u):u=yh(),b={baseLanes:b.baseLanes|s,cachePool:u}),i.memoizedState=b,i.childLanes=mu(e,y,s),t.memoizedState=fu,ni(e.child,i)):(fn(t),s=e.child,e=s.sibling,s=Ra(s,{mode:"visible",children:i.children}),s.return=t,s.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=s,t.memoizedState=null,s)}function pu(e,t){return t=Ll({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ll(e,t){return e=Ht(22,e,null,t),e.lanes=0,e}function gu(e,t,s){return Kn(t,e.child,null,s),e=pu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function km(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Oc(e.return,t,s)}function yu(e,t,s,i,u,f){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:u,treeForkCount:f}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=i,y.tail=s,y.tailMode=u,y.treeForkCount=f)}function Om(e,t,s){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var y=tt.current,b=(y&2)!==0;if(b?(y=y&1|2,t.flags|=128):y&=1,Y(tt,y),_t(e,t,i,s),i=ke?Gr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&km(e,s,t);else if(e.tag===19)km(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(s=t.child,u=null;s!==null;)e=s.alternate,e!==null&&Nl(e)===null&&(u=s),s=s.sibling;s=u,s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),yu(t,!1,u,s,f,i);break;case"backwards":case"unstable_legacy-backwards":for(s=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Nl(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}yu(t,!0,s,null,f,i);break;case"together":yu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Ba(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),gn|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(zs(e,t,s,!1),(s&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,s=Ra(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Ra(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function vu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&yl(e)))}function eb(e,t,s){switch(t.tag){case 3:Ge(t,t.stateNode.containerInfo),on(t,st,e.memoizedState.cache),$n();break;case 27:case 5:Tt(t);break;case 4:Ge(t,t.stateNode.containerInfo);break;case 10:on(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ic(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(fn(t),t.flags|=128,null):(s&t.child.childLanes)!==0?Cm(e,t,s):(fn(t),e=Ba(e,t,s),e!==null?e.sibling:null);fn(t);break;case 19:var u=(e.flags&128)!==0;if(i=(s&t.childLanes)!==0,i||(zs(e,t,s,!1),i=(s&t.childLanes)!==0),u){if(i)return Om(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Y(tt,tt.current),i)break;return null;case 22:return t.lanes=0,Sm(e,t,s,t.pendingProps);case 24:on(t,st,e.memoizedState.cache)}return Ba(e,t,s)}function Rm(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!vu(e,s)&&(t.flags&128)===0)return it=!1,eb(e,t,s);it=(e.flags&131072)!==0}else it=!1,ke&&(t.flags&1048576)!==0&&uh(t,Gr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Gn(t.elementType),t.type=e,typeof e=="function")Sc(e)?(i=Jn(e,i),t.tag=1,t=Tm(null,t,e,i,s)):(t.tag=0,t=du(null,t,e,i,s));else{if(e!=null){var u=e.$$typeof;if(u===G){t.tag=11,t=xm(null,t,e,i,s);break e}else if(u===P){t.tag=14,t=wm(null,t,e,i,s);break e}}throw t=nt(e)||e,Error(l(306,t,""))}}return t;case 0:return du(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,u=Jn(i,t.pendingProps),Tm(e,t,i,u,s);case 3:e:{if(Ge(t,t.stateNode.containerInfo),e===null)throw Error(l(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,Bc(e,t),Fr(t,i,null,s);var y=t.memoizedState;if(i=y.cache,on(t,st,i),i!==f.cache&&Rc(t,[st],s,!0),Zr(),i=y.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Am(e,t,i,s);break e}else if(i!==u){u=Wt(Error(l(424)),t),Pr(u),t=Am(e,t,i,s);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ke=sa(e.firstChild),xt=t,ke=!0,rn=null,aa=!0,s=Sh(t,null,i,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if($n(),i===u){t=Ba(e,t,s);break e}_t(e,t,i,s)}t=t.child}return t;case 26:return Ul(e,t),e===null?(s=Ip(t.type,null,t.pendingProps,null))?t.memoizedState=s:ke||(s=t.type,e=t.pendingProps,i=Wl(ye.current).createElement(s),i[bt]=t,i[Rt]=e,St(i,s,e),pt(i),t.stateNode=i):t.memoizedState=Ip(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ke&&(i=t.stateNode=$p(t.type,t.pendingProps,ye.current),xt=t,aa=!0,u=Ke,wn(t.type)?(Zu=u,Ke=sa(i.firstChild)):Ke=u),_t(e,t,t.pendingProps.children,s),Ul(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ke&&((u=i=Ke)&&(i=kb(i,t.type,t.pendingProps,aa),i!==null?(t.stateNode=i,xt=t,Ke=sa(i.firstChild),aa=!1,u=!0):u=!1),u||ln(t)),Tt(t),u=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,i=f.children,Ku(u,f)?i=null:y!==null&&Ku(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=Pc(e,t,P0,null,null,s),vi._currentValue=u),Ul(e,t),_t(e,t,i,s),t.child;case 6:return e===null&&ke&&((e=s=Ke)&&(s=Ob(s,t.pendingProps,aa),s!==null?(t.stateNode=s,xt=t,Ke=null,e=!0):e=!1),e||ln(t)),null;case 13:return Cm(e,t,s);case 4:return Ge(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Kn(t,null,i,s):_t(e,t,i,s),t.child;case 11:return xm(e,t,t.type,t.pendingProps,s);case 7:return _t(e,t,t.pendingProps,s),t.child;case 8:return _t(e,t,t.pendingProps.children,s),t.child;case 12:return _t(e,t,t.pendingProps.children,s),t.child;case 10:return i=t.pendingProps,on(t,t.type,i.value),_t(e,t,i.children,s),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Vn(t),u=wt(u),i=i(u),t.flags|=1,_t(e,t,i,s),t.child;case 14:return wm(e,t,t.type,t.pendingProps,s);case 15:return _m(e,t,t.type,t.pendingProps,s);case 19:return Om(e,t,s);case 31:return W0(e,t,s);case 22:return Sm(e,t,s,t.pendingProps);case 24:return Vn(t),i=wt(st),e===null?(u=zc(),u===null&&(u=Ie,f=Dc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=s),u=f),t.memoizedState={parent:i,cache:u},Lc(t),on(t,st,u)):((e.lanes&s)!==0&&(Bc(e,t),Fr(t,null,null,s),Zr()),u=e.memoizedState,f=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),on(t,st,i)):(i=f.cache,on(t,st,i),i!==u.cache&&Rc(t,[st],s,!0))),_t(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function qa(e){e.flags|=4}function bu(e,t,s,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(rp())e.flags|=8192;else throw Pn=wl,Uc}else e.flags&=-16777217}function Dm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Jp(t))if(rp())e.flags|=8192;else throw Pn=wl,Uc}function Bl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ga():536870912,e.lanes|=t,Ys|=t)}function si(e,t){if(!ke)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,i=0;if(t)for(var u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=s,t}function tb(e,t,s){var i=t.pendingProps;switch(Tc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return Ye(t),null;case 3:return s=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),za(st),Be(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Ms(t)?qa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Cc())),Ye(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(qa(t),f!==null?(Ye(t),Dm(t,f)):(Ye(t),bu(t,u,null,i,s))):f?f!==e.memoizedState?(qa(t),Ye(t),Dm(t,f)):(Ye(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&qa(t),Ye(t),bu(t,u,e,i,s)),null;case 27:if(yt(t),s=ye.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&qa(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}e=F.current,Ms(t)?fh(t):(e=$p(u,i,s),t.stateNode=e,qa(t))}return Ye(t),null;case 5:if(yt(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&qa(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}if(f=F.current,Ms(t))fh(t);else{var y=Wl(ye.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?y.createElement("select",{is:i.is}):y.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?y.createElement(u,{is:i.is}):y.createElement(u)}}f[bt]=t,f[Rt]=i;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=f;e:switch(St(f,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&qa(t)}}return Ye(t),bu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&qa(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(l(166));if(e=ye.current,Ms(t)){if(e=t.stateNode,s=t.memoizedProps,i=null,u=xt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[bt]=t,e=!!(e.nodeValue===s||i!==null&&i.suppressHydrationWarning===!0||Cp(e.nodeValue,s)),e||ln(t,!0)}else e=Wl(e).createTextNode(i),e[bt]=t,t.stateNode=e}return Ye(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=Ms(t),s!==null){if(e===null){if(!i)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[bt]=t}else $n(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),e=!1}else s=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(It(t),t):(It(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ye(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Ms(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(l(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(l(317));u[bt]=t}else $n(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),u=!1}else u=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(It(t),t):(It(t),null)}return It(t),(t.flags&128)!==0?(t.lanes=s,t):(s=i!==null,e=e!==null&&e.memoizedState!==null,s&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==u&&(i.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),Bl(t,t.updateQueue),Ye(t),null);case 4:return Be(),e===null&&Hu(t.stateNode.containerInfo),Ye(t),null;case 10:return za(t.type),Ye(t),null;case 19:if(V(tt),i=t.memoizedState,i===null)return Ye(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)si(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=Nl(e),f!==null){for(t.flags|=128,si(i,!1),e=f.updateQueue,t.updateQueue=e,Bl(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)lh(s,e),s=s.sibling;return Y(tt,tt.current&1|2),ke&&Da(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&mt()>Il&&(t.flags|=128,u=!0,si(i,!1),t.lanes=4194304)}else{if(!u)if(e=Nl(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Bl(t,e),si(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!ke)return Ye(t),null}else 2*mt()-i.renderingStartTime>Il&&s!==536870912&&(t.flags|=128,u=!0,si(i,!1),t.lanes=4194304);i.isBackwards?(f.sibling=t.child,t.child=f):(e=i.last,e!==null?e.sibling=f:t.child=f,i.last=f)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=mt(),e.sibling=null,s=tt.current,Y(tt,u?s&1|2:s&1),ke&&Da(t,i.treeForkCount),e):(Ye(t),null);case 22:case 23:return It(t),Vc(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(s&536870912)!==0&&(t.flags&128)===0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),s=t.updateQueue,s!==null&&Bl(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==s&&(t.flags|=2048),e!==null&&V(In),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),za(st),Ye(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function ab(e,t){switch(Tc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return za(st),Be(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return yt(t),null;case 31:if(t.memoizedState!==null){if(It(t),t.alternate===null)throw Error(l(340));$n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(It(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));$n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(tt),null;case 4:return Be(),null;case 10:return za(t.type),null;case 22:case 23:return It(t),Vc(),e!==null&&V(In),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return za(st),null;case 25:return null;default:return null}}function Mm(e,t){switch(Tc(t),t.tag){case 3:za(st),Be();break;case 26:case 27:case 5:yt(t);break;case 4:Be();break;case 31:t.memoizedState!==null&&It(t);break;case 13:It(t);break;case 19:V(tt);break;case 10:za(t.type);break;case 22:case 23:It(t),Vc(),e!==null&&V(In);break;case 24:za(st)}}function ri(e,t){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var u=i.next;s=u;do{if((s.tag&e)===e){i=void 0;var f=s.create,y=s.inst;i=f(),y.destroy=i}s=s.next}while(s!==u)}}catch(b){Le(t,t.return,b)}}function mn(e,t,s){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var f=u.next;i=f;do{if((i.tag&e)===e){var y=i.inst,b=y.destroy;if(b!==void 0){y.destroy=void 0,u=t;var N=s,D=b;try{D()}catch($){Le(u,N,$)}}}i=i.next}while(i!==f)}}catch($){Le(t,t.return,$)}}function zm(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Nh(t,s)}catch(i){Le(e,e.return,i)}}}function Um(e,t,s){s.props=Jn(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){Le(e,t,i)}}function ii(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof s=="function"?e.refCleanup=s(i):s.current=i}}catch(u){Le(e,t,u)}}function ba(e,t){var s=e.ref,i=e.refCleanup;if(s!==null)if(typeof i=="function")try{i()}catch(u){Le(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(u){Le(e,t,u)}else s.current=null}function Lm(e){var t=e.type,s=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&i.focus();break e;case"img":s.src?i.src=s.src:s.srcSet&&(i.srcset=s.srcSet)}}catch(u){Le(e,e.return,u)}}function xu(e,t,s){try{var i=e.stateNode;jb(i,e.type,s,t),i[Rt]=t}catch(u){Le(e,e.return,u)}}function Bm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wn(e.type)||e.tag===4}function wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Bm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&wn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _u(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(e),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=ka));else if(i!==4&&(i===27&&wn(e.type)&&(s=e.stateNode,t=null),e=e.child,e!==null))for(_u(e,t,s),e=e.sibling;e!==null;)_u(e,t,s),e=e.sibling}function ql(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(i!==4&&(i===27&&wn(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(ql(e,t,s),e=e.sibling;e!==null;)ql(e,t,s),e=e.sibling}function qm(e){var t=e.stateNode,s=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);St(t,i,s),t[bt]=e,t[Rt]=s}catch(f){Le(e,e.return,f)}}var $a=!1,lt=!1,Su=!1,$m=typeof WeakSet=="function"?WeakSet:Set,gt=null;function nb(e,t){if(e=e.containerInfo,Gu=io,e=Ff(e),gc(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var i=s.getSelection&&s.getSelection();if(i&&i.rangeCount!==0){s=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{s.nodeType,f.nodeType}catch{s=null;break e}var y=0,b=-1,N=-1,D=0,$=0,I=e,M=null;t:for(;;){for(var L;I!==s||u!==0&&I.nodeType!==3||(b=y+u),I!==f||i!==0&&I.nodeType!==3||(N=y+i),I.nodeType===3&&(y+=I.nodeValue.length),(L=I.firstChild)!==null;)M=I,I=L;for(;;){if(I===e)break t;if(M===s&&++D===u&&(b=y),M===f&&++$===i&&(N=y),(L=I.nextSibling)!==null)break;I=M,M=I.parentNode}I=L}s=b===-1||N===-1?null:{start:b,end:N}}else s=null}s=s||{start:0,end:0}}else s=null;for(Pu={focusedElem:e,selectionRange:s},io=!1,gt=t;gt!==null;)if(t=gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,gt=e;else for(;gt!==null;){switch(t=gt,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)u=e[s],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,s=t,u=f.memoizedProps,f=f.memoizedState,i=s.stateNode;try{var ae=Jn(s.type,u);e=i.getSnapshotBeforeUpdate(ae,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(he){Le(s,s.return,he)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Ju(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ju(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=t.sibling,e!==null){e.return=t.return,gt=e;break}gt=t.return}}function Hm(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Va(e,s),i&4&&ri(5,s);break;case 1:if(Va(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(y){Le(s,s.return,y)}else{var u=Jn(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Le(s,s.return,y)}}i&64&&zm(s),i&512&&ii(s,s.return);break;case 3:if(Va(e,s),i&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{Nh(e,t)}catch(y){Le(s,s.return,y)}}break;case 27:t===null&&i&4&&qm(s);case 26:case 5:Va(e,s),t===null&&i&4&&Lm(s),i&512&&ii(s,s.return);break;case 12:Va(e,s);break;case 31:Va(e,s),i&4&&Gm(e,s);break;case 13:Va(e,s),i&4&&Pm(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=fb.bind(null,s),Rb(e,s))));break;case 22:if(i=s.memoizedState!==null||$a,!i){t=t!==null&&t.memoizedState!==null||lt,u=$a;var f=lt;$a=i,(lt=t)&&!f?Ia(e,s,(s.subtreeFlags&8772)!==0):Va(e,s),$a=u,lt=f}break;case 30:break;default:Va(e,s)}}function Vm(e){var t=e.alternate;t!==null&&(e.alternate=null,Vm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Wo(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Xe=null,Mt=!1;function Ha(e,t,s){for(s=s.child;s!==null;)Im(e,t,s),s=s.sibling}function Im(e,t,s){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Dn,s)}catch{}switch(s.tag){case 26:lt||ba(s,t),Ha(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:lt||ba(s,t);var i=Xe,u=Mt;wn(s.type)&&(Xe=s.stateNode,Mt=!1),Ha(e,t,s),pi(s.stateNode),Xe=i,Mt=u;break;case 5:lt||ba(s,t);case 6:if(i=Xe,u=Mt,Xe=null,Ha(e,t,s),Xe=i,Mt=u,Xe!==null)if(Mt)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(s.stateNode)}catch(f){Le(s,t,f)}else try{Xe.removeChild(s.stateNode)}catch(f){Le(s,t,f)}break;case 18:Xe!==null&&(Mt?(e=Xe,zp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),tr(e)):zp(Xe,s.stateNode));break;case 4:i=Xe,u=Mt,Xe=s.stateNode.containerInfo,Mt=!0,Ha(e,t,s),Xe=i,Mt=u;break;case 0:case 11:case 14:case 15:mn(2,s,t),lt||mn(4,s,t),Ha(e,t,s);break;case 1:lt||(ba(s,t),i=s.stateNode,typeof i.componentWillUnmount=="function"&&Um(s,t,i)),Ha(e,t,s);break;case 21:Ha(e,t,s);break;case 22:lt=(i=lt)||s.memoizedState!==null,Ha(e,t,s),lt=i;break;default:Ha(e,t,s)}}function Gm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{tr(e)}catch(s){Le(t,t.return,s)}}}function Pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{tr(e)}catch(s){Le(t,t.return,s)}}function sb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $m),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $m),t;default:throw Error(l(435,e.tag))}}function $l(e,t){var s=sb(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var u=hb.bind(null,e,i);i.then(u,u)}})}function zt(e,t){var s=t.deletions;if(s!==null)for(var i=0;i<s.length;i++){var u=s[i],f=e,y=t,b=y;e:for(;b!==null;){switch(b.tag){case 27:if(wn(b.type)){Xe=b.stateNode,Mt=!1;break e}break;case 5:Xe=b.stateNode,Mt=!1;break e;case 3:case 4:Xe=b.stateNode.containerInfo,Mt=!0;break e}b=b.return}if(Xe===null)throw Error(l(160));Im(f,y,u),Xe=null,Mt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Km(t,e),t=t.sibling}var oa=null;function Km(e,t){var s=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zt(t,e),Ut(e),i&4&&(mn(3,e,e.return),ri(3,e),mn(5,e,e.return));break;case 1:zt(t,e),Ut(e),i&512&&(lt||s===null||ba(s,s.return)),i&64&&$a&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?i:s.concat(i))));break;case 26:var u=oa;if(zt(t,e),Ut(e),i&512&&(lt||s===null||ba(s,s.return)),i&4){var f=s!==null?s.memoizedState:null;if(i=e.memoizedState,s===null)if(i===null)if(e.stateNode===null){e:{i=e.type,s=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Dr]||f[bt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),St(f,i,s),f[bt]=e,pt(f),i=f;break e;case"link":var y=Kp("link","href",u).get(i+(s.href||""));if(y){for(var b=0;b<y.length;b++)if(f=y[b],f.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&f.getAttribute("rel")===(s.rel==null?null:s.rel)&&f.getAttribute("title")===(s.title==null?null:s.title)&&f.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){y.splice(b,1);break t}}f=u.createElement(i),St(f,i,s),u.head.appendChild(f);break;case"meta":if(y=Kp("meta","content",u).get(i+(s.content||""))){for(b=0;b<y.length;b++)if(f=y[b],f.getAttribute("content")===(s.content==null?null:""+s.content)&&f.getAttribute("name")===(s.name==null?null:s.name)&&f.getAttribute("property")===(s.property==null?null:s.property)&&f.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&f.getAttribute("charset")===(s.charSet==null?null:s.charSet)){y.splice(b,1);break t}}f=u.createElement(i),St(f,i,s),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[bt]=e,pt(f),i=f}e.stateNode=i}else Yp(u,e.type,e.stateNode);else e.stateNode=Pp(u,i,e.memoizedProps);else f!==i?(f===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):f.count--,i===null?Yp(u,e.type,e.stateNode):Pp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&xu(e,e.memoizedProps,s.memoizedProps)}break;case 27:zt(t,e),Ut(e),i&512&&(lt||s===null||ba(s,s.return)),s!==null&&i&4&&xu(e,e.memoizedProps,s.memoizedProps);break;case 5:if(zt(t,e),Ut(e),i&512&&(lt||s===null||ba(s,s.return)),e.flags&32){u=e.stateNode;try{js(u,"")}catch(ae){Le(e,e.return,ae)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,xu(e,u,s!==null?s.memoizedProps:u)),i&1024&&(Su=!0);break;case 6:if(zt(t,e),Ut(e),i&4){if(e.stateNode===null)throw Error(l(162));i=e.memoizedProps,s=e.stateNode;try{s.nodeValue=i}catch(ae){Le(e,e.return,ae)}}break;case 3:if(ao=null,u=oa,oa=eo(t.containerInfo),zt(t,e),oa=u,Ut(e),i&4&&s!==null&&s.memoizedState.isDehydrated)try{tr(t.containerInfo)}catch(ae){Le(e,e.return,ae)}Su&&(Su=!1,Ym(e));break;case 4:i=oa,oa=eo(e.stateNode.containerInfo),zt(t,e),Ut(e),oa=i;break;case 12:zt(t,e),Ut(e);break;case 31:zt(t,e),Ut(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,$l(e,i)));break;case 13:zt(t,e),Ut(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Vl=mt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,$l(e,i)));break;case 22:u=e.memoizedState!==null;var N=s!==null&&s.memoizedState!==null,D=$a,$=lt;if($a=D||u,lt=$||N,zt(t,e),lt=$,$a=D,Ut(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(s===null||N||$a||lt||Xn(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){N=s=t;try{if(f=N.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=N.stateNode;var I=N.memoizedProps.style,M=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=M==null||typeof M=="boolean"?"":(""+M).trim()}}catch(ae){Le(N,N.return,ae)}}}else if(t.tag===6){if(s===null){N=t;try{N.stateNode.nodeValue=u?"":N.memoizedProps}catch(ae){Le(N,N.return,ae)}}}else if(t.tag===18){if(s===null){N=t;try{var L=N.stateNode;u?Up(L,!0):Up(N.stateNode,!1)}catch(ae){Le(N,N.return,ae)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(s=i.retryQueue,s!==null&&(i.retryQueue=null,$l(e,s))));break;case 19:zt(t,e),Ut(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,$l(e,i)));break;case 30:break;case 21:break;default:zt(t,e),Ut(e)}}function Ut(e){var t=e.flags;if(t&2){try{for(var s,i=e.return;i!==null;){if(Bm(i)){s=i;break}i=i.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var u=s.stateNode,f=wu(e);ql(e,f,u);break;case 5:var y=s.stateNode;s.flags&32&&(js(y,""),s.flags&=-33);var b=wu(e);ql(e,b,y);break;case 3:case 4:var N=s.stateNode.containerInfo,D=wu(e);_u(e,D,N);break;default:throw Error(l(161))}}catch($){Le(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ym(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ym(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Va(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Hm(e,t.alternate,t),t=t.sibling}function Xn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:mn(4,t,t.return),Xn(t);break;case 1:ba(t,t.return);var s=t.stateNode;typeof s.componentWillUnmount=="function"&&Um(t,t.return,s),Xn(t);break;case 27:pi(t.stateNode);case 26:case 5:ba(t,t.return),Xn(t);break;case 22:t.memoizedState===null&&Xn(t);break;case 30:Xn(t);break;default:Xn(t)}e=e.sibling}}function Ia(e,t,s){for(s=s&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,y=f.flags;switch(f.tag){case 0:case 11:case 15:Ia(u,f,s),ri(4,f);break;case 1:if(Ia(u,f,s),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(D){Le(i,i.return,D)}if(i=f,u=i.updateQueue,u!==null){var b=i.stateNode;try{var N=u.shared.hiddenCallbacks;if(N!==null)for(u.shared.hiddenCallbacks=null,u=0;u<N.length;u++)jh(N[u],b)}catch(D){Le(i,i.return,D)}}s&&y&64&&zm(f),ii(f,f.return);break;case 27:qm(f);case 26:case 5:Ia(u,f,s),s&&i===null&&y&4&&Lm(f),ii(f,f.return);break;case 12:Ia(u,f,s);break;case 31:Ia(u,f,s),s&&y&4&&Gm(u,f);break;case 13:Ia(u,f,s),s&&y&4&&Pm(u,f);break;case 22:f.memoizedState===null&&Ia(u,f,s),ii(f,f.return);break;case 30:break;default:Ia(u,f,s)}t=t.sibling}}function ju(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Kr(s))}function Nu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Kr(e))}function ca(e,t,s,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Jm(e,t,s,i),t=t.sibling}function Jm(e,t,s,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ca(e,t,s,i),u&2048&&ri(9,t);break;case 1:ca(e,t,s,i);break;case 3:ca(e,t,s,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Kr(e)));break;case 12:if(u&2048){ca(e,t,s,i),e=t.stateNode;try{var f=t.memoizedProps,y=f.id,b=f.onPostCommit;typeof b=="function"&&b(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Le(t,t.return,N)}}else ca(e,t,s,i);break;case 31:ca(e,t,s,i);break;case 13:ca(e,t,s,i);break;case 23:break;case 22:f=t.stateNode,y=t.alternate,t.memoizedState!==null?f._visibility&2?ca(e,t,s,i):li(e,t):f._visibility&2?ca(e,t,s,i):(f._visibility|=2,Gs(e,t,s,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&ju(y,t);break;case 24:ca(e,t,s,i),u&2048&&Nu(t.alternate,t);break;default:ca(e,t,s,i)}}function Gs(e,t,s,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,y=t,b=s,N=i,D=y.flags;switch(y.tag){case 0:case 11:case 15:Gs(f,y,b,N,u),ri(8,y);break;case 23:break;case 22:var $=y.stateNode;y.memoizedState!==null?$._visibility&2?Gs(f,y,b,N,u):li(f,y):($._visibility|=2,Gs(f,y,b,N,u)),u&&D&2048&&ju(y.alternate,y);break;case 24:Gs(f,y,b,N,u),u&&D&2048&&Nu(y.alternate,y);break;default:Gs(f,y,b,N,u)}t=t.sibling}}function li(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,i=t,u=i.flags;switch(i.tag){case 22:li(s,i),u&2048&&ju(i.alternate,i);break;case 24:li(s,i),u&2048&&Nu(i.alternate,i);break;default:li(s,i)}t=t.sibling}}var oi=8192;function Ps(e,t,s){if(e.subtreeFlags&oi)for(e=e.child;e!==null;)Xm(e,t,s),e=e.sibling}function Xm(e,t,s){switch(e.tag){case 26:Ps(e,t,s),e.flags&oi&&e.memoizedState!==null&&Gb(s,oa,e.memoizedState,e.memoizedProps);break;case 5:Ps(e,t,s);break;case 3:case 4:var i=oa;oa=eo(e.stateNode.containerInfo),Ps(e,t,s),oa=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=oi,oi=16777216,Ps(e,t,s),oi=i):Ps(e,t,s));break;default:Ps(e,t,s)}}function Qm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ci(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];gt=i,Fm(i,e)}Qm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zm(e),e=e.sibling}function Zm(e){switch(e.tag){case 0:case 11:case 15:ci(e),e.flags&2048&&mn(9,e,e.return);break;case 3:ci(e);break;case 12:ci(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hl(e)):ci(e);break;default:ci(e)}}function Hl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];gt=i,Fm(i,e)}Qm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:mn(8,t,t.return),Hl(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function Fm(e,t){for(;gt!==null;){var s=gt;switch(s.tag){case 0:case 11:case 15:mn(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var i=s.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Kr(s.memoizedState.cache)}if(i=s.child,i!==null)i.return=s,gt=i;else e:for(s=e;gt!==null;){i=gt;var u=i.sibling,f=i.return;if(Vm(i),i===s){gt=null;break e}if(u!==null){u.return=f,gt=u;break e}gt=f}}}var rb={getCacheForType:function(e){var t=wt(st),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return wt(st).controller.signal}},ib=typeof WeakMap=="function"?WeakMap:Map,ze=0,Ie=null,je=null,Te=0,Ue=0,Gt=null,pn=!1,Ks=!1,Eu=!1,Ga=0,We=0,gn=0,Qn=0,Tu=0,Pt=0,Ys=0,ui=null,Lt=null,Au=!1,Vl=0,Wm=0,Il=1/0,Gl=null,yn=null,ut=0,vn=null,Js=null,Pa=0,Cu=0,ku=null,ep=null,di=0,Ou=null;function Kt(){return(ze&2)!==0&&Te!==0?Te&-Te:z.T!==null?Lu():gf()}function tp(){if(Pt===0)if((Te&536870912)===0||ke){var e=ps;ps<<=1,(ps&3932160)===0&&(ps=262144),Pt=e}else Pt=536870912;return e=Vt.current,e!==null&&(e.flags|=32),Pt}function Bt(e,t,s){(e===Ie&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)&&(Xs(e,0),bn(e,Te,Pt,!1)),tn(e,s),((ze&2)===0||e!==Ie)&&(e===Ie&&((ze&2)===0&&(Qn|=s),We===4&&bn(e,Te,Pt,!1)),xa(e))}function ap(e,t,s){if((ze&6)!==0)throw Error(l(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||te(e,t),u=i?cb(e,t):Du(e,t,!0),f=i;do{if(u===0){Ks&&!i&&bn(e,t,0,!1);break}else{if(s=e.current.alternate,f&&!lb(s)){u=Du(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var b=e;u=ui;var N=b.current.memoizedState.isDehydrated;if(N&&(Xs(b,y).flags|=256),y=Du(b,y,!1),y!==2){if(Eu&&!N){b.errorRecoveryDisabledLanes|=f,Qn|=f,u=4;break e}f=Lt,Lt=u,f!==null&&(Lt===null?Lt=f:Lt.push.apply(Lt,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){Xs(e,0),bn(e,t,0,!0);break}e:{switch(i=e,f=u,f){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:bn(i,t,Pt,!pn);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Vl+300-mt(),10<u)){if(bn(i,t,Pt,!pn),U(i,0,!0)!==0)break e;Pa=t,i.timeoutHandle=Dp(np.bind(null,i,s,Lt,Gl,Au,t,Pt,Qn,Ys,pn,f,"Throttled",-0,0),u);break e}np(i,s,Lt,Gl,Au,t,Pt,Qn,Ys,pn,f,null,-0,0)}}break}while(!0);xa(e)}function np(e,t,s,i,u,f,y,b,N,D,$,I,M,L){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ka},Xm(t,f,I);var ae=(f&62914560)===f?Vl-mt():(f&4194048)===f?Wm-mt():0;if(ae=Pb(I,ae),ae!==null){Pa=f,e.cancelPendingCommit=ae(dp.bind(null,e,t,f,s,i,u,y,b,N,$,I,null,M,L)),bn(e,f,y,!D);return}}dp(e,t,f,s,i,u,y,b,N)}function lb(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var i=0;i<s.length;i++){var u=s[i],f=u.getSnapshot;u=u.value;try{if(!$t(f(),u))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bn(e,t,s,i){t&=~Tu,t&=~Qn,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-kt(u),y=1<<f;i[f]=-1,u&=~y}s!==0&&Wi(e,s,t)}function Pl(){return(ze&6)===0?(fi(0),!1):!0}function Ru(){if(je!==null){if(Ue===0)var e=je.return;else e=je,Ma=Hn=null,Jc(e),qs=null,Jr=0,e=je;for(;e!==null;)Mm(e.alternate,e),e=e.return;je=null}}function Xs(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Tb(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Pa=0,Ru(),Ie=e,je=s=Ra(e.current,null),Te=t,Ue=0,Gt=null,pn=!1,Ks=te(e,t),Eu=!1,Ys=Pt=Tu=Qn=gn=We=0,Lt=ui=null,Au=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-kt(i),f=1<<u;t|=e[u],i&=~f}return Ga=t,fl(),s}function sp(e,t){xe=null,z.H=ai,t===Bs||t===xl?(t=xh(),Ue=3):t===Uc?(t=xh(),Ue=4):Ue=t===uu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Gt=t,je===null&&(We=1,Ml(e,Wt(t,e.current)))}function rp(){var e=Vt.current;return e===null?!0:(Te&4194048)===Te?na===null:(Te&62914560)===Te||(Te&536870912)!==0?e===na:!1}function ip(){var e=z.H;return z.H=ai,e===null?ai:e}function lp(){var e=z.A;return z.A=rb,e}function Kl(){We=4,pn||(Te&4194048)!==Te&&Vt.current!==null||(Ks=!0),(gn&134217727)===0&&(Qn&134217727)===0||Ie===null||bn(Ie,Te,Pt,!1)}function Du(e,t,s){var i=ze;ze|=2;var u=ip(),f=lp();(Ie!==e||Te!==t)&&(Gl=null,Xs(e,t)),t=!1;var y=We;e:do try{if(Ue!==0&&je!==null){var b=je,N=Gt;switch(Ue){case 8:Ru(),y=6;break e;case 3:case 2:case 9:case 6:Vt.current===null&&(t=!0);var D=Ue;if(Ue=0,Gt=null,Qs(e,b,N,D),s&&Ks){y=0;break e}break;default:D=Ue,Ue=0,Gt=null,Qs(e,b,N,D)}}ob(),y=We;break}catch($){sp(e,$)}while(!0);return t&&e.shellSuspendCounter++,Ma=Hn=null,ze=i,z.H=u,z.A=f,je===null&&(Ie=null,Te=0,fl()),y}function ob(){for(;je!==null;)op(je)}function cb(e,t){var s=ze;ze|=2;var i=ip(),u=lp();Ie!==e||Te!==t?(Gl=null,Il=mt()+500,Xs(e,t)):Ks=te(e,t);e:do try{if(Ue!==0&&je!==null){t=je;var f=Gt;t:switch(Ue){case 1:Ue=0,Gt=null,Qs(e,t,f,1);break;case 2:case 9:if(vh(f)){Ue=0,Gt=null,cp(t);break}t=function(){Ue!==2&&Ue!==9||Ie!==e||(Ue=7),xa(e)},f.then(t,t);break e;case 3:Ue=7;break e;case 4:Ue=5;break e;case 7:vh(f)?(Ue=0,Gt=null,cp(t)):(Ue=0,Gt=null,Qs(e,t,f,7));break;case 5:var y=null;switch(je.tag){case 26:y=je.memoizedState;case 5:case 27:var b=je;if(y?Jp(y):b.stateNode.complete){Ue=0,Gt=null;var N=b.sibling;if(N!==null)je=N;else{var D=b.return;D!==null?(je=D,Yl(D)):je=null}break t}}Ue=0,Gt=null,Qs(e,t,f,5);break;case 6:Ue=0,Gt=null,Qs(e,t,f,6);break;case 8:Ru(),We=6;break e;default:throw Error(l(462))}}ub();break}catch($){sp(e,$)}while(!0);return Ma=Hn=null,z.H=i,z.A=u,ze=s,je!==null?0:(Ie=null,Te=0,fl(),We)}function ub(){for(;je!==null&&!Yi();)op(je)}function op(e){var t=Rm(e.alternate,e,Ga);e.memoizedProps=e.pendingProps,t===null?Yl(e):je=t}function cp(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Em(s,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Em(s,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:Jc(t);default:Mm(s,t),t=je=lh(t,Ga),t=Rm(s,t,Ga)}e.memoizedProps=e.pendingProps,t===null?Yl(e):je=t}function Qs(e,t,s,i){Ma=Hn=null,Jc(t),qs=null,Jr=0;var u=t.return;try{if(F0(e,u,t,s,Te)){We=1,Ml(e,Wt(s,e.current)),je=null;return}}catch(f){if(u!==null)throw je=u,f;We=1,Ml(e,Wt(s,e.current)),je=null;return}t.flags&32768?(ke||i===1?e=!0:Ks||(Te&536870912)!==0?e=!1:(pn=e=!0,(i===2||i===9||i===3||i===6)&&(i=Vt.current,i!==null&&i.tag===13&&(i.flags|=16384))),up(t,e)):Yl(t)}function Yl(e){var t=e;do{if((t.flags&32768)!==0){up(t,pn);return}e=t.return;var s=tb(t.alternate,t,Ga);if(s!==null){je=s;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);We===0&&(We=5)}function up(e,t){do{var s=ab(e.alternate,e);if(s!==null){s.flags&=32767,je=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=s}while(e!==null);We=6,je=null}function dp(e,t,s,i,u,f,y,b,N){e.cancelPendingCommit=null;do Jl();while(ut!==0);if((ze&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=wc,ys(e,s,f,y,b,N),e===Ie&&(je=Ie=null,Te=0),Js=t,vn=e,Pa=s,Cu=f,ku=u,ep=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,mb(hs,function(){return gp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=z.T,z.T=null,u=Q.p,Q.p=2,y=ze,ze|=4;try{nb(e,t,s)}finally{ze=y,Q.p=u,z.T=i}}ut=1,fp(),hp(),mp()}}function fp(){if(ut===1){ut=0;var e=vn,t=Js,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=z.T,z.T=null;var i=Q.p;Q.p=2;var u=ze;ze|=4;try{Km(t,e);var f=Pu,y=Ff(e.containerInfo),b=f.focusedElem,N=f.selectionRange;if(y!==b&&b&&b.ownerDocument&&Zf(b.ownerDocument.documentElement,b)){if(N!==null&&gc(b)){var D=N.start,$=N.end;if($===void 0&&($=D),"selectionStart"in b)b.selectionStart=D,b.selectionEnd=Math.min($,b.value.length);else{var I=b.ownerDocument||document,M=I&&I.defaultView||window;if(M.getSelection){var L=M.getSelection(),ae=b.textContent.length,he=Math.min(N.start,ae),He=N.end===void 0?he:Math.min(N.end,ae);!L.extend&&he>He&&(y=He,He=he,he=y);var C=Qf(b,he),E=Qf(b,He);if(C&&E&&(L.rangeCount!==1||L.anchorNode!==C.node||L.anchorOffset!==C.offset||L.focusNode!==E.node||L.focusOffset!==E.offset)){var R=I.createRange();R.setStart(C.node,C.offset),L.removeAllRanges(),he>He?(L.addRange(R),L.extend(E.node,E.offset)):(R.setEnd(E.node,E.offset),L.addRange(R))}}}}for(I=[],L=b;L=L.parentNode;)L.nodeType===1&&I.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var H=I[b];H.element.scrollLeft=H.left,H.element.scrollTop=H.top}}io=!!Gu,Pu=Gu=null}finally{ze=u,Q.p=i,z.T=s}}e.current=t,ut=2}}function hp(){if(ut===2){ut=0;var e=vn,t=Js,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=z.T,z.T=null;var i=Q.p;Q.p=2;var u=ze;ze|=4;try{Hm(e,t.alternate,t)}finally{ze=u,Q.p=i,z.T=s}}ut=3}}function mp(){if(ut===4||ut===3){ut=0,Ji();var e=vn,t=Js,s=Pa,i=ep;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ut=5:(ut=0,Js=vn=null,pp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(yn=null),Zo(s),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Dn,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=z.T,u=Q.p,Q.p=2,z.T=null;try{for(var f=e.onRecoverableError,y=0;y<i.length;y++){var b=i[y];f(b.value,{componentStack:b.stack})}}finally{z.T=t,Q.p=u}}(Pa&3)!==0&&Jl(),xa(e),u=e.pendingLanes,(s&261930)!==0&&(u&42)!==0?e===Ou?di++:(di=0,Ou=e):di=0,fi(0)}}function pp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Kr(t)))}function Jl(){return fp(),hp(),mp(),gp()}function gp(){if(ut!==5)return!1;var e=vn,t=Cu;Cu=0;var s=Zo(Pa),i=z.T,u=Q.p;try{Q.p=32>s?32:s,z.T=null,s=ku,ku=null;var f=vn,y=Pa;if(ut=0,Js=vn=null,Pa=0,(ze&6)!==0)throw Error(l(331));var b=ze;if(ze|=4,Zm(f.current),Jm(f,f.current,y,s),ze=b,fi(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Dn,f)}catch{}return!0}finally{Q.p=u,z.T=i,pp(e,t)}}function yp(e,t,s){t=Wt(s,t),t=cu(e.stateNode,t,2),e=dn(e,t,2),e!==null&&(tn(e,2),xa(e))}function Le(e,t,s){if(e.tag===3)yp(e,e,s);else for(;t!==null;){if(t.tag===3){yp(t,e,s);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(yn===null||!yn.has(i))){e=Wt(s,e),s=vm(2),i=dn(t,s,2),i!==null&&(bm(s,i,t,e),tn(i,2),xa(i));break}}t=t.return}}function Mu(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new ib;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(s)||(Eu=!0,u.add(s),e=db.bind(null,e,t,s),t.then(e,e))}function db(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Ie===e&&(Te&s)===s&&(We===4||We===3&&(Te&62914560)===Te&&300>mt()-Vl?(ze&2)===0&&Xs(e,0):Tu|=s,Ys===Te&&(Ys=0)),xa(e)}function vp(e,t){t===0&&(t=ga()),e=Bn(e,t),e!==null&&(tn(e,t),xa(e))}function fb(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),vp(e,s)}function hb(e,t){var s=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(s=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(l(314))}i!==null&&i.delete(t),vp(e,s)}function mb(e,t){return en(e,t)}var Xl=null,Zs=null,zu=!1,Ql=!1,Uu=!1,xn=0;function xa(e){e!==Zs&&e.next===null&&(Zs===null?Xl=Zs=e:Zs=Zs.next=e),Ql=!0,zu||(zu=!0,gb())}function fi(e,t){if(!Uu&&Ql){Uu=!0;do for(var s=!1,i=Xl;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var y=i.suspendedLanes,b=i.pingedLanes;f=(1<<31-kt(42|e)+1)-1,f&=u&~(y&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(s=!0,_p(i,f))}else f=Te,f=U(i,i===Ie?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||te(i,f)||(s=!0,_p(i,f));i=i.next}while(s);Uu=!1}}function pb(){bp()}function bp(){Ql=zu=!1;var e=0;xn!==0&&Eb()&&(e=xn);for(var t=mt(),s=null,i=Xl;i!==null;){var u=i.next,f=xp(i,t);f===0?(i.next=null,s===null?Xl=u:s.next=u,u===null&&(Zs=s)):(s=i,(e!==0||(f&3)!==0)&&(Ql=!0)),i=u}ut!==0&&ut!==5||fi(e),xn!==0&&(xn=0)}function xp(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-kt(f),b=1<<y,N=u[y];N===-1?((b&s)===0||(b&i)!==0)&&(u[y]=Me(b,t)):N<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ie,s=Te,s=U(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&ds(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||te(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&ds(i),Zo(s)){case 2:case 8:s=Qi;break;case 32:s=hs;break;case 268435456:s=Zi;break;default:s=hs}return i=wp.bind(null,e),s=en(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&ds(i),e.callbackPriority=2,e.callbackNode=null,2}function wp(e,t){if(ut!==0&&ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Jl()&&e.callbackNode!==s)return null;var i=Te;return i=U(e,e===Ie?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(ap(e,i,t),xp(e,mt()),e.callbackNode!=null&&e.callbackNode===s?wp.bind(null,e):null)}function _p(e,t){if(Jl())return null;ap(e,t,!0)}function gb(){Ab(function(){(ze&6)!==0?en(Xi,pb):bp()})}function Lu(){if(xn===0){var e=Us;e===0&&(e=ms,ms<<=1,(ms&261888)===0&&(ms=256)),xn=e}return xn}function Sp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:sl(""+e)}function jp(e,t){var s=t.ownerDocument.createElement("input");return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}function yb(e,t,s,i,u){if(t==="submit"&&s&&s.stateNode===u){var f=Sp((u[Rt]||null).action),y=i.submitter;y&&(t=(t=y[Rt]||null)?Sp(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var b=new ol("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(xn!==0){var N=y?jp(u,y):new FormData(u);nu(s,{pending:!0,data:N,method:u.method,action:f},null,N)}}else typeof f=="function"&&(b.preventDefault(),N=y?jp(u,y):new FormData(u),nu(s,{pending:!0,data:N,method:u.method,action:f},f,N))},currentTarget:u}]})}}for(var Bu=0;Bu<xc.length;Bu++){var qu=xc[Bu],vb=qu.toLowerCase(),bb=qu[0].toUpperCase()+qu.slice(1);la(vb,"on"+bb)}la(th,"onAnimationEnd"),la(ah,"onAnimationIteration"),la(nh,"onAnimationStart"),la("dblclick","onDoubleClick"),la("focusin","onFocus"),la("focusout","onBlur"),la(z0,"onTransitionRun"),la(U0,"onTransitionStart"),la(L0,"onTransitionCancel"),la(sh,"onTransitionEnd"),_s("onMouseEnter",["mouseout","mouseover"]),_s("onMouseLeave",["mouseout","mouseover"]),_s("onPointerEnter",["pointerout","pointerover"]),_s("onPointerLeave",["pointerout","pointerover"]),Mn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Mn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Mn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Mn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Mn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Mn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),xb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(hi));function Np(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var i=e[s],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var y=i.length-1;0<=y;y--){var b=i[y],N=b.instance,D=b.currentTarget;if(b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=D;try{f(u)}catch($){dl($)}u.currentTarget=null,f=N}else for(y=0;y<i.length;y++){if(b=i[y],N=b.instance,D=b.currentTarget,b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=D;try{f(u)}catch($){dl($)}u.currentTarget=null,f=N}}}}function Ne(e,t){var s=t[Fo];s===void 0&&(s=t[Fo]=new Set);var i=e+"__bubble";s.has(i)||(Ep(t,e,2,!1),s.add(i))}function $u(e,t,s){var i=0;t&&(i|=4),Ep(s,e,i,t)}var Zl="_reactListening"+Math.random().toString(36).slice(2);function Hu(e){if(!e[Zl]){e[Zl]=!0,bf.forEach(function(s){s!=="selectionchange"&&(xb.has(s)||$u(s,!1,e),$u(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zl]||(t[Zl]=!0,$u("selectionchange",!1,t))}}function Ep(e,t,s,i){switch(tg(t)){case 2:var u=Jb;break;case 8:u=Xb;break;default:u=ad}s=u.bind(null,t,s,e),u=void 0,!lc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,s,{capture:!0,passive:u}):e.addEventListener(t,s,!0):u!==void 0?e.addEventListener(t,s,{passive:u}):e.addEventListener(t,s,!1)}function Vu(e,t,s,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var y=i.tag;if(y===3||y===4){var b=i.stateNode.containerInfo;if(b===u)break;if(y===4)for(y=i.return;y!==null;){var N=y.tag;if((N===3||N===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;b!==null;){if(y=bs(b),y===null)return;if(N=y.tag,N===5||N===6||N===26||N===27){i=f=y;continue e}b=b.parentNode}}i=i.return}Of(function(){var D=f,$=rc(s),I=[];e:{var M=rh.get(e);if(M!==void 0){var L=ol,ae=e;switch(e){case"keypress":if(il(s)===0)break e;case"keydown":case"keyup":L=h0;break;case"focusin":ae="focus",L=dc;break;case"focusout":ae="blur",L=dc;break;case"beforeblur":case"afterblur":L=dc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=Mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=t0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=g0;break;case th:case ah:case nh:L=s0;break;case sh:L=v0;break;case"scroll":case"scrollend":L=Wv;break;case"wheel":L=x0;break;case"copy":case"cut":case"paste":L=i0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Uf;break;case"toggle":case"beforetoggle":L=_0}var he=(t&4)!==0,He=!he&&(e==="scroll"||e==="scrollend"),C=he?M!==null?M+"Capture":null:M;he=[];for(var E=D,R;E!==null;){var H=E;if(R=H.stateNode,H=H.tag,H!==5&&H!==26&&H!==27||R===null||C===null||(H=zr(E,C),H!=null&&he.push(mi(E,H,R))),He)break;E=E.return}0<he.length&&(M=new L(M,ae,null,s,$),I.push({event:M,listeners:he}))}}if((t&7)===0){e:{if(M=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",M&&s!==sc&&(ae=s.relatedTarget||s.fromElement)&&(bs(ae)||ae[vs]))break e;if((L||M)&&(M=$.window===$?$:(M=$.ownerDocument)?M.defaultView||M.parentWindow:window,L?(ae=s.relatedTarget||s.toElement,L=D,ae=ae?bs(ae):null,ae!==null&&(He=d(ae),he=ae.tag,ae!==He||he!==5&&he!==27&&he!==6)&&(ae=null)):(L=null,ae=D),L!==ae)){if(he=Mf,H="onMouseLeave",C="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(he=Uf,H="onPointerLeave",C="onPointerEnter",E="pointer"),He=L==null?M:Mr(L),R=ae==null?M:Mr(ae),M=new he(H,E+"leave",L,s,$),M.target=He,M.relatedTarget=R,H=null,bs($)===D&&(he=new he(C,E+"enter",ae,s,$),he.target=R,he.relatedTarget=He,H=he),He=H,L&&ae)t:{for(he=wb,C=L,E=ae,R=0,H=C;H;H=he(H))R++;H=0;for(var ce=E;ce;ce=he(ce))H++;for(;0<R-H;)C=he(C),R--;for(;0<H-R;)E=he(E),H--;for(;R--;){if(C===E||E!==null&&C===E.alternate){he=C;break t}C=he(C),E=he(E)}he=null}else he=null;L!==null&&Tp(I,M,L,he,!1),ae!==null&&He!==null&&Tp(I,He,ae,he,!0)}}e:{if(M=D?Mr(D):window,L=M.nodeName&&M.nodeName.toLowerCase(),L==="select"||L==="input"&&M.type==="file")var Re=Gf;else if(Vf(M))if(Pf)Re=R0;else{Re=k0;var ie=C0}else L=M.nodeName,!L||L.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?D&&nc(D.elementType)&&(Re=Gf):Re=O0;if(Re&&(Re=Re(e,D))){If(I,Re,s,$);break e}ie&&ie(e,M,D),e==="focusout"&&D&&M.type==="number"&&D.memoizedProps.value!=null&&ac(M,"number",M.value)}switch(ie=D?Mr(D):window,e){case"focusin":(Vf(ie)||ie.contentEditable==="true")&&(As=ie,yc=D,Ir=null);break;case"focusout":Ir=yc=As=null;break;case"mousedown":vc=!0;break;case"contextmenu":case"mouseup":case"dragend":vc=!1,Wf(I,s,$);break;case"selectionchange":if(M0)break;case"keydown":case"keyup":Wf(I,s,$)}var we;if(hc)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else Ts?$f(e,s)&&(Ae="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Ae="onCompositionStart");Ae&&(Lf&&s.locale!=="ko"&&(Ts||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&Ts&&(we=Rf()):(nn=$,oc="value"in nn?nn.value:nn.textContent,Ts=!0)),ie=Fl(D,Ae),0<ie.length&&(Ae=new zf(Ae,e,null,s,$),I.push({event:Ae,listeners:ie}),we?Ae.data=we:(we=Hf(s),we!==null&&(Ae.data=we)))),(we=j0?N0(e,s):E0(e,s))&&(Ae=Fl(D,"onBeforeInput"),0<Ae.length&&(ie=new zf("onBeforeInput","beforeinput",null,s,$),I.push({event:ie,listeners:Ae}),ie.data=we)),yb(I,e,D,s,$)}Np(I,t)})}function mi(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Fl(e,t){for(var s=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=zr(e,s),u!=null&&i.unshift(mi(e,u,f)),u=zr(e,t),u!=null&&i.push(mi(e,u,f))),e.tag===3)return i;e=e.return}return[]}function wb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Tp(e,t,s,i,u){for(var f=t._reactName,y=[];s!==null&&s!==i;){var b=s,N=b.alternate,D=b.stateNode;if(b=b.tag,N!==null&&N===i)break;b!==5&&b!==26&&b!==27||D===null||(N=D,u?(D=zr(s,f),D!=null&&y.unshift(mi(s,D,N))):u||(D=zr(s,f),D!=null&&y.push(mi(s,D,N)))),s=s.return}y.length!==0&&e.push({event:t,listeners:y})}var _b=/\r\n?/g,Sb=/\u0000|\uFFFD/g;function Ap(e){return(typeof e=="string"?e:""+e).replace(_b,`
|
|
9
|
+
`).replace(Sb,"")}function Cp(e,t){return t=Ap(t),Ap(e)===t}function $e(e,t,s,i,u,f){switch(s){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||js(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&js(e,""+i);break;case"className":al(e,"class",i);break;case"tabIndex":al(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":al(e,s,i);break;case"style":Cf(e,i,f);break;case"data":if(t!=="object"){al(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=sl(""+i),e.setAttribute(s,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(s==="formAction"?(t!=="input"&&$e(e,t,"name",u.name,u,null),$e(e,t,"formEncType",u.formEncType,u,null),$e(e,t,"formMethod",u.formMethod,u,null),$e(e,t,"formTarget",u.formTarget,u,null)):($e(e,t,"encType",u.encType,u,null),$e(e,t,"method",u.method,u,null),$e(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=sl(""+i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=ka);break;case"onScroll":i!=null&&Ne("scroll",e);break;case"onScrollEnd":i!=null&&Ne("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}s=sl(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""+i):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":i===!0?e.setAttribute(s,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(s,i):e.removeAttribute(s);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(s):e.setAttribute(s,i);break;case"popover":Ne("beforetoggle",e),Ne("toggle",e),tl(e,"popover",i);break;case"xlinkActuate":Ca(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ca(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ca(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ca(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ca(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ca(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ca(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ca(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ca(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":tl(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=Zv.get(s)||s,tl(e,s,i))}}function Iu(e,t,s,i,u,f){switch(s){case"style":Cf(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"children":typeof i=="string"?js(e,i):(typeof i=="number"||typeof i=="bigint")&&js(e,""+i);break;case"onScroll":i!=null&&Ne("scroll",e);break;case"onScrollEnd":i!=null&&Ne("scrollend",e);break;case"onClick":i!=null&&(e.onclick=ka);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xf.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(u=s.endsWith("Capture"),t=s.slice(2,u?s.length-7:void 0),f=e[Rt]||null,f=f!=null?f[s]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,i,u);break e}s in e?e[s]=i:i===!0?e.setAttribute(s,""):tl(e,s,i)}}}function St(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ne("error",e),Ne("load",e);var i=!1,u=!1,f;for(f in s)if(s.hasOwnProperty(f)){var y=s[f];if(y!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:$e(e,t,f,y,s,null)}}u&&$e(e,t,"srcSet",s.srcSet,s,null),i&&$e(e,t,"src",s.src,s,null);return;case"input":Ne("invalid",e);var b=f=y=u=null,N=null,D=null;for(i in s)if(s.hasOwnProperty(i)){var $=s[i];if($!=null)switch(i){case"name":u=$;break;case"type":y=$;break;case"checked":N=$;break;case"defaultChecked":D=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(l(137,t));break;default:$e(e,t,i,$,s,null)}}Nf(e,f,b,N,D,y,u,!1);return;case"select":Ne("invalid",e),i=y=f=null;for(u in s)if(s.hasOwnProperty(u)&&(b=s[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":y=b;break;case"multiple":i=b;default:$e(e,t,u,b,s,null)}t=f,s=y,e.multiple=!!i,t!=null?Ss(e,!!i,t,!1):s!=null&&Ss(e,!!i,s,!0);return;case"textarea":Ne("invalid",e),f=u=i=null;for(y in s)if(s.hasOwnProperty(y)&&(b=s[y],b!=null))switch(y){case"value":i=b;break;case"defaultValue":u=b;break;case"children":f=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(l(91));break;default:$e(e,t,y,b,s,null)}Tf(e,i,u,f);return;case"option":for(N in s)s.hasOwnProperty(N)&&(i=s[N],i!=null)&&(N==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":$e(e,t,N,i,s,null));return;case"dialog":Ne("beforetoggle",e),Ne("toggle",e),Ne("cancel",e),Ne("close",e);break;case"iframe":case"object":Ne("load",e);break;case"video":case"audio":for(i=0;i<hi.length;i++)Ne(hi[i],e);break;case"image":Ne("error",e),Ne("load",e);break;case"details":Ne("toggle",e);break;case"embed":case"source":case"link":Ne("error",e),Ne("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(D in s)if(s.hasOwnProperty(D)&&(i=s[D],i!=null))switch(D){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:$e(e,t,D,i,s,null)}return;default:if(nc(t)){for($ in s)s.hasOwnProperty($)&&(i=s[$],i!==void 0&&Iu(e,t,$,i,s,void 0));return}}for(b in s)s.hasOwnProperty(b)&&(i=s[b],i!=null&&$e(e,t,b,i,s,null))}function jb(e,t,s,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,b=null,N=null,D=null,$=null;for(L in s){var I=s[L];if(s.hasOwnProperty(L)&&I!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":N=I;default:i.hasOwnProperty(L)||$e(e,t,L,null,i,I)}}for(var M in i){var L=i[M];if(I=s[M],i.hasOwnProperty(M)&&(L!=null||I!=null))switch(M){case"type":f=L;break;case"name":u=L;break;case"checked":D=L;break;case"defaultChecked":$=L;break;case"value":y=L;break;case"defaultValue":b=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==I&&$e(e,t,M,L,i,I)}}tc(e,y,b,N,D,$,f,u);return;case"select":L=y=b=M=null;for(f in s)if(N=s[f],s.hasOwnProperty(f)&&N!=null)switch(f){case"value":break;case"multiple":L=N;default:i.hasOwnProperty(f)||$e(e,t,f,null,i,N)}for(u in i)if(f=i[u],N=s[u],i.hasOwnProperty(u)&&(f!=null||N!=null))switch(u){case"value":M=f;break;case"defaultValue":b=f;break;case"multiple":y=f;default:f!==N&&$e(e,t,u,f,i,N)}t=b,s=y,i=L,M!=null?Ss(e,!!s,M,!1):!!i!=!!s&&(t!=null?Ss(e,!!s,t,!0):Ss(e,!!s,s?[]:"",!1));return;case"textarea":L=M=null;for(b in s)if(u=s[b],s.hasOwnProperty(b)&&u!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:$e(e,t,b,null,i,u)}for(y in i)if(u=i[y],f=s[y],i.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":M=u;break;case"defaultValue":L=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&$e(e,t,y,u,i,f)}Ef(e,M,L);return;case"option":for(var ae in s)M=s[ae],s.hasOwnProperty(ae)&&M!=null&&!i.hasOwnProperty(ae)&&(ae==="selected"?e.selected=!1:$e(e,t,ae,null,i,M));for(N in i)M=i[N],L=s[N],i.hasOwnProperty(N)&&M!==L&&(M!=null||L!=null)&&(N==="selected"?e.selected=M&&typeof M!="function"&&typeof M!="symbol":$e(e,t,N,M,i,L));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var he in s)M=s[he],s.hasOwnProperty(he)&&M!=null&&!i.hasOwnProperty(he)&&$e(e,t,he,null,i,M);for(D in i)if(M=i[D],L=s[D],i.hasOwnProperty(D)&&M!==L&&(M!=null||L!=null))switch(D){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(l(137,t));break;default:$e(e,t,D,M,i,L)}return;default:if(nc(t)){for(var He in s)M=s[He],s.hasOwnProperty(He)&&M!==void 0&&!i.hasOwnProperty(He)&&Iu(e,t,He,void 0,i,M);for($ in i)M=i[$],L=s[$],!i.hasOwnProperty($)||M===L||M===void 0&&L===void 0||Iu(e,t,$,M,i,L);return}}for(var C in s)M=s[C],s.hasOwnProperty(C)&&M!=null&&!i.hasOwnProperty(C)&&$e(e,t,C,null,i,M);for(I in i)M=i[I],L=s[I],!i.hasOwnProperty(I)||M===L||M==null&&L==null||$e(e,t,I,M,i,L)}function kp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Nb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),i=0;i<s.length;i++){var u=s[i],f=u.transferSize,y=u.initiatorType,b=u.duration;if(f&&b&&kp(y)){for(y=0,b=u.responseEnd,i+=1;i<s.length;i++){var N=s[i],D=N.startTime;if(D>b)break;var $=N.transferSize,I=N.initiatorType;$&&kp(I)&&(N=N.responseEnd,y+=$*(N<b?1:(b-D)/(N-D)))}if(--i,t+=8*(f+y)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Gu=null,Pu=null;function Wl(e){return e.nodeType===9?e:e.ownerDocument}function Op(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Rp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ku(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Yu=null;function Eb(){var e=window.event;return e&&e.type==="popstate"?e===Yu?!1:(Yu=e,!0):(Yu=null,!1)}var Dp=typeof setTimeout=="function"?setTimeout:void 0,Tb=typeof clearTimeout=="function"?clearTimeout:void 0,Mp=typeof Promise=="function"?Promise:void 0,Ab=typeof queueMicrotask=="function"?queueMicrotask:typeof Mp<"u"?function(e){return Mp.resolve(null).then(e).catch(Cb)}:Dp;function Cb(e){setTimeout(function(){throw e})}function wn(e){return e==="head"}function zp(e,t){var s=t,i=0;do{var u=s.nextSibling;if(e.removeChild(s),u&&u.nodeType===8)if(s=u.data,s==="/$"||s==="/&"){if(i===0){e.removeChild(u),tr(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")pi(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,pi(s);for(var f=s.firstChild;f;){var y=f.nextSibling,b=f.nodeName;f[Dr]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||s.removeChild(f),f=y}}else s==="body"&&pi(e.ownerDocument.body);s=u}while(s);tr(t)}function Up(e,t){var s=e;e=0;do{var i=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),i&&i.nodeType===8)if(s=i.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=i}while(s)}function Ju(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Ju(s),Wo(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function kb(e,t,s,i){for(;e.nodeType===1;){var u=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Dr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=sa(e.nextSibling),e===null)break}return null}function Ob(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=sa(e.nextSibling),e===null))return null;return e}function Lp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sa(e.nextSibling),e===null))return null;return e}function Xu(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Rb(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var i=function(){t(),s.removeEventListener("DOMContentLoaded",i)};s.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function sa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Zu=null;function Bp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return sa(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function qp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function $p(e,t,s){switch(t=Wl(s),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function pi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Wo(e)}var ra=new Map,Hp=new Set;function eo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ka=Q.d;Q.d={f:Db,r:Mb,D:zb,C:Ub,L:Lb,m:Bb,X:$b,S:qb,M:Hb};function Db(){var e=Ka.f(),t=Pl();return e||t}function Mb(e){var t=xs(e);t!==null&&t.tag===5&&t.type==="form"?sm(t):Ka.r(e)}var Fs=typeof document>"u"?null:document;function Vp(e,t,s){var i=Fs;if(i&&typeof t=="string"&&t){var u=Zt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),Hp.has(u)||(Hp.add(u),e={rel:e,crossOrigin:s,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),St(t,"link",e),pt(t),i.head.appendChild(t)))}}function zb(e){Ka.D(e),Vp("dns-prefetch",e,null)}function Ub(e,t){Ka.C(e,t),Vp("preconnect",e,t)}function Lb(e,t,s){Ka.L(e,t,s);var i=Fs;if(i&&e&&t){var u='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+Zt(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+Zt(s.imageSizes)+'"]')):u+='[href="'+Zt(e)+'"]';var f=u;switch(t){case"style":f=Ws(e);break;case"script":f=er(e)}ra.has(f)||(e=_({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),ra.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(gi(f))||t==="script"&&i.querySelector(yi(f))||(t=i.createElement("link"),St(t,"link",e),pt(t),i.head.appendChild(t)))}}function Bb(e,t){Ka.m(e,t);var s=Fs;if(s&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Zt(i)+'"][href="'+Zt(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=er(e)}if(!ra.has(f)&&(e=_({rel:"modulepreload",href:e},t),ra.set(f,e),s.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(yi(f)))return}i=s.createElement("link"),St(i,"link",e),pt(i),s.head.appendChild(i)}}}function qb(e,t,s){Ka.S(e,t,s);var i=Fs;if(i&&e){var u=ws(i).hoistableStyles,f=Ws(e);t=t||"default";var y=u.get(f);if(!y){var b={loading:0,preload:null};if(y=i.querySelector(gi(f)))b.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":t},s),(s=ra.get(f))&&Fu(e,s);var N=y=i.createElement("link");pt(N),St(N,"link",e),N._p=new Promise(function(D,$){N.onload=D,N.onerror=$}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,to(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},u.set(f,y)}}}function $b(e,t){Ka.X(e,t);var s=Fs;if(s&&e){var i=ws(s).hoistableScripts,u=er(e),f=i.get(u);f||(f=s.querySelector(yi(u)),f||(e=_({src:e,async:!0},t),(t=ra.get(u))&&Wu(e,t),f=s.createElement("script"),pt(f),St(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Hb(e,t){Ka.M(e,t);var s=Fs;if(s&&e){var i=ws(s).hoistableScripts,u=er(e),f=i.get(u);f||(f=s.querySelector(yi(u)),f||(e=_({src:e,async:!0,type:"module"},t),(t=ra.get(u))&&Wu(e,t),f=s.createElement("script"),pt(f),St(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Ip(e,t,s,i){var u=(u=ye.current)?eo(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(t=Ws(s.href),s=ws(u).hoistableStyles,i=s.get(t),i||(i={type:"style",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Ws(s.href);var f=ws(u).hoistableStyles,y=f.get(e);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,y),(f=u.querySelector(gi(e)))&&!f._p&&(y.instance=f,y.state.loading=5),ra.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ra.set(e,s),f||Vb(u,e,s,y.state))),t&&i===null)throw Error(l(528,""));return y}if(t&&i!==null)throw Error(l(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=er(s),s=ws(u).hoistableScripts,i=s.get(t),i||(i={type:"script",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Ws(e){return'href="'+Zt(e)+'"'}function gi(e){return'link[rel="stylesheet"]['+e+"]"}function Gp(e){return _({},e,{"data-precedence":e.precedence,precedence:null})}function Vb(e,t,s,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),St(t,"link",s),pt(t),e.head.appendChild(t))}function er(e){return'[src="'+Zt(e)+'"]'}function yi(e){return"script[async]"+e}function Pp(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Zt(s.href)+'"]');if(i)return t.instance=i,pt(i),i;var u=_({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),pt(i),St(i,"style",u),to(i,s.precedence,e),t.instance=i;case"stylesheet":u=Ws(s.href);var f=e.querySelector(gi(u));if(f)return t.state.loading|=4,t.instance=f,pt(f),f;i=Gp(s),(u=ra.get(u))&&Fu(i,u),f=(e.ownerDocument||e).createElement("link"),pt(f);var y=f;return y._p=new Promise(function(b,N){y.onload=b,y.onerror=N}),St(f,"link",i),t.state.loading|=4,to(f,s.precedence,e),t.instance=f;case"script":return f=er(s.src),(u=e.querySelector(yi(f)))?(t.instance=u,pt(u),u):(i=s,(u=ra.get(f))&&(i=_({},s),Wu(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),pt(u),St(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,to(i,s.precedence,e));return t.instance}function to(e,t,s){for(var i=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,y=0;y<i.length;y++){var b=i[y];if(b.dataset.precedence===t)f=b;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function Fu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Wu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ao=null;function Kp(e,t,s){if(ao===null){var i=new Map,u=ao=new Map;u.set(s,i)}else u=ao,i=u.get(s),i||(i=new Map,u.set(s,i));if(i.has(e))return i;for(i.set(e,null),s=s.getElementsByTagName(e),u=0;u<s.length;u++){var f=s[u];if(!(f[Dr]||f[bt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(t)||"";y=e+y;var b=i.get(y);b?b.push(f):i.set(y,[f])}}return i}function Yp(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function Ib(e,t,s){if(s===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Jp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Gb(e,t,s,i){if(s.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var u=Ws(i.href),f=t.querySelector(gi(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=no.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=f,pt(f);return}f=t.ownerDocument||t,i=Gp(i),(u=ra.get(u))&&Fu(i,u),f=f.createElement("link"),pt(f);var y=f;y._p=new Promise(function(b,N){y.onload=b,y.onerror=N}),St(f,"link",i),s.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=no.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var ed=0;function Pb(e,t){return e.stylesheets&&e.count===0&&ro(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&ed===0&&(ed=62500*Nb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>ed?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function no(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ro(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var so=null;function ro(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,so=new Map,t.forEach(Kb,e),so=null,no.call(e))}function Kb(e,t){if(!(t.state.loading&4)){var s=so.get(e);if(s)var i=s.get(null);else{s=new Map,so.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(s.set(y.dataset.precedence,y),i=y)}i&&s.set(null,i)}u=t.instance,y=u.getAttribute("data-precedence"),f=s.get(y)||i,f===i&&s.set(null,u),s.set(y,u),this.count++,i=no.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var vi={$$typeof:B,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Yb(e,t,s,i,u,f,y,b,N){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Rr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rr(0),this.hiddenUpdates=Rr(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Xp(e,t,s,i,u,f,y,b,N,D,$,I){return e=new Yb(e,t,s,y,N,D,$,I,b),t=1,f===!0&&(t|=24),f=Ht(3,null,null,t),e.current=f,f.stateNode=e,t=Dc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:s,cache:t},Lc(f),e}function Qp(e){return e?(e=Os,e):Os}function Zp(e,t,s,i,u,f){u=Qp(u),i.context===null?i.context=u:i.pendingContext=u,i=un(t),i.payload={element:s},f=f===void 0?null:f,f!==null&&(i.callback=f),s=dn(e,i,t),s!==null&&(Bt(s,e,t),Qr(s,e,t))}function Fp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function td(e,t){Fp(e,t),(e=e.alternate)&&Fp(e,t)}function Wp(e){if(e.tag===13||e.tag===31){var t=Bn(e,67108864);t!==null&&Bt(t,e,67108864),td(e,67108864)}}function eg(e){if(e.tag===13||e.tag===31){var t=Kt();t=Qo(t);var s=Bn(e,t);s!==null&&Bt(s,e,t),td(e,t)}}var io=!0;function Jb(e,t,s,i){var u=z.T;z.T=null;var f=Q.p;try{Q.p=2,ad(e,t,s,i)}finally{Q.p=f,z.T=u}}function Xb(e,t,s,i){var u=z.T;z.T=null;var f=Q.p;try{Q.p=8,ad(e,t,s,i)}finally{Q.p=f,z.T=u}}function ad(e,t,s,i){if(io){var u=nd(i);if(u===null)Vu(e,t,i,lo,s),ag(e,i);else if(Zb(u,e,t,s,i))i.stopPropagation();else if(ag(e,i),t&4&&-1<Qb.indexOf(e)){for(;u!==null;){var f=xs(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=Aa(f.pendingLanes);if(y!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;y;){var N=1<<31-kt(y);b.entanglements[1]|=N,y&=~N}xa(f),(ze&6)===0&&(Il=mt()+500,fi(0))}}break;case 31:case 13:b=Bn(f,2),b!==null&&Bt(b,f,2),Pl(),td(f,2)}if(f=nd(i),f===null&&Vu(e,t,i,lo,s),f===u)break;u=f}u!==null&&i.stopPropagation()}else Vu(e,t,i,null,s)}}function nd(e){return e=rc(e),sd(e)}var lo=null;function sd(e){if(lo=null,e=bs(e),e!==null){var t=d(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=h(t),e!==null)return e;e=null}else if(s===31){if(e=m(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return lo=e,null}function tg(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(fs()){case Xi:return 2;case Qi:return 8;case hs:case Po:return 32;case Zi:return 268435456;default:return 32}default:return 32}}var rd=!1,_n=null,Sn=null,jn=null,bi=new Map,xi=new Map,Nn=[],Qb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ag(e,t){switch(e){case"focusin":case"focusout":_n=null;break;case"dragenter":case"dragleave":Sn=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":bi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":xi.delete(t.pointerId)}}function wi(e,t,s,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:s,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=xs(t),t!==null&&Wp(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Zb(e,t,s,i,u){switch(t){case"focusin":return _n=wi(_n,e,t,s,i,u),!0;case"dragenter":return Sn=wi(Sn,e,t,s,i,u),!0;case"mouseover":return jn=wi(jn,e,t,s,i,u),!0;case"pointerover":var f=u.pointerId;return bi.set(f,wi(bi.get(f)||null,e,t,s,i,u)),!0;case"gotpointercapture":return f=u.pointerId,xi.set(f,wi(xi.get(f)||null,e,t,s,i,u)),!0}return!1}function ng(e){var t=bs(e.target);if(t!==null){var s=d(t);if(s!==null){if(t=s.tag,t===13){if(t=h(s),t!==null){e.blockedOn=t,yf(e.priority,function(){eg(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,yf(e.priority,function(){eg(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function oo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=nd(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);sc=i,s.target.dispatchEvent(i),sc=null}else return t=xs(s),t!==null&&Wp(t),e.blockedOn=s,!1;t.shift()}return!0}function sg(e,t,s){oo(e)&&s.delete(t)}function Fb(){rd=!1,_n!==null&&oo(_n)&&(_n=null),Sn!==null&&oo(Sn)&&(Sn=null),jn!==null&&oo(jn)&&(jn=null),bi.forEach(sg),xi.forEach(sg)}function co(e,t){e.blockedOn===t&&(e.blockedOn=null,rd||(rd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Fb)))}var uo=null;function rg(e){uo!==e&&(uo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){uo===e&&(uo=null);for(var t=0;t<e.length;t+=3){var s=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(sd(i||s)===null)continue;break}var f=xs(s);f!==null&&(e.splice(t,3),t-=3,nu(f,{pending:!0,data:u,method:s.method,action:i},i,u))}}))}function tr(e){function t(N){return co(N,e)}_n!==null&&co(_n,e),Sn!==null&&co(Sn,e),jn!==null&&co(jn,e),bi.forEach(t),xi.forEach(t);for(var s=0;s<Nn.length;s++){var i=Nn[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Nn.length&&(s=Nn[0],s.blockedOn===null);)ng(s),s.blockedOn===null&&Nn.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(i=0;i<s.length;i+=3){var u=s[i],f=s[i+1],y=u[Rt]||null;if(typeof f=="function")y||rg(s);else if(y){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[Rt]||null)b=y.formAction;else if(sd(u)!==null)continue}else b=y.action;typeof b=="function"?s[i+1]=b:(s.splice(i,3),i-=3),rg(s)}}}function ig(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(s,20)}function s(){if(!i&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function id(e){this._internalRoot=e}fo.prototype.render=id.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var s=t.current,i=Kt();Zp(s,i,e,t,null,null)},fo.prototype.unmount=id.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zp(e.current,2,null,e,null,null),Pl(),t[vs]=null}};function fo(e){this._internalRoot=e}fo.prototype.unstable_scheduleHydration=function(e){if(e){var t=gf();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Nn.length&&t!==0&&t<Nn[s].priority;s++);Nn.splice(s,0,e),s===0&&ng(e)}};var lg=a.version;if(lg!=="19.2.3")throw Error(l(527,lg,"19.2.3"));Q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var Wb={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ho=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ho.isDisabled&&ho.supportsFiber)try{Dn=ho.inject(Wb),Ct=ho}catch{}}return Si.createRoot=function(e,t){if(!c(e))throw Error(l(299));var s=!1,i="",u=mm,f=pm,y=gm;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Xp(e,1,!1,null,null,s,i,null,u,f,y,ig),e[vs]=t.current,Hu(e),new id(t)},Si.hydrateRoot=function(e,t,s){if(!c(e))throw Error(l(299));var i=!1,u="",f=mm,y=pm,b=gm,N=null;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(y=s.onCaughtError),s.onRecoverableError!==void 0&&(b=s.onRecoverableError),s.formState!==void 0&&(N=s.formState)),t=Xp(e,1,!0,t,s??null,i,u,N,f,y,b,ig),t.context=Qp(null),s=t.current,i=Kt(),i=Qo(i),u=un(i),u.callback=null,dn(s,u,i),s=i,t.current.lanes=s,tn(t,s),xa(t),e[vs]=t.current,Hu(e),new fo(t)},Si.version="19.2.3",Si}var yg;function cx(){if(yg)return cd.exports;yg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),cd.exports=ox(),cd.exports}var ux=cx();const dx=Fd(ux);const fx=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hx=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),vg=n=>{const a=hx(n);return a.charAt(0).toUpperCase()+a.slice(1)},py=(...n)=>n.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),mx=n=>{for(const a in n)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var px={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const gx=w.forwardRef(({color:n="currentColor",size:a=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},p)=>w.createElement("svg",{ref:p,...px,width:a,height:a,stroke:n,strokeWidth:l?Number(r)*24/Number(a):r,className:py("lucide",c),...!d&&!mx(m)&&{"aria-hidden":"true"},...m},[...h.map(([g,v])=>w.createElement(g,v)),...Array.isArray(d)?d:[d]]));const le=(n,a)=>{const r=w.forwardRef(({className:l,...c},d)=>w.createElement(gx,{ref:d,iconNode:a,className:py(`lucide-${fx(vg(n))}`,`lucide-${n}`,l),...c}));return r.displayName=vg(n),r};const yx=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],vx=le("activity",yx);const bx=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],xx=le("archive",bx);const wx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],_x=le("arrow-left",wx);const Sx=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],jx=le("arrow-up-down",Sx);const Nx=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ki=le("brain",Nx);const Ex=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Tx=le("calendar",Ex);const Ax=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Cx=le("camera",Ax);const kx=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],gy=le("chart-column",kx);const Ox=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Qa=le("check",Ox);const Rx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Dx=le("chevron-down",Rx);const Mx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],zx=le("chevron-left",Mx);const Ux=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Lx=le("chevron-right",Ux);const Bx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],qx=le("chevron-up",Bx);const $x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Nr=le("circle-alert",$x);const Hx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],tf=le("circle-check-big",Hx);const Vx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],af=le("circle-check",Vx);const Ix=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Gx=le("circle-user",Ix);const Px=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Kx=le("circle-x",Px);const Yx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wr=le("clock",Yx);const Jx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],gr=le("code",Jx);const Xx=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Qx=le("copy",Xx);const Zx=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],nf=le("cpu",Zx);const Fx=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Oi=le("database",Fx);const Wx=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ri=le("external-link",Wx);const ew=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],tw=le("eye",ew);const aw=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],nw=le("flag",aw);const sw=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],rw=le("hash",sw);const iw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],_r=le("info",iw);const lw=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ow=le("key-round",lw);const cw=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],uw=le("key",cw);const dw=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],fw=le("layout-dashboard",dw);const hw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],qt=le("loader-circle",hw);const mw=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],pw=le("log-in",mw);const gw=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],yw=le("log-out",gw);const vw=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Dd=le("mail",vw);const bw=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],xw=le("minimize-2",bw);const ww=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_w=le("moon",ww);const Sw=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],bg=le("paperclip",Sw);const jw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ji=le("plus",jw);const Nw=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],hd=le("power",Nw);const Ew=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Sr=le("refresh-cw",Ew);const Tw=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],yy=le("rotate-ccw",Tw);const Aw=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Cw=le("save",Aw);const kw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ow=le("search",kw);const Rw=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Dw=le("send",Rw);const Mw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Md=le("settings",Mw);const zw=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Uw=le("settings-2",zw);const Lw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],zd=le("shield-check",Lw);const Bw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],qw=le("shield",Bw);const $w=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Hw=le("sun",$w);const Vw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ud=le("terminal",Vw);const Iw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ko=le("trash-2",Iw);const Gw=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],jr=le("triangle-alert",Gw);const Pw=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Kw=le("upload",Pw);const Yw=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Jw=le("user-plus",Yw);const Xw=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],vy=le("user",Xw);const Qw=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Zw=le("volume-2",Qw);const Fw=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Ww=le("volume-x",Fw);const e_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Gi=le("x",e_);const t_=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Oo=le("zap",t_),a_={theme:"system",setTheme:()=>null},by=w.createContext(a_);function n_({children:n,defaultTheme:a="system",storageKey:r="vite-ui-theme"}){const[l,c]=w.useState(()=>localStorage.getItem(r)||a);w.useEffect(()=>{const h=window.document.documentElement;if(h.classList.remove("light","dark"),l==="system"){const m=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";h.classList.add(m);return}h.classList.add(l)},[l]);const d={theme:l,setTheme:h=>{localStorage.setItem(r,h),c(h)}};return o.jsx(by.Provider,{value:d,children:n})}const s_=()=>{const n=w.useContext(by);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n};function xg(n,a){if(typeof n=="function")return n(a);n!=null&&(n.current=a)}function Bo(...n){return a=>{let r=!1;const l=n.map(c=>{const d=xg(c,a);return!r&&typeof d=="function"&&(r=!0),d});if(r)return()=>{for(let c=0;c<l.length;c++){const d=l[c];typeof d=="function"?d():xg(n[c],null)}}}}function ls(...n){return w.useCallback(Bo(...n),n)}var r_=Symbol.for("react.lazy"),Ro=ef[" use ".trim().toString()];function i_(n){return typeof n=="object"&&n!==null&&"then"in n}function xy(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===r_&&"_payload"in n&&i_(n._payload)}function wy(n){const a=o_(n),r=w.forwardRef((l,c)=>{let{children:d,...h}=l;xy(d)&&typeof Ro=="function"&&(d=Ro(d._payload));const m=w.Children.toArray(d),p=m.find(u_);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}var l_=wy("Slot");function o_(n){const a=w.forwardRef((r,l)=>{let{children:c,...d}=r;if(xy(c)&&typeof Ro=="function"&&(c=Ro(c._payload)),w.isValidElement(c)){const h=f_(c),m=d_(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Bo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var c_=Symbol("radix.slottable");function u_(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===c_}function d_(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function f_(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}function _y(n){var a,r,l="";if(typeof n=="string"||typeof n=="number")l+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(a=0;a<c;a++)n[a]&&(r=_y(n[a]))&&(l&&(l+=" "),l+=r)}else for(r in n)n[r]&&(l&&(l+=" "),l+=r);return l}function Sy(){for(var n,a,r=0,l="",c=arguments.length;r<c;r++)(n=arguments[r])&&(a=_y(n))&&(l&&(l+=" "),l+=a);return l}const wg=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,_g=Sy,jy=(n,a)=>r=>{var l;if(a?.variants==null)return _g(n,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(g=>{const v=r?.[g],_=d?.[g];if(v===null)return null;const x=wg(v)||wg(_);return c[g][x]}),m=r&&Object.entries(r).reduce((g,v)=>{let[_,x]=v;return x===void 0||(g[_]=x),g},{}),p=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((g,v)=>{let{class:_,className:x,...S}=v;return Object.entries(S).every(A=>{let[j,k]=A;return Array.isArray(k)?k.includes({...d,...m}[j]):{...d,...m}[j]===k})?[...g,_,x]:g},[]);return _g(n,h,p,r?.class,r?.className)},h_=(n,a)=>{const r=new Array(n.length+a.length);for(let l=0;l<n.length;l++)r[l]=n[l];for(let l=0;l<a.length;l++)r[n.length+l]=a[l];return r},m_=(n,a)=>({classGroupId:n,validator:a}),Ny=(n=new Map,a=null,r)=>({nextPart:n,validators:a,classGroupId:r}),Do="-",Sg=[],p_="arbitrary..",g_=n=>{const a=v_(n),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return y_(h);const m=h.split(Do),p=m[0]===""&&m.length>1?1:0;return Ey(m,p,a)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=l[h],g=r[h];return p?g?h_(g,p):p:g||Sg}return r[h]||Sg}}},Ey=(n,a,r)=>{if(n.length-a===0)return r.classGroupId;const c=n[a],d=r.nextPart.get(c);if(d){const g=Ey(n,a+1,d);if(g)return g}const h=r.validators;if(h===null)return;const m=a===0?n.join(Do):n.slice(a).join(Do),p=h.length;for(let g=0;g<p;g++){const v=h[g];if(v.validator(m))return v.classGroupId}},y_=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=n.slice(1,-1),r=a.indexOf(":"),l=a.slice(0,r);return l?p_+l:void 0})(),v_=n=>{const{theme:a,classGroups:r}=n;return b_(r,a)},b_=(n,a)=>{const r=Ny();for(const l in n){const c=n[l];sf(c,r,l,a)}return r},sf=(n,a,r,l)=>{const c=n.length;for(let d=0;d<c;d++){const h=n[d];x_(h,a,r,l)}},x_=(n,a,r,l)=>{if(typeof n=="string"){w_(n,a,r);return}if(typeof n=="function"){__(n,a,r,l);return}S_(n,a,r,l)},w_=(n,a,r)=>{const l=n===""?a:Ty(a,n);l.classGroupId=r},__=(n,a,r,l)=>{if(j_(n)){sf(n(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(m_(r,n))},S_=(n,a,r,l)=>{const c=Object.entries(n),d=c.length;for(let h=0;h<d;h++){const[m,p]=c[h];sf(p,Ty(a,m),r,l)}},Ty=(n,a)=>{let r=n;const l=a.split(Do),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=Ny(),r.nextPart.set(h,m)),r=m}return r},j_=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,N_=n=>{if(n<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),l=Object.create(null);const c=(d,h)=>{r[d]=h,a++,a>n&&(a=0,l=r,r=Object.create(null))};return{get(d){let h=r[d];if(h!==void 0)return h;if((h=l[d])!==void 0)return c(d,h),h},set(d,h){d in r?r[d]=h:c(d,h)}}},Ld="!",jg=":",E_=[],Ng=(n,a,r,l,c)=>({modifiers:n,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),T_=n=>{const{prefix:a,experimentalParseClassName:r}=n;let l=c=>{const d=[];let h=0,m=0,p=0,g;const v=c.length;for(let j=0;j<v;j++){const k=c[j];if(h===0&&m===0){if(k===jg){d.push(c.slice(p,j)),p=j+1;continue}if(k==="/"){g=j;continue}}k==="["?h++:k==="]"?h--:k==="("?m++:k===")"&&m--}const _=d.length===0?c:c.slice(p);let x=_,S=!1;_.endsWith(Ld)?(x=_.slice(0,-1),S=!0):_.startsWith(Ld)&&(x=_.slice(1),S=!0);const A=g&&g>p?g-p:void 0;return Ng(d,S,x,A)};if(a){const c=a+jg,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):Ng(E_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},A_=n=>{const a=new Map;return n.orderSensitiveModifiers.forEach((r,l)=>{a.set(r,1e6+l)}),r=>{const l=[];let c=[];for(let d=0;d<r.length;d++){const h=r[d],m=h[0]==="[",p=a.has(h);m||p?(c.length>0&&(c.sort(),l.push(...c),c=[]),l.push(h)):c.push(h)}return c.length>0&&(c.sort(),l.push(...c)),l}},C_=n=>({cache:N_(n.cacheSize),parseClassName:T_(n),sortModifiers:A_(n),...g_(n)}),k_=/\s+/,O_=(n,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=n.trim().split(k_);let p="";for(let g=m.length-1;g>=0;g-=1){const v=m[g],{isExternal:_,modifiers:x,hasImportantModifier:S,baseClassName:A,maybePostfixModifierPosition:j}=r(v);if(_){p=v+(p.length>0?" "+p:p);continue}let k=!!j,O=l(k?A.substring(0,j):A);if(!O){if(!k){p=v+(p.length>0?" "+p:p);continue}if(O=l(A),!O){p=v+(p.length>0?" "+p:p);continue}k=!1}const q=x.length===0?"":x.length===1?x[0]:d(x).join(":"),B=S?q+Ld:q,G=B+O;if(h.indexOf(G)>-1)continue;h.push(G);const ee=c(O,k);for(let J=0;J<ee.length;++J){const P=ee[J];h.push(B+P)}p=v+(p.length>0?" "+p:p)}return p},R_=(...n)=>{let a=0,r,l,c="";for(;a<n.length;)(r=n[a++])&&(l=Ay(r))&&(c&&(c+=" "),c+=l);return c},Ay=n=>{if(typeof n=="string")return n;let a,r="";for(let l=0;l<n.length;l++)n[l]&&(a=Ay(n[l]))&&(r&&(r+=" "),r+=a);return r},D_=(n,...a)=>{let r,l,c,d;const h=p=>{const g=a.reduce((v,_)=>_(v),n());return r=C_(g),l=r.cache.get,c=r.cache.set,d=m,m(p)},m=p=>{const g=l(p);if(g)return g;const v=O_(p,r);return c(p,v),v};return d=h,(...p)=>d(R_(...p))},M_=[],dt=n=>{const a=r=>r[n]||M_;return a.isThemeGetter=!0,a},Cy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ky=/^\((?:(\w[\w-]*):)?(.+)\)$/i,z_=/^\d+\/\d+$/,U_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,L_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,B_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,q_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ar=n=>z_.test(n),_e=n=>!!n&&!Number.isNaN(Number(n)),Tn=n=>!!n&&Number.isInteger(Number(n)),md=n=>n.endsWith("%")&&_e(n.slice(0,-1)),Ya=n=>U_.test(n),H_=()=>!0,V_=n=>L_.test(n)&&!B_.test(n),Oy=()=>!1,I_=n=>q_.test(n),G_=n=>$_.test(n),P_=n=>!ne(n)&&!se(n),K_=n=>Er(n,My,Oy),ne=n=>Cy.test(n),Zn=n=>Er(n,zy,V_),pd=n=>Er(n,Z_,_e),Eg=n=>Er(n,Ry,Oy),Y_=n=>Er(n,Dy,G_),mo=n=>Er(n,Uy,I_),se=n=>ky.test(n),Ni=n=>Tr(n,zy),J_=n=>Tr(n,F_),Tg=n=>Tr(n,Ry),X_=n=>Tr(n,My),Q_=n=>Tr(n,Dy),po=n=>Tr(n,Uy,!0),Er=(n,a,r)=>{const l=Cy.exec(n);return l?l[1]?a(l[1]):r(l[2]):!1},Tr=(n,a,r=!1)=>{const l=ky.exec(n);return l?l[1]?a(l[1]):r:!1},Ry=n=>n==="position"||n==="percentage",Dy=n=>n==="image"||n==="url",My=n=>n==="length"||n==="size"||n==="bg-size",zy=n=>n==="length",Z_=n=>n==="number",F_=n=>n==="family-name",Uy=n=>n==="shadow",W_=()=>{const n=dt("color"),a=dt("font"),r=dt("text"),l=dt("font-weight"),c=dt("tracking"),d=dt("leading"),h=dt("breakpoint"),m=dt("container"),p=dt("spacing"),g=dt("radius"),v=dt("shadow"),_=dt("inset-shadow"),x=dt("text-shadow"),S=dt("drop-shadow"),A=dt("blur"),j=dt("perspective"),k=dt("aspect"),O=dt("ease"),q=dt("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ee=()=>[...G(),se,ne],J=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],X=()=>[se,ne,p],ue=()=>[ar,"full","auto",...X()],Je=()=>[Tn,"none","subgrid",se,ne],be=()=>["auto",{span:["full",Tn,se,ne]},Tn,se,ne],ge=()=>[Tn,"auto",se,ne],Ze=()=>["auto","min","max","fr",se,ne],nt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...X()],Q=()=>[ar,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...X()],K=()=>[n,se,ne],Se=()=>[...G(),Tg,Eg,{position:[se,ne]}],Oe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",X_,K_,{size:[se,ne]}],V=()=>[md,Ni,Zn],Y=()=>["","none","full",g,se,ne],F=()=>["",_e,Ni,Zn],de=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[_e,md,Tg,Eg],Ge=()=>["","none",A,se,ne],Be=()=>["none",_e,se,ne],Tt=()=>["none",_e,se,ne],yt=()=>[_e,se,ne],vt=()=>[ar,"full",...X()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ya],breakpoint:[Ya],color:[H_],container:[Ya],"drop-shadow":[Ya],ease:["in","out","in-out"],font:[P_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ya],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ya],shadow:[Ya],spacing:["px",_e],text:[Ya],"text-shadow":[Ya],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ar,ne,se,k]}],container:["container"],columns:[{columns:[_e,ne,se,m]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:ee()}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ue()}],"inset-x":[{"inset-x":ue()}],"inset-y":[{"inset-y":ue()}],start:[{start:ue()}],end:[{end:ue()}],top:[{top:ue()}],right:[{right:ue()}],bottom:[{bottom:ue()}],left:[{left:ue()}],visibility:["visible","invisible","collapse"],z:[{z:[Tn,"auto",se,ne]}],basis:[{basis:[ar,"full","auto",m,...X()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,ar,"auto","initial","none",ne]}],grow:[{grow:["",_e,se,ne]}],shrink:[{shrink:["",_e,se,ne]}],order:[{order:[Tn,"first","last","none",se,ne]}],"grid-cols":[{"grid-cols":Je()}],"col-start-end":[{col:be()}],"col-start":[{"col-start":ge()}],"col-end":[{"col-end":ge()}],"grid-rows":[{"grid-rows":Je()}],"row-start-end":[{row:be()}],"row-start":[{"row-start":ge()}],"row-end":[{"row-end":ge()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ze()}],"auto-rows":[{"auto-rows":Ze()}],gap:[{gap:X()}],"gap-x":[{"gap-x":X()}],"gap-y":[{"gap-y":X()}],"justify-content":[{justify:[...nt(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...nt()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":nt()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:X()}],px:[{px:X()}],py:[{py:X()}],ps:[{ps:X()}],pe:[{pe:X()}],pt:[{pt:X()}],pr:[{pr:X()}],pb:[{pb:X()}],pl:[{pl:X()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":X()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":X()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[m,"screen",...Q()]}],"min-w":[{"min-w":[m,"screen","none",...Q()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",r,Ni,Zn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,se,pd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",md,ne]}],"font-family":[{font:[J_,ne,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,se,ne]}],"line-clamp":[{"line-clamp":[_e,"none",se,pd]}],leading:[{leading:[d,...X()]}],"list-image":[{"list-image":["none",se,ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",se,Zn]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[_e,"auto",se,ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:X()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",se,ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Se()}],"bg-repeat":[{bg:Oe()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Tn,se,ne],radial:["",se,ne],conic:[Tn,se,ne]},Q_,Y_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,se,ne]}],"outline-w":[{outline:["",_e,Ni,Zn]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",v,po,mo]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",_,po,mo]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[_e,Zn]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",x,po,mo]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[_e,se,ne]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[se,ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":G()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Se()}],"mask-repeat":[{mask:Oe()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,ne]}],filter:[{filter:["","none",se,ne]}],blur:[{blur:Ge()}],brightness:[{brightness:[_e,se,ne]}],contrast:[{contrast:[_e,se,ne]}],"drop-shadow":[{"drop-shadow":["","none",S,po,mo]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",_e,se,ne]}],"hue-rotate":[{"hue-rotate":[_e,se,ne]}],invert:[{invert:["",_e,se,ne]}],saturate:[{saturate:[_e,se,ne]}],sepia:[{sepia:["",_e,se,ne]}],"backdrop-filter":[{"backdrop-filter":["","none",se,ne]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[_e,se,ne]}],"backdrop-contrast":[{"backdrop-contrast":[_e,se,ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,se,ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,se,ne]}],"backdrop-invert":[{"backdrop-invert":["",_e,se,ne]}],"backdrop-opacity":[{"backdrop-opacity":[_e,se,ne]}],"backdrop-saturate":[{"backdrop-saturate":[_e,se,ne]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,se,ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":X()}],"border-spacing-x":[{"border-spacing-x":X()}],"border-spacing-y":[{"border-spacing-y":X()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",se,ne]}],ease:[{ease:["linear","initial",O,se,ne]}],delay:[{delay:[_e,se,ne]}],animate:[{animate:["none",q,se,ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,se,ne]}],"perspective-origin":[{"perspective-origin":ee()}],rotate:[{rotate:Be()}],"rotate-x":[{"rotate-x":Be()}],"rotate-y":[{"rotate-y":Be()}],"rotate-z":[{"rotate-z":Be()}],scale:[{scale:Tt()}],"scale-x":[{"scale-x":Tt()}],"scale-y":[{"scale-y":Tt()}],"scale-z":[{"scale-z":Tt()}],"scale-3d":["scale-3d"],skew:[{skew:yt()}],"skew-x":[{"skew-x":yt()}],"skew-y":[{"skew-y":yt()}],transform:[{transform:[se,ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:ee()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:vt()}],"translate-x":[{"translate-x":vt()}],"translate-y":[{"translate-y":vt()}],"translate-z":[{"translate-z":vt()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",se,ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":X()}],"scroll-mx":[{"scroll-mx":X()}],"scroll-my":[{"scroll-my":X()}],"scroll-ms":[{"scroll-ms":X()}],"scroll-me":[{"scroll-me":X()}],"scroll-mt":[{"scroll-mt":X()}],"scroll-mr":[{"scroll-mr":X()}],"scroll-mb":[{"scroll-mb":X()}],"scroll-ml":[{"scroll-ml":X()}],"scroll-p":[{"scroll-p":X()}],"scroll-px":[{"scroll-px":X()}],"scroll-py":[{"scroll-py":X()}],"scroll-ps":[{"scroll-ps":X()}],"scroll-pe":[{"scroll-pe":X()}],"scroll-pt":[{"scroll-pt":X()}],"scroll-pr":[{"scroll-pr":X()}],"scroll-pb":[{"scroll-pb":X()}],"scroll-pl":[{"scroll-pl":X()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",se,ne]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[_e,Ni,Zn,pd]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},e1=D_(W_);function Ce(...n){return e1(Sy(n))}const t1=jy("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),W=w.forwardRef(({className:n,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?l_:"button";return o.jsx(h,{className:Ce(t1({variant:a,size:r,className:n})),ref:d,...c})});W.displayName="Button";function Ly(){const{setTheme:n,theme:a}=s_();return o.jsxs(W,{variant:"ghost",size:"icon",onClick:()=>n(a==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",title:`Switch to ${a==="dark"?"light":"dark"} mode`,children:[a==="dark"?o.jsx(Hw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(_w,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var wa=function(){return wa=Object.assign||function(a){for(var r,l=1,c=arguments.length;l<c;l++){r=arguments[l];for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&(a[d]=r[d])}return a},wa.apply(this,arguments)};function Ar(n,a){var r={};for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&a.indexOf(l)<0&&(r[l]=n[l]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(n);c<l.length;c++)a.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(n,l[c])&&(r[l[c]]=n[l[c]]);return r}function a1(n,a,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(v){try{g(l.next(v))}catch(_){h(_)}}function p(v){try{g(l.throw(v))}catch(_){h(_)}}function g(v){v.done?d(v.value):c(v.value).then(m,p)}g((l=l.apply(n,a||[])).next())})}function n1(n,a,r){if(r||arguments.length===2)for(var l=0,c=a.length,d;l<c;l++)(d||!(l in a))&&(d||(d=Array.prototype.slice.call(a,0,l)),d[l]=a[l]);return n.concat(d||Array.prototype.slice.call(a))}const s1=n=>n?(...a)=>n(...a):(...a)=>fetch(...a);class rf extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class r1 extends rf{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class Ag extends rf{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class Cg extends rf{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Bd;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(Bd||(Bd={}));class i1{constructor(a,{headers:r={},customFetch:l,region:c=Bd.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=s1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return a1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:p,body:g,signal:v,timeout:_}=l;let x={},{region:S}=l;S||(S=this.region);const A=new URL(`${this.url}/${r}`);S&&S!=="any"&&(x["x-region"]=S,A.searchParams.set("forceFunctionRegion",S));let j;g&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&g instanceof Blob||g instanceof ArrayBuffer?(x["Content-Type"]="application/octet-stream",j=g):typeof g=="string"?(x["Content-Type"]="text/plain",j=g):typeof FormData<"u"&&g instanceof FormData?j=g:(x["Content-Type"]="application/json",j=JSON.stringify(g)):g&&typeof g!="string"&&!(typeof Blob<"u"&&g instanceof Blob)&&!(g instanceof ArrayBuffer)&&!(typeof FormData<"u"&&g instanceof FormData)?j=JSON.stringify(g):j=g;let k=v;_&&(h=new AbortController,d=setTimeout(()=>h.abort(),_),v?(k=h.signal,v.addEventListener("abort",()=>h.abort())):k=h.signal);const O=yield this.fetch(A.toString(),{method:p||"POST",headers:Object.assign(Object.assign(Object.assign({},x),this.headers),m),body:j,signal:k}).catch(ee=>{throw new r1(ee)}),q=O.headers.get("x-relay-error");if(q&&q==="true")throw new Ag(O);if(!O.ok)throw new Cg(O);let B=((c=O.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),G;return B==="application/json"?G=yield O.json():B==="application/octet-stream"||B==="application/pdf"?G=yield O.blob():B==="text/event-stream"?G=O:B==="multipart/form-data"?G=yield O.formData():G=yield O.text(),{data:G,error:null,response:O}}catch(m){return{data:null,error:m,response:m instanceof Cg||m instanceof Ag?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var l1=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}},o1=class{constructor(n){var a,r;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(a=n.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=n.signal,this.isMaybeSingle=(r=n.isMaybeSingle)!==null&&r!==void 0?r:!1,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,a){return this.headers=new Headers(this.headers),this.headers.set(n,a),this}then(n,a){var r=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const l=this.fetch;let c=l(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async d=>{let h=null,m=null,p=null,g=d.status,v=d.statusText;if(d.ok){var _,x;if(r.method!=="HEAD"){var S;const O=await d.text();O===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((S=r.headers.get("Accept"))===null||S===void 0)&&S.includes("application/vnd.pgrst.plan+text"))?m=O:m=JSON.parse(O))}const j=(_=r.headers.get("Prefer"))===null||_===void 0?void 0:_.match(/count=(exact|planned|estimated)/),k=(x=d.headers.get("content-range"))===null||x===void 0?void 0:x.split("/");j&&k&&k.length>1&&(p=parseInt(k[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(m)&&(m.length>1?(h={code:"PGRST116",details:`Results contain ${m.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},m=null,p=null,g=406,v="Not Acceptable"):m.length===1?m=m[0]:m=null)}else{var A;const j=await d.text();try{h=JSON.parse(j),Array.isArray(h)&&d.status===404&&(m=[],h=null,g=200,v="OK")}catch{d.status===404&&j===""?(g=204,v="No Content"):h={message:j}}if(h&&r.isMaybeSingle&&(!(h==null||(A=h.details)===null||A===void 0)&&A.includes("0 rows"))&&(h=null,g=200,v="OK"),h&&r.shouldThrowOnError)throw new l1(h)}return{error:h,data:m,count:p,status:g,statusText:v}});return this.shouldThrowOnError||(c=c.catch(d=>{var h;let m="";const p=d?.cause;if(p){var g,v,_,x;const A=(g=p?.message)!==null&&g!==void 0?g:"",j=(v=p?.code)!==null&&v!==void 0?v:"";m=`${(_=d?.name)!==null&&_!==void 0?_:"FetchError"}: ${d?.message}`,m+=`
|
|
10
|
+
|
|
11
|
+
Caused by: ${(x=p?.name)!==null&&x!==void 0?x:"Error"}: ${A}`,j&&(m+=` (${j})`),p?.stack&&(m+=`
|
|
12
|
+
${p.stack}`)}else{var S;m=(S=d?.stack)!==null&&S!==void 0?S:""}return{error:{message:`${(h=d?.name)!==null&&h!==void 0?h:"FetchError"}: ${d?.message}`,details:m,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),c.then(n,a)}returns(){return this}overrideTypes(){return this}},c1=class extends o1{select(n){let a=!1;const r=(n??"*").split("").map(l=>/\s/.test(l)&&!a?"":(l==='"'&&(a=!a),l)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:a=!0,nullsFirst:r,foreignTable:l,referencedTable:c=l}={}){const d=c?`${c}.order`:"order",h=this.url.searchParams.get(d);return this.url.searchParams.set(d,`${h?`${h},`:""}${n}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${n}`),this}range(n,a,{foreignTable:r,referencedTable:l=r}={}){const c=typeof l>"u"?"offset":`${l}.offset`,d=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(c,`${n}`),this.url.searchParams.set(d,`${a-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:n=!1,verbose:a=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[n?"analyze":null,a?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),p=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${p}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const kg=new RegExp("[,()]");var fr=class extends c1{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}regexMatch(n,a){return this.url.searchParams.append(n,`match.${a}`),this}regexIMatch(n,a){return this.url.searchParams.append(n,`imatch.${a}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}isDistinct(n,a){return this.url.searchParams.append(n,`isdistinct.${a}`),this}in(n,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&kg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(n,`in.(${r})`),this}notIn(n,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&kg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(n,`not.in.(${r})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{config:r,type:l}={}){let c="";l==="plain"?c="pl":l==="phrase"?c="ph":l==="websearch"&&(c="w");const d=r===void 0?"":`(${r})`;return this.url.searchParams.append(n,`${c}fts${d}.${a}`),this}match(n){return Object.entries(n).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(n,a,r){return this.url.searchParams.append(n,`not.${a}.${r}`),this}or(n,{foreignTable:a,referencedTable:r=a}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${n})`),this}filter(n,a,r){return this.url.searchParams.append(n,`${a}.${r}`),this}},u1=class{constructor(n,{headers:a={},schema:r,fetch:l}){this.url=n,this.headers=new Headers(a),this.schema=r,this.fetch=l}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(n,a){const{head:r=!1,count:l}=a??{},c=r?"HEAD":"GET";let d=!1;const h=(n??"*").split("").map(g=>/\s/.test(g)&&!d?"":(g==='"'&&(d=!d),g)).join(""),{url:m,headers:p}=this.cloneRequestState();return m.searchParams.set("select",h),l&&p.append("Prefer",`count=${l}`),new fr({method:c,url:m,headers:p,schema:this.schema,fetch:this.fetch})}insert(n,{count:a,defaultToNull:r=!0}={}){var l;const c="POST",{url:d,headers:h}=this.cloneRequestState();if(a&&h.append("Prefer",`count=${a}`),r||h.append("Prefer","missing=default"),Array.isArray(n)){const m=n.reduce((p,g)=>p.concat(Object.keys(g)),[]);if(m.length>0){const p=[...new Set(m)].map(g=>`"${g}"`);d.searchParams.set("columns",p.join(","))}}return new fr({method:c,url:d,headers:h,schema:this.schema,body:n,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(n,{onConflict:a,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:p}=this.cloneRequestState();if(p.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),a!==void 0&&m.searchParams.set("on_conflict",a),l&&p.append("Prefer",`count=${l}`),c||p.append("Prefer","missing=default"),Array.isArray(n)){const g=n.reduce((v,_)=>v.concat(Object.keys(_)),[]);if(g.length>0){const v=[...new Set(g)].map(_=>`"${_}"`);m.searchParams.set("columns",v.join(","))}}return new fr({method:h,url:m,headers:p,schema:this.schema,body:n,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(n,{count:a}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return a&&d.append("Prefer",`count=${a}`),new fr({method:l,url:c,headers:d,schema:this.schema,body:n,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:n}={}){var a;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return n&&c.append("Prefer",`count=${n}`),new fr({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},d1=class By{constructor(a,{headers:r={},schema:l,fetch:c}={}){this.url=a,this.headers=new Headers(r),this.schemaName=l,this.fetch=c}from(a){if(!a||typeof a!="string"||a.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new u1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new By(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,r={},{head:l=!1,get:c=!1,count:d}={}){var h;let m;const p=new URL(`${this.url}/rpc/${a}`);let g;const v=S=>S!==null&&typeof S=="object"&&(!Array.isArray(S)||S.some(v)),_=l&&Object.values(r).some(v);_?(m="POST",g=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([S,A])=>A!==void 0).map(([S,A])=>[S,Array.isArray(A)?`{${A.join(",")}}`:`${A}`]).forEach(([S,A])=>{p.searchParams.append(S,A)})):(m="POST",g=r);const x=new Headers(this.headers);return _?x.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&x.set("Prefer",`count=${d}`),new fr({method:m,url:p,headers:x,schema:this.schemaName,body:g,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class f1{constructor(){}static detectEnvironment(){var a;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((a=navigator.userAgent)===null||a===void 0)&&a.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const r=globalThis.process;if(r){const l=r.versions;if(l&&l.node){const c=l.node,d=parseInt(c.replace(/^v/,"").split(".")[0]);return d>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${d} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${d} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
13
|
+
import ws from "ws"
|
|
14
|
+
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const a=this.detectEnvironment();if(a.constructor)return a.constructor;let r=a.error||"WebSocket not supported in this environment.";throw a.workaround&&(r+=`
|
|
15
|
+
|
|
16
|
+
Suggested solution: ${a.workaround}`),new Error(r)}static createWebSocket(a,r){const l=this.getWebSocketConstructor();return new l(a,r)}static isWebSocketSupported(){try{const a=this.detectEnvironment();return a.type==="native"||a.type==="ws"}catch{return!1}}}const h1="2.90.1",m1=`realtime-js/${h1}`,qy="1.0.0",p1="2.0.0",Og=qy,qd=1e4,g1=1e3,y1=100;var Cn;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(Cn||(Cn={}));var ft;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(ft||(ft={}));var fa;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(fa||(fa={}));var $d;(function(n){n.websocket="websocket"})($d||($d={}));var ts;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(ts||(ts={}));class v1{constructor(a){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=a??[]}encode(a,r){if(a.event===this.BROADCAST_EVENT&&!(a.payload instanceof ArrayBuffer)&&typeof a.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(a));let l=[a.join_ref,a.ref,a.topic,a.event,a.payload];return r(JSON.stringify(l))}_binaryEncodeUserBroadcastPush(a){var r;return this._isArrayBuffer((r=a.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(a):this._encodeJsonUserBroadcastPush(a)}_encodeBinaryUserBroadcastPush(a){var r,l;const c=(l=(r=a.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:new ArrayBuffer(0);return this._encodeUserBroadcastPush(a,this.BINARY_ENCODING,c)}_encodeJsonUserBroadcastPush(a){var r,l;const c=(l=(r=a.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:{},h=new TextEncoder().encode(JSON.stringify(c)).buffer;return this._encodeUserBroadcastPush(a,this.JSON_ENCODING,h)}_encodeUserBroadcastPush(a,r,l){var c,d;const h=a.topic,m=(c=a.ref)!==null&&c!==void 0?c:"",p=(d=a.join_ref)!==null&&d!==void 0?d:"",g=a.payload.event,v=this.allowedMetadataKeys?this._pick(a.payload,this.allowedMetadataKeys):{},_=Object.keys(v).length===0?"":JSON.stringify(v);if(p.length>255)throw new Error(`joinRef length ${p.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`ref length ${m.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`topic length ${h.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`userEvent length ${g.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const x=this.USER_BROADCAST_PUSH_META_LENGTH+p.length+m.length+h.length+g.length+_.length,S=new ArrayBuffer(this.HEADER_LENGTH+x);let A=new DataView(S),j=0;A.setUint8(j++,this.KINDS.userBroadcastPush),A.setUint8(j++,p.length),A.setUint8(j++,m.length),A.setUint8(j++,h.length),A.setUint8(j++,g.length),A.setUint8(j++,_.length),A.setUint8(j++,r),Array.from(p,O=>A.setUint8(j++,O.charCodeAt(0))),Array.from(m,O=>A.setUint8(j++,O.charCodeAt(0))),Array.from(h,O=>A.setUint8(j++,O.charCodeAt(0))),Array.from(g,O=>A.setUint8(j++,O.charCodeAt(0))),Array.from(_,O=>A.setUint8(j++,O.charCodeAt(0)));var k=new Uint8Array(S.byteLength+l.byteLength);return k.set(new Uint8Array(S),0),k.set(new Uint8Array(l),S.byteLength),k.buffer}decode(a,r){if(this._isArrayBuffer(a)){let l=this._binaryDecode(a);return r(l)}if(typeof a=="string"){const l=JSON.parse(a),[c,d,h,m,p]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:p})}return r({})}_binaryDecode(a){const r=new DataView(a),l=r.getUint8(0),c=new TextDecoder;if(l===this.KINDS.userBroadcast)return this._decodeUserBroadcast(a,r,c)}_decodeUserBroadcast(a,r,l){const c=r.getUint8(1),d=r.getUint8(2),h=r.getUint8(3),m=r.getUint8(4);let p=this.HEADER_LENGTH+4;const g=l.decode(a.slice(p,p+c));p=p+c;const v=l.decode(a.slice(p,p+d));p=p+d;const _=l.decode(a.slice(p,p+h));p=p+h;const x=a.slice(p,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(x)):x,A={type:this.BROADCAST_EVENT,event:v,payload:S};return h>0&&(A.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:g,event:this.BROADCAST_EVENT,payload:A}}_isArrayBuffer(a){var r;return a instanceof ArrayBuffer||((r=a?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(a,r){return!a||typeof a!="object"?{}:Object.fromEntries(Object.entries(a).filter(([l])=>r.includes(l)))}}class $y{constructor(a,r){this.callback=a,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=a,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Pe;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(Pe||(Pe={}));const Rg=(n,a,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return a?Object.keys(a).reduce((d,h)=>(d[h]=b1(h,n,a,c),d),{}):{}},b1=(n,a,r,l)=>{const c=a.find(m=>m.name===n),d=c?.type,h=r[n];return d&&!l.includes(d)?Hy(d,h):Hd(h)},Hy=(n,a)=>{if(n.charAt(0)==="_"){const r=n.slice(1,n.length);return S1(a,r)}switch(n){case Pe.bool:return x1(a);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return w1(a);case Pe.json:case Pe.jsonb:return _1(a);case Pe.timestamp:return j1(a);case Pe.abstime:case Pe.date:case Pe.daterange:case Pe.int4range:case Pe.int8range:case Pe.money:case Pe.reltime:case Pe.text:case Pe.time:case Pe.timestamptz:case Pe.timetz:case Pe.tsrange:case Pe.tstzrange:return Hd(a);default:return Hd(a)}},Hd=n=>n,x1=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},w1=n=>{if(typeof n=="string"){const a=parseFloat(n);if(!Number.isNaN(a))return a}return n},_1=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},S1=(n,a)=>{if(typeof n!="string")return n;const r=n.length-1,l=n[r];if(n[0]==="{"&&l==="}"){let d;const h=n.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Hy(a,m))}return n},j1=n=>typeof n=="string"?n.replace(" ","T"):n,Vy=n=>{const a=new URL(n);return a.protocol=a.protocol.replace(/^ws/i,"http"),a.pathname=a.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),a.pathname===""||a.pathname==="/"?a.pathname="/api/broadcast":a.pathname=a.pathname+"/api/broadcast",a.href};class gd{constructor(a,r,l={},c=qd){this.channel=a,this.event=r,this.payload=l,this.timeout=c,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(a){this.timeout=a,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(a){this.payload=Object.assign(Object.assign({},this.payload),a)}receive(a,r){var l;return this._hasReceived(a)&&r((l=this.receivedResp)===null||l===void 0?void 0:l.response),this.recHooks.push({status:a,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const a=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},a),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(a,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:a,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:a,response:r}){this.recHooks.filter(l=>l.status===a).forEach(l=>l.callback(r))}_hasReceived(a){return this.receivedResp&&this.receivedResp.status===a}}var Dg;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(Dg||(Dg={}));class Ti{constructor(a,r){this.channel=a,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const l=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(l.state,{},c=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Ti.syncState(this.state,c,d,h),this.pendingDiffs.forEach(p=>{this.state=Ti.syncDiff(this.state,p,d,h)}),this.pendingDiffs=[],m()}),this.channel._on(l.diff,{},c=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(c):(this.state=Ti.syncDiff(this.state,c,d,h),m())}),this.onJoin((c,d,h)=>{this.channel._trigger("presence",{event:"join",key:c,currentPresences:d,newPresences:h})}),this.onLeave((c,d,h)=>{this.channel._trigger("presence",{event:"leave",key:c,currentPresences:d,leftPresences:h})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(a,r,l,c){const d=this.cloneDeep(a),h=this.transformState(r),m={},p={};return this.map(d,(g,v)=>{h[g]||(p[g]=v)}),this.map(h,(g,v)=>{const _=d[g];if(_){const x=v.map(k=>k.presence_ref),S=_.map(k=>k.presence_ref),A=v.filter(k=>S.indexOf(k.presence_ref)<0),j=_.filter(k=>x.indexOf(k.presence_ref)<0);A.length>0&&(m[g]=A),j.length>0&&(p[g]=j)}else m[g]=v}),this.syncDiff(d,{joins:m,leaves:p},l,c)}static syncDiff(a,r,l,c){const{joins:d,leaves:h}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return l||(l=()=>{}),c||(c=()=>{}),this.map(d,(m,p)=>{var g;const v=(g=a[m])!==null&&g!==void 0?g:[];if(a[m]=this.cloneDeep(p),v.length>0){const _=a[m].map(S=>S.presence_ref),x=v.filter(S=>_.indexOf(S.presence_ref)<0);a[m].unshift(...x)}l(m,v,p)}),this.map(h,(m,p)=>{let g=a[m];if(!g)return;const v=p.map(_=>_.presence_ref);g=g.filter(_=>v.indexOf(_.presence_ref)<0),a[m]=g,c(m,g,p),g.length===0&&delete a[m]}),a}static map(a,r){return Object.getOwnPropertyNames(a).map(l=>r(l,a[l]))}static transformState(a){return a=this.cloneDeep(a),Object.getOwnPropertyNames(a).reduce((r,l)=>{const c=a[l];return"metas"in c?r[l]=c.metas.map(d=>(d.presence_ref=d.phx_ref,delete d.phx_ref,delete d.phx_ref_prev,d)):r[l]=c,r},{})}static cloneDeep(a){return JSON.parse(JSON.stringify(a))}onJoin(a){this.caller.onJoin=a}onLeave(a){this.caller.onLeave=a}onSync(a){this.caller.onSync=a}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Mg;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(Mg||(Mg={}));var Ai;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(Ai||(Ai={}));var Xa;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(Xa||(Xa={}));class yr{constructor(a,r={config:{}},l){var c,d;if(this.topic=a,this.params=r,this.socket=l,this.bindings={},this.state=ft.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=a.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new gd(this,fa.join,this.params,this.timeout),this.rejoinTimer=new $y(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ft.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(h=>h.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=ft.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this._on(fa.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new Ti(this),this.broadcastEndpointURL=Vy(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((d=(c=this.params.config)===null||c===void 0?void 0:c.broadcast)===null||d===void 0)&&d.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(a,r=this.timeout){var l,c,d;if(this.socket.isConnected()||this.socket.connect(),this.state==ft.closed){const{config:{broadcast:h,presence:m,private:p}}=this.params,g=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(S=>S.filter))!==null&&c!==void 0?c:[],v=!!this.bindings[Ai.PRESENCE]&&this.bindings[Ai.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,_={},x={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:v}),postgres_changes:g,private:p};this.socket.accessTokenValue&&(_.access_token=this.socket.accessTokenValue),this._onError(S=>a?.(Xa.CHANNEL_ERROR,S)),this._onClose(()=>a?.(Xa.CLOSED)),this.updateJoinPayload(Object.assign({config:x},_)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:S})=>{var A;if(this.socket._isManualToken()||this.socket.setAuth(),S===void 0){a?.(Xa.SUBSCRIBED);return}else{const j=this.bindings.postgres_changes,k=(A=j?.length)!==null&&A!==void 0?A:0,O=[];for(let q=0;q<k;q++){const B=j[q],{filter:{event:G,schema:ee,table:J,filter:P}}=B,X=S&&S[q];if(X&&X.event===G&&yr.isFilterValueEqual(X.schema,ee)&&yr.isFilterValueEqual(X.table,J)&&yr.isFilterValueEqual(X.filter,P))O.push(Object.assign(Object.assign({},B),{id:X.id}));else{this.unsubscribe(),this.state=ft.errored,a?.(Xa.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=O,a&&a(Xa.SUBSCRIBED);return}}).receive("error",S=>{this.state=ft.errored,a?.(Xa.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{a?.(Xa.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(a,r={}){return await this.send({type:"presence",event:"track",payload:a},r.timeout||this.timeout)}async untrack(a={}){return await this.send({type:"presence",event:"untrack"},a)}on(a,r,l){return this.state===ft.joined&&a===Ai.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(a,r,l)}async httpSend(a,r,l={}){var c;if(r==null)return Promise.reject("Payload is required for httpSend()");const d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:r,private:this.private}]})},m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(c=l.timeout)!==null&&c!==void 0?c:this.timeout);if(m.status===202)return{success:!0};let p=m.statusText;try{const g=await m.json();p=g.error||g.message||p}catch{}return Promise.reject(new Error(p))}async send(a,r={}){var l,c;if(!this._canPush()&&a.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:d,payload:h}=a,m={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(m.Authorization=`Bearer ${this.socket.accessTokenValue}`);const p={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const g=await this._fetchWithTimeout(this.broadcastEndpointURL,p,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=g.body)===null||c===void 0?void 0:c.cancel()),g.ok?"ok":"error"}catch(g){return g.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,p;const g=this._push(a.type,a,r.timeout||this.timeout);a.type==="broadcast"&&!(!((p=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||p===void 0)&&p.ack)&&d("ok"),g.receive("ok",()=>d("ok")),g.receive("error",()=>d("error")),g.receive("timeout",()=>d("timed out"))})}updateJoinPayload(a){this.joinPush.updatePayload(a)}unsubscribe(a=this.timeout){this.state=ft.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(fa.close,"leave",this._joinRef())};this.joinPush.destroy();let l=null;return new Promise(c=>{l=new gd(this,fa.leave,{},a),l.receive("ok",()=>{r(),c("ok")}).receive("timeout",()=>{r(),c("timed out")}).receive("error",()=>{c("error")}),l.send(),this._canPush()||l.trigger("ok",{})}).finally(()=>{l?.destroy()})}teardown(){this.pushBuffer.forEach(a=>a.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ft.closed,this.bindings={}}async _fetchWithTimeout(a,r,l){const c=new AbortController,d=setTimeout(()=>c.abort(),l),h=await this.socket.fetch(a,Object.assign(Object.assign({},r),{signal:c.signal}));return clearTimeout(d),h}_push(a,r,l=this.timeout){if(!this.joinedOnce)throw`tried to push '${a}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let c=new gd(this,a,r,l);return this._canPush()?c.send():this._addToPushBuffer(c),c}_addToPushBuffer(a){if(a.startTimeout(),this.pushBuffer.push(a),this.pushBuffer.length>y1){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(a,r,l){return r}_isMember(a){return this.topic===a}_joinRef(){return this.joinPush.ref}_trigger(a,r,l){var c,d;const h=a.toLocaleLowerCase(),{close:m,error:p,leave:g,join:v}=fa;if(l&&[m,p,g,v].indexOf(h)>=0&&l!==this._joinRef())return;let x=this._onMessage(h,r,l);if(r&&!x)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(h)?(c=this.bindings.postgres_changes)===null||c===void 0||c.filter(S=>{var A,j,k;return((A=S.filter)===null||A===void 0?void 0:A.event)==="*"||((k=(j=S.filter)===null||j===void 0?void 0:j.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===h}).map(S=>S.callback(x,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var A,j,k,O,q,B,G,ee;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const J=S.id,P=(A=S.filter)===null||A===void 0?void 0:A.event;return J&&((j=r.ids)===null||j===void 0?void 0:j.includes(J))&&(P==="*"||P?.toLocaleLowerCase()===((k=r.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))&&(!(!((O=S.filter)===null||O===void 0)&&O.table)||S.filter.table===((q=r.data)===null||q===void 0?void 0:q.table))}else{const J=(G=(B=S?.filter)===null||B===void 0?void 0:B.event)===null||G===void 0?void 0:G.toLocaleLowerCase();return J==="*"||J===((ee=r?.event)===null||ee===void 0?void 0:ee.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===h}).map(S=>{if(typeof x=="object"&&"ids"in x){const A=x.data,{schema:j,table:k,commit_timestamp:O,type:q,errors:B}=A;x=Object.assign(Object.assign({},{schema:j,table:k,commit_timestamp:O,eventType:q,new:{},old:{},errors:B}),this._getPayloadRecords(A))}S.callback(x,l)})}_isClosed(){return this.state===ft.closed}_isJoined(){return this.state===ft.joined}_isJoining(){return this.state===ft.joining}_isLeaving(){return this.state===ft.leaving}_replyEventName(a){return`chan_reply_${a}`}_on(a,r,l){const c=a.toLocaleLowerCase(),d={type:c,filter:r,callback:l};return this.bindings[c]?this.bindings[c].push(d):this.bindings[c]=[d],this}_off(a,r){const l=a.toLocaleLowerCase();return this.bindings[l]&&(this.bindings[l]=this.bindings[l].filter(c=>{var d;return!(((d=c.type)===null||d===void 0?void 0:d.toLocaleLowerCase())===l&&yr.isEqual(c.filter,r))})),this}static isEqual(a,r){if(Object.keys(a).length!==Object.keys(r).length)return!1;for(const l in a)if(a[l]!==r[l])return!1;return!0}static isFilterValueEqual(a,r){return(a??void 0)===(r??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(a){this._on(fa.close,{},a)}_onError(a){this._on(fa.error,{},r=>a(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(a=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ft.joining,this.joinPush.resend(a))}_getPayloadRecords(a){const r={new:{},old:{}};return(a.type==="INSERT"||a.type==="UPDATE")&&(r.new=Rg(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Rg(a.columns,a.old_record)),r}}const yd=()=>{},go={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},N1=[1e3,2e3,5e3,1e4],E1=1e4,T1=`
|
|
17
|
+
addEventListener("message", (e) => {
|
|
18
|
+
if (e.data.event === "start") {
|
|
19
|
+
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
20
|
+
}
|
|
21
|
+
});`;class A1{constructor(a,r){var l;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=qd,this.transport=null,this.heartbeatIntervalMs=go.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=yd,this.ref=0,this.reconnectTimer=null,this.vsn=Og,this.logger=yd,this.conn=null,this.sendBuffer=[],this.serializer=new v1,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=c=>c?(...d)=>c(...d):(...d)=>fetch(...d),!(!((l=r?.params)===null||l===void 0)&&l.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${a}/${$d.websocket}`,this.httpEndpoint=Vy(a),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=f1.createWebSocket(this.endpointURL())}catch(a){this._setConnectionState("disconnected");const r=a.message;throw r.includes("Node.js")?new Error(`${r}
|
|
22
|
+
|
|
23
|
+
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
24
|
+
|
|
25
|
+
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
26
|
+
Option 2: Install and provide the "ws" package:
|
|
27
|
+
|
|
28
|
+
npm install ws
|
|
29
|
+
|
|
30
|
+
import ws from "ws"
|
|
31
|
+
const client = new RealtimeClient(url, {
|
|
32
|
+
...options,
|
|
33
|
+
transport: ws
|
|
34
|
+
})`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(a,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const l=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(l),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(a?this.conn.close(a,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(a){const r=await a.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const a=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),a}log(a,r,l){this.logger(a,r,l)}connectionState(){switch(this.conn&&this.conn.readyState){case Cn.connecting:return ts.Connecting;case Cn.open:return ts.Open;case Cn.closing:return ts.Closing;default:return ts.Closed}}isConnected(){return this.connectionState()===ts.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(a,r={config:{}}){const l=`realtime:${a}`,c=this.getChannels().find(d=>d.topic===l);if(c)return c;{const d=new yr(`realtime:${a}`,r,this);return this.channels.push(d),d}}push(a){const{topic:r,event:l,payload:c,ref:d}=a,h=()=>{this.encode(a,m=>{var p;(p=this.conn)===null||p===void 0||p.send(m)})};this.log("push",`${r} ${l} (${d})`,c),this.isConnected()?h():this.sendBuffer.push(h)}async setAuth(a=null){this._authPromise=this._performAuth(a);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var a;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(a=this.conn)===null||a===void 0||a.close(g1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},go.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(a){this.heartbeatCallback=a}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(a=>a()),this.sendBuffer=[])}_makeRef(){let a=this.ref+1;return a===this.ref?this.ref=0:this.ref=a,this.ref.toString()}_leaveOpenTopic(a){let r=this.channels.find(l=>l.topic===a&&(l._isJoined()||l._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${a}"`),r.unsubscribe())}_remove(a){this.channels=this.channels.filter(r=>r.topic!==a.topic)}_onConnMessage(a){this.decode(a.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply"&&r.ref&&r.ref===this.pendingHeartbeatRef){const g=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",g)}catch(v){this.log("error","error in heartbeat callback",v)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:l,event:c,payload:d,ref:h}=r,m=h?`(${h})`:"",p=d.status||"";this.log("receive",`${p} ${l} ${c} ${m}`.trim(),d),this.channels.filter(g=>g._isMember(l)).forEach(g=>g._trigger(c,d,h)),this._triggerStateCallbacks("message",r)})}_clearTimer(a){var r;a==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):a==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=a=>this._onConnError(a),this.conn.onmessage=a=>this._onConnMessage(a),this.conn.onclose=a=>this._onConnClose(a),this.conn.readyState===Cn.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Cn.open||this.conn.readyState===Cn.connecting)try{this.conn.close()}catch(a){this.log("error","Error closing connection",a)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(a=>a.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const a=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(a),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(a){var r;this._setConnectionState("disconnected"),this.log("transport","close",a),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",a)}_onConnError(a){this._setConnectionState("disconnected"),this.log("transport",`${a}`),this._triggerChanError(),this._triggerStateCallbacks("error",a)}_triggerChanError(){this.channels.forEach(a=>a._trigger(fa.error))}_appendParams(a,r){if(Object.keys(r).length===0)return a;const l=a.match(/\?/)?"&":"?",c=new URLSearchParams(r);return`${a}${l}${c}`}_workerObjectUrl(a){let r;if(a)r=a;else{const l=new Blob([T1],{type:"application/javascript"});r=URL.createObjectURL(l)}return r}_setConnectionState(a,r=!1){this._connectionState=a,a==="connecting"?this._wasManualDisconnect=!1:a==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(a=null){let r,l=!1;if(a)r=a,l=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(c){this.log("error","Error fetching access token from callback",c),r=this.accessTokenValue}else r=this.accessTokenValue;l?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(c=>{const d={access_token:r,version:m1};r&&c.updateJoinPayload(d),c.joinedOnce&&c._isJoined()&&c._push(fa.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(a="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${a}`,r)})}_triggerStateCallbacks(a,r){try{this.stateChangeCallbacks[a].forEach(l=>{try{l(r)}catch(c){this.log("error",`error in ${a} callback`,c)}})}catch(l){this.log("error",`error triggering ${a} callbacks`,l)}}_setupReconnectionTimer(){this.reconnectTimer=new $y(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},go.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(a){var r,l,c,d,h,m,p,g,v,_,x,S;switch(this.transport=(r=a?.transport)!==null&&r!==void 0?r:null,this.timeout=(l=a?.timeout)!==null&&l!==void 0?l:qd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:go.HEARTBEAT_INTERVAL,this.worker=(d=a?.worker)!==null&&d!==void 0?d:!1,this.accessToken=(h=a?.accessToken)!==null&&h!==void 0?h:null,this.heartbeatCallback=(m=a?.heartbeatCallback)!==null&&m!==void 0?m:yd,this.vsn=(p=a?.vsn)!==null&&p!==void 0?p:Og,a?.params&&(this.params=a.params),a?.logger&&(this.logger=a.logger),(a?.logLevel||a?.log_level)&&(this.logLevel=a.logLevel||a.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(g=a?.reconnectAfterMs)!==null&&g!==void 0?g:(A=>N1[A-1]||E1),this.vsn){case qy:this.encode=(v=a?.encode)!==null&&v!==void 0?v:((A,j)=>j(JSON.stringify(A))),this.decode=(_=a?.decode)!==null&&_!==void 0?_:((A,j)=>j(JSON.parse(A)));break;case p1:this.encode=(x=a?.encode)!==null&&x!==void 0?x:this.serializer.encode.bind(this.serializer),this.decode=(S=a?.decode)!==null&&S!==void 0?S:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=a?.workerUrl}}}var Di=class extends Error{constructor(n,a){super(n),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown=a.icebergType==="CommitStateUnknownException"||[500,502,504].includes(a.status)&&a.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function C1(n,a,r){const l=new URL(a,n);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function k1(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function O1(n){const a=n.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=C1(n.baseUrl,l,c),p=await k1(n.auth),g=await a(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...p,...h},body:d?JSON.stringify(d):void 0}),v=await g.text(),_=(g.headers.get("content-type")||"").includes("application/json"),x=_&&v?JSON.parse(v):v;if(!g.ok){const S=_?x:void 0,A=S?.error;throw new Di(A?.message??`Request failed with status ${g.status}`,{status:g.status,icebergType:A?.type,icebergCode:A?.code,details:S})}return{status:g.status,headers:g.headers,data:x}}}}function yo(n){return n.join("")}var R1=class{constructor(n,a=""){this.client=n,this.prefix=a}async listNamespaces(n){const a=n?{parent:yo(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(n,a){const r={namespace:n.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${yo(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${yo(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${yo(n.namespace)}`}),!0}catch(a){if(a instanceof Di&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(n,a){try{return await this.createNamespace(n,a)}catch(r){if(r instanceof Di&&r.status===409)return;throw r}}};function nr(n){return n.join("")}var D1=class{constructor(n,a="",r){this.client=n,this.prefix=a,this.accessDelegation=r}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables`})).data.identifiers}async createTable(n,a){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables`,body:a,headers:r})).data.metadata}async updateTable(n,a){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables/${n.name}`,body:a});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(n,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(n){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables/${n.name}`,headers:a})).data.metadata}async tableExists(n){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables/${n.name}`,headers:a}),!0}catch(r){if(r instanceof Di&&r.status===404)return!1;throw r}}async createTableIfNotExists(n,a){try{return await this.createTable(n,a)}catch(r){if(r instanceof Di&&r.status===409)return await this.loadTable({namespace:n.namespace,name:a.name});throw r}}},M1=class{constructor(n){let a="v1";n.catalogName&&(a+=`/${n.catalogName}`);const r=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=O1({baseUrl:r,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=n.accessDelegation?.join(","),this.namespaceOps=new R1(this.client,a),this.tableOps=new D1(this.client,a,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,a){return this.namespaceOps.createNamespace(n,a)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}async createTable(n,a){return this.tableOps.createTable(n,a)}async updateTable(n,a){return this.tableOps.updateTable(n,a)}async dropTable(n,a){await this.tableOps.dropTable(n,a)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,a){return this.namespaceOps.createNamespaceIfNotExists(n,a)}async createTableIfNotExists(n,a){return this.tableOps.createTableIfNotExists(n,a)}},qo=class extends Error{constructor(n){super(n),this.__isStorageError=!0,this.name="StorageError"}};function Qe(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var z1=class extends qo{constructor(n,a,r){super(n),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Vd=class extends qo{constructor(n,a){super(n),this.name="StorageUnknownError",this.originalError=a}};const lf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),U1=()=>Response,Id=n=>{if(Array.isArray(n))return n.map(r=>Id(r));if(typeof n=="function"||n!==Object(n))return n;const a={};return Object.entries(n).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));a[c]=Id(l)}),a},L1=n=>{if(typeof n!="object"||n===null)return!1;const a=Object.getPrototypeOf(n);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},B1=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function Mi(n){"@babel/helpers - typeof";return Mi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Mi(n)}function q1(n,a){if(Mi(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(Mi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function $1(n){var a=q1(n,"string");return Mi(a)=="symbol"?a:a+""}function H1(n,a,r){return(a=$1(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function zg(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(n,c).enumerable})),r.push.apply(r,l)}return r}function pe(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?zg(Object(r),!0).forEach(function(l){H1(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):zg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const vd=n=>{var a;return n.msg||n.message||n.error_description||(typeof n.error=="string"?n.error:(a=n.error)===null||a===void 0?void 0:a.message)||JSON.stringify(n)},V1=async(n,a,r)=>{n instanceof await U1()&&!r?.noResolveJson?n.json().then(l=>{const c=n.status||500,d=l?.statusCode||c+"";a(new z1(vd(l),c,d))}).catch(l=>{a(new Vd(vd(l),l))}):a(new Vd(vd(n),n))},I1=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return n==="GET"||!l?c:(L1(l)?(c.headers=pe({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,a?.duplex&&(c.duplex=a.duplex),pe(pe({},c),r))};async function Pi(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,I1(a,l,c,d)).then(p=>{if(!p.ok)throw p;return l?.noResolveJson?p:p.json()}).then(p=>h(p)).catch(p=>V1(p,m,l))})}async function zi(n,a,r,l){return Pi(n,"GET",a,r,l)}async function da(n,a,r,l,c){return Pi(n,"POST",a,l,c,r)}async function Gd(n,a,r,l,c){return Pi(n,"PUT",a,l,c,r)}async function G1(n,a,r,l){return Pi(n,"HEAD",a,pe(pe({},r),{},{noResolveJson:!0}),l)}async function of(n,a,r,l,c){return Pi(n,"DELETE",a,l,c,r)}var P1=class{constructor(n,a){this.downloadFn=n,this.shouldThrowOnError=a}then(n,a){return this.execute().then(n,a)}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};let Iy;Iy=Symbol.toStringTag;var K1=class{constructor(n,a){this.downloadFn=n,this.shouldThrowOnError=a,this[Iy]="BlobDownloadBuilder",this.promise=null}asStream(){return new P1(this.downloadFn,this.shouldThrowOnError)}then(n,a){return this.getPromise().then(n,a)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};const Y1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Ug={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J1=class{constructor(n,a={},r,l){this.shouldThrowOnError=!1,this.url=n,this.headers=a,this.bucketId=r,this.fetch=lf(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(n,a,r,l){var c=this;try{let d;const h=pe(pe({},Ug),l);let m=pe(pe({},c.headers),n==="POST"&&{"x-upsert":String(h.upsert)});const p=h.metadata;typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),p&&d.append("metadata",c.encodeMetadata(p)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),p&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(p))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,p&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(p))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!h.duplex&&(h.duplex="half")),l?.headers&&(m=pe(pe({},m),l.headers));const g=c._removeEmptyFolders(a),v=c._getFinalPath(g),_=await(n=="PUT"?Gd:da)(c.fetch,`${c.url}/object/${v}`,d,pe({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:g,id:_.Id,fullPath:_.Key},error:null}}catch(d){if(c.shouldThrowOnError)throw d;if(Qe(d))return{data:null,error:d};throw d}}async upload(n,a,r){return this.uploadOrUpdate("POST",n,a,r)}async uploadToSignedUrl(n,a,r,l){var c=this;const d=c._removeEmptyFolders(n),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);m.searchParams.set("token",a);try{let p;const g=pe({upsert:Ug.upsert},l),v=pe(pe({},c.headers),{"x-upsert":String(g.upsert)});return typeof Blob<"u"&&r instanceof Blob?(p=new FormData,p.append("cacheControl",g.cacheControl),p.append("",r)):typeof FormData<"u"&&r instanceof FormData?(p=r,p.append("cacheControl",g.cacheControl)):(p=r,v["cache-control"]=`max-age=${g.cacheControl}`,v["content-type"]=g.contentType),{data:{path:d,fullPath:(await Gd(c.fetch,m.toString(),p,{headers:v})).Key},error:null}}catch(p){if(c.shouldThrowOnError)throw p;if(Qe(p))return{data:null,error:p};throw p}}async createSignedUploadUrl(n,a){var r=this;try{let l=r._getFinalPath(n);const c=pe({},r.headers);a?.upsert&&(c["x-upsert"]="true");const d=await da(r.fetch,`${r.url}/object/upload/sign/${l}`,{},{headers:c}),h=new URL(r.url+d.url),m=h.searchParams.get("token");if(!m)throw new qo("No token returned by API");return{data:{signedUrl:h.toString(),path:n,token:m},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async update(n,a,r){return this.uploadOrUpdate("PUT",n,a,r)}async move(n,a,r){var l=this;try{return{data:await da(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:n,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers}),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async copy(n,a,r){var l=this;try{return{data:{path:(await da(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:n,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers})).Key},error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async createSignedUrl(n,a,r){var l=this;try{let c=l._getFinalPath(n),d=await da(l.fetch,`${l.url}/object/sign/${c}`,pe({expiresIn:a},r?.transform?{transform:r.transform}:{}),{headers:l.headers});const h=r?.download?`&download=${r.download===!0?"":r.download}`:"";return d={signedUrl:encodeURI(`${l.url}${d.signedURL}${h}`)},{data:d,error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async createSignedUrls(n,a,r){var l=this;try{const c=await da(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:a,paths:n},{headers:l.headers}),d=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:c.map(h=>pe(pe({},h),{},{signedUrl:h.signedURL?encodeURI(`${l.url}${h.signedURL}${d}`):null})),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}download(n,a){const r=typeof a?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(a?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(n),h=()=>zi(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new K1(h,this.shouldThrowOnError)}async info(n){var a=this;const r=a._getFinalPath(n);try{return{data:Id(await zi(a.fetch,`${a.url}/object/info/${r}`,{headers:a.headers})),error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async exists(n){var a=this;const r=a._getFinalPath(n);try{return await G1(a.fetch,`${a.url}/object/${r}`,{headers:a.headers}),{data:!0,error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Qe(l)&&l instanceof Vd){const c=l.originalError;if([400,404].includes(c?.status))return{data:!1,error:l}}throw l}}getPublicUrl(n,a){const r=this._getFinalPath(n),l=[],c=a?.download?`download=${a.download===!0?"":a.download}`:"";c!==""&&l.push(c);const d=typeof a?.transform<"u"?"render/image":"object",h=this.transformOptsToQueryString(a?.transform||{});h!==""&&l.push(h);let m=l.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${r}${m}`)}}}async remove(n){var a=this;try{return{data:await of(a.fetch,`${a.url}/object/${a.bucketId}`,{prefixes:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async list(n,a,r){var l=this;try{const c=pe(pe(pe({},Y1),a),{},{prefix:n||""});return{data:await da(l.fetch,`${l.url}/object/list/${l.bucketId}`,c,{headers:l.headers},r),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async listV2(n,a){var r=this;try{const l=pe({},n);return{data:await da(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,l,{headers:r.headers},a),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(n){const a=[];return n.width&&a.push(`width=${n.width}`),n.height&&a.push(`height=${n.height}`),n.resize&&a.push(`resize=${n.resize}`),n.format&&a.push(`format=${n.format}`),n.quality&&a.push(`quality=${n.quality}`),a.join("&")}};const Gy="2.90.1",Py={"X-Client-Info":`storage-js/${Gy}`};var X1=class{constructor(n,a={},r,l){this.shouldThrowOnError=!1;const c=new URL(n);l?.useNewHostname&&/supabase\.(co|in|red)$/.test(c.hostname)&&!c.hostname.includes("storage.supabase.")&&(c.hostname=c.hostname.replace("supabase.","storage.supabase.")),this.url=c.href.replace(/\/$/,""),this.headers=pe(pe({},Py),a),this.fetch=lf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(n){var a=this;try{const r=a.listBucketOptionsToQueryString(n);return{data:await zi(a.fetch,`${a.url}/bucket${r}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async getBucket(n){var a=this;try{return{data:await zi(a.fetch,`${a.url}/bucket/${n}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async createBucket(n,a={public:!1}){var r=this;try{return{data:await da(r.fetch,`${r.url}/bucket`,{id:n,name:n,type:a.type,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async updateBucket(n,a){var r=this;try{return{data:await Gd(r.fetch,`${r.url}/bucket/${n}`,{id:n,name:n,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async emptyBucket(n){var a=this;try{return{data:await da(a.fetch,`${a.url}/bucket/${n}/empty`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await of(a.fetch,`${a.url}/bucket/${n}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(n){const a={};return n&&("limit"in n&&(a.limit=String(n.limit)),"offset"in n&&(a.offset=String(n.offset)),n.search&&(a.search=n.search),n.sortColumn&&(a.sortColumn=n.sortColumn),n.sortOrder&&(a.sortOrder=n.sortOrder)),Object.keys(a).length>0?"?"+new URLSearchParams(a).toString():""}},Q1=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},Py),a),this.fetch=lf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var a=this;try{return{data:await da(a.fetch,`${a.url}/bucket`,{name:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async listBuckets(n){var a=this;try{const r=new URLSearchParams;n?.limit!==void 0&&r.set("limit",n.limit.toString()),n?.offset!==void 0&&r.set("offset",n.offset.toString()),n?.sortColumn&&r.set("sortColumn",n.sortColumn),n?.sortOrder&&r.set("sortOrder",n.sortOrder),n?.search&&r.set("search",n.search);const l=r.toString(),c=l?`${a.url}/bucket?${l}`:`${a.url}/bucket`;return{data:await zi(a.fetch,c,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await of(a.fetch,`${a.url}/bucket/${n}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}from(n){var a=this;if(!B1(n))throw new qo("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new M1({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>a.headers},fetch:this.fetch}),l=this.shouldThrowOnError;return new Proxy(r,{get(c,d){const h=c[d];return typeof h!="function"?h:async(...m)=>{try{return{data:await h.apply(c,m),error:null}}catch(p){if(l)throw p;return{data:null,error:p}}}}})}};const cf={"X-Client-Info":`storage-js/${Gy}`,"Content-Type":"application/json"};var Ky=class extends Error{constructor(n){super(n),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Jt(n){return typeof n=="object"&&n!==null&&"__isStorageVectorsError"in n}var bd=class extends Ky{constructor(n,a,r){super(n),this.name="StorageVectorsApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Z1=class extends Ky{constructor(n,a){super(n),this.name="StorageVectorsUnknownError",this.originalError=a}};const uf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),F1=n=>{if(typeof n!="object"||n===null)return!1;const a=Object.getPrototypeOf(n);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Lg=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),W1=async(n,a,r)=>{if(n&&typeof n=="object"&&"status"in n&&"ok"in n&&typeof n.status=="number"&&!r?.noResolveJson){const l=n.status||500,c=n;if(typeof c.json=="function")c.json().then(d=>{const h=d?.statusCode||d?.code||l+"";a(new bd(Lg(d),l,h))}).catch(()=>{const d=l+"";a(new bd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new bd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new Z1(Lg(n),n))},eS=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return l?(F1(l)?(c.headers=pe({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,pe(pe({},c),r)):c};async function tS(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,eS(a,l,c,d)).then(p=>{if(!p.ok)throw p;if(l?.noResolveJson)return p;const g=p.headers.get("content-type");return!g||!g.includes("application/json")?{}:p.json()}).then(p=>h(p)).catch(p=>W1(p,m,l))})}async function Xt(n,a,r,l,c){return tS(n,"POST",a,l,c,r)}var aS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},cf),a),this.fetch=uf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/CreateIndex`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async getIndex(n,a){var r=this;try{return{data:await Xt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Jt(l))return{data:null,error:l};throw l}}async listIndexes(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/ListIndexes`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async deleteIndex(n,a){var r=this;try{return{data:await Xt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Jt(l))return{data:null,error:l};throw l}}},nS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},cf),a),this.fetch=uf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(n){var a=this;try{if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Xt(a.fetch,`${a.url}/PutVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async getVectors(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/GetVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async listVectors(n){var a=this;try{if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return{data:await Xt(a.fetch,`${a.url}/ListVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async queryVectors(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/QueryVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async deleteVectors(n){var a=this;try{if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Xt(a.fetch,`${a.url}/DeleteVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}},sS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},cf),a),this.fetch=uf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async getBucket(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async listBuckets(n={}){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/ListVectorBuckets`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}},rS=class extends sS{constructor(n,a={}){super(n,a.headers||{},a.fetch)}from(n){return new iS(this.url,this.headers,n,this.fetch)}async createBucket(n){var a=()=>super.createBucket,r=this;return a().call(r,n)}async getBucket(n){var a=()=>super.getBucket,r=this;return a().call(r,n)}async listBuckets(n={}){var a=()=>super.listBuckets,r=this;return a().call(r,n)}async deleteBucket(n){var a=()=>super.deleteBucket,r=this;return a().call(r,n)}},iS=class extends aS{constructor(n,a,r,l){super(n,a,l),this.vectorBucketName=r}async createIndex(n){var a=()=>super.createIndex,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(n={}){var a=()=>super.listIndexes,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(n){var a=()=>super.getIndex,r=this;return a().call(r,r.vectorBucketName,n)}async deleteIndex(n){var a=()=>super.deleteIndex,r=this;return a().call(r,r.vectorBucketName,n)}index(n){return new lS(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},lS=class extends nS{constructor(n,a,r,l,c){super(n,a,c),this.vectorBucketName=r,this.indexName=l}async putVectors(n){var a=()=>super.putVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(n){var a=()=>super.getVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(n={}){var a=()=>super.listVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(n){var a=()=>super.queryVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(n){var a=()=>super.deleteVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},oS=class extends X1{constructor(n,a={},r,l){super(n,a,r,l)}from(n){return new J1(this.url,this.headers,n,this.fetch)}get vectors(){return new rS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Q1(this.url+"/iceberg",this.headers,this.fetch)}};const Yy="2.90.1",hr=30*1e3,Pd=3,xd=Pd*hr,cS="http://localhost:9999",uS="supabase.auth.token",dS={"X-Client-Info":`gotrue-js/${Yy}`},Kd="X-Supabase-Api-Version",Jy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},fS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,hS=600*1e3;class Ui extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function oe(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class mS extends Ui{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function pS(n){return oe(n)&&n.name==="AuthApiError"}class as extends Ui{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class Fa extends Ui{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Yt extends Fa{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function gS(n){return oe(n)&&n.name==="AuthSessionMissingError"}class sr extends Fa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class vo extends Fa{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class bo extends Fa{constructor(a,r=null){super(a,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function yS(n){return oe(n)&&n.name==="AuthImplicitGrantRedirectError"}class Bg extends Fa{constructor(a,r=null){super(a,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class vS extends Fa{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Yd extends Fa{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function wd(n){return oe(n)&&n.name==="AuthRetryableFetchError"}class qg extends Fa{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Jd extends Fa{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const Mo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),$g=`
|
|
35
|
+
\r=`.split(""),bS=(()=>{const n=new Array(128);for(let a=0;a<n.length;a+=1)n[a]=-1;for(let a=0;a<$g.length;a+=1)n[$g[a].charCodeAt(0)]=-2;for(let a=0;a<Mo.length;a+=1)n[Mo[a].charCodeAt(0)]=a;return n})();function Hg(n,a,r){if(n!==null)for(a.queue=a.queue<<8|n,a.queuedBits+=8;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(Mo[l]),a.queuedBits-=6}else if(a.queuedBits>0)for(a.queue=a.queue<<6-a.queuedBits,a.queuedBits=6;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(Mo[l]),a.queuedBits-=6}}function Xy(n,a,r){const l=bS[n];if(l>-1)for(a.queue=a.queue<<6|l,a.queuedBits+=6;a.queuedBits>=8;)r(a.queue>>a.queuedBits-8&255),a.queuedBits-=8;else{if(l===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function Vg(n){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{_S(h,l,r)};for(let h=0;h<n.length;h+=1)Xy(n.charCodeAt(h),c,d);return a.join("")}function xS(n,a){if(n<=127){a(n);return}else if(n<=2047){a(192|n>>6),a(128|n&63);return}else if(n<=65535){a(224|n>>12),a(128|n>>6&63),a(128|n&63);return}else if(n<=1114111){a(240|n>>18),a(128|n>>12&63),a(128|n>>6&63),a(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function wS(n,a){for(let r=0;r<n.length;r+=1){let l=n.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(n.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}xS(l,a)}}function _S(n,a,r){if(a.utf8seq===0){if(n<=127){r(n);return}for(let l=1;l<6;l+=1)if((n>>7-l&1)===0){a.utf8seq=l;break}if(a.utf8seq===2)a.codepoint=n&31;else if(a.utf8seq===3)a.codepoint=n&15;else if(a.utf8seq===4)a.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");a.utf8seq-=1}else if(a.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");a.codepoint=a.codepoint<<6|n&63,a.utf8seq-=1,a.utf8seq===0&&r(a.codepoint)}}function vr(n){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<n.length;c+=1)Xy(n.charCodeAt(c),r,l);return new Uint8Array(a)}function SS(n){const a=[];return wS(n,r=>a.push(r)),new Uint8Array(a)}function ns(n){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};return n.forEach(c=>Hg(c,r,l)),Hg(null,r,l),a.join("")}function jS(n){return Math.round(Date.now()/1e3)+n}function NS(){return Symbol("auth-callback")}const Nt=()=>typeof window<"u"&&typeof document<"u",Fn={tested:!1,writable:!1},Qy=()=>{if(!Nt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Fn.tested)return Fn.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),Fn.tested=!0,Fn.writable=!0}catch{Fn.tested=!0,Fn.writable=!1}return Fn.writable};function ES(n){const a={},r=new URL(n);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((c,d)=>{a[d]=c})}catch{}return r.searchParams.forEach((l,c)=>{a[c]=l}),a}const Zy=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),TS=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",mr=async(n,a,r)=>{await n.setItem(a,JSON.stringify(r))},Wn=async(n,a)=>{const r=await n.getItem(a);if(!r)return null;try{return JSON.parse(r)}catch{return r}},jt=async(n,a)=>{await n.removeItem(a)};class $o{constructor(){this.promise=new $o.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}$o.promiseConstructor=Promise;function _d(n){const a=n.split(".");if(a.length!==3)throw new Jd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!fS.test(a[l]))throw new Jd("JWT not in base64url format");return{header:JSON.parse(Vg(a[0])),payload:JSON.parse(Vg(a[1])),signature:vr(a[2]),raw:{header:a[0],payload:a[1]}}}async function AS(n){return await new Promise(a=>{setTimeout(()=>a(null),n)})}function CS(n,a){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await n(d);if(!a(d,null,h)){l(h);return}}catch(h){if(!a(d,h)){c(h);return}}})()})}function kS(n){return("0"+n.toString(16)).substr(-2)}function OS(){const a=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",l=r.length;let c="";for(let d=0;d<56;d++)c+=r.charAt(Math.floor(Math.random()*l));return c}return crypto.getRandomValues(a),Array.from(a,kS).join("")}async function RS(n){const r=new TextEncoder().encode(n),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function DS(n){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),n;const r=await RS(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function rr(n,a,r=!1){const l=OS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await mr(n,`${a}-code-verifier`,c);const d=await DS(l);return[d,l===d?"plain":"s256"]}const MS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function zS(n){const a=n.headers.get(Kd);if(!a||!a.match(MS))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function US(n){if(!n)throw new Error("Missing exp claim");const a=Math.floor(Date.now()/1e3);if(n<=a)throw new Error("JWT has expired")}function LS(n){switch(n){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const BS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ir(n){if(!BS.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Sd(){const n={};return new Proxy(n,{get:(a,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const l=r.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(a,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(a,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function qS(n,a){return new Proxy(n,{get:(r,l,c)=>{if(l==="__isInsecureUserWarningProxy")return!0;if(typeof l=="symbol"){const d=l.toString();if(d==="Symbol(Symbol.toPrimitive)"||d==="Symbol(Symbol.toStringTag)"||d==="Symbol(util.inspect.custom)"||d==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,l,c)}return!a.value&&typeof l=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),a.value=!0),Reflect.get(r,l,c)}})}function Ig(n){return JSON.parse(JSON.stringify(n))}const es=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),$S=[502,503,504];async function Gg(n){var a;if(!TS(n))throw new Yd(es(n),0);if($S.includes(n.status))throw new Yd(es(n),n.status);let r;try{r=await n.json()}catch(d){throw new as(es(d),d)}let l;const c=zS(n);if(c&&c.getTime()>=Jy["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?l=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(l=r.error_code),l){if(l==="weak_password")throw new qg(es(r),n.status,((a=r.weak_password)===null||a===void 0?void 0:a.reasons)||[]);if(l==="session_not_found")throw new Yt}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((d,h)=>d&&typeof h=="string",!0))throw new qg(es(r),n.status,r.weak_password.reasons);throw new mS(es(r),n.status||500,l)}const HS=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return n==="GET"?c:(c.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},a?.headers),c.body=JSON.stringify(l),Object.assign(Object.assign({},c),r))};async function me(n,a,r,l){var c;const d=Object.assign({},l?.headers);d[Kd]||(d[Kd]=Jy["2024-01-01"].name),l?.jwt&&(d.Authorization=`Bearer ${l.jwt}`);const h=(c=l?.query)!==null&&c!==void 0?c:{};l?.redirectTo&&(h.redirect_to=l.redirectTo);const m=Object.keys(h).length?"?"+new URLSearchParams(h).toString():"",p=await VS(n,a,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(p):{data:Object.assign({},p),error:null}}async function VS(n,a,r,l,c,d){const h=HS(a,l,c,d);let m;try{m=await n(r,Object.assign({},h))}catch(p){throw console.error(p),new Yd(es(p),0)}if(m.ok||await Gg(m),l?.noResolveJson)return m;try{return await m.json()}catch(p){await Gg(p)}}function ua(n){var a;let r=null;PS(n)&&(r=Object.assign({},n),n.expires_at||(r.expires_at=jS(n.expires_in)));const l=(a=n.user)!==null&&a!==void 0?a:n;return{data:{session:r,user:l},error:null}}function Pg(n){const a=ua(n);return!a.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(a.data.weak_password=n.weak_password),a}function kn(n){var a;return{data:{user:(a=n.user)!==null&&a!==void 0?a:n},error:null}}function IS(n){return{data:n,error:null}}function GS(n){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=n,h=Ar(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),m={action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d},p=Object.assign({},h);return{data:{properties:m,user:p},error:null}}function Kg(n){return n}function PS(n){return n.access_token&&n.refresh_token&&n.expires_in}const jd=["global","local","others"];class KS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Zy(l),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(a,r=jd[0]){if(jd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${jd.join(", ")}`);try{return await me(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:a,noResolveJson:!0}),{data:null,error:null}}catch(l){if(oe(l))return{data:null,error:l};throw l}}async inviteUserByEmail(a,r={}){try{return await me(this.fetch,"POST",`${this.url}/invite`,{body:{email:a,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:kn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Ar(a,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await me(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:GS,redirectTo:r?.redirectTo})}catch(r){if(oe(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(a){try{return await me(this.fetch,"POST",`${this.url}/admin/users`,{body:a,headers:this.headers,xform:kn})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async listUsers(a){var r,l,c,d,h,m,p;try{const g={nextPage:null,lastPage:0,total:0},v=await me(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=a?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=a?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:Kg});if(v.error)throw v.error;const _=await v.json(),x=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(p=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&p!==void 0?p:[];return S.length>0&&(S.forEach(A=>{const j=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);g[`${k}Page`]=j}),g.total=parseInt(x)),{data:Object.assign(Object.assign({},_),g),error:null}}catch(g){if(oe(g))return{data:{users:[]},error:g};throw g}}async getUserById(a){ir(a);try{return await me(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:kn})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){ir(a);try{return await me(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:kn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){ir(a);try{return await me(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:kn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){ir(a.userId);try{const{data:r,error:l}=await me(this.fetch,"GET",`${this.url}/admin/users/${a.userId}/factors`,{headers:this.headers,xform:c=>({data:{factors:c},error:null})});return{data:r,error:l}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _deleteFactor(a){ir(a.userId),ir(a.id);try{return{data:await me(this.fetch,"DELETE",`${this.url}/admin/users/${a.userId}/factors/${a.id}`,{headers:this.headers}),error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _listOAuthClients(a){var r,l,c,d,h,m,p;try{const g={nextPage:null,lastPage:0,total:0},v=await me(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=a?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=a?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:Kg});if(v.error)throw v.error;const _=await v.json(),x=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(p=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&p!==void 0?p:[];return S.length>0&&(S.forEach(A=>{const j=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);g[`${k}Page`]=j}),g.total=parseInt(x)),{data:Object.assign(Object.assign({},_),g),error:null}}catch(g){if(oe(g))return{data:{clients:[]},error:g};throw g}}async _createOAuthClient(a){try{return await me(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:a,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _getOAuthClient(a){try{return await me(this.fetch,"GET",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _updateOAuthClient(a,r){try{return await me(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${a}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(oe(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(a){try{return await me(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(a){try{return await me(this.fetch,"POST",`${this.url}/admin/oauth/clients/${a}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}}function Yg(n={}){return{getItem:a=>n[a]||null,setItem:(a,r)=>{n[a]=r},removeItem:a=>{delete n[a]}}}const lr={debug:!!(globalThis&&Qy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Fy extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class YS extends Fy{}async function JS(n,a,r){lr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",n,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),lr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",n)},a),await Promise.resolve().then(()=>globalThis.navigator.locks.request(n,a===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:l.signal},async c=>{if(c){lr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",n,c.name);try{return await r()}finally{lr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",n,c.name)}}else{if(a===0)throw lr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",n),new YS(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(lr.debug)try{const d=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(d,null," "))}catch(d){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",d)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}}))}function XS(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Wy(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function QS(n){return parseInt(n,16)}function ZS(n){const a=new TextEncoder().encode(n);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function FS(n){var a;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:p,resources:g,scheme:v,uri:_,version:x}=n;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!l)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(h&&h.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${h}`);if(!_)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(x!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${x}`);if(!((a=n.statement)===null||a===void 0)&&a.includes(`
|
|
36
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const S=Wy(n.address),A=v?`${v}://${l}`:l,j=n.statement?`${n.statement}
|
|
37
|
+
`:"",k=`${A} wants you to sign in with your Ethereum account:
|
|
38
|
+
${S}
|
|
39
|
+
|
|
40
|
+
${j}`;let O=`URI: ${_}
|
|
41
|
+
Version: ${x}
|
|
42
|
+
Chain ID: ${r}${h?`
|
|
43
|
+
Nonce: ${h}`:""}
|
|
44
|
+
Issued At: ${d.toISOString()}`;if(c&&(O+=`
|
|
45
|
+
Expiration Time: ${c.toISOString()}`),m&&(O+=`
|
|
46
|
+
Not Before: ${m.toISOString()}`),p&&(O+=`
|
|
47
|
+
Request ID: ${p}`),g){let q=`
|
|
48
|
+
Resources:`;for(const B of g){if(!B||typeof B!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${B}`);q+=`
|
|
49
|
+
- ${B}`}O+=q}return`${k}
|
|
50
|
+
${O}`}class ot extends Error{constructor({message:a,code:r,cause:l,name:c}){var d;super(a,{cause:l}),this.__isWebAuthnError=!0,this.name=(d=c??(l instanceof Error?l.name:void 0))!==null&&d!==void 0?d:"Unknown Error",this.code=r}}class zo extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function WS({error:n,options:a}){var r,l,c;const{publicKey:d}=a;if(!d)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((r=d.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ot({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(a.mediation==="conditional"&&((l=d.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new ot({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((c=d.authenticatorSelection)===null||c===void 0?void 0:c.userVerification)==="required")return new ot({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new ot({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new ot({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return d.pubKeyCredParams.filter(m=>m.type==="public-key").length===0?new ot({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new ot({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const h=window.location.hostname;if(ev(h)){if(d.rp.id!==h)return new ot({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(d.user.id.byteLength<1||d.user.id.byteLength>64)return new ot({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new ot({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function ej({error:n,options:a}){const{publicKey:r}=a;if(!r)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new ot({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const l=window.location.hostname;if(ev(l)){if(r.rpId!==l)return new ot({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new ot({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class tj{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const a=new AbortController;return this.controller=a,a.signal}cancelCeremony(){if(this.controller){const a=new Error("Manually cancelling existing WebAuthn API call");a.name="AbortError",this.controller.abort(a),this.controller=void 0}}}const aj=new tj;function nj(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:a,user:r,excludeCredentials:l}=n,c=Ar(n,["challenge","user","excludeCredentials"]),d=vr(a).buffer,h=Object.assign(Object.assign({},r),{id:vr(r.id).buffer}),m=Object.assign(Object.assign({},c),{challenge:d,user:h});if(l&&l.length>0){m.excludeCredentials=new Array(l.length);for(let p=0;p<l.length;p++){const g=l[p];m.excludeCredentials[p]=Object.assign(Object.assign({},g),{id:vr(g.id).buffer,type:g.type||"public-key",transports:g.transports})}}return m}function sj(n){if(!n)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(n);const{challenge:a,allowCredentials:r}=n,l=Ar(n,["challenge","allowCredentials"]),c=vr(a).buffer,d=Object.assign(Object.assign({},l),{challenge:c});if(r&&r.length>0){d.allowCredentials=new Array(r.length);for(let h=0;h<r.length;h++){const m=r[h];d.allowCredentials[h]=Object.assign(Object.assign({},m),{id:vr(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function rj(n){var a;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const r=n;return{id:n.id,rawId:n.id,response:{attestationObject:ns(new Uint8Array(n.response.attestationObject)),clientDataJSON:ns(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function ij(n){var a;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const r=n,l=n.getClientExtensionResults(),c=n.response;return{id:n.id,rawId:n.id,response:{authenticatorData:ns(new Uint8Array(c.authenticatorData)),clientDataJSON:ns(new Uint8Array(c.clientDataJSON)),signature:ns(new Uint8Array(c.signature)),userHandle:c.userHandle?ns(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function ev(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function Jg(){var n,a;return!!(Nt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.create)=="function"&&typeof((a=navigator?.credentials)===null||a===void 0?void 0:a.get)=="function")}async function lj(n){try{const a=await navigator.credentials.create(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new zo("Browser returned unexpected credential type",a)}:{data:null,error:new zo("Empty credential response",a)}}catch(a){return{data:null,error:WS({error:a,options:n})}}}async function oj(n){try{const a=await navigator.credentials.get(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new zo("Browser returned unexpected credential type",a)}:{data:null,error:new zo("Empty credential response",a)}}catch(a){return{data:null,error:ej({error:a,options:n})}}}const cj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},uj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Uo(...n){const a=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of n)if(c)for(const d in c){const h=c[d];if(h!==void 0)if(Array.isArray(h))l[d]=h;else if(r(h))l[d]=h;else if(a(h)){const m=l[d];a(m)?l[d]=Uo(m,h):l[d]=Uo(h)}else l[d]=h}return l}function dj(n,a){return Uo(cj,n,a||{})}function fj(n,a){return Uo(uj,n,a||{})}class hj{constructor(a){this.client=a,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(a){return this.client.mfa.enroll(Object.assign(Object.assign({},a),{factorType:"webauthn"}))}async _challenge({factorId:a,webauthn:r,friendlyName:l,signal:c},d){try{const{data:h,error:m}=await this.client.mfa.challenge({factorId:a,webauthn:r});if(!h)return{data:null,error:m};const p=c??aj.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:g}=h.webauthn.credential_options.publicKey;g.name||(g.name=`${g.id}:${l}`),g.displayName||(g.displayName=g.name)}switch(h.webauthn.type){case"create":{const g=dj(h.webauthn.credential_options.publicKey,d?.create),{data:v,error:_}=await lj({publicKey:g,signal:p});return v?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:_}}case"request":{const g=fj(h.webauthn.credential_options.publicKey,d?.request),{data:v,error:_}=await oj(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:g,signal:p}));return v?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:_}}}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new as("Unexpected error in challenge",h)}}}async _verify({challengeId:a,factorId:r,webauthn:l}){return this.client.mfa.verify({factorId:r,challengeId:a,webauthn:l})}async _authenticate({factorId:a,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new Ui("rpId is required for WebAuthn authentication")};try{if(!Jg())return{data:null,error:new as("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this.challenge({factorId:a,webauthn:{rpId:r,rpOrigins:l},signal:c},{request:d});if(!h)return{data:null,error:m};const{webauthn:p}=h;return this._verify({factorId:a,challengeId:h.challengeId,webauthn:{type:p.type,rpId:r,rpOrigins:l,credential_response:p.credential_response}})}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new as("Unexpected error in authenticate",h)}}}async _register({friendlyName:a,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new Ui("rpId is required for WebAuthn registration")};try{if(!Jg())return{data:null,error:new as("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this._enroll({friendlyName:a});if(!h)return await this.client.mfa.listFactors().then(v=>{var _;return(_=v.data)===null||_===void 0?void 0:_.all.find(x=>x.factor_type==="webauthn"&&x.friendly_name===a&&x.status!=="unverified")}).then(v=>v?this.client.mfa.unenroll({factorId:v?.id}):void 0),{data:null,error:m};const{data:p,error:g}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return p?this._verify({factorId:h.id,challengeId:p.challengeId,webauthn:{rpId:r,rpOrigins:l,type:p.webauthn.type,credential_response:p.webauthn.credential_response}}):{data:null,error:g}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new as("Unexpected error in register",h)}}}}XS();const mj={url:cS,storageKey:uS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:dS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Xg(n,a,r){return await r()}const or={};class Li{get jwks(){var a,r;return(r=(a=or[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){or[this.storageKey]=Object.assign(Object.assign({},or[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=or[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){or[this.storageKey]=Object.assign(Object.assign({},or[this.storageKey]),{cachedAt:a})}constructor(a){var r,l,c;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const d=Object.assign(Object.assign({},mj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Li.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Li.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Nt()){const h=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(h),this.logDebugMessages&&console.trace(h)}if(this.persistSession=d.persistSession,this.autoRefreshToken=d.autoRefreshToken,this.admin=new KS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Zy(d.fetch),this.lock=d.lock||Xg,this.detectSessionInUrl=d.detectSessionInUrl,this.flowType=d.flowType,this.hasCustomAuthorizationHeader=d.hasCustomAuthorizationHeader,this.throwOnError=d.throwOnError,this.lockAcquireTimeout=d.lockAcquireTimeout,d.lock?this.lock=d.lock:this.persistSession&&Nt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=JS:this.lock=Xg,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new hj(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(d.storage?this.storage=d.storage:Qy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Yg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Yg(this.memoryStorage)),Nt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(h){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",h)}(c=this.broadcastChannel)===null||c===void 0||c.addEventListener("message",async h=>{this._debug("received broadcast notification from other tab or client",h),await this._notifyAllSubscribers(h.data.event,h.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(a){if(this.throwOnError&&a&&a.error)throw a.error;return a}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Yy}) ${new Date().toISOString()}`}_debug(...a){return this.logDebugMessages&&this.logger(this._logPrefix(),...a),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var a;try{let r={},l="none";if(Nt()&&(r=ES(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Nt()&&this.detectSessionInUrl&&l!=="none"){const{data:c,error:d}=await this._getSessionFromURL(r,l);if(d){if(this._debug("#_initialize()","error detecting session from URL",d),yS(d)){const p=(a=d.details)===null||a===void 0?void 0:a.code;if(p==="identity_already_exists"||p==="identity_not_found"||p==="single_identity_not_deletable")return{error:d}}return{error:d}}const{session:h,redirectType:m}=c;return this._debug("#_initialize()","detected session in URL",h,"redirect type",m),await this._saveSession(h),setTimeout(async()=>{m==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",h):await this._notifyAllSubscribers("SIGNED_IN",h)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return oe(r)?this._returnResult({error:r}):this._returnResult({error:new as("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(a){var r,l,c;try{const d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(l=(r=a?.options)===null||r===void 0?void 0:r.data)!==null&&l!==void 0?l:{},gotrue_meta_security:{captcha_token:(c=a?.options)===null||c===void 0?void 0:c.captchaToken}},xform:ua}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const p=h.session,g=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(d){if(oe(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signUp(a){var r,l,c;try{let d;if("email"in a){const{email:v,password:_,options:x}=a;let S=null,A=null;this.flowType==="pkce"&&([S,A]=await rr(this.storage,this.storageKey)),d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:x?.emailRedirectTo,body:{email:v,password:_,data:(r=x?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:x?.captchaToken},code_challenge:S,code_challenge_method:A},xform:ua})}else if("phone"in a){const{phone:v,password:_,options:x}=a;d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:_,data:(l=x?.data)!==null&&l!==void 0?l:{},channel:(c=x?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:x?.captchaToken}},xform:ua})}else throw new vo("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await jt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const p=h.session,g=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(d){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signInWithPassword(a){try{let r;if("email"in a){const{email:d,password:h,options:m}=a;r=await me(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:Pg})}else if("phone"in a){const{phone:d,password:h,options:m}=a;r=await me(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:Pg})}else throw new vo("You must provide either an email or phone number and a password");const{data:l,error:c}=r;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const d=new sr;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign({user:l.user,session:l.session},l.weak_password?{weakPassword:l.weak_password}:null),error:c})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(a){var r,l,c,d;return await this._handleProviderSignIn(a.provider,{redirectTo:(r=a.options)===null||r===void 0?void 0:r.redirectTo,scopes:(l=a.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=a.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:(d=a.options)===null||d===void 0?void 0:d.skipBrowserRedirect})}async exchangeCodeForSession(a){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(a))}async signInWithWeb3(a){const{chain:r}=a;switch(r){case"ethereum":return await this.signInWithEthereum(a);case"solana":return await this.signInWithSolana(a);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(a){var r,l,c,d,h,m,p,g,v,_,x;let S,A;if("message"in a)S=a.message,A=a.signature;else{const{chain:j,wallet:k,statement:O,options:q}=a;let B;if(Nt())if(typeof k=="object")B=k;else{const ue=window;if("ethereum"in ue&&typeof ue.ethereum=="object"&&"request"in ue.ethereum&&typeof ue.ethereum.request=="function")B=ue.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");B=k}const G=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),ee=await B.request({method:"eth_requestAccounts"}).then(ue=>ue).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!ee||ee.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const J=Wy(ee[0]);let P=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!P){const ue=await B.request({method:"eth_chainId"});P=QS(ue)}const X={domain:G.host,address:J,statement:O,uri:G.href,version:"1",chainId:P,nonce:(c=q?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=q?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=q?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(p=q?.signInWithEthereum)===null||p===void 0?void 0:p.notBefore,requestId:(g=q?.signInWithEthereum)===null||g===void 0?void 0:g.requestId,resources:(v=q?.signInWithEthereum)===null||v===void 0?void 0:v.resources};S=FS(X),A=await B.request({method:"personal_sign",params:[ZS(S),J]})}try{const{data:j,error:k}=await me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:A},!((_=a.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(x=a.options)===null||x===void 0?void 0:x.captchaToken}}:null),xform:ua});if(k)throw k;if(!j||!j.session||!j.user){const O=new sr;return this._returnResult({data:{user:null,session:null},error:O})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:k})}catch(j){if(oe(j))return this._returnResult({data:{user:null,session:null},error:j});throw j}}async signInWithSolana(a){var r,l,c,d,h,m,p,g,v,_,x,S;let A,j;if("message"in a)A=a.message,j=a.signature;else{const{chain:k,wallet:O,statement:q,options:B}=a;let G;if(Nt())if(typeof O=="object")G=O;else{const J=window;if("solana"in J&&typeof J.solana=="object"&&("signIn"in J.solana&&typeof J.solana.signIn=="function"||"signMessage"in J.solana&&typeof J.solana.signMessage=="function"))G=J.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof O!="object"||!B?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");G=O}const ee=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in G&&G.signIn){const J=await G.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},B?.signInWithSolana),{version:"1",domain:ee.host,uri:ee.href}),q?{statement:q}:null));let P;if(Array.isArray(J)&&J[0]&&typeof J[0]=="object")P=J[0];else if(J&&typeof J=="object"&&"signedMessage"in J&&"signature"in J)P=J;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)A=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),j=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in G)||typeof G.signMessage!="function"||!("publicKey"in G)||typeof G!="object"||!G.publicKey||!("toBase58"in G.publicKey)||typeof G.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");A=[`${ee.host} wants you to sign in with your Solana account:`,G.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${ee.href}`,`Issued At: ${(c=(l=B?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=B?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${B.signInWithSolana.notBefore}`]:[],...!((h=B?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${B.signInWithSolana.expirationTime}`]:[],...!((m=B?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${B.signInWithSolana.chainId}`]:[],...!((p=B?.signInWithSolana)===null||p===void 0)&&p.nonce?[`Nonce: ${B.signInWithSolana.nonce}`]:[],...!((g=B?.signInWithSolana)===null||g===void 0)&&g.requestId?[`Request ID: ${B.signInWithSolana.requestId}`]:[],...!((_=(v=B?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||_===void 0)&&_.length?["Resources",...B.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
|
|
51
|
+
`);const J=await G.signMessage(new TextEncoder().encode(A),"utf8");if(!J||!(J instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=J}}try{const{data:k,error:O}=await me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:A,signature:ns(j)},!((x=a.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(S=a.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:ua});if(O)throw O;if(!k||!k.session||!k.user){const q=new sr;return this._returnResult({data:{user:null,session:null},error:q})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:O})}catch(k){if(oe(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(a){const r=await Wn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new vS;const{data:d,error:h}=await me(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:l},xform:ua});if(await jt(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new sr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:m})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",d.session)),this._returnResult({data:Object.assign(Object.assign({},d),{redirectType:c??null}),error:h})}catch(d){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:{user:null,session:null,redirectType:null},error:d});throw d}}async signInWithIdToken(a){try{const{options:r,provider:l,token:c,access_token:d,nonce:h}=a,m=await me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:l,id_token:c,access_token:d,nonce:h,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:ua}),{data:p,error:g}=m;if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!p||!p.session||!p.user){const v=new sr;return this._returnResult({data:{user:null,session:null},error:v})}return p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("SIGNED_IN",p.session)),this._returnResult({data:p,error:g})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(a){var r,l,c,d,h;try{if("email"in a){const{email:m,options:p}=a;let g=null,v=null;this.flowType==="pkce"&&([g,v]=await rr(this.storage,this.storageKey));const{error:_}=await me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=p?.data)!==null&&r!==void 0?r:{},create_user:(l=p?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},code_challenge:g,code_challenge_method:v},redirectTo:p?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:_})}if("phone"in a){const{phone:m,options:p}=a,{data:g,error:v}=await me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=p?.data)!==null&&c!==void 0?c:{},create_user:(d=p?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},channel:(h=p?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:g?.message_id},error:v})}throw new vo("You must provide either an email or phone number.")}catch(m){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async verifyOtp(a){var r,l;try{let c,d;"options"in a&&(c=(r=a.options)===null||r===void 0?void 0:r.redirectTo,d=(l=a.options)===null||l===void 0?void 0:l.captchaToken);const{data:h,error:m}=await me(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},a),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:ua});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const p=h.session,g=h.user;return p?.access_token&&(await this._saveSession(p),await this._notifyAllSubscribers(a.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(c){if(oe(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithSSO(a){var r,l,c,d,h;try{let m=null,p=null;this.flowType==="pkce"&&([m,p]=await rr(this.storage,this.storageKey));const g=await me(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in a?{provider_id:a.providerId}:null),"domain"in a?{domain:a.domain}:null),{redirect_to:(l=(r=a.options)===null||r===void 0?void 0:r.redirectTo)!==null&&l!==void 0?l:void 0}),!((c=a?.options)===null||c===void 0)&&c.captchaToken?{gotrue_meta_security:{captcha_token:a.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:m,code_challenge_method:p}),headers:this.headers,xform:IS});return!((d=g.data)===null||d===void 0)&&d.url&&Nt()&&!(!((h=a.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(g.data.url),this._returnResult(g)}catch(m){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(m))return this._returnResult({data:null,error:m});throw m}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async a=>{const{data:{session:r},error:l}=a;if(l)throw l;if(!r)throw new Yt;const{error:c}=await me(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:c})})}catch(a){if(oe(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async resend(a){try{const r=`${this.url}/resend`;if("email"in a){const{email:l,type:c,options:d}=a,{error:h}=await me(this.fetch,"POST",r,{headers:this.headers,body:{email:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken}},redirectTo:d?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}else if("phone"in a){const{phone:l,type:c,options:d}=a,{data:h,error:m}=await me(this.fetch,"POST",r,{headers:this.headers,body:{phone:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:h?.message_id},error:m})}throw new vo("You must provide either an email or phone number and a type")}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(a,r){this._debug("#_acquireLock","begin",a);try{if(this.lockAcquired){const l=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),c=(async()=>(await l,await r()))();return this.pendingInLock.push((async()=>{try{await c}catch{}})()),c}return await this.lock(`lock:${this.storageKey}`,a,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const l=r();for(this.pendingInLock.push((async()=>{try{await l}catch{}})()),await l;this.pendingInLock.length;){const c=[...this.pendingInLock];await Promise.all(c),this.pendingInLock.splice(0,c.length)}return await l}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(a){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await a(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let a=null;const r=await Wn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?a=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!a)return{data:{session:null},error:null};const l=a.expires_at?a.expires_at*1e3-Date.now()<xd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",a.expires_at),!l){if(this.userStorage){const h=await Wn(this.userStorage,this.storageKey+"-user");h?.user?a.user=h.user:a.user=Sd()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=qS(a.user,h),h.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:a},error:null}}const{data:c,error:d}=await this._callRefreshToken(a.refresh_token);return d?this._returnResult({data:{session:null},error:d}):this._returnResult({data:{session:c},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(a){if(a)return await this._getUser(a);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(a){try{return a?await me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:a,xform:kn}):await this._useSession(async r=>{var l,c,d;const{data:h,error:m}=r;if(m)throw m;return!(!((l=h.session)===null||l===void 0)&&l.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Yt}:await me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(d=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&d!==void 0?d:void 0,xform:kn})})}catch(r){if(oe(r))return gS(r)&&(await this._removeSession(),await jt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(a,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(a,r))}async _updateUser(a,r={}){try{return await this._useSession(async l=>{const{data:c,error:d}=l;if(d)throw d;if(!c.session)throw new Yt;const h=c.session;let m=null,p=null;this.flowType==="pkce"&&a.email!=null&&([m,p]=await rr(this.storage,this.storageKey));const{data:g,error:v}=await me(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},a),{code_challenge:m,code_challenge_method:p}),jwt:h.access_token,xform:kn});if(v)throw v;return h.user=g.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(l))return this._returnResult({data:{user:null},error:l});throw l}}async setSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(a))}async _setSession(a){try{if(!a.access_token||!a.refresh_token)throw new Yt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=_d(a.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:p}=await this._callRefreshToken(a.refresh_token);if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:p}=await this._getUser(a.access_token);if(p)throw p;d={access_token:a.access_token,refresh_token:a.refresh_token,user:m.user,token_type:"bearer",expires_in:l-r,expires_at:l},await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)}return this._returnResult({data:{user:d.user,session:d},error:null})}catch(r){if(oe(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(a))}async _refreshSession(a){try{return await this._useSession(async r=>{var l;if(!a){const{data:h,error:m}=r;if(m)throw m;a=(l=h.session)!==null&&l!==void 0?l:void 0}if(!a?.refresh_token)throw new Yt;const{data:c,error:d}=await this._callRefreshToken(a.refresh_token);return d?this._returnResult({data:{user:null,session:null},error:d}):c?this._returnResult({data:{user:c.user,session:c},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(a,r){try{if(!Nt())throw new bo("No browser detected.");if(a.error||a.error_description||a.error_code)throw new bo(a.error_description||"Error in URL with unspecified error_description",{error:a.error||"unspecified_error",code:a.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Bg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new bo("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!a.code)throw new Bg("No code detected.");const{data:q,error:B}=await this._exchangeCodeForSession(a.code);if(B)throw B;const G=new URL(window.location.href);return G.searchParams.delete("code"),window.history.replaceState(window.history.state,"",G.toString()),{data:{session:q.session,redirectType:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:d,refresh_token:h,expires_in:m,expires_at:p,token_type:g}=a;if(!d||!m||!h||!g)throw new bo("No session defined in URL");const v=Math.round(Date.now()/1e3),_=parseInt(m);let x=v+_;p&&(x=parseInt(p));const S=x-v;S*1e3<=hr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${_}s`);const A=x-_;v-A>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",A,x,v):v-A<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",A,x,v);const{data:j,error:k}=await this._getUser(d);if(k)throw k;const O={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:_,expires_at:x,refresh_token:h,token_type:g,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:O,redirectType:a.type},error:null})}catch(l){if(oe(l))return this._returnResult({data:{session:null,redirectType:null},error:l});throw l}}_isImplicitGrantCallback(a){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),a):!!(a.access_token||a.error_description)}async _isPKCECallback(a){const r=await Wn(this.storage,`${this.storageKey}-code-verifier`);return!!(a.code&&r)}async signOut(a={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(a))}async _signOut({scope:a}={scope:"global"}){return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({error:d});const h=(l=c.session)===null||l===void 0?void 0:l.access_token;if(h){const{error:m}=await this.admin.signOut(h,a);if(m&&!(pS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await jt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=NS(),l={id:r,callback:a,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,l),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:l}}}async _emitInitialSession(a){return await this._useSession(async r=>{var l,c;try{const{data:{session:d},error:h}=r;if(h)throw h;await((l=this.stateChangeEmitters.get(a))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",a,"session",d)}catch(d){await((c=this.stateChangeEmitters.get(a))===null||c===void 0?void 0:c.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",a,"error",d),console.error(d)}})}async resetPasswordForEmail(a,r={}){let l=null,c=null;this.flowType==="pkce"&&([l,c]=await rr(this.storage,this.storageKey,!0));try{return await me(this.fetch,"POST",`${this.url}/recover`,{body:{email:a,code_challenge:l,code_challenge_method:c,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(d){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:null,error:d});throw d}}async getUserIdentities(){var a;try{const{data:r,error:l}=await this.getUser();if(l)throw l;return this._returnResult({data:{identities:(a=r.user.identities)!==null&&a!==void 0?a:[]},error:null})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(a){return"token"in a?this.linkIdentityIdToken(a):this.linkIdentityOAuth(a)}async linkIdentityOAuth(a){var r;try{const{data:l,error:c}=await this._useSession(async d=>{var h,m,p,g,v;const{data:_,error:x}=d;if(x)throw x;const S=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,a.provider,{redirectTo:(h=a.options)===null||h===void 0?void 0:h.redirectTo,scopes:(m=a.options)===null||m===void 0?void 0:m.scopes,queryParams:(p=a.options)===null||p===void 0?void 0:p.queryParams,skipBrowserRedirect:!0});return await me(this.fetch,"GET",S,{headers:this.headers,jwt:(v=(g=_.session)===null||g===void 0?void 0:g.access_token)!==null&&v!==void 0?v:void 0})});if(c)throw c;return Nt()&&!(!((r=a.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(l?.url),this._returnResult({data:{provider:a.provider,url:l?.url},error:null})}catch(l){if(oe(l))return this._returnResult({data:{provider:a.provider,url:null},error:l});throw l}}async linkIdentityIdToken(a){return await this._useSession(async r=>{var l;try{const{error:c,data:{session:d}}=r;if(c)throw c;const{options:h,provider:m,token:p,access_token:g,nonce:v}=a,_=await me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(l=d?.access_token)!==null&&l!==void 0?l:void 0,body:{provider:m,id_token:p,access_token:g,nonce:v,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:ua}),{data:x,error:S}=_;return S?this._returnResult({data:{user:null,session:null},error:S}):!x||!x.session||!x.user?this._returnResult({data:{user:null,session:null},error:new sr}):(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("USER_UPDATED",x.session)),this._returnResult({data:x,error:S}))}catch(c){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}})}async unlinkIdentity(a){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)throw h;return await me(this.fetch,"DELETE",`${this.url}/user/identities/${a.identity_id}`,{headers:this.headers,jwt:(c=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(a){const r=`#_refreshAccessToken(${a.substring(0,5)}...)`;this._debug(r,"begin");try{const l=Date.now();return await CS(async c=>(c>0&&await AS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await me(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:a},headers:this.headers,xform:ua})),(c,d)=>{const h=200*Math.pow(2,c);return d&&wd(d)&&Date.now()+h-l<hr})}catch(l){if(this._debug(r,"error",l),oe(l))return this._returnResult({data:{session:null,user:null},error:l});throw l}finally{this._debug(r,"end")}}_isValidSession(a){return typeof a=="object"&&a!==null&&"access_token"in a&&"refresh_token"in a&&"expires_at"in a}async _handleProviderSignIn(a,r){const l=await this._getUrlForProvider(`${this.url}/authorize`,a,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",a,"options",r,"url",l),Nt()&&!r.skipBrowserRedirect&&window.location.assign(l),{data:{provider:a,url:l},error:null}}async _recoverAndRefresh(){var a,r;const l="#_recoverAndRefresh()";this._debug(l,"begin");try{const c=await Wn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await Wn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await mr(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:Sd()}else if(c&&!c.user&&!c.user){const h=await Wn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await jt(this.storage,this.storageKey+"-user"),await mr(this.storage,this.storageKey,c)):c.user=Sd()}if(this._debug(l,"session from storage",c),!this._isValidSession(c)){this._debug(l,"session is not valid"),c!==null&&await this._removeSession();return}const d=((r=c.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<xd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${xd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),wd(h)||(this._debug(l,"refresh failed with a non-retryable error, removing the session",h),await this._removeSession()))}}else if(c.user&&c.user.__isUserNotAvailableProxy===!0)try{const{data:h,error:m}=await this._getUser(c.access_token);!m&&h?.user?(c.user=h.user,await this._saveSession(c),await this._notifyAllSubscribers("SIGNED_IN",c)):this._debug(l,"could not get user data, skipping SIGNED_IN notification")}catch(h){console.error("Error getting user data:",h),this._debug(l,"error getting user data, skipping SIGNED_IN notification",h)}else await this._notifyAllSubscribers("SIGNED_IN",c)}catch(c){this._debug(l,"error",c),console.error(c);return}finally{this._debug(l,"end")}}async _callRefreshToken(a){var r,l;if(!a)throw new Yt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const c=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(c,"begin");try{this.refreshingDeferred=new $o;const{data:d,error:h}=await this._refreshAccessToken(a);if(h)throw h;if(!d.session)throw new Yt;await this._saveSession(d.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",d.session);const m={data:d.session,error:null};return this.refreshingDeferred.resolve(m),m}catch(d){if(this._debug(c,"error",d),oe(d)){const h={data:null,error:d};return wd(d)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(h),h}throw(l=this.refreshingDeferred)===null||l===void 0||l.reject(d),d}finally{this.refreshingDeferred=null,this._debug(c,"end")}}async _notifyAllSubscribers(a,r,l=!0){const c=`#_notifyAllSubscribers(${a})`;this._debug(c,"begin",r,`broadcast = ${l}`);try{this.broadcastChannel&&l&&this.broadcastChannel.postMessage({event:a,session:r});const d=[],h=Array.from(this.stateChangeEmitters.values()).map(async m=>{try{await m.callback(a,r)}catch(p){d.push(p)}});if(await Promise.all(h),d.length>0){for(let m=0;m<d.length;m+=1)console.error(d[m]);throw d[0]}}finally{this._debug(c,"end")}}async _saveSession(a){this._debug("#_saveSession()",a),this.suppressGetSessionWarning=!0,await jt(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},a),l=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!l&&r.user&&await mr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Ig(c);await mr(this.storage,this.storageKey,d)}else{const c=Ig(r);await mr(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await jt(this.storage,this.storageKey),await jt(this.storage,this.storageKey+"-code-verifier"),await jt(this.storage,this.storageKey+"-user"),this.userStorage&&await jt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&Nt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",a)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const a=setInterval(()=>this._autoRefreshTokenTick(),hr);this.autoRefreshTicker=a,a&&typeof a=="object"&&typeof a.unref=="function"?a.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(a);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const a=this.autoRefreshTicker;this.autoRefreshTicker=null,a&&clearInterval(a);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const a=Date.now();try{return await this._useSession(async r=>{const{data:{session:l}}=r;if(!l||!l.refresh_token||!l.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const c=Math.floor((l.expires_at*1e3-a)/hr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${hr}ms, refresh threshold is ${Pd} ticks`),c<=Pd&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(a){if(a.isAcquireTimeout||a instanceof Fy)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Nt()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(a){console.error("_handleVisibilityChange",a)}}async _onVisibilityChanged(a){const r=`#_onVisibilityChanged(${a})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),a||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(a,r,l){const c=[`provider=${encodeURIComponent(r)}`];if(l?.redirectTo&&c.push(`redirect_to=${encodeURIComponent(l.redirectTo)}`),l?.scopes&&c.push(`scopes=${encodeURIComponent(l.scopes)}`),this.flowType==="pkce"){const[d,h]=await rr(this.storage,this.storageKey),m=new URLSearchParams({code_challenge:`${encodeURIComponent(d)}`,code_challenge_method:`${encodeURIComponent(h)}`});c.push(m.toString())}if(l?.queryParams){const d=new URLSearchParams(l.queryParams);c.push(d.toString())}return l?.skipBrowserRedirect&&c.push(`skip_http_redirect=${l.skipBrowserRedirect}`),`${a}?${c.join("&")}`}async _unenroll(a){try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;return d?this._returnResult({data:null,error:d}):await me(this.fetch,"DELETE",`${this.url}/factors/${a.factorId}`,{headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(a){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({friendly_name:a.friendlyName,factor_type:a.factorType},a.factorType==="phone"?{phone:a.phone}:a.factorType==="totp"?{issuer:a.issuer}:{}),{data:p,error:g}=await me(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(l=d?.session)===null||l===void 0?void 0:l.access_token});return g?this._returnResult({data:null,error:g}):(a.factorType==="totp"&&p.type==="totp"&&(!((c=p?.totp)===null||c===void 0)&&c.qr_code)&&(p.totp.qr_code=`data:image/svg+xml;utf-8,${p.totp.qr_code}`),this._returnResult({data:p,error:null}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _verify(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({data:null,error:d});const h=Object.assign({challenge_id:a.challengeId},"webauthn"in a?{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_response:a.webauthn.type==="create"?rj(a.webauthn.credential_response):ij(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:p}=await me(this.fetch,"POST",`${this.url}/factors/${a.factorId}/verify`,{body:h,headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+m.expires_in},m)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",m),this._returnResult({data:m,error:p}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({data:null,error:d});const h=await me(this.fetch,"POST",`${this.url}/factors/${a.factorId}/challenge`,{body:a,headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token});if(h.error)return h;const{data:m}=h;if(m.type!=="webauthn")return{data:m,error:null};switch(m.webauthn.type){case"create":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:nj(m.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:sj(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(a){const{data:r,error:l}=await this._challenge({factorId:a.factorId});return l?this._returnResult({data:null,error:l}):await this._verify({factorId:a.factorId,challengeId:r.id,code:a.code})}async _listFactors(){var a;const{data:{user:r},error:l}=await this.getUser();if(l)return{data:null,error:l};const c={all:[],phone:[],totp:[],webauthn:[]};for(const d of(a=r?.factors)!==null&&a!==void 0?a:[])c.all.push(d),d.status==="verified"&&c[d.factor_type].push(d);return{data:c,error:null}}async _getAuthenticatorAssuranceLevel(){var a,r;const{data:{session:l},error:c}=await this.getSession();if(c)return this._returnResult({data:null,error:c});if(!l)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:d}=_d(l.access_token);let h=null;d.aal&&(h=d.aal);let m=h;((r=(a=l.user.factors)===null||a===void 0?void 0:a.filter(v=>v.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const g=d.amr||[];return{data:{currentLevel:h,nextLevel:m,currentAuthenticationMethods:g},error:null}}async _getAuthorizationDetails(a){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?await me(this.fetch,"GET",`${this.url}/oauth/authorizations/${a}`,{headers:this.headers,jwt:l.access_token,xform:d=>({data:d,error:null})}):this._returnResult({data:null,error:new Yt})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(a,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new Yt});const h=await me(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"approve"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Nt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(oe(l))return this._returnResult({data:null,error:l});throw l}}async _denyAuthorization(a,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new Yt});const h=await me(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"deny"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Nt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(oe(l))return this._returnResult({data:null,error:l});throw l}}async _listOAuthGrants(){try{return await this._useSession(async a=>{const{data:{session:r},error:l}=a;return l?this._returnResult({data:null,error:l}):r?await me(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:c=>({data:c,error:null})}):this._returnResult({data:null,error:new Yt})})}catch(a){if(oe(a))return this._returnResult({data:null,error:a});throw a}}async _revokeOAuthGrant(a){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?(await me(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:l.access_token,query:{client_id:a.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Yt})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(a,r={keys:[]}){let l=r.keys.find(m=>m.kid===a);if(l)return l;const c=Date.now();if(l=this.jwks.keys.find(m=>m.kid===a),l&&this.jwks_cached_at+hS>c)return l;const{data:d,error:h}=await me(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(h)throw h;return!d.keys||d.keys.length===0||(this.jwks=d,this.jwks_cached_at=c,l=d.keys.find(m=>m.kid===a),!l)?null:l}async getClaims(a,r={}){try{let l=a;if(!l){const{data:S,error:A}=await this.getSession();if(A||!S.session)return this._returnResult({data:null,error:A});l=S.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:p}}=_d(l);r?.allowExpired||US(d.exp);const g=!c.alg||c.alg.startsWith("HS")||!c.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(c.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!g){const{error:S}=await this.getUser(l);if(S)throw S;return{data:{claims:d,header:c,signature:h},error:null}}const v=LS(c.alg),_=await crypto.subtle.importKey("jwk",g,v,!0,["verify"]);if(!await crypto.subtle.verify(v,_,h,SS(`${m}.${p}`)))throw new Jd("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(oe(l))return this._returnResult({data:null,error:l});throw l}}}Li.nextInstanceID={};const pj=Li,gj="2.90.1";let Ei="";typeof Deno<"u"?Ei="deno":typeof document<"u"?Ei="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ei="react-native":Ei="node";const yj={"X-Client-Info":`supabase-js-${Ei}/${gj}`},vj={headers:yj},bj={schema:"public"},xj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},wj={};function Bi(n){"@babel/helpers - typeof";return Bi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Bi(n)}function _j(n,a){if(Bi(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(Bi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function Sj(n){var a=_j(n,"string");return Bi(a)=="symbol"?a:a+""}function jj(n,a,r){return(a=Sj(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function Qg(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(n,c).enumerable})),r.push.apply(r,l)}return r}function et(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Qg(Object(r),!0).forEach(function(l){jj(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Qg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const Nj=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),Ej=()=>Headers,Tj=(n,a,r)=>{const l=Nj(r),c=Ej();return async(d,h)=>{var m;const p=(m=await a())!==null&&m!==void 0?m:n;let g=new c(h?.headers);return g.has("apikey")||g.set("apikey",n),g.has("Authorization")||g.set("Authorization",`Bearer ${p}`),l(d,et(et({},h),{},{headers:g}))}};function Aj(n){return n.endsWith("/")?n:n+"/"}function Cj(n,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=n,{db:p,auth:g,realtime:v,global:_}=a,x={db:et(et({},p),c),auth:et(et({},g),d),realtime:et(et({},v),h),storage:{},global:et(et(et({},_),m),{},{headers:et(et({},(r=_?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return n.accessToken?x.accessToken=n.accessToken:delete x.accessToken,x}function kj(n){const a=n?.trim();if(!a)throw new Error("supabaseUrl is required.");if(!a.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Aj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Oj=class extends pj{constructor(n){super(n)}},Rj=class{constructor(n,a,r){var l,c;this.supabaseUrl=n,this.supabaseKey=a;const d=kj(n);if(!a)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",d),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",d),this.storageUrl=new URL("storage/v1",d),this.functionsUrl=new URL("functions/v1",d);const h=`sb-${d.hostname.split(".")[0]}-auth-token`,m={db:bj,realtime:wj,auth:et(et({},xj),{},{storageKey:h}),global:vj},p=Cj(r??{},m);if(this.storageKey=(l=p.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=p.global.headers)!==null&&c!==void 0?c:{},p.accessToken)this.accessToken=p.accessToken,this.auth=new Proxy({},{get:(v,_)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(_)} is not possible`)}});else{var g;this.auth=this._initSupabaseAuthClient((g=p.auth)!==null&&g!==void 0?g:{},this.headers,p.global.fetch)}this.fetch=Tj(a,this._getAccessToken.bind(this),p.global.fetch),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this)},p.realtime)),this.accessToken&&this.accessToken().then(v=>this.realtime.setAuth(v)).catch(v=>console.warn("Failed to set initial Realtime auth token:",v)),this.rest=new d1(new URL("rest/v1",d).href,{headers:this.headers,schema:p.db.schema,fetch:this.fetch}),this.storage=new oS(this.storageUrl.href,this.headers,this.fetch,r?.storage),p.accessToken||this._listenForAuthEvents()}get functions(){return new i1(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,a={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,a,r)}channel(n,a={config:{}}){return this.realtime.channel(n,a)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,a,r;if(n.accessToken)return await n.accessToken();const{data:l}=await n.auth.getSession();return(a=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:p,throwOnError:g},v,_){const x={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Oj({url:this.authUrl.href,headers:et(et({},x),v),storageKey:d,autoRefreshToken:n,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:p,throwOnError:g,fetch:_,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new A1(this.realtimeUrl.href,et(et({},n),{},{params:et(et({},{apikey:this.supabaseKey}),n?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,a)=>{this._handleTokenChanged(n,"CLIENT",a?.access_token)})}_handleTokenChanged(n,a,r){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Zg=(n,a,r)=>new Rj(n,a,r);function Dj(){if(typeof window<"u")return!1;const n=globalThis.process;if(!n)return!1;const a=n.version;if(a==null)return!1;const r=a.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Dj()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Ho="email_automator_supabase_config";function Cr(){try{const n=localStorage.getItem(Ho);if(n)return JSON.parse(n)}catch(n){console.error("Error reading Supabase config:",n)}return null}function Mj(n){try{localStorage.setItem(Ho,JSON.stringify(n))}catch(a){console.error("Error saving Supabase config:",a)}}function zj(){try{localStorage.removeItem(Ho)}catch(n){console.error("Error clearing Supabase config:",n)}}async function tv(n,a){try{if(!n.startsWith("http://")&&!n.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const r=a.startsWith("eyJ"),l=a.startsWith("sb_publishable_");if(!r&&!l)return{valid:!1,error:"Invalid API key format (must be anon or publishable key)"};if(l)return{valid:!0};const c=await fetch(`${n}/rest/v1/`,{method:"GET",headers:{apikey:a,Authorization:`Bearer ${a}`}});return c.ok?{valid:!0}:c.status===401||c.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${c.statusText}`}}catch(r){return{valid:!1,error:r instanceof Error?r.message:"Connection failed"}}}function Uj(){return localStorage.getItem(Ho)?"ui":"none"}function Lj(){const n=Cr();return!n||!n.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Zg("https://placeholder.supabase.co","placeholder-key")):Zg(n.url,n.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=Lj();function Fg(){const n=Cr(),a=n?`${n.url}/functions/v1`:"",r=n?n.anonKey:"",l=window.location.port==="5173";let c="";return l?c="http://localhost:3004":c=window.location.origin,{edgeFunctionsUrl:a,expressApiUrl:c,anonKey:r}}class Bj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=Fg();this.edgeFunctionsUrl=a.edgeFunctionsUrl,this.expressApiUrl=a.expressApiUrl,this.anonKey=a.anonKey}setSupabaseClient(a){this.supabaseClient=a}setToken(a){console.debug(a?"[HybridApiClient] Token updated":"[HybridApiClient] Token cleared"),this.token=a}async request(a,r,l={}){const{auth:c=!0,...d}=l,h={"Content-Type":"application/json",...l.headers||{}};if(c&&!this.token&&this.supabaseClient){const{data:{session:m}}=await this.supabaseClient.auth.getSession();m?.access_token&&(this.token=m.access_token,console.debug("[HybridApiClient] Recovered token from session"))}if(c&&!this.token)return console.warn(`[HybridApiClient] Attempted protected request to ${r} without token`),{error:{code:"AUTH_REQUIRED",message:"You must be logged in to perform this action"}};c&&this.token&&(h.Authorization=`Bearer ${this.token}`);try{console.debug(`[HybridApiClient] ${l.method||"GET"} ${a}${r}`);const m=await fetch(`${a}${r}`,{...d,headers:h});if(!m.ok){const g=await m.json().catch(()=>({})),v=typeof g.error=="string"?g.error:g.error?.message||`Request failed: ${m.status}`;return{error:{code:g.error?.code||"API_ERROR",message:v}}}return{data:await m.json()}}catch(m){return{error:{code:"NETWORK_ERROR",message:m instanceof Error?m.message:"Network error"}}}}edgeRequest(a,r){const l={...r?.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,a,{...r,headers:l})}expressRequest(a,r){const l=Fg(),c={...r?.headers||{},"X-Supabase-Url":l.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":l.anonKey};return this.request(this.expressApiUrl,a,{...r,headers:c})}async getGmailAuthUrl(){return this.edgeRequest("/auth-gmail?action=url",{method:"GET"})}async connectGmail(a){return this.edgeRequest("/auth-gmail",{method:"POST",body:JSON.stringify({code:a})})}async startMicrosoftDeviceFlow(){return this.edgeRequest("/auth-microsoft?action=device-flow",{method:"POST"})}async pollMicrosoftDeviceCode(a){return this.edgeRequest("/auth-microsoft?action=poll",{method:"POST",body:JSON.stringify({deviceCode:a})})}async getAccounts(){return this.edgeRequest("/api-v1-accounts")}async disconnectAccount(a){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"DELETE"})}async updateAccount(a,r){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async getEmails(a={}){const r=new URLSearchParams;return a.limit&&r.set("limit",a.limit.toString()),a.offset&&r.set("offset",a.offset.toString()),a.category&&r.set("category",a.category),a.search&&r.set("search",a.search),a.sort_by&&r.set("sort_by",a.sort_by),a.sort_order&&r.set("sort_order",a.sort_order),this.edgeRequest(`/api-v1-emails?${r}`)}async getEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`)}async getEmailEvents(a){return this.edgeRequest(`/api-v1-emails/${a}/events`)}async deleteEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`,{method:"DELETE"})}async getCategorySummary(){return this.edgeRequest("/api-v1-emails/summary/categories")}async getRules(){return this.expressRequest("/api/rules")}async createRule(a){return this.expressRequest("/api/rules",{method:"POST",body:JSON.stringify(a)})}async updateRule(a,r){return this.expressRequest(`/api/rules/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async deleteRule(a){return this.expressRequest(`/api/rules/${a}`,{method:"DELETE"})}async toggleRule(a){return this.expressRequest(`/api/rules/${a}/toggle`,{method:"POST"})}async getSettings(){return this.edgeRequest("/api-v1-settings")}async getRunEvents(a){return this.edgeRequest(`/api-v1-settings/logs/${a}/events`)}async updateSettings(a){return this.edgeRequest("/api-v1-settings",{method:"PATCH",body:JSON.stringify(a)})}async getStats(){return this.edgeRequest("/api-v1-settings/stats")}async testLlm(a){return this.expressRequest("/api/settings/test-llm",{method:"POST",body:JSON.stringify(a)})}async triggerSync(a){return this.expressRequest("/api/sync",{method:"POST",body:JSON.stringify({accountId:a})})}async syncAll(){return this.expressRequest("/api/sync/all",{method:"POST"})}async getSyncLogs(a=10){return this.expressRequest(`/api/sync/logs?limit=${a}`)}async executeAction(a,r,l){return this.expressRequest("/api/actions/execute",{method:"POST",body:JSON.stringify({emailId:a,action:r,draftContent:l})})}async generateDraft(a,r){return this.expressRequest(`/api/actions/draft/${a}`,{method:"POST",body:JSON.stringify({instructions:r})})}async bulkAction(a,r){return this.expressRequest("/api/actions/bulk",{method:"POST",body:JSON.stringify({emailIds:a,action:r})})}async healthCheck(){return this.expressRequest("/api/health",{auth:!1})}async getProfile(){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:a}}=await this.supabaseClient.auth.getUser();if(!a)return{error:"Not authenticated"};const{data:r,error:l}=await this.supabaseClient.from("profiles").select("*").eq("id",a.id).single();return{data:r,error:l}}async updateProfile(a){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:r}}=await this.supabaseClient.auth.getUser();if(!r)return{error:"Not authenticated"};const{data:l,error:c}=await this.supabaseClient.from("profiles").update({...a,updated_at:new Date().toISOString()}).eq("id",r.id).select().single();return{data:l,error:c}}async changePassword(a){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{error:r}=await this.supabaseClient.auth.updateUser({password:a});return{success:!r,error:r}}}const Ve=new Bj;async function av(n){Ve.setSupabaseClient(n);const{data:{session:a}}=await n.auth.getSession();a?.access_token&&Ve.setToken(a.access_token),n.auth.onAuthStateChange((r,l)=>{Ve.setToken(l?.access_token||null)})}const qj=Object.freeze(Object.defineProperty({__proto__:null,api:Ve,initializeApi:av},Symbol.toStringTag,{value:"Module"}));function $j({userId:n,onInsert:a,onUpdate:r,onDelete:l,enabled:c=!0}){const d=w.useRef(null);return w.useEffect(()=>{if(!c||!n)return;const h=ct.channel("emails-realtime").on("postgres_changes",{event:"INSERT",schema:"public",table:"emails"},m=>{a?.(m.new)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"emails"},m=>{r?.(m.new)}).on("postgres_changes",{event:"DELETE",schema:"public",table:"emails"},m=>{l?.(m.old.id)}).subscribe();return d.current=h,()=>{d.current&&ct.removeChannel(d.current)}},[n,c,a,r,l]),{isSubscribed:!!d.current}}class Hj{ctx=null;enabled=!1;constructor(){this.enabled=localStorage.getItem("ea_sounds_enabled")==="true"}setEnabled(a){this.enabled=a,localStorage.setItem("ea_sounds_enabled",a?"true":"none")}isEnabled(){return this.enabled}initCtx(){return this.ctx||(this.ctx=new(window.AudioContext||window.webkitAudioContext)),this.ctx.state==="suspended"&&this.ctx.resume(),this.ctx}haptic(a=10){typeof navigator<"u"&&navigator.vibrate&&navigator.vibrate(a)}playNotify(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="sine",r.frequency.setValueAtTime(880,a.currentTime),r.frequency.exponentialRampToValueAtTime(440,a.currentTime+.1),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.1,a.currentTime+.01),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.3),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.3),this.haptic(10)}playAlert(){if(!this.enabled)return;const a=this.initCtx(),r=(l,c)=>{const d=a.createOscillator(),h=a.createGain();d.type="sine",d.frequency.setValueAtTime(l,a.currentTime+c),h.gain.setValueAtTime(0,a.currentTime+c),h.gain.linearRampToValueAtTime(.1,a.currentTime+c+.05),h.gain.exponentialRampToValueAtTime(.001,a.currentTime+c+.4),d.connect(h),h.connect(a.destination),d.start(a.currentTime+c),d.stop(a.currentTime+c+.4)};r(660,0),r(880,.1),this.haptic([20,50,20])}playSuccess(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="triangle",r.frequency.setValueAtTime(523.25,a.currentTime),r.frequency.exponentialRampToValueAtTime(1046.5,a.currentTime+.1),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.05,a.currentTime+.02),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.2),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.2),this.haptic(15)}}const br=new Hj;let qi=[],Xd=new Set;function nv(){Xd.forEach(n=>n())}const re={success:(n,a)=>xo("success",n,a),error:(n,a)=>xo("error",n,a),info:(n,a)=>xo("info",n,a),warning:(n,a)=>xo("warning",n,a)};function xo(n,a,r=5e3){const l=Math.random().toString(36).substr(2,9);qi=[...qi,{id:l,type:n,message:a,duration:r}],nv(),r>0&&setTimeout(()=>sv(l),r)}function sv(n){qi=qi.filter(a=>a.id!==n),nv()}function Vj(){const[,n]=w.useState(0);return w.useEffect(()=>{const a=()=>n(r=>r+1);return Xd.add(a),()=>{Xd.delete(a)}},[]),qi}const Ij={success:tf,error:Nr,info:_r,warning:jr},Gj={success:"bg-emerald-500/10 border-emerald-500/20 text-emerald-600 dark:text-emerald-400",error:"bg-destructive/10 border-destructive/20 text-destructive",info:"bg-blue-500/10 border-blue-500/20 text-blue-600 dark:text-blue-400",warning:"bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-400"};function Pj({toast:n}){const a=Ij[n.type];return o.jsxs("div",{className:Ce("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-right-full duration-300",Gj[n.type]),children:[o.jsx(a,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),o.jsx("p",{className:"text-sm flex-1",children:n.message}),o.jsx("button",{onClick:()=>sv(n.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(Gi,{className:"w-4 h-4"})})]})}function Kj(){const n=Vj();return n.length===0?null:o.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full",children:n.map(a=>o.jsx(Pj,{toast:a},a.id))})}function Ja(n,a){return n?typeof n=="string"?n:n.message||a:a}const rv={user:null,isAuthenticated:!1,profile:null,emails:[],accounts:[],rules:[],settings:null,stats:null,isLoading:!0,isInitialized:!1,error:null,selectedEmailId:null,emailsTotal:0,emailsOffset:0,sortBy:"date",sortOrder:"desc"};function Yj(n,a){switch(a.type){case"SET_USER":return{...n,user:a.payload,isAuthenticated:!!a.payload,isLoading:!1};case"SET_LOADING":return{...n,isLoading:a.payload};case"SET_INITIALIZED":return{...n,isInitialized:a.payload};case"SET_ERROR":return{...n,error:a.payload,isLoading:!1};case"SET_EMAILS":return{...n,emails:a.payload.emails,emailsTotal:a.payload.total,emailsOffset:a.payload.offset,sortBy:a.payload.sortBy||n.sortBy,sortOrder:a.payload.sortOrder||n.sortOrder};case"ADD_EMAIL":return{...n,emails:[a.payload,...n.emails],emailsTotal:n.emailsTotal+1};case"UPDATE_EMAIL":return{...n,emails:n.emails.map(r=>r.id===a.payload.id?a.payload:r)};case"SET_PROFILE":return{...n,profile:a.payload};case"UPDATE_PROFILE":return{...n,profile:a.payload};case"SET_ACCOUNTS":return{...n,accounts:a.payload};case"ADD_ACCOUNT":return{...n,accounts:[a.payload,...n.accounts]};case"REMOVE_ACCOUNT":return{...n,accounts:n.accounts.filter(r=>r.id!==a.payload)};case"SET_RULES":return{...n,rules:a.payload};case"ADD_RULE":return{...n,rules:[a.payload,...n.rules]};case"UPDATE_RULE":return{...n,rules:n.rules.map(r=>r.id===a.payload.id?a.payload:r)};case"REMOVE_RULE":return{...n,rules:n.rules.filter(r=>r.id!==a.payload)};case"SET_SETTINGS":return{...n,settings:a.payload};case"SET_STATS":return{...n,stats:a.payload};case"SET_SELECTED_EMAIL":return{...n,selectedEmailId:a.payload};case"CLEAR_DATA":return{...rv,isLoading:!1,isInitialized:!0};default:return n}}const iv=w.createContext(null);function Jj({children:n}){const[a,r]=w.useReducer(Yj,rv),l=w.useCallback(p=>{r({type:"ADD_EMAIL",payload:p}),p.ai_analysis?.priority==="High"?(br.playAlert(),re.success("High Priority Email Processed!")):(br.playNotify(),re.info("New email processed"))},[r]),c=w.useCallback(p=>{r({type:"UPDATE_EMAIL",payload:p})},[r]),d=w.useCallback(p=>{},[r]),{isSubscribed:h}=$j({userId:a.user?.id,onInsert:l,onUpdate:c,onDelete:d,enabled:a.isAuthenticated});w.useEffect(()=>{async function p(){if(!Cr()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:v}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(v&&v.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await av(ct);const{data:{session:_}}=await ct.auth.getSession();r({type:"SET_USER",payload:_?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:x}}=ct.auth.onAuthStateChange((S,A)=>{r({type:"SET_USER",payload:A?.user||null}),A||r({type:"CLEAR_DATA"})});return()=>x.unsubscribe()}catch(v){console.error("[AppContext] Init error:",v),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}p()},[]);const m={fetchEmails:async(p={})=>{const g=await Ve.getEmails({limit:20,offset:p.offset||0,category:p.category,search:p.search,sort_by:p.sortBy||a.sortBy,sort_order:p.sortOrder||a.sortOrder});g.data&&r({type:"SET_EMAILS",payload:{emails:g.data.emails,total:g.data.total,offset:p.offset||0,sortBy:p.sortBy,sortOrder:p.sortOrder}})},fetchAccounts:async()=>{const p=await Ve.getAccounts();p.data&&r({type:"SET_ACCOUNTS",payload:p.data.accounts})},fetchRules:async()=>{const p=await Ve.getRules();p.data&&r({type:"SET_RULES",payload:p.data.rules})},fetchSettings:async()=>{const p=await Ve.getSettings();p.data&&r({type:"SET_SETTINGS",payload:p.data.settings})},fetchProfile:async()=>{const p=await Ve.getProfile();p.data&&r({type:"SET_PROFILE",payload:p.data})},fetchStats:async()=>{const p=await Ve.getStats();p.data&&r({type:"SET_STATS",payload:p.data.stats})},executeAction:async(p,g,v)=>{const _=await Ve.executeAction(p,g,v);if(_.data?.success){const x=a.emails.find(S=>S.id===p);return x&&r({type:"UPDATE_EMAIL",payload:{...x,action_taken:g}}),!0}return r({type:"SET_ERROR",payload:Ja(_.error,"Action failed")}),!1},triggerSync:async p=>{const g=p?await Ve.triggerSync(p):await Ve.syncAll();return await m.fetchAccounts(),g.error?(r({type:"SET_ERROR",payload:Ja(g.error,"Sync failed")}),!1):!0},disconnectAccount:async p=>{const g=await Ve.disconnectAccount(p);return g.data?.success?(r({type:"REMOVE_ACCOUNT",payload:p}),!0):(r({type:"SET_ERROR",payload:Ja(g.error,"Failed to disconnect")}),!1)},updateSettings:async p=>{const g=await Ve.updateSettings(p);return g.data?(r({type:"SET_SETTINGS",payload:g.data.settings}),!0):(r({type:"SET_ERROR",payload:Ja(g.error,"Failed to update settings")}),!1)},updateProfile:async p=>{const g=await Ve.updateProfile(p);return g.data?(r({type:"UPDATE_PROFILE",payload:g.data}),!0):(r({type:"SET_ERROR",payload:Ja(g.error,"Failed to update profile")}),!1)},updateAccount:async(p,g)=>{const v=await Ve.updateAccount(p,g);return v.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(_=>_.id===p?{..._,...g}:_)}),!0):(r({type:"SET_ERROR",payload:Ja(v.error,"Failed to update account")}),!1)},createRule:async p=>{const g=await Ve.createRule(p);return g.data?(r({type:"ADD_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:Ja(g.error,"Failed to create rule")}),!1)},deleteRule:async p=>{const g=await Ve.deleteRule(p);return g.data?.success?(r({type:"REMOVE_RULE",payload:p}),!0):(r({type:"SET_ERROR",payload:Ja(g.error,"Failed to delete rule")}),!1)},toggleRule:async p=>{const g=await Ve.toggleRule(p);return g.data?(r({type:"UPDATE_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:Ja(g.error,"Failed to toggle rule")}),!1)}};return o.jsx(iv.Provider,{value:{state:a,isSubscribed:h,dispatch:r,actions:m},children:n})}function kr(){const n=w.useContext(iv);if(!n)throw new Error("useApp must be used within AppProvider");return n}const Xj=w.createContext(void 0);function Qj({children:n,value:a}){return o.jsx(Xj.Provider,{value:a,children:n})}const lv=w.createContext(null);function Zj({children:n}){const[a,r]=w.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(lv.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:n})}function ov(){const n=w.useContext(lv);if(!n)throw new Error("useTerminal must be used within a TerminalProvider");return n}const Et=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ce("rounded-xl border bg-card text-card-foreground shadow",n),...a}));Et.displayName="Card";const _a=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ce("flex flex-col space-y-1.5 p-6",n),...a}));_a.displayName="CardHeader";const Sa=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ce("font-semibold leading-none tracking-tight",n),...a}));Sa.displayName="CardTitle";const Za=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ce("text-sm text-muted-foreground",n),...a}));Za.displayName="CardDescription";const ja=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ce("p-6 pt-0",n),...a}));ja.displayName="CardContent";const cv=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ce("flex items-center p-6 pt-0",n),...a}));cv.displayName="CardFooter";class Fj extends w.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,r){console.error("ErrorBoundary caught an error:",a,r)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:o.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:o.jsxs(Et,{className:"max-w-md w-full p-8 text-center",children:[o.jsx("div",{className:"w-16 h-16 bg-destructive/10 text-destructive rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(jr,{className:"w-8 h-8"})}),o.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),o.jsx("p",{className:"text-muted-foreground mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&o.jsx("pre",{className:"text-xs text-left bg-secondary p-3 rounded-lg mb-6 overflow-auto max-h-32",children:this.state.error.message}),o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsxs(W,{onClick:this.handleReset,variant:"outline",children:[o.jsx(Sr,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(W,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function ht({size:n="md",className:a,text:r}){const l={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};return o.jsxs("div",{className:Ce("flex flex-col items-center justify-center gap-3",a),children:[o.jsx(qt,{className:Ce("animate-spin text-primary",l[n])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function Ci({text:n="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(ht,{size:"lg",text:n})})}function Wj(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(ht,{size:"md"})})}function On(n,a,{checkForDefaultPrevented:r=!0}={}){return function(c){if(n?.(c),r===!1||!c.defaultPrevented)return a?.(c)}}function eN(n,a){const r=w.createContext(a),l=d=>{const{children:h,...m}=d,p=w.useMemo(()=>m,Object.values(m));return o.jsx(r.Provider,{value:p,children:h})};l.displayName=n+"Provider";function c(d){const h=w.useContext(r);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${n}\``)}return[l,c]}function tN(n,a=[]){let r=[];function l(d,h){const m=w.createContext(h),p=r.length;r=[...r,h];const g=_=>{const{scope:x,children:S,...A}=_,j=x?.[n]?.[p]||m,k=w.useMemo(()=>A,Object.values(A));return o.jsx(j.Provider,{value:k,children:S})};g.displayName=d+"Provider";function v(_,x){const S=x?.[n]?.[p]||m,A=w.useContext(S);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${_}\` must be used within \`${d}\``)}return[g,v]}const c=()=>{const d=r.map(h=>w.createContext(h));return function(m){const p=m?.[n]||d;return w.useMemo(()=>({[`__scope${n}`]:{...m,[n]:p}}),[m,p])}};return c.scopeName=n,[l,aN(c,...a)]}function aN(...n){const a=n[0];if(n.length===1)return a;const r=()=>{const l=n.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const h=l.reduce((m,{useScope:p,scopeName:g})=>{const _=p(d)[`__scope${g}`];return{...m,..._}},{});return w.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var $i=globalThis?.document?w.useLayoutEffect:()=>{},nN=ef[" useId ".trim().toString()]||(()=>{}),sN=0;function Nd(n){const[a,r]=w.useState(nN());return $i(()=>{r(l=>l??String(sN++))},[n]),n||(a?`radix-${a}`:"")}var rN=ef[" useInsertionEffect ".trim().toString()]||$i;function iN({prop:n,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=lN({defaultProp:a,onChange:r}),m=n!==void 0,p=m?n:c;{const v=w.useRef(n!==void 0);w.useEffect(()=>{const _=v.current;_!==m&&console.warn(`${l} is changing from ${_?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=m},[m,l])}const g=w.useCallback(v=>{if(m){const _=oN(v)?v(n):v;_!==n&&h.current?.(_)}else d(v)},[m,n,d,h]);return[p,g]}function lN({defaultProp:n,onChange:a}){const[r,l]=w.useState(n),c=w.useRef(r),d=w.useRef(a);return rN(()=>{d.current=a},[a]),w.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function oN(n){return typeof n=="function"}var uv=my();const cN=Fd(uv);function uN(n){const a=dN(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(hN);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}function dN(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=pN(c),m=mN(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Bo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var fN=Symbol("radix.slottable");function hN(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===fN}function mN(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function pN(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var gN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wa=gN.reduce((n,a)=>{const r=uN(`Primitive.${a}`),l=w.forwardRef((c,d)=>{const{asChild:h,...m}=c,p=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...n,[a]:l}},{});function yN(n,a){n&&uv.flushSync(()=>n.dispatchEvent(a))}function Hi(n){const a=w.useRef(n);return w.useEffect(()=>{a.current=n}),w.useMemo(()=>(...r)=>a.current?.(...r),[])}function vN(n,a=globalThis?.document){const r=Hi(n);w.useEffect(()=>{const l=c=>{c.key==="Escape"&&r(c)};return a.addEventListener("keydown",l,{capture:!0}),()=>a.removeEventListener("keydown",l,{capture:!0})},[r,a])}var bN="DismissableLayer",Qd="dismissableLayer.update",xN="dismissableLayer.pointerDownOutside",wN="dismissableLayer.focusOutside",Wg,dv=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fv=w.forwardRef((n,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...p}=n,g=w.useContext(dv),[v,_]=w.useState(null),x=v?.ownerDocument??globalThis?.document,[,S]=w.useState({}),A=ls(a,P=>_(P)),j=Array.from(g.layers),[k]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),O=j.indexOf(k),q=v?j.indexOf(v):-1,B=g.layersWithOutsidePointerEventsDisabled.size>0,G=q>=O,ee=jN(P=>{const X=P.target,ue=[...g.branches].some(Je=>Je.contains(X));!G||ue||(c?.(P),h?.(P),P.defaultPrevented||m?.())},x),J=NN(P=>{const X=P.target;[...g.branches].some(Je=>Je.contains(X))||(d?.(P),h?.(P),P.defaultPrevented||m?.())},x);return vN(P=>{q===g.layers.size-1&&(l?.(P),!P.defaultPrevented&&m&&(P.preventDefault(),m()))},x),w.useEffect(()=>{if(v)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Wg=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),ey(),()=>{r&&g.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=Wg)}},[v,x,r,g]),w.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),ey())},[v,g]),w.useEffect(()=>{const P=()=>S({});return document.addEventListener(Qd,P),()=>document.removeEventListener(Qd,P)},[]),o.jsx(Wa.div,{...p,ref:A,style:{pointerEvents:B?G?"auto":"none":void 0,...n.style},onFocusCapture:On(n.onFocusCapture,J.onFocusCapture),onBlurCapture:On(n.onBlurCapture,J.onBlurCapture),onPointerDownCapture:On(n.onPointerDownCapture,ee.onPointerDownCapture)})});fv.displayName=bN;var _N="DismissableLayerBranch",SN=w.forwardRef((n,a)=>{const r=w.useContext(dv),l=w.useRef(null),c=ls(a,l);return w.useEffect(()=>{const d=l.current;if(d)return r.branches.add(d),()=>{r.branches.delete(d)}},[r.branches]),o.jsx(Wa.div,{...n,ref:c})});SN.displayName=_N;function jN(n,a=globalThis?.document){const r=Hi(n),l=w.useRef(!1),c=w.useRef(()=>{});return w.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let p=function(){hv(xN,r,g,{discrete:!0})};const g={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=p,a.addEventListener("click",c.current,{once:!0})):p()}else a.removeEventListener("click",c.current);l.current=!1},h=window.setTimeout(()=>{a.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(h),a.removeEventListener("pointerdown",d),a.removeEventListener("click",c.current)}},[a,r]),{onPointerDownCapture:()=>l.current=!0}}function NN(n,a=globalThis?.document){const r=Hi(n),l=w.useRef(!1);return w.useEffect(()=>{const c=d=>{d.target&&!l.current&&hv(wN,r,{originalEvent:d},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,r]),{onFocusCapture:()=>l.current=!0,onBlurCapture:()=>l.current=!1}}function ey(){const n=new CustomEvent(Qd);document.dispatchEvent(n)}function hv(n,a,r,{discrete:l}){const c=r.originalEvent.target,d=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:r});a&&c.addEventListener(n,a,{once:!0}),l?yN(c,d):c.dispatchEvent(d)}var Ed="focusScope.autoFocusOnMount",Td="focusScope.autoFocusOnUnmount",ty={bubbles:!1,cancelable:!0},EN="FocusScope",mv=w.forwardRef((n,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=n,[m,p]=w.useState(null),g=Hi(c),v=Hi(d),_=w.useRef(null),x=ls(a,j=>p(j)),S=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(l){let j=function(B){if(S.paused||!m)return;const G=B.target;m.contains(G)?_.current=G:An(_.current,{select:!0})},k=function(B){if(S.paused||!m)return;const G=B.relatedTarget;G!==null&&(m.contains(G)||An(_.current,{select:!0}))},O=function(B){if(document.activeElement===document.body)for(const ee of B)ee.removedNodes.length>0&&An(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",k);const q=new MutationObserver(O);return m&&q.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",k),q.disconnect()}}},[l,m,S.paused]),w.useEffect(()=>{if(m){ny.add(S);const j=document.activeElement;if(!m.contains(j)){const O=new CustomEvent(Ed,ty);m.addEventListener(Ed,g),m.dispatchEvent(O),O.defaultPrevented||(TN(RN(pv(m)),{select:!0}),document.activeElement===j&&An(m))}return()=>{m.removeEventListener(Ed,g),setTimeout(()=>{const O=new CustomEvent(Td,ty);m.addEventListener(Td,v),m.dispatchEvent(O),O.defaultPrevented||An(j??document.body,{select:!0}),m.removeEventListener(Td,v),ny.remove(S)},0)}}},[m,g,v,S]);const A=w.useCallback(j=>{if(!r&&!l||S.paused)return;const k=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,O=document.activeElement;if(k&&O){const q=j.currentTarget,[B,G]=AN(q);B&&G?!j.shiftKey&&O===G?(j.preventDefault(),r&&An(B,{select:!0})):j.shiftKey&&O===B&&(j.preventDefault(),r&&An(G,{select:!0})):O===q&&j.preventDefault()}},[r,l,S.paused]);return o.jsx(Wa.div,{tabIndex:-1,...h,ref:x,onKeyDown:A})});mv.displayName=EN;function TN(n,{select:a=!1}={}){const r=document.activeElement;for(const l of n)if(An(l,{select:a}),document.activeElement!==r)return}function AN(n){const a=pv(n),r=ay(a,n),l=ay(a.reverse(),n);return[r,l]}function pv(n){const a=[],r=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const c=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||c?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)a.push(r.currentNode);return a}function ay(n,a){for(const r of n)if(!CN(r,{upTo:a}))return r}function CN(n,{upTo:a}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(a!==void 0&&n===a)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function kN(n){return n instanceof HTMLInputElement&&"select"in n}function An(n,{select:a=!1}={}){if(n&&n.focus){const r=document.activeElement;n.focus({preventScroll:!0}),n!==r&&kN(n)&&a&&n.select()}}var ny=ON();function ON(){let n=[];return{add(a){const r=n[0];a!==r&&r?.pause(),n=sy(n,a),n.unshift(a)},remove(a){n=sy(n,a),n[0]?.resume()}}}function sy(n,a){const r=[...n],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function RN(n){return n.filter(a=>a.tagName!=="A")}var DN="Portal",gv=w.forwardRef((n,a)=>{const{container:r,...l}=n,[c,d]=w.useState(!1);$i(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?cN.createPortal(o.jsx(Wa.div,{...l,ref:a}),h):null});gv.displayName=DN;function MN(n,a){return w.useReducer((r,l)=>a[r][l]??r,n)}var Vo=n=>{const{present:a,children:r}=n,l=zN(a),c=typeof r=="function"?r({present:l.isPresent}):w.Children.only(r),d=ls(l.ref,UN(c));return typeof r=="function"||l.isPresent?w.cloneElement(c,{ref:d}):null};Vo.displayName="Presence";function zN(n){const[a,r]=w.useState(),l=w.useRef(null),c=w.useRef(n),d=w.useRef("none"),h=n?"mounted":"unmounted",[m,p]=MN(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const g=wo(l.current);d.current=m==="mounted"?g:"none"},[m]),$i(()=>{const g=l.current,v=c.current;if(v!==n){const x=d.current,S=wo(g);n?p("MOUNT"):S==="none"||g?.display==="none"?p("UNMOUNT"):p(v&&x!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,p]),$i(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,_=S=>{const j=wo(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&j&&(p("ANIMATION_END"),!c.current)){const k=a.style.animationFillMode;a.style.animationFillMode="forwards",g=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=k)})}},x=S=>{S.target===a&&(d.current=wo(l.current))};return a.addEventListener("animationstart",x),a.addEventListener("animationcancel",_),a.addEventListener("animationend",_),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",x),a.removeEventListener("animationcancel",_),a.removeEventListener("animationend",_)}}else p("ANIMATION_END")},[a,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:w.useCallback(g=>{l.current=g?getComputedStyle(g):null,r(g)},[])}}function wo(n){return n?.animationName||"none"}function UN(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var Ad=0;function LN(){w.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??ry()),document.body.insertAdjacentElement("beforeend",n[1]??ry()),Ad++,()=>{Ad===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Ad--}},[])}function ry(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var Ao="right-scroll-bar-position",Co="width-before-scroll-bar",BN="with-scroll-bars-hidden",qN="--removed-body-scroll-bar-size";function Cd(n,a){return typeof n=="function"?n(a):n&&(n.current=a),n}function $N(n,a){var r=w.useState(function(){return{value:n,callback:a,facade:{get current(){return r.value},set current(l){var c=r.value;c!==l&&(r.value=l,r.callback(l,c))}}}})[0];return r.callback=a,r.facade}var HN=typeof window<"u"?w.useLayoutEffect:w.useEffect,iy=new WeakMap;function VN(n,a){var r=$N(null,function(l){return n.forEach(function(c){return Cd(c,l)})});return HN(function(){var l=iy.get(r);if(l){var c=new Set(l),d=new Set(n),h=r.current;c.forEach(function(m){d.has(m)||Cd(m,null)}),d.forEach(function(m){c.has(m)||Cd(m,h)})}iy.set(r,n)},[n]),r}function IN(n){return n}function GN(n,a){a===void 0&&(a=IN);var r=[],l=!1,c={read:function(){if(l)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:n},useMedium:function(d){var h=a(d,l);return r.push(h),function(){r=r.filter(function(m){return m!==h})}},assignSyncMedium:function(d){for(l=!0;r.length;){var h=r;r=[],h.forEach(d)}r={push:function(m){return d(m)},filter:function(){return r}}},assignMedium:function(d){l=!0;var h=[];if(r.length){var m=r;r=[],m.forEach(d),h=r}var p=function(){var v=h;h=[],v.forEach(d)},g=function(){return Promise.resolve().then(p)};g(),r={push:function(v){h.push(v),g()},filter:function(v){return h=h.filter(v),r}}}};return c}function PN(n){n===void 0&&(n={});var a=GN(null);return a.options=wa({async:!0,ssr:!1},n),a}var yv=function(n){var a=n.sideCar,r=Ar(n,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var l=a.read();if(!l)throw new Error("Sidecar medium not found");return w.createElement(l,wa({},r))};yv.isSideCarExport=!0;function KN(n,a){return n.useMedium(a),yv}var vv=PN(),kd=function(){},Io=w.forwardRef(function(n,a){var r=w.useRef(null),l=w.useState({onScrollCapture:kd,onWheelCapture:kd,onTouchMoveCapture:kd}),c=l[0],d=l[1],h=n.forwardProps,m=n.children,p=n.className,g=n.removeScrollBar,v=n.enabled,_=n.shards,x=n.sideCar,S=n.noRelative,A=n.noIsolation,j=n.inert,k=n.allowPinchZoom,O=n.as,q=O===void 0?"div":O,B=n.gapMode,G=Ar(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),ee=x,J=VN([r,a]),P=wa(wa({},G),c);return w.createElement(w.Fragment,null,v&&w.createElement(ee,{sideCar:vv,removeScrollBar:g,shards:_,noRelative:S,noIsolation:A,inert:j,setCallbacks:d,allowPinchZoom:!!k,lockRef:r,gapMode:B}),h?w.cloneElement(w.Children.only(m),wa(wa({},P),{ref:J})):w.createElement(q,wa({},P,{className:p,ref:J}),m))});Io.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Io.classNames={fullWidth:Co,zeroRight:Ao};var YN=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JN(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var a=YN();return a&&n.setAttribute("nonce",a),n}function XN(n,a){n.styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a))}function QN(n){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(n)}var ZN=function(){var n=0,a=null;return{add:function(r){n==0&&(a=JN())&&(XN(a,r),QN(a)),n++},remove:function(){n--,!n&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},FN=function(){var n=ZN();return function(a,r){w.useEffect(function(){return n.add(a),function(){n.remove()}},[a&&r])}},bv=function(){var n=FN(),a=function(r){var l=r.styles,c=r.dynamic;return n(l,c),null};return a},WN={left:0,top:0,right:0,gap:0},Od=function(n){return parseInt(n||"",10)||0},eE=function(n){var a=window.getComputedStyle(document.body),r=a[n==="padding"?"paddingLeft":"marginLeft"],l=a[n==="padding"?"paddingTop":"marginTop"],c=a[n==="padding"?"paddingRight":"marginRight"];return[Od(r),Od(l),Od(c)]},tE=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return WN;var a=eE(n),r=document.documentElement.clientWidth,l=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,l-r+a[2]-a[0])}},aE=bv(),xr="data-scroll-locked",nE=function(n,a,r,l){var c=n.left,d=n.top,h=n.right,m=n.gap;return r===void 0&&(r="margin"),`
|
|
52
|
+
.`.concat(BN,` {
|
|
53
|
+
overflow: hidden `).concat(l,`;
|
|
54
|
+
padding-right: `).concat(m,"px ").concat(l,`;
|
|
55
|
+
}
|
|
56
|
+
body[`).concat(xr,`] {
|
|
57
|
+
overflow: hidden `).concat(l,`;
|
|
58
|
+
overscroll-behavior: contain;
|
|
59
|
+
`).concat([a&&"position: relative ".concat(l,";"),r==="margin"&&`
|
|
60
|
+
padding-left: `.concat(c,`px;
|
|
61
|
+
padding-top: `).concat(d,`px;
|
|
62
|
+
padding-right: `).concat(h,`px;
|
|
63
|
+
margin-left:0;
|
|
64
|
+
margin-top:0;
|
|
65
|
+
margin-right: `).concat(m,"px ").concat(l,`;
|
|
66
|
+
`),r==="padding"&&"padding-right: ".concat(m,"px ").concat(l,";")].filter(Boolean).join(""),`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.`).concat(Ao,` {
|
|
70
|
+
right: `).concat(m,"px ").concat(l,`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.`).concat(Co,` {
|
|
74
|
+
margin-right: `).concat(m,"px ").concat(l,`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.`).concat(Ao," .").concat(Ao,` {
|
|
78
|
+
right: 0 `).concat(l,`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.`).concat(Co," .").concat(Co,` {
|
|
82
|
+
margin-right: 0 `).concat(l,`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
body[`).concat(xr,`] {
|
|
86
|
+
`).concat(qN,": ").concat(m,`px;
|
|
87
|
+
}
|
|
88
|
+
`)},ly=function(){var n=parseInt(document.body.getAttribute(xr)||"0",10);return isFinite(n)?n:0},sE=function(){w.useEffect(function(){return document.body.setAttribute(xr,(ly()+1).toString()),function(){var n=ly()-1;n<=0?document.body.removeAttribute(xr):document.body.setAttribute(xr,n.toString())}},[])},rE=function(n){var a=n.noRelative,r=n.noImportant,l=n.gapMode,c=l===void 0?"margin":l;sE();var d=w.useMemo(function(){return tE(c)},[c]);return w.createElement(aE,{styles:nE(d,!a,c,r?"":"!important")})},Zd=!1;if(typeof window<"u")try{var _o=Object.defineProperty({},"passive",{get:function(){return Zd=!0,!0}});window.addEventListener("test",_o,_o),window.removeEventListener("test",_o,_o)}catch{Zd=!1}var cr=Zd?{passive:!1}:!1,iE=function(n){return n.tagName==="TEXTAREA"},xv=function(n,a){if(!(n instanceof Element))return!1;var r=window.getComputedStyle(n);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!iE(n)&&r[a]==="visible")},lE=function(n){return xv(n,"overflowY")},oE=function(n){return xv(n,"overflowX")},oy=function(n,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=wv(n,l);if(c){var d=_v(n,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},cE=function(n){var a=n.scrollTop,r=n.scrollHeight,l=n.clientHeight;return[a,r,l]},uE=function(n){var a=n.scrollLeft,r=n.scrollWidth,l=n.clientWidth;return[a,r,l]},wv=function(n,a){return n==="v"?lE(a):oE(a)},_v=function(n,a){return n==="v"?cE(a):uE(a)},dE=function(n,a){return n==="h"&&a==="rtl"?-1:1},fE=function(n,a,r,l,c){var d=dE(n,window.getComputedStyle(a).direction),h=d*l,m=r.target,p=a.contains(m),g=!1,v=h>0,_=0,x=0;do{if(!m)break;var S=_v(n,m),A=S[0],j=S[1],k=S[2],O=j-k-d*A;(A||O)&&wv(n,m)&&(_+=O,x+=A);var q=m.parentNode;m=q&&q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?q.host:q}while(!p&&m!==document.body||p&&(a.contains(m)||a===m));return(v&&Math.abs(_)<1||!v&&Math.abs(x)<1)&&(g=!0),g},So=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},cy=function(n){return[n.deltaX,n.deltaY]},uy=function(n){return n&&"current"in n?n.current:n},hE=function(n,a){return n[0]===a[0]&&n[1]===a[1]},mE=function(n){return`
|
|
89
|
+
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
|
90
|
+
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
|
91
|
+
`)},pE=0,ur=[];function gE(n){var a=w.useRef([]),r=w.useRef([0,0]),l=w.useRef(),c=w.useState(pE++)[0],d=w.useState(bv)[0],h=w.useRef(n);w.useEffect(function(){h.current=n},[n]),w.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(c));var j=n1([n.lockRef.current],(n.shards||[]).map(uy),!0).filter(Boolean);return j.forEach(function(k){return k.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var m=w.useCallback(function(j,k){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!h.current.allowPinchZoom;var O=So(j),q=r.current,B="deltaX"in j?j.deltaX:q[0]-O[0],G="deltaY"in j?j.deltaY:q[1]-O[1],ee,J=j.target,P=Math.abs(B)>Math.abs(G)?"h":"v";if("touches"in j&&P==="h"&&J.type==="range")return!1;var X=window.getSelection(),ue=X&&X.anchorNode,Je=ue?ue===J||ue.contains(J):!1;if(Je)return!1;var be=oy(P,J);if(!be)return!0;if(be?ee=P:(ee=P==="v"?"h":"v",be=oy(P,J)),!be)return!1;if(!l.current&&"changedTouches"in j&&(B||G)&&(l.current=ee),!ee)return!0;var ge=l.current||ee;return fE(ge,k,j,ge==="h"?B:G)},[]),p=w.useCallback(function(j){var k=j;if(!(!ur.length||ur[ur.length-1]!==d)){var O="deltaY"in k?cy(k):So(k),q=a.current.filter(function(ee){return ee.name===k.type&&(ee.target===k.target||k.target===ee.shadowParent)&&hE(ee.delta,O)})[0];if(q&&q.should){k.cancelable&&k.preventDefault();return}if(!q){var B=(h.current.shards||[]).map(uy).filter(Boolean).filter(function(ee){return ee.contains(k.target)}),G=B.length>0?m(k,B[0]):!h.current.noIsolation;G&&k.cancelable&&k.preventDefault()}}},[]),g=w.useCallback(function(j,k,O,q){var B={name:j,delta:k,target:O,should:q,shadowParent:yE(O)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(G){return G!==B})},1)},[]),v=w.useCallback(function(j){r.current=So(j),l.current=void 0},[]),_=w.useCallback(function(j){g(j.type,cy(j),j.target,m(j,n.lockRef.current))},[]),x=w.useCallback(function(j){g(j.type,So(j),j.target,m(j,n.lockRef.current))},[]);w.useEffect(function(){return ur.push(d),n.setCallbacks({onScrollCapture:_,onWheelCapture:_,onTouchMoveCapture:x}),document.addEventListener("wheel",p,cr),document.addEventListener("touchmove",p,cr),document.addEventListener("touchstart",v,cr),function(){ur=ur.filter(function(j){return j!==d}),document.removeEventListener("wheel",p,cr),document.removeEventListener("touchmove",p,cr),document.removeEventListener("touchstart",v,cr)}},[]);var S=n.removeScrollBar,A=n.inert;return w.createElement(w.Fragment,null,A?w.createElement(d,{styles:mE(c)}):null,S?w.createElement(rE,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function yE(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const vE=KN(vv,gE);var Sv=w.forwardRef(function(n,a){return w.createElement(Io,wa({},n,{ref:a,sideCar:vE}))});Sv.classNames=Io.classNames;var bE=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},dr=new WeakMap,jo=new WeakMap,No={},Rd=0,jv=function(n){return n&&(n.host||jv(n.parentNode))},xE=function(n,a){return a.map(function(r){if(n.contains(r))return r;var l=jv(r);return l&&n.contains(l)?l:(console.error("aria-hidden",r,"in not contained inside",n,". Doing nothing"),null)}).filter(function(r){return!!r})},wE=function(n,a,r,l){var c=xE(a,Array.isArray(n)?n:[n]);No[r]||(No[r]=new WeakMap);var d=No[r],h=[],m=new Set,p=new Set(c),g=function(_){!_||m.has(_)||(m.add(_),g(_.parentNode))};c.forEach(g);var v=function(_){!_||p.has(_)||Array.prototype.forEach.call(_.children,function(x){if(m.has(x))v(x);else try{var S=x.getAttribute(l),A=S!==null&&S!=="false",j=(dr.get(x)||0)+1,k=(d.get(x)||0)+1;dr.set(x,j),d.set(x,k),h.push(x),j===1&&A&&jo.set(x,!0),k===1&&x.setAttribute(r,"true"),A||x.setAttribute(l,"true")}catch(O){console.error("aria-hidden: cannot operate on ",x,O)}})};return v(a),m.clear(),Rd++,function(){h.forEach(function(_){var x=dr.get(_)-1,S=d.get(_)-1;dr.set(_,x),d.set(_,S),x||(jo.has(_)||_.removeAttribute(l),jo.delete(_)),S||_.removeAttribute(r)}),Rd--,Rd||(dr=new WeakMap,dr=new WeakMap,jo=new WeakMap,No={})}},_E=function(n,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(n)?n:[n]),c=bE(n);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),wE(l,c,r,"aria-hidden")):function(){return null}};function SE(n){const a=jE(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(EE);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}function jE(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=AE(c),m=TE(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Bo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var NE=Symbol("radix.slottable");function EE(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===NE}function TE(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function AE(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var Go="Dialog",[Nv]=tN(Go),[CE,ma]=Nv(Go),Ev=n=>{const{__scopeDialog:a,children:r,open:l,defaultOpen:c,onOpenChange:d,modal:h=!0}=n,m=w.useRef(null),p=w.useRef(null),[g,v]=iN({prop:l,defaultProp:c??!1,onChange:d,caller:Go});return o.jsx(CE,{scope:a,triggerRef:m,contentRef:p,contentId:Nd(),titleId:Nd(),descriptionId:Nd(),open:g,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(_=>!_),[v]),modal:h,children:r})};Ev.displayName=Go;var Tv="DialogTrigger",kE=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Tv,r),d=ls(a,c.triggerRef);return o.jsx(Wa.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":hf(c.open),...l,ref:d,onClick:On(n.onClick,c.onOpenToggle)})});kE.displayName=Tv;var df="DialogPortal",[OE,Av]=Nv(df,{forceMount:void 0}),Cv=n=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=n,d=ma(df,a);return o.jsx(OE,{scope:a,forceMount:r,children:w.Children.map(l,h=>o.jsx(Vo,{present:r||d.open,children:o.jsx(gv,{asChild:!0,container:c,children:h})}))})};Cv.displayName=df;var Lo="DialogOverlay",kv=w.forwardRef((n,a)=>{const r=Av(Lo,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=ma(Lo,n.__scopeDialog);return d.modal?o.jsx(Vo,{present:l||d.open,children:o.jsx(DE,{...c,ref:a})}):null});kv.displayName=Lo;var RE=SE("DialogOverlay.RemoveScroll"),DE=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Lo,r);return o.jsx(Sv,{as:RE,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(Wa.div,{"data-state":hf(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),is="DialogContent",Ov=w.forwardRef((n,a)=>{const r=Av(is,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=ma(is,n.__scopeDialog);return o.jsx(Vo,{present:l||d.open,children:d.modal?o.jsx(ME,{...c,ref:a}):o.jsx(zE,{...c,ref:a})})});Ov.displayName=is;var ME=w.forwardRef((n,a)=>{const r=ma(is,n.__scopeDialog),l=w.useRef(null),c=ls(a,r.contentRef,l);return w.useEffect(()=>{const d=l.current;if(d)return _E(d)},[]),o.jsx(Rv,{...n,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:On(n.onCloseAutoFocus,d=>{d.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:On(n.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:On(n.onFocusOutside,d=>d.preventDefault())})}),zE=w.forwardRef((n,a)=>{const r=ma(is,n.__scopeDialog),l=w.useRef(!1),c=w.useRef(!1);return o.jsx(Rv,{...n,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{n.onCloseAutoFocus?.(d),d.defaultPrevented||(l.current||r.triggerRef.current?.focus(),d.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:d=>{n.onInteractOutside?.(d),d.defaultPrevented||(l.current=!0,d.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const h=d.target;r.triggerRef.current?.contains(h)&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&c.current&&d.preventDefault()}})}),Rv=w.forwardRef((n,a)=>{const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,...h}=n,m=ma(is,r),p=w.useRef(null),g=ls(a,p);return LN(),o.jsxs(o.Fragment,{children:[o.jsx(mv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(fv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":hf(m.open),...h,ref:g,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(UE,{titleId:m.titleId}),o.jsx(BE,{contentRef:p,descriptionId:m.descriptionId})]})]})}),ff="DialogTitle",Dv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(ff,r);return o.jsx(Wa.h2,{id:c.titleId,...l,ref:a})});Dv.displayName=ff;var Mv="DialogDescription",zv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Mv,r);return o.jsx(Wa.p,{id:c.descriptionId,...l,ref:a})});zv.displayName=Mv;var Uv="DialogClose",Lv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Uv,r);return o.jsx(Wa.button,{type:"button",...l,ref:a,onClick:On(n.onClick,()=>c.onOpenChange(!1))})});Lv.displayName=Uv;function hf(n){return n?"open":"closed"}var Bv="DialogTitleWarning",[C2,qv]=eN(Bv,{contentName:is,titleName:ff,docsSlug:"dialog"}),UE=({titleId:n})=>{const a=qv(Bv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
|
|
92
|
+
|
|
93
|
+
If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
94
|
+
|
|
95
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return w.useEffect(()=>{n&&(document.getElementById(n)||console.error(r))},[r,n]),null},LE="DialogDescriptionWarning",BE=({contentRef:n,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qv(LE).contentName}}.`;return w.useEffect(()=>{const c=n.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,n,a]),null},qE=Ev,$E=Cv,HE=kv,VE=Ov,IE=Dv,GE=zv,PE=Lv;function ss({...n}){return o.jsx(qE,{"data-slot":"dialog",...n})}function KE({...n}){return o.jsx($E,{"data-slot":"dialog-portal",...n})}function YE({className:n,...a}){return o.jsx(HE,{"data-slot":"dialog-overlay",className:Ce("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),...a})}function rs({className:n,children:a,...r}){return o.jsxs(KE,{"data-slot":"dialog-portal",children:[o.jsx(YE,{}),o.jsxs(VE,{"data-slot":"dialog-content",className:Ce("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",n),...r,children:[a,o.jsxs(PE,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(Gi,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Na({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:Ce("flex flex-col gap-2 text-center sm:text-left",n),...a})}function pr({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:Ce("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...a})}function Ea({className:n,...a}){return o.jsx(IE,{"data-slot":"dialog-title",className:Ce("text-lg leading-none font-semibold",n),...a})}function Ta({className:n,...a}){return o.jsx(GE,{"data-slot":"dialog-description",className:Ce("text-muted-foreground text-sm",n),...a})}const Ee=w.forwardRef(({className:n,type:a,...r},l)=>o.jsx("input",{type:a,className:Ce("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:l,...r}));Ee.displayName="Input";var JE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],XE=JE.reduce((n,a)=>{const r=wy(`Primitive.${a}`),l=w.forwardRef((c,d)=>{const{asChild:h,...m}=c,p=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...n,[a]:l}},{}),QE="Label",$v=w.forwardRef((n,a)=>o.jsx(XE.label,{...n,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(n.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));$v.displayName=QE;var ZE=$v;function ha({className:n,...a}){return o.jsx(ZE,{"data-slot":"label",className:Ce("flex items-center gap-2 text-sm leading-none font-medium select-none text-muted-foreground group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...a})}const FE=jy("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Vi({className:n,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:Ce(FE({variant:a}),n),...r})}function Ii({className:n,...a}){return o.jsx("div",{"data-slot":"alert-description",className:Ce("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",n),...a})}function mf({className:n}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Ce("w-9 h-9",n),children:[o.jsx("path",{d:"M112 112H400C426.51 112 448 133.49 448 160V352C448 378.51 426.51 400 400 400H112C85.4903 400 64 378.51 64 352V160C64 133.49 85.4903 112 112 112Z",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M64 160 L200 270",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M448 160 L312 270",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M256 128 C256 128 276 170 306 178 C276 186 256 228 256 228 C256 228 236 186 206 178 C236 170 256 128 256 128 Z",fill:"#9333ea",children:o.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0 0; 0 -10; 0 0",dur:"3s",repeatCount:"indefinite"})})]})}function dy(n){const a=n.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function WE(n){const a=n.trim();if(!a)return{valid:!1};if(a.startsWith("http://")||a.startsWith("https://"))try{return new URL(a).hostname.endsWith(".supabase.co")?{valid:!0,message:"Valid Supabase URL"}:{valid:!1,message:"URL must be a supabase.co domain"}}catch{return{valid:!1,message:"Invalid URL format"}}return/^[a-z0-9]+$/.test(a)?{valid:!0,message:"Project ID detected"}:{valid:!1,message:"Enter a URL or Project ID"}}function e2(n){const a=n.trim();return a?a.startsWith("sb_publishable_")?a.length>25?{valid:!0,message:"Valid Publishable Key"}:{valid:!1,message:"Incomplete Publishable Key"}:a.startsWith("eyJ")?a.length>50?{valid:!0,message:"Valid Anon Key"}:{valid:!1,message:"Incomplete Anon Key"}:{valid:!1,message:"Invalid API Key format"}:{valid:!1}}function Hv({onComplete:n,open:a=!0,canClose:r=!1}){const[l,c]=w.useState("welcome"),[d,h]=w.useState(""),[m,p]=w.useState(""),[g,v]=w.useState(null),[_,x]=w.useState(!1),[S,A]=w.useState(!1),j=async()=>{v(null),c("validating");const G=dy(d),ee=m.trim(),J=await tv(G,ee);J.valid?(Mj({url:G,anonKey:ee}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(v(J.error||"Connection failed. Please check your credentials."),c("credentials"))},k=d?WE(d):{valid:!1},O=m?e2(m):{valid:!1},q=d?dy(d):"",B=d&&!d.startsWith("http")&&k.valid;return o.jsx(ss,{open:a,onOpenChange:G=>{!G&&r&&n()},children:o.jsxs(rs,{className:"sm:max-w-md",onPointerDownOutside:G=>{r||G.preventDefault()},onEscapeKeyDown:G=>{r||G.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(Na,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(mf,{className:"w-9 h-9"}),o.jsx(Ea,{children:"Welcome to Email Automator"})]}),o.jsx(Ta,{children:"This application requires a Supabase database to store your emails and automation rules."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx(Vi,{children:o.jsxs(Ii,{children:[o.jsx("strong",{children:"No Supabase Setup Detected"}),o.jsx("br",{}),"You can create a free project at"," ",o.jsxs("a",{href:"https://supabase.com",target:"_blank",rel:"noopener noreferrer",className:"underline text-primary inline-flex items-center gap-1",children:["supabase.com",o.jsx(Ri,{className:"h-3 w-3"})]})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"You will need:"}),o.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground space-y-1",children:[o.jsx("li",{children:"Project URL"}),o.jsx("li",{children:"Anon Public Key"})]})]}),o.jsxs("div",{className:"flex gap-2",children:[r&&o.jsx(W,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(W,{onClick:()=>c("credentials"),className:"flex-1",children:"Continue Setup"})]})]})]}),l==="credentials"&&o.jsxs(o.Fragment,{children:[o.jsxs(Na,{children:[o.jsx(Ea,{children:"Connect to Supabase"}),o.jsx(Ta,{children:"Enter your connection details below."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[g&&o.jsxs(Vi,{variant:"destructive",children:[o.jsx(Nr,{className:"h-4 w-4"}),o.jsx(Ii,{children:g})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"supabase-url",children:"Project URL or ID"}),o.jsxs("div",{className:"relative",children:[o.jsx(Ee,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:G=>{h(G.target.value),x(!0)},onBlur:()=>x(!0),className:_&&d?k.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),_&&d&&k.valid&&o.jsx(Qa,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),B&&o.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-green-600 dark:text-green-400",children:[o.jsx(Qa,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),o.jsxs("span",{children:["Will use: ",q]})]}),_&&d&&k.message&&!k.valid&&o.jsx("p",{className:"text-xs text-destructive",children:k.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"anon-key",children:"Anon Public Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Ee,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:G=>{p(G.target.value),A(!0)},onBlur:()=>A(!0),className:S&&m?O.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),S&&m&&O.valid&&o.jsx(Qa,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),S&&m&&O.message&&o.jsx("p",{className:`text-xs ${O.valid?"text-green-600 dark:text-green-400":"text-destructive"}`,children:O.message})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(W,{variant:"outline",onClick:()=>c("welcome"),className:"flex-1",children:"Back"}),r&&o.jsx(W,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(W,{onClick:j,disabled:!k.valid||!O.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(Na,{children:[o.jsx(Ea,{children:"Validating Connection"}),o.jsx(Ta,{children:"Verifying your credentials with Supabase..."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(qt,{className:"h-12 w-12 animate-spin text-primary mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Please wait..."})]})]}),l==="success"&&o.jsxs(o.Fragment,{children:[o.jsxs(Na,{children:[o.jsx(Ea,{children:"Success!"}),o.jsx(Ta,{children:"Your database is connected."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(tf,{className:"h-12 w-12 text-green-500 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restarting application..."})]})]})]})})}function t2({email:n,isOpen:a,onOpenChange:r}){const[l,c]=w.useState([]),[d,h]=w.useState(!1);w.useEffect(()=>{a&&n&&m()},[a,n]);const m=async()=>{if(n){h(!0);try{const g=await Ve.getEmailEvents(n.id);g.data&&c(g.data.events)}catch(g){console.error("Failed to fetch trace:",g)}finally{h(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx(ki,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Oo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Nr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(_r,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(ss,{open:a,onOpenChange:r,children:o.jsxs(rs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Na,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(nf,{className:"w-5 h-5 text-primary"}),o.jsx(Ea,{children:"AI Processing Trace"})]}),o.jsx(Ta,{children:"Step-by-step log of how the AI analyzed and acted on this email."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:d?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(ht,{})}):l.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:"No granular trace events found for this email."}):l.map((g,v)=>o.jsxs("div",{className:"relative pl-8",children:[v!==l.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:p(g.event_type)}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground/70",children:g.agent_state}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(wr,{className:"w-3 h-3"}),new Date(g.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[g.event_type==="info"&&o.jsx("p",{className:"text-sm text-foreground/90",children:g.details?.message}),g.event_type==="analysis"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Category:"}),o.jsx("span",{className:"font-bold uppercase",children:g.details?.category||"Analyzing..."})]}),o.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Sentiment:"}),o.jsx("span",{className:"font-bold uppercase",children:g.details?.sentiment||"Analyzing..."})]})]}),g.details?.system_prompt&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(gr,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details?.system_prompt})]}),g.details?._raw_response&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(gr,{className:"w-3 h-3"})," Raw LLM Response"]}),o.jsx("pre",{className:"text-[10px] bg-emerald-500/5 p-2 rounded border border-emerald-500/10 overflow-x-auto font-mono",children:JSON.stringify(JSON.parse(g.details._raw_response),null,2)})]})]}),g.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:["Executed: ",g.details?.action]}),o.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',g.details?.reason,'"']})]}),o.jsx(af,{className:"w-5 h-5 text-emerald-500"})]}),g.event_type==="error"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:typeof g.details?.error=="object"?g.details.error.message||JSON.stringify(g.details.error):g.details?.error}),g.details?.raw_response&&o.jsx("pre",{className:"text-[10px] bg-red-500/5 p-2 rounded border border-red-500/10 overflow-x-auto whitespace-pre-wrap font-mono",children:typeof g.details.raw_response=="object"?JSON.stringify(g.details.raw_response,null,2):g.details.raw_response})]})]})]})]},g.id))})]})})}const a2={spam:"bg-destructive/10 text-destructive",newsletter:"bg-blue-500/10 text-blue-600 dark:text-blue-400",support:"bg-orange-500/10 text-orange-600 dark:text-orange-400",client:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",internal:"bg-purple-500/10 text-purple-600 dark:text-purple-400",personal:"bg-pink-500/10 text-pink-600 dark:text-pink-400",other:"bg-gray-500/10 text-gray-600 dark:text-gray-400"};function n2(){const{state:n,actions:a,dispatch:r}=kr(),{openTerminal:l}=ov(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState(""),[v,_]=w.useState(null),[x,S]=w.useState(null),[A,j]=w.useState({}),[k,O]=w.useState(null),[q,B]=w.useState(!1),[G,ee]=w.useState(null);w.useEffect(()=>{n.isAuthenticated?(J(),a.fetchStats()):d(!1)},[v,n.isAuthenticated]);const J=async(Z=0)=>{d(!0),await a.fetchEmails({category:v||void 0,search:p||void 0,offset:Z,sortBy:n.sortBy,sortOrder:n.sortOrder}),d(!1)},P=Z=>{a.fetchEmails({category:v||void 0,search:p||void 0,offset:0,sortBy:Z,sortOrder:n.sortOrder})},X=()=>{a.fetchEmails({category:v||void 0,search:p||void 0,offset:0,sortBy:n.sortBy,sortOrder:n.sortOrder==="asc"?"desc":"asc"})},ue=async()=>{if(n.accounts.length===0){re.warning("Please connect an email account first");return}l(),m(!0);const Z=await a.triggerSync();m(!1),Z?(br.playSuccess(),re.success("Sync completed! Check your emails.")):re.error("Sync failed. Check account status for details.")},Je=async(Z,z)=>{if(z==="delete"&&k!==Z.id){O(Z.id);return}O(null),j(K=>({...K,[Z.id]:z}));const Q=await a.executeAction(Z.id,z);j(K=>{const Se={...K};return delete Se[Z.id],Se}),Q&&(re.success(`Email ${z==="delete"?"deleted":z==="archive"?"archived":"updated"}`),z==="delete"&&J(n.emailsOffset))},be=()=>{O(null)},ge=Z=>{Z.preventDefault(),J()},Ze=Z=>{const z=Z==="next"?n.emailsOffset+20:Math.max(0,n.emailsOffset-20);J(z)},nt=Z=>{ee(Z),B(!0)};return o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 animate-in fade-in duration-500",children:[o.jsxs("section",{className:"lg:col-span-2 space-y-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-4",children:[o.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[o.jsx(Dd,{className:"w-5 h-5 text-primary"}),"Recent Analysis"]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(W,{onClick:ue,size:"sm",variant:"outline",className:"shadow-sm",disabled:h,children:[o.jsx(Sr,{className:Ce("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),h?"Syncing...":"Sync Now"]}),o.jsxs("span",{className:"text-xs font-medium text-muted-foreground bg-secondary px-2 py-1 rounded-md border border-border flex items-center",children:[n.emailsTotal," emails"]})]})]}),h&&o.jsxs("div",{className:"bg-primary/5 border border-primary/20 p-4 rounded-lg flex items-center justify-between animate-in fade-in slide-in-from-top-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o.jsx(qt,{className:"w-5 h-5 text-primary animate-spin"})}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-sm",children:"Sync in progress..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Fetching and analyzing emails. New emails will appear below automatically."})]})]}),o.jsxs(W,{variant:"outline",size:"sm",onClick:l,className:"h-8 text-xs",children:[o.jsx(nf,{className:"w-3.5 h-3.5 mr-2"}),"View Logs"]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[o.jsxs("form",{onSubmit:ge,className:"flex-1 flex gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Ow,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Ee,{placeholder:"Search emails...",value:p,onChange:Z=>g(Z.target.value),className:"pl-9"})]}),o.jsx(W,{type:"submit",size:"sm",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-7",value:n.sortBy,onChange:Z=>P(Z.target.value),children:[o.jsx("option",{value:"date",children:"Received Time"}),o.jsx("option",{value:"created_at",children:"Processed Time"})]}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:X,title:n.sortOrder==="asc"?"Oldest First":"Newest First",children:o.jsx(jx,{className:Ce("w-3.5 h-3.5",n.sortOrder==="asc"&&"rotate-180")})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(W,{size:"sm",variant:v===null?"secondary":"ghost",onClick:()=>_(null),children:"All"}),["spam","client","newsletter","support"].map(Z=>o.jsx(W,{size:"sm",variant:v===Z?"secondary":"ghost",onClick:()=>_(Z),className:"capitalize",children:Z},Z))]}),c?o.jsx(Wj,{}):n.emails.length===0?o.jsxs(Et,{className:"p-20 text-center shadow-sm",children:[o.jsx("div",{className:"w-16 h-16 bg-primary/10 text-primary rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(Dd,{className:"w-8 h-8"})}),o.jsx("h3",{className:"text-lg font-medium",children:"No emails found"}),o.jsx("p",{className:"text-muted-foreground mt-2 mb-6",children:n.accounts.length===0?"Connect your email account to get started.":"Try syncing or adjusting your filters."}),n.accounts.length>0&&o.jsxs(W,{onClick:()=>{l(),ue()},disabled:h,children:[o.jsx(Sr,{className:Ce("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[n.emails.map(Z=>o.jsx(r2,{email:Z,onAction:Je,onViewTrace:nt,onSelect:()=>S(Z),isSelected:x?.id===Z.id,loadingAction:A[Z.id],isDeletePending:k===Z.id,onCancelDelete:be},Z.id)),o.jsx(t2,{isOpen:q,onOpenChange:B,email:G}),n.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(W,{variant:"outline",size:"sm",onClick:()=>Ze("prev"),disabled:n.emailsOffset===0,children:[o.jsx(zx,{className:"w-4 h-4 mr-1"}),"Previous"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[n.emailsOffset+1," - ",Math.min(n.emailsOffset+20,n.emailsTotal)," of ",n.emailsTotal]}),o.jsxs(W,{variant:"outline",size:"sm",onClick:()=>Ze("next"),disabled:n.emailsOffset+20>=n.emailsTotal,children:["Next",o.jsx(Lx,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[x&&o.jsxs(Et,{className:"p-6 border-primary/20 bg-primary/5 animate-in slide-in-from-right-5",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"font-semibold",children:"Email Details"}),o.jsx(W,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>S(null),children:o.jsx(Gi,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"From:"}),o.jsx("p",{className:"font-medium truncate",children:x.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),o.jsx("p",{className:"font-medium",children:x.subject})]}),x.ai_analysis&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Summary:"}),o.jsx("p",{className:"text-xs mt-1",children:x.ai_analysis.summary})]}),x.ai_analysis.key_points&&o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Key Points:"}),o.jsx("ul",{className:"text-xs mt-1 list-disc list-inside",children:x.ai_analysis.key_points.map((Z,z)=>o.jsx("li",{children:Z},z))})]}),x.ai_analysis.draft_response&&o.jsxs("div",{className:"mt-4 p-3 bg-emerald-500/5 border border-emerald-500/20 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2 text-emerald-600 dark:text-emerald-400",children:[o.jsx(Dw,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"text-xs font-bold uppercase",children:"AI Draft Reply"})]}),o.jsx("p",{className:"text-xs leading-relaxed whitespace-pre-wrap italic text-foreground/80",children:x.ai_analysis.draft_response}),o.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:["* This draft is already saved in your ",x.email_accounts?.provider==="gmail"?"Gmail":"Outlook"," Drafts folder."]})]})]})]})]}),o.jsx(s2,{accounts:n.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:n.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(Et,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(yy,{className:"w-4 h-4 text-primary"}),"Sync History"]}),o.jsx("div",{className:"space-y-4",children:!n.stats?.recentSyncs||n.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No sync history available."}):n.stats.recentSyncs.slice(0,5).map(Z=>o.jsxs("div",{className:"flex justify-between items-start text-sm border-b last:border-0 pb-3 last:pb-0",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Ce("w-1.5 h-1.5 rounded-full",Z.status==="success"?"bg-emerald-500":Z.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(Z.started_at).toLocaleDateString()," ",new Date(Z.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),o.jsxs("p",{className:"text-[10px] text-muted-foreground pl-3.5",children:["Processed: ",o.jsx("span",{className:"font-medium text-foreground",children:Z.emails_processed})," • Actioned: ",o.jsx("span",{className:"font-medium text-foreground",children:Z.emails_deleted+Z.emails_drafted})]}),Z.error_message&&o.jsx("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:Z.error_message,children:Z.error_message})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:Z.status==="running"?"Running":Z.completed_at?`${Math.round((new Date(Z.completed_at).getTime()-new Date(Z.started_at).getTime())/1e3)}s`:"..."})]},Z.id))})]}),o.jsxs(Et,{className:"p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Quick Stats"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Processed"}),o.jsx("span",{className:"font-medium",children:n.emailsTotal})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Connected Accounts"}),o.jsx("span",{className:"font-medium",children:n.accounts.length})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Rules"}),o.jsx("span",{className:"font-medium",children:n.rules.filter(Z=>Z.is_enabled).length})]})]})]})]})]})}function s2({accounts:n,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){const[h,m]=w.useState(null),[p,g]=w.useState(!1),v=x=>{if(!x)return"";const S=typeof x=="string"&&/^\d+$/.test(x)?parseInt(x):x,A=new Date(S);if(isNaN(A.getTime()))return"";const j=k=>k<10?"0"+k:k;return A.getFullYear()+"-"+j(A.getMonth()+1)+"-"+j(A.getDate())+"T"+j(A.getHours())+":"+j(A.getMinutes())},_=async(x,S)=>{m(x),await a(x,S),m(null)};return n.length===0?null:o.jsxs(Et,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(Uw,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsx("div",{className:"space-y-6",children:n.map(x=>o.jsxs("div",{className:"space-y-3 pb-4 border-b last:border-0 last:pb-0",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-xs font-medium truncate max-w-[150px]",title:x.email_address,children:x.email_address}),o.jsxs("div",{className:"flex items-center gap-1",children:[x.last_sync_status==="syncing"?o.jsx(qt,{className:"w-3 h-3 text-primary animate-spin"}):x.last_sync_status==="success"?o.jsx(af,{className:"w-3 h-3 text-emerald-500"}):x.last_sync_status==="error"?o.jsx("span",{title:x.last_sync_error||"Error",children:o.jsx(Nr,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(W,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{d(),r(x.id)},disabled:x.last_sync_status==="syncing",children:o.jsx(Sr,{className:Ce("w-3 h-3",x.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-orange-500",title:"Reset Checkpoint (Force Full Re-sync from Start Date)",onClick:()=>a(x.id,{last_sync_checkpoint:null}),disabled:x.last_sync_status==="syncing",children:o.jsx(yy,{className:"w-3 h-3"})})]})]}),o.jsxs("div",{className:"grid grid-cols-[1.5fr_1fr] gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Tx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Ee,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:x.sync_start_date?v(x.sync_start_date):x.last_sync_checkpoint?v(x.last_sync_checkpoint):x.last_sync_at?v(x.last_sync_at):"",onChange:S=>_(x.id,{sync_start_date:S.target.value?new Date(S.target.value).toISOString():null}),disabled:h===x.id})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(rw,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Ee,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:x.sync_max_emails_per_run||50,onChange:S=>_(x.id,{sync_max_emails_per_run:parseInt(S.target.value,10)||50}),disabled:h===x.id})]})]}),x.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Last sync: ",new Date(x.last_sync_at).toLocaleString()]}),x.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:x.last_sync_error,children:["Error: ",x.last_sync_error]})]},x.id))})]})}function r2({email:n,onAction:a,onViewTrace:r,onSelect:l,isSelected:c,loadingAction:d,isDeletePending:h,onCancelDelete:m}){if(!n)return null;const p=a2[n.category||"other"],g=!!d,v=()=>{if(!n.email_accounts)return"#";const{provider:_,email_address:x}=n.email_accounts;return _==="gmail"?`https://mail.google.com/mail/u/${x}/#all/${n.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(n.external_id)}`};return o.jsx(Et,{className:Ce("hover:shadow-md transition-shadow group cursor-pointer",c&&"ring-2 ring-primary"),onClick:l,children:o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex justify-between items-start mb-3",children:[o.jsxs("div",{className:"flex gap-3",children:[o.jsx("div",{className:Ce("w-8 h-8 rounded-full flex items-center justify-center font-bold text-white text-xs",n.category==="spam"?"bg-destructive":"bg-primary"),children:n.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:n.subject||"No Subject"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:Ce("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",p),children:n.category||"unknown"}),o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[n.processing_status==="pending"&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(wr,{className:"w-2.5 h-2.5"})," Queued"]}),n.processing_status==="processing"&&o.jsxs("span",{className:"text-[9px] text-blue-600 dark:text-blue-400 bg-blue-500/10 border border-blue-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(qt,{className:"w-2.5 h-2.5 animate-spin"})," Analyzing"]}),n.processing_status==="completed"&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(ki,{className:"w-2.5 h-2.5"})," Analyzed"]}),n.processing_status==="failed"&&o.jsxs("span",{className:"text-[9px] text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",title:n.processing_error||"Unknown error",children:[o.jsx(Nr,{className:"w-2.5 h-2.5"})," Failed"]}),!n.processing_status&&!n.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(qt,{className:"w-2.5 h-2.5 animate-spin"})," Pending"]}),!n.processing_status&&n.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(ki,{className:"w-2.5 h-2.5"})," Analyzed"]})]}),o.jsxs("div",{className:"flex flex-col items-end text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:n.date?new Date(n.date).toLocaleString():"",children:[o.jsx("span",{className:"opacity-70",children:"Rec:"})," ",n.date?new Date(n.date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsxs("span",{title:new Date(n.created_at).toLocaleString(),children:[o.jsx("span",{className:"opacity-70",children:"Proc:"})," ",new Date(n.created_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:n.body_snippet}),o.jsxs("div",{className:"bg-secondary/30 p-3 rounded-lg border border-border/50 flex justify-between items-center",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[o.jsx(zd,{className:"w-3.5 h-3.5 text-emerald-500"}),"Suggested:",n.suggested_actions&&n.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:n.suggested_actions.map(_=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:_},_))}):o.jsx("span",{className:"text-foreground",children:n.suggested_action||"none"}),n.actions_taken&&n.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:n.actions_taken.join(", "),children:["(Done: ",n.actions_taken.join(", "),")"]}):n.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(Done: ",n.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:_=>_.stopPropagation(),children:h?o.jsxs("div",{className:"flex items-center gap-1 animate-in fade-in duration-200",children:[o.jsx("span",{className:"text-xs text-destructive mr-1",children:"Delete?"}),o.jsx(W,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(n,"delete"),disabled:g,children:d==="delete"?o.jsx(qt,{className:"w-3 h-3 animate-spin"}):"Yes"}),o.jsx(W,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:m,disabled:g,children:"No"})]}):o.jsxs(o.Fragment,{children:[o.jsx("a",{href:v(),target:"_blank",rel:"noreferrer",className:"inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-primary hover:bg-secondary/50 transition-colors",title:`Open in ${n.email_accounts?.provider==="gmail"?"Gmail":"Outlook"}`,children:o.jsx(Ri,{className:"w-3.5 h-3.5"})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>r(n),title:"View AI Trace (Prompt/Response)",children:o.jsx(tw,{className:"w-3.5 h-3.5"})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>a(n,"delete"),disabled:g,title:"Delete",children:d==="delete"?o.jsx(qt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(ko,{className:"w-3.5 h-3.5"})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>a(n,"archive"),disabled:g,title:"Archive",children:d==="archive"?o.jsx(qt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(xx,{className:"w-3.5 h-3.5"})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>a(n,"flag"),disabled:g,title:"Flag",children:d==="flag"?o.jsx(qt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(nw,{className:"w-3.5 h-3.5"})})]})})]})]})})}function i2(){const{state:n,actions:a}=kr(),[r,l]=w.useState(!1),[c,d]=w.useState(!1),[h,m]=w.useState(null),[p,g]=w.useState(!1),[v,_]=w.useState(!1),[x,S]=w.useState({}),[A,j]=w.useState(!1),[k,O]=w.useState("credentials"),[q,B]=w.useState(""),[G,ee]=w.useState(""),[J,P]=w.useState(""),[X,ue]=w.useState(""),[Je,be]=w.useState(!1),[ge,Ze]=w.useState(!1),[nt,Z]=w.useState(!1),[z,Q]=w.useState("credentials"),[K,Se]=w.useState(""),[Oe,T]=w.useState(""),[V,Y]=w.useState(!1),[F,de]=w.useState(!1),[ye,fe]=w.useState(""),[Ge,Be]=w.useState("category"),[Tt,yt]=w.useState("newsletter"),[vt,os]=w.useState(["archive"]),[ia,cs]=w.useState(""),[us,Ki]=w.useState(""),[Or,Rn]=w.useState([]),[en,ds]=w.useState(!1),[Yi,Ji]=w.useState(!1),[mt,fs]=w.useState(null);w.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),w.useEffect(()=>{n.settings&&S(n.settings)},[n.settings]);const Xi=async()=>{const U=n.rules.find(te=>te.name==="Auto-Trash Spam");if(!U){re.error("System rule not found. Please sync your database.");return}fs("auto_trash_spam"),await a.toggleRule(U.id),fs(null)},Qi=async()=>{const U=n.rules.find(te=>te.name==="Smart Drafts");if(!U){re.error("System rule not found. Please sync your database.");return}fs("smart_drafts"),await a.toggleRule(U.id),fs(null)},hs=w.useRef(null),Po=()=>{O("credentials"),B(""),ee(""),P(""),ue(""),j(!0)},Zi=U=>{B(U);try{const te=JSON.parse(U),Me=te.installed||te.web||te;Me.client_id&&ee(Me.client_id),Me.client_secret&&P(Me.client_secret),te.installed?re.success("Detected Desktop app credentials"):te.web&&re.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Ko=async()=>{if(!G||!J){re.error("Please provide both Client ID and Client Secret");return}be(!0);try{if(await a.updateSettings({...x,google_client_id:G,google_client_secret:J})){S(Me=>({...Me,google_client_id:G,google_client_secret:J}));const te=await Ve.getGmailAuthUrl();if(te.data?.url)window.open(te.data.url,"_blank"),O("code"),re.success("Please authorize in the opened tab, then paste the code here");else{const Me=typeof te.error=="string"?te.error:te.error?.message;re.error(Me||"Failed to get OAuth URL")}}else re.error("Failed to save credentials")}catch{re.error("Failed to save credentials")}finally{be(!1)}},Yo=async()=>{if(!X.trim()){re.error("Please paste the authorization code");return}Ze(!0);try{const U=await Ve.connectGmail(X.trim());if(U.data?.success)re.success("Gmail account connected successfully!"),j(!1),a.fetchAccounts();else{const te=typeof U.error=="string"?U.error:U.error?.message;re.error(te||"Failed to connect Gmail")}}catch{re.error("Failed to connect Gmail")}finally{Ze(!1)}},Dn=()=>{Q("credentials"),Se(""),T(""),Z(!0)},Ct=async()=>{if(!K){re.error("Please provide the Client ID");return}Y(!0);try{if(await a.updateSettings({...x,microsoft_client_id:K,microsoft_tenant_id:Oe||"common"})){S(Me=>({...Me,microsoft_client_id:K,microsoft_tenant_id:Oe||"common"}));const te=await Ve.startMicrosoftDeviceFlow();if(te.data)m(te.data),Q("device-code"),pa(te.data.deviceCode,te.data.interval);else{const Me=typeof te.error=="string"?te.error:te.error?.message;re.error(Me||"Failed to start device flow")}}else re.error("Failed to save credentials")}catch{re.error("Failed to save credentials")}finally{Y(!1)}},pa=async(U,te)=>{const Me=setInterval(async()=>{try{const ga=await Ve.pollMicrosoftDeviceCode(U);ga.data?.status==="completed"?(clearInterval(Me),m(null),d(!1),Z(!1),re.success("Outlook account connected"),a.fetchAccounts()):ga.error&&typeof ga.error=="object"&&ga.error.code}catch{}},te*1e3);setTimeout(()=>{clearInterval(Me),c&&(m(null),d(!1),Z(!1),re.error("Connection timed out. Please try again."))},900*1e3)},kt=async()=>{if(!ye){re.error("Please name your rule");return}if(vt.length===0){re.error("Please select at least one action");return}Ji(!0);try{const U={[Ge]:Tt};ia&&(U.older_than_days=parseInt(ia,10));const te=vt.includes("draft");await a.createRule({name:ye,condition:U,actions:vt,instructions:te?us:void 0,attachments:te?Or:[],is_enabled:!0})?(re.success("Rule created"),de(!1),fe(""),os(["archive"]),cs(""),Ki(""),Rn([]),a.fetchRules()):re.error("Failed to create rule")}catch{re.error("Failed to create rule")}finally{Ji(!1)}},Jo=async U=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(U)&&re.success("Account disconnected")},Fi=async()=>{g(!0);const U=await a.updateSettings(x);g(!1),U&&re.success("Settings saved")},Xo=async()=>{_(!0);try{const U=await Ve.testLlm({llm_model:x.llm_model||null,llm_base_url:x.llm_base_url||null,llm_api_key:x.llm_api_key||null});U.data?.success?re.success(U.data.message):re.error(U.data?.message||"Connection test failed")}catch{re.error("Failed to test connection")}finally{_(!1)}},ms=async U=>{await a.toggleRule(U)},ps=async U=>{const te=U.target.files;if(!te||te.length===0)return;ds(!0);const Me=te[0],ga=Me.name.split(".").pop(),Rr=`${Math.random().toString(36).substring(2)}.${ga}`,tn=`${n.user.id}/${Rr}`;try{const{error:ys}=await ct.storage.from("rule-attachments").upload(tn,Me);if(ys)throw ys;const Wi={name:Me.name,path:tn,type:Me.type,size:Me.size};Rn(el=>[...el,Wi]),re.success("File uploaded")}catch(ys){console.error("Upload error:",ys),re.error("Failed to upload file")}finally{ds(!1),U.target.value=""}},gs=U=>{Rn(te=>te.filter(Me=>Me.path!==U))},Aa=U=>U==="gmail"?o.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold",children:"G"}):o.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold",children:"O"});return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsx(ss,{open:A,onOpenChange:j,children:o.jsxs(rs,{className:"sm:max-w-lg",children:[o.jsxs(Na,{children:[o.jsxs(Ea,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold text-sm",children:"G"}),"Connect Gmail Account"]}),o.jsx(Ta,{children:k==="credentials"?"Enter your Google OAuth credentials to connect your Gmail account.":"Paste the authorization code from Google to complete the connection."})]}),k==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Kw,{className:"w-4 h-4"}),"Paste credentials.json"]}),o.jsx("textarea",{className:"w-full h-24 p-3 text-xs font-mono border rounded-lg bg-secondary/30 resize-none focus:outline-none focus:ring-2 focus:ring-primary",placeholder:'{"installed":{"client_id":"...","client_secret":"..."}}',value:q,onChange:U=>Zi(U.target.value)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Download from Google Cloud Console → APIs & Services → Credentials"})]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("span",{className:"w-full border-t"})}),o.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:o.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or enter manually"})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Ee,{placeholder:"xxx.apps.googleusercontent.com",value:G,onChange:U=>ee(U.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Ee,{type:"password",placeholder:"GOCSPX-...",value:J,onChange:U=>P(U.target.value)})]})]})]}),o.jsxs(pr,{children:[o.jsx(W,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),o.jsxs(W,{onClick:Ko,disabled:Je||!G||!J,children:[Je?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:o.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["1. A new tab opened with Google Sign-In",o.jsx("br",{}),"2. Sign in and authorize the app",o.jsx("br",{}),"3. Copy the authorization code shown",o.jsx("br",{}),"4. Paste it below"]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Authorization Code"}),o.jsx(Ee,{placeholder:"4/0AQlEd8x...",value:X,onChange:U=>ue(U.target.value),className:"font-mono"})]})]}),o.jsxs(pr,{children:[o.jsx(W,{variant:"outline",onClick:()=>O("credentials"),children:"Back"}),o.jsxs(W,{onClick:Yo,disabled:ge||!X.trim(),children:[ge?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Connect"]})]})]})]})}),o.jsx(ss,{open:nt,onOpenChange:Z,children:o.jsxs(rs,{className:"sm:max-w-lg",children:[o.jsxs(Na,{children:[o.jsxs(Ea,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold text-sm",children:"O"}),"Connect Outlook Account"]}),o.jsx(Ta,{children:z==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),z==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:o.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"Note: You need an Azure App Registration for this to work."})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID (Application ID)"}),o.jsx(Ee,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:U=>Se(U.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),o.jsx(Ee,{placeholder:"common",value:Oe,onChange:U=>T(U.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:'Default is "common". Use your specific Tenant ID for organization accounts.'})]})]})]}),o.jsxs(pr,{children:[o.jsx(W,{variant:"outline",onClick:()=>Z(!1),children:"Cancel"}),o.jsxs(W,{onClick:Ct,disabled:V||!K,children:[V?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):o.jsxs(o.Fragment,{children:[h&&o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Action Required"}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:h.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:h.userCode})}),o.jsxs(W,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ri,{className:"w-4 h-4 ml-2"})]})]})]}),o.jsx("div",{className:"flex justify-center",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(ht,{size:"sm"}),"Waiting for authorization..."]})})]}),o.jsx(pr,{children:o.jsx(W,{variant:"outline",onClick:()=>Z(!1),children:"Cancel"})})]})]})}),o.jsx(ss,{open:F,onOpenChange:de,children:o.jsxs(rs,{children:[o.jsxs(Na,{children:[o.jsx(Ea,{children:"Create Auto-Pilot Rule"}),o.jsx(Ta,{children:"Define a condition based on AI analysis to trigger an action."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Rule Name"}),o.jsx(Ee,{placeholder:"e.g. Archive Newsletters",value:ye,onChange:U=>fe(U.target.value)})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"If Condition Field"}),o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ge,onChange:U=>{Be(U.target.value),U.target.value==="category"?yt("newsletter"):U.target.value==="sentiment"?yt("Positive"):U.target.value==="priority"?yt("High"):yt("")},children:[o.jsxs("optgroup",{label:"AI Analysis",children:[o.jsx("option",{value:"category",children:"Category"}),o.jsx("option",{value:"sentiment",children:"Sentiment"}),o.jsx("option",{value:"priority",children:"Priority"})]}),o.jsxs("optgroup",{label:"Metadata",children:[o.jsx("option",{value:"sender_email",children:"Specific Email (Exact)"}),o.jsx("option",{value:"sender_domain",children:"Email Domain (@...)"}),o.jsx("option",{value:"sender_contains",children:"Sender contains..."}),o.jsx("option",{value:"subject_contains",children:"Subject contains..."}),o.jsx("option",{value:"body_contains",children:"Body contains..."})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Equals Value"}),Ge==="category"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:U=>yt(U.target.value),children:[o.jsx("option",{value:"newsletter",children:"Newsletter"}),o.jsx("option",{value:"spam",children:"Spam"}),o.jsx("option",{value:"promotional",children:"Promotional"}),o.jsx("option",{value:"transactional",children:"Transactional"}),o.jsx("option",{value:"social",children:"Social"}),o.jsx("option",{value:"support",children:"Support"}),o.jsx("option",{value:"client",children:"Client"}),o.jsx("option",{value:"internal",children:"Internal"}),o.jsx("option",{value:"personal",children:"Personal"}),o.jsx("option",{value:"other",children:"Other"})]}):Ge==="sentiment"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:U=>yt(U.target.value),children:[o.jsx("option",{value:"Positive",children:"Positive"}),o.jsx("option",{value:"Neutral",children:"Neutral"}),o.jsx("option",{value:"Negative",children:"Negative"})]}):Ge==="priority"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:U=>yt(U.target.value),children:[o.jsx("option",{value:"High",children:"High"}),o.jsx("option",{value:"Medium",children:"Medium"}),o.jsx("option",{value:"Low",children:"Low"})]}):o.jsx(Ee,{placeholder:Ge==="sender_domain"?"rta.vn":Ge==="sender_email"?"john@example.com":"Keywords...",value:Tt,onChange:U=>yt(U.target.value)})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(wr,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ee,{type:"number",min:"0",placeholder:"0",className:"w-24",value:ia,onChange:U=>cs(U.target.value)}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"days"})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Leave empty or 0 to apply rule immediately upon receipt."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Then Perform Action(s)"}),o.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Select one or more actions to execute when the rule matches"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"archive",label:"Archive Email"},{value:"delete",label:"Delete Email"},{value:"draft",label:"Draft Reply"},{value:"read",label:"Mark as Read"},{value:"star",label:"Star / Flag"}].map(U=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${vt.includes(U.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:vt.includes(U.value),onChange:te=>{te.target.checked?os([...vt,U.value]):os(vt.filter(Me=>Me!==U.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:U.label})]},U.value))})]}),vt.includes("draft")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsx("label",{className:"text-sm font-medium",children:"Draft Instructions (Context)"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[80px] text-sm",placeholder:"e.g. Tell them I'm busy until Friday, but interested in the proposal.",value:us,onChange:U=>Ki(U.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Specific context for the AI ghostwriter."})]}),o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(bg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[Or.map(U=>o.jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary/50 rounded border text-xs",children:[o.jsx("span",{className:"truncate max-w-[200px]",children:U.name}),o.jsx(W,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>gs(U.path),children:o.jsx(Gi,{className:"w-3 h-3"})})]},U.path)),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:ps,disabled:en}),o.jsxs(W,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:en,children:[en?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(ji,{className:"w-3 h-3 mr-2"}),en?"Uploading...":"Add Attachment"]})]})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Files will be attached to every draft generated by this rule."})]})]})]}),o.jsxs(pr,{children:[o.jsx(W,{variant:"outline",onClick:()=>de(!1),children:"Cancel"}),o.jsxs(W,{onClick:kt,disabled:Yi,children:[Yi?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(ji,{className:"w-4 h-4 mr-2"}),"Create Rule"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(Oi,{className:"w-5 h-5 text-primary"}),"Connected Accounts"]}),o.jsx(Za,{children:"Manage your email providers"})]}),o.jsxs(ja,{className:"space-y-4",children:[n.accounts.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No accounts connected yet"}):n.accounts.map(U=>o.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-card",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[Aa(U.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:U.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:U.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[U.is_active?o.jsx("span",{className:"text-xs text-emerald-600 bg-emerald-500/10 px-2 py-1 rounded-full",children:"Active"}):o.jsx("span",{className:"text-xs text-yellow-600 bg-yellow-500/10 px-2 py-1 rounded-full",children:"Inactive"}),o.jsx(W,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>Jo(U.id),children:o.jsx(ko,{className:"w-4 h-4"})})]})]},U.id)),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(W,{className:"w-full border-dashed",variant:"outline",onClick:Po,disabled:r||c,children:[r?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(ji,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(W,{className:"w-full border-dashed",variant:"outline",onClick:Dn,disabled:r||c,children:[c&&!h?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(ji,{className:"w-4 h-4 mr-2"}),"Connect Outlook Account"]})]}),h&&o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg animate-in slide-in-from-top-2",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Microsoft Sign-In Required"}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:h.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:h.userCode})}),o.jsxs(W,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ri,{className:"w-4 h-4 ml-2"})]}),o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"Waiting for you to sign in..."})]})]})]})]}),o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(zd,{className:"w-5 h-5 text-emerald-500"}),"Auto-Pilot Rules"]}),o.jsx(Za,{children:"Configure AI automation behavior"})]}),o.jsxs(ja,{className:"space-y-4",children:[o.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Auto-Trash Spam"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically delete emails categorized as spam"})]}),o.jsxs(W,{variant:n.rules.find(U=>U.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Xi,disabled:mt==="auto_trash_spam",children:[mt==="auto_trash_spam"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(hd,{className:"w-4 h-4 mr-1"}),n.rules.find(U=>U.name==="Auto-Trash Spam")?.is_enabled?"On":"Off"]})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Smart Drafts"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate draft replies for important emails"})]}),o.jsxs(W,{variant:n.rules.find(U=>U.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:Qi,disabled:mt==="smart_drafts",children:[mt==="smart_drafts"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(hd,{className:"w-4 h-4 mr-1"}),n.rules.find(U=>U.name==="Smart Drafts")?.is_enabled?"On":"Off"]})]}),o.jsxs("div",{className:"pt-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"text-sm font-medium",children:"Custom Rules"}),o.jsxs(W,{variant:"ghost",size:"sm",onClick:()=>de(!0),children:[o.jsx(ji,{className:"w-4 h-4 mr-1"})," Add Rule"]})]}),n.rules.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2 border border-dashed rounded-lg",children:"No custom rules yet"}),n.rules.length>0&&n.rules.filter(U=>U.name!=="Auto-Trash Spam"&&U.name!=="Smart Drafts").map(U=>{const te=U.actions&&U.actions.length>0?U.actions:U.action?[U.action]:[];return o.jsxs("div",{className:"p-3 bg-secondary/30 rounded-lg mb-2",children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-sm font-medium",children:U.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["→ ",te.join(" + ")]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(W,{variant:U.is_enabled?"default":"outline",size:"sm",onClick:()=>ms(U.id),className:"h-7 px-2",children:[o.jsx(hd,{className:"w-3.5 h-3.5 mr-1"}),U.is_enabled?"On":"Off"]}),o.jsx(W,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>a.deleteRule(U.id),children:o.jsx(ko,{className:"w-3 h-3"})})]})]}),U.instructions&&o.jsxs("p",{className:"text-[10px] text-muted-foreground italic border-t border-border/50 pt-1 mt-1 truncate",children:['"',U.instructions,'"']}),U.attachments&&U.attachments.length>0&&o.jsx("div",{className:"flex gap-1 mt-1",children:U.attachments.map(Me=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] bg-blue-500/10 text-blue-400 px-1.5 py-0.5 rounded border border-blue-500/20",children:[o.jsx(bg,{className:"w-2.5 h-2.5"}),Me.name]},Me.path))})]},U.id)})]})]})]})]}),o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(Sr,{className:"w-5 h-5 text-indigo-500"}),"Model Configuration"]}),o.jsx(Za,{children:"Configure Local LLM or API settings"})]}),o.jsxs(ja,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Model Name"}),o.jsx(Ee,{placeholder:"gpt-4o-mini",value:x.llm_model||"",onChange:U=>S(te=>({...te,llm_model:U.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Base URL"}),o.jsx(Ee,{placeholder:"https://api.openai.com/v1",value:x.llm_base_url||"",onChange:U=>S(te=>({...te,llm_base_url:U.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Use http://localhost:11434/v1 for Ollama"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"API Key"}),o.jsx(Ee,{type:"password",placeholder:"sk-...",value:x.llm_api_key||"",onChange:U=>S(te=>({...te,llm_api_key:U.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Oi,{className:"w-4 h-4"}),"Local Storage Path (.eml)"]}),o.jsx(Ee,{placeholder:"./data/emails",value:x.storage_path||"",onChange:U=>S(te=>({...te,storage_path:U.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Absolute or relative path where raw emails will be saved before analysis. Default: ./data/emails"})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(wr,{className:"w-4 h-4"}),"Background Sync Interval (minutes)"]}),o.jsx(Ee,{type:"number",min:1,max:1440,value:x.sync_interval_minutes||5,onChange:U=>S(te=>({...te,sync_interval_minutes:parseInt(U.target.value,10)||5}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"How often the system checks for new emails in the background."})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(W,{variant:"outline",onClick:Xo,disabled:v,children:[v?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Sr,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(W,{onClick:Fi,disabled:p,children:[p?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})]})]})]}),o.jsx("div",{ref:hs,children:o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(zd,{className:"w-5 h-5 text-orange-500"}),"Provider Credentials (Advanced)"]}),o.jsx(Za,{children:"Bring Your Own Keys (BYOK). Configure your own OAuth credentials here. Leave empty to use system defaults."})]}),o.jsxs(ja,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-4 border-b pb-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Google / Gmail"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Ee,{type:"password",placeholder:"...apps.googleusercontent.com",value:x.google_client_id||"",onChange:U=>S(te=>({...te,google_client_id:U.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Ee,{type:"password",placeholder:"GOCSPX-...",value:x.google_client_secret||"",onChange:U=>S(te=>({...te,google_client_secret:U.target.value}))})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500"})," Microsoft / Outlook"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Ee,{type:"password",value:x.microsoft_client_id||"",onChange:U=>S(te=>({...te,microsoft_client_id:U.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),o.jsx(Ee,{type:"password",value:x.microsoft_client_secret||"",onChange:U=>S(te=>({...te,microsoft_client_secret:U.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),o.jsx(Ee,{placeholder:"common",value:x.microsoft_tenant_id||"",onChange:U=>S(te=>({...te,microsoft_tenant_id:U.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(W,{onClick:Fi,disabled:p,variant:"secondary",children:[p?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})})]})]})})]})}const l2="modulepreload",o2=function(n){return"/"+n},fy={},c2=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let g=function(v){return Promise.all(v.map(_=>Promise.resolve(_).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};var h=g;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=m?.nonce||m?.getAttribute("nonce");c=g(r.map(v=>{if(v=o2(v),v in fy)return;fy[v]=!0;const _=v.endsWith(".css"),x=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${x}`))return;const S=document.createElement("link");if(S.rel=_?"stylesheet":l2,_||(S.as="script"),S.crossOrigin="",S.href=v,p&&S.setAttribute("nonce",p),document.head.appendChild(S),_)return new Promise((A,j)=>{S.addEventListener("load",A),S.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${v}`)))})}))}function d(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return c.then(m=>{for(const p of m||[])p.status==="rejected"&&d(p.reason);return a().catch(d)})};function u2(){const[n,a]=w.useState("profile"),{state:r,actions:l}=kr();w.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:vy},{id:"security",label:"Security",icon:qw},{id:"database",label:"Supabase",icon:Oi}];return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Account Settings"}),o.jsx("p",{className:"text-muted-foreground",children:"Manage your profile, security, and connection preferences."})]}),o.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[o.jsx("aside",{className:"w-full md:w-64 space-y-1",children:c.map(d=>{const h=d.icon,m=n===d.id;return o.jsxs("button",{onClick:()=>a(d.id),className:`w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors ${m?"bg-primary text-primary-foreground":"hover:bg-secondary text-muted-foreground"}`,children:[o.jsx(h,{className:"w-4 h-4"}),d.label]},d.id)})}),o.jsxs("div",{className:"flex-1 space-y-6",children:[n==="profile"&&o.jsx(d2,{}),n==="security"&&o.jsx(f2,{}),n==="database"&&o.jsx(h2,{})]})]})]})}function d2(){const{state:n,actions:a}=kr(),[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(!1),[p,g]=w.useState(!1),[v,_]=w.useState(br.isEnabled());w.useEffect(()=>{n.profile&&(l(n.profile.first_name||""),d(n.profile.last_name||""))},[n.profile]);const x=()=>{const j=!v;br.setEnabled(j),_(j),j?(br.playSuccess(),re.success("Sound effects enabled")):re.info("Sound effects disabled")},S=async()=>{m(!0);const j=await a.updateProfile({first_name:r,last_name:c});m(!1),j&&re.success("Profile updated")},A=async j=>{const k=j.target.files?.[0];if(!(!k||!n.user)){g(!0);try{const O=k.name.split(".").pop(),q=`${n.user.id}/avatar.${O}`,{data:B,error:G}=await ct.storage.from("avatars").upload(q,k,{upsert:!0});if(G)throw G;const{data:{publicUrl:ee}}=ct.storage.from("avatars").getPublicUrl(q);await a.updateProfile({avatar_url:ee}),re.success("Avatar updated")}catch(O){console.error("Avatar upload error:",O),re.error("Failed to upload avatar")}finally{g(!1)}}};return o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsx(Sa,{children:"Profile Information"}),o.jsx(Za,{children:"Update your personal details and avatar."})]}),o.jsxs(ja,{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col items-center sm:flex-row sm:items-start gap-6",children:[o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"w-24 h-24 rounded-full bg-secondary overflow-hidden border-2 border-border flex items-center justify-center",children:n.profile?.avatar_url?o.jsx("img",{src:n.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(vy,{className:"w-12 h-12 text-muted-foreground"})}),o.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-full opacity-0 group-hover:opacity-100 cursor-pointer transition-opacity",children:[o.jsx(Cx,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:A,disabled:p})]}),p&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(ht,{size:"sm"})})]}),o.jsxs("div",{className:"flex-1 space-y-4 w-full",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"first-name",children:"First Name"}),o.jsx(Ee,{id:"first-name",value:r,onChange:j=>l(j.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Ee,{id:"last-name",value:c,onChange:j=>d(j.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"email",children:"Email Address"}),o.jsx(Ee,{id:"email",value:n.profile?.email||"",disabled:!0,className:"bg-secondary/50"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Email cannot be changed directly."})]})]})]}),o.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("label",{className:"text-sm font-medium",children:"Sound & Haptics"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Audio feedback when processing emails and completing tasks."})]}),o.jsxs(W,{variant:v?"default":"outline",size:"sm",onClick:x,className:"gap-2",children:[v?o.jsx(Zw,{className:"w-4 h-4"}):o.jsx(Ww,{className:"w-4 h-4"}),v?"Enabled":"Disabled"]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(W,{onClick:S,disabled:h,children:[h?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Cw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function f2(){const[n,a]=w.useState(""),[r,l]=w.useState(""),[c,d]=w.useState(!1),h=async()=>{if(!n){re.error("Please enter a new password");return}if(n!==r){re.error("Passwords do not match");return}if(n.length<6){re.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await c2(async()=>{const{api:g}=await Promise.resolve().then(()=>qj);return{api:g}},void 0),p=await m.changePassword(n);p.success?(re.success("Password changed successfully"),a(""),l("")):re.error(p.error?.message||"Failed to change password")}catch{re.error("An error occurred")}finally{d(!1)}};return o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsx(Sa,{children:"Security"}),o.jsx(Za,{children:"Manage your password and account security."})]}),o.jsxs(ja,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"new-password",children:"New Password"}),o.jsx(Ee,{id:"new-password",type:"password",value:n,onChange:m=>a(m.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"confirm-password",children:"Confirm New Password"}),o.jsx(Ee,{id:"confirm-password",type:"password",value:r,onChange:m=>l(m.target.value),placeholder:"••••••••"})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(W,{onClick:h,disabled:c,children:[c?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(uw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function h2(){const[n,a]=w.useState(!1),r=Cr(),l=Uj(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(zj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(Oi,{className:"w-5 h-5 text-primary"}),"Supabase Connection"]}),o.jsx(Za,{children:"Manage your database configuration (BYOK - Bring Your Own Keys)."})]}),o.jsx(ja,{className:"space-y-6",children:r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-xl bg-emerald-500/5 border-emerald-500/20",children:[o.jsx(tf,{className:"w-6 h-6 text-emerald-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx("p",{className:"font-semibold text-emerald-700 dark:text-emerald-400",children:"Connected"}),o.jsx("p",{className:"text-sm font-mono break-all opacity-80",children:r.url})]})]}),l==="env"&&o.jsxs(Vi,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(Md,{className:"h-4 w-4 text-amber-500"}),o.jsx(Ii,{className:"text-amber-700 dark:text-amber-400 text-xs",children:"Configuration is loaded from environment variables. Use the UI to override them."})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs(W,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[o.jsx(Md,{className:"w-4 h-4 mr-2"}),"Change Connection"]}),l==="ui"&&o.jsxs(W,{variant:"outline",onClick:c,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(ko,{className:"w-4 h-4 mr-2"}),"Clear Config"]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(ha,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Anon Public Key"}),o.jsxs("div",{className:"p-2 bg-secondary/50 rounded-lg font-mono text-xs break-all",children:[r.anonKey.substring(0,20),"...",r.anonKey.substring(r.anonKey.length-10)]})]})]}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center space-y-4",children:[o.jsx(Kx,{className:"w-12 h-12 text-destructive opacity-20"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"No Connection Detected"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure a Supabase project to get started."})]}),o.jsxs(W,{onClick:()=>a(!0),children:[o.jsx(Oi,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx(Hv,{open:n,onComplete:()=>a(!1),canClose:!0})]})}function m2({length:n=6,value:a,onChange:r,onComplete:l,disabled:c=!1,error:d=!1}){const h=w.useRef([]),[m,p]=w.useState(null),g=(x,S)=>{const A=S.replace(/[^0-9]/g,"");if(A.length===0){const O=a.split("");O[x]=" ",a.split("");let q=a.split("");x<q.length&&q.splice(x,1);const B=q.join("");r(B),x>0&&h.current[x-1]?.focus();return}a.split("");const j=[...a];j[x]=A[0],r(j.join("")),x<n-1&&h.current[x+1]?.focus();const k=j.join("");k.length===n&&l&&l(k)},v=(x,S)=>{S.key==="Backspace"&&!a[x]&&x>0||S.key==="ArrowLeft"&&x>0?h.current[x-1]?.focus():S.key==="ArrowRight"&&x<n-1&&h.current[x+1]?.focus()},_=x=>{x.preventDefault();const A=x.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,n);r(A);const j=Math.min(A.length,n-1);h.current[j]?.focus(),A.length===n&&l&&l(A)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:n}).map((x,S)=>o.jsx(Ee,{ref:A=>{h.current[S]=A},type:"text",inputMode:"numeric",maxLength:1,value:a[S]||"",onChange:A=>g(S,A.target.value),onKeyDown:A=>v(S,A),onPaste:_,onFocus:()=>p(S),onBlur:()=>p(null),disabled:c,className:Ce("w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-semibold px-0",d&&"border-destructive focus-visible:ring-destructive",m===S&&"ring-2 ring-ring"),"aria-label":`Digit ${S+1}`},S))})}function p2({onSuccess:n,onConfigure:a}){const[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(""),[p,g]=w.useState(""),[v,_]=w.useState(!1),[x,S]=w.useState(!0),[A,j]=w.useState(!1),[k,O]=w.useState(""),[q,B]=w.useState("password"),[G,ee]=w.useState("email"),[J,P]=w.useState("");w.useEffect(()=>{X()},[]);const X=async()=>{try{const{data:be,error:ge}=await ct.from("init_state").select("is_initialized");if(ge){console.warn("[Login] Init check failed, defaulting to initialized (Login):",ge),j(!0);return}const Ze=be?.[0]?.is_initialized>0;j(Ze)}catch(be){if(console.warn("[Login] Init check exception, defaulting to initialized:",be),be.message?.includes("Invalid API key")||be.status===401){console.warn("[Login] API Key invalid for REST check (likely Publishable Key). defaulting to Setup Mode (isInitialized=false)."),j(!1);return}j(!0)}finally{S(!1)}},ue=async be=>{be.preventDefault(),_(!0),O("");try{if(A){if(q==="password"){const{error:ge}=await ct.auth.signInWithPassword({email:r,password:c});if(ge)throw ge;re.success("Logged in successfully"),n?.()}else if(G==="email"){const{error:ge}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(ge)throw ge;ee("verify"),re.success("Validation code sent to your email")}}else{const{data:ge,error:Ze}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:p}});if(Ze||!ge){if(Ze?.message?.includes("First user already exists")){re.info("System already initialized. Please log in."),j(!0);return}throw new Error(Ze?.message||"Failed to create admin account")}re.success("Admin account created! Signing you in...");const{error:nt}=await ct.auth.signInWithPassword({email:r,password:c});if(nt)throw nt;j(!0),n?.()}}catch(ge){O(ge?.message||"Authentication failed"),console.error("[Login] Error:",ge)}finally{_(!1)}},Je=async()=>{_(!0),O("");try{const{data:be,error:ge}=await ct.auth.verifyOtp({email:r,token:J,type:"magiclink"});if(ge)throw ge;if(!be.session)throw new Error("Failed to create session");re.success("Logged in successfully"),n?.()}catch(be){O(be?.message||"Invalid code")}finally{_(!1)}};return x?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx(qt,{className:"w-8 h-8 animate-spin text-primary"})}):o.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-8 relative",children:[o.jsx("div",{className:"absolute top-4 right-4",children:o.jsx(Ly,{})}),o.jsxs(Et,{className:"w-full max-w-md shadow-2xl",children:[o.jsxs(_a,{className:"text-center",children:[o.jsx("div",{className:"mx-auto bg-primary/10 p-4 rounded-full w-fit mb-4",children:o.jsx(mf,{className:"w-12 h-12"})}),o.jsx(Sa,{className:"text-2xl",children:A?"Welcome Back":"Welcome to Email Automator"}),o.jsx(Za,{children:A?q==="password"?"Sign in to access your email automation":G==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:ue,children:[o.jsxs(ja,{className:"space-y-4",children:[!A&&o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"First Name"}),o.jsx(Ee,{value:h,onChange:be=>m(be.target.value),required:!A,placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Last Name"}),o.jsx(Ee,{value:p,onChange:be=>g(be.target.value),required:!A,placeholder:"Doe"})]})]}),q==="password"||G==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Ee,{type:"email",placeholder:"admin@example.com",value:r,onChange:be=>l(be.target.value),required:!0,autoComplete:"email",disabled:G==="verify"})]}):null,q==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Ee,{type:"password",placeholder:"••••••••",value:c,onChange:be=>d(be.target.value),required:!0,minLength:6,autoComplete:A?"current-password":"new-password"})]}),q==="otp"&&G==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(m2,{value:J,onChange:P,length:6,onComplete:()=>{}})}),o.jsx(W,{type:"button",variant:"link",className:"w-full text-xs text-muted-foreground",onClick:()=>ee("email"),children:"Change email address"})]}),o.jsxs("div",{className:"bg-destructive/10 text-destructive text-sm p-3 rounded-md flex flex-col gap-2",children:[o.jsx("p",{children:k}),k.includes("configuration")||k.includes("Invalid API key")||k.includes("API key")&&a&&o.jsx(W,{type:"button",variant:"outline",className:"w-full border-destructive/50 hover:bg-destructive/20 text-destructive",onClick:a,children:"Update Connection Settings"})]})]}),o.jsxs(cv,{className:"flex flex-col gap-3",children:[q==="otp"&&G==="verify"?o.jsx(W,{type:"button",onClick:Je,disabled:v||J.length!==6,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx(qt,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify Code"}):o.jsx(W,{type:"submit",disabled:v||!r||q==="password"&&!c,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx(qt,{className:"w-4 h-4 mr-2 animate-spin"}),A?q==="otp"?"Send Code":"Signing in...":"Creating Account..."]}):o.jsxs(o.Fragment,{children:[A?q==="otp"?o.jsx(Dd,{className:"w-4 h-4 mr-2"}):o.jsx(pw,{className:"w-4 h-4 mr-2"}):o.jsx(Jw,{className:"w-4 h-4 mr-2"}),A?q==="otp"?"Send Login Code":"Sign In":"Create Admin Account"]})}),A&&o.jsx("div",{className:"flex flex-col gap-2 w-full",children:q==="password"?o.jsxs(W,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("otp"),ee("email"),O("")},children:[o.jsx(ow,{className:"w-4 h-4 mr-2"}),"Sign in with Code"]}):o.jsxs(W,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("password"),O("")},children:[o.jsx(_x,{className:"w-4 h-4 mr-2"}),"Sign in with Password"]})}),A&&o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"New users must be invited by an admin."})]})]})]})]})}const Vv=void 0,g2=void 0;function y2(n,a){const r=n.split(".").map(Number),l=a.split(".").map(Number);for(let c=0;c<Math.max(r.length,l.length);c++){const d=r[c]||0,h=l[c]||0;if(d>h)return 1;if(d<h)return-1}return 0}async function v2(n){try{const{data:a,error:r}=await n.rpc("get_latest_migration_timestamp");return r?(console.warn("Could not get latest migration timestamp:",r.message),{version:null,latestMigrationTimestamp:null}):{version:Vv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function b2(n){const a=Vv,r=g2,l=await v2(n);if(console.log("[Migration Check]",{appVersion:a,appMigrationTimestamp:r,dbVersion:l.version,dbMigrationTimestamp:l.latestMigrationTimestamp}),l.latestMigrationTimestamp&&l.latestMigrationTimestamp.trim()!==""){const c=r,d=l.latestMigrationTimestamp;return c>d?{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`New migrations available. Database is at ${d}, app has ${c}.`}:c<d?(console.warn("[Migration Check] DB is ahead of app - possible downgrade"),{needsMigration:!1,appVersion:a,dbVersion:l.version,message:`Database (${d}) is ahead of app (${c}).`}):(console.log("[Migration Check] Timestamps match - database is up-to-date"),{needsMigration:!1,appVersion:a,dbVersion:l.version,message:"Database schema is up-to-date."})}if(l.version){console.log("[Migration Check] Legacy DB detected (no timestamp). Falling back to SemVer.");const c=y2(a,l.version);return c>0?{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`Database schema (v${l.version}) is outdated. Migration to v${a} required.`}:c===0?(console.warn("[Migration Check] Legacy DB with matching version - forcing migration to add timestamp tracking"),{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`Database lacks timestamp tracking. Please run migration to upgrade to modern schema (v${a}).`}):{needsMigration:!1,appVersion:a,dbVersion:l.version,message:`Database version (v${l.version}) is ahead of app (v${a}).`}}return console.log("[Migration Check] No DB info found - assuming migration needed"),{needsMigration:!0,appVersion:a,dbVersion:null,message:`Database schema unknown. Migration required to v${a}.`}}const Iv="email_automator_migration_reminder_dismissed_at";function x2(n=24){try{const a=localStorage.getItem(Iv);if(!a)return!1;const r=new Date(a).getTime();return(Date.now()-r)/(1e3*60*60)<n}catch(a){return console.error("Error checking migration reminder:",a),!1}}function w2(){try{localStorage.setItem(Iv,new Date().toISOString())}catch(n){console.error("Error dismissing migration reminder:",n)}}function _2({status:n,onDismiss:a,onLearnMore:r}){const[l,c]=w.useState(!0);if(!l)return null;const d=()=>{w2(),c(!1),a?.()},h=()=>{r?r():(navigator.clipboard.writeText("npx email-automator migrate"),re.success("Command copied to clipboard"))};return o.jsx("div",{className:"fixed right-4 top-16 z-50 max-w-sm animate-in slide-in-from-top-5",children:o.jsx("div",{className:"rounded-lg border border-yellow-500 bg-yellow-50 p-4 shadow-lg dark:bg-yellow-950/90 dark:border-yellow-600",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(jr,{className:"h-5 w-5 flex-shrink-0 text-yellow-600 dark:text-yellow-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:"Database Update Required"}),o.jsxs(W,{size:"icon",variant:"ghost",className:"h-5 w-5 -mr-1 -mt-1 text-yellow-900 hover:bg-yellow-100 dark:text-yellow-100 dark:hover:bg-yellow-900/30",onClick:d,children:[o.jsx(Gi,{className:"h-3 w-3"}),o.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),o.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-200",children:["Your app version (",n.appVersion,") requires a database schema update."]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(W,{size:"sm",variant:"default",className:"h-7 text-xs bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-500 dark:hover:bg-yellow-600",onClick:h,children:"Update Now"}),o.jsx(W,{size:"sm",variant:"ghost",className:"h-7 text-xs text-yellow-900 hover:bg-yellow-100 dark:text-yellow-100 dark:hover:bg-yellow-900/30",onClick:d,children:"Remind Later"})]})]})]})})})}function Eo({code:n,label:a}){const[r,l]=w.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){re.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(n),l(!0),window.setTimeout(()=>l(!1),2e3),re.success("Copied to clipboard")}catch(h){console.error("Failed to copy:",h),re.error("Failed to copy to clipboard")}};return o.jsxs("div",{className:"relative",children:[a&&o.jsx("div",{className:"mb-2 text-sm font-medium text-muted-foreground",children:a}),o.jsxs("div",{className:"group relative",children:[o.jsx("pre",{className:"overflow-hidden rounded-md bg-muted p-3 pr-12 text-sm",children:o.jsx("code",{className:"block whitespace-pre-wrap break-all",children:n})}),o.jsxs(W,{type:"button",size:"icon",variant:"ghost",className:"absolute right-2 top-2 h-8 w-8",onClick:d,disabled:!c,children:[r?o.jsx(Qa,{className:"h-4 w-4 text-green-600"}):o.jsx(Qx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function S2({open:n,onOpenChange:a,status:r}){const l=Cr(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState([]),[v,_]=w.useState(""),[x,S]=w.useState(""),A=w.useRef(null),j=w.useMemo(()=>{const O=l?.url;if(!O)return"";try{return new URL(O).hostname.split(".")[0]||""}catch{return""}},[l?.url]);w.useEffect(()=>{A.current&&A.current.scrollIntoView({behavior:"smooth"})},[p]);const k=async()=>{if(!j){re.error("Missing Project ID");return}m(!0),g(["Initializing migration..."]);try{const O=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:j,dbPassword:v,accessToken:x})});if(!O.ok)throw new Error(`Server returned ${O.status}: ${O.statusText}`);const q=O.body?.getReader();if(!q)throw new Error("No response stream received.");const B=new TextDecoder;for(;;){const{done:G,value:ee}=await q.read();if(G)break;const P=B.decode(ee).split(`
|
|
96
|
+
`).filter(Boolean);g(X=>[...X,...P])}}catch(O){console.error(O),g(q=>[...q,`Error: ${O instanceof Error?O.message:String(O)}`]),re.error("Migration failed. Check logs for details.")}finally{m(!1)}};return o.jsx(ss,{open:n,onOpenChange:O=>!h&&a(O),children:o.jsxs(rs,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[o.jsxs(Na,{children:[o.jsxs(Ea,{className:"flex items-center gap-2 text-xl",children:[o.jsx(jr,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Migration Required"]}),o.jsxs(Ta,{children:["Your application version (",r.appVersion,") requires a database schema update to function correctly."]})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs(Vi,{children:[o.jsx(_r,{className:"h-4 w-4"}),o.jsxs(Ii,{children:[o.jsx("strong",{children:"Why is this needed?"}),o.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[o.jsxs("li",{children:["Updates your database schema to match version ",r.appVersion]}),o.jsx("li",{children:"Enables new features and performance improvements"}),o.jsx("li",{children:"Your existing data will be preserved (safe migration)"})]})]})]}),o.jsxs("div",{className:"flex border-b",children:[o.jsx("button",{className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${c?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,onClick:()=>d(!0),children:"Automatic (Recommended)"}),o.jsx("button",{className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${c?"border-transparent text-muted-foreground hover:text-foreground":"border-primary text-primary"}`,onClick:()=>d(!1),children:"Manual CLI"})]}),c?o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm p-6",children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Automated Migration"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Run the migration directly from your browser. Requires your database password."}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ha,{htmlFor:"project-id",children:"Supabase Project ID"}),o.jsx(Ee,{id:"project-id",value:j,disabled:!0,readOnly:!0,className:"bg-muted"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(ha,{htmlFor:"access-token",children:"Access Token (Optional)"}),o.jsxs("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["Generate Token ",o.jsx(Ri,{className:"h-3 w-3"})]})]}),o.jsx(Ee,{id:"access-token",type:"password",placeholder:"sbp_...",value:x,onChange:O=>S(O.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Recommended for more reliable authentication."})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ha,{htmlFor:"db-password",children:"Database Password"}),o.jsx(Ee,{id:"db-password",type:"password",placeholder:"Your database password",value:v,onChange:O=>_(O.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Required if no access token is provided."})]}),o.jsx(W,{onClick:k,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx(qt,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Ud,{className:"mr-2 h-4 w-4"}),"Start Migration"]})})]})]}),o.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[p.length===0?o.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):p.map((O,q)=>o.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:O},q)),o.jsx("div",{ref:A})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"1"}),"Prerequisites"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"You will need the following before proceeding:"}),o.jsxs("ul",{className:"list-inside list-disc space-y-1 text-sm",children:[o.jsx("li",{children:"Supabase CLI installed"}),o.jsxs("li",{children:["Project ID:"," ",o.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:j||"your-project-id"})]}),o.jsx("li",{children:"Database Password"})]})]})]}),o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"2"}),"Install Supabase CLI"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"MacOS (Brew)"}),o.jsx(Eo,{code:"brew install supabase/tap/supabase"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"Windows (Scoop)"}),o.jsx(Eo,{code:`scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
|
|
97
|
+
scoop install supabase`})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"NPM (Universal)"}),o.jsx(Eo,{code:"npm install -g supabase"})]})]})]}),o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"3"}),"Run Migration"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Run the built-in migration tool:"}),o.jsx(Eo,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Vi,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(jr,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(Ii,{children:[o.jsx("strong",{children:"Troubleshooting"}),o.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[o.jsxs("li",{children:["Try logging out: ",o.jsx("code",{children:"supabase logout"})]}),o.jsx("li",{children:"Verify your database password is correct"})]})]})]})]}),o.jsx(pr,{children:o.jsx(W,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function j2(){const[n,a]=w.useState([]),{isExpanded:r,setIsExpanded:l}=ov(),[c,d]=w.useState({});w.useEffect(()=>{h();const v=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},_=>{const x=_.new;x.event_type==="error"&&d(S=>({...S,[x.id]:!0})),a(S=>{const A=[x,...S];return A.length>100?A.slice(0,100):A})}).subscribe();return()=>{ct.removeChannel(v)}},[]);const h=async()=>{const{data:v}=await ct.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);v&&a(v)},m=v=>{d(_=>({..._,[v]:!_[v]}))},p=v=>{switch(v){case"analysis":return o.jsx(ki,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Oo,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(jr,{className:"w-3 h-3 text-red-500"});default:return o.jsx(_r,{className:"w-3 h-3 text-blue-500"})}},g=v=>new Date(v).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return r?o.jsxs(Et,{className:"fixed bottom-4 right-4 z-50 w-[550px] h-[650px] flex flex-col shadow-2xl border-border bg-background/95 text-foreground backdrop-blur-md animate-in slide-in-from-bottom-10",children:[o.jsxs(_a,{className:"py-3 px-4 border-b border-border flex flex-row items-center justify-between sticky top-0 bg-background/95 z-20",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ud,{className:"w-4 h-4 text-primary"}),o.jsx(Sa,{className:"text-sm font-mono font-bold",children:"Agent Terminal"}),o.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 bg-green-500/10 px-2 py-0.5 rounded-full border border-green-500/20 font-bold",children:[o.jsx(vx,{className:"w-3 h-3"}),"LIVE"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(W,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:"Clear"}),o.jsx(W,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:o.jsx(xw,{className:"w-4 h-4"})})]})]}),o.jsxs(ja,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[n.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:"Waiting for agent activity..."}),n.map((v,_)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[_!==n.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:Ce("absolute left-0 top-0 w-7 h-7 rounded-full border border-border bg-card flex items-center justify-center z-10 shadow-sm",v.event_type==="error"&&"border-red-500/50 bg-red-500/5",v.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",v.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5"),children:p(v.event_type)}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between group",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Ce("font-bold uppercase tracking-tight text-[10px]",v.event_type==="info"&&"text-muted-foreground",v.event_type==="analysis"&&"text-purple-600 dark:text-purple-400",v.event_type==="action"&&"text-emerald-600 dark:text-emerald-400",v.event_type==="error"&&"text-red-600 dark:text-red-400"),children:v.agent_state}),o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:g(v.created_at)})]}),(v.details?.system_prompt||v.details?._raw_response||v.details?.raw_response)&&o.jsxs(W,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[9px] text-muted-foreground hover:text-primary opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>m(v.id),children:[c[v.id]?o.jsx(qx,{className:"w-3 h-3 mr-1"}):o.jsx(Dx,{className:"w-3 h-3 mr-1"}),"Details"]})]}),v.event_type==="analysis"&&v.details?o.jsxs("div",{className:"bg-purple-500/5 border border-purple-500/10 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:Ce("px-1.5 py-0.5 rounded text-[9px] font-bold border",v.details.is_useless?"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20":"bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20"),children:v.details.is_useless?"USELESS":"RELEVANT"}),o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold border bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 uppercase",children:v.details.category})]}),o.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',v.details.summary,'"']}),v.details.suggested_actions&&v.details.suggested_actions.length>0&&o.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:v.details.suggested_actions.map(x=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-emerald-600 dark:text-emerald-400 font-bold bg-emerald-500/10 px-1.5 py-0.5 rounded border border-emerald-500/20 uppercase",children:[o.jsx(Oo,{className:"w-2.5 h-2.5"}),x]},x))})]}):v.event_type==="action"&&v.details?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/10 rounded-lg p-3",children:[o.jsx("p",{className:"text-emerald-600 dark:text-emerald-400 font-bold mb-1 uppercase text-[9px] tracking-widest",children:"Execution Complete"}),o.jsxs("p",{className:"text-foreground font-medium",children:[v.details.action==="delete"&&"Moved to Trash",v.details.action==="archive"&&"Archived Email",v.details.action==="draft"&&"Drafted Reply",v.details.action==="read"&&"Marked as Read",v.details.action==="star"&&"Starred Email",!["delete","archive","draft","read","star"].includes(v.details.action)&&v.details.action]}),v.details.reason&&o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[o.jsx(_r,{className:"w-3 h-3"}),v.details.reason]})]}):v.event_type==="error"&&v.details?o.jsx("div",{className:"bg-red-500/5 border border-red-500/10 rounded-lg p-2.5 text-red-600 dark:text-red-400 font-medium",children:typeof v.details.error=="object"?v.details.error.message||JSON.stringify(v.details.error):v.details.error}):o.jsx("p",{className:"text-muted-foreground leading-relaxed",children:v.details?.message||JSON.stringify(v.details)}),c[v.id]&&o.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[v.details?.system_prompt&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(gr,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"whitespace-pre-wrap break-words text-[10px] leading-normal text-muted-foreground select-all",children:v.details.system_prompt})})]}),v.details?.content_preview&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(gr,{className:"w-3 h-3"})," Input Content (Cleaned)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border",children:o.jsx("p",{className:"whitespace-pre-wrap break-words text-[10px] text-muted-foreground",children:v.details.content_preview})})]}),v.details?._raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(gr,{className:"w-3 h-3"})," Raw LLM JSON Output"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all",children:JSON.stringify(JSON.parse(v.details._raw_response),null,2)})})]}),v.details?.raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(gr,{className:"w-3 h-3"})," Raw Response (from Error)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all whitespace-pre-wrap",children:typeof v.details.raw_response=="object"?JSON.stringify(v.details.raw_response,null,2):v.details.raw_response})})]})]})]})]},v.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(W,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx(Ud,{className:"w-4 h-4 mr-2"}),"Live Activity",n.length>0&&o.jsxs("span",{className:"ml-2 flex h-2 w-2 relative",children:[o.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),o.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]})]})})}function N2(){const{state:n,isSubscribed:a,actions:r}=kr(),[l,c]=w.useState(!1),[d,h]=w.useState("dashboard"),[m,p]=w.useState(!0),[g,v]=w.useState(!1);if(w.useEffect(()=>{const P=new URLSearchParams(window.location.search).get("code");P&&!g&&(async()=>{v(!0);try{const ue=await Ve.connectGmail(P);if(ue.data?.success)re.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),r.fetchAccounts());else{const Je=typeof ue.error=="string"?ue.error:ue.error?.message;re.error(Je||"Failed to connect Gmail")}}catch{re.error("Connection failed")}finally{v(!1)}})()},[]),g)return o.jsx(Ci,{text:"Connecting account..."});const[_,x]=w.useState(null),[S,A]=w.useState(!1),[j,k]=w.useState(!1),[O,q]=w.useState(!1);w.useEffect(()=>{(async()=>{const P=Cr();if(!P){c(!0),p(!1);return}if((await tv(P.url,P.anonKey)).valid)n.isInitialized&&n.isAuthenticated&&(r.fetchAccounts(),r.fetchRules(),r.fetchSettings(),r.fetchProfile(),b2(ct).then(ue=>{x(ue),ue.needsMigration&&!x2()&&A(!0)}));else{c(!0),p(!1);return}p(!1)})()},[n.isInitialized,n.isAuthenticated]);const B=()=>{k(!0),A(!1)},G={migrationStatus:_,showMigrationBanner:S,showMigrationModal:j,openMigrationModal:B,suppressMigrationBanner:O,setSuppressMigrationBanner:q};if(m)return o.jsx(Ci,{text:"Checking configuration..."});if(l)return o.jsx(Hv,{onComplete:()=>{c(!1),window.location.reload()}});if(!n.isInitialized)return o.jsx(Ci,{text:"Initializing..."});if(!n.isAuthenticated)return o.jsx(p2,{onConfigure:()=>c(!0)});const ee=async()=>{await ct.auth.signOut(),re.success("Logged out successfully")};return o.jsx(Qj,{value:G,children:o.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[o.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{onClick:()=>h("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(mf,{className:"w-9 h-9"}),o.jsx("span",{className:"hidden sm:inline",children:"Email Automator"}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),o.jsxs("div",{className:Ce("flex items-center gap-1.5 px-2 py-1 rounded-full text-[10px] font-bold border transition-colors",a?"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 dark:text-emerald-400":"bg-yellow-500/10 text-yellow-600 border-yellow-500/20 dark:text-yellow-400"),children:[o.jsx("div",{className:Ce("w-1.5 h-1.5 rounded-full",a?"bg-emerald-500 animate-pulse":"bg-yellow-500")}),o.jsx("span",{className:"hidden xs:inline",children:a?"LIVE":"OFFLINE"})]})]}),o.jsxs("div",{className:"flex gap-4 items-center",children:[o.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[o.jsxs(W,{variant:d==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>h("dashboard"),className:"gap-2",children:[o.jsx(fw,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),o.jsxs(W,{variant:d==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>h("analytics"),className:"gap-2",children:[o.jsx(gy,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),o.jsxs(W,{variant:d==="config"?"secondary":"ghost",size:"sm",onClick:()=>h("config"),className:"gap-2",children:[o.jsx(Md,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Configuration"})]})]}),o.jsx("div",{className:"h-6 w-px bg-border/50 mx-2 hidden sm:block"}),o.jsx(Ly,{}),o.jsx(W,{variant:d==="account"?"secondary":"ghost",size:"sm",onClick:()=>h("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:"Account Settings",children:n.profile?.avatar_url?o.jsx("img",{src:n.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(Gx,{className:"w-5 h-5"})}),o.jsx(W,{variant:"ghost",size:"sm",onClick:ee,className:"text-muted-foreground hover:text-foreground",title:"Sign out",children:o.jsx(yw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4",children:[d==="dashboard"&&o.jsx(n2,{}),d==="config"&&o.jsx(i2,{}),d==="analytics"&&o.jsx(T2,{}),d==="account"&&o.jsx(u2,{})]}),n.error&&o.jsx("div",{className:"fixed bottom-20 left-4 right-4 sm:left-auto sm:right-4 sm:max-w-sm z-50",children:o.jsx("div",{className:"bg-destructive/10 border border-destructive/20 text-destructive p-4 rounded-lg",children:o.jsx("p",{className:"text-sm",children:n.error})})}),_&&S&&!O&&o.jsx(_2,{status:_,onDismiss:()=>A(!1),onLearnMore:B}),_&&o.jsx(S2,{open:j,onOpenChange:k,status:_}),o.jsx(j2,{})]})})}function E2({runId:n,accountEmail:a,isOpen:r,onOpenChange:l}){const[c,d]=w.useState([]),[h,m]=w.useState(!1);w.useEffect(()=>{r&&n&&p()},[r,n]);const p=async()=>{if(n){m(!0);try{const v=await Ve.getRunEvents(n);v.data&&d(v.data.events)}catch(v){console.error("Failed to fetch run trace:",v)}finally{m(!1)}}},g=v=>{switch(v){case"analysis":return o.jsx(ki,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Oo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Nr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(_r,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(ss,{open:r,onOpenChange:l,children:o.jsxs(rs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Na,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(nf,{className:"w-5 h-5 text-primary"}),o.jsx(Ea,{children:"Sync Run Trace"})]}),o.jsx(Ta,{children:a?`Full log for account: ${a}`:"Historical log for this synchronization run."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:h?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(Ci,{text:"Loading trace..."})}):c.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:"No granular trace events found for this run."}):c.map((v,_)=>o.jsxs("div",{className:"relative pl-8",children:[_!==c.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:g(v.event_type)}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-foreground/70",children:v.agent_state}),v.emails?.subject&&o.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",v.emails.subject]})]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(wr,{className:"w-3 h-3"}),new Date(v.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[v.event_type==="info"&&o.jsx("p",{className:"text-sm text-foreground/90",children:v.details?.message}),v.event_type==="analysis"&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',v.details?.summary,'"']}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:"text-[9px] bg-secondary px-1.5 py-0.5 rounded font-bold uppercase",children:v.details?.category}),v.details?.suggested_actions?.map(x=>o.jsx("span",{className:"text-[9px] bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 px-1.5 py-0.5 rounded border border-emerald-500/20 font-bold uppercase",children:x},x))]})]}),v.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:["Executed: ",v.details?.action]}),o.jsx(af,{className:"w-4 h-4 text-emerald-500"})]}),v.event_type==="error"&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:v.details?.error})]})]})]},v.id))})]})})}function T2(){const{state:n,actions:a}=kr(),[r,l]=w.useState(null),[c,d]=w.useState(void 0),[h,m]=w.useState(!1);if(w.useEffect(()=>{a.fetchStats()},[]),!n.stats)return o.jsx(Ci,{text:"Loading analytics..."});const p=(v,_)=>{l(v),d(_),m(!0)},{stats:g}=n;return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[o.jsx(gy,{className:"w-6 h-6 text-primary"}),"Analytics Dashboard"]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[o.jsx(To,{title:"Total Emails",value:g.totalEmails,color:"primary"}),o.jsx(To,{title:"Spam Caught",value:g.categoryCounts.spam||0,color:"destructive"}),o.jsx(To,{title:"Actions Taken",value:Object.values(g.actionCounts).reduce((v,_)=>v+_,0)-(g.actionCounts.none||0),color:"emerald"}),o.jsx(To,{title:"Accounts",value:g.accountCount,color:"blue"})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Email Categories"}),o.jsx("div",{className:"space-y-3",children:Object.entries(g.categoryCounts).map(([v,_])=>o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[o.jsx("span",{className:"capitalize",children:v}),o.jsx("span",{className:"text-muted-foreground",children:_})]}),o.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${_/g.totalEmails*100}%`}})})]})},v))})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Actions Taken"}),o.jsx("div",{className:"space-y-3",children:Object.entries(g.actionCounts).map(([v,_])=>o.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[o.jsx("span",{className:"capitalize",children:v}),o.jsx("span",{className:"font-medium",children:_})]},v))})]})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Recent Sync Activity"}),g.recentSyncs.length===0?o.jsx("p",{className:"text-muted-foreground text-sm",children:"No sync activity yet"}):o.jsx("div",{className:"space-y-3",children:g.recentSyncs.map(v=>{const _=v.completed_at?Math.round((new Date(v.completed_at).getTime()-new Date(v.started_at).getTime())/1e3):null;return o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between p-3 border rounded-lg hover:bg-secondary/30 transition-colors gap-3 cursor-pointer group",onClick:()=>p(v.id,v.email_accounts?.email_address),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:Ce("w-2.5 h-2.5 rounded-full",v.status==="success"?"bg-emerald-500":v.status==="failed"?"bg-destructive":"bg-yellow-500 shadow-[0_0_8px_rgba(234,179,8,0.5)] animate-pulse")}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:v.email_accounts?.email_address||"System Sync"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(wr,{className:"w-3 h-3"}),new Date(v.started_at).toLocaleString(),_!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[_,"s"]})]})]})]}),o.jsx("div",{className:"flex items-center gap-4 text-xs",children:o.jsxs("div",{className:"flex flex-col items-end",children:[o.jsxs("span",{className:"font-bold text-primary",children:[v.emails_processed," emails"]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[v.emails_deleted," deleted, ",v.emails_drafted," drafted"]})]})})]},v.id)})})]}),o.jsx(E2,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function To({title:n,value:a,color:r}){const l={primary:"bg-primary/10 text-primary",destructive:"bg-destructive/10 text-destructive",emerald:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",blue:"bg-blue-500/10 text-blue-600 dark:text-blue-400"};return o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:n}),o.jsx("p",{className:`text-3xl font-bold ${l[r]||""}`,children:a})]})}function A2(){return o.jsx(n_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(Fj,{children:o.jsx(Zj,{children:o.jsxs(Jj,{children:[o.jsx(N2,{}),o.jsx(Kj,{})]})})})})}dx.createRoot(document.getElementById("root")).render(o.jsx(hy.StrictMode,{children:o.jsx(A2,{})}));
|