@realtimex/email-automator 2.3.8 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
- function ex(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 Zd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var id={exports:{}},bi={};var lg;function tx(){if(lg)return bi;lg=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 bi.Fragment=a,bi.jsx=r,bi.jsxs=r,bi}var og;function ax(){return og||(og=1,id.exports=tx()),id.exports}var o=ax(),ld={exports:{}},ve={};var cg;function nx(){if(cg)return ve;cg=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"),x=Symbol.for("react.activity"),_=Symbol.iterator;function S(N){return N===null||typeof N!="object"?null:(N=_&&N[_]||N["@@iterator"],typeof N=="function"?N:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,k={};function O(N,I,X){this.props=N,this.context=I,this.refs=k,this.updater=X||A}O.prototype.isReactComponent={},O.prototype.setState=function(N,I){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,I,"setState")},O.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function q(){}q.prototype=O.prototype;function L(N,I,X){this.props=N,this.context=I,this.refs=k,this.updater=X||A}var P=L.prototype=new q;P.constructor=L,E(P,O.prototype),P.isPureReactComponent=!0;var W=Array.isArray;function Q(){}var Y={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function fe(N,I,X){var Z=X.ref;return{$$typeof:n,type:N,key:I,ref:Z!==void 0?Z:null,props:X}}function Ie(N,I){return fe(N.type,I,N.props)}function pe(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function ge(N){var I={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(X){return I[X]})}var et=/\/+/g;function nt(N,I){return typeof N=="object"&&N!==null&&N.key!=null?ge(""+N.key):I.toString(36)}function Ue(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(Q,Q):(N.status="pending",N.then(function(I){N.status==="pending"&&(N.status="fulfilled",N.value=I)},function(I){N.status==="pending"&&(N.status="rejected",N.reason=I)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function U(N,I,X,Z,ce){var ye=typeof N;(ye==="undefined"||ye==="boolean")&&(N=null);var ue=!1;if(N===null)ue=!0;else switch(ye){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(N.$$typeof){case n:case a:ue=!0;break;case v:return ue=N._init,U(ue(N._payload),I,X,Z,ce)}}if(ue)return ce=ce(N),ue=Z===""?"."+nt(N,0):Z,W(ce)?(X="",ue!=null&&(X=ue.replace(et,"$&/")+"/"),U(ce,I,X,"",function(Nt){return Nt})):ce!=null&&(pe(ce)&&(ce=Ie(ce,X+(ce.key==null||N&&N.key===ce.key?"":(""+ce.key).replace(et,"$&/")+"/")+ue)),I.push(ce)),1;ue=0;var Ge=Z===""?".":Z+":";if(W(N))for(var Le=0;Le<N.length;Le++)Z=N[Le],ye=Ge+nt(Z,Le),ue+=U(Z,I,X,ye,ce);else if(Le=S(N),typeof Le=="function")for(N=Le.call(N),Le=0;!(Z=N.next()).done;)Z=Z.value,ye=Ge+nt(Z,Le++),ue+=U(Z,I,X,ye,ce);else if(ye==="object"){if(typeof N.then=="function")return U(Ue(N),I,X,Z,ce);throw I=String(N),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return ue}function H(N,I,X){if(N==null)return N;var Z=[],ce=0;return U(N,Z,"","",function(ye){return I.call(X,ye,ce++)}),Z}function K(N){if(N._status===-1){var I=N._result;I=I(),I.then(function(X){(N._status===0||N._status===-1)&&(N._status=1,N._result=X)},function(X){(N._status===0||N._status===-1)&&(N._status=2,N._result=X)}),N._status===-1&&(N._status=0,N._result=I)}if(N._status===1)return N._result.default;throw N._result}var Ee=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},_e={map:H,forEach:function(N,I,X){H(N,function(){I.apply(this,arguments)},X)},count:function(N){var I=0;return H(N,function(){I++}),I},toArray:function(N){return H(N,function(I){return I})||[]},only:function(N){if(!pe(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return ve.Activity=x,ve.Children=_e,ve.Component=O,ve.Fragment=r,ve.Profiler=c,ve.PureComponent=L,ve.StrictMode=l,ve.Suspense=p,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Y,ve.__COMPILER_RUNTIME={__proto__:null,c:function(N){return Y.H.useMemoCache(N)}},ve.cache=function(N){return function(){return N.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(N,I,X){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var Z=E({},N.props),ce=N.key;if(I!=null)for(ye in I.key!==void 0&&(ce=""+I.key),I)!J.call(I,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&I.ref===void 0||(Z[ye]=I[ye]);var ye=arguments.length-2;if(ye===1)Z.children=X;else if(1<ye){for(var ue=Array(ye),Ge=0;Ge<ye;Ge++)ue[Ge]=arguments[Ge+2];Z.children=ue}return fe(N.type,ce,Z)},ve.createContext=function(N){return N={$$typeof:h,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:d,_context:N},N},ve.createElement=function(N,I,X){var Z,ce={},ye=null;if(I!=null)for(Z in I.key!==void 0&&(ye=""+I.key),I)J.call(I,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(ce[Z]=I[Z]);var ue=arguments.length-2;if(ue===1)ce.children=X;else if(1<ue){for(var Ge=Array(ue),Le=0;Le<ue;Le++)Ge[Le]=arguments[Le+2];ce.children=Ge}if(N&&N.defaultProps)for(Z in ue=N.defaultProps,ue)ce[Z]===void 0&&(ce[Z]=ue[Z]);return fe(N,ye,ce)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(N){return{$$typeof:m,render:N}},ve.isValidElement=pe,ve.lazy=function(N){return{$$typeof:v,_payload:{_status:-1,_result:N},_init:K}},ve.memo=function(N,I){return{$$typeof:g,type:N,compare:I===void 0?null:I}},ve.startTransition=function(N){var I=Y.T,X={};Y.T=X;try{var Z=N(),ce=Y.S;ce!==null&&ce(X,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(Q,Ee)}catch(ye){Ee(ye)}finally{I!==null&&X.types!==null&&(I.types=X.types),Y.T=I}},ve.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},ve.use=function(N){return Y.H.use(N)},ve.useActionState=function(N,I,X){return Y.H.useActionState(N,I,X)},ve.useCallback=function(N,I){return Y.H.useCallback(N,I)},ve.useContext=function(N){return Y.H.useContext(N)},ve.useDebugValue=function(){},ve.useDeferredValue=function(N,I){return Y.H.useDeferredValue(N,I)},ve.useEffect=function(N,I){return Y.H.useEffect(N,I)},ve.useEffectEvent=function(N){return Y.H.useEffectEvent(N)},ve.useId=function(){return Y.H.useId()},ve.useImperativeHandle=function(N,I,X){return Y.H.useImperativeHandle(N,I,X)},ve.useInsertionEffect=function(N,I){return Y.H.useInsertionEffect(N,I)},ve.useLayoutEffect=function(N,I){return Y.H.useLayoutEffect(N,I)},ve.useMemo=function(N,I){return Y.H.useMemo(N,I)},ve.useOptimistic=function(N,I){return Y.H.useOptimistic(N,I)},ve.useReducer=function(N,I,X){return Y.H.useReducer(N,I,X)},ve.useRef=function(N){return Y.H.useRef(N)},ve.useState=function(N){return Y.H.useState(N)},ve.useSyncExternalStore=function(N,I,X){return Y.H.useSyncExternalStore(N,I,X)},ve.useTransition=function(){return Y.H.useTransition()},ve.version="19.2.3",ve}var ug;function Fd(){return ug||(ug=1,ld.exports=nx()),ld.exports}var w=Fd();const fy=Zd(w),Wd=ex({__proto__:null,default:fy},[w]);var od={exports:{}},xi={},cd={exports:{}},ud={};var dg;function sx(){return dg||(dg=1,(function(n){function a(U,H){var K=U.length;U.push(H);e:for(;0<K;){var Ee=K-1>>>1,_e=U[Ee];if(0<c(_e,H))U[Ee]=H,U[K]=_e,K=Ee;else break e}}function r(U){return U.length===0?null:U[0]}function l(U){if(U.length===0)return null;var H=U[0],K=U.pop();if(K!==H){U[0]=K;e:for(var Ee=0,_e=U.length,N=_e>>>1;Ee<N;){var I=2*(Ee+1)-1,X=U[I],Z=I+1,ce=U[Z];if(0>c(X,K))Z<_e&&0>c(ce,X)?(U[Ee]=ce,U[Z]=K,Ee=Z):(U[Ee]=X,U[I]=K,Ee=I);else if(Z<_e&&0>c(ce,K))U[Ee]=ce,U[Z]=K,Ee=Z;else break e}}return H}function c(U,H){var K=U.sortIndex-H.sortIndex;return K!==0?K:U.id-H.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,x=null,_=3,S=!1,A=!1,E=!1,k=!1,O=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function P(U){for(var H=r(g);H!==null;){if(H.callback===null)l(g);else if(H.startTime<=U)l(g),H.sortIndex=H.expirationTime,a(p,H);else break;H=r(g)}}function W(U){if(E=!1,P(U),!A)if(r(p)!==null)A=!0,Q||(Q=!0,ge());else{var H=r(g);H!==null&&Ue(W,H.startTime-U)}}var Q=!1,Y=-1,J=5,fe=-1;function Ie(){return k?!0:!(n.unstable_now()-fe<J)}function pe(){if(k=!1,Q){var U=n.unstable_now();fe=U;var H=!0;try{e:{A=!1,E&&(E=!1,q(Y),Y=-1),S=!0;var K=_;try{t:{for(P(U),x=r(p);x!==null&&!(x.expirationTime>U&&Ie());){var Ee=x.callback;if(typeof Ee=="function"){x.callback=null,_=x.priorityLevel;var _e=Ee(x.expirationTime<=U);if(U=n.unstable_now(),typeof _e=="function"){x.callback=_e,P(U),H=!0;break t}x===r(p)&&l(p),P(U)}else l(p);x=r(p)}if(x!==null)H=!0;else{var N=r(g);N!==null&&Ue(W,N.startTime-U),H=!1}}break e}finally{x=null,_=K,S=!1}H=void 0}}finally{H?ge():Q=!1}}}var ge;if(typeof L=="function")ge=function(){L(pe)};else if(typeof MessageChannel<"u"){var et=new MessageChannel,nt=et.port2;et.port1.onmessage=pe,ge=function(){nt.postMessage(null)}}else ge=function(){O(pe,0)};function Ue(U,H){Y=O(function(){U(n.unstable_now())},H)}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(U){U.callback=null},n.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<U?Math.floor(1e3/U):5},n.unstable_getCurrentPriorityLevel=function(){return _},n.unstable_next=function(U){switch(_){case 1:case 2:case 3:var H=3;break;default:H=_}var K=_;_=H;try{return U()}finally{_=K}},n.unstable_requestPaint=function(){k=!0},n.unstable_runWithPriority=function(U,H){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var K=_;_=U;try{return H()}finally{_=K}},n.unstable_scheduleCallback=function(U,H,K){var Ee=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Ee+K:Ee):K=Ee,U){case 1:var _e=-1;break;case 2:_e=250;break;case 5:_e=1073741823;break;case 4:_e=1e4;break;default:_e=5e3}return _e=K+_e,U={id:v++,callback:H,priorityLevel:U,startTime:K,expirationTime:_e,sortIndex:-1},K>Ee?(U.sortIndex=K,a(g,U),r(p)===null&&U===r(g)&&(E?(q(Y),Y=-1):E=!0,Ue(W,K-Ee))):(U.sortIndex=_e,a(p,U),A||S||(A=!0,Q||(Q=!0,ge()))),U},n.unstable_shouldYield=Ie,n.unstable_wrapCallback=function(U){var H=_;return function(){var K=_;_=H;try{return U.apply(this,arguments)}finally{_=K}}}})(ud)),ud}var fg;function rx(){return fg||(fg=1,cd.exports=sx()),cd.exports}var dd={exports:{}},Tt={};var hg;function ix(){if(hg)return Tt;hg=1;var n=Fd();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 x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:x==null?null:""+x,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 Tt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Tt.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)},Tt.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()}},Tt.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))},Tt.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},Tt.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var v=g.as,x=m(v,g.crossOrigin),_=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:x,integrity:_,fetchPriority:S}):v==="script"&&l.d.X(p,{crossOrigin:x,integrity:_,fetchPriority:S,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Tt.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)},Tt.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var v=g.as,x=m(v,g.crossOrigin);l.d.L(p,v,{crossOrigin:x,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})}},Tt.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)},Tt.requestFormReset=function(p){l.d.r(p)},Tt.unstable_batchedUpdates=function(p,g){return p(g)},Tt.useFormState=function(p,g,v){return h.H.useFormState(p,g,v)},Tt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Tt.version="19.2.3",Tt}var mg;function hy(){if(mg)return dd.exports;mg=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(),dd.exports=ix(),dd.exports}var pg;function lx(){if(pg)return xi;pg=1;var n=rx(),a=Fd(),r=hy();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 x=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),L=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),fe=Symbol.for("react.activity"),Ie=Symbol.for("react.memo_cache_sentinel"),pe=Symbol.iterator;function ge(e){return e===null||typeof e!="object"?null:(e=pe&&e[pe]||e["@@iterator"],typeof e=="function"?e:null)}var et=Symbol.for("react.client.reference");function nt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===et?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case O:return"Profiler";case k:return"StrictMode";case W:return"Suspense";case Q:return"SuspenseList";case fe:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case L:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case P:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Y:return t=e.displayName||null,t!==null?t:nt(e.type)||"Memo";case J:t=e._payload,e=e._init;try{return nt(e(t))}catch{}}return null}var Ue=Array.isArray,U=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Ee=[],_e=-1;function N(e){return{current:e}}function I(e){0>_e||(e.current=Ee[_e],Ee[_e]=null,_e--)}function X(e,t){_e++,Ee[_e]=e.current,e.current=t}var Z=N(null),ce=N(null),ye=N(null),ue=N(null);function Ge(e,t){switch(X(ye,t),X(ce,e),X(Z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?kp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=kp(t),e=Op(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}I(Z),X(Z,e)}function Le(){I(Z),I(ce),I(ye)}function Nt(e){e.memoizedState!==null&&X(ue,e);var t=Z.current,s=Op(t,e.type);t!==s&&(X(ce,e),X(Z,s))}function yt(e){ce.current===e&&(I(Z),I(ce)),ue.current===e&&(I(ue),pi._currentValue=K)}var Ot,Hi;function ia(e){if(Ot===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);Ot=t&&t[1]||"",Hi=-1<s.stack.indexOf(`
1
+ function ex(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 Zd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var id={exports:{}},xi={};var lg;function tx(){if(lg)return xi;lg=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 xi.Fragment=a,xi.jsx=r,xi.jsxs=r,xi}var og;function ax(){return og||(og=1,id.exports=tx()),id.exports}var o=ax(),ld={exports:{}},ve={};var cg;function nx(){if(cg)return ve;cg=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"),x=Symbol.for("react.activity"),_=Symbol.iterator;function S(N){return N===null||typeof N!="object"?null:(N=_&&N[_]||N["@@iterator"],typeof N=="function"?N:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,k={};function O(N,I,X){this.props=N,this.context=I,this.refs=k,this.updater=X||A}O.prototype.isReactComponent={},O.prototype.setState=function(N,I){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,I,"setState")},O.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function q(){}q.prototype=O.prototype;function B(N,I,X){this.props=N,this.context=I,this.refs=k,this.updater=X||A}var P=B.prototype=new q;P.constructor=B,E(P,O.prototype),P.isPureReactComponent=!0;var W=Array.isArray;function Q(){}var Y={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function fe(N,I,X){var Z=X.ref;return{$$typeof:n,type:N,key:I,ref:Z!==void 0?Z:null,props:X}}function Ge(N,I){return fe(N.type,I,N.props)}function pe(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function ge(N){var I={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(X){return I[X]})}var et=/\/+/g;function nt(N,I){return typeof N=="object"&&N!==null&&N.key!=null?ge(""+N.key):I.toString(36)}function Le(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(Q,Q):(N.status="pending",N.then(function(I){N.status==="pending"&&(N.status="fulfilled",N.value=I)},function(I){N.status==="pending"&&(N.status="rejected",N.reason=I)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function L(N,I,X,Z,ce){var ye=typeof N;(ye==="undefined"||ye==="boolean")&&(N=null);var ue=!1;if(N===null)ue=!0;else switch(ye){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(N.$$typeof){case n:case a:ue=!0;break;case v:return ue=N._init,L(ue(N._payload),I,X,Z,ce)}}if(ue)return ce=ce(N),ue=Z===""?"."+nt(N,0):Z,W(ce)?(X="",ue!=null&&(X=ue.replace(et,"$&/")+"/"),L(ce,I,X,"",function(Tt){return Tt})):ce!=null&&(pe(ce)&&(ce=Ge(ce,X+(ce.key==null||N&&N.key===ce.key?"":(""+ce.key).replace(et,"$&/")+"/")+ue)),I.push(ce)),1;ue=0;var Pe=Z===""?".":Z+":";if(W(N))for(var Be=0;Be<N.length;Be++)Z=N[Be],ye=Pe+nt(Z,Be),ue+=L(Z,I,X,ye,ce);else if(Be=S(N),typeof Be=="function")for(N=Be.call(N),Be=0;!(Z=N.next()).done;)Z=Z.value,ye=Pe+nt(Z,Be++),ue+=L(Z,I,X,ye,ce);else if(ye==="object"){if(typeof N.then=="function")return L(Le(N),I,X,Z,ce);throw I=String(N),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return ue}function H(N,I,X){if(N==null)return N;var Z=[],ce=0;return L(N,Z,"","",function(ye){return I.call(X,ye,ce++)}),Z}function K(N){if(N._status===-1){var I=N._result;I=I(),I.then(function(X){(N._status===0||N._status===-1)&&(N._status=1,N._result=X)},function(X){(N._status===0||N._status===-1)&&(N._status=2,N._result=X)}),N._status===-1&&(N._status=0,N._result=I)}if(N._status===1)return N._result.default;throw N._result}var Ee=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},_e={map:H,forEach:function(N,I,X){H(N,function(){I.apply(this,arguments)},X)},count:function(N){var I=0;return H(N,function(){I++}),I},toArray:function(N){return H(N,function(I){return I})||[]},only:function(N){if(!pe(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return ve.Activity=x,ve.Children=_e,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=Y,ve.__COMPILER_RUNTIME={__proto__:null,c:function(N){return Y.H.useMemoCache(N)}},ve.cache=function(N){return function(){return N.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(N,I,X){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var Z=E({},N.props),ce=N.key;if(I!=null)for(ye in I.key!==void 0&&(ce=""+I.key),I)!J.call(I,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&I.ref===void 0||(Z[ye]=I[ye]);var ye=arguments.length-2;if(ye===1)Z.children=X;else if(1<ye){for(var ue=Array(ye),Pe=0;Pe<ye;Pe++)ue[Pe]=arguments[Pe+2];Z.children=ue}return fe(N.type,ce,Z)},ve.createContext=function(N){return N={$$typeof:h,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:d,_context:N},N},ve.createElement=function(N,I,X){var Z,ce={},ye=null;if(I!=null)for(Z in I.key!==void 0&&(ye=""+I.key),I)J.call(I,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(ce[Z]=I[Z]);var ue=arguments.length-2;if(ue===1)ce.children=X;else if(1<ue){for(var Pe=Array(ue),Be=0;Be<ue;Be++)Pe[Be]=arguments[Be+2];ce.children=Pe}if(N&&N.defaultProps)for(Z in ue=N.defaultProps,ue)ce[Z]===void 0&&(ce[Z]=ue[Z]);return fe(N,ye,ce)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(N){return{$$typeof:m,render:N}},ve.isValidElement=pe,ve.lazy=function(N){return{$$typeof:v,_payload:{_status:-1,_result:N},_init:K}},ve.memo=function(N,I){return{$$typeof:g,type:N,compare:I===void 0?null:I}},ve.startTransition=function(N){var I=Y.T,X={};Y.T=X;try{var Z=N(),ce=Y.S;ce!==null&&ce(X,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(Q,Ee)}catch(ye){Ee(ye)}finally{I!==null&&X.types!==null&&(I.types=X.types),Y.T=I}},ve.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},ve.use=function(N){return Y.H.use(N)},ve.useActionState=function(N,I,X){return Y.H.useActionState(N,I,X)},ve.useCallback=function(N,I){return Y.H.useCallback(N,I)},ve.useContext=function(N){return Y.H.useContext(N)},ve.useDebugValue=function(){},ve.useDeferredValue=function(N,I){return Y.H.useDeferredValue(N,I)},ve.useEffect=function(N,I){return Y.H.useEffect(N,I)},ve.useEffectEvent=function(N){return Y.H.useEffectEvent(N)},ve.useId=function(){return Y.H.useId()},ve.useImperativeHandle=function(N,I,X){return Y.H.useImperativeHandle(N,I,X)},ve.useInsertionEffect=function(N,I){return Y.H.useInsertionEffect(N,I)},ve.useLayoutEffect=function(N,I){return Y.H.useLayoutEffect(N,I)},ve.useMemo=function(N,I){return Y.H.useMemo(N,I)},ve.useOptimistic=function(N,I){return Y.H.useOptimistic(N,I)},ve.useReducer=function(N,I,X){return Y.H.useReducer(N,I,X)},ve.useRef=function(N){return Y.H.useRef(N)},ve.useState=function(N){return Y.H.useState(N)},ve.useSyncExternalStore=function(N,I,X){return Y.H.useSyncExternalStore(N,I,X)},ve.useTransition=function(){return Y.H.useTransition()},ve.version="19.2.3",ve}var ug;function Fd(){return ug||(ug=1,ld.exports=nx()),ld.exports}var w=Fd();const fy=Zd(w),Wd=ex({__proto__:null,default:fy},[w]);var od={exports:{}},wi={},cd={exports:{}},ud={};var dg;function sx(){return dg||(dg=1,(function(n){function a(L,H){var K=L.length;L.push(H);e:for(;0<K;){var Ee=K-1>>>1,_e=L[Ee];if(0<c(_e,H))L[Ee]=H,L[K]=_e,K=Ee;else break e}}function r(L){return L.length===0?null:L[0]}function l(L){if(L.length===0)return null;var H=L[0],K=L.pop();if(K!==H){L[0]=K;e:for(var Ee=0,_e=L.length,N=_e>>>1;Ee<N;){var I=2*(Ee+1)-1,X=L[I],Z=I+1,ce=L[Z];if(0>c(X,K))Z<_e&&0>c(ce,X)?(L[Ee]=ce,L[Z]=K,Ee=Z):(L[Ee]=X,L[I]=K,Ee=I);else if(Z<_e&&0>c(ce,K))L[Ee]=ce,L[Z]=K,Ee=Z;else break e}}return H}function c(L,H){var K=L.sortIndex-H.sortIndex;return K!==0?K:L.id-H.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,x=null,_=3,S=!1,A=!1,E=!1,k=!1,O=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function P(L){for(var H=r(g);H!==null;){if(H.callback===null)l(g);else if(H.startTime<=L)l(g),H.sortIndex=H.expirationTime,a(p,H);else break;H=r(g)}}function W(L){if(E=!1,P(L),!A)if(r(p)!==null)A=!0,Q||(Q=!0,ge());else{var H=r(g);H!==null&&Le(W,H.startTime-L)}}var Q=!1,Y=-1,J=5,fe=-1;function Ge(){return k?!0:!(n.unstable_now()-fe<J)}function pe(){if(k=!1,Q){var L=n.unstable_now();fe=L;var H=!0;try{e:{A=!1,E&&(E=!1,q(Y),Y=-1),S=!0;var K=_;try{t:{for(P(L),x=r(p);x!==null&&!(x.expirationTime>L&&Ge());){var Ee=x.callback;if(typeof Ee=="function"){x.callback=null,_=x.priorityLevel;var _e=Ee(x.expirationTime<=L);if(L=n.unstable_now(),typeof _e=="function"){x.callback=_e,P(L),H=!0;break t}x===r(p)&&l(p),P(L)}else l(p);x=r(p)}if(x!==null)H=!0;else{var N=r(g);N!==null&&Le(W,N.startTime-L),H=!1}}break e}finally{x=null,_=K,S=!1}H=void 0}}finally{H?ge():Q=!1}}}var ge;if(typeof B=="function")ge=function(){B(pe)};else if(typeof MessageChannel<"u"){var et=new MessageChannel,nt=et.port2;et.port1.onmessage=pe,ge=function(){nt.postMessage(null)}}else ge=function(){O(pe,0)};function Le(L,H){Y=O(function(){L(n.unstable_now())},H)}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(L){L.callback=null},n.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<L?Math.floor(1e3/L):5},n.unstable_getCurrentPriorityLevel=function(){return _},n.unstable_next=function(L){switch(_){case 1:case 2:case 3:var H=3;break;default:H=_}var K=_;_=H;try{return L()}finally{_=K}},n.unstable_requestPaint=function(){k=!0},n.unstable_runWithPriority=function(L,H){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var K=_;_=L;try{return H()}finally{_=K}},n.unstable_scheduleCallback=function(L,H,K){var Ee=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Ee+K:Ee):K=Ee,L){case 1:var _e=-1;break;case 2:_e=250;break;case 5:_e=1073741823;break;case 4:_e=1e4;break;default:_e=5e3}return _e=K+_e,L={id:v++,callback:H,priorityLevel:L,startTime:K,expirationTime:_e,sortIndex:-1},K>Ee?(L.sortIndex=K,a(g,L),r(p)===null&&L===r(g)&&(E?(q(Y),Y=-1):E=!0,Le(W,K-Ee))):(L.sortIndex=_e,a(p,L),A||S||(A=!0,Q||(Q=!0,ge()))),L},n.unstable_shouldYield=Ge,n.unstable_wrapCallback=function(L){var H=_;return function(){var K=_;_=H;try{return L.apply(this,arguments)}finally{_=K}}}})(ud)),ud}var fg;function rx(){return fg||(fg=1,cd.exports=sx()),cd.exports}var dd={exports:{}},At={};var hg;function ix(){if(hg)return At;hg=1;var n=Fd();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 x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:x==null?null:""+x,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,x=m(v,g.crossOrigin),_=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:x,integrity:_,fetchPriority:S}):v==="script"&&l.d.X(p,{crossOrigin:x,integrity:_,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,x=m(v,g.crossOrigin);l.d.L(p,v,{crossOrigin:x,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 mg;function hy(){if(mg)return dd.exports;mg=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(),dd.exports=ix(),dd.exports}var pg;function lx(){if(pg)return wi;pg=1;var n=rx(),a=Fd(),r=hy();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 x=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),E=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"),P=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),fe=Symbol.for("react.activity"),Ge=Symbol.for("react.memo_cache_sentinel"),pe=Symbol.iterator;function ge(e){return e===null||typeof e!="object"?null:(e=pe&&e[pe]||e["@@iterator"],typeof e=="function"?e:null)}var et=Symbol.for("react.client.reference");function nt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===et?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case O:return"Profiler";case k:return"StrictMode";case W:return"Suspense";case Q:return"SuspenseList";case fe: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 P:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Y:return t=e.displayName||null,t!==null?t:nt(e.type)||"Memo";case J:t=e._payload,e=e._init;try{return nt(e(t))}catch{}}return null}var Le=Array.isArray,L=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Ee=[],_e=-1;function N(e){return{current:e}}function I(e){0>_e||(e.current=Ee[_e],Ee[_e]=null,_e--)}function X(e,t){_e++,Ee[_e]=e.current,e.current=t}var Z=N(null),ce=N(null),ye=N(null),ue=N(null);function Pe(e,t){switch(X(ye,t),X(ce,e),X(Z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?kp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=kp(t),e=Op(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}I(Z),X(Z,e)}function Be(){I(Z),I(ce),I(ye)}function Tt(e){e.memoizedState!==null&&X(ue,e);var t=Z.current,s=Op(t,e.type);t!==s&&(X(ce,e),X(Z,s))}function yt(e){ce.current===e&&(I(Z),I(ce)),ue.current===e&&(I(ue),gi._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
2
  at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Ot+e+Hi}var os=!1;function cs(e,t){if(!e||os)return"";os=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var G=function(){throw Error()};if(Object.defineProperty(G.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(G,[])}catch(z){var M=z}Reflect.construct(e,[],G)}else{try{G.call()}catch(z){M=z}e.call(G.prototype)}}else{try{throw Error()}catch(z){M=z}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(z){if(z&&M&&typeof z.stack=="string")return[z.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 j=y.split(`
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 G=function(){throw Error()};if(Object.defineProperty(G.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(G,[])}catch(U){var M=U}Reflect.construct(e,[],G)}else{try{G.call()}catch(U){M=U}e.call(G.prototype)}}else{try{throw Error()}catch(U){M=U}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(U){if(U&&M&&typeof U.stack=="string")return[U.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 j=y.split(`
4
4
  `),D=b.split(`
5
5
  `);for(u=i=0;i<j.length&&!j[i].includes("DetermineComponentFrameRoot");)i++;for(;u<D.length&&!D[u].includes("DetermineComponentFrameRoot");)u++;if(i===j.length||u===D.length)for(i=j.length-1,u=D.length-1;1<=i&&0<=u&&j[i]!==D[u];)u--;for(;1<=i&&0<=u;i--,u--)if(j[i]!==D[u]){if(i!==1||u!==1)do if(i--,u--,0>u||j[i]!==D[u]){var $=`
6
- `+j[i].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=i&&0<=u);break}}}finally{os=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?ia(s):""}function Vi(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 cs(e.type,!1);case 11:return cs(e.type.render,!1);case 1:return cs(e.type,!0);case 31:return ia("Activity");default:return""}}function Ar(e){try{var t="",s=null;do t+=Vi(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
6
+ `+j[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 Vi(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 Cr(e){try{var t="",s=null;do t+=Vi(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
7
7
  Error generating stack: `+i.message+`
8
- `+i.stack}}var Rn=Object.prototype.hasOwnProperty,en=n.unstable_scheduleCallback,us=n.unstable_cancelCallback,Ii=n.unstable_shouldYield,Gi=n.unstable_requestPaint,mt=n.unstable_now,ds=n.unstable_getCurrentPriorityLevel,Pi=n.unstable_ImmediatePriority,Ki=n.unstable_UserBlockingPriority,fs=n.unstable_NormalPriority,Go=n.unstable_LowPriority,Yi=n.unstable_IdlePriority,Po=n.log,Ko=n.unstable_setDisableYieldValue,Dn=null,At=null;function pa(e){if(typeof Po=="function"&&Ko(e),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(Dn,e)}catch{}}var Ct=Math.clz32?Math.clz32:Jo,Yo=Math.log,Ji=Math.LN2;function Jo(e){return e>>>=0,e===0?32:31-(Yo(e)/Ji|0)|0}var hs=256,ms=262144,ps=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 B(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 re(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ke(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=ps;return ps<<=1,(ps&62914560)===0&&(ps=4194304),e}function Cr(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 gs(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,j=e.expirationTimes,D=e.hiddenUpdates;for(s=y&~s;0<s;){var $=31-Ct(s),G=1<<$;b[$]=0,j[$]=-1;var M=D[$];if(M!==null)for(D[$]=null,$=0;$<M.length;$++){var z=M[$];z!==null&&(z.lane&=-536870913)}s&=~G}i!==0&&Xi(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function Xi(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ct(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|s&261930}function Qi(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-Ct(s),u=1<<i;u&t|e[i]&t&&(e[i]|=t),s&=~u}}function mf(e,t){var s=t&-t;return s=(s&42)!==0?1:Xo(s),(s&(e.suspendedLanes|t))!==0?0:s}function Xo(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 Qo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function pf(){var e=H.p;return e!==0?e:(e=window.event,e===void 0?32:eg(e.type))}function gf(e,t){var s=H.p;try{return H.p=e,t()}finally{H.p=s}}var an=Math.random().toString(36).slice(2),vt="__reactFiber$"+an,Rt="__reactProps$"+an,ys="__reactContainer$"+an,Zo="__reactEvents$"+an,Iv="__reactListeners$"+an,Gv="__reactHandles$"+an,yf="__reactResources$"+an,kr="__reactMarker$"+an;function Fo(e){delete e[vt],delete e[Rt],delete e[Zo],delete e[Iv],delete e[Gv]}function vs(e){var t=e[vt];if(t)return t;for(var s=e.parentNode;s;){if(t=s[ys]||s[vt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=Bp(e);e!==null;){if(s=e[vt])return s;e=Bp(e)}return t}e=s,s=e.parentNode}return null}function bs(e){if(e=e[vt]||e[ys]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Or(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function xs(e){var t=e[yf];return t||(t=e[yf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pt(e){e[kr]=!0}var vf=new Set,bf={};function Mn(e,t){ws(e,t),ws(e+"Capture",t)}function ws(e,t){for(bf[e]=t,e=0;e<t.length;e++)vf.add(t[e])}var Pv=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]*$"),xf={},wf={};function Kv(e){return Rn.call(wf,e)?!0:Rn.call(xf,e)?!1:Pv.test(e)?wf[e]=!0:(xf[e]=!0,!1)}function Zi(e,t,s){if(Kv(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 Fi(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 Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _f(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Yv(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 Wo(e){if(!e._valueTracker){var t=_f(e)?"checked":"value";e._valueTracker=Yv(e,t,""+e[t])}}function Sf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=_f(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}function Wi(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 Jv=/[\n"\\]/g;function Qt(e){return e.replace(Jv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ec(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=""+Xt(t)):e.value!==""+Xt(t)&&(e.value=""+Xt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?tc(e,y,Xt(t)):s!=null?tc(e,y,Xt(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=""+Xt(b):e.removeAttribute("name")}function jf(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)){Wo(e);return}s=s!=null?""+Xt(s):"",t=t!=null?""+Xt(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),Wo(e)}function tc(e,t,s){t==="number"&&Wi(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function _s(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=""+Xt(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=""+Xt(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Xt(s):""}function Nf(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(l(92));if(Ue(i)){if(1<i.length)throw Error(l(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=Xt(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),Wo(e)}function Ss(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Xv=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 Tf(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||Xv.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Af(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&&Tf(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&Tf(e,f,t[f])}function ac(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 Qv=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"]]),Zv=/^[\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 el(e){return Zv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ka(){}var nc=null;function sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var js=null,Es=null;function Cf(e){var t=bs(e);if(t&&(e=t.stateNode)){var s=e[Rt]||null;e:switch(e=t.stateNode,t.type){case"input":if(ec(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="'+Qt(""+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));ec(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&&Sf(i)}break e;case"textarea":Ef(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&_s(e,!!s.multiple,t,!1)}}}var rc=!1;function kf(e,t,s){if(rc)return e(t,s);rc=!0;try{var i=e(t);return i}finally{if(rc=!1,(js!==null||Es!==null)&&(Hl(),js&&(t=js,e=Es,Es=js=null,Cf(t),e)))for(t=0;t<e.length;t++)Cf(e[t])}}function Rr(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"),ic=!1;if(Oa)try{var Dr={};Object.defineProperty(Dr,"passive",{get:function(){ic=!0}}),window.addEventListener("test",Dr,Dr),window.removeEventListener("test",Dr,Dr)}catch{ic=!1}var nn=null,lc=null,tl=null;function Of(){if(tl)return tl;var e,t=lc,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 tl=u.slice(e,1<i?1-i:void 0)}function al(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 nl(){return!0}function Rf(){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)?nl:Rf,this.isPropagationStopped=Rf,this}return x(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=nl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=nl)},persist:function(){},isPersistent:nl}),t}var zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sl=Dt(zn),Mr=x({},zn,{view:0,detail:0}),Fv=Dt(Mr),oc,cc,zr,rl=x({},Mr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dc,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!==zr&&(zr&&e.type==="mousemove"?(oc=e.screenX-zr.screenX,cc=e.screenY-zr.screenY):cc=oc=0,zr=e),oc)},movementY:function(e){return"movementY"in e?e.movementY:cc}}),Df=Dt(rl),Wv=x({},rl,{dataTransfer:0}),e0=Dt(Wv),t0=x({},Mr,{relatedTarget:0}),uc=Dt(t0),a0=x({},zn,{animationName:0,elapsedTime:0,pseudoElement:0}),n0=Dt(a0),s0=x({},zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),r0=Dt(s0),i0=x({},zn,{data:0}),Mf=Dt(i0),l0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},o0={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"},c0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function u0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=c0[e])?!!t[e]:!1}function dc(){return u0}var d0=x({},Mr,{key:function(e){if(e.key){var t=l0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=al(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?o0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dc,charCode:function(e){return e.type==="keypress"?al(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?al(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),f0=Dt(d0),h0=x({},rl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zf=Dt(h0),m0=x({},Mr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dc}),p0=Dt(m0),g0=x({},zn,{propertyName:0,elapsedTime:0,pseudoElement:0}),y0=Dt(g0),v0=x({},rl,{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}),b0=Dt(v0),x0=x({},zn,{newState:0,oldState:0}),w0=Dt(x0),_0=[9,13,27,32],fc=Oa&&"CompositionEvent"in window,Ur=null;Oa&&"documentMode"in document&&(Ur=document.documentMode);var S0=Oa&&"TextEvent"in window&&!Ur,Uf=Oa&&(!fc||Ur&&8<Ur&&11>=Ur),Lf=" ",Bf=!1;function qf(e,t){switch(e){case"keyup":return _0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $f(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ns=!1;function j0(e,t){switch(e){case"compositionend":return $f(t);case"keypress":return t.which!==32?null:(Bf=!0,Lf);case"textInput":return e=t.data,e===Lf&&Bf?null:e;default:return null}}function E0(e,t){if(Ns)return e==="compositionend"||!fc&&qf(e,t)?(e=Of(),tl=lc=nn=null,Ns=!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 Uf&&t.locale!=="ko"?null:t.data;default:return null}}var N0={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 Hf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!N0[e.type]:t==="textarea"}function Vf(e,t,s,i){js?Es?Es.push(i):Es=[i]:js=i,t=Jl(t,"onChange"),0<t.length&&(s=new sl("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var Lr=null,Br=null;function T0(e){jp(e,0)}function il(e){var t=Or(e);if(Sf(t))return e}function If(e,t){if(e==="change")return t}var Gf=!1;if(Oa){var hc;if(Oa){var mc="oninput"in document;if(!mc){var Pf=document.createElement("div");Pf.setAttribute("oninput","return;"),mc=typeof Pf.oninput=="function"}hc=mc}else hc=!1;Gf=hc&&(!document.documentMode||9<document.documentMode)}function Kf(){Lr&&(Lr.detachEvent("onpropertychange",Yf),Br=Lr=null)}function Yf(e){if(e.propertyName==="value"&&il(Br)){var t=[];Vf(t,Br,e,sc(e)),kf(T0,t)}}function A0(e,t,s){e==="focusin"?(Kf(),Lr=t,Br=s,Lr.attachEvent("onpropertychange",Yf)):e==="focusout"&&Kf()}function C0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return il(Br)}function k0(e,t){if(e==="click")return il(t)}function O0(e,t){if(e==="input"||e==="change")return il(t)}function R0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qt=typeof Object.is=="function"?Object.is:R0;function qr(e,t){if(qt(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)||!qt(e[u],t[u]))return!1}return!0}function Jf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xf(e,t){var s=Jf(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=Jf(s)}}function Qf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Wi(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=Wi(e.document)}return t}function pc(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 D0=Oa&&"documentMode"in document&&11>=document.documentMode,Ts=null,gc=null,$r=null,yc=!1;function Ff(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;yc||Ts==null||Ts!==Wi(i)||(i=Ts,"selectionStart"in i&&pc(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}),$r&&qr($r,i)||($r=i,i=Jl(gc,"onSelect"),0<i.length&&(t=new sl("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=Ts)))}function Un(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var As={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")},vc={},Wf={};Oa&&(Wf=document.createElement("div").style,"AnimationEvent"in window||(delete As.animationend.animation,delete As.animationiteration.animation,delete As.animationstart.animation),"TransitionEvent"in window||delete As.transitionend.transition);function Ln(e){if(vc[e])return vc[e];if(!As[e])return e;var t=As[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Wf)return vc[e]=t[s];return e}var eh=Ln("animationend"),th=Ln("animationiteration"),ah=Ln("animationstart"),M0=Ln("transitionrun"),z0=Ln("transitionstart"),U0=Ln("transitioncancel"),nh=Ln("transitionend"),sh=new Map,bc="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(" ");bc.push("scrollEnd");function la(e,t){sh.set(e,t),Mn(t,[e])}var ll=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)},Zt=[],Cs=0,xc=0;function ol(){for(var e=Cs,t=xc=Cs=0;t<e;){var s=Zt[t];Zt[t++]=null;var i=Zt[t];Zt[t++]=null;var u=Zt[t];Zt[t++]=null;var f=Zt[t];if(Zt[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&&rh(s,u,f)}}function cl(e,t,s,i){Zt[Cs++]=e,Zt[Cs++]=t,Zt[Cs++]=s,Zt[Cs++]=i,xc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function wc(e,t,s,i){return cl(e,t,s,i),ul(e)}function Bn(e,t){return cl(e,null,null,t),ul(e)}function rh(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-Ct(s),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=s|536870912),f):null}function ul(e){if(50<oi)throw oi=0,ku=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ks={};function L0(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 $t(e,t,s,i){return new L0(e,t,s,i)}function _c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ra(e,t){var s=e.alternate;return s===null?(s=$t(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 ih(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 dl(e,t,s,i,u,f){var y=0;if(i=e,typeof e=="function")_c(e)&&(y=1);else if(typeof e=="string")y=Vb(e,s,Z.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case fe:return e=$t(31,s,t,u),e.elementType=fe,e.lanes=f,e;case E:return qn(s.children,u,f,t);case k:y=8,u|=24;break;case O:return e=$t(12,s,t,u|2),e.elementType=O,e.lanes=f,e;case W:return e=$t(13,s,t,u),e.elementType=W,e.lanes=f,e;case Q:return e=$t(19,s,t,u),e.elementType=Q,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case L:y=10;break e;case q:y=9;break e;case P:y=11;break e;case Y:y=14;break e;case J:y=16,i=null;break e}y=29,s=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=$t(y,s,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function qn(e,t,s,i){return e=$t(7,e,i,t),e.lanes=s,e}function Sc(e,t,s){return e=$t(6,e,null,t),e.lanes=s,e}function lh(e){var t=$t(18,null,null,0);return t.stateNode=e,t}function jc(e,t,s){return t=$t(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var oh=new WeakMap;function Ft(e,t){if(typeof e=="object"&&e!==null){var s=oh.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Ar(t)},oh.set(e,t),t)}return{value:e,source:t,stack:Ar(t)}}var Os=[],Rs=0,fl=null,Hr=0,Wt=[],ea=0,sn=null,ya=1,va="";function Da(e,t){Os[Rs++]=Hr,Os[Rs++]=fl,fl=e,Hr=t}function ch(e,t,s){Wt[ea++]=ya,Wt[ea++]=va,Wt[ea++]=sn,sn=e;var i=ya;e=va;var u=32-Ct(i)-1;i&=~(1<<u),s+=1;var f=32-Ct(t)+u;if(30<f){var y=u-u%5;f=(i&(1<<y)-1).toString(32),i>>=y,u-=y,ya=1<<32-Ct(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),ch(e,1,0))}function Nc(e){for(;e===fl;)fl=Os[--Rs],Os[Rs]=null,Hr=Os[--Rs],Os[Rs]=null;for(;e===sn;)sn=Wt[--ea],Wt[ea]=null,va=Wt[--ea],Wt[ea]=null,ya=Wt[--ea],Wt[ea]=null}function uh(e,t){Wt[ea++]=ya,Wt[ea++]=va,Wt[ea++]=sn,ya=t.id,va=t.overflow,sn=e}var bt=null,Ye=null,Ce=!1,rn=null,ta=!1,Tc=Error(l(519));function ln(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vr(Ft(t,e)),Tc}function dh(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[vt]=e,t[Rt]=i,s){case"dialog":je("cancel",t),je("close",t);break;case"iframe":case"object":case"embed":je("load",t);break;case"video":case"audio":for(s=0;s<ui.length;s++)je(ui[s],t);break;case"source":je("error",t);break;case"img":case"image":case"link":je("error",t),je("load",t);break;case"details":je("toggle",t);break;case"input":je("invalid",t),jf(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":je("invalid",t);break;case"textarea":je("invalid",t),Nf(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||Ap(t.textContent,s)?(i.popover!=null&&(je("beforetoggle",t),je("toggle",t)),i.onScroll!=null&&je("scroll",t),i.onScrollEnd!=null&&je("scrollend",t),i.onClick!=null&&(t.onclick=ka),t=!0):t=!1,t||ln(e,!0)}function fh(e){for(bt=e.return;bt;)switch(bt.tag){case 5:case 31:case 13:ta=!1;return;case 27:case 3:ta=!0;return;default:bt=bt.return}}function Ds(e){if(e!==bt)return!1;if(!Ce)return fh(e),Ce=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Pu(e.type,e.memoizedProps)),s=!s),s&&Ye&&ln(e),fh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ye=Lp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ye=Lp(e)}else t===27?(t=Ye,wn(e.type)?(e=Qu,Qu=null,Ye=e):Ye=t):Ye=bt?na(e.stateNode.nextSibling):null;return!0}function $n(){Ye=bt=null,Ce=!1}function Ac(){var e=rn;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),rn=null),e}function Vr(e){rn===null?rn=[e]:rn.push(e)}var Cc=N(null),Hn=null,Ma=null;function on(e,t,s){X(Cc,t._currentValue),t._currentValue=s}function za(e){e._currentValue=Cc.current,I(Cc)}function kc(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 Oc(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 j=0;j<t.length;j++)if(b.context===t[j]){f.lanes|=s,b=f.alternate,b!==null&&(b.lanes|=s),kc(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),kc(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 Ms(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;qt(u.pendingProps.value,y.value)||(e!==null?e.push(b):e=[b])}}else if(u===ue.current){if(y=u.alternate,y===null)throw Error(l(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(pi):e=[pi])}u=u.return}e!==null&&Oc(t,e,s,i),t.flags|=262144}function hl(e){for(e=e.firstContext;e!==null;){if(!qt(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 xt(e){return hh(Hn,e)}function ml(e,t){return Hn===null&&Vn(e),hh(e,t)}function hh(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 B0=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()})}},q0=n.unstable_scheduleCallback,$0=n.unstable_NormalPriority,st={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Rc(){return{controller:new B0,data:new Map,refCount:0}}function Ir(e){e.refCount--,e.refCount===0&&q0($0,function(){e.controller.abort()})}var Gr=null,Dc=0,zs=0,Us=null;function H0(e,t){if(Gr===null){var s=Gr=[];Dc=0,zs=Uu(),Us={status:"pending",value:void 0,then:function(i){s.push(i)}}}return Dc++,t.then(mh,mh),t}function mh(){if(--Dc===0&&Gr!==null){Us!==null&&(Us.status="fulfilled");var e=Gr;Gr=null,zs=0,Us=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function V0(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 ph=U.S;U.S=function(e,t){Fm=mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&H0(e,t),ph!==null&&ph(e,t)};var In=N(null);function Mc(){var e=In.current;return e!==null?e:Ve.pooledCache}function pl(e,t){t===null?X(In,In.current):X(In,t.pool)}function gh(){var e=Mc();return e===null?null:{parent:st._currentValue,pool:e}}var Ls=Error(l(460)),zc=Error(l(474)),gl=Error(l(542)),yl={then:function(){}};function yh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function vh(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,xh(e),e;default:if(typeof t.status=="string")t.then(ka,ka);else{if(e=Ve,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,xh(e),e}throw Pn=t,Ls}}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,Ls):s}}var Pn=null;function bh(){if(Pn===null)throw Error(l(459));var e=Pn;return Pn=null,e}function xh(e){if(e===Ls||e===gl)throw Error(l(483))}var Bs=null,Pr=0;function vl(e){var t=Pr;return Pr+=1,Bs===null&&(Bs=[]),vh(Bs,e,t)}function Kr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function bl(e,t){throw t.$$typeof===_?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function wh(e){function t(C,T){if(e){var R=C.deletions;R===null?(C.deletions=[T],C.flags|=16):R.push(T)}}function s(C,T){if(!e)return null;for(;T!==null;)t(C,T),T=T.sibling;return null}function i(C){for(var T=new Map;C!==null;)C.key!==null?T.set(C.key,C):T.set(C.index,C),C=C.sibling;return T}function u(C,T){return C=Ra(C,T),C.index=0,C.sibling=null,C}function f(C,T,R){return C.index=R,e?(R=C.alternate,R!==null?(R=R.index,R<T?(C.flags|=67108866,T):R):(C.flags|=67108866,T)):(C.flags|=1048576,T)}function y(C){return e&&C.alternate===null&&(C.flags|=67108866),C}function b(C,T,R,V){return T===null||T.tag!==6?(T=Sc(R,C.mode,V),T.return=C,T):(T=u(T,R),T.return=C,T)}function j(C,T,R,V){var oe=R.type;return oe===E?$(C,T,R.props.children,V,R.key):T!==null&&(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===J&&Gn(oe)===T.type)?(T=u(T,R.props),Kr(T,R),T.return=C,T):(T=dl(R.type,R.key,R.props,null,C.mode,V),Kr(T,R),T.return=C,T)}function D(C,T,R,V){return T===null||T.tag!==4||T.stateNode.containerInfo!==R.containerInfo||T.stateNode.implementation!==R.implementation?(T=jc(R,C.mode,V),T.return=C,T):(T=u(T,R.children||[]),T.return=C,T)}function $(C,T,R,V,oe){return T===null||T.tag!==7?(T=qn(R,C.mode,V,oe),T.return=C,T):(T=u(T,R),T.return=C,T)}function G(C,T,R){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=Sc(""+T,C.mode,R),T.return=C,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case S:return R=dl(T.type,T.key,T.props,null,C.mode,R),Kr(R,T),R.return=C,R;case A:return T=jc(T,C.mode,R),T.return=C,T;case J:return T=Gn(T),G(C,T,R)}if(Ue(T)||ge(T))return T=qn(T,C.mode,R,null),T.return=C,T;if(typeof T.then=="function")return G(C,vl(T),R);if(T.$$typeof===L)return G(C,ml(C,T),R);bl(C,T)}return null}function M(C,T,R,V){var oe=T!==null?T.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return oe!==null?null:b(C,T,""+R,V);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return R.key===oe?j(C,T,R,V):null;case A:return R.key===oe?D(C,T,R,V):null;case J:return R=Gn(R),M(C,T,R,V)}if(Ue(R)||ge(R))return oe!==null?null:$(C,T,R,V,null);if(typeof R.then=="function")return M(C,T,vl(R),V);if(R.$$typeof===L)return M(C,T,ml(C,R),V);bl(C,R)}return null}function z(C,T,R,V,oe){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return C=C.get(R)||null,b(T,C,""+V,oe);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return C=C.get(V.key===null?R:V.key)||null,j(T,C,V,oe);case A:return C=C.get(V.key===null?R:V.key)||null,D(T,C,V,oe);case J:return V=Gn(V),z(C,T,R,V,oe)}if(Ue(V)||ge(V))return C=C.get(R)||null,$(T,C,V,oe,null);if(typeof V.then=="function")return z(C,T,R,vl(V),oe);if(V.$$typeof===L)return z(C,T,R,ml(T,V),oe);bl(T,V)}return null}function ee(C,T,R,V){for(var oe=null,Oe=null,se=T,xe=T=0,Te=null;se!==null&&xe<R.length;xe++){se.index>xe?(Te=se,se=null):Te=se.sibling;var Re=M(C,se,R[xe],V);if(Re===null){se===null&&(se=Te);break}e&&se&&Re.alternate===null&&t(C,se),T=f(Re,T,xe),Oe===null?oe=Re:Oe.sibling=Re,Oe=Re,se=Te}if(xe===R.length)return s(C,se),Ce&&Da(C,xe),oe;if(se===null){for(;xe<R.length;xe++)se=G(C,R[xe],V),se!==null&&(T=f(se,T,xe),Oe===null?oe=se:Oe.sibling=se,Oe=se);return Ce&&Da(C,xe),oe}for(se=i(se);xe<R.length;xe++)Te=z(se,C,xe,R[xe],V),Te!==null&&(e&&Te.alternate!==null&&se.delete(Te.key===null?xe:Te.key),T=f(Te,T,xe),Oe===null?oe=Te:Oe.sibling=Te,Oe=Te);return e&&se.forEach(function(Nn){return t(C,Nn)}),Ce&&Da(C,xe),oe}function de(C,T,R,V){if(R==null)throw Error(l(151));for(var oe=null,Oe=null,se=T,xe=T=0,Te=null,Re=R.next();se!==null&&!Re.done;xe++,Re=R.next()){se.index>xe?(Te=se,se=null):Te=se.sibling;var Nn=M(C,se,Re.value,V);if(Nn===null){se===null&&(se=Te);break}e&&se&&Nn.alternate===null&&t(C,se),T=f(Nn,T,xe),Oe===null?oe=Nn:Oe.sibling=Nn,Oe=Nn,se=Te}if(Re.done)return s(C,se),Ce&&Da(C,xe),oe;if(se===null){for(;!Re.done;xe++,Re=R.next())Re=G(C,Re.value,V),Re!==null&&(T=f(Re,T,xe),Oe===null?oe=Re:Oe.sibling=Re,Oe=Re);return Ce&&Da(C,xe),oe}for(se=i(se);!Re.done;xe++,Re=R.next())Re=z(se,C,xe,Re.value,V),Re!==null&&(e&&Re.alternate!==null&&se.delete(Re.key===null?xe:Re.key),T=f(Re,T,xe),Oe===null?oe=Re:Oe.sibling=Re,Oe=Re);return e&&se.forEach(function(Wb){return t(C,Wb)}),Ce&&Da(C,xe),oe}function $e(C,T,R,V){if(typeof R=="object"&&R!==null&&R.type===E&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case S:e:{for(var oe=R.key;T!==null;){if(T.key===oe){if(oe=R.type,oe===E){if(T.tag===7){s(C,T.sibling),V=u(T,R.props.children),V.return=C,C=V;break e}}else if(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===J&&Gn(oe)===T.type){s(C,T.sibling),V=u(T,R.props),Kr(V,R),V.return=C,C=V;break e}s(C,T);break}else t(C,T);T=T.sibling}R.type===E?(V=qn(R.props.children,C.mode,V,R.key),V.return=C,C=V):(V=dl(R.type,R.key,R.props,null,C.mode,V),Kr(V,R),V.return=C,C=V)}return y(C);case A:e:{for(oe=R.key;T!==null;){if(T.key===oe)if(T.tag===4&&T.stateNode.containerInfo===R.containerInfo&&T.stateNode.implementation===R.implementation){s(C,T.sibling),V=u(T,R.children||[]),V.return=C,C=V;break e}else{s(C,T);break}else t(C,T);T=T.sibling}V=jc(R,C.mode,V),V.return=C,C=V}return y(C);case J:return R=Gn(R),$e(C,T,R,V)}if(Ue(R))return ee(C,T,R,V);if(ge(R)){if(oe=ge(R),typeof oe!="function")throw Error(l(150));return R=oe.call(R),de(C,T,R,V)}if(typeof R.then=="function")return $e(C,T,vl(R),V);if(R.$$typeof===L)return $e(C,T,ml(C,R),V);bl(C,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,T!==null&&T.tag===6?(s(C,T.sibling),V=u(T,R),V.return=C,C=V):(s(C,T),V=Sc(R,C.mode,V),V.return=C,C=V),y(C)):s(C,T)}return function(C,T,R,V){try{Pr=0;var oe=$e(C,T,R,V);return Bs=null,oe}catch(se){if(se===Ls||se===gl)throw se;var Oe=$t(29,se,null,C.mode);return Oe.lanes=V,Oe.return=C,Oe}}}var Kn=wh(!0),_h=wh(!1),cn=!1;function Uc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lc(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,(De&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=ul(e),rh(e,null,s),t}return cl(e,i,t,s),ul(e)}function Yr(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,Qi(e,s)}}function Bc(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 qc=!1;function Jr(){if(qc){var e=Us;if(e!==null)throw e}}function Xr(e,t,s,i){qc=!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 j=b,D=j.next;j.next=null,y===null?f=D:y.next=D,y=j;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==y&&(b===null?$.firstBaseUpdate=D:b.next=D,$.lastBaseUpdate=j))}if(f!==null){var G=u.baseState;y=0,$=D=j=null,b=f;do{var M=b.lane&-536870913,z=M!==b.lane;if(z?(Ne&M)===M:(i&M)===M){M!==0&&M===zs&&(qc=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ee=e,de=b;M=t;var $e=s;switch(de.tag){case 1:if(ee=de.payload,typeof ee=="function"){G=ee.call($e,G,M);break e}G=ee;break e;case 3:ee.flags=ee.flags&-65537|128;case 0:if(ee=de.payload,M=typeof ee=="function"?ee.call($e,G,M):ee,M==null)break e;G=x({},G,M);break e;case 2:cn=!0}}M=b.callback,M!==null&&(e.flags|=64,z&&(e.flags|=8192),z=u.callbacks,z===null?u.callbacks=[M]:z.push(M))}else z={lane:M,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(D=$=z,j=G):$=$.next=z,y|=M;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;z=b,b=z.next,z.next=null,u.lastBaseUpdate=z,u.shared.pending=null}}while(!0);$===null&&(j=G),u.baseState=j,u.firstBaseUpdate=D,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),gn|=y,e.lanes=y,e.memoizedState=G}}function Sh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function jh(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Sh(s[e],t)}var qs=N(null),xl=N(0);function Eh(e,t){e=Ga,X(xl,e),X(qs,t),Ga=e|t.baseLanes}function $c(){X(xl,Ga),X(qs,qs.current)}function Hc(){Ga=xl.current,I(qs),I(xl)}var Ht=N(null),aa=null;function fn(e){var t=e.alternate;X(tt,tt.current&1),X(Ht,e),aa===null&&(t===null||qs.current!==null||t.memoizedState!==null)&&(aa=e)}function Vc(e){X(tt,tt.current),X(Ht,e),aa===null&&(aa=e)}function Nh(e){e.tag===22?(X(tt,tt.current),X(Ht,e),aa===null&&(aa=e)):hn()}function hn(){X(tt,tt.current),X(Ht,Ht.current)}function Vt(e){I(Ht),aa===e&&(aa=null),I(tt)}var tt=N(0);function wl(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Ju(s)||Xu(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,be=null,Be=null,rt=null,_l=!1,$s=!1,Yn=!1,Sl=0,Qr=0,Hs=null,I0=0;function Ze(){throw Error(l(321))}function Ic(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!qt(e[s],t[s]))return!1;return!0}function Gc(e,t,s,i,u,f){return Ua=f,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,U.H=e===null||e.memoizedState===null?cm:ru,Yn=!1,f=s(i,u),Yn=!1,$s&&(f=Ah(t,s,i,u)),Th(e),f}function Th(e){U.H=Wr;var t=Be!==null&&Be.next!==null;if(Ua=0,rt=Be=be=null,_l=!1,Qr=0,Hs=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&hl(e)&&(it=!0))}function Ah(e,t,s,i){be=e;var u=0;do{if($s&&(Hs=null),Qr=0,$s=!1,25<=u)throw Error(l(301));if(u+=1,rt=Be=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}U.H=um,f=t(s,i)}while($s);return f}function G0(){var e=U.H,t=e.useState()[0];return t=typeof t.then=="function"?Zr(t):t,e=e.useState()[0],(Be!==null?Be.memoizedState:null)!==e&&(be.flags|=1024),t}function Pc(){var e=Sl!==0;return Sl=0,e}function Kc(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Yc(e){if(_l){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}_l=!1}Ua=0,rt=Be=be=null,$s=!1,Qr=Sl=0,Hs=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?be.memoizedState=rt=e:rt=rt.next=e,rt}function at(){if(Be===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=rt===null?be.memoizedState:rt.next;if(t!==null)rt=t,Be=e;else{if(e===null)throw be.alternate===null?Error(l(467)):Error(l(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},rt===null?be.memoizedState=rt=e:rt=rt.next=e}return rt}function jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Zr(e){var t=Qr;return Qr+=1,Hs===null&&(Hs=[]),e=vh(Hs,e,t),t=be,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,U.H=t===null||t.memoizedState===null?cm:ru),e}function El(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Zr(e);if(e.$$typeof===L)return xt(e)}throw Error(l(438,String(e)))}function Jc(e){var t=null,s=be.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=be.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=jl(),be.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]=Ie;return t.index++,s}function La(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=at();return Xc(t,Be,e)}function Xc(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,j=null,D=t,$=!1;do{var G=D.lane&-536870913;if(G!==D.lane?(Ne&G)===G:(Ua&G)===G){var M=D.revertLane;if(M===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null}),G===zs&&($=!0);else if((Ua&M)===M){D=D.next,M===zs&&($=!0);continue}else G={lane:0,revertLane:D.revertLane,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},j===null?(b=j=G,y=f):j=j.next=G,be.lanes|=M,gn|=M;G=D.action,Yn&&s(f,G),f=D.hasEagerState?D.eagerState:s(f,G)}else M={lane:G,revertLane:D.revertLane,gesture:D.gesture,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},j===null?(b=j=M,y=f):j=j.next=M,be.lanes|=G,gn|=G;D=D.next}while(D!==null&&D!==t);if(j===null?y=f:j.next=b,!qt(f,e.memoizedState)&&(it=!0,$&&(s=Us,s!==null)))throw s;e.memoizedState=f,e.baseState=y,e.baseQueue=j,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Qc(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);qt(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),s.lastRenderedState=f}return[f,i]}function Ch(e,t,s){var i=be,u=at(),f=Ce;if(f){if(s===void 0)throw Error(l(407));s=s()}else s=t();var y=!qt((Be||u).memoizedState,s);if(y&&(u.memoizedState=s,it=!0),u=u.queue,Wc(Rh.bind(null,i,u,e),[e]),u.getSnapshot!==t||y||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,Vs(9,{destroy:void 0},Oh.bind(null,i,u,s,t),null),Ve===null)throw Error(l(349));f||(Ua&127)!==0||kh(i,t,s)}return s}function kh(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=be.updateQueue,t===null?(t=jl(),be.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Oh(e,t,s,i){t.value=s,t.getSnapshot=i,Dh(t)&&Mh(e)}function Rh(e,t,s){return s(function(){Dh(t)&&Mh(e)})}function Dh(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!qt(e,s)}catch{return!0}}function Mh(e){var t=Bn(e,2);t!==null&&Bt(t,e,2)}function Zc(e){var t=kt();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 zh(e,t,s,i){return e.baseState=s,Xc(e,Be,typeof i=="function"?i:La)}function P0(e,t,s,i,u){if(Cl(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)}};U.T!==null?s(!0):f.isTransition=!1,i(f),s=t.pending,s===null?(f.next=t.pending=f,Uh(t,f)):(f.next=s.next,t.pending=s.next=f)}}function Uh(e,t){var s=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=U.T,y={};U.T=y;try{var b=s(u,i),j=U.S;j!==null&&j(y,b),Lh(e,t,b)}catch(D){Fc(e,t,D)}finally{f!==null&&y.types!==null&&(f.types=y.types),U.T=f}}else try{f=s(u,i),Lh(e,t,f)}catch(D){Fc(e,t,D)}}function Lh(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){Bh(e,t,i)},function(i){return Fc(e,t,i)}):Bh(e,t,s)}function Bh(e,t,s){t.status="fulfilled",t.value=s,qh(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,Uh(e,s)))}function Fc(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,qh(t),t=t.next;while(t!==i)}e.action=null}function qh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function $h(e,t){return t}function Hh(e,t){if(Ce){var s=Ve.formState;if(s!==null){e:{var i=be;if(Ce){if(Ye){t:{for(var u=Ye,f=ta;u.nodeType!==8;){if(!f){u=null;break t}if(u=na(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ye=na(u.nextSibling),i=u.data==="F!";break e}}ln(i)}i=!1}i&&(t=s[0])}}return s=kt(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$h,lastRenderedState:t},s.queue=i,s=im.bind(null,be,i),i.dispatch=s,i=Zc(!1),f=su.bind(null,be,!1,i.queue),i=kt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,s=P0.bind(null,be,u,f,s),u.dispatch=s,i.memoizedState=e,[t,s,!1]}function Vh(e){var t=at();return Ih(t,Be,e)}function Ih(e,t,s){if(t=Xc(e,t,$h)[0],e=Nl(La)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Zr(t)}catch(y){throw y===Ls?gl:y}else i=t;t=at();var u=t.queue,f=u.dispatch;return s!==t.memoizedState&&(be.flags|=2048,Vs(9,{destroy:void 0},K0.bind(null,u,s),null)),[i,f,e]}function K0(e,t){e.action=t}function Gh(e){var t=at(),s=Be;if(s!==null)return Ih(t,s,e);at(),t=t.memoizedState,s=at();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function Vs(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=be.updateQueue,t===null&&(t=jl(),be.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 Ph(){return at().memoizedState}function Tl(e,t,s,i){var u=kt();be.flags|=e,u.memoizedState=Vs(1|t,{destroy:void 0},s,i===void 0?null:i)}function Al(e,t,s,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;Be!==null&&i!==null&&Ic(i,Be.memoizedState.deps)?u.memoizedState=Vs(t,f,s,i):(be.flags|=e,u.memoizedState=Vs(1|t,f,s,i))}function Kh(e,t){Tl(8390656,8,e,t)}function Wc(e,t){Al(2048,8,e,t)}function Y0(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=jl(),be.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function Yh(e){var t=at().memoizedState;return Y0({ref:t,nextImpl:e}),function(){if((De&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Jh(e,t){return Al(4,2,e,t)}function Xh(e,t){return Al(4,4,e,t)}function Qh(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 Zh(e,t,s){s=s!=null?s.concat([e]):null,Al(4,4,Qh.bind(null,t,e),s)}function eu(){}function Fh(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&Ic(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function Wh(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&Ic(t,i[1]))return i[0];if(i=e(),Yn){pa(!0);try{e()}finally{pa(!1)}}return s.memoizedState=[i,t],i}function tu(e,t,s){return s===void 0||(Ua&1073741824)!==0&&(Ne&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=ep(),be.lanes|=e,gn|=e,s)}function em(e,t,s,i){return qt(s,t)?s:qs.current!==null?(e=tu(e,s,i),qt(e,t)||(it=!0),e):(Ua&42)===0||(Ua&1073741824)!==0&&(Ne&261930)===0?(it=!0,e.memoizedState=s):(e=ep(),be.lanes|=e,gn|=e,t)}function tm(e,t,s,i,u){var f=H.p;H.p=f!==0&&8>f?f:8;var y=U.T,b={};U.T=b,su(e,!1,t,s);try{var j=u(),D=U.S;if(D!==null&&D(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var $=V0(j,i);Fr(e,t,$,Pt(e))}else Fr(e,t,i,Pt(e))}catch(G){Fr(e,t,{then:function(){},status:"rejected",reason:G},Pt())}finally{H.p=f,y!==null&&b.types!==null&&(y.types=b.types),U.T=y}}function J0(){}function au(e,t,s,i){if(e.tag!==5)throw Error(l(476));var u=am(e).queue;tm(e,u,t,K,s===null?J0:function(){return nm(e),s(i)})}function am(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 nm(e){var t=am(e);t.next===null&&(t=e.alternate.memoizedState),Fr(e,t.next.queue,{},Pt())}function nu(){return xt(pi)}function sm(){return at().memoizedState}function rm(){return at().memoizedState}function X0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=Pt();e=un(s);var i=dn(t,e,s);i!==null&&(Bt(i,t,s),Yr(i,t,s)),t={cache:Rc()},e.payload=t;return}t=t.return}}function Q0(e,t,s){var i=Pt();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Cl(e)?lm(t,s):(s=wc(e,t,s,i),s!==null&&(Bt(s,e,i),om(s,t,i)))}function im(e,t,s){var i=Pt();Fr(e,t,s,i)}function Fr(e,t,s,i){var u={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Cl(e))lm(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,qt(b,y))return cl(e,t,u,0),Ve===null&&ol(),!1}catch{}if(s=wc(e,t,u,i),s!==null)return Bt(s,e,i),om(s,t,i),!0}return!1}function su(e,t,s,i){if(i={lane:2,revertLane:Uu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Cl(e)){if(t)throw Error(l(479))}else t=wc(e,s,i,2),t!==null&&Bt(t,e,2)}function Cl(e){var t=e.alternate;return e===be||t!==null&&t===be}function lm(e,t){$s=_l=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function om(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Qi(e,s)}}var Wr={readContext:xt,use:El,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useLayoutEffect:Ze,useInsertionEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useSyncExternalStore:Ze,useId:Ze,useHostTransitionStatus:Ze,useFormState:Ze,useActionState:Ze,useOptimistic:Ze,useMemoCache:Ze,useCacheRefresh:Ze};Wr.useEffectEvent=Ze;var cm={readContext:xt,use:El,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:xt,useEffect:Kh,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Tl(4194308,4,Qh.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Tl(4194308,4,e,t)},useInsertionEffect:function(e,t){Tl(4,2,e,t)},useMemo:function(e,t){var s=kt();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=kt();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=Q0.bind(null,be,e),[i.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Zc(e);var t=e.queue,s=im.bind(null,be,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:eu,useDeferredValue:function(e,t){var s=kt();return tu(s,e,t)},useTransition:function(){var e=Zc(!1);return e=tm.bind(null,be,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=be,u=kt();if(Ce){if(s===void 0)throw Error(l(407));s=s()}else{if(s=t(),Ve===null)throw Error(l(349));(Ne&127)!==0||kh(i,t,s)}u.memoizedState=s;var f={value:s,getSnapshot:t};return u.queue=f,Kh(Rh.bind(null,i,f,e),[e]),i.flags|=2048,Vs(9,{destroy:void 0},Oh.bind(null,i,f,s,t),null),s},useId:function(){var e=kt(),t=Ve.identifierPrefix;if(Ce){var s=va,i=ya;s=(i&~(1<<32-Ct(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Sl++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=I0++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nu,useFormState:Hh,useActionState:Hh,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=su.bind(null,be,!0,s),s.dispatch=t,[e,t]},useMemoCache:Jc,useCacheRefresh:function(){return kt().memoizedState=X0.bind(null,be)},useEffectEvent:function(e){var t=kt(),s={impl:e};return t.memoizedState=s,function(){if((De&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},ru={readContext:xt,use:El,useCallback:Fh,useContext:xt,useEffect:Wc,useImperativeHandle:Zh,useInsertionEffect:Jh,useLayoutEffect:Xh,useMemo:Wh,useReducer:Nl,useRef:Ph,useState:function(){return Nl(La)},useDebugValue:eu,useDeferredValue:function(e,t){var s=at();return em(s,Be.memoizedState,e,t)},useTransition:function(){var e=Nl(La)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Zr(e),t]},useSyncExternalStore:Ch,useId:sm,useHostTransitionStatus:nu,useFormState:Vh,useActionState:Vh,useOptimistic:function(e,t){var s=at();return zh(s,Be,e,t)},useMemoCache:Jc,useCacheRefresh:rm};ru.useEffectEvent=Yh;var um={readContext:xt,use:El,useCallback:Fh,useContext:xt,useEffect:Wc,useImperativeHandle:Zh,useInsertionEffect:Jh,useLayoutEffect:Xh,useMemo:Wh,useReducer:Qc,useRef:Ph,useState:function(){return Qc(La)},useDebugValue:eu,useDeferredValue:function(e,t){var s=at();return Be===null?tu(s,e,t):em(s,Be.memoizedState,e,t)},useTransition:function(){var e=Qc(La)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Zr(e),t]},useSyncExternalStore:Ch,useId:sm,useHostTransitionStatus:nu,useFormState:Gh,useActionState:Gh,useOptimistic:function(e,t){var s=at();return Be!==null?zh(s,Be,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Jc,useCacheRefresh:rm};um.useEffectEvent=Yh;function iu(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:x({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var lu={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=Pt(),u=un(i);u.payload=t,s!=null&&(u.callback=s),t=dn(e,u,i),t!==null&&(Bt(t,e,i),Yr(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=Pt(),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),Yr(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Pt(),i=un(s);i.tag=2,t!=null&&(i.callback=t),t=dn(e,i,s),t!==null&&(Bt(t,e,s),Yr(t,e,s))}};function dm(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?!qr(s,i)||!qr(u,f):!0}function fm(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&&lu.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=x({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function hm(e){ll(e)}function mm(e){console.error(e)}function pm(e){ll(e)}function kl(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function gm(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 ou(e,t,s){return s=un(s),s.tag=3,s.payload={element:null},s.callback=function(){kl(e,t)},s}function ym(e){return e=un(e),e.tag=3,e}function vm(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(){gm(t,s,i)}}var y=s.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){gm(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 Z0(e,t,s,i,u){if(s.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=s.alternate,t!==null&&Ms(t,s,u,!0),s=Ht.current,s!==null){switch(s.tag){case 31:case 13:return aa===null?Vl():s.alternate===null&&Fe===0&&(Fe=3),s.flags&=-257,s.flags|=65536,s.lanes=u,i===yl?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),Du(e,i,u)),!1;case 22:return s.flags|=65536,i===yl?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)),Du(e,i,u)),!1}throw Error(l(435,s.tag))}return Du(e,i,u),Vl(),!1}if(Ce)return t=Ht.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Tc&&(e=Error(l(422),{cause:i}),Vr(Ft(e,s)))):(i!==Tc&&(t=Error(l(423),{cause:i}),Vr(Ft(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=Ft(i,s),u=ou(e.stateNode,i,u),Bc(e,u),Fe!==4&&(Fe=2)),!1;var f=Error(l(520),{cause:i});if(f=Ft(f,s),li===null?li=[f]:li.push(f),Fe!==4&&(Fe=2),t===null)return!0;i=Ft(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=ou(s.stateNode,i,e),Bc(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=ym(u),vm(u,e,s,i),Bc(s,u),!1}s=s.return}while(s!==null);return!1}var cu=Error(l(461)),it=!1;function wt(e,t,s,i){t.child=e===null?_h(t,null,s,i):Kn(t,e.child,s,i)}function bm(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=Gc(e,t,s,y,f,u),b=Pc(),e!==null&&!it?(Kc(e,t,u),Ba(e,t,u)):(Ce&&b&&Ec(t),t.flags|=1,wt(e,t,i,u),t.child)}function xm(e,t,s,i,u){if(e===null){var f=s.type;return typeof f=="function"&&!_c(f)&&f.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=f,wm(e,t,f,i,u)):(e=dl(s.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!yu(e,u)){var y=f.memoizedProps;if(s=s.compare,s=s!==null?s:qr,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 wm(e,t,s,i,u){if(e!==null){var f=e.memoizedProps;if(qr(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,yu(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Ba(e,t,u)}return uu(e,t,s,i,u)}function _m(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 Sm(e,t,f,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pl(t,f!==null?f.cachePool:null),f!==null?Eh(t,f):$c(),Nh(t);else return i=t.lanes=536870912,Sm(e,t,f!==null?f.baseLanes|s:s,s,i)}else f!==null?(pl(t,f.cachePool),Eh(t,f),hn(),t.memoizedState=null):(e!==null&&pl(t,null),$c(),hn());return wt(e,t,u,s),t.child}function ei(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Sm(e,t,s,i,u){var f=Mc();return f=f===null?null:{parent:st._currentValue,pool:f},t.memoizedState={baseLanes:s,cachePool:f},e!==null&&pl(t,null),$c(),Nh(t),e!==null&&Ms(e,t,i,!0),t.childLanes=u,null}function Ol(e,t){return t=Dl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function jm(e,t,s){return Kn(t,e.child,null,s),e=Ol(t,t.pendingProps),e.flags|=2,Vt(t),t.memoizedState=null,e}function F0(e,t,s){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ce){if(i.mode==="hidden")return e=Ol(t,i),t.lanes=536870912,ei(null,e);if(Vc(t),(e=Ye)?(e=Up(e,ta),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=lh(e),s.return=t,t.child=s,bt=t,Ye=null)):e=null,e===null)throw ln(t);return t.lanes=536870912,null}return Ol(t,i)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Vc(t),u)if(t.flags&256)t.flags&=-257,t=jm(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||Ms(e,t,s,!1),u=(s&e.childLanes)!==0,it||u){if(i=Ve,i!==null&&(y=mf(i,s),y!==0&&y!==f.retryLane))throw f.retryLane=y,Bn(e,y),Bt(i,e,y),cu;Vl(),t=jm(e,t,s)}else e=f.treeContext,Ye=na(y.nextSibling),bt=t,Ce=!0,rn=null,ta=!1,e!==null&&uh(t,e),t=Ol(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 Rl(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 uu(e,t,s,i,u){return Vn(t),s=Gc(e,t,s,i,void 0,u),i=Pc(),e!==null&&!it?(Kc(e,t,u),Ba(e,t,u)):(Ce&&i&&Ec(t),t.flags|=1,wt(e,t,s,u),t.child)}function Em(e,t,s,i,u,f){return Vn(t),t.updateQueue=null,s=Ah(t,i,s,u),Th(e),i=Pc(),e!==null&&!it?(Kc(e,t,f),Ba(e,t,f)):(Ce&&i&&Ec(t),t.flags|=1,wt(e,t,s,f),t.child)}function Nm(e,t,s,i,u){if(Vn(t),t.stateNode===null){var f=ks,y=s.contextType;typeof y=="object"&&y!==null&&(f=xt(y)),f=new s(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=lu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Uc(t),y=s.contextType,f.context=typeof y=="object"&&y!==null?xt(y):ks,f.state=t.memoizedState,y=s.getDerivedStateFromProps,typeof y=="function"&&(iu(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&&lu.enqueueReplaceState(f,f.state,null),Xr(t,i,f,u),Jr(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var b=t.memoizedProps,j=Jn(s,b);f.props=j;var D=f.context,$=s.contextType;y=ks,typeof $=="object"&&$!==null&&(y=xt($));var G=s.getDerivedStateFromProps;$=typeof G=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||D!==y)&&fm(t,f,i,y),cn=!1;var M=t.memoizedState;f.state=M,Xr(t,i,f,u),Jr(),D=t.memoizedState,b||M!==D||cn?(typeof G=="function"&&(iu(t,s,G,i),D=t.memoizedState),(j=cn||dm(t,s,j,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=j):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Lc(e,t),y=t.memoizedProps,$=Jn(s,y),f.props=$,G=t.pendingProps,M=f.context,D=s.contextType,j=ks,typeof D=="object"&&D!==null&&(j=xt(D)),b=s.getDerivedStateFromProps,(D=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==G||M!==j)&&fm(t,f,i,j),cn=!1,M=t.memoizedState,f.state=M,Xr(t,i,f,u),Jr();var z=t.memoizedState;y!==G||M!==z||cn||e!==null&&e.dependencies!==null&&hl(e.dependencies)?(typeof b=="function"&&(iu(t,s,b,i),z=t.memoizedState),($=cn||dm(t,s,$,i,M,z,j)||e!==null&&e.dependencies!==null&&hl(e.dependencies))?(D||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,z,j),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,z,j)),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=z),f.props=i,f.state=z,f.context=j,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,Rl(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)):wt(e,t,s,u),t.memoizedState=f.state,e=t.child):e=Ba(e,t,u),e}function Tm(e,t,s,i){return $n(),t.flags|=256,wt(e,t,s,i),t.child}var du={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:gh()}}function hu(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=Gt),e}function Am(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(Ce){if(u?fn(t):hn(),(e=Ye)?(e=Up(e,ta),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=lh(e),s.return=t,t.child=s,bt=t,Ye=null)):e=null,e===null)throw ln(t);return Xu(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(hn(),u=t.mode,b=Dl({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=fu(s),i.childLanes=hu(e,y,s),t.memoizedState=du,ei(null,i)):(fn(t),mu(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(f)t.flags&256?(fn(t),t.flags&=-257,t=pu(e,t,s)):t.memoizedState!==null?(hn(),t.child=e.child,t.flags|=128,t=null):(hn(),b=i.fallback,u=t.mode,i=Dl({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=fu(s),i.childLanes=hu(e,y,s),t.memoizedState=du,t=ei(null,i));else if(fn(t),Xu(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var D=y.dgst;y=D,i=Error(l(419)),i.stack="",i.digest=y,Vr({value:i,source:null,stack:null}),t=pu(e,t,s)}else if(it||Ms(e,t,s,!1),y=(s&e.childLanes)!==0,it||y){if(y=Ve,y!==null&&(i=mf(y,s),i!==0&&i!==j.retryLane))throw j.retryLane=i,Bn(e,i),Bt(y,e,i),cu;Ju(b)||Vl(),t=pu(e,t,s)}else Ju(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,Ye=na(b.nextSibling),bt=t,Ce=!0,rn=null,ta=!1,e!==null&&uh(t,e),t=mu(t,i.children),t.flags|=4096);return t}return u?(hn(),b=i.fallback,u=t.mode,j=e.child,D=j.sibling,i=Ra(j,{mode:"hidden",children:i.children}),i.subtreeFlags=j.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,ei(null,i),i=t.child,b=e.child.memoizedState,b===null?b=fu(s):(u=b.cachePool,u!==null?(j=st._currentValue,u=u.parent!==j?{parent:j,pool:j}:u):u=gh(),b={baseLanes:b.baseLanes|s,cachePool:u}),i.memoizedState=b,i.childLanes=hu(e,y,s),t.memoizedState=du,ei(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 mu(e,t){return t=Dl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Dl(e,t){return e=$t(22,e,null,t),e.lanes=0,e}function pu(e,t,s){return Kn(t,e.child,null,s),e=mu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cm(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),kc(e.return,t,s)}function gu(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 km(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,X(tt,y),wt(e,t,i,s),i=Ce?Hr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cm(e,s,t);else if(e.tag===19)Cm(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&&wl(e)===null&&(u=s),s=s.sibling;s=u,s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),gu(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&&wl(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}gu(t,!0,s,null,f,i);break;case"together":gu(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(Ms(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 yu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&hl(e)))}function W0(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:Nt(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,Vc(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?Am(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||(Ms(e,t,s,!1),i=(s&t.childLanes)!==0),u){if(i)return km(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),X(tt,tt.current),i)break;return null;case 22:return t.lanes=0,_m(e,t,s,t.pendingProps);case 24:on(t,st,e.memoizedState.cache)}return Ba(e,t,s)}function Om(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!yu(e,s)&&(t.flags&128)===0)return it=!1,W0(e,t,s);it=(e.flags&131072)!==0}else it=!1,Ce&&(t.flags&1048576)!==0&&ch(t,Hr,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")_c(e)?(i=Jn(e,i),t.tag=1,t=Nm(null,t,e,i,s)):(t.tag=0,t=uu(null,t,e,i,s));else{if(e!=null){var u=e.$$typeof;if(u===P){t.tag=11,t=bm(null,t,e,i,s);break e}else if(u===Y){t.tag=14,t=xm(null,t,e,i,s);break e}}throw t=nt(e)||e,Error(l(306,t,""))}}return t;case 0:return uu(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,u=Jn(i,t.pendingProps),Nm(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,Lc(e,t),Xr(t,i,null,s);var y=t.memoizedState;if(i=y.cache,on(t,st,i),i!==f.cache&&Oc(t,[st],s,!0),Jr(),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=Tm(e,t,i,s);break e}else if(i!==u){u=Ft(Error(l(424)),t),Vr(u),t=Tm(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,Ye=na(e.firstChild),bt=t,Ce=!0,rn=null,ta=!0,s=_h(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}wt(e,t,i,s)}t=t.child}return t;case 26:return Rl(e,t),e===null?(s=Vp(t.type,null,t.pendingProps,null))?t.memoizedState=s:Ce||(s=t.type,e=t.pendingProps,i=Xl(ye.current).createElement(s),i[vt]=t,i[Rt]=e,_t(i,s,e),pt(i),t.stateNode=i):t.memoizedState=Vp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Nt(t),e===null&&Ce&&(i=t.stateNode=qp(t.type,t.pendingProps,ye.current),bt=t,ta=!0,u=Ye,wn(t.type)?(Qu=u,Ye=na(i.firstChild)):Ye=u),wt(e,t,t.pendingProps.children,s),Rl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ce&&((u=i=Ye)&&(i=Cb(i,t.type,t.pendingProps,ta),i!==null?(t.stateNode=i,bt=t,Ye=na(i.firstChild),ta=!1,u=!0):u=!1),u||ln(t)),Nt(t),u=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,i=f.children,Pu(u,f)?i=null:y!==null&&Pu(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=Gc(e,t,G0,null,null,s),pi._currentValue=u),Rl(e,t),wt(e,t,i,s),t.child;case 6:return e===null&&Ce&&((e=s=Ye)&&(s=kb(s,t.pendingProps,ta),s!==null?(t.stateNode=s,bt=t,Ye=null,e=!0):e=!1),e||ln(t)),null;case 13:return Am(e,t,s);case 4:return Ge(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Kn(t,null,i,s):wt(e,t,i,s),t.child;case 11:return bm(e,t,t.type,t.pendingProps,s);case 7:return wt(e,t,t.pendingProps,s),t.child;case 8:return wt(e,t,t.pendingProps.children,s),t.child;case 12:return wt(e,t,t.pendingProps.children,s),t.child;case 10:return i=t.pendingProps,on(t,t.type,i.value),wt(e,t,i.children,s),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Vn(t),u=xt(u),i=i(u),t.flags|=1,wt(e,t,i,s),t.child;case 14:return xm(e,t,t.type,t.pendingProps,s);case 15:return wm(e,t,t.type,t.pendingProps,s);case 19:return km(e,t,s);case 31:return F0(e,t,s);case 22:return _m(e,t,s,t.pendingProps);case 24:return Vn(t),i=xt(st),e===null?(u=Mc(),u===null&&(u=Ve,f=Rc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=s),u=f),t.memoizedState={parent:i,cache:u},Uc(t),on(t,st,u)):((e.lanes&s)!==0&&(Lc(e,t),Xr(t,null,null,s),Jr()),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&&Oc(t,[st],s,!0))),wt(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 vu(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(sp())e.flags|=8192;else throw Pn=yl,zc}else e.flags&=-16777217}function Rm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(t))if(sp())e.flags|=8192;else throw Pn=yl,zc}function Ml(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ga():536870912,e.lanes|=t,Ks|=t)}function ti(e,t){if(!Ce)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 Je(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 eb(e,t,s){var i=t.pendingProps;switch(Nc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return Je(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),Le(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Ds(t)?qa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ac())),Je(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(qa(t),f!==null?(Je(t),Rm(t,f)):(Je(t),vu(t,u,null,i,s))):f?f!==e.memoizedState?(qa(t),Je(t),Rm(t,f)):(Je(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&qa(t),Je(t),vu(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 Je(t),null}e=Z.current,Ds(t)?dh(t):(e=qp(u,i,s),t.stateNode=e,qa(t))}return Je(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 Je(t),null}if(f=Z.current,Ds(t))dh(t);else{var y=Xl(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[vt]=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(_t(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 Je(t),vu(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,Ds(t)){if(e=t.stateNode,s=t.memoizedProps,i=null,u=bt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[vt]=t,e=!!(e.nodeValue===s||i!==null&&i.suppressHydrationWarning===!0||Ap(e.nodeValue,s)),e||ln(t,!0)}else e=Xl(e).createTextNode(i),e[vt]=t,t.stateNode=e}return Je(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=Ds(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[vt]=t}else $n(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),e=!1}else s=Ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(Vt(t),t):(Vt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Je(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Ds(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[vt]=t}else $n(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),u=!1}else u=Ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Vt(t),t):(Vt(t),null)}return Vt(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),Ml(t,t.updateQueue),Je(t),null);case 4:return Le(),e===null&&$u(t.stateNode.containerInfo),Je(t),null;case 10:return za(t.type),Je(t),null;case 19:if(I(tt),i=t.memoizedState,i===null)return Je(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)ti(i,!1);else{if(Fe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=wl(e),f!==null){for(t.flags|=128,ti(i,!1),e=f.updateQueue,t.updateQueue=e,Ml(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)ih(s,e),s=s.sibling;return X(tt,tt.current&1|2),Ce&&Da(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&mt()>ql&&(t.flags|=128,u=!0,ti(i,!1),t.lanes=4194304)}else{if(!u)if(e=wl(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Ml(t,e),ti(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!Ce)return Je(t),null}else 2*mt()-i.renderingStartTime>ql&&s!==536870912&&(t.flags|=128,u=!0,ti(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,X(tt,u?s&1|2:s&1),Ce&&Da(t,i.treeForkCount),e):(Je(t),null);case 22:case 23:return Vt(t),Hc(),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&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),s=t.updateQueue,s!==null&&Ml(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&&I(In),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),za(st),Je(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function tb(e,t){switch(Nc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return za(st),Le(),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(Vt(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(Vt(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 I(tt),null;case 4:return Le(),null;case 10:return za(t.type),null;case 22:case 23:return Vt(t),Hc(),e!==null&&I(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 Dm(e,t){switch(Nc(t),t.tag){case 3:za(st),Le();break;case 26:case 27:case 5:yt(t);break;case 4:Le();break;case 31:t.memoizedState!==null&&Vt(t);break;case 13:Vt(t);break;case 19:I(tt);break;case 10:za(t.type);break;case 22:case 23:Vt(t),Hc(),e!==null&&I(In);break;case 24:za(st)}}function ai(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){ze(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 j=s,D=b;try{D()}catch($){ze(u,j,$)}}}i=i.next}while(i!==f)}}catch($){ze(t,t.return,$)}}function Mm(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{jh(t,s)}catch(i){ze(e,e.return,i)}}}function zm(e,t,s){s.props=Jn(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){ze(e,t,i)}}function ni(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){ze(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){ze(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){ze(e,t,u)}else s.current=null}function Um(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){ze(e,e.return,u)}}function bu(e,t,s){try{var i=e.stateNode;Sb(i,e.type,s,t),i[Rt]=t}catch(u){ze(e,e.return,u)}}function Lm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wn(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lm(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 wu(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(wu(e,t,s),e=e.sibling;e!==null;)wu(e,t,s),e=e.sibling}function zl(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(zl(e,t,s),e=e.sibling;e!==null;)zl(e,t,s),e=e.sibling}function Bm(e){var t=e.stateNode,s=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);_t(t,i,s),t[vt]=e,t[Rt]=s}catch(f){ze(e,e.return,f)}}var $a=!1,lt=!1,_u=!1,qm=typeof WeakSet=="function"?WeakSet:Set,gt=null;function ab(e,t){if(e=e.containerInfo,Iu=ao,e=Zf(e),pc(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,j=-1,D=0,$=0,G=e,M=null;t:for(;;){for(var z;G!==s||u!==0&&G.nodeType!==3||(b=y+u),G!==f||i!==0&&G.nodeType!==3||(j=y+i),G.nodeType===3&&(y+=G.nodeValue.length),(z=G.firstChild)!==null;)M=G,G=z;for(;;){if(G===e)break t;if(M===s&&++D===u&&(b=y),M===f&&++$===i&&(j=y),(z=G.nextSibling)!==null)break;G=M,M=G.parentNode}G=z}s=b===-1||j===-1?null:{start:b,end:j}}else s=null}s=s||{start:0,end:0}}else s=null;for(Gu={focusedElem:e,selectionRange:s},ao=!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 ee=Jn(s.type,u);e=i.getSnapshotBeforeUpdate(ee,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(de){ze(s,s.return,de)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Yu(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Yu(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 $m(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Va(e,s),i&4&&ai(5,s);break;case 1:if(Va(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(y){ze(s,s.return,y)}else{var u=Jn(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){ze(s,s.return,y)}}i&64&&Mm(s),i&512&&ni(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{jh(e,t)}catch(y){ze(s,s.return,y)}}break;case 27:t===null&&i&4&&Bm(s);case 26:case 5:Va(e,s),t===null&&i&4&&Um(s),i&512&&ni(s,s.return);break;case 12:Va(e,s);break;case 31:Va(e,s),i&4&&Im(e,s);break;case 13:Va(e,s),i&4&&Gm(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=db.bind(null,s),Ob(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 Hm(e){var t=e.alternate;t!==null&&(e.alternate=null,Hm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Fo(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;)Vm(e,t,s),s=s.sibling}function Vm(e,t,s){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.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),fi(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){ze(s,t,f)}else try{Xe.removeChild(s.stateNode)}catch(f){ze(s,t,f)}break;case 18:Xe!==null&&(Mt?(e=Xe,Mp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),er(e)):Mp(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"&&zm(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 Im(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{er(e)}catch(s){ze(t,t.return,s)}}}function Gm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{er(e)}catch(s){ze(t,t.return,s)}}function nb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new qm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new qm),t;default:throw Error(l(435,e.tag))}}function Ul(e,t){var s=nb(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var u=fb.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));Vm(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;)Pm(t,e),t=t.sibling}var oa=null;function Pm(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),ai(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[kr]||f[vt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),_t(f,i,s),f[vt]=e,pt(f),i=f;break e;case"link":var y=Pp("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),_t(f,i,s),u.head.appendChild(f);break;case"meta":if(y=Pp("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),_t(f,i,s),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[vt]=e,pt(f),i=f}e.stateNode=i}else Kp(u,e.type,e.stateNode);else e.stateNode=Gp(u,i,e.memoizedProps);else f!==i?(f===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):f.count--,i===null?Kp(u,e.type,e.stateNode):Gp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&bu(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&&bu(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{Ss(u,"")}catch(ee){ze(e,e.return,ee)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,bu(e,u,s!==null?s.memoizedProps:u)),i&1024&&(_u=!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(ee){ze(e,e.return,ee)}}break;case 3:if(Fl=null,u=oa,oa=Ql(t.containerInfo),zt(t,e),oa=u,Ut(e),i&4&&s!==null&&s.memoizedState.isDehydrated)try{er(t.containerInfo)}catch(ee){ze(e,e.return,ee)}_u&&(_u=!1,Km(e));break;case 4:i=oa,oa=Ql(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,Ul(e,i)));break;case 13:zt(t,e),Ut(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Bl=mt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ul(e,i)));break;case 22:u=e.memoizedState!==null;var j=s!==null&&s.memoizedState!==null,D=$a,$=lt;if($a=D||u,lt=$||j,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||j||$a||lt||Xn(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){j=s=t;try{if(f=j.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=j.stateNode;var G=j.memoizedProps.style,M=G!=null&&G.hasOwnProperty("display")?G.display:null;b.style.display=M==null||typeof M=="boolean"?"":(""+M).trim()}}catch(ee){ze(j,j.return,ee)}}}else if(t.tag===6){if(s===null){j=t;try{j.stateNode.nodeValue=u?"":j.memoizedProps}catch(ee){ze(j,j.return,ee)}}}else if(t.tag===18){if(s===null){j=t;try{var z=j.stateNode;u?zp(z,!0):zp(j.stateNode,!1)}catch(ee){ze(j,j.return,ee)}}}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,Ul(e,s))));break;case 19:zt(t,e),Ut(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ul(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(Lm(i)){s=i;break}i=i.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var u=s.stateNode,f=xu(e);zl(e,f,u);break;case 5:var y=s.stateNode;s.flags&32&&(Ss(y,""),s.flags&=-33);var b=xu(e);zl(e,b,y);break;case 3:case 4:var j=s.stateNode.containerInfo,D=xu(e);wu(e,D,j);break;default:throw Error(l(161))}}catch($){ze(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Km(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Km(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;)$m(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"&&zm(t,t.return,s),Xn(t);break;case 27:fi(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),ai(4,f);break;case 1:if(Ia(u,f,s),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(D){ze(i,i.return,D)}if(i=f,u=i.updateQueue,u!==null){var b=i.stateNode;try{var j=u.shared.hiddenCallbacks;if(j!==null)for(u.shared.hiddenCallbacks=null,u=0;u<j.length;u++)Sh(j[u],b)}catch(D){ze(i,i.return,D)}}s&&y&64&&Mm(f),ni(f,f.return);break;case 27:Bm(f);case 26:case 5:Ia(u,f,s),s&&i===null&&y&4&&Um(f),ni(f,f.return);break;case 12:Ia(u,f,s);break;case 31:Ia(u,f,s),s&&y&4&&Im(u,f);break;case 13:Ia(u,f,s),s&&y&4&&Gm(u,f);break;case 22:f.memoizedState===null&&Ia(u,f,s),ni(f,f.return);break;case 30:break;default:Ia(u,f,s)}t=t.sibling}}function Su(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&&Ir(s))}function ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ir(e))}function ca(e,t,s,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ym(e,t,s,i),t=t.sibling}function Ym(e,t,s,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ca(e,t,s,i),u&2048&&ai(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&&Ir(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(j){ze(t,t.return,j)}}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):si(e,t):f._visibility&2?ca(e,t,s,i):(f._visibility|=2,Is(e,t,s,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Su(y,t);break;case 24:ca(e,t,s,i),u&2048&&ju(t.alternate,t);break;default:ca(e,t,s,i)}}function Is(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,j=i,D=y.flags;switch(y.tag){case 0:case 11:case 15:Is(f,y,b,j,u),ai(8,y);break;case 23:break;case 22:var $=y.stateNode;y.memoizedState!==null?$._visibility&2?Is(f,y,b,j,u):si(f,y):($._visibility|=2,Is(f,y,b,j,u)),u&&D&2048&&Su(y.alternate,y);break;case 24:Is(f,y,b,j,u),u&&D&2048&&ju(y.alternate,y);break;default:Is(f,y,b,j,u)}t=t.sibling}}function si(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:si(s,i),u&2048&&Su(i.alternate,i);break;case 24:si(s,i),u&2048&&ju(i.alternate,i);break;default:si(s,i)}t=t.sibling}}var ri=8192;function Gs(e,t,s){if(e.subtreeFlags&ri)for(e=e.child;e!==null;)Jm(e,t,s),e=e.sibling}function Jm(e,t,s){switch(e.tag){case 26:Gs(e,t,s),e.flags&ri&&e.memoizedState!==null&&Ib(s,oa,e.memoizedState,e.memoizedProps);break;case 5:Gs(e,t,s);break;case 3:case 4:var i=oa;oa=Ql(e.stateNode.containerInfo),Gs(e,t,s),oa=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=ri,ri=16777216,Gs(e,t,s),ri=i):Gs(e,t,s));break;default:Gs(e,t,s)}}function Xm(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 ii(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,Zm(i,e)}Xm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Qm(e),e=e.sibling}function Qm(e){switch(e.tag){case 0:case 11:case 15:ii(e),e.flags&2048&&mn(9,e,e.return);break;case 3:ii(e);break;case 12:ii(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ll(e)):ii(e);break;default:ii(e)}}function Ll(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,Zm(i,e)}Xm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:mn(8,t,t.return),Ll(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,Ll(t));break;default:Ll(t)}e=e.sibling}}function Zm(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:Ir(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(Hm(i),i===s){gt=null;break e}if(u!==null){u.return=f,gt=u;break e}gt=f}}}var sb={getCacheForType:function(e){var t=xt(st),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return xt(st).controller.signal}},rb=typeof WeakMap=="function"?WeakMap:Map,De=0,Ve=null,Se=null,Ne=0,Me=0,It=null,pn=!1,Ps=!1,Eu=!1,Ga=0,Fe=0,gn=0,Qn=0,Nu=0,Gt=0,Ks=0,li=null,Lt=null,Tu=!1,Bl=0,Fm=0,ql=1/0,$l=null,yn=null,ut=0,vn=null,Ys=null,Pa=0,Au=0,Cu=null,Wm=null,oi=0,ku=null;function Pt(){return(De&2)!==0&&Ne!==0?Ne&-Ne:U.T!==null?Uu():pf()}function ep(){if(Gt===0)if((Ne&536870912)===0||Ce){var e=ms;ms<<=1,(ms&3932160)===0&&(ms=262144),Gt=e}else Gt=536870912;return e=Ht.current,e!==null&&(e.flags|=32),Gt}function Bt(e,t,s){(e===Ve&&(Me===2||Me===9)||e.cancelPendingCommit!==null)&&(Js(e,0),bn(e,Ne,Gt,!1)),tn(e,s),((De&2)===0||e!==Ve)&&(e===Ve&&((De&2)===0&&(Qn|=s),Fe===4&&bn(e,Ne,Gt,!1)),xa(e))}function tp(e,t,s){if((De&6)!==0)throw Error(l(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||re(e,t),u=i?ob(e,t):Ru(e,t,!0),f=i;do{if(u===0){Ps&&!i&&bn(e,t,0,!1);break}else{if(s=e.current.alternate,f&&!ib(s)){u=Ru(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=li;var j=b.current.memoizedState.isDehydrated;if(j&&(Js(b,y).flags|=256),y=Ru(b,y,!1),y!==2){if(Eu&&!j){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){Js(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,Gt,!pn);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Bl+300-mt(),10<u)){if(bn(i,t,Gt,!pn),B(i,0,!0)!==0)break e;Pa=t,i.timeoutHandle=Rp(ap.bind(null,i,s,Lt,$l,Tu,t,Gt,Qn,Ks,pn,f,"Throttled",-0,0),u);break e}ap(i,s,Lt,$l,Tu,t,Gt,Qn,Ks,pn,f,null,-0,0)}}break}while(!0);xa(e)}function ap(e,t,s,i,u,f,y,b,j,D,$,G,M,z){if(e.timeoutHandle=-1,G=t.subtreeFlags,G&8192||(G&16785408)===16785408){G={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ka},Jm(t,f,G);var ee=(f&62914560)===f?Bl-mt():(f&4194048)===f?Fm-mt():0;if(ee=Gb(G,ee),ee!==null){Pa=f,e.cancelPendingCommit=ee(up.bind(null,e,t,f,s,i,u,y,b,j,$,G,null,M,z)),bn(e,f,y,!D);return}}up(e,t,f,s,i,u,y,b,j)}function ib(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(!qt(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&=~Nu,t&=~Qn,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Ct(u),y=1<<f;i[f]=-1,u&=~y}s!==0&&Xi(e,s,t)}function Hl(){return(De&6)===0?(ci(0),!1):!0}function Ou(){if(Se!==null){if(Me===0)var e=Se.return;else e=Se,Ma=Hn=null,Yc(e),Bs=null,Pr=0,e=Se;for(;e!==null;)Dm(e.alternate,e),e=e.return;Se=null}}function Js(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Nb(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Pa=0,Ou(),Ve=e,Se=s=Ra(e.current,null),Ne=t,Me=0,It=null,pn=!1,Ps=re(e,t),Eu=!1,Ks=Gt=Nu=Qn=gn=Fe=0,Lt=li=null,Tu=!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-Ct(i),f=1<<u;t|=e[u],i&=~f}return Ga=t,ol(),s}function np(e,t){be=null,U.H=Wr,t===Ls||t===gl?(t=bh(),Me=3):t===zc?(t=bh(),Me=4):Me=t===cu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,Se===null&&(Fe=1,kl(e,Ft(t,e.current)))}function sp(){var e=Ht.current;return e===null?!0:(Ne&4194048)===Ne?aa===null:(Ne&62914560)===Ne||(Ne&536870912)!==0?e===aa:!1}function rp(){var e=U.H;return U.H=Wr,e===null?Wr:e}function ip(){var e=U.A;return U.A=sb,e}function Vl(){Fe=4,pn||(Ne&4194048)!==Ne&&Ht.current!==null||(Ps=!0),(gn&134217727)===0&&(Qn&134217727)===0||Ve===null||bn(Ve,Ne,Gt,!1)}function Ru(e,t,s){var i=De;De|=2;var u=rp(),f=ip();(Ve!==e||Ne!==t)&&($l=null,Js(e,t)),t=!1;var y=Fe;e:do try{if(Me!==0&&Se!==null){var b=Se,j=It;switch(Me){case 8:Ou(),y=6;break e;case 3:case 2:case 9:case 6:Ht.current===null&&(t=!0);var D=Me;if(Me=0,It=null,Xs(e,b,j,D),s&&Ps){y=0;break e}break;default:D=Me,Me=0,It=null,Xs(e,b,j,D)}}lb(),y=Fe;break}catch($){np(e,$)}while(!0);return t&&e.shellSuspendCounter++,Ma=Hn=null,De=i,U.H=u,U.A=f,Se===null&&(Ve=null,Ne=0,ol()),y}function lb(){for(;Se!==null;)lp(Se)}function ob(e,t){var s=De;De|=2;var i=rp(),u=ip();Ve!==e||Ne!==t?($l=null,ql=mt()+500,Js(e,t)):Ps=re(e,t);e:do try{if(Me!==0&&Se!==null){t=Se;var f=It;t:switch(Me){case 1:Me=0,It=null,Xs(e,t,f,1);break;case 2:case 9:if(yh(f)){Me=0,It=null,op(t);break}t=function(){Me!==2&&Me!==9||Ve!==e||(Me=7),xa(e)},f.then(t,t);break e;case 3:Me=7;break e;case 4:Me=5;break e;case 7:yh(f)?(Me=0,It=null,op(t)):(Me=0,It=null,Xs(e,t,f,7));break;case 5:var y=null;switch(Se.tag){case 26:y=Se.memoizedState;case 5:case 27:var b=Se;if(y?Yp(y):b.stateNode.complete){Me=0,It=null;var j=b.sibling;if(j!==null)Se=j;else{var D=b.return;D!==null?(Se=D,Il(D)):Se=null}break t}}Me=0,It=null,Xs(e,t,f,5);break;case 6:Me=0,It=null,Xs(e,t,f,6);break;case 8:Ou(),Fe=6;break e;default:throw Error(l(462))}}cb();break}catch($){np(e,$)}while(!0);return Ma=Hn=null,U.H=i,U.A=u,De=s,Se!==null?0:(Ve=null,Ne=0,ol(),Fe)}function cb(){for(;Se!==null&&!Ii();)lp(Se)}function lp(e){var t=Om(e.alternate,e,Ga);e.memoizedProps=e.pendingProps,t===null?Il(e):Se=t}function op(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Em(s,t,t.pendingProps,t.type,void 0,Ne);break;case 11:t=Em(s,t,t.pendingProps,t.type.render,t.ref,Ne);break;case 5:Yc(t);default:Dm(s,t),t=Se=ih(t,Ga),t=Om(s,t,Ga)}e.memoizedProps=e.pendingProps,t===null?Il(e):Se=t}function Xs(e,t,s,i){Ma=Hn=null,Yc(t),Bs=null,Pr=0;var u=t.return;try{if(Z0(e,u,t,s,Ne)){Fe=1,kl(e,Ft(s,e.current)),Se=null;return}}catch(f){if(u!==null)throw Se=u,f;Fe=1,kl(e,Ft(s,e.current)),Se=null;return}t.flags&32768?(Ce||i===1?e=!0:Ps||(Ne&536870912)!==0?e=!1:(pn=e=!0,(i===2||i===9||i===3||i===6)&&(i=Ht.current,i!==null&&i.tag===13&&(i.flags|=16384))),cp(t,e)):Il(t)}function Il(e){var t=e;do{if((t.flags&32768)!==0){cp(t,pn);return}e=t.return;var s=eb(t.alternate,t,Ga);if(s!==null){Se=s;return}if(t=t.sibling,t!==null){Se=t;return}Se=t=e}while(t!==null);Fe===0&&(Fe=5)}function cp(e,t){do{var s=tb(e.alternate,e);if(s!==null){s.flags&=32767,Se=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){Se=e;return}Se=e=s}while(e!==null);Fe=6,Se=null}function up(e,t,s,i,u,f,y,b,j){e.cancelPendingCommit=null;do Gl();while(ut!==0);if((De&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=xc,gs(e,s,f,y,b,j),e===Ve&&(Se=Ve=null,Ne=0),Ys=t,vn=e,Pa=s,Au=f,Cu=u,Wm=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,hb(fs,function(){return pp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=U.T,U.T=null,u=H.p,H.p=2,y=De,De|=4;try{ab(e,t,s)}finally{De=y,H.p=u,U.T=i}}ut=1,dp(),fp(),hp()}}function dp(){if(ut===1){ut=0;var e=vn,t=Ys,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=U.T,U.T=null;var i=H.p;H.p=2;var u=De;De|=4;try{Pm(t,e);var f=Gu,y=Zf(e.containerInfo),b=f.focusedElem,j=f.selectionRange;if(y!==b&&b&&b.ownerDocument&&Qf(b.ownerDocument.documentElement,b)){if(j!==null&&pc(b)){var D=j.start,$=j.end;if($===void 0&&($=D),"selectionStart"in b)b.selectionStart=D,b.selectionEnd=Math.min($,b.value.length);else{var G=b.ownerDocument||document,M=G&&G.defaultView||window;if(M.getSelection){var z=M.getSelection(),ee=b.textContent.length,de=Math.min(j.start,ee),$e=j.end===void 0?de:Math.min(j.end,ee);!z.extend&&de>$e&&(y=$e,$e=de,de=y);var C=Xf(b,de),T=Xf(b,$e);if(C&&T&&(z.rangeCount!==1||z.anchorNode!==C.node||z.anchorOffset!==C.offset||z.focusNode!==T.node||z.focusOffset!==T.offset)){var R=G.createRange();R.setStart(C.node,C.offset),z.removeAllRanges(),de>$e?(z.addRange(R),z.extend(T.node,T.offset)):(R.setEnd(T.node,T.offset),z.addRange(R))}}}}for(G=[],z=b;z=z.parentNode;)z.nodeType===1&&G.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<G.length;b++){var V=G[b];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}ao=!!Iu,Gu=Iu=null}finally{De=u,H.p=i,U.T=s}}e.current=t,ut=2}}function fp(){if(ut===2){ut=0;var e=vn,t=Ys,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=U.T,U.T=null;var i=H.p;H.p=2;var u=De;De|=4;try{$m(e,t.alternate,t)}finally{De=u,H.p=i,U.T=s}}ut=3}}function hp(){if(ut===4||ut===3){ut=0,Gi();var e=vn,t=Ys,s=Pa,i=Wm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ut=5:(ut=0,Ys=vn=null,mp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(yn=null),Qo(s),t=t.stateNode,At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(Dn,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=U.T,u=H.p,H.p=2,U.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{U.T=t,H.p=u}}(Pa&3)!==0&&Gl(),xa(e),u=e.pendingLanes,(s&261930)!==0&&(u&42)!==0?e===ku?oi++:(oi=0,ku=e):oi=0,ci(0)}}function mp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ir(t)))}function Gl(){return dp(),fp(),hp(),pp()}function pp(){if(ut!==5)return!1;var e=vn,t=Au;Au=0;var s=Qo(Pa),i=U.T,u=H.p;try{H.p=32>s?32:s,U.T=null,s=Cu,Cu=null;var f=vn,y=Pa;if(ut=0,Ys=vn=null,Pa=0,(De&6)!==0)throw Error(l(331));var b=De;if(De|=4,Qm(f.current),Ym(f,f.current,y,s),De=b,ci(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(Dn,f)}catch{}return!0}finally{H.p=u,U.T=i,mp(e,t)}}function gp(e,t,s){t=Ft(s,t),t=ou(e.stateNode,t,2),e=dn(e,t,2),e!==null&&(tn(e,2),xa(e))}function ze(e,t,s){if(e.tag===3)gp(e,e,s);else for(;t!==null;){if(t.tag===3){gp(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=Ft(s,e),s=ym(2),i=dn(t,s,2),i!==null&&(vm(s,i,t,e),tn(i,2),xa(i));break}}t=t.return}}function Du(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new rb;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=ub.bind(null,e,t,s),t.then(e,e))}function ub(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Ve===e&&(Ne&s)===s&&(Fe===4||Fe===3&&(Ne&62914560)===Ne&&300>mt()-Bl?(De&2)===0&&Js(e,0):Nu|=s,Ks===Ne&&(Ks=0)),xa(e)}function yp(e,t){t===0&&(t=ga()),e=Bn(e,t),e!==null&&(tn(e,t),xa(e))}function db(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),yp(e,s)}function fb(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),yp(e,s)}function hb(e,t){return en(e,t)}var Pl=null,Qs=null,Mu=!1,Kl=!1,zu=!1,xn=0;function xa(e){e!==Qs&&e.next===null&&(Qs===null?Pl=Qs=e:Qs=Qs.next=e),Kl=!0,Mu||(Mu=!0,pb())}function ci(e,t){if(!zu&&Kl){zu=!0;do for(var s=!1,i=Pl;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-Ct(42|e)+1)-1,f&=u&~(y&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(s=!0,wp(i,f))}else f=Ne,f=B(i,i===Ve?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||re(i,f)||(s=!0,wp(i,f));i=i.next}while(s);zu=!1}}function mb(){vp()}function vp(){Kl=Mu=!1;var e=0;xn!==0&&Eb()&&(e=xn);for(var t=mt(),s=null,i=Pl;i!==null;){var u=i.next,f=bp(i,t);f===0?(i.next=null,s===null?Pl=u:s.next=u,u===null&&(Qs=s)):(s=i,(e!==0||(f&3)!==0)&&(Kl=!0)),i=u}ut!==0&&ut!==5||ci(e),xn!==0&&(xn=0)}function bp(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-Ct(f),b=1<<y,j=u[y];j===-1?((b&s)===0||(b&i)!==0)&&(u[y]=Ke(b,t)):j<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ve,s=Ne,s=B(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(Me===2||Me===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&us(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||re(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&us(i),Qo(s)){case 2:case 8:s=Ki;break;case 32:s=fs;break;case 268435456:s=Yi;break;default:s=fs}return i=xp.bind(null,e),s=en(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&us(i),e.callbackPriority=2,e.callbackNode=null,2}function xp(e,t){if(ut!==0&&ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Gl()&&e.callbackNode!==s)return null;var i=Ne;return i=B(e,e===Ve?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(tp(e,i,t),bp(e,mt()),e.callbackNode!=null&&e.callbackNode===s?xp.bind(null,e):null)}function wp(e,t){if(Gl())return null;tp(e,t,!0)}function pb(){Tb(function(){(De&6)!==0?en(Pi,mb):vp()})}function Uu(){if(xn===0){var e=zs;e===0&&(e=hs,hs<<=1,(hs&261888)===0&&(hs=256)),xn=e}return xn}function _p(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:el(""+e)}function Sp(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 gb(e,t,s,i,u){if(t==="submit"&&s&&s.stateNode===u){var f=_p((u[Rt]||null).action),y=i.submitter;y&&(t=(t=y[Rt]||null)?_p(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var b=new sl("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(xn!==0){var j=y?Sp(u,y):new FormData(u);au(s,{pending:!0,data:j,method:u.method,action:f},null,j)}}else typeof f=="function"&&(b.preventDefault(),j=y?Sp(u,y):new FormData(u),au(s,{pending:!0,data:j,method:u.method,action:f},f,j))},currentTarget:u}]})}}for(var Lu=0;Lu<bc.length;Lu++){var Bu=bc[Lu],yb=Bu.toLowerCase(),vb=Bu[0].toUpperCase()+Bu.slice(1);la(yb,"on"+vb)}la(eh,"onAnimationEnd"),la(th,"onAnimationIteration"),la(ah,"onAnimationStart"),la("dblclick","onDoubleClick"),la("focusin","onFocus"),la("focusout","onBlur"),la(M0,"onTransitionRun"),la(z0,"onTransitionStart"),la(U0,"onTransitionCancel"),la(nh,"onTransitionEnd"),ws("onMouseEnter",["mouseout","mouseover"]),ws("onMouseLeave",["mouseout","mouseover"]),ws("onPointerEnter",["pointerout","pointerover"]),ws("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 ui="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(" "),bb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ui));function jp(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],j=b.instance,D=b.currentTarget;if(b=b.listener,j!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=D;try{f(u)}catch($){ll($)}u.currentTarget=null,f=j}else for(y=0;y<i.length;y++){if(b=i[y],j=b.instance,D=b.currentTarget,b=b.listener,j!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=D;try{f(u)}catch($){ll($)}u.currentTarget=null,f=j}}}}function je(e,t){var s=t[Zo];s===void 0&&(s=t[Zo]=new Set);var i=e+"__bubble";s.has(i)||(Ep(t,e,2,!1),s.add(i))}function qu(e,t,s){var i=0;t&&(i|=4),Ep(s,e,i,t)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function $u(e){if(!e[Yl]){e[Yl]=!0,vf.forEach(function(s){s!=="selectionchange"&&(bb.has(s)||qu(s,!1,e),qu(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yl]||(t[Yl]=!0,qu("selectionchange",!1,t))}}function Ep(e,t,s,i){switch(eg(t)){case 2:var u=Yb;break;case 8:u=Jb;break;default:u=td}s=u.bind(null,t,s,e),u=void 0,!ic||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 Hu(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 j=y.tag;if((j===3||j===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;b!==null;){if(y=vs(b),y===null)return;if(j=y.tag,j===5||j===6||j===26||j===27){i=f=y;continue e}b=b.parentNode}}i=i.return}kf(function(){var D=f,$=sc(s),G=[];e:{var M=sh.get(e);if(M!==void 0){var z=sl,ee=e;switch(e){case"keypress":if(al(s)===0)break e;case"keydown":case"keyup":z=f0;break;case"focusin":ee="focus",z=uc;break;case"focusout":ee="blur",z=uc;break;case"beforeblur":case"afterblur":z=uc;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":z=Df;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":z=e0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":z=p0;break;case eh:case th:case ah:z=n0;break;case nh:z=y0;break;case"scroll":case"scrollend":z=Fv;break;case"wheel":z=b0;break;case"copy":case"cut":case"paste":z=r0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":z=zf;break;case"toggle":case"beforetoggle":z=w0}var de=(t&4)!==0,$e=!de&&(e==="scroll"||e==="scrollend"),C=de?M!==null?M+"Capture":null:M;de=[];for(var T=D,R;T!==null;){var V=T;if(R=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||R===null||C===null||(V=Rr(T,C),V!=null&&de.push(di(T,V,R))),$e)break;T=T.return}0<de.length&&(M=new z(M,ee,null,s,$),G.push({event:M,listeners:de}))}}if((t&7)===0){e:{if(M=e==="mouseover"||e==="pointerover",z=e==="mouseout"||e==="pointerout",M&&s!==nc&&(ee=s.relatedTarget||s.fromElement)&&(vs(ee)||ee[ys]))break e;if((z||M)&&(M=$.window===$?$:(M=$.ownerDocument)?M.defaultView||M.parentWindow:window,z?(ee=s.relatedTarget||s.toElement,z=D,ee=ee?vs(ee):null,ee!==null&&($e=d(ee),de=ee.tag,ee!==$e||de!==5&&de!==27&&de!==6)&&(ee=null)):(z=null,ee=D),z!==ee)){if(de=Df,V="onMouseLeave",C="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(de=zf,V="onPointerLeave",C="onPointerEnter",T="pointer"),$e=z==null?M:Or(z),R=ee==null?M:Or(ee),M=new de(V,T+"leave",z,s,$),M.target=$e,M.relatedTarget=R,V=null,vs($)===D&&(de=new de(C,T+"enter",ee,s,$),de.target=R,de.relatedTarget=$e,V=de),$e=V,z&&ee)t:{for(de=xb,C=z,T=ee,R=0,V=C;V;V=de(V))R++;V=0;for(var oe=T;oe;oe=de(oe))V++;for(;0<R-V;)C=de(C),R--;for(;0<V-R;)T=de(T),V--;for(;R--;){if(C===T||T!==null&&C===T.alternate){de=C;break t}C=de(C),T=de(T)}de=null}else de=null;z!==null&&Np(G,M,z,de,!1),ee!==null&&$e!==null&&Np(G,$e,ee,de,!0)}}e:{if(M=D?Or(D):window,z=M.nodeName&&M.nodeName.toLowerCase(),z==="select"||z==="input"&&M.type==="file")var Oe=If;else if(Hf(M))if(Gf)Oe=O0;else{Oe=C0;var se=A0}else z=M.nodeName,!z||z.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?D&&ac(D.elementType)&&(Oe=If):Oe=k0;if(Oe&&(Oe=Oe(e,D))){Vf(G,Oe,s,$);break e}se&&se(e,M,D),e==="focusout"&&D&&M.type==="number"&&D.memoizedProps.value!=null&&tc(M,"number",M.value)}switch(se=D?Or(D):window,e){case"focusin":(Hf(se)||se.contentEditable==="true")&&(Ts=se,gc=D,$r=null);break;case"focusout":$r=gc=Ts=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,Ff(G,s,$);break;case"selectionchange":if(D0)break;case"keydown":case"keyup":Ff(G,s,$)}var xe;if(fc)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else Ns?qf(e,s)&&(Te="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Te="onCompositionStart");Te&&(Uf&&s.locale!=="ko"&&(Ns||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&Ns&&(xe=Of()):(nn=$,lc="value"in nn?nn.value:nn.textContent,Ns=!0)),se=Jl(D,Te),0<se.length&&(Te=new Mf(Te,e,null,s,$),G.push({event:Te,listeners:se}),xe?Te.data=xe:(xe=$f(s),xe!==null&&(Te.data=xe)))),(xe=S0?j0(e,s):E0(e,s))&&(Te=Jl(D,"onBeforeInput"),0<Te.length&&(se=new Mf("onBeforeInput","beforeinput",null,s,$),G.push({event:se,listeners:Te}),se.data=xe)),gb(G,e,D,s,$)}jp(G,t)})}function di(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Jl(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=Rr(e,s),u!=null&&i.unshift(di(e,u,f)),u=Rr(e,t),u!=null&&i.push(di(e,u,f))),e.tag===3)return i;e=e.return}return[]}function xb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Np(e,t,s,i,u){for(var f=t._reactName,y=[];s!==null&&s!==i;){var b=s,j=b.alternate,D=b.stateNode;if(b=b.tag,j!==null&&j===i)break;b!==5&&b!==26&&b!==27||D===null||(j=D,u?(D=Rr(s,f),D!=null&&y.unshift(di(s,D,j))):u||(D=Rr(s,f),D!=null&&y.push(di(s,D,j)))),s=s.return}y.length!==0&&e.push({event:t,listeners:y})}var wb=/\r\n?/g,_b=/\u0000|\uFFFD/g;function Tp(e){return(typeof e=="string"?e:""+e).replace(wb,`
9
- `).replace(_b,"")}function Ap(e,t){return t=Tp(t),Tp(e)===t}function qe(e,t,s,i,u,f){switch(s){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Ss(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Ss(e,""+i);break;case"className":Fi(e,"class",i);break;case"tabIndex":Fi(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Fi(e,s,i);break;case"style":Af(e,i,f);break;case"data":if(t!=="object"){Fi(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=el(""+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"&&qe(e,t,"name",u.name,u,null),qe(e,t,"formEncType",u.formEncType,u,null),qe(e,t,"formMethod",u.formMethod,u,null),qe(e,t,"formTarget",u.formTarget,u,null)):(qe(e,t,"encType",u.encType,u,null),qe(e,t,"method",u.method,u,null),qe(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=el(""+i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=ka);break;case"onScroll":i!=null&&je("scroll",e);break;case"onScrollEnd":i!=null&&je("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=el(""+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":je("beforetoggle",e),je("toggle",e),Zi(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":Zi(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=Qv.get(s)||s,Zi(e,s,i))}}function Vu(e,t,s,i,u,f){switch(s){case"style":Af(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"?Ss(e,i):(typeof i=="number"||typeof i=="bigint")&&Ss(e,""+i);break;case"onScroll":i!=null&&je("scroll",e);break;case"onScrollEnd":i!=null&&je("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(!bf.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,""):Zi(e,s,i)}}}function _t(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":je("error",e),je("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:qe(e,t,f,y,s,null)}}u&&qe(e,t,"srcSet",s.srcSet,s,null),i&&qe(e,t,"src",s.src,s,null);return;case"input":je("invalid",e);var b=f=y=u=null,j=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":j=$;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:qe(e,t,i,$,s,null)}}jf(e,f,b,j,D,y,u,!1);return;case"select":je("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:qe(e,t,u,b,s,null)}t=f,s=y,e.multiple=!!i,t!=null?_s(e,!!i,t,!1):s!=null&&_s(e,!!i,s,!0);return;case"textarea":je("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:qe(e,t,y,b,s,null)}Nf(e,i,u,f);return;case"option":for(j in s)s.hasOwnProperty(j)&&(i=s[j],i!=null)&&(j==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":qe(e,t,j,i,s,null));return;case"dialog":je("beforetoggle",e),je("toggle",e),je("cancel",e),je("close",e);break;case"iframe":case"object":je("load",e);break;case"video":case"audio":for(i=0;i<ui.length;i++)je(ui[i],e);break;case"image":je("error",e),je("load",e);break;case"details":je("toggle",e);break;case"embed":case"source":case"link":je("error",e),je("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:qe(e,t,D,i,s,null)}return;default:if(ac(t)){for($ in s)s.hasOwnProperty($)&&(i=s[$],i!==void 0&&Vu(e,t,$,i,s,void 0));return}}for(b in s)s.hasOwnProperty(b)&&(i=s[b],i!=null&&qe(e,t,b,i,s,null))}function Sb(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,j=null,D=null,$=null;for(z in s){var G=s[z];if(s.hasOwnProperty(z)&&G!=null)switch(z){case"checked":break;case"value":break;case"defaultValue":j=G;default:i.hasOwnProperty(z)||qe(e,t,z,null,i,G)}}for(var M in i){var z=i[M];if(G=s[M],i.hasOwnProperty(M)&&(z!=null||G!=null))switch(M){case"type":f=z;break;case"name":u=z;break;case"checked":D=z;break;case"defaultChecked":$=z;break;case"value":y=z;break;case"defaultValue":b=z;break;case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(l(137,t));break;default:z!==G&&qe(e,t,M,z,i,G)}}ec(e,y,b,j,D,$,f,u);return;case"select":z=y=b=M=null;for(f in s)if(j=s[f],s.hasOwnProperty(f)&&j!=null)switch(f){case"value":break;case"multiple":z=j;default:i.hasOwnProperty(f)||qe(e,t,f,null,i,j)}for(u in i)if(f=i[u],j=s[u],i.hasOwnProperty(u)&&(f!=null||j!=null))switch(u){case"value":M=f;break;case"defaultValue":b=f;break;case"multiple":y=f;default:f!==j&&qe(e,t,u,f,i,j)}t=b,s=y,i=z,M!=null?_s(e,!!s,M,!1):!!i!=!!s&&(t!=null?_s(e,!!s,t,!0):_s(e,!!s,s?[]:"",!1));return;case"textarea":z=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:qe(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":z=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&qe(e,t,y,u,i,f)}Ef(e,M,z);return;case"option":for(var ee in s)M=s[ee],s.hasOwnProperty(ee)&&M!=null&&!i.hasOwnProperty(ee)&&(ee==="selected"?e.selected=!1:qe(e,t,ee,null,i,M));for(j in i)M=i[j],z=s[j],i.hasOwnProperty(j)&&M!==z&&(M!=null||z!=null)&&(j==="selected"?e.selected=M&&typeof M!="function"&&typeof M!="symbol":qe(e,t,j,M,i,z));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 de in s)M=s[de],s.hasOwnProperty(de)&&M!=null&&!i.hasOwnProperty(de)&&qe(e,t,de,null,i,M);for(D in i)if(M=i[D],z=s[D],i.hasOwnProperty(D)&&M!==z&&(M!=null||z!=null))switch(D){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(l(137,t));break;default:qe(e,t,D,M,i,z)}return;default:if(ac(t)){for(var $e in s)M=s[$e],s.hasOwnProperty($e)&&M!==void 0&&!i.hasOwnProperty($e)&&Vu(e,t,$e,void 0,i,M);for($ in i)M=i[$],z=s[$],!i.hasOwnProperty($)||M===z||M===void 0&&z===void 0||Vu(e,t,$,M,i,z);return}}for(var C in s)M=s[C],s.hasOwnProperty(C)&&M!=null&&!i.hasOwnProperty(C)&&qe(e,t,C,null,i,M);for(G in i)M=i[G],z=s[G],!i.hasOwnProperty(G)||M===z||M==null&&z==null||qe(e,t,G,M,i,z)}function Cp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jb(){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&&Cp(y)){for(y=0,b=u.responseEnd,i+=1;i<s.length;i++){var j=s[i],D=j.startTime;if(D>b)break;var $=j.transferSize,G=j.initiatorType;$&&Cp(G)&&(j=j.responseEnd,y+=$*(j<b?1:(b-D)/(j-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 Iu=null,Gu=null;function Xl(e){return e.nodeType===9?e:e.ownerDocument}function kp(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 Op(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 Pu(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 Ku=null;function Eb(){var e=window.event;return e&&e.type==="popstate"?e===Ku?!1:(Ku=e,!0):(Ku=null,!1)}var Rp=typeof setTimeout=="function"?setTimeout:void 0,Nb=typeof clearTimeout=="function"?clearTimeout:void 0,Dp=typeof Promise=="function"?Promise:void 0,Tb=typeof queueMicrotask=="function"?queueMicrotask:typeof Dp<"u"?function(e){return Dp.resolve(null).then(e).catch(Ab)}:Rp;function Ab(e){setTimeout(function(){throw e})}function wn(e){return e==="head"}function Mp(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),er(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")fi(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,fi(s);for(var f=s.firstChild;f;){var y=f.nextSibling,b=f.nodeName;f[kr]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||s.removeChild(f),f=y}}else s==="body"&&fi(e.ownerDocument.body);s=u}while(s);er(t)}function zp(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 Yu(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":Yu(s),Fo(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Cb(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[kr])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=na(e.nextSibling),e===null)break}return null}function kb(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=na(e.nextSibling),e===null))return null;return e}function Up(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=na(e.nextSibling),e===null))return null;return e}function Ju(e){return e.data==="$?"||e.data==="$~"}function Xu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Ob(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 na(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 Qu=null;function Lp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return na(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function Bp(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 qp(e,t,s){switch(t=Xl(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 fi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Fo(e)}var sa=new Map,$p=new Set;function Ql(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ka=H.d;H.d={f:Rb,r:Db,D:Mb,C:zb,L:Ub,m:Lb,X:qb,S:Bb,M:$b};function Rb(){var e=Ka.f(),t=Hl();return e||t}function Db(e){var t=bs(e);t!==null&&t.tag===5&&t.type==="form"?nm(t):Ka.r(e)}var Zs=typeof document>"u"?null:document;function Hp(e,t,s){var i=Zs;if(i&&typeof t=="string"&&t){var u=Qt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),$p.has(u)||($p.add(u),e={rel:e,crossOrigin:s,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),_t(t,"link",e),pt(t),i.head.appendChild(t)))}}function Mb(e){Ka.D(e),Hp("dns-prefetch",e,null)}function zb(e,t){Ka.C(e,t),Hp("preconnect",e,t)}function Ub(e,t,s){Ka.L(e,t,s);var i=Zs;if(i&&e&&t){var u='link[rel="preload"][as="'+Qt(t)+'"]';t==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+Qt(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+Qt(s.imageSizes)+'"]')):u+='[href="'+Qt(e)+'"]';var f=u;switch(t){case"style":f=Fs(e);break;case"script":f=Ws(e)}sa.has(f)||(e=x({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),sa.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(hi(f))||t==="script"&&i.querySelector(mi(f))||(t=i.createElement("link"),_t(t,"link",e),pt(t),i.head.appendChild(t)))}}function Lb(e,t){Ka.m(e,t);var s=Zs;if(s&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Qt(i)+'"][href="'+Qt(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ws(e)}if(!sa.has(f)&&(e=x({rel:"modulepreload",href:e},t),sa.set(f,e),s.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(mi(f)))return}i=s.createElement("link"),_t(i,"link",e),pt(i),s.head.appendChild(i)}}}function Bb(e,t,s){Ka.S(e,t,s);var i=Zs;if(i&&e){var u=xs(i).hoistableStyles,f=Fs(e);t=t||"default";var y=u.get(f);if(!y){var b={loading:0,preload:null};if(y=i.querySelector(hi(f)))b.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},s),(s=sa.get(f))&&Zu(e,s);var j=y=i.createElement("link");pt(j),_t(j,"link",e),j._p=new Promise(function(D,$){j.onload=D,j.onerror=$}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Zl(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},u.set(f,y)}}}function qb(e,t){Ka.X(e,t);var s=Zs;if(s&&e){var i=xs(s).hoistableScripts,u=Ws(e),f=i.get(u);f||(f=s.querySelector(mi(u)),f||(e=x({src:e,async:!0},t),(t=sa.get(u))&&Fu(e,t),f=s.createElement("script"),pt(f),_t(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function $b(e,t){Ka.M(e,t);var s=Zs;if(s&&e){var i=xs(s).hoistableScripts,u=Ws(e),f=i.get(u);f||(f=s.querySelector(mi(u)),f||(e=x({src:e,async:!0,type:"module"},t),(t=sa.get(u))&&Fu(e,t),f=s.createElement("script"),pt(f),_t(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Vp(e,t,s,i){var u=(u=ye.current)?Ql(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=Fs(s.href),s=xs(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=Fs(s.href);var f=xs(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(hi(e)))&&!f._p&&(y.instance=f,y.state.loading=5),sa.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},sa.set(e,s),f||Hb(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=Ws(s),s=xs(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 Fs(e){return'href="'+Qt(e)+'"'}function hi(e){return'link[rel="stylesheet"]['+e+"]"}function Ip(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function Hb(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}),_t(t,"link",s),pt(t),e.head.appendChild(t))}function Ws(e){return'[src="'+Qt(e)+'"]'}function mi(e){return"script[async]"+e}function Gp(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Qt(s.href)+'"]');if(i)return t.instance=i,pt(i),i;var u=x({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),pt(i),_t(i,"style",u),Zl(i,s.precedence,e),t.instance=i;case"stylesheet":u=Fs(s.href);var f=e.querySelector(hi(u));if(f)return t.state.loading|=4,t.instance=f,pt(f),f;i=Ip(s),(u=sa.get(u))&&Zu(i,u),f=(e.ownerDocument||e).createElement("link"),pt(f);var y=f;return y._p=new Promise(function(b,j){y.onload=b,y.onerror=j}),_t(f,"link",i),t.state.loading|=4,Zl(f,s.precedence,e),t.instance=f;case"script":return f=Ws(s.src),(u=e.querySelector(mi(f)))?(t.instance=u,pt(u),u):(i=s,(u=sa.get(f))&&(i=x({},s),Fu(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),pt(u),_t(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,Zl(i,s.precedence,e));return t.instance}function Zl(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 Zu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Fu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Fl=null;function Pp(e,t,s){if(Fl===null){var i=new Map,u=Fl=new Map;u.set(s,i)}else u=Fl,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[kr]||f[vt]||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 Kp(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function Vb(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 Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ib(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=Fs(i.href),f=t.querySelector(hi(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wl.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=f,pt(f);return}f=t.ownerDocument||t,i=Ip(i),(u=sa.get(u))&&Zu(i,u),f=f.createElement("link"),pt(f);var y=f;y._p=new Promise(function(b,j){y.onload=b,y.onerror=j}),_t(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=Wl.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var Wu=0;function Gb(e,t){return e.stylesheets&&e.count===0&&to(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&to(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&Wu===0&&(Wu=62500*jb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&to(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Wu?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)to(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var eo=null;function to(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,eo=new Map,t.forEach(Pb,e),eo=null,Wl.call(e))}function Pb(e,t){if(!(t.state.loading&4)){var s=eo.get(e);if(s)var i=s.get(null);else{s=new Map,eo.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=Wl.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 pi={$$typeof:L,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Kb(e,t,s,i,u,f,y,b,j){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=Cr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cr(0),this.hiddenUpdates=Cr(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function Jp(e,t,s,i,u,f,y,b,j,D,$,G){return e=new Kb(e,t,s,y,j,D,$,G,b),t=1,f===!0&&(t|=24),f=$t(3,null,null,t),e.current=f,f.stateNode=e,t=Rc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:s,cache:t},Uc(f),e}function Xp(e){return e?(e=ks,e):ks}function Qp(e,t,s,i,u,f){u=Xp(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),Yr(s,e,t))}function Zp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function ed(e,t){Zp(e,t),(e=e.alternate)&&Zp(e,t)}function Fp(e){if(e.tag===13||e.tag===31){var t=Bn(e,67108864);t!==null&&Bt(t,e,67108864),ed(e,67108864)}}function Wp(e){if(e.tag===13||e.tag===31){var t=Pt();t=Xo(t);var s=Bn(e,t);s!==null&&Bt(s,e,t),ed(e,t)}}var ao=!0;function Yb(e,t,s,i){var u=U.T;U.T=null;var f=H.p;try{H.p=2,td(e,t,s,i)}finally{H.p=f,U.T=u}}function Jb(e,t,s,i){var u=U.T;U.T=null;var f=H.p;try{H.p=8,td(e,t,s,i)}finally{H.p=f,U.T=u}}function td(e,t,s,i){if(ao){var u=ad(i);if(u===null)Hu(e,t,i,no,s),tg(e,i);else if(Qb(u,e,t,s,i))i.stopPropagation();else if(tg(e,i),t&4&&-1<Xb.indexOf(e)){for(;u!==null;){var f=bs(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 j=1<<31-Ct(y);b.entanglements[1]|=j,y&=~j}xa(f),(De&6)===0&&(ql=mt()+500,ci(0))}}break;case 31:case 13:b=Bn(f,2),b!==null&&Bt(b,f,2),Hl(),ed(f,2)}if(f=ad(i),f===null&&Hu(e,t,i,no,s),f===u)break;u=f}u!==null&&i.stopPropagation()}else Hu(e,t,i,null,s)}}function ad(e){return e=sc(e),nd(e)}var no=null;function nd(e){if(no=null,e=vs(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 no=e,null}function eg(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(ds()){case Pi:return 2;case Ki:return 8;case fs:case Go:return 32;case Yi:return 268435456;default:return 32}default:return 32}}var sd=!1,_n=null,Sn=null,jn=null,gi=new Map,yi=new Map,En=[],Xb="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 tg(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":gi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":yi.delete(t.pointerId)}}function vi(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=bs(t),t!==null&&Fp(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Qb(e,t,s,i,u){switch(t){case"focusin":return _n=vi(_n,e,t,s,i,u),!0;case"dragenter":return Sn=vi(Sn,e,t,s,i,u),!0;case"mouseover":return jn=vi(jn,e,t,s,i,u),!0;case"pointerover":var f=u.pointerId;return gi.set(f,vi(gi.get(f)||null,e,t,s,i,u)),!0;case"gotpointercapture":return f=u.pointerId,yi.set(f,vi(yi.get(f)||null,e,t,s,i,u)),!0}return!1}function ag(e){var t=vs(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,gf(e.priority,function(){Wp(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,gf(e.priority,function(){Wp(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 so(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=ad(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);nc=i,s.target.dispatchEvent(i),nc=null}else return t=bs(s),t!==null&&Fp(t),e.blockedOn=s,!1;t.shift()}return!0}function ng(e,t,s){so(e)&&s.delete(t)}function Zb(){sd=!1,_n!==null&&so(_n)&&(_n=null),Sn!==null&&so(Sn)&&(Sn=null),jn!==null&&so(jn)&&(jn=null),gi.forEach(ng),yi.forEach(ng)}function ro(e,t){e.blockedOn===t&&(e.blockedOn=null,sd||(sd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Zb)))}var io=null;function sg(e){io!==e&&(io=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){io===e&&(io=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(nd(i||s)===null)continue;break}var f=bs(s);f!==null&&(e.splice(t,3),t-=3,au(f,{pending:!0,data:u,method:s.method,action:i},i,u))}}))}function er(e){function t(j){return ro(j,e)}_n!==null&&ro(_n,e),Sn!==null&&ro(Sn,e),jn!==null&&ro(jn,e),gi.forEach(t),yi.forEach(t);for(var s=0;s<En.length;s++){var i=En[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<En.length&&(s=En[0],s.blockedOn===null);)ag(s),s.blockedOn===null&&En.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||sg(s);else if(y){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[Rt]||null)b=y.formAction;else if(nd(u)!==null)continue}else b=y.action;typeof b=="function"?s[i+1]=b:(s.splice(i,3),i-=3),sg(s)}}}function rg(){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 rd(e){this._internalRoot=e}lo.prototype.render=rd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var s=t.current,i=Pt();Qp(s,i,e,t,null,null)},lo.prototype.unmount=rd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qp(e.current,2,null,e,null,null),Hl(),t[ys]=null}};function lo(e){this._internalRoot=e}lo.prototype.unstable_scheduleHydration=function(e){if(e){var t=pf();e={blockedOn:null,target:e,priority:t};for(var s=0;s<En.length&&t!==0&&t<En[s].priority;s++);En.splice(s,0,e),s===0&&ag(e)}};var ig=a.version;if(ig!=="19.2.3")throw Error(l(527,ig,"19.2.3"));H.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 Fb={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oo.isDisabled&&oo.supportsFiber)try{Dn=oo.inject(Fb),At=oo}catch{}}return xi.createRoot=function(e,t){if(!c(e))throw Error(l(299));var s=!1,i="",u=hm,f=mm,y=pm;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=Jp(e,1,!1,null,null,s,i,null,u,f,y,rg),e[ys]=t.current,$u(e),new rd(t)},xi.hydrateRoot=function(e,t,s){if(!c(e))throw Error(l(299));var i=!1,u="",f=hm,y=mm,b=pm,j=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&&(j=s.formState)),t=Jp(e,1,!0,t,s??null,i,u,j,f,y,b,rg),t.context=Xp(null),s=t.current,i=Pt(),i=Xo(i),u=un(i),u.callback=null,dn(s,u,i),s=i,t.current.lanes=s,tn(t,s),xa(t),e[ys]=t.current,$u(e),new lo(t)},xi.version="19.2.3",xi}var gg;function ox(){if(gg)return od.exports;gg=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(),od.exports=lx(),od.exports}var cx=ox();const ux=Zd(cx);const dx=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fx=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),yg=n=>{const a=fx(n);return a.charAt(0).toUpperCase()+a.slice(1)},my=(...n)=>n.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),hx=n=>{for(const a in n)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var mx={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 px=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,...mx,width:a,height:a,stroke:n,strokeWidth:l?Number(r)*24/Number(a):r,className:my("lucide",c),...!d&&!hx(m)&&{"aria-hidden":"true"},...m},[...h.map(([g,v])=>w.createElement(g,v)),...Array.isArray(d)?d:[d]]));const ie=(n,a)=>{const r=w.forwardRef(({className:l,...c},d)=>w.createElement(px,{ref:d,iconNode:a,className:my(`lucide-${dx(yg(n))}`,`lucide-${n}`,l),...c}));return r.displayName=yg(n),r};const gx=[["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"}]],yx=ie("activity",gx);const vx=[["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"}]],bx=ie("archive",vx);const xx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],wx=ie("arrow-left",xx);const _x=[["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"}]],ef=ie("brain",_x);const Sx=[["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"}]],jx=ie("calendar",Sx);const Ex=[["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"}]],Nx=ie("camera",Ex);const Tx=[["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"}]],py=ie("chart-column",Tx);const Ax=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Qa=ie("check",Ax);const Cx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],kx=ie("chevron-down",Cx);const Ox=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Rx=ie("chevron-left",Ox);const Dx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Mx=ie("chevron-right",Dx);const zx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ux=ie("chevron-up",zx);const Lx=[["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"}]],qi=ie("circle-alert",Lx);const Bx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],tf=ie("circle-check-big",Bx);const qx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],af=ie("circle-check",qx);const $x=[["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"}]],Hx=ie("circle-user",$x);const Vx=[["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"}]],Ix=ie("circle-x",Vx);const Gx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zo=ie("clock",Gx);const Px=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],pr=ie("code",Px);const Kx=[["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"}]],Yx=ie("copy",Kx);const Jx=[["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"}]],gy=ie("cpu",Jx);const Xx=[["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"}]],No=ie("database",Xx);const Qx=[["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"}]],Ti=ie("external-link",Qx);const Zx=[["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"}]],Fx=ie("eye",Zx);const Wx=[["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"}]],ew=ie("flag",Wx);const tw=[["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"}]],aw=ie("hash",tw);const nw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xr=ie("info",nw);const sw=[["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"}]],rw=ie("key-round",sw);const iw=[["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"}]],lw=ie("key",iw);const ow=[["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"}]],cw=ie("layout-dashboard",ow);const uw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ra=ie("loader-circle",uw);const dw=[["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"}]],fw=ie("log-in",dw);const hw=[["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"}]],mw=ie("log-out",hw);const pw=[["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"}]],Rd=ie("mail",pw);const gw=[["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"}]],yw=ie("minimize-2",gw);const vw=[["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"}]],bw=ie("moon",vw);const xw=[["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"}]],vg=ie("paperclip",xw);const ww=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],wi=ie("plus",ww);const _w=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],fd=ie("power",_w);const Sw=[["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"}]],wr=ie("refresh-cw",Sw);const jw=[["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"}]],Ew=ie("rotate-ccw",jw);const Nw=[["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"}]],Tw=ie("save",Nw);const Aw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Cw=ie("search",Aw);const kw=[["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"}]],Ow=ie("send",kw);const Rw=[["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"}]],Dd=ie("settings",Rw);const Dw=[["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"}]],Mw=ie("settings-2",Dw);const zw=[["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"}]],Md=ie("shield-check",zw);const Uw=[["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"}]],Lw=ie("shield",Uw);const Bw=[["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"}]],qw=ie("sun",Bw);const $w=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],zd=ie("terminal",$w);const Hw=[["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"}]],To=ie("trash-2",Hw);const Vw=[["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"}]],_r=ie("triangle-alert",Vw);const Iw=[["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"}]],Gw=ie("upload",Iw);const Pw=[["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"}]],Kw=ie("user-plus",Pw);const Yw=[["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"}]],yy=ie("user",Yw);const Jw=[["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"}]],Xw=ie("volume-2",Jw);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"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Zw=ie("volume-x",Qw);const Fw=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Uo=ie("x",Fw);const Ww=[["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"}]],Ao=ie("zap",Ww),e_={theme:"system",setTheme:()=>null},vy=w.createContext(e_);function t_({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(vy.Provider,{value:d,children:n})}const a_=()=>{const n=w.useContext(vy);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n};function bg(n,a){if(typeof n=="function")return n(a);n!=null&&(n.current=a)}function Lo(...n){return a=>{let r=!1;const l=n.map(c=>{const d=bg(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():bg(n[c],null)}}}}function ls(...n){return w.useCallback(Lo(...n),n)}var n_=Symbol.for("react.lazy"),Co=Wd[" use ".trim().toString()];function s_(n){return typeof n=="object"&&n!==null&&"then"in n}function by(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===n_&&"_payload"in n&&s_(n._payload)}function xy(n){const a=i_(n),r=w.forwardRef((l,c)=>{let{children:d,...h}=l;by(d)&&typeof Co=="function"&&(d=Co(d._payload));const m=w.Children.toArray(d),p=m.find(o_);if(p){const g=p.props.children,v=m.map(x=>x===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:x);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 r_=xy("Slot");function i_(n){const a=w.forwardRef((r,l)=>{let{children:c,...d}=r;if(by(c)&&typeof Co=="function"&&(c=Co(c._payload)),w.isValidElement(c)){const h=u_(c),m=c_(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Lo(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 l_=Symbol("radix.slottable");function o_(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===l_}function c_(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 u_(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 wy(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=wy(n[a]))&&(l&&(l+=" "),l+=r)}else for(r in n)n[r]&&(l&&(l+=" "),l+=r);return l}function _y(){for(var n,a,r=0,l="",c=arguments.length;r<c;r++)(n=arguments[r])&&(a=wy(n))&&(l&&(l+=" "),l+=a);return l}const xg=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,wg=_y,Sy=(n,a)=>r=>{var l;if(a?.variants==null)return wg(n,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(g=>{const v=r?.[g],x=d?.[g];if(v===null)return null;const _=xg(v)||xg(x);return c[g][_]}),m=r&&Object.entries(r).reduce((g,v)=>{let[x,_]=v;return _===void 0||(g[x]=_),g},{}),p=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((g,v)=>{let{class:x,className:_,...S}=v;return Object.entries(S).every(A=>{let[E,k]=A;return Array.isArray(k)?k.includes({...d,...m}[E]):{...d,...m}[E]===k})?[...g,x,_]:g},[]);return wg(n,h,p,r?.class,r?.className)},d_=(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},f_=(n,a)=>({classGroupId:n,validator:a}),jy=(n=new Map,a=null,r)=>({nextPart:n,validators:a,classGroupId:r}),ko="-",_g=[],h_="arbitrary..",m_=n=>{const a=g_(n),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return p_(h);const m=h.split(ko),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?d_(g,p):p:g||_g}return r[h]||_g}}},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(ko):n.slice(a).join(ko),p=h.length;for(let g=0;g<p;g++){const v=h[g];if(v.validator(m))return v.classGroupId}},p_=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?h_+l:void 0})(),g_=n=>{const{theme:a,classGroups:r}=n;return y_(r,a)},y_=(n,a)=>{const r=jy();for(const l in n){const c=n[l];nf(c,r,l,a)}return r},nf=(n,a,r,l)=>{const c=n.length;for(let d=0;d<c;d++){const h=n[d];v_(h,a,r,l)}},v_=(n,a,r,l)=>{if(typeof n=="string"){b_(n,a,r);return}if(typeof n=="function"){x_(n,a,r,l);return}w_(n,a,r,l)},b_=(n,a,r)=>{const l=n===""?a:Ny(a,n);l.classGroupId=r},x_=(n,a,r,l)=>{if(__(n)){nf(n(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(f_(r,n))},w_=(n,a,r,l)=>{const c=Object.entries(n),d=c.length;for(let h=0;h<d;h++){const[m,p]=c[h];nf(p,Ny(a,m),r,l)}},Ny=(n,a)=>{let r=n;const l=a.split(ko),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=jy(),r.nextPart.set(h,m)),r=m}return r},__=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,S_=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)}}},Ud="!",Sg=":",j_=[],jg=(n,a,r,l,c)=>({modifiers:n,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),E_=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 E=0;E<v;E++){const k=c[E];if(h===0&&m===0){if(k===Sg){d.push(c.slice(p,E)),p=E+1;continue}if(k==="/"){g=E;continue}}k==="["?h++:k==="]"?h--:k==="("?m++:k===")"&&m--}const x=d.length===0?c:c.slice(p);let _=x,S=!1;x.endsWith(Ud)?(_=x.slice(0,-1),S=!0):x.startsWith(Ud)&&(_=x.slice(1),S=!0);const A=g&&g>p?g-p:void 0;return jg(d,S,_,A)};if(a){const c=a+Sg,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):jg(j_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},N_=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}},T_=n=>({cache:S_(n.cacheSize),parseClassName:E_(n),sortModifiers:N_(n),...m_(n)}),A_=/\s+/,C_=(n,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=n.trim().split(A_);let p="";for(let g=m.length-1;g>=0;g-=1){const v=m[g],{isExternal:x,modifiers:_,hasImportantModifier:S,baseClassName:A,maybePostfixModifierPosition:E}=r(v);if(x){p=v+(p.length>0?" "+p:p);continue}let k=!!E,O=l(k?A.substring(0,E):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=_.length===0?"":_.length===1?_[0]:d(_).join(":"),L=S?q+Ud:q,P=L+O;if(h.indexOf(P)>-1)continue;h.push(P);const W=c(O,k);for(let Q=0;Q<W.length;++Q){const Y=W[Q];h.push(L+Y)}p=v+(p.length>0?" "+p:p)}return p},k_=(...n)=>{let a=0,r,l,c="";for(;a<n.length;)(r=n[a++])&&(l=Ty(r))&&(c&&(c+=" "),c+=l);return c},Ty=n=>{if(typeof n=="string")return n;let a,r="";for(let l=0;l<n.length;l++)n[l]&&(a=Ty(n[l]))&&(r&&(r+=" "),r+=a);return r},O_=(n,...a)=>{let r,l,c,d;const h=p=>{const g=a.reduce((v,x)=>x(v),n());return r=T_(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=C_(p,r);return c(p,v),v};return d=h,(...p)=>d(k_(...p))},R_=[],dt=n=>{const a=r=>r[n]||R_;return a.isThemeGetter=!0,a},Ay=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Cy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,D_=/^\d+\/\d+$/,M_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,z_=/\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$/,U_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,L_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,B_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tr=n=>D_.test(n),we=n=>!!n&&!Number.isNaN(Number(n)),Tn=n=>!!n&&Number.isInteger(Number(n)),hd=n=>n.endsWith("%")&&we(n.slice(0,-1)),Ya=n=>M_.test(n),q_=()=>!0,$_=n=>z_.test(n)&&!U_.test(n),ky=()=>!1,H_=n=>L_.test(n),V_=n=>B_.test(n),I_=n=>!te(n)&&!ae(n),G_=n=>Sr(n,Dy,ky),te=n=>Ay.test(n),Zn=n=>Sr(n,My,$_),md=n=>Sr(n,X_,we),Eg=n=>Sr(n,Oy,ky),P_=n=>Sr(n,Ry,V_),co=n=>Sr(n,zy,H_),ae=n=>Cy.test(n),_i=n=>jr(n,My),K_=n=>jr(n,Q_),Ng=n=>jr(n,Oy),Y_=n=>jr(n,Dy),J_=n=>jr(n,Ry),uo=n=>jr(n,zy,!0),Sr=(n,a,r)=>{const l=Ay.exec(n);return l?l[1]?a(l[1]):r(l[2]):!1},jr=(n,a,r=!1)=>{const l=Cy.exec(n);return l?l[1]?a(l[1]):r:!1},Oy=n=>n==="position"||n==="percentage",Ry=n=>n==="image"||n==="url",Dy=n=>n==="length"||n==="size"||n==="bg-size",My=n=>n==="length",X_=n=>n==="number",Q_=n=>n==="family-name",zy=n=>n==="shadow",Z_=()=>{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"),x=dt("inset-shadow"),_=dt("text-shadow"),S=dt("drop-shadow"),A=dt("blur"),E=dt("perspective"),k=dt("aspect"),O=dt("ease"),q=dt("animate"),L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...P(),ae,te],Q=()=>["auto","hidden","clip","visible","scroll"],Y=()=>["auto","contain","none"],J=()=>[ae,te,p],fe=()=>[tr,"full","auto",...J()],Ie=()=>[Tn,"none","subgrid",ae,te],pe=()=>["auto",{span:["full",Tn,ae,te]},Tn,ae,te],ge=()=>[Tn,"auto",ae,te],et=()=>["auto","min","max","fr",ae,te],nt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ue=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...J()],H=()=>[tr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...J()],K=()=>[n,ae,te],Ee=()=>[...P(),Ng,Eg,{position:[ae,te]}],_e=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",Y_,G_,{size:[ae,te]}],I=()=>[hd,_i,Zn],X=()=>["","none","full",g,ae,te],Z=()=>["",we,_i,Zn],ce=()=>["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"],ue=()=>[we,hd,Ng,Eg],Ge=()=>["","none",A,ae,te],Le=()=>["none",we,ae,te],Nt=()=>["none",we,ae,te],yt=()=>[we,ae,te],Ot=()=>[tr,"full",...J()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ya],breakpoint:[Ya],color:[q_],container:[Ya],"drop-shadow":[Ya],ease:["in","out","in-out"],font:[I_],"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",we],text:[Ya],"text-shadow":[Ya],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",tr,te,ae,k]}],container:["container"],columns:[{columns:[we,te,ae,m]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"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:W()}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:fe()}],"inset-x":[{"inset-x":fe()}],"inset-y":[{"inset-y":fe()}],start:[{start:fe()}],end:[{end:fe()}],top:[{top:fe()}],right:[{right:fe()}],bottom:[{bottom:fe()}],left:[{left:fe()}],visibility:["visible","invisible","collapse"],z:[{z:[Tn,"auto",ae,te]}],basis:[{basis:[tr,"full","auto",m,...J()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[we,tr,"auto","initial","none",te]}],grow:[{grow:["",we,ae,te]}],shrink:[{shrink:["",we,ae,te]}],order:[{order:[Tn,"first","last","none",ae,te]}],"grid-cols":[{"grid-cols":Ie()}],"col-start-end":[{col:pe()}],"col-start":[{"col-start":ge()}],"col-end":[{"col-end":ge()}],"grid-rows":[{"grid-rows":Ie()}],"row-start-end":[{row:pe()}],"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":et()}],"auto-rows":[{"auto-rows":et()}],gap:[{gap:J()}],"gap-x":[{"gap-x":J()}],"gap-y":[{"gap-y":J()}],"justify-content":[{justify:[...nt(),"normal"]}],"justify-items":[{"justify-items":[...Ue(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ue()]}],"align-content":[{content:["normal",...nt()]}],"align-items":[{items:[...Ue(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ue(),{baseline:["","last"]}]}],"place-content":[{"place-content":nt()}],"place-items":[{"place-items":[...Ue(),"baseline"]}],"place-self":[{"place-self":["auto",...Ue()]}],p:[{p:J()}],px:[{px:J()}],py:[{py:J()}],ps:[{ps:J()}],pe:[{pe:J()}],pt:[{pt:J()}],pr:[{pr:J()}],pb:[{pb:J()}],pl:[{pl:J()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":J()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":J()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[m,"screen",...H()]}],"min-w":[{"min-w":[m,"screen","none",...H()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,_i,Zn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,ae,md]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hd,te]}],"font-family":[{font:[K_,te,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,ae,te]}],"line-clamp":[{"line-clamp":[we,"none",ae,md]}],leading:[{leading:[d,...J()]}],"list-image":[{"list-image":["none",ae,te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ae,te]}],"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:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[we,"from-font","auto",ae,Zn]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[we,"auto",ae,te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:J()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ae,te]}],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",ae,te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ee()}],"bg-repeat":[{bg:_e()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Tn,ae,te],radial:["",ae,te],conic:[Tn,ae,te]},J_,P_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"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:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[we,ae,te]}],"outline-w":[{outline:["",we,_i,Zn]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",v,uo,co]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",x,uo,co]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[we,Zn]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",_,uo,co]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[we,ae,te]}],"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":[we]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"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":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"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":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"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":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"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":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"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":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"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":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[ae,te]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[we]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"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:Ee()}],"mask-repeat":[{mask:_e()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ae,te]}],filter:[{filter:["","none",ae,te]}],blur:[{blur:Ge()}],brightness:[{brightness:[we,ae,te]}],contrast:[{contrast:[we,ae,te]}],"drop-shadow":[{"drop-shadow":["","none",S,uo,co]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",we,ae,te]}],"hue-rotate":[{"hue-rotate":[we,ae,te]}],invert:[{invert:["",we,ae,te]}],saturate:[{saturate:[we,ae,te]}],sepia:[{sepia:["",we,ae,te]}],"backdrop-filter":[{"backdrop-filter":["","none",ae,te]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[we,ae,te]}],"backdrop-contrast":[{"backdrop-contrast":[we,ae,te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",we,ae,te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[we,ae,te]}],"backdrop-invert":[{"backdrop-invert":["",we,ae,te]}],"backdrop-opacity":[{"backdrop-opacity":[we,ae,te]}],"backdrop-saturate":[{"backdrop-saturate":[we,ae,te]}],"backdrop-sepia":[{"backdrop-sepia":["",we,ae,te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":J()}],"border-spacing-x":[{"border-spacing-x":J()}],"border-spacing-y":[{"border-spacing-y":J()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ae,te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[we,"initial",ae,te]}],ease:[{ease:["linear","initial",O,ae,te]}],delay:[{delay:[we,ae,te]}],animate:[{animate:["none",q,ae,te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[E,ae,te]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:Le()}],"rotate-x":[{"rotate-x":Le()}],"rotate-y":[{"rotate-y":Le()}],"rotate-z":[{"rotate-z":Le()}],scale:[{scale:Nt()}],"scale-x":[{"scale-x":Nt()}],"scale-y":[{"scale-y":Nt()}],"scale-z":[{"scale-z":Nt()}],"scale-3d":["scale-3d"],skew:[{skew:yt()}],"skew-x":[{"skew-x":yt()}],"skew-y":[{"skew-y":yt()}],transform:[{transform:[ae,te,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ot()}],"translate-x":[{"translate-x":Ot()}],"translate-y":[{"translate-y":Ot()}],"translate-z":[{"translate-z":Ot()}],"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",ae,te]}],"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":J()}],"scroll-mx":[{"scroll-mx":J()}],"scroll-my":[{"scroll-my":J()}],"scroll-ms":[{"scroll-ms":J()}],"scroll-me":[{"scroll-me":J()}],"scroll-mt":[{"scroll-mt":J()}],"scroll-mr":[{"scroll-mr":J()}],"scroll-mb":[{"scroll-mb":J()}],"scroll-ml":[{"scroll-ml":J()}],"scroll-p":[{"scroll-p":J()}],"scroll-px":[{"scroll-px":J()}],"scroll-py":[{"scroll-py":J()}],"scroll-ps":[{"scroll-ps":J()}],"scroll-pe":[{"scroll-pe":J()}],"scroll-pt":[{"scroll-pt":J()}],"scroll-pr":[{"scroll-pr":J()}],"scroll-pb":[{"scroll-pb":J()}],"scroll-pl":[{"scroll-pl":J()}],"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",ae,te]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[we,_i,Zn,md]}],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"]}},F_=O_(Z_);function ke(...n){return F_(_y(n))}const W_=Sy("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"}}),F=w.forwardRef(({className:n,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?r_:"button";return o.jsx(h,{className:ke(W_({variant:a,size:r,className:n})),ref:d,...c})});F.displayName="Button";function Uy(){const{setTheme:n,theme:a}=a_();return o.jsxs(F,{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(qw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(bw,{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 Er(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 e1(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(x){h(x)}}function p(v){try{g(l.throw(v))}catch(x){h(x)}}function g(v){v.done?d(v.value):c(v.value).then(m,p)}g((l=l.apply(n,a||[])).next())})}function t1(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 a1=n=>n?(...a)=>n(...a):(...a)=>fetch(...a);class sf extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class n1 extends sf{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class Tg extends sf{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class Ag extends sf{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Ld;(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"})(Ld||(Ld={}));class s1{constructor(a,{headers:r={},customFetch:l,region:c=Ld.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=a1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return e1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:p,body:g,signal:v,timeout:x}=l;let _={},{region:S}=l;S||(S=this.region);const A=new URL(`${this.url}/${r}`);S&&S!=="any"&&(_["x-region"]=S,A.searchParams.set("forceFunctionRegion",S));let E;g&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&g instanceof Blob||g instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",E=g):typeof g=="string"?(_["Content-Type"]="text/plain",E=g):typeof FormData<"u"&&g instanceof FormData?E=g:(_["Content-Type"]="application/json",E=JSON.stringify(g)):g&&typeof g!="string"&&!(typeof Blob<"u"&&g instanceof Blob)&&!(g instanceof ArrayBuffer)&&!(typeof FormData<"u"&&g instanceof FormData)?E=JSON.stringify(g):E=g;let k=v;x&&(h=new AbortController,d=setTimeout(()=>h.abort(),x),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({},_),this.headers),m),body:E,signal:k}).catch(W=>{throw new n1(W)}),q=O.headers.get("x-relay-error");if(q&&q==="true")throw new Tg(O);if(!O.ok)throw new Ag(O);let L=((c=O.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),P;return L==="application/json"?P=yield O.json():L==="application/octet-stream"||L==="application/pdf"?P=yield O.blob():L==="text/event-stream"?P=O:L==="multipart/form-data"?P=yield O.formData():P=yield O.text(),{data:P,error:null,response:O}}catch(m){return{data:null,error:m,response:m instanceof Ag||m instanceof Tg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var r1=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}},i1=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 E=(x=r.headers.get("Prefer"))===null||x===void 0?void 0:x.match(/count=(exact|planned|estimated)/),k=(_=d.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");E&&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 E=await d.text();try{h=JSON.parse(E),Array.isArray(h)&&d.status===404&&(m=[],h=null,g=200,v="OK")}catch{d.status===404&&E===""?(g=204,v="No Content"):h={message:E}}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 r1(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:"",E=(v=p?.code)!==null&&v!==void 0?v:"";m=`${(x=d?.name)!==null&&x!==void 0?x:"FetchError"}: ${d?.message}`,m+=`
8
+ `+i.stack}}var Rn=Object.prototype.hasOwnProperty,en=n.unstable_scheduleCallback,ds=n.unstable_cancelCallback,Ii=n.unstable_shouldYield,Gi=n.unstable_requestPaint,mt=n.unstable_now,fs=n.unstable_getCurrentPriorityLevel,Pi=n.unstable_ImmediatePriority,Ki=n.unstable_UserBlockingPriority,hs=n.unstable_NormalPriority,Go=n.unstable_LowPriority,Yi=n.unstable_IdlePriority,Po=n.log,Ko=n.unstable_setDisableYieldValue,Dn=null,Ct=null;function pa(e){if(typeof Po=="function"&&Ko(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Dn,e)}catch{}}var kt=Math.clz32?Math.clz32:Jo,Yo=Math.log,Ji=Math.LN2;function Jo(e){return e>>>=0,e===0?32:31-(Yo(e)/Ji|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 z(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 ne(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function De(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 kr(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,j=e.expirationTimes,D=e.hiddenUpdates;for(s=y&~s;0<s;){var $=31-kt(s),G=1<<$;b[$]=0,j[$]=-1;var M=D[$];if(M!==null)for(D[$]=null,$=0;$<M.length;$++){var U=M[$];U!==null&&(U.lane&=-536870913)}s&=~G}i!==0&&Xi(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function Xi(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 Qi(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 mf(e,t){var s=t&-t;return s=(s&42)!==0?1:Xo(s),(s&(e.suspendedLanes|t))!==0?0:s}function Xo(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 Qo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function pf(){var e=H.p;return e!==0?e:(e=window.event,e===void 0?32:eg(e.type))}function gf(e,t){var s=H.p;try{return H.p=e,t()}finally{H.p=s}}var an=Math.random().toString(36).slice(2),bt="__reactFiber$"+an,Rt="__reactProps$"+an,vs="__reactContainer$"+an,Zo="__reactEvents$"+an,Iv="__reactListeners$"+an,Gv="__reactHandles$"+an,yf="__reactResources$"+an,Or="__reactMarker$"+an;function Fo(e){delete e[bt],delete e[Rt],delete e[Zo],delete e[Iv],delete e[Gv]}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=Bp(e);e!==null;){if(s=e[bt])return s;e=Bp(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 Rr(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[yf];return t||(t=e[yf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pt(e){e[Or]=!0}var vf=new Set,bf={};function Mn(e,t){_s(e,t),_s(e+"Capture",t)}function _s(e,t){for(bf[e]=t,e=0;e<t.length;e++)vf.add(t[e])}var Pv=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]*$"),xf={},wf={};function Kv(e){return Rn.call(wf,e)?!0:Rn.call(xf,e)?!1:Pv.test(e)?wf[e]=!0:(xf[e]=!0,!1)}function Zi(e,t,s){if(Kv(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 Fi(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 Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _f(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Yv(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 Wo(e){if(!e._valueTracker){var t=_f(e)?"checked":"value";e._valueTracker=Yv(e,t,""+e[t])}}function Sf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=_f(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}function Wi(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 Jv=/[\n"\\]/g;function Qt(e){return e.replace(Jv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ec(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=""+Xt(t)):e.value!==""+Xt(t)&&(e.value=""+Xt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?tc(e,y,Xt(t)):s!=null?tc(e,y,Xt(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=""+Xt(b):e.removeAttribute("name")}function jf(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)){Wo(e);return}s=s!=null?""+Xt(s):"",t=t!=null?""+Xt(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),Wo(e)}function tc(e,t,s){t==="number"&&Wi(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=""+Xt(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=""+Xt(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Xt(s):""}function Nf(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(l(92));if(Le(i)){if(1<i.length)throw Error(l(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=Xt(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),Wo(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 Xv=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 Tf(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||Xv.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Af(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&&Tf(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&Tf(e,f,t[f])}function ac(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 Qv=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"]]),Zv=/^[\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 el(e){return Zv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ka(){}var nc=null;function sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Es=null,Ns=null;function Cf(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(ec(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="'+Qt(""+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));ec(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&&Sf(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 rc=!1;function kf(e,t,s){if(rc)return e(t,s);rc=!0;try{var i=e(t);return i}finally{if(rc=!1,(Es!==null||Ns!==null)&&(Hl(),Es&&(t=Es,e=Ns,Ns=Es=null,Cf(t),e)))for(t=0;t<e.length;t++)Cf(e[t])}}function Dr(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"),ic=!1;if(Oa)try{var Mr={};Object.defineProperty(Mr,"passive",{get:function(){ic=!0}}),window.addEventListener("test",Mr,Mr),window.removeEventListener("test",Mr,Mr)}catch{ic=!1}var nn=null,lc=null,tl=null;function Of(){if(tl)return tl;var e,t=lc,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 tl=u.slice(e,1<i?1-i:void 0)}function al(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 nl(){return!0}function Rf(){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)?nl:Rf,this.isPropagationStopped=Rf,this}return x(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=nl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=nl)},persist:function(){},isPersistent:nl}),t}var zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sl=Dt(zn),zr=x({},zn,{view:0,detail:0}),Fv=Dt(zr),oc,cc,Ur,rl=x({},zr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dc,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!==Ur&&(Ur&&e.type==="mousemove"?(oc=e.screenX-Ur.screenX,cc=e.screenY-Ur.screenY):cc=oc=0,Ur=e),oc)},movementY:function(e){return"movementY"in e?e.movementY:cc}}),Df=Dt(rl),Wv=x({},rl,{dataTransfer:0}),e0=Dt(Wv),t0=x({},zr,{relatedTarget:0}),uc=Dt(t0),a0=x({},zn,{animationName:0,elapsedTime:0,pseudoElement:0}),n0=Dt(a0),s0=x({},zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),r0=Dt(s0),i0=x({},zn,{data:0}),Mf=Dt(i0),l0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},o0={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"},c0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function u0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=c0[e])?!!t[e]:!1}function dc(){return u0}var d0=x({},zr,{key:function(e){if(e.key){var t=l0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=al(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?o0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dc,charCode:function(e){return e.type==="keypress"?al(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?al(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),f0=Dt(d0),h0=x({},rl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zf=Dt(h0),m0=x({},zr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dc}),p0=Dt(m0),g0=x({},zn,{propertyName:0,elapsedTime:0,pseudoElement:0}),y0=Dt(g0),v0=x({},rl,{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}),b0=Dt(v0),x0=x({},zn,{newState:0,oldState:0}),w0=Dt(x0),_0=[9,13,27,32],fc=Oa&&"CompositionEvent"in window,Lr=null;Oa&&"documentMode"in document&&(Lr=document.documentMode);var S0=Oa&&"TextEvent"in window&&!Lr,Uf=Oa&&(!fc||Lr&&8<Lr&&11>=Lr),Lf=" ",Bf=!1;function qf(e,t){switch(e){case"keyup":return _0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $f(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ts=!1;function j0(e,t){switch(e){case"compositionend":return $f(t);case"keypress":return t.which!==32?null:(Bf=!0,Lf);case"textInput":return e=t.data,e===Lf&&Bf?null:e;default:return null}}function E0(e,t){if(Ts)return e==="compositionend"||!fc&&qf(e,t)?(e=Of(),tl=lc=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 Uf&&t.locale!=="ko"?null:t.data;default:return null}}var N0={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 Hf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!N0[e.type]:t==="textarea"}function Vf(e,t,s,i){Es?Ns?Ns.push(i):Ns=[i]:Es=i,t=Jl(t,"onChange"),0<t.length&&(s=new sl("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var Br=null,qr=null;function T0(e){jp(e,0)}function il(e){var t=Rr(e);if(Sf(t))return e}function If(e,t){if(e==="change")return t}var Gf=!1;if(Oa){var hc;if(Oa){var mc="oninput"in document;if(!mc){var Pf=document.createElement("div");Pf.setAttribute("oninput","return;"),mc=typeof Pf.oninput=="function"}hc=mc}else hc=!1;Gf=hc&&(!document.documentMode||9<document.documentMode)}function Kf(){Br&&(Br.detachEvent("onpropertychange",Yf),qr=Br=null)}function Yf(e){if(e.propertyName==="value"&&il(qr)){var t=[];Vf(t,qr,e,sc(e)),kf(T0,t)}}function A0(e,t,s){e==="focusin"?(Kf(),Br=t,qr=s,Br.attachEvent("onpropertychange",Yf)):e==="focusout"&&Kf()}function C0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return il(qr)}function k0(e,t){if(e==="click")return il(t)}function O0(e,t){if(e==="input"||e==="change")return il(t)}function R0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qt=typeof Object.is=="function"?Object.is:R0;function $r(e,t){if(qt(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)||!qt(e[u],t[u]))return!1}return!0}function Jf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xf(e,t){var s=Jf(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=Jf(s)}}function Qf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Wi(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=Wi(e.document)}return t}function pc(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 D0=Oa&&"documentMode"in document&&11>=document.documentMode,As=null,gc=null,Hr=null,yc=!1;function Ff(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;yc||As==null||As!==Wi(i)||(i=As,"selectionStart"in i&&pc(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}),Hr&&$r(Hr,i)||(Hr=i,i=Jl(gc,"onSelect"),0<i.length&&(t=new sl("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")},vc={},Wf={};Oa&&(Wf=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(vc[e])return vc[e];if(!Cs[e])return e;var t=Cs[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Wf)return vc[e]=t[s];return e}var eh=Ln("animationend"),th=Ln("animationiteration"),ah=Ln("animationstart"),M0=Ln("transitionrun"),z0=Ln("transitionstart"),U0=Ln("transitioncancel"),nh=Ln("transitionend"),sh=new Map,bc="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(" ");bc.push("scrollEnd");function la(e,t){sh.set(e,t),Mn(t,[e])}var ll=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)},Zt=[],ks=0,xc=0;function ol(){for(var e=ks,t=xc=ks=0;t<e;){var s=Zt[t];Zt[t++]=null;var i=Zt[t];Zt[t++]=null;var u=Zt[t];Zt[t++]=null;var f=Zt[t];if(Zt[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&&rh(s,u,f)}}function cl(e,t,s,i){Zt[ks++]=e,Zt[ks++]=t,Zt[ks++]=s,Zt[ks++]=i,xc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function wc(e,t,s,i){return cl(e,t,s,i),ul(e)}function Bn(e,t){return cl(e,null,null,t),ul(e)}function rh(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 ul(e){if(50<ci)throw ci=0,ku=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 L0(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 $t(e,t,s,i){return new L0(e,t,s,i)}function _c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ra(e,t){var s=e.alternate;return s===null?(s=$t(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 ih(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 dl(e,t,s,i,u,f){var y=0;if(i=e,typeof e=="function")_c(e)&&(y=1);else if(typeof e=="string")y=Vb(e,s,Z.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case fe:return e=$t(31,s,t,u),e.elementType=fe,e.lanes=f,e;case E:return qn(s.children,u,f,t);case k:y=8,u|=24;break;case O:return e=$t(12,s,t,u|2),e.elementType=O,e.lanes=f,e;case W:return e=$t(13,s,t,u),e.elementType=W,e.lanes=f,e;case Q:return e=$t(19,s,t,u),e.elementType=Q,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 P:y=11;break e;case Y:y=14;break e;case J:y=16,i=null;break e}y=29,s=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=$t(y,s,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function qn(e,t,s,i){return e=$t(7,e,i,t),e.lanes=s,e}function Sc(e,t,s){return e=$t(6,e,null,t),e.lanes=s,e}function lh(e){var t=$t(18,null,null,0);return t.stateNode=e,t}function jc(e,t,s){return t=$t(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var oh=new WeakMap;function Ft(e,t){if(typeof e=="object"&&e!==null){var s=oh.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Cr(t)},oh.set(e,t),t)}return{value:e,source:t,stack:Cr(t)}}var Rs=[],Ds=0,fl=null,Vr=0,Wt=[],ea=0,sn=null,ya=1,va="";function Da(e,t){Rs[Ds++]=Vr,Rs[Ds++]=fl,fl=e,Vr=t}function ch(e,t,s){Wt[ea++]=ya,Wt[ea++]=va,Wt[ea++]=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),ch(e,1,0))}function Nc(e){for(;e===fl;)fl=Rs[--Ds],Rs[Ds]=null,Vr=Rs[--Ds],Rs[Ds]=null;for(;e===sn;)sn=Wt[--ea],Wt[ea]=null,va=Wt[--ea],Wt[ea]=null,ya=Wt[--ea],Wt[ea]=null}function uh(e,t){Wt[ea++]=ya,Wt[ea++]=va,Wt[ea++]=sn,ya=t.id,va=t.overflow,sn=e}var xt=null,Ye=null,Ce=!1,rn=null,ta=!1,Tc=Error(l(519));function ln(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ir(Ft(t,e)),Tc}function dh(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[bt]=e,t[Rt]=i,s){case"dialog":je("cancel",t),je("close",t);break;case"iframe":case"object":case"embed":je("load",t);break;case"video":case"audio":for(s=0;s<di.length;s++)je(di[s],t);break;case"source":je("error",t);break;case"img":case"image":case"link":je("error",t),je("load",t);break;case"details":je("toggle",t);break;case"input":je("invalid",t),jf(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":je("invalid",t);break;case"textarea":je("invalid",t),Nf(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||Ap(t.textContent,s)?(i.popover!=null&&(je("beforetoggle",t),je("toggle",t)),i.onScroll!=null&&je("scroll",t),i.onScrollEnd!=null&&je("scrollend",t),i.onClick!=null&&(t.onclick=ka),t=!0):t=!1,t||ln(e,!0)}function fh(e){for(xt=e.return;xt;)switch(xt.tag){case 5:case 31:case 13:ta=!1;return;case 27:case 3:ta=!0;return;default:xt=xt.return}}function Ms(e){if(e!==xt)return!1;if(!Ce)return fh(e),Ce=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Pu(e.type,e.memoizedProps)),s=!s),s&&Ye&&ln(e),fh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ye=Lp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ye=Lp(e)}else t===27?(t=Ye,wn(e.type)?(e=Qu,Qu=null,Ye=e):Ye=t):Ye=xt?na(e.stateNode.nextSibling):null;return!0}function $n(){Ye=xt=null,Ce=!1}function Ac(){var e=rn;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),rn=null),e}function Ir(e){rn===null?rn=[e]:rn.push(e)}var Cc=N(null),Hn=null,Ma=null;function on(e,t,s){X(Cc,t._currentValue),t._currentValue=s}function za(e){e._currentValue=Cc.current,I(Cc)}function kc(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 Oc(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 j=0;j<t.length;j++)if(b.context===t[j]){f.lanes|=s,b=f.alternate,b!==null&&(b.lanes|=s),kc(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),kc(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;qt(u.pendingProps.value,y.value)||(e!==null?e.push(b):e=[b])}}else if(u===ue.current){if(y=u.alternate,y===null)throw Error(l(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(gi):e=[gi])}u=u.return}e!==null&&Oc(t,e,s,i),t.flags|=262144}function hl(e){for(e=e.firstContext;e!==null;){if(!qt(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 hh(Hn,e)}function ml(e,t){return Hn===null&&Vn(e),hh(e,t)}function hh(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 B0=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()})}},q0=n.unstable_scheduleCallback,$0=n.unstable_NormalPriority,st={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Rc(){return{controller:new B0,data:new Map,refCount:0}}function Gr(e){e.refCount--,e.refCount===0&&q0($0,function(){e.controller.abort()})}var Pr=null,Dc=0,Us=0,Ls=null;function H0(e,t){if(Pr===null){var s=Pr=[];Dc=0,Us=Uu(),Ls={status:"pending",value:void 0,then:function(i){s.push(i)}}}return Dc++,t.then(mh,mh),t}function mh(){if(--Dc===0&&Pr!==null){Ls!==null&&(Ls.status="fulfilled");var e=Pr;Pr=null,Us=0,Ls=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function V0(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 ph=L.S;L.S=function(e,t){Fm=mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&H0(e,t),ph!==null&&ph(e,t)};var In=N(null);function Mc(){var e=In.current;return e!==null?e:Ie.pooledCache}function pl(e,t){t===null?X(In,In.current):X(In,t.pool)}function gh(){var e=Mc();return e===null?null:{parent:st._currentValue,pool:e}}var Bs=Error(l(460)),zc=Error(l(474)),gl=Error(l(542)),yl={then:function(){}};function yh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function vh(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,xh(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,xh(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 bh(){if(Pn===null)throw Error(l(459));var e=Pn;return Pn=null,e}function xh(e){if(e===Bs||e===gl)throw Error(l(483))}var qs=null,Kr=0;function vl(e){var t=Kr;return Kr+=1,qs===null&&(qs=[]),vh(qs,e,t)}function Yr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function bl(e,t){throw t.$$typeof===_?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function wh(e){function t(C,T){if(e){var R=C.deletions;R===null?(C.deletions=[T],C.flags|=16):R.push(T)}}function s(C,T){if(!e)return null;for(;T!==null;)t(C,T),T=T.sibling;return null}function i(C){for(var T=new Map;C!==null;)C.key!==null?T.set(C.key,C):T.set(C.index,C),C=C.sibling;return T}function u(C,T){return C=Ra(C,T),C.index=0,C.sibling=null,C}function f(C,T,R){return C.index=R,e?(R=C.alternate,R!==null?(R=R.index,R<T?(C.flags|=67108866,T):R):(C.flags|=67108866,T)):(C.flags|=1048576,T)}function y(C){return e&&C.alternate===null&&(C.flags|=67108866),C}function b(C,T,R,V){return T===null||T.tag!==6?(T=Sc(R,C.mode,V),T.return=C,T):(T=u(T,R),T.return=C,T)}function j(C,T,R,V){var oe=R.type;return oe===E?$(C,T,R.props.children,V,R.key):T!==null&&(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===J&&Gn(oe)===T.type)?(T=u(T,R.props),Yr(T,R),T.return=C,T):(T=dl(R.type,R.key,R.props,null,C.mode,V),Yr(T,R),T.return=C,T)}function D(C,T,R,V){return T===null||T.tag!==4||T.stateNode.containerInfo!==R.containerInfo||T.stateNode.implementation!==R.implementation?(T=jc(R,C.mode,V),T.return=C,T):(T=u(T,R.children||[]),T.return=C,T)}function $(C,T,R,V,oe){return T===null||T.tag!==7?(T=qn(R,C.mode,V,oe),T.return=C,T):(T=u(T,R),T.return=C,T)}function G(C,T,R){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=Sc(""+T,C.mode,R),T.return=C,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case S:return R=dl(T.type,T.key,T.props,null,C.mode,R),Yr(R,T),R.return=C,R;case A:return T=jc(T,C.mode,R),T.return=C,T;case J:return T=Gn(T),G(C,T,R)}if(Le(T)||ge(T))return T=qn(T,C.mode,R,null),T.return=C,T;if(typeof T.then=="function")return G(C,vl(T),R);if(T.$$typeof===B)return G(C,ml(C,T),R);bl(C,T)}return null}function M(C,T,R,V){var oe=T!==null?T.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return oe!==null?null:b(C,T,""+R,V);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return R.key===oe?j(C,T,R,V):null;case A:return R.key===oe?D(C,T,R,V):null;case J:return R=Gn(R),M(C,T,R,V)}if(Le(R)||ge(R))return oe!==null?null:$(C,T,R,V,null);if(typeof R.then=="function")return M(C,T,vl(R),V);if(R.$$typeof===B)return M(C,T,ml(C,R),V);bl(C,R)}return null}function U(C,T,R,V,oe){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return C=C.get(R)||null,b(T,C,""+V,oe);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return C=C.get(V.key===null?R:V.key)||null,j(T,C,V,oe);case A:return C=C.get(V.key===null?R:V.key)||null,D(T,C,V,oe);case J:return V=Gn(V),U(C,T,R,V,oe)}if(Le(V)||ge(V))return C=C.get(R)||null,$(T,C,V,oe,null);if(typeof V.then=="function")return U(C,T,R,vl(V),oe);if(V.$$typeof===B)return U(C,T,R,ml(T,V),oe);bl(T,V)}return null}function ee(C,T,R,V){for(var oe=null,Oe=null,re=T,xe=T=0,Te=null;re!==null&&xe<R.length;xe++){re.index>xe?(Te=re,re=null):Te=re.sibling;var Re=M(C,re,R[xe],V);if(Re===null){re===null&&(re=Te);break}e&&re&&Re.alternate===null&&t(C,re),T=f(Re,T,xe),Oe===null?oe=Re:Oe.sibling=Re,Oe=Re,re=Te}if(xe===R.length)return s(C,re),Ce&&Da(C,xe),oe;if(re===null){for(;xe<R.length;xe++)re=G(C,R[xe],V),re!==null&&(T=f(re,T,xe),Oe===null?oe=re:Oe.sibling=re,Oe=re);return Ce&&Da(C,xe),oe}for(re=i(re);xe<R.length;xe++)Te=U(re,C,xe,R[xe],V),Te!==null&&(e&&Te.alternate!==null&&re.delete(Te.key===null?xe:Te.key),T=f(Te,T,xe),Oe===null?oe=Te:Oe.sibling=Te,Oe=Te);return e&&re.forEach(function(Nn){return t(C,Nn)}),Ce&&Da(C,xe),oe}function de(C,T,R,V){if(R==null)throw Error(l(151));for(var oe=null,Oe=null,re=T,xe=T=0,Te=null,Re=R.next();re!==null&&!Re.done;xe++,Re=R.next()){re.index>xe?(Te=re,re=null):Te=re.sibling;var Nn=M(C,re,Re.value,V);if(Nn===null){re===null&&(re=Te);break}e&&re&&Nn.alternate===null&&t(C,re),T=f(Nn,T,xe),Oe===null?oe=Nn:Oe.sibling=Nn,Oe=Nn,re=Te}if(Re.done)return s(C,re),Ce&&Da(C,xe),oe;if(re===null){for(;!Re.done;xe++,Re=R.next())Re=G(C,Re.value,V),Re!==null&&(T=f(Re,T,xe),Oe===null?oe=Re:Oe.sibling=Re,Oe=Re);return Ce&&Da(C,xe),oe}for(re=i(re);!Re.done;xe++,Re=R.next())Re=U(re,C,xe,Re.value,V),Re!==null&&(e&&Re.alternate!==null&&re.delete(Re.key===null?xe:Re.key),T=f(Re,T,xe),Oe===null?oe=Re:Oe.sibling=Re,Oe=Re);return e&&re.forEach(function(Wb){return t(C,Wb)}),Ce&&Da(C,xe),oe}function He(C,T,R,V){if(typeof R=="object"&&R!==null&&R.type===E&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case S:e:{for(var oe=R.key;T!==null;){if(T.key===oe){if(oe=R.type,oe===E){if(T.tag===7){s(C,T.sibling),V=u(T,R.props.children),V.return=C,C=V;break e}}else if(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===J&&Gn(oe)===T.type){s(C,T.sibling),V=u(T,R.props),Yr(V,R),V.return=C,C=V;break e}s(C,T);break}else t(C,T);T=T.sibling}R.type===E?(V=qn(R.props.children,C.mode,V,R.key),V.return=C,C=V):(V=dl(R.type,R.key,R.props,null,C.mode,V),Yr(V,R),V.return=C,C=V)}return y(C);case A:e:{for(oe=R.key;T!==null;){if(T.key===oe)if(T.tag===4&&T.stateNode.containerInfo===R.containerInfo&&T.stateNode.implementation===R.implementation){s(C,T.sibling),V=u(T,R.children||[]),V.return=C,C=V;break e}else{s(C,T);break}else t(C,T);T=T.sibling}V=jc(R,C.mode,V),V.return=C,C=V}return y(C);case J:return R=Gn(R),He(C,T,R,V)}if(Le(R))return ee(C,T,R,V);if(ge(R)){if(oe=ge(R),typeof oe!="function")throw Error(l(150));return R=oe.call(R),de(C,T,R,V)}if(typeof R.then=="function")return He(C,T,vl(R),V);if(R.$$typeof===B)return He(C,T,ml(C,R),V);bl(C,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,T!==null&&T.tag===6?(s(C,T.sibling),V=u(T,R),V.return=C,C=V):(s(C,T),V=Sc(R,C.mode,V),V.return=C,C=V),y(C)):s(C,T)}return function(C,T,R,V){try{Kr=0;var oe=He(C,T,R,V);return qs=null,oe}catch(re){if(re===Bs||re===gl)throw re;var Oe=$t(29,re,null,C.mode);return Oe.lanes=V,Oe.return=C,Oe}}}var Kn=wh(!0),_h=wh(!1),cn=!1;function Uc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lc(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,(Me&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=ul(e),rh(e,null,s),t}return cl(e,i,t,s),ul(e)}function Jr(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,Qi(e,s)}}function Bc(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 qc=!1;function Xr(){if(qc){var e=Ls;if(e!==null)throw e}}function Qr(e,t,s,i){qc=!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 j=b,D=j.next;j.next=null,y===null?f=D:y.next=D,y=j;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==y&&(b===null?$.firstBaseUpdate=D:b.next=D,$.lastBaseUpdate=j))}if(f!==null){var G=u.baseState;y=0,$=D=j=null,b=f;do{var M=b.lane&-536870913,U=M!==b.lane;if(U?(Ne&M)===M:(i&M)===M){M!==0&&M===Us&&(qc=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ee=e,de=b;M=t;var He=s;switch(de.tag){case 1:if(ee=de.payload,typeof ee=="function"){G=ee.call(He,G,M);break e}G=ee;break e;case 3:ee.flags=ee.flags&-65537|128;case 0:if(ee=de.payload,M=typeof ee=="function"?ee.call(He,G,M):ee,M==null)break e;G=x({},G,M);break e;case 2:cn=!0}}M=b.callback,M!==null&&(e.flags|=64,U&&(e.flags|=8192),U=u.callbacks,U===null?u.callbacks=[M]:U.push(M))}else U={lane:M,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(D=$=U,j=G):$=$.next=U,y|=M;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;U=b,b=U.next,U.next=null,u.lastBaseUpdate=U,u.shared.pending=null}}while(!0);$===null&&(j=G),u.baseState=j,u.firstBaseUpdate=D,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),gn|=y,e.lanes=y,e.memoizedState=G}}function Sh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function jh(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Sh(s[e],t)}var $s=N(null),xl=N(0);function Eh(e,t){e=Ga,X(xl,e),X($s,t),Ga=e|t.baseLanes}function $c(){X(xl,Ga),X($s,$s.current)}function Hc(){Ga=xl.current,I($s),I(xl)}var Ht=N(null),aa=null;function fn(e){var t=e.alternate;X(tt,tt.current&1),X(Ht,e),aa===null&&(t===null||$s.current!==null||t.memoizedState!==null)&&(aa=e)}function Vc(e){X(tt,tt.current),X(Ht,e),aa===null&&(aa=e)}function Nh(e){e.tag===22?(X(tt,tt.current),X(Ht,e),aa===null&&(aa=e)):hn()}function hn(){X(tt,tt.current),X(Ht,Ht.current)}function Vt(e){I(Ht),aa===e&&(aa=null),I(tt)}var tt=N(0);function wl(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Ju(s)||Xu(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,be=null,qe=null,rt=null,_l=!1,Hs=!1,Yn=!1,Sl=0,Zr=0,Vs=null,I0=0;function Ze(){throw Error(l(321))}function Ic(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!qt(e[s],t[s]))return!1;return!0}function Gc(e,t,s,i,u,f){return Ua=f,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,L.H=e===null||e.memoizedState===null?cm:ru,Yn=!1,f=s(i,u),Yn=!1,Hs&&(f=Ah(t,s,i,u)),Th(e),f}function Th(e){L.H=ei;var t=qe!==null&&qe.next!==null;if(Ua=0,rt=qe=be=null,_l=!1,Zr=0,Vs=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&hl(e)&&(it=!0))}function Ah(e,t,s,i){be=e;var u=0;do{if(Hs&&(Vs=null),Zr=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)}L.H=um,f=t(s,i)}while(Hs);return f}function G0(){var e=L.H,t=e.useState()[0];return t=typeof t.then=="function"?Fr(t):t,e=e.useState()[0],(qe!==null?qe.memoizedState:null)!==e&&(be.flags|=1024),t}function Pc(){var e=Sl!==0;return Sl=0,e}function Kc(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Yc(e){if(_l){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}_l=!1}Ua=0,rt=qe=be=null,Hs=!1,Zr=Sl=0,Vs=null}function Ot(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?be.memoizedState=rt=e:rt=rt.next=e,rt}function at(){if(qe===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=qe.next;var t=rt===null?be.memoizedState:rt.next;if(t!==null)rt=t,qe=e;else{if(e===null)throw be.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?be.memoizedState=rt=e:rt=rt.next=e}return rt}function jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fr(e){var t=Zr;return Zr+=1,Vs===null&&(Vs=[]),e=vh(Vs,e,t),t=be,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,L.H=t===null||t.memoizedState===null?cm:ru),e}function El(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Fr(e);if(e.$$typeof===B)return wt(e)}throw Error(l(438,String(e)))}function Jc(e){var t=null,s=be.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=be.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=jl(),be.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]=Ge;return t.index++,s}function La(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=at();return Xc(t,qe,e)}function Xc(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,j=null,D=t,$=!1;do{var G=D.lane&-536870913;if(G!==D.lane?(Ne&G)===G:(Ua&G)===G){var M=D.revertLane;if(M===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null}),G===Us&&($=!0);else if((Ua&M)===M){D=D.next,M===Us&&($=!0);continue}else G={lane:0,revertLane:D.revertLane,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},j===null?(b=j=G,y=f):j=j.next=G,be.lanes|=M,gn|=M;G=D.action,Yn&&s(f,G),f=D.hasEagerState?D.eagerState:s(f,G)}else M={lane:G,revertLane:D.revertLane,gesture:D.gesture,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},j===null?(b=j=M,y=f):j=j.next=M,be.lanes|=G,gn|=G;D=D.next}while(D!==null&&D!==t);if(j===null?y=f:j.next=b,!qt(f,e.memoizedState)&&(it=!0,$&&(s=Ls,s!==null)))throw s;e.memoizedState=f,e.baseState=y,e.baseQueue=j,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Qc(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);qt(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),s.lastRenderedState=f}return[f,i]}function Ch(e,t,s){var i=be,u=at(),f=Ce;if(f){if(s===void 0)throw Error(l(407));s=s()}else s=t();var y=!qt((qe||u).memoizedState,s);if(y&&(u.memoizedState=s,it=!0),u=u.queue,Wc(Rh.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},Oh.bind(null,i,u,s,t),null),Ie===null)throw Error(l(349));f||(Ua&127)!==0||kh(i,t,s)}return s}function kh(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=be.updateQueue,t===null?(t=jl(),be.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Oh(e,t,s,i){t.value=s,t.getSnapshot=i,Dh(t)&&Mh(e)}function Rh(e,t,s){return s(function(){Dh(t)&&Mh(e)})}function Dh(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!qt(e,s)}catch{return!0}}function Mh(e){var t=Bn(e,2);t!==null&&Bt(t,e,2)}function Zc(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 zh(e,t,s,i){return e.baseState=s,Xc(e,qe,typeof i=="function"?i:La)}function P0(e,t,s,i,u){if(Cl(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)}};L.T!==null?s(!0):f.isTransition=!1,i(f),s=t.pending,s===null?(f.next=t.pending=f,Uh(t,f)):(f.next=s.next,t.pending=s.next=f)}}function Uh(e,t){var s=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=L.T,y={};L.T=y;try{var b=s(u,i),j=L.S;j!==null&&j(y,b),Lh(e,t,b)}catch(D){Fc(e,t,D)}finally{f!==null&&y.types!==null&&(f.types=y.types),L.T=f}}else try{f=s(u,i),Lh(e,t,f)}catch(D){Fc(e,t,D)}}function Lh(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){Bh(e,t,i)},function(i){return Fc(e,t,i)}):Bh(e,t,s)}function Bh(e,t,s){t.status="fulfilled",t.value=s,qh(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,Uh(e,s)))}function Fc(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,qh(t),t=t.next;while(t!==i)}e.action=null}function qh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function $h(e,t){return t}function Hh(e,t){if(Ce){var s=Ie.formState;if(s!==null){e:{var i=be;if(Ce){if(Ye){t:{for(var u=Ye,f=ta;u.nodeType!==8;){if(!f){u=null;break t}if(u=na(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ye=na(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:$h,lastRenderedState:t},s.queue=i,s=im.bind(null,be,i),i.dispatch=s,i=Zc(!1),f=su.bind(null,be,!1,i.queue),i=Ot(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,s=P0.bind(null,be,u,f,s),u.dispatch=s,i.memoizedState=e,[t,s,!1]}function Vh(e){var t=at();return Ih(t,qe,e)}function Ih(e,t,s){if(t=Xc(e,t,$h)[0],e=Nl(La)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Fr(t)}catch(y){throw y===Bs?gl:y}else i=t;t=at();var u=t.queue,f=u.dispatch;return s!==t.memoizedState&&(be.flags|=2048,Is(9,{destroy:void 0},K0.bind(null,u,s),null)),[i,f,e]}function K0(e,t){e.action=t}function Gh(e){var t=at(),s=qe;if(s!==null)return Ih(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=be.updateQueue,t===null&&(t=jl(),be.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 Ph(){return at().memoizedState}function Tl(e,t,s,i){var u=Ot();be.flags|=e,u.memoizedState=Is(1|t,{destroy:void 0},s,i===void 0?null:i)}function Al(e,t,s,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;qe!==null&&i!==null&&Ic(i,qe.memoizedState.deps)?u.memoizedState=Is(t,f,s,i):(be.flags|=e,u.memoizedState=Is(1|t,f,s,i))}function Kh(e,t){Tl(8390656,8,e,t)}function Wc(e,t){Al(2048,8,e,t)}function Y0(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=jl(),be.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function Yh(e){var t=at().memoizedState;return Y0({ref:t,nextImpl:e}),function(){if((Me&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Jh(e,t){return Al(4,2,e,t)}function Xh(e,t){return Al(4,4,e,t)}function Qh(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 Zh(e,t,s){s=s!=null?s.concat([e]):null,Al(4,4,Qh.bind(null,t,e),s)}function eu(){}function Fh(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&Ic(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function Wh(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&Ic(t,i[1]))return i[0];if(i=e(),Yn){pa(!0);try{e()}finally{pa(!1)}}return s.memoizedState=[i,t],i}function tu(e,t,s){return s===void 0||(Ua&1073741824)!==0&&(Ne&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=ep(),be.lanes|=e,gn|=e,s)}function em(e,t,s,i){return qt(s,t)?s:$s.current!==null?(e=tu(e,s,i),qt(e,t)||(it=!0),e):(Ua&42)===0||(Ua&1073741824)!==0&&(Ne&261930)===0?(it=!0,e.memoizedState=s):(e=ep(),be.lanes|=e,gn|=e,t)}function tm(e,t,s,i,u){var f=H.p;H.p=f!==0&&8>f?f:8;var y=L.T,b={};L.T=b,su(e,!1,t,s);try{var j=u(),D=L.S;if(D!==null&&D(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var $=V0(j,i);Wr(e,t,$,Pt(e))}else Wr(e,t,i,Pt(e))}catch(G){Wr(e,t,{then:function(){},status:"rejected",reason:G},Pt())}finally{H.p=f,y!==null&&b.types!==null&&(y.types=b.types),L.T=y}}function J0(){}function au(e,t,s,i){if(e.tag!==5)throw Error(l(476));var u=am(e).queue;tm(e,u,t,K,s===null?J0:function(){return nm(e),s(i)})}function am(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 nm(e){var t=am(e);t.next===null&&(t=e.alternate.memoizedState),Wr(e,t.next.queue,{},Pt())}function nu(){return wt(gi)}function sm(){return at().memoizedState}function rm(){return at().memoizedState}function X0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=Pt();e=un(s);var i=dn(t,e,s);i!==null&&(Bt(i,t,s),Jr(i,t,s)),t={cache:Rc()},e.payload=t;return}t=t.return}}function Q0(e,t,s){var i=Pt();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Cl(e)?lm(t,s):(s=wc(e,t,s,i),s!==null&&(Bt(s,e,i),om(s,t,i)))}function im(e,t,s){var i=Pt();Wr(e,t,s,i)}function Wr(e,t,s,i){var u={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Cl(e))lm(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,qt(b,y))return cl(e,t,u,0),Ie===null&&ol(),!1}catch{}if(s=wc(e,t,u,i),s!==null)return Bt(s,e,i),om(s,t,i),!0}return!1}function su(e,t,s,i){if(i={lane:2,revertLane:Uu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Cl(e)){if(t)throw Error(l(479))}else t=wc(e,s,i,2),t!==null&&Bt(t,e,2)}function Cl(e){var t=e.alternate;return e===be||t!==null&&t===be}function lm(e,t){Hs=_l=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function om(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Qi(e,s)}}var ei={readContext:wt,use:El,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useLayoutEffect:Ze,useInsertionEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useSyncExternalStore:Ze,useId:Ze,useHostTransitionStatus:Ze,useFormState:Ze,useActionState:Ze,useOptimistic:Ze,useMemoCache:Ze,useCacheRefresh:Ze};ei.useEffectEvent=Ze;var cm={readContext:wt,use:El,useCallback:function(e,t){return Ot().memoizedState=[e,t===void 0?null:t],e},useContext:wt,useEffect:Kh,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Tl(4194308,4,Qh.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Tl(4194308,4,e,t)},useInsertionEffect:function(e,t){Tl(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=Q0.bind(null,be,e),[i.memoizedState,e]},useRef:function(e){var t=Ot();return e={current:e},t.memoizedState=e},useState:function(e){e=Zc(e);var t=e.queue,s=im.bind(null,be,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:eu,useDeferredValue:function(e,t){var s=Ot();return tu(s,e,t)},useTransition:function(){var e=Zc(!1);return e=tm.bind(null,be,e.queue,!0,!1),Ot().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=be,u=Ot();if(Ce){if(s===void 0)throw Error(l(407));s=s()}else{if(s=t(),Ie===null)throw Error(l(349));(Ne&127)!==0||kh(i,t,s)}u.memoizedState=s;var f={value:s,getSnapshot:t};return u.queue=f,Kh(Rh.bind(null,i,f,e),[e]),i.flags|=2048,Is(9,{destroy:void 0},Oh.bind(null,i,f,s,t),null),s},useId:function(){var e=Ot(),t=Ie.identifierPrefix;if(Ce){var s=va,i=ya;s=(i&~(1<<32-kt(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Sl++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=I0++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nu,useFormState:Hh,useActionState:Hh,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=su.bind(null,be,!0,s),s.dispatch=t,[e,t]},useMemoCache:Jc,useCacheRefresh:function(){return Ot().memoizedState=X0.bind(null,be)},useEffectEvent:function(e){var t=Ot(),s={impl:e};return t.memoizedState=s,function(){if((Me&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},ru={readContext:wt,use:El,useCallback:Fh,useContext:wt,useEffect:Wc,useImperativeHandle:Zh,useInsertionEffect:Jh,useLayoutEffect:Xh,useMemo:Wh,useReducer:Nl,useRef:Ph,useState:function(){return Nl(La)},useDebugValue:eu,useDeferredValue:function(e,t){var s=at();return em(s,qe.memoizedState,e,t)},useTransition:function(){var e=Nl(La)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Fr(e),t]},useSyncExternalStore:Ch,useId:sm,useHostTransitionStatus:nu,useFormState:Vh,useActionState:Vh,useOptimistic:function(e,t){var s=at();return zh(s,qe,e,t)},useMemoCache:Jc,useCacheRefresh:rm};ru.useEffectEvent=Yh;var um={readContext:wt,use:El,useCallback:Fh,useContext:wt,useEffect:Wc,useImperativeHandle:Zh,useInsertionEffect:Jh,useLayoutEffect:Xh,useMemo:Wh,useReducer:Qc,useRef:Ph,useState:function(){return Qc(La)},useDebugValue:eu,useDeferredValue:function(e,t){var s=at();return qe===null?tu(s,e,t):em(s,qe.memoizedState,e,t)},useTransition:function(){var e=Qc(La)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Fr(e),t]},useSyncExternalStore:Ch,useId:sm,useHostTransitionStatus:nu,useFormState:Gh,useActionState:Gh,useOptimistic:function(e,t){var s=at();return qe!==null?zh(s,qe,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Jc,useCacheRefresh:rm};um.useEffectEvent=Yh;function iu(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:x({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var lu={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=Pt(),u=un(i);u.payload=t,s!=null&&(u.callback=s),t=dn(e,u,i),t!==null&&(Bt(t,e,i),Jr(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=Pt(),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),Jr(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Pt(),i=un(s);i.tag=2,t!=null&&(i.callback=t),t=dn(e,i,s),t!==null&&(Bt(t,e,s),Jr(t,e,s))}};function dm(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?!$r(s,i)||!$r(u,f):!0}function fm(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&&lu.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=x({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function hm(e){ll(e)}function mm(e){console.error(e)}function pm(e){ll(e)}function kl(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function gm(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 ou(e,t,s){return s=un(s),s.tag=3,s.payload={element:null},s.callback=function(){kl(e,t)},s}function ym(e){return e=un(e),e.tag=3,e}function vm(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(){gm(t,s,i)}}var y=s.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){gm(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 Z0(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=Ht.current,s!==null){switch(s.tag){case 31:case 13:return aa===null?Vl():s.alternate===null&&Fe===0&&(Fe=3),s.flags&=-257,s.flags|=65536,s.lanes=u,i===yl?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),Du(e,i,u)),!1;case 22:return s.flags|=65536,i===yl?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)),Du(e,i,u)),!1}throw Error(l(435,s.tag))}return Du(e,i,u),Vl(),!1}if(Ce)return t=Ht.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Tc&&(e=Error(l(422),{cause:i}),Ir(Ft(e,s)))):(i!==Tc&&(t=Error(l(423),{cause:i}),Ir(Ft(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=Ft(i,s),u=ou(e.stateNode,i,u),Bc(e,u),Fe!==4&&(Fe=2)),!1;var f=Error(l(520),{cause:i});if(f=Ft(f,s),oi===null?oi=[f]:oi.push(f),Fe!==4&&(Fe=2),t===null)return!0;i=Ft(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=ou(s.stateNode,i,e),Bc(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=ym(u),vm(u,e,s,i),Bc(s,u),!1}s=s.return}while(s!==null);return!1}var cu=Error(l(461)),it=!1;function _t(e,t,s,i){t.child=e===null?_h(t,null,s,i):Kn(t,e.child,s,i)}function bm(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=Gc(e,t,s,y,f,u),b=Pc(),e!==null&&!it?(Kc(e,t,u),Ba(e,t,u)):(Ce&&b&&Ec(t),t.flags|=1,_t(e,t,i,u),t.child)}function xm(e,t,s,i,u){if(e===null){var f=s.type;return typeof f=="function"&&!_c(f)&&f.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=f,wm(e,t,f,i,u)):(e=dl(s.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!yu(e,u)){var y=f.memoizedProps;if(s=s.compare,s=s!==null?s:$r,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 wm(e,t,s,i,u){if(e!==null){var f=e.memoizedProps;if($r(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,yu(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Ba(e,t,u)}return uu(e,t,s,i,u)}function _m(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 Sm(e,t,f,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pl(t,f!==null?f.cachePool:null),f!==null?Eh(t,f):$c(),Nh(t);else return i=t.lanes=536870912,Sm(e,t,f!==null?f.baseLanes|s:s,s,i)}else f!==null?(pl(t,f.cachePool),Eh(t,f),hn(),t.memoizedState=null):(e!==null&&pl(t,null),$c(),hn());return _t(e,t,u,s),t.child}function ti(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Sm(e,t,s,i,u){var f=Mc();return f=f===null?null:{parent:st._currentValue,pool:f},t.memoizedState={baseLanes:s,cachePool:f},e!==null&&pl(t,null),$c(),Nh(t),e!==null&&zs(e,t,i,!0),t.childLanes=u,null}function Ol(e,t){return t=Dl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function jm(e,t,s){return Kn(t,e.child,null,s),e=Ol(t,t.pendingProps),e.flags|=2,Vt(t),t.memoizedState=null,e}function F0(e,t,s){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ce){if(i.mode==="hidden")return e=Ol(t,i),t.lanes=536870912,ti(null,e);if(Vc(t),(e=Ye)?(e=Up(e,ta),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=lh(e),s.return=t,t.child=s,xt=t,Ye=null)):e=null,e===null)throw ln(t);return t.lanes=536870912,null}return Ol(t,i)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Vc(t),u)if(t.flags&256)t.flags&=-257,t=jm(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=mf(i,s),y!==0&&y!==f.retryLane))throw f.retryLane=y,Bn(e,y),Bt(i,e,y),cu;Vl(),t=jm(e,t,s)}else e=f.treeContext,Ye=na(y.nextSibling),xt=t,Ce=!0,rn=null,ta=!1,e!==null&&uh(t,e),t=Ol(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 Rl(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 uu(e,t,s,i,u){return Vn(t),s=Gc(e,t,s,i,void 0,u),i=Pc(),e!==null&&!it?(Kc(e,t,u),Ba(e,t,u)):(Ce&&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=Ah(t,i,s,u),Th(e),i=Pc(),e!==null&&!it?(Kc(e,t,f),Ba(e,t,f)):(Ce&&i&&Ec(t),t.flags|=1,_t(e,t,s,f),t.child)}function Nm(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=lu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Uc(t),y=s.contextType,f.context=typeof y=="object"&&y!==null?wt(y):Os,f.state=t.memoizedState,y=s.getDerivedStateFromProps,typeof y=="function"&&(iu(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&&lu.enqueueReplaceState(f,f.state,null),Qr(t,i,f,u),Xr(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var b=t.memoizedProps,j=Jn(s,b);f.props=j;var D=f.context,$=s.contextType;y=Os,typeof $=="object"&&$!==null&&(y=wt($));var G=s.getDerivedStateFromProps;$=typeof G=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||D!==y)&&fm(t,f,i,y),cn=!1;var M=t.memoizedState;f.state=M,Qr(t,i,f,u),Xr(),D=t.memoizedState,b||M!==D||cn?(typeof G=="function"&&(iu(t,s,G,i),D=t.memoizedState),(j=cn||dm(t,s,j,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=j):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Lc(e,t),y=t.memoizedProps,$=Jn(s,y),f.props=$,G=t.pendingProps,M=f.context,D=s.contextType,j=Os,typeof D=="object"&&D!==null&&(j=wt(D)),b=s.getDerivedStateFromProps,(D=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==G||M!==j)&&fm(t,f,i,j),cn=!1,M=t.memoizedState,f.state=M,Qr(t,i,f,u),Xr();var U=t.memoizedState;y!==G||M!==U||cn||e!==null&&e.dependencies!==null&&hl(e.dependencies)?(typeof b=="function"&&(iu(t,s,b,i),U=t.memoizedState),($=cn||dm(t,s,$,i,M,U,j)||e!==null&&e.dependencies!==null&&hl(e.dependencies))?(D||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,U,j),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,U,j)),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=U),f.props=i,f.state=U,f.context=j,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,Rl(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 Tm(e,t,s,i){return $n(),t.flags|=256,_t(e,t,s,i),t.child}var du={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:gh()}}function hu(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=Gt),e}function Am(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(Ce){if(u?fn(t):hn(),(e=Ye)?(e=Up(e,ta),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=lh(e),s.return=t,t.child=s,xt=t,Ye=null)):e=null,e===null)throw ln(t);return Xu(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(hn(),u=t.mode,b=Dl({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=fu(s),i.childLanes=hu(e,y,s),t.memoizedState=du,ti(null,i)):(fn(t),mu(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(f)t.flags&256?(fn(t),t.flags&=-257,t=pu(e,t,s)):t.memoizedState!==null?(hn(),t.child=e.child,t.flags|=128,t=null):(hn(),b=i.fallback,u=t.mode,i=Dl({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=fu(s),i.childLanes=hu(e,y,s),t.memoizedState=du,t=ti(null,i));else if(fn(t),Xu(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var D=y.dgst;y=D,i=Error(l(419)),i.stack="",i.digest=y,Ir({value:i,source:null,stack:null}),t=pu(e,t,s)}else if(it||zs(e,t,s,!1),y=(s&e.childLanes)!==0,it||y){if(y=Ie,y!==null&&(i=mf(y,s),i!==0&&i!==j.retryLane))throw j.retryLane=i,Bn(e,i),Bt(y,e,i),cu;Ju(b)||Vl(),t=pu(e,t,s)}else Ju(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,Ye=na(b.nextSibling),xt=t,Ce=!0,rn=null,ta=!1,e!==null&&uh(t,e),t=mu(t,i.children),t.flags|=4096);return t}return u?(hn(),b=i.fallback,u=t.mode,j=e.child,D=j.sibling,i=Ra(j,{mode:"hidden",children:i.children}),i.subtreeFlags=j.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,ti(null,i),i=t.child,b=e.child.memoizedState,b===null?b=fu(s):(u=b.cachePool,u!==null?(j=st._currentValue,u=u.parent!==j?{parent:j,pool:j}:u):u=gh(),b={baseLanes:b.baseLanes|s,cachePool:u}),i.memoizedState=b,i.childLanes=hu(e,y,s),t.memoizedState=du,ti(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 mu(e,t){return t=Dl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Dl(e,t){return e=$t(22,e,null,t),e.lanes=0,e}function pu(e,t,s){return Kn(t,e.child,null,s),e=mu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cm(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),kc(e.return,t,s)}function gu(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 km(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,X(tt,y),_t(e,t,i,s),i=Ce?Vr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cm(e,s,t);else if(e.tag===19)Cm(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&&wl(e)===null&&(u=s),s=s.sibling;s=u,s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),gu(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&&wl(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}gu(t,!0,s,null,f,i);break;case"together":gu(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 yu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&hl(e)))}function W0(e,t,s){switch(t.tag){case 3:Pe(t,t.stateNode.containerInfo),on(t,st,e.memoizedState.cache),$n();break;case 27:case 5:Tt(t);break;case 4:Pe(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,Vc(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?Am(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 km(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),X(tt,tt.current),i)break;return null;case 22:return t.lanes=0,_m(e,t,s,t.pendingProps);case 24:on(t,st,e.memoizedState.cache)}return Ba(e,t,s)}function Om(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!yu(e,s)&&(t.flags&128)===0)return it=!1,W0(e,t,s);it=(e.flags&131072)!==0}else it=!1,Ce&&(t.flags&1048576)!==0&&ch(t,Vr,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")_c(e)?(i=Jn(e,i),t.tag=1,t=Nm(null,t,e,i,s)):(t.tag=0,t=uu(null,t,e,i,s));else{if(e!=null){var u=e.$$typeof;if(u===P){t.tag=11,t=bm(null,t,e,i,s);break e}else if(u===Y){t.tag=14,t=xm(null,t,e,i,s);break e}}throw t=nt(e)||e,Error(l(306,t,""))}}return t;case 0:return uu(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,u=Jn(i,t.pendingProps),Nm(e,t,i,u,s);case 3:e:{if(Pe(t,t.stateNode.containerInfo),e===null)throw Error(l(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,Lc(e,t),Qr(t,i,null,s);var y=t.memoizedState;if(i=y.cache,on(t,st,i),i!==f.cache&&Oc(t,[st],s,!0),Xr(),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=Tm(e,t,i,s);break e}else if(i!==u){u=Ft(Error(l(424)),t),Ir(u),t=Tm(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,Ye=na(e.firstChild),xt=t,Ce=!0,rn=null,ta=!0,s=_h(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 Rl(e,t),e===null?(s=Vp(t.type,null,t.pendingProps,null))?t.memoizedState=s:Ce||(s=t.type,e=t.pendingProps,i=Xl(ye.current).createElement(s),i[bt]=t,i[Rt]=e,St(i,s,e),pt(i),t.stateNode=i):t.memoizedState=Vp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Ce&&(i=t.stateNode=qp(t.type,t.pendingProps,ye.current),xt=t,ta=!0,u=Ye,wn(t.type)?(Qu=u,Ye=na(i.firstChild)):Ye=u),_t(e,t,t.pendingProps.children,s),Rl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ce&&((u=i=Ye)&&(i=Cb(i,t.type,t.pendingProps,ta),i!==null?(t.stateNode=i,xt=t,Ye=na(i.firstChild),ta=!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,Pu(u,f)?i=null:y!==null&&Pu(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=Gc(e,t,G0,null,null,s),gi._currentValue=u),Rl(e,t),_t(e,t,i,s),t.child;case 6:return e===null&&Ce&&((e=s=Ye)&&(s=kb(s,t.pendingProps,ta),s!==null?(t.stateNode=s,xt=t,Ye=null,e=!0):e=!1),e||ln(t)),null;case 13:return Am(e,t,s);case 4:return Pe(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 bm(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 xm(e,t,t.type,t.pendingProps,s);case 15:return wm(e,t,t.type,t.pendingProps,s);case 19:return km(e,t,s);case 31:return F0(e,t,s);case 22:return _m(e,t,s,t.pendingProps);case 24:return Vn(t),i=wt(st),e===null?(u=Mc(),u===null&&(u=Ie,f=Rc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=s),u=f),t.memoizedState={parent:i,cache:u},Uc(t),on(t,st,u)):((e.lanes&s)!==0&&(Lc(e,t),Qr(t,null,null,s),Xr()),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&&Oc(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 vu(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(sp())e.flags|=8192;else throw Pn=yl,zc}else e.flags&=-16777217}function Rm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(t))if(sp())e.flags|=8192;else throw Pn=yl,zc}function Ml(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ga():536870912,e.lanes|=t,Ys|=t)}function ai(e,t){if(!Ce)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 Je(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 eb(e,t,s){var i=t.pendingProps;switch(Nc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return Je(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,Ac())),Je(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(qa(t),f!==null?(Je(t),Rm(t,f)):(Je(t),vu(t,u,null,i,s))):f?f!==e.memoizedState?(qa(t),Je(t),Rm(t,f)):(Je(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&qa(t),Je(t),vu(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 Je(t),null}e=Z.current,Ms(t)?dh(t):(e=qp(u,i,s),t.stateNode=e,qa(t))}return Je(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 Je(t),null}if(f=Z.current,Ms(t))dh(t);else{var y=Xl(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 Je(t),vu(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||Ap(e.nodeValue,s)),e||ln(t,!0)}else e=Xl(e).createTextNode(i),e[bt]=t,t.stateNode=e}return Je(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;Je(t),e=!1}else s=Ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(Vt(t),t):(Vt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Je(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;Je(t),u=!1}else u=Ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Vt(t),t):(Vt(t),null)}return Vt(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),Ml(t,t.updateQueue),Je(t),null);case 4:return Be(),e===null&&$u(t.stateNode.containerInfo),Je(t),null;case 10:return za(t.type),Je(t),null;case 19:if(I(tt),i=t.memoizedState,i===null)return Je(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)ai(i,!1);else{if(Fe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=wl(e),f!==null){for(t.flags|=128,ai(i,!1),e=f.updateQueue,t.updateQueue=e,Ml(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)ih(s,e),s=s.sibling;return X(tt,tt.current&1|2),Ce&&Da(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&mt()>ql&&(t.flags|=128,u=!0,ai(i,!1),t.lanes=4194304)}else{if(!u)if(e=wl(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Ml(t,e),ai(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!Ce)return Je(t),null}else 2*mt()-i.renderingStartTime>ql&&s!==536870912&&(t.flags|=128,u=!0,ai(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,X(tt,u?s&1|2:s&1),Ce&&Da(t,i.treeForkCount),e):(Je(t),null);case 22:case 23:return Vt(t),Hc(),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&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),s=t.updateQueue,s!==null&&Ml(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&&I(In),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),za(st),Je(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function tb(e,t){switch(Nc(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(Vt(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(Vt(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 I(tt),null;case 4:return Be(),null;case 10:return za(t.type),null;case 22:case 23:return Vt(t),Hc(),e!==null&&I(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 Dm(e,t){switch(Nc(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&&Vt(t);break;case 13:Vt(t);break;case 19:I(tt);break;case 10:za(t.type);break;case 22:case 23:Vt(t),Hc(),e!==null&&I(In);break;case 24:za(st)}}function ni(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){Ue(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 j=s,D=b;try{D()}catch($){Ue(u,j,$)}}}i=i.next}while(i!==f)}}catch($){Ue(t,t.return,$)}}function Mm(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{jh(t,s)}catch(i){Ue(e,e.return,i)}}}function zm(e,t,s){s.props=Jn(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){Ue(e,t,i)}}function si(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){Ue(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){Ue(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){Ue(e,t,u)}else s.current=null}function Um(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){Ue(e,e.return,u)}}function bu(e,t,s){try{var i=e.stateNode;Sb(i,e.type,s,t),i[Rt]=t}catch(u){Ue(e,e.return,u)}}function Lm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wn(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lm(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 wu(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(wu(e,t,s),e=e.sibling;e!==null;)wu(e,t,s),e=e.sibling}function zl(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(zl(e,t,s),e=e.sibling;e!==null;)zl(e,t,s),e=e.sibling}function Bm(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){Ue(e,e.return,f)}}var $a=!1,lt=!1,_u=!1,qm=typeof WeakSet=="function"?WeakSet:Set,gt=null;function ab(e,t){if(e=e.containerInfo,Iu=ao,e=Zf(e),pc(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,j=-1,D=0,$=0,G=e,M=null;t:for(;;){for(var U;G!==s||u!==0&&G.nodeType!==3||(b=y+u),G!==f||i!==0&&G.nodeType!==3||(j=y+i),G.nodeType===3&&(y+=G.nodeValue.length),(U=G.firstChild)!==null;)M=G,G=U;for(;;){if(G===e)break t;if(M===s&&++D===u&&(b=y),M===f&&++$===i&&(j=y),(U=G.nextSibling)!==null)break;G=M,M=G.parentNode}G=U}s=b===-1||j===-1?null:{start:b,end:j}}else s=null}s=s||{start:0,end:0}}else s=null;for(Gu={focusedElem:e,selectionRange:s},ao=!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 ee=Jn(s.type,u);e=i.getSnapshotBeforeUpdate(ee,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(de){Ue(s,s.return,de)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Yu(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Yu(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 $m(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Va(e,s),i&4&&ni(5,s);break;case 1:if(Va(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(y){Ue(s,s.return,y)}else{var u=Jn(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Ue(s,s.return,y)}}i&64&&Mm(s),i&512&&si(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{jh(e,t)}catch(y){Ue(s,s.return,y)}}break;case 27:t===null&&i&4&&Bm(s);case 26:case 5:Va(e,s),t===null&&i&4&&Um(s),i&512&&si(s,s.return);break;case 12:Va(e,s);break;case 31:Va(e,s),i&4&&Im(e,s);break;case 13:Va(e,s),i&4&&Gm(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=db.bind(null,s),Ob(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 Hm(e){var t=e.alternate;t!==null&&(e.alternate=null,Hm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Fo(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;)Vm(e,t,s),s=s.sibling}function Vm(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),hi(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){Ue(s,t,f)}else try{Xe.removeChild(s.stateNode)}catch(f){Ue(s,t,f)}break;case 18:Xe!==null&&(Mt?(e=Xe,Mp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),tr(e)):Mp(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"&&zm(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 Im(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{tr(e)}catch(s){Ue(t,t.return,s)}}}function Gm(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){Ue(t,t.return,s)}}function nb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new qm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new qm),t;default:throw Error(l(435,e.tag))}}function Ul(e,t){var s=nb(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var u=fb.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));Vm(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;)Pm(t,e),t=t.sibling}var oa=null;function Pm(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),ni(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[Or]||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=Pp("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=Pp("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 Kp(u,e.type,e.stateNode);else e.stateNode=Gp(u,i,e.memoizedProps);else f!==i?(f===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):f.count--,i===null?Kp(u,e.type,e.stateNode):Gp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&bu(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&&bu(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(ee){Ue(e,e.return,ee)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,bu(e,u,s!==null?s.memoizedProps:u)),i&1024&&(_u=!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(ee){Ue(e,e.return,ee)}}break;case 3:if(Fl=null,u=oa,oa=Ql(t.containerInfo),zt(t,e),oa=u,Ut(e),i&4&&s!==null&&s.memoizedState.isDehydrated)try{tr(t.containerInfo)}catch(ee){Ue(e,e.return,ee)}_u&&(_u=!1,Km(e));break;case 4:i=oa,oa=Ql(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,Ul(e,i)));break;case 13:zt(t,e),Ut(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Bl=mt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ul(e,i)));break;case 22:u=e.memoizedState!==null;var j=s!==null&&s.memoizedState!==null,D=$a,$=lt;if($a=D||u,lt=$||j,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||j||$a||lt||Xn(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){j=s=t;try{if(f=j.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=j.stateNode;var G=j.memoizedProps.style,M=G!=null&&G.hasOwnProperty("display")?G.display:null;b.style.display=M==null||typeof M=="boolean"?"":(""+M).trim()}}catch(ee){Ue(j,j.return,ee)}}}else if(t.tag===6){if(s===null){j=t;try{j.stateNode.nodeValue=u?"":j.memoizedProps}catch(ee){Ue(j,j.return,ee)}}}else if(t.tag===18){if(s===null){j=t;try{var U=j.stateNode;u?zp(U,!0):zp(j.stateNode,!1)}catch(ee){Ue(j,j.return,ee)}}}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,Ul(e,s))));break;case 19:zt(t,e),Ut(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ul(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(Lm(i)){s=i;break}i=i.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var u=s.stateNode,f=xu(e);zl(e,f,u);break;case 5:var y=s.stateNode;s.flags&32&&(js(y,""),s.flags&=-33);var b=xu(e);zl(e,b,y);break;case 3:case 4:var j=s.stateNode.containerInfo,D=xu(e);wu(e,D,j);break;default:throw Error(l(161))}}catch($){Ue(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Km(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Km(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;)$m(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"&&zm(t,t.return,s),Xn(t);break;case 27:hi(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),ni(4,f);break;case 1:if(Ia(u,f,s),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(D){Ue(i,i.return,D)}if(i=f,u=i.updateQueue,u!==null){var b=i.stateNode;try{var j=u.shared.hiddenCallbacks;if(j!==null)for(u.shared.hiddenCallbacks=null,u=0;u<j.length;u++)Sh(j[u],b)}catch(D){Ue(i,i.return,D)}}s&&y&64&&Mm(f),si(f,f.return);break;case 27:Bm(f);case 26:case 5:Ia(u,f,s),s&&i===null&&y&4&&Um(f),si(f,f.return);break;case 12:Ia(u,f,s);break;case 31:Ia(u,f,s),s&&y&4&&Im(u,f);break;case 13:Ia(u,f,s),s&&y&4&&Gm(u,f);break;case 22:f.memoizedState===null&&Ia(u,f,s),si(f,f.return);break;case 30:break;default:Ia(u,f,s)}t=t.sibling}}function Su(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&&Gr(s))}function ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gr(e))}function ca(e,t,s,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ym(e,t,s,i),t=t.sibling}function Ym(e,t,s,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ca(e,t,s,i),u&2048&&ni(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&&Gr(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(j){Ue(t,t.return,j)}}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):ri(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&&Su(y,t);break;case 24:ca(e,t,s,i),u&2048&&ju(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,j=i,D=y.flags;switch(y.tag){case 0:case 11:case 15:Gs(f,y,b,j,u),ni(8,y);break;case 23:break;case 22:var $=y.stateNode;y.memoizedState!==null?$._visibility&2?Gs(f,y,b,j,u):ri(f,y):($._visibility|=2,Gs(f,y,b,j,u)),u&&D&2048&&Su(y.alternate,y);break;case 24:Gs(f,y,b,j,u),u&&D&2048&&ju(y.alternate,y);break;default:Gs(f,y,b,j,u)}t=t.sibling}}function ri(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:ri(s,i),u&2048&&Su(i.alternate,i);break;case 24:ri(s,i),u&2048&&ju(i.alternate,i);break;default:ri(s,i)}t=t.sibling}}var ii=8192;function Ps(e,t,s){if(e.subtreeFlags&ii)for(e=e.child;e!==null;)Jm(e,t,s),e=e.sibling}function Jm(e,t,s){switch(e.tag){case 26:Ps(e,t,s),e.flags&ii&&e.memoizedState!==null&&Ib(s,oa,e.memoizedState,e.memoizedProps);break;case 5:Ps(e,t,s);break;case 3:case 4:var i=oa;oa=Ql(e.stateNode.containerInfo),Ps(e,t,s),oa=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=ii,ii=16777216,Ps(e,t,s),ii=i):Ps(e,t,s));break;default:Ps(e,t,s)}}function Xm(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 li(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,Zm(i,e)}Xm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Qm(e),e=e.sibling}function Qm(e){switch(e.tag){case 0:case 11:case 15:li(e),e.flags&2048&&mn(9,e,e.return);break;case 3:li(e);break;case 12:li(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ll(e)):li(e);break;default:li(e)}}function Ll(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,Zm(i,e)}Xm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:mn(8,t,t.return),Ll(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,Ll(t));break;default:Ll(t)}e=e.sibling}}function Zm(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:Gr(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(Hm(i),i===s){gt=null;break e}if(u!==null){u.return=f,gt=u;break e}gt=f}}}var sb={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}},rb=typeof WeakMap=="function"?WeakMap:Map,Me=0,Ie=null,Se=null,Ne=0,ze=0,It=null,pn=!1,Ks=!1,Eu=!1,Ga=0,Fe=0,gn=0,Qn=0,Nu=0,Gt=0,Ys=0,oi=null,Lt=null,Tu=!1,Bl=0,Fm=0,ql=1/0,$l=null,yn=null,ut=0,vn=null,Js=null,Pa=0,Au=0,Cu=null,Wm=null,ci=0,ku=null;function Pt(){return(Me&2)!==0&&Ne!==0?Ne&-Ne:L.T!==null?Uu():pf()}function ep(){if(Gt===0)if((Ne&536870912)===0||Ce){var e=ps;ps<<=1,(ps&3932160)===0&&(ps=262144),Gt=e}else Gt=536870912;return e=Ht.current,e!==null&&(e.flags|=32),Gt}function Bt(e,t,s){(e===Ie&&(ze===2||ze===9)||e.cancelPendingCommit!==null)&&(Xs(e,0),bn(e,Ne,Gt,!1)),tn(e,s),((Me&2)===0||e!==Ie)&&(e===Ie&&((Me&2)===0&&(Qn|=s),Fe===4&&bn(e,Ne,Gt,!1)),xa(e))}function tp(e,t,s){if((Me&6)!==0)throw Error(l(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||ne(e,t),u=i?ob(e,t):Ru(e,t,!0),f=i;do{if(u===0){Ks&&!i&&bn(e,t,0,!1);break}else{if(s=e.current.alternate,f&&!ib(s)){u=Ru(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=oi;var j=b.current.memoizedState.isDehydrated;if(j&&(Xs(b,y).flags|=256),y=Ru(b,y,!1),y!==2){if(Eu&&!j){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,Gt,!pn);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Bl+300-mt(),10<u)){if(bn(i,t,Gt,!pn),z(i,0,!0)!==0)break e;Pa=t,i.timeoutHandle=Rp(ap.bind(null,i,s,Lt,$l,Tu,t,Gt,Qn,Ys,pn,f,"Throttled",-0,0),u);break e}ap(i,s,Lt,$l,Tu,t,Gt,Qn,Ys,pn,f,null,-0,0)}}break}while(!0);xa(e)}function ap(e,t,s,i,u,f,y,b,j,D,$,G,M,U){if(e.timeoutHandle=-1,G=t.subtreeFlags,G&8192||(G&16785408)===16785408){G={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ka},Jm(t,f,G);var ee=(f&62914560)===f?Bl-mt():(f&4194048)===f?Fm-mt():0;if(ee=Gb(G,ee),ee!==null){Pa=f,e.cancelPendingCommit=ee(up.bind(null,e,t,f,s,i,u,y,b,j,$,G,null,M,U)),bn(e,f,y,!D);return}}up(e,t,f,s,i,u,y,b,j)}function ib(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(!qt(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&=~Nu,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&&Xi(e,s,t)}function Hl(){return(Me&6)===0?(ui(0),!1):!0}function Ou(){if(Se!==null){if(ze===0)var e=Se.return;else e=Se,Ma=Hn=null,Yc(e),qs=null,Kr=0,e=Se;for(;e!==null;)Dm(e.alternate,e),e=e.return;Se=null}}function Xs(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Nb(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Pa=0,Ou(),Ie=e,Se=s=Ra(e.current,null),Ne=t,ze=0,It=null,pn=!1,Ks=ne(e,t),Eu=!1,Ys=Gt=Nu=Qn=gn=Fe=0,Lt=oi=null,Tu=!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,ol(),s}function np(e,t){be=null,L.H=ei,t===Bs||t===gl?(t=bh(),ze=3):t===zc?(t=bh(),ze=4):ze=t===cu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,Se===null&&(Fe=1,kl(e,Ft(t,e.current)))}function sp(){var e=Ht.current;return e===null?!0:(Ne&4194048)===Ne?aa===null:(Ne&62914560)===Ne||(Ne&536870912)!==0?e===aa:!1}function rp(){var e=L.H;return L.H=ei,e===null?ei:e}function ip(){var e=L.A;return L.A=sb,e}function Vl(){Fe=4,pn||(Ne&4194048)!==Ne&&Ht.current!==null||(Ks=!0),(gn&134217727)===0&&(Qn&134217727)===0||Ie===null||bn(Ie,Ne,Gt,!1)}function Ru(e,t,s){var i=Me;Me|=2;var u=rp(),f=ip();(Ie!==e||Ne!==t)&&($l=null,Xs(e,t)),t=!1;var y=Fe;e:do try{if(ze!==0&&Se!==null){var b=Se,j=It;switch(ze){case 8:Ou(),y=6;break e;case 3:case 2:case 9:case 6:Ht.current===null&&(t=!0);var D=ze;if(ze=0,It=null,Qs(e,b,j,D),s&&Ks){y=0;break e}break;default:D=ze,ze=0,It=null,Qs(e,b,j,D)}}lb(),y=Fe;break}catch($){np(e,$)}while(!0);return t&&e.shellSuspendCounter++,Ma=Hn=null,Me=i,L.H=u,L.A=f,Se===null&&(Ie=null,Ne=0,ol()),y}function lb(){for(;Se!==null;)lp(Se)}function ob(e,t){var s=Me;Me|=2;var i=rp(),u=ip();Ie!==e||Ne!==t?($l=null,ql=mt()+500,Xs(e,t)):Ks=ne(e,t);e:do try{if(ze!==0&&Se!==null){t=Se;var f=It;t:switch(ze){case 1:ze=0,It=null,Qs(e,t,f,1);break;case 2:case 9:if(yh(f)){ze=0,It=null,op(t);break}t=function(){ze!==2&&ze!==9||Ie!==e||(ze=7),xa(e)},f.then(t,t);break e;case 3:ze=7;break e;case 4:ze=5;break e;case 7:yh(f)?(ze=0,It=null,op(t)):(ze=0,It=null,Qs(e,t,f,7));break;case 5:var y=null;switch(Se.tag){case 26:y=Se.memoizedState;case 5:case 27:var b=Se;if(y?Yp(y):b.stateNode.complete){ze=0,It=null;var j=b.sibling;if(j!==null)Se=j;else{var D=b.return;D!==null?(Se=D,Il(D)):Se=null}break t}}ze=0,It=null,Qs(e,t,f,5);break;case 6:ze=0,It=null,Qs(e,t,f,6);break;case 8:Ou(),Fe=6;break e;default:throw Error(l(462))}}cb();break}catch($){np(e,$)}while(!0);return Ma=Hn=null,L.H=i,L.A=u,Me=s,Se!==null?0:(Ie=null,Ne=0,ol(),Fe)}function cb(){for(;Se!==null&&!Ii();)lp(Se)}function lp(e){var t=Om(e.alternate,e,Ga);e.memoizedProps=e.pendingProps,t===null?Il(e):Se=t}function op(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Em(s,t,t.pendingProps,t.type,void 0,Ne);break;case 11:t=Em(s,t,t.pendingProps,t.type.render,t.ref,Ne);break;case 5:Yc(t);default:Dm(s,t),t=Se=ih(t,Ga),t=Om(s,t,Ga)}e.memoizedProps=e.pendingProps,t===null?Il(e):Se=t}function Qs(e,t,s,i){Ma=Hn=null,Yc(t),qs=null,Kr=0;var u=t.return;try{if(Z0(e,u,t,s,Ne)){Fe=1,kl(e,Ft(s,e.current)),Se=null;return}}catch(f){if(u!==null)throw Se=u,f;Fe=1,kl(e,Ft(s,e.current)),Se=null;return}t.flags&32768?(Ce||i===1?e=!0:Ks||(Ne&536870912)!==0?e=!1:(pn=e=!0,(i===2||i===9||i===3||i===6)&&(i=Ht.current,i!==null&&i.tag===13&&(i.flags|=16384))),cp(t,e)):Il(t)}function Il(e){var t=e;do{if((t.flags&32768)!==0){cp(t,pn);return}e=t.return;var s=eb(t.alternate,t,Ga);if(s!==null){Se=s;return}if(t=t.sibling,t!==null){Se=t;return}Se=t=e}while(t!==null);Fe===0&&(Fe=5)}function cp(e,t){do{var s=tb(e.alternate,e);if(s!==null){s.flags&=32767,Se=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){Se=e;return}Se=e=s}while(e!==null);Fe=6,Se=null}function up(e,t,s,i,u,f,y,b,j){e.cancelPendingCommit=null;do Gl();while(ut!==0);if((Me&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=xc,ys(e,s,f,y,b,j),e===Ie&&(Se=Ie=null,Ne=0),Js=t,vn=e,Pa=s,Au=f,Cu=u,Wm=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,hb(hs,function(){return pp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=L.T,L.T=null,u=H.p,H.p=2,y=Me,Me|=4;try{ab(e,t,s)}finally{Me=y,H.p=u,L.T=i}}ut=1,dp(),fp(),hp()}}function dp(){if(ut===1){ut=0;var e=vn,t=Js,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=L.T,L.T=null;var i=H.p;H.p=2;var u=Me;Me|=4;try{Pm(t,e);var f=Gu,y=Zf(e.containerInfo),b=f.focusedElem,j=f.selectionRange;if(y!==b&&b&&b.ownerDocument&&Qf(b.ownerDocument.documentElement,b)){if(j!==null&&pc(b)){var D=j.start,$=j.end;if($===void 0&&($=D),"selectionStart"in b)b.selectionStart=D,b.selectionEnd=Math.min($,b.value.length);else{var G=b.ownerDocument||document,M=G&&G.defaultView||window;if(M.getSelection){var U=M.getSelection(),ee=b.textContent.length,de=Math.min(j.start,ee),He=j.end===void 0?de:Math.min(j.end,ee);!U.extend&&de>He&&(y=He,He=de,de=y);var C=Xf(b,de),T=Xf(b,He);if(C&&T&&(U.rangeCount!==1||U.anchorNode!==C.node||U.anchorOffset!==C.offset||U.focusNode!==T.node||U.focusOffset!==T.offset)){var R=G.createRange();R.setStart(C.node,C.offset),U.removeAllRanges(),de>He?(U.addRange(R),U.extend(T.node,T.offset)):(R.setEnd(T.node,T.offset),U.addRange(R))}}}}for(G=[],U=b;U=U.parentNode;)U.nodeType===1&&G.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<G.length;b++){var V=G[b];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}ao=!!Iu,Gu=Iu=null}finally{Me=u,H.p=i,L.T=s}}e.current=t,ut=2}}function fp(){if(ut===2){ut=0;var e=vn,t=Js,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=L.T,L.T=null;var i=H.p;H.p=2;var u=Me;Me|=4;try{$m(e,t.alternate,t)}finally{Me=u,H.p=i,L.T=s}}ut=3}}function hp(){if(ut===4||ut===3){ut=0,Gi();var e=vn,t=Js,s=Pa,i=Wm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ut=5:(ut=0,Js=vn=null,mp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(yn=null),Qo(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=L.T,u=H.p,H.p=2,L.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{L.T=t,H.p=u}}(Pa&3)!==0&&Gl(),xa(e),u=e.pendingLanes,(s&261930)!==0&&(u&42)!==0?e===ku?ci++:(ci=0,ku=e):ci=0,ui(0)}}function mp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Gr(t)))}function Gl(){return dp(),fp(),hp(),pp()}function pp(){if(ut!==5)return!1;var e=vn,t=Au;Au=0;var s=Qo(Pa),i=L.T,u=H.p;try{H.p=32>s?32:s,L.T=null,s=Cu,Cu=null;var f=vn,y=Pa;if(ut=0,Js=vn=null,Pa=0,(Me&6)!==0)throw Error(l(331));var b=Me;if(Me|=4,Qm(f.current),Ym(f,f.current,y,s),Me=b,ui(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Dn,f)}catch{}return!0}finally{H.p=u,L.T=i,mp(e,t)}}function gp(e,t,s){t=Ft(s,t),t=ou(e.stateNode,t,2),e=dn(e,t,2),e!==null&&(tn(e,2),xa(e))}function Ue(e,t,s){if(e.tag===3)gp(e,e,s);else for(;t!==null;){if(t.tag===3){gp(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=Ft(s,e),s=ym(2),i=dn(t,s,2),i!==null&&(vm(s,i,t,e),tn(i,2),xa(i));break}}t=t.return}}function Du(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new rb;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=ub.bind(null,e,t,s),t.then(e,e))}function ub(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Ie===e&&(Ne&s)===s&&(Fe===4||Fe===3&&(Ne&62914560)===Ne&&300>mt()-Bl?(Me&2)===0&&Xs(e,0):Nu|=s,Ys===Ne&&(Ys=0)),xa(e)}function yp(e,t){t===0&&(t=ga()),e=Bn(e,t),e!==null&&(tn(e,t),xa(e))}function db(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),yp(e,s)}function fb(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),yp(e,s)}function hb(e,t){return en(e,t)}var Pl=null,Zs=null,Mu=!1,Kl=!1,zu=!1,xn=0;function xa(e){e!==Zs&&e.next===null&&(Zs===null?Pl=Zs=e:Zs=Zs.next=e),Kl=!0,Mu||(Mu=!0,pb())}function ui(e,t){if(!zu&&Kl){zu=!0;do for(var s=!1,i=Pl;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,wp(i,f))}else f=Ne,f=z(i,i===Ie?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||ne(i,f)||(s=!0,wp(i,f));i=i.next}while(s);zu=!1}}function mb(){vp()}function vp(){Kl=Mu=!1;var e=0;xn!==0&&Eb()&&(e=xn);for(var t=mt(),s=null,i=Pl;i!==null;){var u=i.next,f=bp(i,t);f===0?(i.next=null,s===null?Pl=u:s.next=u,u===null&&(Zs=s)):(s=i,(e!==0||(f&3)!==0)&&(Kl=!0)),i=u}ut!==0&&ut!==5||ui(e),xn!==0&&(xn=0)}function bp(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,j=u[y];j===-1?((b&s)===0||(b&i)!==0)&&(u[y]=De(b,t)):j<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ie,s=Ne,s=z(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(ze===2||ze===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&ds(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||ne(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&ds(i),Qo(s)){case 2:case 8:s=Ki;break;case 32:s=hs;break;case 268435456:s=Yi;break;default:s=hs}return i=xp.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 xp(e,t){if(ut!==0&&ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Gl()&&e.callbackNode!==s)return null;var i=Ne;return i=z(e,e===Ie?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(tp(e,i,t),bp(e,mt()),e.callbackNode!=null&&e.callbackNode===s?xp.bind(null,e):null)}function wp(e,t){if(Gl())return null;tp(e,t,!0)}function pb(){Tb(function(){(Me&6)!==0?en(Pi,mb):vp()})}function Uu(){if(xn===0){var e=Us;e===0&&(e=ms,ms<<=1,(ms&261888)===0&&(ms=256)),xn=e}return xn}function _p(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:el(""+e)}function Sp(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 gb(e,t,s,i,u){if(t==="submit"&&s&&s.stateNode===u){var f=_p((u[Rt]||null).action),y=i.submitter;y&&(t=(t=y[Rt]||null)?_p(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var b=new sl("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(xn!==0){var j=y?Sp(u,y):new FormData(u);au(s,{pending:!0,data:j,method:u.method,action:f},null,j)}}else typeof f=="function"&&(b.preventDefault(),j=y?Sp(u,y):new FormData(u),au(s,{pending:!0,data:j,method:u.method,action:f},f,j))},currentTarget:u}]})}}for(var Lu=0;Lu<bc.length;Lu++){var Bu=bc[Lu],yb=Bu.toLowerCase(),vb=Bu[0].toUpperCase()+Bu.slice(1);la(yb,"on"+vb)}la(eh,"onAnimationEnd"),la(th,"onAnimationIteration"),la(ah,"onAnimationStart"),la("dblclick","onDoubleClick"),la("focusin","onFocus"),la("focusout","onBlur"),la(M0,"onTransitionRun"),la(z0,"onTransitionStart"),la(U0,"onTransitionCancel"),la(nh,"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 di="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(" "),bb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(di));function jp(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],j=b.instance,D=b.currentTarget;if(b=b.listener,j!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=D;try{f(u)}catch($){ll($)}u.currentTarget=null,f=j}else for(y=0;y<i.length;y++){if(b=i[y],j=b.instance,D=b.currentTarget,b=b.listener,j!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=D;try{f(u)}catch($){ll($)}u.currentTarget=null,f=j}}}}function je(e,t){var s=t[Zo];s===void 0&&(s=t[Zo]=new Set);var i=e+"__bubble";s.has(i)||(Ep(t,e,2,!1),s.add(i))}function qu(e,t,s){var i=0;t&&(i|=4),Ep(s,e,i,t)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function $u(e){if(!e[Yl]){e[Yl]=!0,vf.forEach(function(s){s!=="selectionchange"&&(bb.has(s)||qu(s,!1,e),qu(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yl]||(t[Yl]=!0,qu("selectionchange",!1,t))}}function Ep(e,t,s,i){switch(eg(t)){case 2:var u=Yb;break;case 8:u=Jb;break;default:u=td}s=u.bind(null,t,s,e),u=void 0,!ic||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 Hu(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 j=y.tag;if((j===3||j===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;b!==null;){if(y=bs(b),y===null)return;if(j=y.tag,j===5||j===6||j===26||j===27){i=f=y;continue e}b=b.parentNode}}i=i.return}kf(function(){var D=f,$=sc(s),G=[];e:{var M=sh.get(e);if(M!==void 0){var U=sl,ee=e;switch(e){case"keypress":if(al(s)===0)break e;case"keydown":case"keyup":U=f0;break;case"focusin":ee="focus",U=uc;break;case"focusout":ee="blur",U=uc;break;case"beforeblur":case"afterblur":U=uc;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":U=Df;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=e0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=p0;break;case eh:case th:case ah:U=n0;break;case nh:U=y0;break;case"scroll":case"scrollend":U=Fv;break;case"wheel":U=b0;break;case"copy":case"cut":case"paste":U=r0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=zf;break;case"toggle":case"beforetoggle":U=w0}var de=(t&4)!==0,He=!de&&(e==="scroll"||e==="scrollend"),C=de?M!==null?M+"Capture":null:M;de=[];for(var T=D,R;T!==null;){var V=T;if(R=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||R===null||C===null||(V=Dr(T,C),V!=null&&de.push(fi(T,V,R))),He)break;T=T.return}0<de.length&&(M=new U(M,ee,null,s,$),G.push({event:M,listeners:de}))}}if((t&7)===0){e:{if(M=e==="mouseover"||e==="pointerover",U=e==="mouseout"||e==="pointerout",M&&s!==nc&&(ee=s.relatedTarget||s.fromElement)&&(bs(ee)||ee[vs]))break e;if((U||M)&&(M=$.window===$?$:(M=$.ownerDocument)?M.defaultView||M.parentWindow:window,U?(ee=s.relatedTarget||s.toElement,U=D,ee=ee?bs(ee):null,ee!==null&&(He=d(ee),de=ee.tag,ee!==He||de!==5&&de!==27&&de!==6)&&(ee=null)):(U=null,ee=D),U!==ee)){if(de=Df,V="onMouseLeave",C="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(de=zf,V="onPointerLeave",C="onPointerEnter",T="pointer"),He=U==null?M:Rr(U),R=ee==null?M:Rr(ee),M=new de(V,T+"leave",U,s,$),M.target=He,M.relatedTarget=R,V=null,bs($)===D&&(de=new de(C,T+"enter",ee,s,$),de.target=R,de.relatedTarget=He,V=de),He=V,U&&ee)t:{for(de=xb,C=U,T=ee,R=0,V=C;V;V=de(V))R++;V=0;for(var oe=T;oe;oe=de(oe))V++;for(;0<R-V;)C=de(C),R--;for(;0<V-R;)T=de(T),V--;for(;R--;){if(C===T||T!==null&&C===T.alternate){de=C;break t}C=de(C),T=de(T)}de=null}else de=null;U!==null&&Np(G,M,U,de,!1),ee!==null&&He!==null&&Np(G,He,ee,de,!0)}}e:{if(M=D?Rr(D):window,U=M.nodeName&&M.nodeName.toLowerCase(),U==="select"||U==="input"&&M.type==="file")var Oe=If;else if(Hf(M))if(Gf)Oe=O0;else{Oe=C0;var re=A0}else U=M.nodeName,!U||U.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?D&&ac(D.elementType)&&(Oe=If):Oe=k0;if(Oe&&(Oe=Oe(e,D))){Vf(G,Oe,s,$);break e}re&&re(e,M,D),e==="focusout"&&D&&M.type==="number"&&D.memoizedProps.value!=null&&tc(M,"number",M.value)}switch(re=D?Rr(D):window,e){case"focusin":(Hf(re)||re.contentEditable==="true")&&(As=re,gc=D,Hr=null);break;case"focusout":Hr=gc=As=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,Ff(G,s,$);break;case"selectionchange":if(D0)break;case"keydown":case"keyup":Ff(G,s,$)}var xe;if(fc)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else Ts?qf(e,s)&&(Te="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Te="onCompositionStart");Te&&(Uf&&s.locale!=="ko"&&(Ts||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&Ts&&(xe=Of()):(nn=$,lc="value"in nn?nn.value:nn.textContent,Ts=!0)),re=Jl(D,Te),0<re.length&&(Te=new Mf(Te,e,null,s,$),G.push({event:Te,listeners:re}),xe?Te.data=xe:(xe=$f(s),xe!==null&&(Te.data=xe)))),(xe=S0?j0(e,s):E0(e,s))&&(Te=Jl(D,"onBeforeInput"),0<Te.length&&(re=new Mf("onBeforeInput","beforeinput",null,s,$),G.push({event:re,listeners:Te}),re.data=xe)),gb(G,e,D,s,$)}jp(G,t)})}function fi(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Jl(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=Dr(e,s),u!=null&&i.unshift(fi(e,u,f)),u=Dr(e,t),u!=null&&i.push(fi(e,u,f))),e.tag===3)return i;e=e.return}return[]}function xb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Np(e,t,s,i,u){for(var f=t._reactName,y=[];s!==null&&s!==i;){var b=s,j=b.alternate,D=b.stateNode;if(b=b.tag,j!==null&&j===i)break;b!==5&&b!==26&&b!==27||D===null||(j=D,u?(D=Dr(s,f),D!=null&&y.unshift(fi(s,D,j))):u||(D=Dr(s,f),D!=null&&y.push(fi(s,D,j)))),s=s.return}y.length!==0&&e.push({event:t,listeners:y})}var wb=/\r\n?/g,_b=/\u0000|\uFFFD/g;function Tp(e){return(typeof e=="string"?e:""+e).replace(wb,`
9
+ `).replace(_b,"")}function Ap(e,t){return t=Tp(t),Tp(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":Fi(e,"class",i);break;case"tabIndex":Fi(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Fi(e,s,i);break;case"style":Af(e,i,f);break;case"data":if(t!=="object"){Fi(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=el(""+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=el(""+i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=ka);break;case"onScroll":i!=null&&je("scroll",e);break;case"onScrollEnd":i!=null&&je("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=el(""+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":je("beforetoggle",e),je("toggle",e),Zi(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":Zi(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=Qv.get(s)||s,Zi(e,s,i))}}function Vu(e,t,s,i,u,f){switch(s){case"style":Af(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&&je("scroll",e);break;case"onScrollEnd":i!=null&&je("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(!bf.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,""):Zi(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":je("error",e),je("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":je("invalid",e);var b=f=y=u=null,j=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":j=$;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)}}jf(e,f,b,j,D,y,u,!1);return;case"select":je("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":je("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)}Nf(e,i,u,f);return;case"option":for(j in s)s.hasOwnProperty(j)&&(i=s[j],i!=null)&&(j==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":$e(e,t,j,i,s,null));return;case"dialog":je("beforetoggle",e),je("toggle",e),je("cancel",e),je("close",e);break;case"iframe":case"object":je("load",e);break;case"video":case"audio":for(i=0;i<di.length;i++)je(di[i],e);break;case"image":je("error",e),je("load",e);break;case"details":je("toggle",e);break;case"embed":case"source":case"link":je("error",e),je("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(ac(t)){for($ in s)s.hasOwnProperty($)&&(i=s[$],i!==void 0&&Vu(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 Sb(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,j=null,D=null,$=null;for(U in s){var G=s[U];if(s.hasOwnProperty(U)&&G!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":j=G;default:i.hasOwnProperty(U)||$e(e,t,U,null,i,G)}}for(var M in i){var U=i[M];if(G=s[M],i.hasOwnProperty(M)&&(U!=null||G!=null))switch(M){case"type":f=U;break;case"name":u=U;break;case"checked":D=U;break;case"defaultChecked":$=U;break;case"value":y=U;break;case"defaultValue":b=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:U!==G&&$e(e,t,M,U,i,G)}}ec(e,y,b,j,D,$,f,u);return;case"select":U=y=b=M=null;for(f in s)if(j=s[f],s.hasOwnProperty(f)&&j!=null)switch(f){case"value":break;case"multiple":U=j;default:i.hasOwnProperty(f)||$e(e,t,f,null,i,j)}for(u in i)if(f=i[u],j=s[u],i.hasOwnProperty(u)&&(f!=null||j!=null))switch(u){case"value":M=f;break;case"defaultValue":b=f;break;case"multiple":y=f;default:f!==j&&$e(e,t,u,f,i,j)}t=b,s=y,i=U,M!=null?Ss(e,!!s,M,!1):!!i!=!!s&&(t!=null?Ss(e,!!s,t,!0):Ss(e,!!s,s?[]:"",!1));return;case"textarea":U=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":U=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,U);return;case"option":for(var ee in s)M=s[ee],s.hasOwnProperty(ee)&&M!=null&&!i.hasOwnProperty(ee)&&(ee==="selected"?e.selected=!1:$e(e,t,ee,null,i,M));for(j in i)M=i[j],U=s[j],i.hasOwnProperty(j)&&M!==U&&(M!=null||U!=null)&&(j==="selected"?e.selected=M&&typeof M!="function"&&typeof M!="symbol":$e(e,t,j,M,i,U));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 de in s)M=s[de],s.hasOwnProperty(de)&&M!=null&&!i.hasOwnProperty(de)&&$e(e,t,de,null,i,M);for(D in i)if(M=i[D],U=s[D],i.hasOwnProperty(D)&&M!==U&&(M!=null||U!=null))switch(D){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(l(137,t));break;default:$e(e,t,D,M,i,U)}return;default:if(ac(t)){for(var He in s)M=s[He],s.hasOwnProperty(He)&&M!==void 0&&!i.hasOwnProperty(He)&&Vu(e,t,He,void 0,i,M);for($ in i)M=i[$],U=s[$],!i.hasOwnProperty($)||M===U||M===void 0&&U===void 0||Vu(e,t,$,M,i,U);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(G in i)M=i[G],U=s[G],!i.hasOwnProperty(G)||M===U||M==null&&U==null||$e(e,t,G,M,i,U)}function Cp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jb(){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&&Cp(y)){for(y=0,b=u.responseEnd,i+=1;i<s.length;i++){var j=s[i],D=j.startTime;if(D>b)break;var $=j.transferSize,G=j.initiatorType;$&&Cp(G)&&(j=j.responseEnd,y+=$*(j<b?1:(b-D)/(j-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 Iu=null,Gu=null;function Xl(e){return e.nodeType===9?e:e.ownerDocument}function kp(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 Op(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 Pu(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 Ku=null;function Eb(){var e=window.event;return e&&e.type==="popstate"?e===Ku?!1:(Ku=e,!0):(Ku=null,!1)}var Rp=typeof setTimeout=="function"?setTimeout:void 0,Nb=typeof clearTimeout=="function"?clearTimeout:void 0,Dp=typeof Promise=="function"?Promise:void 0,Tb=typeof queueMicrotask=="function"?queueMicrotask:typeof Dp<"u"?function(e){return Dp.resolve(null).then(e).catch(Ab)}:Rp;function Ab(e){setTimeout(function(){throw e})}function wn(e){return e==="head"}function Mp(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")hi(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,hi(s);for(var f=s.firstChild;f;){var y=f.nextSibling,b=f.nodeName;f[Or]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||s.removeChild(f),f=y}}else s==="body"&&hi(e.ownerDocument.body);s=u}while(s);tr(t)}function zp(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 Yu(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":Yu(s),Fo(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Cb(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[Or])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=na(e.nextSibling),e===null)break}return null}function kb(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=na(e.nextSibling),e===null))return null;return e}function Up(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=na(e.nextSibling),e===null))return null;return e}function Ju(e){return e.data==="$?"||e.data==="$~"}function Xu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Ob(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 na(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 Qu=null;function Lp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return na(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function Bp(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 qp(e,t,s){switch(t=Xl(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 hi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Fo(e)}var sa=new Map,$p=new Set;function Ql(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ka=H.d;H.d={f:Rb,r:Db,D:Mb,C:zb,L:Ub,m:Lb,X:qb,S:Bb,M:$b};function Rb(){var e=Ka.f(),t=Hl();return e||t}function Db(e){var t=xs(e);t!==null&&t.tag===5&&t.type==="form"?nm(t):Ka.r(e)}var Fs=typeof document>"u"?null:document;function Hp(e,t,s){var i=Fs;if(i&&typeof t=="string"&&t){var u=Qt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),$p.has(u)||($p.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 Mb(e){Ka.D(e),Hp("dns-prefetch",e,null)}function zb(e,t){Ka.C(e,t),Hp("preconnect",e,t)}function Ub(e,t,s){Ka.L(e,t,s);var i=Fs;if(i&&e&&t){var u='link[rel="preload"][as="'+Qt(t)+'"]';t==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+Qt(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+Qt(s.imageSizes)+'"]')):u+='[href="'+Qt(e)+'"]';var f=u;switch(t){case"style":f=Ws(e);break;case"script":f=er(e)}sa.has(f)||(e=x({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),sa.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(mi(f))||t==="script"&&i.querySelector(pi(f))||(t=i.createElement("link"),St(t,"link",e),pt(t),i.head.appendChild(t)))}}function Lb(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="'+Qt(i)+'"][href="'+Qt(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=er(e)}if(!sa.has(f)&&(e=x({rel:"modulepreload",href:e},t),sa.set(f,e),s.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(pi(f)))return}i=s.createElement("link"),St(i,"link",e),pt(i),s.head.appendChild(i)}}}function Bb(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(mi(f)))b.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},s),(s=sa.get(f))&&Zu(e,s);var j=y=i.createElement("link");pt(j),St(j,"link",e),j._p=new Promise(function(D,$){j.onload=D,j.onerror=$}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Zl(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},u.set(f,y)}}}function qb(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(pi(u)),f||(e=x({src:e,async:!0},t),(t=sa.get(u))&&Fu(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 $b(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(pi(u)),f||(e=x({src:e,async:!0,type:"module"},t),(t=sa.get(u))&&Fu(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 Vp(e,t,s,i){var u=(u=ye.current)?Ql(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(mi(e)))&&!f._p&&(y.instance=f,y.state.loading=5),sa.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},sa.set(e,s),f||Hb(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="'+Qt(e)+'"'}function mi(e){return'link[rel="stylesheet"]['+e+"]"}function Ip(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function Hb(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="'+Qt(e)+'"]'}function pi(e){return"script[async]"+e}function Gp(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Qt(s.href)+'"]');if(i)return t.instance=i,pt(i),i;var u=x({},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),Zl(i,s.precedence,e),t.instance=i;case"stylesheet":u=Ws(s.href);var f=e.querySelector(mi(u));if(f)return t.state.loading|=4,t.instance=f,pt(f),f;i=Ip(s),(u=sa.get(u))&&Zu(i,u),f=(e.ownerDocument||e).createElement("link"),pt(f);var y=f;return y._p=new Promise(function(b,j){y.onload=b,y.onerror=j}),St(f,"link",i),t.state.loading|=4,Zl(f,s.precedence,e),t.instance=f;case"script":return f=er(s.src),(u=e.querySelector(pi(f)))?(t.instance=u,pt(u),u):(i=s,(u=sa.get(f))&&(i=x({},s),Fu(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,Zl(i,s.precedence,e));return t.instance}function Zl(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 Zu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Fu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Fl=null;function Pp(e,t,s){if(Fl===null){var i=new Map,u=Fl=new Map;u.set(s,i)}else u=Fl,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[Or]||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 Kp(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function Vb(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 Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ib(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(mi(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wl.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=f,pt(f);return}f=t.ownerDocument||t,i=Ip(i),(u=sa.get(u))&&Zu(i,u),f=f.createElement("link"),pt(f);var y=f;y._p=new Promise(function(b,j){y.onload=b,y.onerror=j}),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=Wl.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var Wu=0;function Gb(e,t){return e.stylesheets&&e.count===0&&to(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&to(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&Wu===0&&(Wu=62500*jb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&to(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Wu?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)to(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var eo=null;function to(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,eo=new Map,t.forEach(Pb,e),eo=null,Wl.call(e))}function Pb(e,t){if(!(t.state.loading&4)){var s=eo.get(e);if(s)var i=s.get(null);else{s=new Map,eo.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=Wl.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 gi={$$typeof:B,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Kb(e,t,s,i,u,f,y,b,j){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=kr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kr(0),this.hiddenUpdates=kr(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function Jp(e,t,s,i,u,f,y,b,j,D,$,G){return e=new Kb(e,t,s,y,j,D,$,G,b),t=1,f===!0&&(t|=24),f=$t(3,null,null,t),e.current=f,f.stateNode=e,t=Rc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:s,cache:t},Uc(f),e}function Xp(e){return e?(e=Os,e):Os}function Qp(e,t,s,i,u,f){u=Xp(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),Jr(s,e,t))}function Zp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function ed(e,t){Zp(e,t),(e=e.alternate)&&Zp(e,t)}function Fp(e){if(e.tag===13||e.tag===31){var t=Bn(e,67108864);t!==null&&Bt(t,e,67108864),ed(e,67108864)}}function Wp(e){if(e.tag===13||e.tag===31){var t=Pt();t=Xo(t);var s=Bn(e,t);s!==null&&Bt(s,e,t),ed(e,t)}}var ao=!0;function Yb(e,t,s,i){var u=L.T;L.T=null;var f=H.p;try{H.p=2,td(e,t,s,i)}finally{H.p=f,L.T=u}}function Jb(e,t,s,i){var u=L.T;L.T=null;var f=H.p;try{H.p=8,td(e,t,s,i)}finally{H.p=f,L.T=u}}function td(e,t,s,i){if(ao){var u=ad(i);if(u===null)Hu(e,t,i,no,s),tg(e,i);else if(Qb(u,e,t,s,i))i.stopPropagation();else if(tg(e,i),t&4&&-1<Xb.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 j=1<<31-kt(y);b.entanglements[1]|=j,y&=~j}xa(f),(Me&6)===0&&(ql=mt()+500,ui(0))}}break;case 31:case 13:b=Bn(f,2),b!==null&&Bt(b,f,2),Hl(),ed(f,2)}if(f=ad(i),f===null&&Hu(e,t,i,no,s),f===u)break;u=f}u!==null&&i.stopPropagation()}else Hu(e,t,i,null,s)}}function ad(e){return e=sc(e),nd(e)}var no=null;function nd(e){if(no=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 no=e,null}function eg(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 Pi:return 2;case Ki:return 8;case hs:case Go:return 32;case Yi:return 268435456;default:return 32}default:return 32}}var sd=!1,_n=null,Sn=null,jn=null,yi=new Map,vi=new Map,En=[],Xb="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 tg(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":yi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vi.delete(t.pointerId)}}function bi(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&&Fp(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Qb(e,t,s,i,u){switch(t){case"focusin":return _n=bi(_n,e,t,s,i,u),!0;case"dragenter":return Sn=bi(Sn,e,t,s,i,u),!0;case"mouseover":return jn=bi(jn,e,t,s,i,u),!0;case"pointerover":var f=u.pointerId;return yi.set(f,bi(yi.get(f)||null,e,t,s,i,u)),!0;case"gotpointercapture":return f=u.pointerId,vi.set(f,bi(vi.get(f)||null,e,t,s,i,u)),!0}return!1}function ag(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,gf(e.priority,function(){Wp(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,gf(e.priority,function(){Wp(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 so(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=ad(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);nc=i,s.target.dispatchEvent(i),nc=null}else return t=xs(s),t!==null&&Fp(t),e.blockedOn=s,!1;t.shift()}return!0}function ng(e,t,s){so(e)&&s.delete(t)}function Zb(){sd=!1,_n!==null&&so(_n)&&(_n=null),Sn!==null&&so(Sn)&&(Sn=null),jn!==null&&so(jn)&&(jn=null),yi.forEach(ng),vi.forEach(ng)}function ro(e,t){e.blockedOn===t&&(e.blockedOn=null,sd||(sd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Zb)))}var io=null;function sg(e){io!==e&&(io=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){io===e&&(io=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(nd(i||s)===null)continue;break}var f=xs(s);f!==null&&(e.splice(t,3),t-=3,au(f,{pending:!0,data:u,method:s.method,action:i},i,u))}}))}function tr(e){function t(j){return ro(j,e)}_n!==null&&ro(_n,e),Sn!==null&&ro(Sn,e),jn!==null&&ro(jn,e),yi.forEach(t),vi.forEach(t);for(var s=0;s<En.length;s++){var i=En[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<En.length&&(s=En[0],s.blockedOn===null);)ag(s),s.blockedOn===null&&En.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||sg(s);else if(y){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[Rt]||null)b=y.formAction;else if(nd(u)!==null)continue}else b=y.action;typeof b=="function"?s[i+1]=b:(s.splice(i,3),i-=3),sg(s)}}}function rg(){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 rd(e){this._internalRoot=e}lo.prototype.render=rd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var s=t.current,i=Pt();Qp(s,i,e,t,null,null)},lo.prototype.unmount=rd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qp(e.current,2,null,e,null,null),Hl(),t[vs]=null}};function lo(e){this._internalRoot=e}lo.prototype.unstable_scheduleHydration=function(e){if(e){var t=pf();e={blockedOn:null,target:e,priority:t};for(var s=0;s<En.length&&t!==0&&t<En[s].priority;s++);En.splice(s,0,e),s===0&&ag(e)}};var ig=a.version;if(ig!=="19.2.3")throw Error(l(527,ig,"19.2.3"));H.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 Fb={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oo.isDisabled&&oo.supportsFiber)try{Dn=oo.inject(Fb),Ct=oo}catch{}}return wi.createRoot=function(e,t){if(!c(e))throw Error(l(299));var s=!1,i="",u=hm,f=mm,y=pm;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=Jp(e,1,!1,null,null,s,i,null,u,f,y,rg),e[vs]=t.current,$u(e),new rd(t)},wi.hydrateRoot=function(e,t,s){if(!c(e))throw Error(l(299));var i=!1,u="",f=hm,y=mm,b=pm,j=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&&(j=s.formState)),t=Jp(e,1,!0,t,s??null,i,u,j,f,y,b,rg),t.context=Xp(null),s=t.current,i=Pt(),i=Xo(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,$u(e),new lo(t)},wi.version="19.2.3",wi}var gg;function ox(){if(gg)return od.exports;gg=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(),od.exports=lx(),od.exports}var cx=ox();const ux=Zd(cx);const dx=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fx=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),yg=n=>{const a=fx(n);return a.charAt(0).toUpperCase()+a.slice(1)},my=(...n)=>n.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),hx=n=>{for(const a in n)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var mx={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 px=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,...mx,width:a,height:a,stroke:n,strokeWidth:l?Number(r)*24/Number(a):r,className:my("lucide",c),...!d&&!hx(m)&&{"aria-hidden":"true"},...m},[...h.map(([g,v])=>w.createElement(g,v)),...Array.isArray(d)?d:[d]]));const ie=(n,a)=>{const r=w.forwardRef(({className:l,...c},d)=>w.createElement(px,{ref:d,iconNode:a,className:my(`lucide-${dx(yg(n))}`,`lucide-${n}`,l),...c}));return r.displayName=yg(n),r};const gx=[["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"}]],yx=ie("activity",gx);const vx=[["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"}]],bx=ie("archive",vx);const xx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],wx=ie("arrow-left",xx);const _x=[["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"}]],ef=ie("brain",_x);const Sx=[["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"}]],jx=ie("calendar",Sx);const Ex=[["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"}]],Nx=ie("camera",Ex);const Tx=[["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"}]],py=ie("chart-column",Tx);const Ax=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Qa=ie("check",Ax);const Cx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],kx=ie("chevron-down",Cx);const Ox=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Rx=ie("chevron-left",Ox);const Dx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Mx=ie("chevron-right",Dx);const zx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ux=ie("chevron-up",zx);const Lx=[["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"}]],$i=ie("circle-alert",Lx);const Bx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],tf=ie("circle-check-big",Bx);const qx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],af=ie("circle-check",qx);const $x=[["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"}]],Hx=ie("circle-user",$x);const Vx=[["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"}]],Ix=ie("circle-x",Vx);const Gx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zo=ie("clock",Gx);const Px=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],gr=ie("code",Px);const Kx=[["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"}]],Yx=ie("copy",Kx);const Jx=[["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"}]],gy=ie("cpu",Jx);const Xx=[["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"}]],No=ie("database",Xx);const Qx=[["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"}]],Ai=ie("external-link",Qx);const Zx=[["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"}]],Fx=ie("eye",Zx);const Wx=[["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"}]],ew=ie("flag",Wx);const tw=[["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"}]],aw=ie("hash",tw);const nw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],wr=ie("info",nw);const sw=[["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"}]],rw=ie("key-round",sw);const iw=[["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"}]],lw=ie("key",iw);const ow=[["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"}]],cw=ie("layout-dashboard",ow);const uw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ra=ie("loader-circle",uw);const dw=[["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"}]],fw=ie("log-in",dw);const hw=[["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"}]],mw=ie("log-out",hw);const pw=[["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"}]],Rd=ie("mail",pw);const gw=[["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"}]],yw=ie("minimize-2",gw);const vw=[["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"}]],bw=ie("moon",vw);const xw=[["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"}]],vg=ie("paperclip",xw);const ww=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],_i=ie("plus",ww);const _w=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],fd=ie("power",_w);const Sw=[["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"}]],_r=ie("refresh-cw",Sw);const jw=[["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"}]],Ew=ie("rotate-ccw",jw);const Nw=[["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"}]],Tw=ie("save",Nw);const Aw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Cw=ie("search",Aw);const kw=[["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"}]],Ow=ie("send",kw);const Rw=[["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"}]],Dd=ie("settings",Rw);const Dw=[["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"}]],Mw=ie("settings-2",Dw);const zw=[["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"}]],Md=ie("shield-check",zw);const Uw=[["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"}]],Lw=ie("shield",Uw);const Bw=[["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"}]],qw=ie("sun",Bw);const $w=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],zd=ie("terminal",$w);const Hw=[["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"}]],To=ie("trash-2",Hw);const Vw=[["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"}]],Sr=ie("triangle-alert",Vw);const Iw=[["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"}]],Gw=ie("upload",Iw);const Pw=[["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"}]],Kw=ie("user-plus",Pw);const Yw=[["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"}]],yy=ie("user",Yw);const Jw=[["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"}]],Xw=ie("volume-2",Jw);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"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Zw=ie("volume-x",Qw);const Fw=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Uo=ie("x",Fw);const Ww=[["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"}]],Ao=ie("zap",Ww),e_={theme:"system",setTheme:()=>null},vy=w.createContext(e_);function t_({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(vy.Provider,{value:d,children:n})}const a_=()=>{const n=w.useContext(vy);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n};function bg(n,a){if(typeof n=="function")return n(a);n!=null&&(n.current=a)}function Lo(...n){return a=>{let r=!1;const l=n.map(c=>{const d=bg(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():bg(n[c],null)}}}}function ls(...n){return w.useCallback(Lo(...n),n)}var n_=Symbol.for("react.lazy"),Co=Wd[" use ".trim().toString()];function s_(n){return typeof n=="object"&&n!==null&&"then"in n}function by(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===n_&&"_payload"in n&&s_(n._payload)}function xy(n){const a=i_(n),r=w.forwardRef((l,c)=>{let{children:d,...h}=l;by(d)&&typeof Co=="function"&&(d=Co(d._payload));const m=w.Children.toArray(d),p=m.find(o_);if(p){const g=p.props.children,v=m.map(x=>x===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:x);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 r_=xy("Slot");function i_(n){const a=w.forwardRef((r,l)=>{let{children:c,...d}=r;if(by(c)&&typeof Co=="function"&&(c=Co(c._payload)),w.isValidElement(c)){const h=u_(c),m=c_(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Lo(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 l_=Symbol("radix.slottable");function o_(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===l_}function c_(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 u_(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 wy(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=wy(n[a]))&&(l&&(l+=" "),l+=r)}else for(r in n)n[r]&&(l&&(l+=" "),l+=r);return l}function _y(){for(var n,a,r=0,l="",c=arguments.length;r<c;r++)(n=arguments[r])&&(a=wy(n))&&(l&&(l+=" "),l+=a);return l}const xg=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,wg=_y,Sy=(n,a)=>r=>{var l;if(a?.variants==null)return wg(n,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(g=>{const v=r?.[g],x=d?.[g];if(v===null)return null;const _=xg(v)||xg(x);return c[g][_]}),m=r&&Object.entries(r).reduce((g,v)=>{let[x,_]=v;return _===void 0||(g[x]=_),g},{}),p=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((g,v)=>{let{class:x,className:_,...S}=v;return Object.entries(S).every(A=>{let[E,k]=A;return Array.isArray(k)?k.includes({...d,...m}[E]):{...d,...m}[E]===k})?[...g,x,_]:g},[]);return wg(n,h,p,r?.class,r?.className)},d_=(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},f_=(n,a)=>({classGroupId:n,validator:a}),jy=(n=new Map,a=null,r)=>({nextPart:n,validators:a,classGroupId:r}),ko="-",_g=[],h_="arbitrary..",m_=n=>{const a=g_(n),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return p_(h);const m=h.split(ko),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?d_(g,p):p:g||_g}return r[h]||_g}}},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(ko):n.slice(a).join(ko),p=h.length;for(let g=0;g<p;g++){const v=h[g];if(v.validator(m))return v.classGroupId}},p_=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?h_+l:void 0})(),g_=n=>{const{theme:a,classGroups:r}=n;return y_(r,a)},y_=(n,a)=>{const r=jy();for(const l in n){const c=n[l];nf(c,r,l,a)}return r},nf=(n,a,r,l)=>{const c=n.length;for(let d=0;d<c;d++){const h=n[d];v_(h,a,r,l)}},v_=(n,a,r,l)=>{if(typeof n=="string"){b_(n,a,r);return}if(typeof n=="function"){x_(n,a,r,l);return}w_(n,a,r,l)},b_=(n,a,r)=>{const l=n===""?a:Ny(a,n);l.classGroupId=r},x_=(n,a,r,l)=>{if(__(n)){nf(n(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(f_(r,n))},w_=(n,a,r,l)=>{const c=Object.entries(n),d=c.length;for(let h=0;h<d;h++){const[m,p]=c[h];nf(p,Ny(a,m),r,l)}},Ny=(n,a)=>{let r=n;const l=a.split(ko),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=jy(),r.nextPart.set(h,m)),r=m}return r},__=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,S_=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)}}},Ud="!",Sg=":",j_=[],jg=(n,a,r,l,c)=>({modifiers:n,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),E_=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 E=0;E<v;E++){const k=c[E];if(h===0&&m===0){if(k===Sg){d.push(c.slice(p,E)),p=E+1;continue}if(k==="/"){g=E;continue}}k==="["?h++:k==="]"?h--:k==="("?m++:k===")"&&m--}const x=d.length===0?c:c.slice(p);let _=x,S=!1;x.endsWith(Ud)?(_=x.slice(0,-1),S=!0):x.startsWith(Ud)&&(_=x.slice(1),S=!0);const A=g&&g>p?g-p:void 0;return jg(d,S,_,A)};if(a){const c=a+Sg,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):jg(j_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},N_=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}},T_=n=>({cache:S_(n.cacheSize),parseClassName:E_(n),sortModifiers:N_(n),...m_(n)}),A_=/\s+/,C_=(n,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=n.trim().split(A_);let p="";for(let g=m.length-1;g>=0;g-=1){const v=m[g],{isExternal:x,modifiers:_,hasImportantModifier:S,baseClassName:A,maybePostfixModifierPosition:E}=r(v);if(x){p=v+(p.length>0?" "+p:p);continue}let k=!!E,O=l(k?A.substring(0,E):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=_.length===0?"":_.length===1?_[0]:d(_).join(":"),B=S?q+Ud:q,P=B+O;if(h.indexOf(P)>-1)continue;h.push(P);const W=c(O,k);for(let Q=0;Q<W.length;++Q){const Y=W[Q];h.push(B+Y)}p=v+(p.length>0?" "+p:p)}return p},k_=(...n)=>{let a=0,r,l,c="";for(;a<n.length;)(r=n[a++])&&(l=Ty(r))&&(c&&(c+=" "),c+=l);return c},Ty=n=>{if(typeof n=="string")return n;let a,r="";for(let l=0;l<n.length;l++)n[l]&&(a=Ty(n[l]))&&(r&&(r+=" "),r+=a);return r},O_=(n,...a)=>{let r,l,c,d;const h=p=>{const g=a.reduce((v,x)=>x(v),n());return r=T_(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=C_(p,r);return c(p,v),v};return d=h,(...p)=>d(k_(...p))},R_=[],dt=n=>{const a=r=>r[n]||R_;return a.isThemeGetter=!0,a},Ay=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Cy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,D_=/^\d+\/\d+$/,M_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,z_=/\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$/,U_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,L_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,B_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ar=n=>D_.test(n),we=n=>!!n&&!Number.isNaN(Number(n)),Tn=n=>!!n&&Number.isInteger(Number(n)),hd=n=>n.endsWith("%")&&we(n.slice(0,-1)),Ya=n=>M_.test(n),q_=()=>!0,$_=n=>z_.test(n)&&!U_.test(n),ky=()=>!1,H_=n=>L_.test(n),V_=n=>B_.test(n),I_=n=>!te(n)&&!ae(n),G_=n=>jr(n,Dy,ky),te=n=>Ay.test(n),Zn=n=>jr(n,My,$_),md=n=>jr(n,X_,we),Eg=n=>jr(n,Oy,ky),P_=n=>jr(n,Ry,V_),co=n=>jr(n,zy,H_),ae=n=>Cy.test(n),Si=n=>Er(n,My),K_=n=>Er(n,Q_),Ng=n=>Er(n,Oy),Y_=n=>Er(n,Dy),J_=n=>Er(n,Ry),uo=n=>Er(n,zy,!0),jr=(n,a,r)=>{const l=Ay.exec(n);return l?l[1]?a(l[1]):r(l[2]):!1},Er=(n,a,r=!1)=>{const l=Cy.exec(n);return l?l[1]?a(l[1]):r:!1},Oy=n=>n==="position"||n==="percentage",Ry=n=>n==="image"||n==="url",Dy=n=>n==="length"||n==="size"||n==="bg-size",My=n=>n==="length",X_=n=>n==="number",Q_=n=>n==="family-name",zy=n=>n==="shadow",Z_=()=>{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"),x=dt("inset-shadow"),_=dt("text-shadow"),S=dt("drop-shadow"),A=dt("blur"),E=dt("perspective"),k=dt("aspect"),O=dt("ease"),q=dt("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...P(),ae,te],Q=()=>["auto","hidden","clip","visible","scroll"],Y=()=>["auto","contain","none"],J=()=>[ae,te,p],fe=()=>[ar,"full","auto",...J()],Ge=()=>[Tn,"none","subgrid",ae,te],pe=()=>["auto",{span:["full",Tn,ae,te]},Tn,ae,te],ge=()=>[Tn,"auto",ae,te],et=()=>["auto","min","max","fr",ae,te],nt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Le=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...J()],H=()=>[ar,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...J()],K=()=>[n,ae,te],Ee=()=>[...P(),Ng,Eg,{position:[ae,te]}],_e=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",Y_,G_,{size:[ae,te]}],I=()=>[hd,Si,Zn],X=()=>["","none","full",g,ae,te],Z=()=>["",we,Si,Zn],ce=()=>["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"],ue=()=>[we,hd,Ng,Eg],Pe=()=>["","none",A,ae,te],Be=()=>["none",we,ae,te],Tt=()=>["none",we,ae,te],yt=()=>[we,ae,te],vt=()=>[ar,"full",...J()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ya],breakpoint:[Ya],color:[q_],container:[Ya],"drop-shadow":[Ya],ease:["in","out","in-out"],font:[I_],"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",we],text:[Ya],"text-shadow":[Ya],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ar,te,ae,k]}],container:["container"],columns:[{columns:[we,te,ae,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:W()}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:fe()}],"inset-x":[{"inset-x":fe()}],"inset-y":[{"inset-y":fe()}],start:[{start:fe()}],end:[{end:fe()}],top:[{top:fe()}],right:[{right:fe()}],bottom:[{bottom:fe()}],left:[{left:fe()}],visibility:["visible","invisible","collapse"],z:[{z:[Tn,"auto",ae,te]}],basis:[{basis:[ar,"full","auto",m,...J()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[we,ar,"auto","initial","none",te]}],grow:[{grow:["",we,ae,te]}],shrink:[{shrink:["",we,ae,te]}],order:[{order:[Tn,"first","last","none",ae,te]}],"grid-cols":[{"grid-cols":Ge()}],"col-start-end":[{col:pe()}],"col-start":[{"col-start":ge()}],"col-end":[{"col-end":ge()}],"grid-rows":[{"grid-rows":Ge()}],"row-start-end":[{row:pe()}],"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":et()}],"auto-rows":[{"auto-rows":et()}],gap:[{gap:J()}],"gap-x":[{"gap-x":J()}],"gap-y":[{"gap-y":J()}],"justify-content":[{justify:[...nt(),"normal"]}],"justify-items":[{"justify-items":[...Le(),"normal"]}],"justify-self":[{"justify-self":["auto",...Le()]}],"align-content":[{content:["normal",...nt()]}],"align-items":[{items:[...Le(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Le(),{baseline:["","last"]}]}],"place-content":[{"place-content":nt()}],"place-items":[{"place-items":[...Le(),"baseline"]}],"place-self":[{"place-self":["auto",...Le()]}],p:[{p:J()}],px:[{px:J()}],py:[{py:J()}],ps:[{ps:J()}],pe:[{pe:J()}],pt:[{pt:J()}],pr:[{pr:J()}],pb:[{pb:J()}],pl:[{pl:J()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":J()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":J()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[m,"screen",...H()]}],"min-w":[{"min-w":[m,"screen","none",...H()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,Si,Zn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,ae,md]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hd,te]}],"font-family":[{font:[K_,te,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,ae,te]}],"line-clamp":[{"line-clamp":[we,"none",ae,md]}],leading:[{leading:[d,...J()]}],"list-image":[{"list-image":["none",ae,te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ae,te]}],"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:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[we,"from-font","auto",ae,Zn]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[we,"auto",ae,te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:J()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ae,te]}],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",ae,te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ee()}],"bg-repeat":[{bg:_e()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Tn,ae,te],radial:["",ae,te],conic:[Tn,ae,te]},J_,P_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"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:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[we,ae,te]}],"outline-w":[{outline:["",we,Si,Zn]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",v,uo,co]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",x,uo,co]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[we,Zn]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",_,uo,co]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[we,ae,te]}],"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":[we]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"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":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"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":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"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":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"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":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"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":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"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":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[ae,te]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[we]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"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:Ee()}],"mask-repeat":[{mask:_e()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ae,te]}],filter:[{filter:["","none",ae,te]}],blur:[{blur:Pe()}],brightness:[{brightness:[we,ae,te]}],contrast:[{contrast:[we,ae,te]}],"drop-shadow":[{"drop-shadow":["","none",S,uo,co]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",we,ae,te]}],"hue-rotate":[{"hue-rotate":[we,ae,te]}],invert:[{invert:["",we,ae,te]}],saturate:[{saturate:[we,ae,te]}],sepia:[{sepia:["",we,ae,te]}],"backdrop-filter":[{"backdrop-filter":["","none",ae,te]}],"backdrop-blur":[{"backdrop-blur":Pe()}],"backdrop-brightness":[{"backdrop-brightness":[we,ae,te]}],"backdrop-contrast":[{"backdrop-contrast":[we,ae,te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",we,ae,te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[we,ae,te]}],"backdrop-invert":[{"backdrop-invert":["",we,ae,te]}],"backdrop-opacity":[{"backdrop-opacity":[we,ae,te]}],"backdrop-saturate":[{"backdrop-saturate":[we,ae,te]}],"backdrop-sepia":[{"backdrop-sepia":["",we,ae,te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":J()}],"border-spacing-x":[{"border-spacing-x":J()}],"border-spacing-y":[{"border-spacing-y":J()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ae,te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[we,"initial",ae,te]}],ease:[{ease:["linear","initial",O,ae,te]}],delay:[{delay:[we,ae,te]}],animate:[{animate:["none",q,ae,te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[E,ae,te]}],"perspective-origin":[{"perspective-origin":W()}],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:[ae,te,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"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",ae,te]}],"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":J()}],"scroll-mx":[{"scroll-mx":J()}],"scroll-my":[{"scroll-my":J()}],"scroll-ms":[{"scroll-ms":J()}],"scroll-me":[{"scroll-me":J()}],"scroll-mt":[{"scroll-mt":J()}],"scroll-mr":[{"scroll-mr":J()}],"scroll-mb":[{"scroll-mb":J()}],"scroll-ml":[{"scroll-ml":J()}],"scroll-p":[{"scroll-p":J()}],"scroll-px":[{"scroll-px":J()}],"scroll-py":[{"scroll-py":J()}],"scroll-ps":[{"scroll-ps":J()}],"scroll-pe":[{"scroll-pe":J()}],"scroll-pt":[{"scroll-pt":J()}],"scroll-pr":[{"scroll-pr":J()}],"scroll-pb":[{"scroll-pb":J()}],"scroll-pl":[{"scroll-pl":J()}],"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",ae,te]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[we,Si,Zn,md]}],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"]}},F_=O_(Z_);function ke(...n){return F_(_y(n))}const W_=Sy("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"}}),F=w.forwardRef(({className:n,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?r_:"button";return o.jsx(h,{className:ke(W_({variant:a,size:r,className:n})),ref:d,...c})});F.displayName="Button";function Uy(){const{setTheme:n,theme:a}=a_();return o.jsxs(F,{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(qw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(bw,{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 Nr(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 e1(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(x){h(x)}}function p(v){try{g(l.throw(v))}catch(x){h(x)}}function g(v){v.done?d(v.value):c(v.value).then(m,p)}g((l=l.apply(n,a||[])).next())})}function t1(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 a1=n=>n?(...a)=>n(...a):(...a)=>fetch(...a);class sf extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class n1 extends sf{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class Tg extends sf{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class Ag extends sf{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Ld;(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"})(Ld||(Ld={}));class s1{constructor(a,{headers:r={},customFetch:l,region:c=Ld.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=a1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return e1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:p,body:g,signal:v,timeout:x}=l;let _={},{region:S}=l;S||(S=this.region);const A=new URL(`${this.url}/${r}`);S&&S!=="any"&&(_["x-region"]=S,A.searchParams.set("forceFunctionRegion",S));let E;g&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&g instanceof Blob||g instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",E=g):typeof g=="string"?(_["Content-Type"]="text/plain",E=g):typeof FormData<"u"&&g instanceof FormData?E=g:(_["Content-Type"]="application/json",E=JSON.stringify(g)):g&&typeof g!="string"&&!(typeof Blob<"u"&&g instanceof Blob)&&!(g instanceof ArrayBuffer)&&!(typeof FormData<"u"&&g instanceof FormData)?E=JSON.stringify(g):E=g;let k=v;x&&(h=new AbortController,d=setTimeout(()=>h.abort(),x),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({},_),this.headers),m),body:E,signal:k}).catch(W=>{throw new n1(W)}),q=O.headers.get("x-relay-error");if(q&&q==="true")throw new Tg(O);if(!O.ok)throw new Ag(O);let B=((c=O.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),P;return B==="application/json"?P=yield O.json():B==="application/octet-stream"||B==="application/pdf"?P=yield O.blob():B==="text/event-stream"?P=O:B==="multipart/form-data"?P=yield O.formData():P=yield O.text(),{data:P,error:null,response:O}}catch(m){return{data:null,error:m,response:m instanceof Ag||m instanceof Tg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var r1=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}},i1=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 E=(x=r.headers.get("Prefer"))===null||x===void 0?void 0:x.match(/count=(exact|planned|estimated)/),k=(_=d.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");E&&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 E=await d.text();try{h=JSON.parse(E),Array.isArray(h)&&d.status===404&&(m=[],h=null,g=200,v="OK")}catch{d.status===404&&E===""?(g=204,v="No Content"):h={message:E}}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 r1(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:"",E=(v=p?.code)!==null&&v!==void 0?v:"";m=`${(x=d?.name)!==null&&x!==void 0?x:"FetchError"}: ${d?.message}`,m+=`
10
10
 
11
11
  Caused by: ${(_=p?.name)!==null&&_!==void 0?_:"Error"}: ${A}`,E&&(m+=` (${E})`),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}},l1=class extends i1{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 Cg=new RegExp("[,()]");var dr=class extends l1{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"&&Cg.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"&&Cg.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}},o1=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 dr({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 dr({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,x)=>v.concat(Object.keys(x)),[]);if(g.length>0){const v=[...new Set(g)].map(x=>`"${x}"`);m.searchParams.set("columns",v.join(","))}}return new dr({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 dr({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 dr({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},c1=class Ly{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 o1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new Ly(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)),x=l&&Object.values(r).some(v);x?(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 _=new Headers(this.headers);return x?_.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&_.set("Prefer",`count=${d}`),new dr({method:m,url:p,headers:_,schema:this.schemaName,body:g,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class u1{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:
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}},l1=class extends i1{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 Cg=new RegExp("[,()]");var fr=class extends l1{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"&&Cg.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"&&Cg.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}},o1=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,x)=>v.concat(Object.keys(x)),[]);if(g.length>0){const v=[...new Set(g)].map(x=>`"${x}"`);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})}},c1=class Ly{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 o1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new Ly(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)),x=l&&Object.values(r).some(v);x?(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 _=new Headers(this.headers);return x?_.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&_.set("Prefer",`count=${d}`),new fr({method:m,url:p,headers:_,schema:this.schemaName,body:g,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class u1{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
13
  import ws from "ws"
14
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
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 d1="2.90.1",f1=`realtime-js/${d1}`,By="1.0.0",h1="2.0.0",kg=By,Bd=1e4,m1=1e3,p1=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 qd;(function(n){n.websocket="websocket"})(qd||(qd={}));var ts;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(ts||(ts={}));class g1{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):{},x=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(x.length>255)throw new Error(`metadata length ${x.length} exceeds maximum of 255`);const _=this.USER_BROADCAST_PUSH_META_LENGTH+p.length+m.length+h.length+g.length+x.length,S=new ArrayBuffer(this.HEADER_LENGTH+_);let A=new DataView(S),E=0;A.setUint8(E++,this.KINDS.userBroadcastPush),A.setUint8(E++,p.length),A.setUint8(E++,m.length),A.setUint8(E++,h.length),A.setUint8(E++,g.length),A.setUint8(E++,x.length),A.setUint8(E++,r),Array.from(p,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(m,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(h,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(g,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(x,O=>A.setUint8(E++,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 x=l.decode(a.slice(p,p+h));p=p+h;const _=a.slice(p,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(_)):_,A={type:this.BROADCAST_EVENT,event:v,payload:S};return h>0&&(A.meta=JSON.parse(x)),{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 qy{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 Og=(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]=y1(h,n,a,c),d),{}):{}},y1=(n,a,r,l)=>{const c=a.find(m=>m.name===n),d=c?.type,h=r[n];return d&&!l.includes(d)?$y(d,h):$d(h)},$y=(n,a)=>{if(n.charAt(0)==="_"){const r=n.slice(1,n.length);return w1(a,r)}switch(n){case Pe.bool:return v1(a);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return b1(a);case Pe.json:case Pe.jsonb:return x1(a);case Pe.timestamp:return _1(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 $d(a);default:return $d(a)}},$d=n=>n,v1=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},b1=n=>{if(typeof n=="string"){const a=parseFloat(n);if(!Number.isNaN(a))return a}return n},x1=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},w1=(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=>$y(a,m))}return n},_1=n=>typeof n=="string"?n.replace(" ","T"):n,Hy=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 pd{constructor(a,r,l={},c=Bd){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 Rg;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(Rg||(Rg={}));class ji{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=ji.syncState(this.state,c,d,h),this.pendingDiffs.forEach(p=>{this.state=ji.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=ji.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 x=d[g];if(x){const _=v.map(k=>k.presence_ref),S=x.map(k=>k.presence_ref),A=v.filter(k=>S.indexOf(k.presence_ref)<0),E=x.filter(k=>_.indexOf(k.presence_ref)<0);A.length>0&&(m[g]=A),E.length>0&&(p[g]=E)}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 x=a[m].map(S=>S.presence_ref),_=v.filter(S=>x.indexOf(S.presence_ref)<0);a[m].unshift(..._)}l(m,v,p)}),this.map(h,(m,p)=>{let g=a[m];if(!g)return;const v=p.map(x=>x.presence_ref);g=g.filter(x=>v.indexOf(x.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 Dg;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(Dg||(Dg={}));var Ei;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(Ei||(Ei={}));var Xa;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(Xa||(Xa={}));class gr{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 pd(this,fa.join,this.params,this.timeout),this.rejoinTimer=new qy(()=>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 ji(this),this.broadcastEndpointURL=Hy(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[Ei.PRESENCE]&&this.bindings[Ei.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&&(x.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 E=this.bindings.postgres_changes,k=(A=E?.length)!==null&&A!==void 0?A:0,O=[];for(let q=0;q<k;q++){const L=E[q],{filter:{event:P,schema:W,table:Q,filter:Y}}=L,J=S&&S[q];if(J&&J.event===P&&gr.isFilterValueEqual(J.schema,W)&&gr.isFilterValueEqual(J.table,Q)&&gr.isFilterValueEqual(J.filter,Y))O.push(Object.assign(Object.assign({},L),{id:J.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===Ei.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 pd(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 pd(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>p1){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 _=this._onMessage(h,r,l);if(r&&!_)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,E,k;return((A=S.filter)===null||A===void 0?void 0:A.event)==="*"||((k=(E=S.filter)===null||E===void 0?void 0:E.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===h}).map(S=>S.callback(_,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var A,E,k,O,q,L,P,W;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const Q=S.id,Y=(A=S.filter)===null||A===void 0?void 0:A.event;return Q&&((E=r.ids)===null||E===void 0?void 0:E.includes(Q))&&(Y==="*"||Y?.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 Q=(P=(L=S?.filter)===null||L===void 0?void 0:L.event)===null||P===void 0?void 0:P.toLocaleLowerCase();return Q==="*"||Q===((W=r?.event)===null||W===void 0?void 0:W.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===h}).map(S=>{if(typeof _=="object"&&"ids"in _){const A=_.data,{schema:E,table:k,commit_timestamp:O,type:q,errors:L}=A;_=Object.assign(Object.assign({},{schema:E,table:k,commit_timestamp:O,eventType:q,new:{},old:{},errors:L}),this._getPayloadRecords(A))}S.callback(_,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&&gr.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=Og(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Og(a.columns,a.old_record)),r}}const gd=()=>{},fo={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},S1=[1e3,2e3,5e3,1e4],j1=1e4,E1=`
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 d1="2.90.1",f1=`realtime-js/${d1}`,By="1.0.0",h1="2.0.0",kg=By,Bd=1e4,m1=1e3,p1=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 qd;(function(n){n.websocket="websocket"})(qd||(qd={}));var ts;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(ts||(ts={}));class g1{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):{},x=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(x.length>255)throw new Error(`metadata length ${x.length} exceeds maximum of 255`);const _=this.USER_BROADCAST_PUSH_META_LENGTH+p.length+m.length+h.length+g.length+x.length,S=new ArrayBuffer(this.HEADER_LENGTH+_);let A=new DataView(S),E=0;A.setUint8(E++,this.KINDS.userBroadcastPush),A.setUint8(E++,p.length),A.setUint8(E++,m.length),A.setUint8(E++,h.length),A.setUint8(E++,g.length),A.setUint8(E++,x.length),A.setUint8(E++,r),Array.from(p,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(m,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(h,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(g,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(x,O=>A.setUint8(E++,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 x=l.decode(a.slice(p,p+h));p=p+h;const _=a.slice(p,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(_)):_,A={type:this.BROADCAST_EVENT,event:v,payload:S};return h>0&&(A.meta=JSON.parse(x)),{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 qy{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 Ke;(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"})(Ke||(Ke={}));const Og=(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]=y1(h,n,a,c),d),{}):{}},y1=(n,a,r,l)=>{const c=a.find(m=>m.name===n),d=c?.type,h=r[n];return d&&!l.includes(d)?$y(d,h):$d(h)},$y=(n,a)=>{if(n.charAt(0)==="_"){const r=n.slice(1,n.length);return w1(a,r)}switch(n){case Ke.bool:return v1(a);case Ke.float4:case Ke.float8:case Ke.int2:case Ke.int4:case Ke.int8:case Ke.numeric:case Ke.oid:return b1(a);case Ke.json:case Ke.jsonb:return x1(a);case Ke.timestamp:return _1(a);case Ke.abstime:case Ke.date:case Ke.daterange:case Ke.int4range:case Ke.int8range:case Ke.money:case Ke.reltime:case Ke.text:case Ke.time:case Ke.timestamptz:case Ke.timetz:case Ke.tsrange:case Ke.tstzrange:return $d(a);default:return $d(a)}},$d=n=>n,v1=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},b1=n=>{if(typeof n=="string"){const a=parseFloat(n);if(!Number.isNaN(a))return a}return n},x1=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},w1=(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=>$y(a,m))}return n},_1=n=>typeof n=="string"?n.replace(" ","T"):n,Hy=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 pd{constructor(a,r,l={},c=Bd){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 Rg;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(Rg||(Rg={}));class Ei{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=Ei.syncState(this.state,c,d,h),this.pendingDiffs.forEach(p=>{this.state=Ei.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=Ei.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 x=d[g];if(x){const _=v.map(k=>k.presence_ref),S=x.map(k=>k.presence_ref),A=v.filter(k=>S.indexOf(k.presence_ref)<0),E=x.filter(k=>_.indexOf(k.presence_ref)<0);A.length>0&&(m[g]=A),E.length>0&&(p[g]=E)}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 x=a[m].map(S=>S.presence_ref),_=v.filter(S=>x.indexOf(S.presence_ref)<0);a[m].unshift(..._)}l(m,v,p)}),this.map(h,(m,p)=>{let g=a[m];if(!g)return;const v=p.map(x=>x.presence_ref);g=g.filter(x=>v.indexOf(x.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 Dg;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(Dg||(Dg={}));var Ni;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(Ni||(Ni={}));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 pd(this,fa.join,this.params,this.timeout),this.rejoinTimer=new qy(()=>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 Ei(this),this.broadcastEndpointURL=Hy(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[Ni.PRESENCE]&&this.bindings[Ni.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&&(x.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 E=this.bindings.postgres_changes,k=(A=E?.length)!==null&&A!==void 0?A:0,O=[];for(let q=0;q<k;q++){const B=E[q],{filter:{event:P,schema:W,table:Q,filter:Y}}=B,J=S&&S[q];if(J&&J.event===P&&yr.isFilterValueEqual(J.schema,W)&&yr.isFilterValueEqual(J.table,Q)&&yr.isFilterValueEqual(J.filter,Y))O.push(Object.assign(Object.assign({},B),{id:J.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===Ni.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 pd(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 pd(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>p1){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 _=this._onMessage(h,r,l);if(r&&!_)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,E,k;return((A=S.filter)===null||A===void 0?void 0:A.event)==="*"||((k=(E=S.filter)===null||E===void 0?void 0:E.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===h}).map(S=>S.callback(_,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var A,E,k,O,q,B,P,W;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const Q=S.id,Y=(A=S.filter)===null||A===void 0?void 0:A.event;return Q&&((E=r.ids)===null||E===void 0?void 0:E.includes(Q))&&(Y==="*"||Y?.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 Q=(P=(B=S?.filter)===null||B===void 0?void 0:B.event)===null||P===void 0?void 0:P.toLocaleLowerCase();return Q==="*"||Q===((W=r?.event)===null||W===void 0?void 0:W.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===h}).map(S=>{if(typeof _=="object"&&"ids"in _){const A=_.data,{schema:E,table:k,commit_timestamp:O,type:q,errors:B}=A;_=Object.assign(Object.assign({},{schema:E,table:k,commit_timestamp:O,eventType:q,new:{},old:{},errors:B}),this._getPayloadRecords(A))}S.callback(_,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=Og(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Og(a.columns,a.old_record)),r}}const gd=()=>{},fo={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},S1=[1e3,2e3,5e3,1e4],j1=1e4,E1=`
17
17
  addEventListener("message", (e) => {
18
18
  if (e.data.event === "start") {
19
19
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
@@ -31,8 +31,8 @@ Option 2: Install and provide the "ws" package:
31
31
  const client = new RealtimeClient(url, {
32
32
  ...options,
33
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 gr(`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(m1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},fo.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([E1],{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:f1};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 qy(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},fo.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:Bd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:fo.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:gd,this.vsn=(p=a?.vsn)!==null&&p!==void 0?p:kg,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=>S1[A-1]||j1),this.vsn){case By:this.encode=(v=a?.encode)!==null&&v!==void 0?v:((A,E)=>E(JSON.stringify(A))),this.decode=(x=a?.decode)!==null&&x!==void 0?x:((A,E)=>E(JSON.parse(A)));break;case h1:this.encode=(_=a?.encode)!==null&&_!==void 0?_: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 Ai=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 T1(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 A1(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 C1(n){const a=n.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=T1(n.baseUrl,l,c),p=await A1(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(),x=(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 Ai(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:_}}}}function ho(n){return n.join("")}var k1=class{constructor(n,a=""){this.client=n,this.prefix=a}async listNamespaces(n){const a=n?{parent:ho(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/${ho(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ho(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ho(n.namespace)}`}),!0}catch(a){if(a instanceof Ai&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(n,a){try{return await this.createNamespace(n,a)}catch(r){if(r instanceof Ai&&r.status===409)return;throw r}}};function ar(n){return n.join("")}var O1=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/${ar(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/${ar(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/${ar(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/${ar(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/${ar(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/${ar(n.namespace)}/tables/${n.name}`,headers:a}),!0}catch(r){if(r instanceof Ai&&r.status===404)return!1;throw r}}async createTableIfNotExists(n,a){try{return await this.createTable(n,a)}catch(r){if(r instanceof Ai&&r.status===409)return await this.loadTable({namespace:n.namespace,name:a.name});throw r}}},R1=class{constructor(n){let a="v1";n.catalogName&&(a+=`/${n.catalogName}`);const r=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=C1({baseUrl:r,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=n.accessDelegation?.join(","),this.namespaceOps=new k1(this.client,a),this.tableOps=new O1(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)}},Bo=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 D1=class extends Bo{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}}},Hd=class extends Bo{constructor(n,a){super(n),this.name="StorageUnknownError",this.originalError=a}};const rf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),M1=()=>Response,Vd=n=>{if(Array.isArray(n))return n.map(r=>Vd(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]=Vd(l)}),a},z1=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)},U1=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function Ci(n){"@babel/helpers - typeof";return Ci=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},Ci(n)}function L1(n,a){if(Ci(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(Ci(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function B1(n){var a=L1(n,"string");return Ci(a)=="symbol"?a:a+""}function q1(n,a,r){return(a=B1(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function Mg(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 me(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Mg(Object(r),!0).forEach(function(l){q1(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Mg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const yd=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)},$1=async(n,a,r)=>{n instanceof await M1()&&!r?.noResolveJson?n.json().then(l=>{const c=n.status||500,d=l?.statusCode||c+"";a(new D1(yd(l),c,d))}).catch(l=>{a(new Hd(yd(l),l))}):a(new Hd(yd(n),n))},H1=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return n==="GET"||!l?c:(z1(l)?(c.headers=me({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,a?.duplex&&(c.duplex=a.duplex),me(me({},c),r))};async function $i(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,H1(a,l,c,d)).then(p=>{if(!p.ok)throw p;return l?.noResolveJson?p:p.json()}).then(p=>h(p)).catch(p=>$1(p,m,l))})}async function ki(n,a,r,l){return $i(n,"GET",a,r,l)}async function da(n,a,r,l,c){return $i(n,"POST",a,l,c,r)}async function Id(n,a,r,l,c){return $i(n,"PUT",a,l,c,r)}async function V1(n,a,r,l){return $i(n,"HEAD",a,me(me({},r),{},{noResolveJson:!0}),l)}async function lf(n,a,r,l,c){return $i(n,"DELETE",a,l,c,r)}var I1=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 Vy;Vy=Symbol.toStringTag;var G1=class{constructor(n,a){this.downloadFn=n,this.shouldThrowOnError=a,this[Vy]="BlobDownloadBuilder",this.promise=null}asStream(){return new I1(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 P1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},zg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var K1=class{constructor(n,a={},r,l){this.shouldThrowOnError=!1,this.url=n,this.headers=a,this.bucketId=r,this.fetch=rf(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(n,a,r,l){var c=this;try{let d;const h=me(me({},zg),l);let m=me(me({},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=me(me({},m),l.headers));const g=c._removeEmptyFolders(a),v=c._getFinalPath(g),x=await(n=="PUT"?Id:da)(c.fetch,`${c.url}/object/${v}`,d,me({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:g,id:x.Id,fullPath:x.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=me({upsert:zg.upsert},l),v=me(me({},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 Id(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=me({},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 Bo("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}`,me({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=>me(me({},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=()=>ki(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new G1(h,this.shouldThrowOnError)}async info(n){var a=this;const r=a._getFinalPath(n);try{return{data:Vd(await ki(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 V1(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 Hd){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 lf(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=me(me(me({},P1),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=me({},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 Iy="2.90.1",Gy={"X-Client-Info":`storage-js/${Iy}`};var Y1=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=me(me({},Gy),a),this.fetch=rf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(n){var a=this;try{const r=a.listBucketOptionsToQueryString(n);return{data:await ki(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 ki(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 Id(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 lf(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():""}},J1=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=me(me({},Gy),a),this.fetch=rf(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 ki(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 lf(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(!U1(n))throw new Bo("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 R1({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 of={"X-Client-Info":`storage-js/${Iy}`,"Content-Type":"application/json"};var Py=class extends Error{constructor(n){super(n),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Yt(n){return typeof n=="object"&&n!==null&&"__isStorageVectorsError"in n}var vd=class extends Py{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}}},X1=class extends Py{constructor(n,a){super(n),this.name="StorageVectorsUnknownError",this.originalError=a}};const cf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),Q1=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)},Ug=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),Z1=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 vd(Ug(d),l,h))}).catch(()=>{const d=l+"";a(new vd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new vd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new X1(Ug(n),n))},F1=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return l?(Q1(l)?(c.headers=me({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,me(me({},c),r)):c};async function W1(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,F1(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=>Z1(p,m,l))})}async function Jt(n,a,r,l,c){return W1(n,"POST",a,l,c,r)}var eS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=me(me({},of),a),this.fetch=cf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/CreateIndex`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async getIndex(n,a){var r=this;try{return{data:await Jt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Yt(l))return{data:null,error:l};throw l}}async listIndexes(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/ListIndexes`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async deleteIndex(n,a){var r=this;try{return{data:await Jt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Yt(l))return{data:null,error:l};throw l}}},tS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=me(me({},of),a),this.fetch=cf(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 Jt(a.fetch,`${a.url}/PutVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async getVectors(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/GetVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(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 Jt(a.fetch,`${a.url}/ListVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async queryVectors(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/QueryVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(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 Jt(a.fetch,`${a.url}/DeleteVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}},aS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=me(me({},of),a),this.fetch=cf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async getBucket(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async listBuckets(n={}){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/ListVectorBuckets`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}},nS=class extends aS{constructor(n,a={}){super(n,a.headers||{},a.fetch)}from(n){return new sS(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)}},sS=class extends eS{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,me(me({},n),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(n={}){var a=()=>super.listIndexes,r=this;return a().call(r,me(me({},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 rS(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},rS=class extends tS{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,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(n){var a=()=>super.getVectors,r=this;return a().call(r,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(n={}){var a=()=>super.listVectors,r=this;return a().call(r,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(n){var a=()=>super.queryVectors,r=this;return a().call(r,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(n){var a=()=>super.deleteVectors,r=this;return a().call(r,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},iS=class extends Y1{constructor(n,a={},r,l){super(n,a,r,l)}from(n){return new K1(this.url,this.headers,n,this.fetch)}get vectors(){return new nS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new J1(this.url+"/iceberg",this.headers,this.fetch)}};const Ky="2.90.1",fr=30*1e3,Gd=3,bd=Gd*fr,lS="http://localhost:9999",oS="supabase.auth.token",cS={"X-Client-Info":`gotrue-js/${Ky}`},Pd="X-Supabase-Api-Version",Yy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},uS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,dS=600*1e3;class Oi extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function le(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class fS extends Oi{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function hS(n){return le(n)&&n.name==="AuthApiError"}class as extends Oi{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class Fa extends Oi{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Kt extends Fa{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function mS(n){return le(n)&&n.name==="AuthSessionMissingError"}class nr extends Fa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class mo extends Fa{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class po 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 pS(n){return le(n)&&n.name==="AuthImplicitGrantRedirectError"}class Lg 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 gS 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 Kd extends Fa{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function xd(n){return le(n)&&n.name==="AuthRetryableFetchError"}class Bg extends Fa{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Yd extends Fa{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const Oo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),qg=`
35
- \r=`.split(""),yS=(()=>{const n=new Array(128);for(let a=0;a<n.length;a+=1)n[a]=-1;for(let a=0;a<qg.length;a+=1)n[qg[a].charCodeAt(0)]=-2;for(let a=0;a<Oo.length;a+=1)n[Oo[a].charCodeAt(0)]=a;return n})();function $g(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(Oo[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(Oo[l]),a.queuedBits-=6}}function Jy(n,a,r){const l=yS[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 Hg(n){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{xS(h,l,r)};for(let h=0;h<n.length;h+=1)Jy(n.charCodeAt(h),c,d);return a.join("")}function vS(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 bS(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}vS(l,a)}}function xS(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 yr(n){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<n.length;c+=1)Jy(n.charCodeAt(c),r,l);return new Uint8Array(a)}function wS(n){const a=[];return bS(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=>$g(c,r,l)),$g(null,r,l),a.join("")}function _S(n){return Math.round(Date.now()/1e3)+n}function SS(){return Symbol("auth-callback")}const jt=()=>typeof window<"u"&&typeof document<"u",Fn={tested:!1,writable:!1},Xy=()=>{if(!jt())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 jS(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 Qy=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),ES=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",hr=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}},St=async(n,a)=>{await n.removeItem(a)};class qo{constructor(){this.promise=new qo.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}qo.promiseConstructor=Promise;function wd(n){const a=n.split(".");if(a.length!==3)throw new Yd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!uS.test(a[l]))throw new Yd("JWT not in base64url format");return{header:JSON.parse(Hg(a[0])),payload:JSON.parse(Hg(a[1])),signature:yr(a[2]),raw:{header:a[0],payload:a[1]}}}async function NS(n){return await new Promise(a=>{setTimeout(()=>a(null),n)})}function TS(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 AS(n){return("0"+n.toString(16)).substr(-2)}function CS(){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,AS).join("")}async function kS(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 OS(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 kS(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function sr(n,a,r=!1){const l=CS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await hr(n,`${a}-code-verifier`,c);const d=await OS(l);return[d,l===d?"plain":"s256"]}const RS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function DS(n){const a=n.headers.get(Pd);if(!a||!a.match(RS))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function MS(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 zS(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 US=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function rr(n){if(!US.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function _d(){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 LS(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 Vg(n){return JSON.parse(JSON.stringify(n))}const es=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),BS=[502,503,504];async function Ig(n){var a;if(!ES(n))throw new Kd(es(n),0);if(BS.includes(n.status))throw new Kd(es(n),n.status);let r;try{r=await n.json()}catch(d){throw new as(es(d),d)}let l;const c=DS(n);if(c&&c.getTime()>=Yy["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 Bg(es(r),n.status,((a=r.weak_password)===null||a===void 0?void 0:a.reasons)||[]);if(l==="session_not_found")throw new Kt}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 Bg(es(r),n.status,r.weak_password.reasons);throw new fS(es(r),n.status||500,l)}const qS=(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 he(n,a,r,l){var c;const d=Object.assign({},l?.headers);d[Pd]||(d[Pd]=Yy["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 $S(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 $S(n,a,r,l,c,d){const h=qS(a,l,c,d);let m;try{m=await n(r,Object.assign({},h))}catch(p){throw console.error(p),new Kd(es(p),0)}if(m.ok||await Ig(m),l?.noResolveJson)return m;try{return await m.json()}catch(p){await Ig(p)}}function ua(n){var a;let r=null;IS(n)&&(r=Object.assign({},n),n.expires_at||(r.expires_at=_S(n.expires_in)));const l=(a=n.user)!==null&&a!==void 0?a:n;return{data:{session:r,user:l},error:null}}function Gg(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 HS(n){return{data:n,error:null}}function VS(n){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=n,h=Er(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 Pg(n){return n}function IS(n){return n.access_token&&n.refresh_token&&n.expires_in}const Sd=["global","local","others"];class GS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Qy(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=Sd[0]){if(Sd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Sd.join(", ")}`);try{return await he(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:a,noResolveJson:!0}),{data:null,error:null}}catch(l){if(le(l))return{data:null,error:l};throw l}}async inviteUserByEmail(a,r={}){try{return await he(this.fetch,"POST",`${this.url}/invite`,{body:{email:a,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:kn})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Er(a,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await he(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:VS,redirectTo:r?.redirectTo})}catch(r){if(le(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(a){try{return await he(this.fetch,"POST",`${this.url}/admin/users`,{body:a,headers:this.headers,xform:kn})}catch(r){if(le(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 he(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:Pg});if(v.error)throw v.error;const x=await v.json(),_=(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 E=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);g[`${k}Page`]=E}),g.total=parseInt(_)),{data:Object.assign(Object.assign({},x),g),error:null}}catch(g){if(le(g))return{data:{users:[]},error:g};throw g}}async getUserById(a){rr(a);try{return await he(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:kn})}catch(r){if(le(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){rr(a);try{return await he(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:kn})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){rr(a);try{return await he(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:kn})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){rr(a.userId);try{const{data:r,error:l}=await he(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(le(r))return{data:null,error:r};throw r}}async _deleteFactor(a){rr(a.userId),rr(a.id);try{return{data:await he(this.fetch,"DELETE",`${this.url}/admin/users/${a.userId}/factors/${a.id}`,{headers:this.headers}),error:null}}catch(r){if(le(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 he(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:Pg});if(v.error)throw v.error;const x=await v.json(),_=(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 E=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);g[`${k}Page`]=E}),g.total=parseInt(_)),{data:Object.assign(Object.assign({},x),g),error:null}}catch(g){if(le(g))return{data:{clients:[]},error:g};throw g}}async _createOAuthClient(a){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:a,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}async _getOAuthClient(a){try{return await he(this.fetch,"GET",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}async _updateOAuthClient(a,r){try{return await he(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${a}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(le(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(a){try{return await he(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(le(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(a){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients/${a}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}}function Kg(n={}){return{getItem:a=>n[a]||null,setItem:(a,r)=>{n[a]=r},removeItem:a=>{delete n[a]}}}const ir={debug:!!(globalThis&&Xy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Zy extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class PS extends Zy{}async function KS(n,a,r){ir.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",n,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),ir.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){ir.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",n,c.name);try{return await r()}finally{ir.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",n,c.name)}}else{if(a===0)throw ir.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",n),new PS(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(ir.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 YS(){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 Fy(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function JS(n){return parseInt(n,16)}function XS(n){const a=new TextEncoder().encode(n);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function QS(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:x,version:_}=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(!x)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(_!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${_}`);if(!((a=n.statement)===null||a===void 0)&&a.includes(`
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(m1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},fo.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([E1],{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:f1};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 qy(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},fo.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:Bd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:fo.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:gd,this.vsn=(p=a?.vsn)!==null&&p!==void 0?p:kg,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=>S1[A-1]||j1),this.vsn){case By:this.encode=(v=a?.encode)!==null&&v!==void 0?v:((A,E)=>E(JSON.stringify(A))),this.decode=(x=a?.decode)!==null&&x!==void 0?x:((A,E)=>E(JSON.parse(A)));break;case h1:this.encode=(_=a?.encode)!==null&&_!==void 0?_: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 Ci=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 T1(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 A1(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 C1(n){const a=n.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=T1(n.baseUrl,l,c),p=await A1(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(),x=(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 Ci(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:_}}}}function ho(n){return n.join("")}var k1=class{constructor(n,a=""){this.client=n,this.prefix=a}async listNamespaces(n){const a=n?{parent:ho(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/${ho(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ho(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ho(n.namespace)}`}),!0}catch(a){if(a instanceof Ci&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(n,a){try{return await this.createNamespace(n,a)}catch(r){if(r instanceof Ci&&r.status===409)return;throw r}}};function nr(n){return n.join("")}var O1=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 Ci&&r.status===404)return!1;throw r}}async createTableIfNotExists(n,a){try{return await this.createTable(n,a)}catch(r){if(r instanceof Ci&&r.status===409)return await this.loadTable({namespace:n.namespace,name:a.name});throw r}}},R1=class{constructor(n){let a="v1";n.catalogName&&(a+=`/${n.catalogName}`);const r=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=C1({baseUrl:r,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=n.accessDelegation?.join(","),this.namespaceOps=new k1(this.client,a),this.tableOps=new O1(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)}},Bo=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 D1=class extends Bo{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}}},Hd=class extends Bo{constructor(n,a){super(n),this.name="StorageUnknownError",this.originalError=a}};const rf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),M1=()=>Response,Vd=n=>{if(Array.isArray(n))return n.map(r=>Vd(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]=Vd(l)}),a},z1=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)},U1=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function ki(n){"@babel/helpers - typeof";return ki=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},ki(n)}function L1(n,a){if(ki(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(ki(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function B1(n){var a=L1(n,"string");return ki(a)=="symbol"?a:a+""}function q1(n,a,r){return(a=B1(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function Mg(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 me(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Mg(Object(r),!0).forEach(function(l){q1(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Mg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const yd=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)},$1=async(n,a,r)=>{n instanceof await M1()&&!r?.noResolveJson?n.json().then(l=>{const c=n.status||500,d=l?.statusCode||c+"";a(new D1(yd(l),c,d))}).catch(l=>{a(new Hd(yd(l),l))}):a(new Hd(yd(n),n))},H1=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return n==="GET"||!l?c:(z1(l)?(c.headers=me({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,a?.duplex&&(c.duplex=a.duplex),me(me({},c),r))};async function Hi(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,H1(a,l,c,d)).then(p=>{if(!p.ok)throw p;return l?.noResolveJson?p:p.json()}).then(p=>h(p)).catch(p=>$1(p,m,l))})}async function Oi(n,a,r,l){return Hi(n,"GET",a,r,l)}async function da(n,a,r,l,c){return Hi(n,"POST",a,l,c,r)}async function Id(n,a,r,l,c){return Hi(n,"PUT",a,l,c,r)}async function V1(n,a,r,l){return Hi(n,"HEAD",a,me(me({},r),{},{noResolveJson:!0}),l)}async function lf(n,a,r,l,c){return Hi(n,"DELETE",a,l,c,r)}var I1=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 Vy;Vy=Symbol.toStringTag;var G1=class{constructor(n,a){this.downloadFn=n,this.shouldThrowOnError=a,this[Vy]="BlobDownloadBuilder",this.promise=null}asStream(){return new I1(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 P1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},zg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var K1=class{constructor(n,a={},r,l){this.shouldThrowOnError=!1,this.url=n,this.headers=a,this.bucketId=r,this.fetch=rf(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(n,a,r,l){var c=this;try{let d;const h=me(me({},zg),l);let m=me(me({},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=me(me({},m),l.headers));const g=c._removeEmptyFolders(a),v=c._getFinalPath(g),x=await(n=="PUT"?Id:da)(c.fetch,`${c.url}/object/${v}`,d,me({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:g,id:x.Id,fullPath:x.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=me({upsert:zg.upsert},l),v=me(me({},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 Id(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=me({},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 Bo("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}`,me({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=>me(me({},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=()=>Oi(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new G1(h,this.shouldThrowOnError)}async info(n){var a=this;const r=a._getFinalPath(n);try{return{data:Vd(await Oi(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 V1(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 Hd){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 lf(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=me(me(me({},P1),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=me({},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 Iy="2.90.1",Gy={"X-Client-Info":`storage-js/${Iy}`};var Y1=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=me(me({},Gy),a),this.fetch=rf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(n){var a=this;try{const r=a.listBucketOptionsToQueryString(n);return{data:await Oi(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 Oi(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 Id(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 lf(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():""}},J1=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=me(me({},Gy),a),this.fetch=rf(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 Oi(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 lf(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(!U1(n))throw new Bo("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 R1({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 of={"X-Client-Info":`storage-js/${Iy}`,"Content-Type":"application/json"};var Py=class extends Error{constructor(n){super(n),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Yt(n){return typeof n=="object"&&n!==null&&"__isStorageVectorsError"in n}var vd=class extends Py{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}}},X1=class extends Py{constructor(n,a){super(n),this.name="StorageVectorsUnknownError",this.originalError=a}};const cf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),Q1=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)},Ug=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),Z1=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 vd(Ug(d),l,h))}).catch(()=>{const d=l+"";a(new vd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new vd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new X1(Ug(n),n))},F1=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return l?(Q1(l)?(c.headers=me({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,me(me({},c),r)):c};async function W1(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,F1(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=>Z1(p,m,l))})}async function Jt(n,a,r,l,c){return W1(n,"POST",a,l,c,r)}var eS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=me(me({},of),a),this.fetch=cf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/CreateIndex`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async getIndex(n,a){var r=this;try{return{data:await Jt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Yt(l))return{data:null,error:l};throw l}}async listIndexes(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/ListIndexes`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async deleteIndex(n,a){var r=this;try{return{data:await Jt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Yt(l))return{data:null,error:l};throw l}}},tS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=me(me({},of),a),this.fetch=cf(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 Jt(a.fetch,`${a.url}/PutVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async getVectors(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/GetVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(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 Jt(a.fetch,`${a.url}/ListVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async queryVectors(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/QueryVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(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 Jt(a.fetch,`${a.url}/DeleteVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}},aS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=me(me({},of),a),this.fetch=cf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async getBucket(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async listBuckets(n={}){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/ListVectorBuckets`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await Jt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Yt(r))return{data:null,error:r};throw r}}},nS=class extends aS{constructor(n,a={}){super(n,a.headers||{},a.fetch)}from(n){return new sS(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)}},sS=class extends eS{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,me(me({},n),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(n={}){var a=()=>super.listIndexes,r=this;return a().call(r,me(me({},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 rS(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},rS=class extends tS{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,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(n){var a=()=>super.getVectors,r=this;return a().call(r,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(n={}){var a=()=>super.listVectors,r=this;return a().call(r,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(n){var a=()=>super.queryVectors,r=this;return a().call(r,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(n){var a=()=>super.deleteVectors,r=this;return a().call(r,me(me({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},iS=class extends Y1{constructor(n,a={},r,l){super(n,a,r,l)}from(n){return new K1(this.url,this.headers,n,this.fetch)}get vectors(){return new nS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new J1(this.url+"/iceberg",this.headers,this.fetch)}};const Ky="2.90.1",hr=30*1e3,Gd=3,bd=Gd*hr,lS="http://localhost:9999",oS="supabase.auth.token",cS={"X-Client-Info":`gotrue-js/${Ky}`},Pd="X-Supabase-Api-Version",Yy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},uS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,dS=600*1e3;class Ri extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function le(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class fS extends Ri{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function hS(n){return le(n)&&n.name==="AuthApiError"}class as extends Ri{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class Fa extends Ri{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Kt extends Fa{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function mS(n){return le(n)&&n.name==="AuthSessionMissingError"}class sr extends Fa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class mo extends Fa{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class po 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 pS(n){return le(n)&&n.name==="AuthImplicitGrantRedirectError"}class Lg 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 gS 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 Kd extends Fa{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function xd(n){return le(n)&&n.name==="AuthRetryableFetchError"}class Bg extends Fa{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Yd extends Fa{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const Oo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),qg=`
35
+ \r=`.split(""),yS=(()=>{const n=new Array(128);for(let a=0;a<n.length;a+=1)n[a]=-1;for(let a=0;a<qg.length;a+=1)n[qg[a].charCodeAt(0)]=-2;for(let a=0;a<Oo.length;a+=1)n[Oo[a].charCodeAt(0)]=a;return n})();function $g(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(Oo[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(Oo[l]),a.queuedBits-=6}}function Jy(n,a,r){const l=yS[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 Hg(n){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{xS(h,l,r)};for(let h=0;h<n.length;h+=1)Jy(n.charCodeAt(h),c,d);return a.join("")}function vS(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 bS(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}vS(l,a)}}function xS(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)Jy(n.charCodeAt(c),r,l);return new Uint8Array(a)}function wS(n){const a=[];return bS(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=>$g(c,r,l)),$g(null,r,l),a.join("")}function _S(n){return Math.round(Date.now()/1e3)+n}function SS(){return Symbol("auth-callback")}const Et=()=>typeof window<"u"&&typeof document<"u",Fn={tested:!1,writable:!1},Xy=()=>{if(!Et())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 jS(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 Qy=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),ES=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 qo{constructor(){this.promise=new qo.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}qo.promiseConstructor=Promise;function wd(n){const a=n.split(".");if(a.length!==3)throw new Yd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!uS.test(a[l]))throw new Yd("JWT not in base64url format");return{header:JSON.parse(Hg(a[0])),payload:JSON.parse(Hg(a[1])),signature:vr(a[2]),raw:{header:a[0],payload:a[1]}}}async function NS(n){return await new Promise(a=>{setTimeout(()=>a(null),n)})}function TS(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 AS(n){return("0"+n.toString(16)).substr(-2)}function CS(){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,AS).join("")}async function kS(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 OS(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 kS(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function rr(n,a,r=!1){const l=CS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await mr(n,`${a}-code-verifier`,c);const d=await OS(l);return[d,l===d?"plain":"s256"]}const RS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function DS(n){const a=n.headers.get(Pd);if(!a||!a.match(RS))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function MS(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 zS(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 US=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ir(n){if(!US.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function _d(){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 LS(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 Vg(n){return JSON.parse(JSON.stringify(n))}const es=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),BS=[502,503,504];async function Ig(n){var a;if(!ES(n))throw new Kd(es(n),0);if(BS.includes(n.status))throw new Kd(es(n),n.status);let r;try{r=await n.json()}catch(d){throw new as(es(d),d)}let l;const c=DS(n);if(c&&c.getTime()>=Yy["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 Bg(es(r),n.status,((a=r.weak_password)===null||a===void 0?void 0:a.reasons)||[]);if(l==="session_not_found")throw new Kt}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 Bg(es(r),n.status,r.weak_password.reasons);throw new fS(es(r),n.status||500,l)}const qS=(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 he(n,a,r,l){var c;const d=Object.assign({},l?.headers);d[Pd]||(d[Pd]=Yy["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 $S(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 $S(n,a,r,l,c,d){const h=qS(a,l,c,d);let m;try{m=await n(r,Object.assign({},h))}catch(p){throw console.error(p),new Kd(es(p),0)}if(m.ok||await Ig(m),l?.noResolveJson)return m;try{return await m.json()}catch(p){await Ig(p)}}function ua(n){var a;let r=null;IS(n)&&(r=Object.assign({},n),n.expires_at||(r.expires_at=_S(n.expires_in)));const l=(a=n.user)!==null&&a!==void 0?a:n;return{data:{session:r,user:l},error:null}}function Gg(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 HS(n){return{data:n,error:null}}function VS(n){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=n,h=Nr(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 Pg(n){return n}function IS(n){return n.access_token&&n.refresh_token&&n.expires_in}const Sd=["global","local","others"];class GS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Qy(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=Sd[0]){if(Sd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Sd.join(", ")}`);try{return await he(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:a,noResolveJson:!0}),{data:null,error:null}}catch(l){if(le(l))return{data:null,error:l};throw l}}async inviteUserByEmail(a,r={}){try{return await he(this.fetch,"POST",`${this.url}/invite`,{body:{email:a,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:kn})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Nr(a,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await he(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:VS,redirectTo:r?.redirectTo})}catch(r){if(le(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(a){try{return await he(this.fetch,"POST",`${this.url}/admin/users`,{body:a,headers:this.headers,xform:kn})}catch(r){if(le(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 he(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:Pg});if(v.error)throw v.error;const x=await v.json(),_=(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 E=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);g[`${k}Page`]=E}),g.total=parseInt(_)),{data:Object.assign(Object.assign({},x),g),error:null}}catch(g){if(le(g))return{data:{users:[]},error:g};throw g}}async getUserById(a){ir(a);try{return await he(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:kn})}catch(r){if(le(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){ir(a);try{return await he(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:kn})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){ir(a);try{return await he(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:kn})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){ir(a.userId);try{const{data:r,error:l}=await he(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(le(r))return{data:null,error:r};throw r}}async _deleteFactor(a){ir(a.userId),ir(a.id);try{return{data:await he(this.fetch,"DELETE",`${this.url}/admin/users/${a.userId}/factors/${a.id}`,{headers:this.headers}),error:null}}catch(r){if(le(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 he(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:Pg});if(v.error)throw v.error;const x=await v.json(),_=(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 E=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);g[`${k}Page`]=E}),g.total=parseInt(_)),{data:Object.assign(Object.assign({},x),g),error:null}}catch(g){if(le(g))return{data:{clients:[]},error:g};throw g}}async _createOAuthClient(a){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:a,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}async _getOAuthClient(a){try{return await he(this.fetch,"GET",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}async _updateOAuthClient(a,r){try{return await he(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${a}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(le(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(a){try{return await he(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(le(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(a){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients/${a}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}}function Kg(n={}){return{getItem:a=>n[a]||null,setItem:(a,r)=>{n[a]=r},removeItem:a=>{delete n[a]}}}const lr={debug:!!(globalThis&&Xy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Zy extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class PS extends Zy{}async function KS(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 PS(`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 YS(){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 Fy(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function JS(n){return parseInt(n,16)}function XS(n){const a=new TextEncoder().encode(n);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function QS(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:x,version:_}=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(!x)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(_!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${_}`);if(!((a=n.statement)===null||a===void 0)&&a.includes(`
36
36
  `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const S=Fy(n.address),A=v?`${v}://${l}`:l,E=n.statement?`${n.statement}
37
37
  `:"",k=`${A} wants you to sign in with your Ethereum account:
38
38
  ${S}
@@ -45,15 +45,15 @@ Issued At: ${d.toISOString()}`;if(c&&(O+=`
45
45
  Expiration Time: ${c.toISOString()}`),m&&(O+=`
46
46
  Not Before: ${m.toISOString()}`),p&&(O+=`
47
47
  Request ID: ${p}`),g){let q=`
48
- Resources:`;for(const L of g){if(!L||typeof L!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${L}`);q+=`
49
- - ${L}`}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 Ro extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function ZS({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(Wy(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 FS({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(Wy(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 WS{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 ej=new WS;function tj(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=Er(n,["challenge","user","excludeCredentials"]),d=yr(a).buffer,h=Object.assign(Object.assign({},r),{id:yr(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:yr(g.id).buffer,type:g.type||"public-key",transports:g.transports})}}return m}function aj(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=Er(n,["challenge","allowCredentials"]),c=yr(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:yr(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function nj(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 sj(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 Wy(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function Yg(){var n,a;return!!(jt()&&"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 rj(n){try{const a=await navigator.credentials.create(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Ro("Browser returned unexpected credential type",a)}:{data:null,error:new Ro("Empty credential response",a)}}catch(a){return{data:null,error:ZS({error:a,options:n})}}}async function ij(n){try{const a=await navigator.credentials.get(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Ro("Browser returned unexpected credential type",a)}:{data:null,error:new Ro("Empty credential response",a)}}catch(a){return{data:null,error:FS({error:a,options:n})}}}const lj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},oj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Do(...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]=Do(m,h):l[d]=Do(h)}else l[d]=h}return l}function cj(n,a){return Do(lj,n,a||{})}function uj(n,a){return Do(oj,n,a||{})}class dj{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??ej.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=cj(h.webauthn.credential_options.publicKey,d?.create),{data:v,error:x}=await rj({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:x}}case"request":{const g=uj(h.webauthn.credential_options.publicKey,d?.request),{data:v,error:x}=await ij(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:x}}}}catch(h){return le(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 Oi("rpId is required for WebAuthn authentication")};try{if(!Yg())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 le(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 Oi("rpId is required for WebAuthn registration")};try{if(!Yg())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 x;return(x=v.data)===null||x===void 0?void 0:x.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===a&&_.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 le(h)?{data:null,error:h}:{data:null,error:new as("Unexpected error in register",h)}}}}YS();const fj={url:lS,storageKey:oS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:cS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Jg(n,a,r){return await r()}const lr={};class Ri{get jwks(){var a,r;return(r=(a=lr[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){lr[this.storageKey]=Object.assign(Object.assign({},lr[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=lr[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){lr[this.storageKey]=Object.assign(Object.assign({},lr[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({},fj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Ri.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Ri.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&jt()){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 GS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Qy(d.fetch),this.lock=d.lock||Jg,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&&jt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=KS:this.lock=Jg,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 dj(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:Xy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Kg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Kg(this.memoryStorage)),jt()&&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} (${Ky}) ${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(jt()&&(r=jS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),jt()&&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),pS(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 le(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 he(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(le(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:x,options:_}=a;let S=null,A=null;this.flowType==="pkce"&&([S,A]=await sr(this.storage,this.storageKey)),d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_?.emailRedirectTo,body:{email:v,password:x,data:(r=_?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:_?.captchaToken},code_challenge:S,code_challenge_method:A},xform:ua})}else if("phone"in a){const{phone:v,password:x,options:_}=a;d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:x,data:(l=_?.data)!==null&&l!==void 0?l:{},channel:(c=_?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:_?.captchaToken}},xform:ua})}else throw new mo("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await St(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 St(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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:Gg})}else if("phone"in a){const{phone:d,password:h,options:m}=a;r=await he(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:Gg})}else throw new mo("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 nr;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(le(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:E,wallet:k,statement:O,options:q}=a;let L;if(jt())if(typeof k=="object")L=k;else{const fe=window;if("ethereum"in fe&&typeof fe.ethereum=="object"&&"request"in fe.ethereum&&typeof fe.ethereum.request=="function")L=fe.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.");L=k}const P=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),W=await L.request({method:"eth_requestAccounts"}).then(fe=>fe).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!W||W.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const Q=Fy(W[0]);let Y=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!Y){const fe=await L.request({method:"eth_chainId"});Y=JS(fe)}const J={domain:P.host,address:Q,statement:O,uri:P.href,version:"1",chainId:Y,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=QS(J),A=await L.request({method:"personal_sign",params:[XS(S),Q]})}try{const{data:E,error:k}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:A},!((x=a.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(_=a.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:ua});if(k)throw k;if(!E||!E.session||!E.user){const O=new nr;return this._returnResult({data:{user:null,session:null},error:O})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:k})}catch(E){if(le(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async signInWithSolana(a){var r,l,c,d,h,m,p,g,v,x,_,S;let A,E;if("message"in a)A=a.message,E=a.signature;else{const{chain:k,wallet:O,statement:q,options:L}=a;let P;if(jt())if(typeof O=="object")P=O;else{const Q=window;if("solana"in Q&&typeof Q.solana=="object"&&("signIn"in Q.solana&&typeof Q.solana.signIn=="function"||"signMessage"in Q.solana&&typeof Q.solana.signMessage=="function"))P=Q.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"||!L?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=O}const W=new URL((r=L?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in P&&P.signIn){const Q=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},L?.signInWithSolana),{version:"1",domain:W.host,uri:W.href}),q?{statement:q}:null));let Y;if(Array.isArray(Q)&&Q[0]&&typeof Q[0]=="object")Y=Q[0];else if(Q&&typeof Q=="object"&&"signedMessage"in Q&&"signature"in Q)Y=Q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in Y&&"signature"in Y&&(typeof Y.signedMessage=="string"||Y.signedMessage instanceof Uint8Array)&&Y.signature instanceof Uint8Array)A=typeof Y.signedMessage=="string"?Y.signedMessage:new TextDecoder().decode(Y.signedMessage),E=Y.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");A=[`${W.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${W.href}`,`Issued At: ${(c=(l=L?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=L?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${L.signInWithSolana.notBefore}`]:[],...!((h=L?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${L.signInWithSolana.expirationTime}`]:[],...!((m=L?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${L.signInWithSolana.chainId}`]:[],...!((p=L?.signInWithSolana)===null||p===void 0)&&p.nonce?[`Nonce: ${L.signInWithSolana.nonce}`]:[],...!((g=L?.signInWithSolana)===null||g===void 0)&&g.requestId?[`Request ID: ${L.signInWithSolana.requestId}`]:[],...!((x=(v=L?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||x===void 0)&&x.length?["Resources",...L.signInWithSolana.resources.map(Y=>`- ${Y}`)]:[]].join(`
51
- `);const Q=await P.signMessage(new TextEncoder().encode(A),"utf8");if(!Q||!(Q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");E=Q}}try{const{data:k,error:O}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:A,signature:ns(E)},!((_=a.options)===null||_===void 0)&&_.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 nr;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(le(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 gS;const{data:d,error:h}=await he(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:l},xform:ua});if(await St(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new nr;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 St(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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 nr;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(le(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 sr(this.storage,this.storageKey));const{error:x}=await he(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:x})}if("phone"in a){const{phone:m,options:p}=a,{data:g,error:v}=await he(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 mo("You must provide either an email or phone number.")}catch(m){if(await St(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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(le(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 sr(this.storage,this.storageKey));const g=await he(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:HS});return!((d=g.data)===null||d===void 0)&&d.url&&jt()&&!(!((h=a.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(g.data.url),this._returnResult(g)}catch(m){if(await St(this.storage,`${this.storageKey}-code-verifier`),le(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 Kt;const{error:c}=await he(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(le(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 he(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 he(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 mo("You must provide either an email or phone number and a type")}catch(r){if(le(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()<bd:!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=_d()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=LS(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 he(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 Kt}:await he(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(le(r))return mS(r)&&(await this._removeSession(),await St(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 Kt;const h=c.session;let m=null,p=null;this.flowType==="pkce"&&a.email!=null&&([m,p]=await sr(this.storage,this.storageKey));const{data:g,error:v}=await he(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 St(this.storage,`${this.storageKey}-code-verifier`),le(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 Kt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=wd(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(le(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 Kt;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(le(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(a,r){try{if(!jt())throw new po("No browser detected.");if(a.error||a.error_description||a.error_code)throw new po(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 Lg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new po("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 Lg("No code detected.");const{data:q,error:L}=await this._exchangeCodeForSession(a.code);if(L)throw L;const P=new URL(window.location.href);return P.searchParams.delete("code"),window.history.replaceState(window.history.state,"",P.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 po("No session defined in URL");const v=Math.round(Date.now()/1e3),x=parseInt(m);let _=v+x;p&&(_=parseInt(p));const S=_-v;S*1e3<=fr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${x}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,_,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,_,v);const{data:E,error:k}=await this._getUser(d);if(k)throw k;const O={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:x,expires_at:_,refresh_token:h,token_type:g,user:E.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(le(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&&!(hS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await St(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=SS(),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 sr(this.storage,this.storageKey,!0));try{return await he(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 St(this.storage,`${this.storageKey}-code-verifier`),le(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(le(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:x,error:_}=d;if(_)throw _;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 he(this.fetch,"GET",S,{headers:this.headers,jwt:(v=(g=x.session)===null||g===void 0?void 0:g.access_token)!==null&&v!==void 0?v:void 0})});if(c)throw c;return jt()&&!(!((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(le(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,x=await he(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:_,error:S}=x;return S?this._returnResult({data:{user:null,session:null},error:S}):!_||!_.session||!_.user?this._returnResult({data:{user:null,session:null},error:new nr}):(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),this._returnResult({data:_,error:S}))}catch(c){if(await St(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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(le(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 TS(async c=>(c>0&&await NS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await he(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&&xd(d)&&Date.now()+h-l<fr})}catch(l){if(this._debug(r,"error",l),le(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),jt()&&!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 hr(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:_d()}else if(c&&!c.user&&!c.user){const h=await Wn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await St(this.storage,this.storageKey+"-user"),await hr(this.storage,this.storageKey,c)):c.user=_d()}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()<bd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${bd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),xd(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 Kt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const c=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(c,"begin");try{this.refreshingDeferred=new qo;const{data:d,error:h}=await this._refreshAccessToken(a);if(h)throw h;if(!d.session)throw new Kt;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),le(d)){const h={data:null,error:d};return xd(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 St(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 hr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Vg(c);await hr(this.storage,this.storageKey,d)}else{const c=Vg(r);await hr(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await St(this.storage,this.storageKey),await St(this.storage,this.storageKey+"-code-verifier"),await St(this.storage,this.storageKey+"-user"),this.userStorage&&await St(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&jt()&&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(),fr);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)/fr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${fr}ms, refresh threshold is ${Gd} ticks`),c<=Gd&&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 Zy)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!jt()||!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 sr(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 he(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(le(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 he(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(le(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"?nj(a.webauthn.credential_response):sj(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:p}=await he(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(le(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 he(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:tj(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:aj(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(le(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}=wd(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 he(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 Kt})})}catch(r){if(le(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 Kt});const h=await he(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&&jt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(le(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 Kt});const h=await he(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&&jt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(le(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 he(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 Kt})})}catch(a){if(le(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 he(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 Kt})})}catch(r){if(le(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+dS>c)return l;const{data:d,error:h}=await he(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}}=wd(l);r?.allowExpired||MS(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=zS(c.alg),x=await crypto.subtle.importKey("jwk",g,v,!0,["verify"]);if(!await crypto.subtle.verify(v,x,h,wS(`${m}.${p}`)))throw new Yd("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(le(l))return this._returnResult({data:null,error:l});throw l}}}Ri.nextInstanceID={};const hj=Ri,mj="2.90.1";let Si="";typeof Deno<"u"?Si="deno":typeof document<"u"?Si="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Si="react-native":Si="node";const pj={"X-Client-Info":`supabase-js-${Si}/${mj}`},gj={headers:pj},yj={schema:"public"},vj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},bj={};function Di(n){"@babel/helpers - typeof";return Di=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},Di(n)}function xj(n,a){if(Di(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(Di(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function wj(n){var a=xj(n,"string");return Di(a)=="symbol"?a:a+""}function _j(n,a,r){return(a=wj(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function Xg(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 We(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Xg(Object(r),!0).forEach(function(l){_j(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Xg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const Sj=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),jj=()=>Headers,Ej=(n,a,r)=>{const l=Sj(r),c=jj();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,We(We({},h),{},{headers:g}))}};function Nj(n){return n.endsWith("/")?n:n+"/"}function Tj(n,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=n,{db:p,auth:g,realtime:v,global:x}=a,_={db:We(We({},p),c),auth:We(We({},g),d),realtime:We(We({},v),h),storage:{},global:We(We(We({},x),m),{},{headers:We(We({},(r=x?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return n.accessToken?_.accessToken=n.accessToken:delete _.accessToken,_}function Aj(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(Nj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Cj=class extends hj{constructor(n){super(n)}},kj=class{constructor(n,a,r){var l,c;this.supabaseUrl=n,this.supabaseKey=a;const d=Aj(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:yj,realtime:bj,auth:We(We({},vj),{},{storageKey:h}),global:gj},p=Tj(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,x)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(x)} 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=Ej(a,this._getAccessToken.bind(this),p.global.fetch),this.realtime=this._initRealtimeClient(We({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 c1(new URL("rest/v1",d).href,{headers:this.headers,schema:p.db.schema,fetch:this.fetch}),this.storage=new iS(this.storageUrl.href,this.headers,this.fetch,r?.storage),p.accessToken||this._listenForAuthEvents()}get functions(){return new s1(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,x){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Cj({url:this.authUrl.href,headers:We(We({},_),v),storageKey:d,autoRefreshToken:n,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:p,throwOnError:g,fetch:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new N1(this.realtimeUrl.href,We(We({},n),{},{params:We(We({},{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 Qg=(n,a,r)=>new kj(n,a,r);function Oj(){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}Oj()&&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 $o="email_automator_supabase_config";function Nr(){try{const n=localStorage.getItem($o);if(n)return JSON.parse(n)}catch(n){console.error("Error reading Supabase config:",n)}return null}function Rj(n){try{localStorage.setItem($o,JSON.stringify(n))}catch(a){console.error("Error saving Supabase config:",a)}}function Dj(){try{localStorage.removeItem($o)}catch(n){console.error("Error clearing Supabase config:",n)}}async function ev(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 Mj(){return localStorage.getItem($o)?"ui":"none"}function zj(){const n=Nr();return!n||!n.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Qg("https://placeholder.supabase.co","placeholder-key")):Qg(n.url,n.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=zj();function Zg(){const n=Nr(),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 Uj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=Zg();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=Zg(),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),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 He=new Uj;async function tv(n){He.setSupabaseClient(n);const{data:{session:a}}=await n.auth.getSession();a?.access_token&&He.setToken(a.access_token),n.auth.onAuthStateChange((r,l)=>{He.setToken(l?.access_token||null)})}const Lj=Object.freeze(Object.defineProperty({__proto__:null,api:He,initializeApi:tv},Symbol.toStringTag,{value:"Module"}));function Ja(n,a){return n?typeof n=="string"?n:n.message||a:a}const av={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};function Bj(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};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{...av,isLoading:!1,isInitialized:!0};default:return n}}const nv=w.createContext(null);function qj({children:n}){const[a,r]=w.useReducer(Bj,av);w.useEffect(()=>{async function c(){if(!Nr()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:h}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(h&&h.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await tv(ct);const{data:{session:m}}=await ct.auth.getSession();r({type:"SET_USER",payload:m?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:p}}=ct.auth.onAuthStateChange((g,v)=>{r({type:"SET_USER",payload:v?.user||null}),v||r({type:"CLEAR_DATA"})});return()=>p.unsubscribe()}catch(h){console.error("[AppContext] Init error:",h),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}c()},[]);const l={fetchEmails:async(c={})=>{const d=await He.getEmails({limit:20,offset:c.offset||0,category:c.category,search:c.search});d.data&&r({type:"SET_EMAILS",payload:{emails:d.data.emails,total:d.data.total,offset:c.offset||0}})},fetchAccounts:async()=>{const c=await He.getAccounts();c.data&&r({type:"SET_ACCOUNTS",payload:c.data.accounts})},fetchRules:async()=>{const c=await He.getRules();c.data&&r({type:"SET_RULES",payload:c.data.rules})},fetchSettings:async()=>{const c=await He.getSettings();c.data&&r({type:"SET_SETTINGS",payload:c.data.settings})},fetchProfile:async()=>{const c=await He.getProfile();c.data&&r({type:"SET_PROFILE",payload:c.data})},fetchStats:async()=>{const c=await He.getStats();c.data&&r({type:"SET_STATS",payload:c.data.stats})},executeAction:async(c,d,h)=>{const m=await He.executeAction(c,d,h);if(m.data?.success){const p=a.emails.find(g=>g.id===c);return p&&r({type:"UPDATE_EMAIL",payload:{...p,action_taken:d}}),!0}return r({type:"SET_ERROR",payload:Ja(m.error,"Action failed")}),!1},triggerSync:async c=>{const d=c?await He.triggerSync(c):await He.syncAll();return await l.fetchAccounts(),d.error?(r({type:"SET_ERROR",payload:Ja(d.error,"Sync failed")}),!1):!0},disconnectAccount:async c=>{const d=await He.disconnectAccount(c);return d.data?.success?(r({type:"REMOVE_ACCOUNT",payload:c}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to disconnect")}),!1)},updateSettings:async c=>{const d=await He.updateSettings(c);return d.data?(r({type:"SET_SETTINGS",payload:d.data.settings}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to update settings")}),!1)},updateProfile:async c=>{const d=await He.updateProfile(c);return d.data?(r({type:"UPDATE_PROFILE",payload:d.data}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to update profile")}),!1)},updateAccount:async(c,d)=>{const h=await He.updateAccount(c,d);return h.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(m=>m.id===c?{...m,...d}:m)}),!0):(r({type:"SET_ERROR",payload:Ja(h.error,"Failed to update account")}),!1)},createRule:async c=>{const d=await He.createRule(c);return d.data?(r({type:"ADD_RULE",payload:d.data.rule}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to create rule")}),!1)},deleteRule:async c=>{const d=await He.deleteRule(c);return d.data?.success?(r({type:"REMOVE_RULE",payload:c}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to delete rule")}),!1)},toggleRule:async c=>{const d=await He.toggleRule(c);return d.data?(r({type:"UPDATE_RULE",payload:d.data.rule}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to toggle rule")}),!1)}};return o.jsx(nv.Provider,{value:{state:a,dispatch:r,actions:l},children:n})}function Tr(){const n=w.useContext(nv);if(!n)throw new Error("useApp must be used within AppProvider");return n}const $j=w.createContext(void 0);function Hj({children:n,value:a}){return o.jsx($j.Provider,{value:a,children:n})}const sv=w.createContext(null);function Vj({children:n}){const[a,r]=w.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(sv.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:n})}function rv(){const n=w.useContext(sv);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:ke("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:ke("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:ke("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:ke("text-sm text-muted-foreground",n),...a}));Za.displayName="CardDescription";const ja=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("p-6 pt-0",n),...a}));ja.displayName="CardContent";const iv=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("flex items-center p-6 pt-0",n),...a}));iv.displayName="CardFooter";class Ij 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(_r,{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(F,{onClick:this.handleReset,variant:"outline",children:[o.jsx(wr,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(F,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}let Mi=[],Jd=new Set;function lv(){Jd.forEach(n=>n())}const ne={success:(n,a)=>go("success",n,a),error:(n,a)=>go("error",n,a),info:(n,a)=>go("info",n,a),warning:(n,a)=>go("warning",n,a)};function go(n,a,r=5e3){const l=Math.random().toString(36).substr(2,9);Mi=[...Mi,{id:l,type:n,message:a,duration:r}],lv(),r>0&&setTimeout(()=>ov(l),r)}function ov(n){Mi=Mi.filter(a=>a.id!==n),lv()}function Gj(){const[,n]=w.useState(0);return w.useEffect(()=>{const a=()=>n(r=>r+1);return Jd.add(a),()=>{Jd.delete(a)}},[]),Mi}const Pj={success:tf,error:qi,info:xr,warning:_r},Kj={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 Yj({toast:n}){const a=Pj[n.type];return o.jsxs("div",{className:ke("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-right-full duration-300",Kj[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:()=>ov(n.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(Uo,{className:"w-4 h-4"})})]})}function Jj(){const n=Gj();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(Yj,{toast:a},a.id))})}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:ke("flex flex-col items-center justify-center gap-3",a),children:[o.jsx(ra,{className:ke("animate-spin text-primary",l[n])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function Ni({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 Xj(){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 Qj(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 Zj(n,a=[]){let r=[];function l(d,h){const m=w.createContext(h),p=r.length;r=[...r,h];const g=x=>{const{scope:_,children:S,...A}=x,E=_?.[n]?.[p]||m,k=w.useMemo(()=>A,Object.values(A));return o.jsx(E.Provider,{value:k,children:S})};g.displayName=d+"Provider";function v(x,_){const S=_?.[n]?.[p]||m,A=w.useContext(S);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${x}\` 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,Fj(c,...a)]}function Fj(...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 x=p(d)[`__scope${g}`];return{...m,...x}},{});return w.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var zi=globalThis?.document?w.useLayoutEffect:()=>{},Wj=Wd[" useId ".trim().toString()]||(()=>{}),eE=0;function jd(n){const[a,r]=w.useState(Wj());return zi(()=>{r(l=>l??String(eE++))},[n]),n||(a?`radix-${a}`:"")}var tE=Wd[" useInsertionEffect ".trim().toString()]||zi;function aE({prop:n,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=nE({defaultProp:a,onChange:r}),m=n!==void 0,p=m?n:c;{const v=w.useRef(n!==void 0);w.useEffect(()=>{const x=v.current;x!==m&&console.warn(`${l} is changing from ${x?"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 x=sE(v)?v(n):v;x!==n&&h.current?.(x)}else d(v)},[m,n,d,h]);return[p,g]}function nE({defaultProp:n,onChange:a}){const[r,l]=w.useState(n),c=w.useRef(r),d=w.useRef(a);return tE(()=>{d.current=a},[a]),w.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function sE(n){return typeof n=="function"}var cv=hy();const rE=Zd(cv);function iE(n){const a=lE(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(cE);if(p){const g=p.props.children,v=m.map(x=>x===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:x);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 lE(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=dE(c),m=uE(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Lo(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 oE=Symbol("radix.slottable");function cE(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===oE}function uE(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 dE(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 fE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wa=fE.reduce((n,a)=>{const r=iE(`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 hE(n,a){n&&cv.flushSync(()=>n.dispatchEvent(a))}function Ui(n){const a=w.useRef(n);return w.useEffect(()=>{a.current=n}),w.useMemo(()=>(...r)=>a.current?.(...r),[])}function mE(n,a=globalThis?.document){const r=Ui(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 pE="DismissableLayer",Xd="dismissableLayer.update",gE="dismissableLayer.pointerDownOutside",yE="dismissableLayer.focusOutside",Fg,uv=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dv=w.forwardRef((n,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...p}=n,g=w.useContext(uv),[v,x]=w.useState(null),_=v?.ownerDocument??globalThis?.document,[,S]=w.useState({}),A=ls(a,Y=>x(Y)),E=Array.from(g.layers),[k]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),O=E.indexOf(k),q=v?E.indexOf(v):-1,L=g.layersWithOutsidePointerEventsDisabled.size>0,P=q>=O,W=xE(Y=>{const J=Y.target,fe=[...g.branches].some(Ie=>Ie.contains(J));!P||fe||(c?.(Y),h?.(Y),Y.defaultPrevented||m?.())},_),Q=wE(Y=>{const J=Y.target;[...g.branches].some(Ie=>Ie.contains(J))||(d?.(Y),h?.(Y),Y.defaultPrevented||m?.())},_);return mE(Y=>{q===g.layers.size-1&&(l?.(Y),!Y.defaultPrevented&&m&&(Y.preventDefault(),m()))},_),w.useEffect(()=>{if(v)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Fg=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),Wg(),()=>{r&&g.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=Fg)}},[v,_,r,g]),w.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),Wg())},[v,g]),w.useEffect(()=>{const Y=()=>S({});return document.addEventListener(Xd,Y),()=>document.removeEventListener(Xd,Y)},[]),o.jsx(Wa.div,{...p,ref:A,style:{pointerEvents:L?P?"auto":"none":void 0,...n.style},onFocusCapture:On(n.onFocusCapture,Q.onFocusCapture),onBlurCapture:On(n.onBlurCapture,Q.onBlurCapture),onPointerDownCapture:On(n.onPointerDownCapture,W.onPointerDownCapture)})});dv.displayName=pE;var vE="DismissableLayerBranch",bE=w.forwardRef((n,a)=>{const r=w.useContext(uv),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})});bE.displayName=vE;function xE(n,a=globalThis?.document){const r=Ui(n),l=w.useRef(!1),c=w.useRef(()=>{});return w.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let p=function(){fv(gE,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 wE(n,a=globalThis?.document){const r=Ui(n),l=w.useRef(!1);return w.useEffect(()=>{const c=d=>{d.target&&!l.current&&fv(yE,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 Wg(){const n=new CustomEvent(Xd);document.dispatchEvent(n)}function fv(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?hE(c,d):c.dispatchEvent(d)}var Ed="focusScope.autoFocusOnMount",Nd="focusScope.autoFocusOnUnmount",ey={bubbles:!1,cancelable:!0},_E="FocusScope",hv=w.forwardRef((n,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=n,[m,p]=w.useState(null),g=Ui(c),v=Ui(d),x=w.useRef(null),_=ls(a,E=>p(E)),S=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(l){let E=function(L){if(S.paused||!m)return;const P=L.target;m.contains(P)?x.current=P:An(x.current,{select:!0})},k=function(L){if(S.paused||!m)return;const P=L.relatedTarget;P!==null&&(m.contains(P)||An(x.current,{select:!0}))},O=function(L){if(document.activeElement===document.body)for(const W of L)W.removedNodes.length>0&&An(m)};document.addEventListener("focusin",E),document.addEventListener("focusout",k);const q=new MutationObserver(O);return m&&q.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",k),q.disconnect()}}},[l,m,S.paused]),w.useEffect(()=>{if(m){ay.add(S);const E=document.activeElement;if(!m.contains(E)){const O=new CustomEvent(Ed,ey);m.addEventListener(Ed,g),m.dispatchEvent(O),O.defaultPrevented||(SE(AE(mv(m)),{select:!0}),document.activeElement===E&&An(m))}return()=>{m.removeEventListener(Ed,g),setTimeout(()=>{const O=new CustomEvent(Nd,ey);m.addEventListener(Nd,v),m.dispatchEvent(O),O.defaultPrevented||An(E??document.body,{select:!0}),m.removeEventListener(Nd,v),ay.remove(S)},0)}}},[m,g,v,S]);const A=w.useCallback(E=>{if(!r&&!l||S.paused)return;const k=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,O=document.activeElement;if(k&&O){const q=E.currentTarget,[L,P]=jE(q);L&&P?!E.shiftKey&&O===P?(E.preventDefault(),r&&An(L,{select:!0})):E.shiftKey&&O===L&&(E.preventDefault(),r&&An(P,{select:!0})):O===q&&E.preventDefault()}},[r,l,S.paused]);return o.jsx(Wa.div,{tabIndex:-1,...h,ref:_,onKeyDown:A})});hv.displayName=_E;function SE(n,{select:a=!1}={}){const r=document.activeElement;for(const l of n)if(An(l,{select:a}),document.activeElement!==r)return}function jE(n){const a=mv(n),r=ty(a,n),l=ty(a.reverse(),n);return[r,l]}function mv(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 ty(n,a){for(const r of n)if(!EE(r,{upTo:a}))return r}function EE(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 NE(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&&NE(n)&&a&&n.select()}}var ay=TE();function TE(){let n=[];return{add(a){const r=n[0];a!==r&&r?.pause(),n=ny(n,a),n.unshift(a)},remove(a){n=ny(n,a),n[0]?.resume()}}}function ny(n,a){const r=[...n],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function AE(n){return n.filter(a=>a.tagName!=="A")}var CE="Portal",pv=w.forwardRef((n,a)=>{const{container:r,...l}=n,[c,d]=w.useState(!1);zi(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?rE.createPortal(o.jsx(Wa.div,{...l,ref:a}),h):null});pv.displayName=CE;function kE(n,a){return w.useReducer((r,l)=>a[r][l]??r,n)}var Ho=n=>{const{present:a,children:r}=n,l=OE(a),c=typeof r=="function"?r({present:l.isPresent}):w.Children.only(r),d=ls(l.ref,RE(c));return typeof r=="function"||l.isPresent?w.cloneElement(c,{ref:d}):null};Ho.displayName="Presence";function OE(n){const[a,r]=w.useState(),l=w.useRef(null),c=w.useRef(n),d=w.useRef("none"),h=n?"mounted":"unmounted",[m,p]=kE(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const g=yo(l.current);d.current=m==="mounted"?g:"none"},[m]),zi(()=>{const g=l.current,v=c.current;if(v!==n){const _=d.current,S=yo(g);n?p("MOUNT"):S==="none"||g?.display==="none"?p("UNMOUNT"):p(v&&_!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,p]),zi(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,x=S=>{const E=yo(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&E&&(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)})}},_=S=>{S.target===a&&(d.current=yo(l.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",x),a.addEventListener("animationend",x),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",x),a.removeEventListener("animationend",x)}}else p("ANIMATION_END")},[a,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:w.useCallback(g=>{l.current=g?getComputedStyle(g):null,r(g)},[])}}function yo(n){return n?.animationName||"none"}function RE(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 Td=0;function DE(){w.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??sy()),document.body.insertAdjacentElement("beforeend",n[1]??sy()),Td++,()=>{Td===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Td--}},[])}function sy(){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 jo="right-scroll-bar-position",Eo="width-before-scroll-bar",ME="with-scroll-bars-hidden",zE="--removed-body-scroll-bar-size";function Ad(n,a){return typeof n=="function"?n(a):n&&(n.current=a),n}function UE(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 LE=typeof window<"u"?w.useLayoutEffect:w.useEffect,ry=new WeakMap;function BE(n,a){var r=UE(null,function(l){return n.forEach(function(c){return Ad(c,l)})});return LE(function(){var l=ry.get(r);if(l){var c=new Set(l),d=new Set(n),h=r.current;c.forEach(function(m){d.has(m)||Ad(m,null)}),d.forEach(function(m){c.has(m)||Ad(m,h)})}ry.set(r,n)},[n]),r}function qE(n){return n}function $E(n,a){a===void 0&&(a=qE);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 HE(n){n===void 0&&(n={});var a=$E(null);return a.options=wa({async:!0,ssr:!1},n),a}var gv=function(n){var a=n.sideCar,r=Er(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))};gv.isSideCarExport=!0;function VE(n,a){return n.useMedium(a),gv}var yv=HE(),Cd=function(){},Vo=w.forwardRef(function(n,a){var r=w.useRef(null),l=w.useState({onScrollCapture:Cd,onWheelCapture:Cd,onTouchMoveCapture:Cd}),c=l[0],d=l[1],h=n.forwardProps,m=n.children,p=n.className,g=n.removeScrollBar,v=n.enabled,x=n.shards,_=n.sideCar,S=n.noRelative,A=n.noIsolation,E=n.inert,k=n.allowPinchZoom,O=n.as,q=O===void 0?"div":O,L=n.gapMode,P=Er(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),W=_,Q=BE([r,a]),Y=wa(wa({},P),c);return w.createElement(w.Fragment,null,v&&w.createElement(W,{sideCar:yv,removeScrollBar:g,shards:x,noRelative:S,noIsolation:A,inert:E,setCallbacks:d,allowPinchZoom:!!k,lockRef:r,gapMode:L}),h?w.cloneElement(w.Children.only(m),wa(wa({},Y),{ref:Q})):w.createElement(q,wa({},Y,{className:p,ref:Q}),m))});Vo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Vo.classNames={fullWidth:Eo,zeroRight:jo};var IE=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function GE(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var a=IE();return a&&n.setAttribute("nonce",a),n}function PE(n,a){n.styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a))}function KE(n){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(n)}var YE=function(){var n=0,a=null;return{add:function(r){n==0&&(a=GE())&&(PE(a,r),KE(a)),n++},remove:function(){n--,!n&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},JE=function(){var n=YE();return function(a,r){w.useEffect(function(){return n.add(a),function(){n.remove()}},[a&&r])}},vv=function(){var n=JE(),a=function(r){var l=r.styles,c=r.dynamic;return n(l,c),null};return a},XE={left:0,top:0,right:0,gap:0},kd=function(n){return parseInt(n||"",10)||0},QE=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[kd(r),kd(l),kd(c)]},ZE=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return XE;var a=QE(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])}},FE=vv(),vr="data-scroll-locked",WE=function(n,a,r,l){var c=n.left,d=n.top,h=n.right,m=n.gap;return r===void 0&&(r="margin"),`
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 Ro extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function ZS({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(Wy(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 FS({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(Wy(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 WS{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 ej=new WS;function tj(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=Nr(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 aj(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=Nr(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 nj(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 sj(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 Wy(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function Yg(){var n,a;return!!(Et()&&"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 rj(n){try{const a=await navigator.credentials.create(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Ro("Browser returned unexpected credential type",a)}:{data:null,error:new Ro("Empty credential response",a)}}catch(a){return{data:null,error:ZS({error:a,options:n})}}}async function ij(n){try{const a=await navigator.credentials.get(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Ro("Browser returned unexpected credential type",a)}:{data:null,error:new Ro("Empty credential response",a)}}catch(a){return{data:null,error:FS({error:a,options:n})}}}const lj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},oj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Do(...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]=Do(m,h):l[d]=Do(h)}else l[d]=h}return l}function cj(n,a){return Do(lj,n,a||{})}function uj(n,a){return Do(oj,n,a||{})}class dj{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??ej.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=cj(h.webauthn.credential_options.publicKey,d?.create),{data:v,error:x}=await rj({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:x}}case"request":{const g=uj(h.webauthn.credential_options.publicKey,d?.request),{data:v,error:x}=await ij(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:x}}}}catch(h){return le(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 Ri("rpId is required for WebAuthn authentication")};try{if(!Yg())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 le(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 Ri("rpId is required for WebAuthn registration")};try{if(!Yg())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 x;return(x=v.data)===null||x===void 0?void 0:x.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===a&&_.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 le(h)?{data:null,error:h}:{data:null,error:new as("Unexpected error in register",h)}}}}YS();const fj={url:lS,storageKey:oS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:cS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Jg(n,a,r){return await r()}const or={};class Di{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({},fj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Di.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Di.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Et()){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 GS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Qy(d.fetch),this.lock=d.lock||Jg,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&&Et()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=KS:this.lock=Jg,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 dj(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:Xy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Kg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Kg(this.memoryStorage)),Et()&&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} (${Ky}) ${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(Et()&&(r=jS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Et()&&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),pS(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 le(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 he(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(le(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:x,options:_}=a;let S=null,A=null;this.flowType==="pkce"&&([S,A]=await rr(this.storage,this.storageKey)),d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_?.emailRedirectTo,body:{email:v,password:x,data:(r=_?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:_?.captchaToken},code_challenge:S,code_challenge_method:A},xform:ua})}else if("phone"in a){const{phone:v,password:x,options:_}=a;d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:x,data:(l=_?.data)!==null&&l!==void 0?l:{},channel:(c=_?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:_?.captchaToken}},xform:ua})}else throw new mo("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`),le(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 he(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:Gg})}else if("phone"in a){const{phone:d,password:h,options:m}=a;r=await he(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:Gg})}else throw new mo("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(le(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:E,wallet:k,statement:O,options:q}=a;let B;if(Et())if(typeof k=="object")B=k;else{const fe=window;if("ethereum"in fe&&typeof fe.ethereum=="object"&&"request"in fe.ethereum&&typeof fe.ethereum.request=="function")B=fe.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 P=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),W=await B.request({method:"eth_requestAccounts"}).then(fe=>fe).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!W||W.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const Q=Fy(W[0]);let Y=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!Y){const fe=await B.request({method:"eth_chainId"});Y=JS(fe)}const J={domain:P.host,address:Q,statement:O,uri:P.href,version:"1",chainId:Y,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=QS(J),A=await B.request({method:"personal_sign",params:[XS(S),Q]})}try{const{data:E,error:k}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:A},!((x=a.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(_=a.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:ua});if(k)throw k;if(!E||!E.session||!E.user){const O=new sr;return this._returnResult({data:{user:null,session:null},error:O})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:k})}catch(E){if(le(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async signInWithSolana(a){var r,l,c,d,h,m,p,g,v,x,_,S;let A,E;if("message"in a)A=a.message,E=a.signature;else{const{chain:k,wallet:O,statement:q,options:B}=a;let P;if(Et())if(typeof O=="object")P=O;else{const Q=window;if("solana"in Q&&typeof Q.solana=="object"&&("signIn"in Q.solana&&typeof Q.solana.signIn=="function"||"signMessage"in Q.solana&&typeof Q.solana.signMessage=="function"))P=Q.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.");P=O}const W=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in P&&P.signIn){const Q=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},B?.signInWithSolana),{version:"1",domain:W.host,uri:W.href}),q?{statement:q}:null));let Y;if(Array.isArray(Q)&&Q[0]&&typeof Q[0]=="object")Y=Q[0];else if(Q&&typeof Q=="object"&&"signedMessage"in Q&&"signature"in Q)Y=Q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in Y&&"signature"in Y&&(typeof Y.signedMessage=="string"||Y.signedMessage instanceof Uint8Array)&&Y.signature instanceof Uint8Array)A=typeof Y.signedMessage=="string"?Y.signedMessage:new TextDecoder().decode(Y.signedMessage),E=Y.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");A=[`${W.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${W.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}`]:[],...!((x=(v=B?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||x===void 0)&&x.length?["Resources",...B.signInWithSolana.resources.map(Y=>`- ${Y}`)]:[]].join(`
51
+ `);const Q=await P.signMessage(new TextEncoder().encode(A),"utf8");if(!Q||!(Q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");E=Q}}try{const{data:k,error:O}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:A,signature:ns(E)},!((_=a.options)===null||_===void 0)&&_.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(le(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 gS;const{data:d,error:h}=await he(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`),le(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 he(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(le(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:x}=await he(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:x})}if("phone"in a){const{phone:m,options:p}=a,{data:g,error:v}=await he(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 mo("You must provide either an email or phone number.")}catch(m){if(await jt(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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(le(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 he(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:HS});return!((d=g.data)===null||d===void 0)&&d.url&&Et()&&!(!((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`),le(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 Kt;const{error:c}=await he(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(le(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 he(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 he(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 mo("You must provide either an email or phone number and a type")}catch(r){if(le(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()<bd:!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=_d()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=LS(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 he(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 Kt}:await he(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(le(r))return mS(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 Kt;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 he(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`),le(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 Kt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=wd(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(le(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 Kt;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(le(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(a,r){try{if(!Et())throw new po("No browser detected.");if(a.error||a.error_description||a.error_code)throw new po(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 Lg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new po("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 Lg("No code detected.");const{data:q,error:B}=await this._exchangeCodeForSession(a.code);if(B)throw B;const P=new URL(window.location.href);return P.searchParams.delete("code"),window.history.replaceState(window.history.state,"",P.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 po("No session defined in URL");const v=Math.round(Date.now()/1e3),x=parseInt(m);let _=v+x;p&&(_=parseInt(p));const S=_-v;S*1e3<=hr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${x}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,_,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,_,v);const{data:E,error:k}=await this._getUser(d);if(k)throw k;const O={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:x,expires_at:_,refresh_token:h,token_type:g,user:E.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(le(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&&!(hS(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=SS(),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 he(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`),le(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(le(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:x,error:_}=d;if(_)throw _;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 he(this.fetch,"GET",S,{headers:this.headers,jwt:(v=(g=x.session)===null||g===void 0?void 0:g.access_token)!==null&&v!==void 0?v:void 0})});if(c)throw c;return Et()&&!(!((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(le(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,x=await he(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:_,error:S}=x;return S?this._returnResult({data:{user:null,session:null},error:S}):!_||!_.session||!_.user?this._returnResult({data:{user:null,session:null},error:new sr}):(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),this._returnResult({data:_,error:S}))}catch(c){if(await jt(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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(le(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 TS(async c=>(c>0&&await NS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await he(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&&xd(d)&&Date.now()+h-l<hr})}catch(l){if(this._debug(r,"error",l),le(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),Et()&&!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:_d()}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=_d()}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()<bd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${bd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),xd(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 Kt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const c=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(c,"begin");try{this.refreshingDeferred=new qo;const{data:d,error:h}=await this._refreshAccessToken(a);if(h)throw h;if(!d.session)throw new Kt;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),le(d)){const h={data:null,error:d};return xd(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=Vg(c);await mr(this.storage,this.storageKey,d)}else{const c=Vg(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&&Et()&&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 ${Gd} ticks`),c<=Gd&&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 Zy)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Et()||!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 he(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(le(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 he(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(le(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"?nj(a.webauthn.credential_response):sj(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:p}=await he(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(le(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 he(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:tj(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:aj(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(le(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}=wd(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 he(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 Kt})})}catch(r){if(le(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 Kt});const h=await he(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&&Et()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(le(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 Kt});const h=await he(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&&Et()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(le(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 he(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 Kt})})}catch(a){if(le(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 he(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 Kt})})}catch(r){if(le(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+dS>c)return l;const{data:d,error:h}=await he(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}}=wd(l);r?.allowExpired||MS(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=zS(c.alg),x=await crypto.subtle.importKey("jwk",g,v,!0,["verify"]);if(!await crypto.subtle.verify(v,x,h,wS(`${m}.${p}`)))throw new Yd("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(le(l))return this._returnResult({data:null,error:l});throw l}}}Di.nextInstanceID={};const hj=Di,mj="2.90.1";let ji="";typeof Deno<"u"?ji="deno":typeof document<"u"?ji="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ji="react-native":ji="node";const pj={"X-Client-Info":`supabase-js-${ji}/${mj}`},gj={headers:pj},yj={schema:"public"},vj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},bj={};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 xj(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 wj(n){var a=xj(n,"string");return Mi(a)=="symbol"?a:a+""}function _j(n,a,r){return(a=wj(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function Xg(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 We(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Xg(Object(r),!0).forEach(function(l){_j(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Xg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const Sj=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),jj=()=>Headers,Ej=(n,a,r)=>{const l=Sj(r),c=jj();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,We(We({},h),{},{headers:g}))}};function Nj(n){return n.endsWith("/")?n:n+"/"}function Tj(n,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=n,{db:p,auth:g,realtime:v,global:x}=a,_={db:We(We({},p),c),auth:We(We({},g),d),realtime:We(We({},v),h),storage:{},global:We(We(We({},x),m),{},{headers:We(We({},(r=x?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return n.accessToken?_.accessToken=n.accessToken:delete _.accessToken,_}function Aj(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(Nj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Cj=class extends hj{constructor(n){super(n)}},kj=class{constructor(n,a,r){var l,c;this.supabaseUrl=n,this.supabaseKey=a;const d=Aj(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:yj,realtime:bj,auth:We(We({},vj),{},{storageKey:h}),global:gj},p=Tj(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,x)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(x)} 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=Ej(a,this._getAccessToken.bind(this),p.global.fetch),this.realtime=this._initRealtimeClient(We({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 c1(new URL("rest/v1",d).href,{headers:this.headers,schema:p.db.schema,fetch:this.fetch}),this.storage=new iS(this.storageUrl.href,this.headers,this.fetch,r?.storage),p.accessToken||this._listenForAuthEvents()}get functions(){return new s1(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,x){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Cj({url:this.authUrl.href,headers:We(We({},_),v),storageKey:d,autoRefreshToken:n,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:p,throwOnError:g,fetch:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new N1(this.realtimeUrl.href,We(We({},n),{},{params:We(We({},{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 Qg=(n,a,r)=>new kj(n,a,r);function Oj(){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}Oj()&&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 $o="email_automator_supabase_config";function Tr(){try{const n=localStorage.getItem($o);if(n)return JSON.parse(n)}catch(n){console.error("Error reading Supabase config:",n)}return null}function Rj(n){try{localStorage.setItem($o,JSON.stringify(n))}catch(a){console.error("Error saving Supabase config:",a)}}function Dj(){try{localStorage.removeItem($o)}catch(n){console.error("Error clearing Supabase config:",n)}}async function ev(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 Mj(){return localStorage.getItem($o)?"ui":"none"}function zj(){const n=Tr();return!n||!n.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Qg("https://placeholder.supabase.co","placeholder-key")):Qg(n.url,n.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=zj();function Zg(){const n=Tr(),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 Uj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=Zg();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=Zg(),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),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 Uj;async function tv(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 Lj=Object.freeze(Object.defineProperty({__proto__:null,api:Ve,initializeApi:tv},Symbol.toStringTag,{value:"Module"}));function Ja(n,a){return n?typeof n=="string"?n:n.message||a:a}const av={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};function Bj(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};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{...av,isLoading:!1,isInitialized:!0};default:return n}}const nv=w.createContext(null);function qj({children:n}){const[a,r]=w.useReducer(Bj,av);w.useEffect(()=>{async function c(){if(!Tr()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:h}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(h&&h.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await tv(ct);const{data:{session:m}}=await ct.auth.getSession();r({type:"SET_USER",payload:m?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:p}}=ct.auth.onAuthStateChange((g,v)=>{r({type:"SET_USER",payload:v?.user||null}),v||r({type:"CLEAR_DATA"})});return()=>p.unsubscribe()}catch(h){console.error("[AppContext] Init error:",h),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}c()},[]);const l={fetchEmails:async(c={})=>{const d=await Ve.getEmails({limit:20,offset:c.offset||0,category:c.category,search:c.search});d.data&&r({type:"SET_EMAILS",payload:{emails:d.data.emails,total:d.data.total,offset:c.offset||0}})},fetchAccounts:async()=>{const c=await Ve.getAccounts();c.data&&r({type:"SET_ACCOUNTS",payload:c.data.accounts})},fetchRules:async()=>{const c=await Ve.getRules();c.data&&r({type:"SET_RULES",payload:c.data.rules})},fetchSettings:async()=>{const c=await Ve.getSettings();c.data&&r({type:"SET_SETTINGS",payload:c.data.settings})},fetchProfile:async()=>{const c=await Ve.getProfile();c.data&&r({type:"SET_PROFILE",payload:c.data})},fetchStats:async()=>{const c=await Ve.getStats();c.data&&r({type:"SET_STATS",payload:c.data.stats})},executeAction:async(c,d,h)=>{const m=await Ve.executeAction(c,d,h);if(m.data?.success){const p=a.emails.find(g=>g.id===c);return p&&r({type:"UPDATE_EMAIL",payload:{...p,action_taken:d}}),!0}return r({type:"SET_ERROR",payload:Ja(m.error,"Action failed")}),!1},triggerSync:async c=>{const d=c?await Ve.triggerSync(c):await Ve.syncAll();return await l.fetchAccounts(),d.error?(r({type:"SET_ERROR",payload:Ja(d.error,"Sync failed")}),!1):!0},disconnectAccount:async c=>{const d=await Ve.disconnectAccount(c);return d.data?.success?(r({type:"REMOVE_ACCOUNT",payload:c}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to disconnect")}),!1)},updateSettings:async c=>{const d=await Ve.updateSettings(c);return d.data?(r({type:"SET_SETTINGS",payload:d.data.settings}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to update settings")}),!1)},updateProfile:async c=>{const d=await Ve.updateProfile(c);return d.data?(r({type:"UPDATE_PROFILE",payload:d.data}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to update profile")}),!1)},updateAccount:async(c,d)=>{const h=await Ve.updateAccount(c,d);return h.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(m=>m.id===c?{...m,...d}:m)}),!0):(r({type:"SET_ERROR",payload:Ja(h.error,"Failed to update account")}),!1)},createRule:async c=>{const d=await Ve.createRule(c);return d.data?(r({type:"ADD_RULE",payload:d.data.rule}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to create rule")}),!1)},deleteRule:async c=>{const d=await Ve.deleteRule(c);return d.data?.success?(r({type:"REMOVE_RULE",payload:c}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to delete rule")}),!1)},toggleRule:async c=>{const d=await Ve.toggleRule(c);return d.data?(r({type:"UPDATE_RULE",payload:d.data.rule}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to toggle rule")}),!1)}};return o.jsx(nv.Provider,{value:{state:a,dispatch:r,actions:l},children:n})}function Ar(){const n=w.useContext(nv);if(!n)throw new Error("useApp must be used within AppProvider");return n}const $j=w.createContext(void 0);function Hj({children:n,value:a}){return o.jsx($j.Provider,{value:a,children:n})}const sv=w.createContext(null);function Vj({children:n}){const[a,r]=w.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(sv.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:n})}function rv(){const n=w.useContext(sv);if(!n)throw new Error("useTerminal must be used within a TerminalProvider");return n}const Nt=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("rounded-xl border bg-card text-card-foreground shadow",n),...a}));Nt.displayName="Card";const _a=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("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:ke("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:ke("text-sm text-muted-foreground",n),...a}));Za.displayName="CardDescription";const ja=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("p-6 pt-0",n),...a}));ja.displayName="CardContent";const iv=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("flex items-center p-6 pt-0",n),...a}));iv.displayName="CardFooter";class Ij 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(Nt,{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(Sr,{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(F,{onClick:this.handleReset,variant:"outline",children:[o.jsx(_r,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(F,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}let zi=[],Jd=new Set;function lv(){Jd.forEach(n=>n())}const se={success:(n,a)=>go("success",n,a),error:(n,a)=>go("error",n,a),info:(n,a)=>go("info",n,a),warning:(n,a)=>go("warning",n,a)};function go(n,a,r=5e3){const l=Math.random().toString(36).substr(2,9);zi=[...zi,{id:l,type:n,message:a,duration:r}],lv(),r>0&&setTimeout(()=>ov(l),r)}function ov(n){zi=zi.filter(a=>a.id!==n),lv()}function Gj(){const[,n]=w.useState(0);return w.useEffect(()=>{const a=()=>n(r=>r+1);return Jd.add(a),()=>{Jd.delete(a)}},[]),zi}const Pj={success:tf,error:$i,info:wr,warning:Sr},Kj={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 Yj({toast:n}){const a=Pj[n.type];return o.jsxs("div",{className:ke("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-right-full duration-300",Kj[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:()=>ov(n.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(Uo,{className:"w-4 h-4"})})]})}function Jj(){const n=Gj();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(Yj,{toast:a},a.id))})}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:ke("flex flex-col items-center justify-center gap-3",a),children:[o.jsx(ra,{className:ke("animate-spin text-primary",l[n])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function Ti({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 Xj(){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 Qj(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 Zj(n,a=[]){let r=[];function l(d,h){const m=w.createContext(h),p=r.length;r=[...r,h];const g=x=>{const{scope:_,children:S,...A}=x,E=_?.[n]?.[p]||m,k=w.useMemo(()=>A,Object.values(A));return o.jsx(E.Provider,{value:k,children:S})};g.displayName=d+"Provider";function v(x,_){const S=_?.[n]?.[p]||m,A=w.useContext(S);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${x}\` 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,Fj(c,...a)]}function Fj(...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 x=p(d)[`__scope${g}`];return{...m,...x}},{});return w.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var Ui=globalThis?.document?w.useLayoutEffect:()=>{},Wj=Wd[" useId ".trim().toString()]||(()=>{}),eE=0;function jd(n){const[a,r]=w.useState(Wj());return Ui(()=>{r(l=>l??String(eE++))},[n]),n||(a?`radix-${a}`:"")}var tE=Wd[" useInsertionEffect ".trim().toString()]||Ui;function aE({prop:n,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=nE({defaultProp:a,onChange:r}),m=n!==void 0,p=m?n:c;{const v=w.useRef(n!==void 0);w.useEffect(()=>{const x=v.current;x!==m&&console.warn(`${l} is changing from ${x?"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 x=sE(v)?v(n):v;x!==n&&h.current?.(x)}else d(v)},[m,n,d,h]);return[p,g]}function nE({defaultProp:n,onChange:a}){const[r,l]=w.useState(n),c=w.useRef(r),d=w.useRef(a);return tE(()=>{d.current=a},[a]),w.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function sE(n){return typeof n=="function"}var cv=hy();const rE=Zd(cv);function iE(n){const a=lE(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(cE);if(p){const g=p.props.children,v=m.map(x=>x===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:x);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 lE(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=dE(c),m=uE(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Lo(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 oE=Symbol("radix.slottable");function cE(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===oE}function uE(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 dE(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 fE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wa=fE.reduce((n,a)=>{const r=iE(`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 hE(n,a){n&&cv.flushSync(()=>n.dispatchEvent(a))}function Li(n){const a=w.useRef(n);return w.useEffect(()=>{a.current=n}),w.useMemo(()=>(...r)=>a.current?.(...r),[])}function mE(n,a=globalThis?.document){const r=Li(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 pE="DismissableLayer",Xd="dismissableLayer.update",gE="dismissableLayer.pointerDownOutside",yE="dismissableLayer.focusOutside",Fg,uv=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dv=w.forwardRef((n,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...p}=n,g=w.useContext(uv),[v,x]=w.useState(null),_=v?.ownerDocument??globalThis?.document,[,S]=w.useState({}),A=ls(a,Y=>x(Y)),E=Array.from(g.layers),[k]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),O=E.indexOf(k),q=v?E.indexOf(v):-1,B=g.layersWithOutsidePointerEventsDisabled.size>0,P=q>=O,W=xE(Y=>{const J=Y.target,fe=[...g.branches].some(Ge=>Ge.contains(J));!P||fe||(c?.(Y),h?.(Y),Y.defaultPrevented||m?.())},_),Q=wE(Y=>{const J=Y.target;[...g.branches].some(Ge=>Ge.contains(J))||(d?.(Y),h?.(Y),Y.defaultPrevented||m?.())},_);return mE(Y=>{q===g.layers.size-1&&(l?.(Y),!Y.defaultPrevented&&m&&(Y.preventDefault(),m()))},_),w.useEffect(()=>{if(v)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Fg=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),Wg(),()=>{r&&g.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=Fg)}},[v,_,r,g]),w.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),Wg())},[v,g]),w.useEffect(()=>{const Y=()=>S({});return document.addEventListener(Xd,Y),()=>document.removeEventListener(Xd,Y)},[]),o.jsx(Wa.div,{...p,ref:A,style:{pointerEvents:B?P?"auto":"none":void 0,...n.style},onFocusCapture:On(n.onFocusCapture,Q.onFocusCapture),onBlurCapture:On(n.onBlurCapture,Q.onBlurCapture),onPointerDownCapture:On(n.onPointerDownCapture,W.onPointerDownCapture)})});dv.displayName=pE;var vE="DismissableLayerBranch",bE=w.forwardRef((n,a)=>{const r=w.useContext(uv),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})});bE.displayName=vE;function xE(n,a=globalThis?.document){const r=Li(n),l=w.useRef(!1),c=w.useRef(()=>{});return w.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let p=function(){fv(gE,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 wE(n,a=globalThis?.document){const r=Li(n),l=w.useRef(!1);return w.useEffect(()=>{const c=d=>{d.target&&!l.current&&fv(yE,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 Wg(){const n=new CustomEvent(Xd);document.dispatchEvent(n)}function fv(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?hE(c,d):c.dispatchEvent(d)}var Ed="focusScope.autoFocusOnMount",Nd="focusScope.autoFocusOnUnmount",ey={bubbles:!1,cancelable:!0},_E="FocusScope",hv=w.forwardRef((n,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=n,[m,p]=w.useState(null),g=Li(c),v=Li(d),x=w.useRef(null),_=ls(a,E=>p(E)),S=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(l){let E=function(B){if(S.paused||!m)return;const P=B.target;m.contains(P)?x.current=P:An(x.current,{select:!0})},k=function(B){if(S.paused||!m)return;const P=B.relatedTarget;P!==null&&(m.contains(P)||An(x.current,{select:!0}))},O=function(B){if(document.activeElement===document.body)for(const W of B)W.removedNodes.length>0&&An(m)};document.addEventListener("focusin",E),document.addEventListener("focusout",k);const q=new MutationObserver(O);return m&&q.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",k),q.disconnect()}}},[l,m,S.paused]),w.useEffect(()=>{if(m){ay.add(S);const E=document.activeElement;if(!m.contains(E)){const O=new CustomEvent(Ed,ey);m.addEventListener(Ed,g),m.dispatchEvent(O),O.defaultPrevented||(SE(AE(mv(m)),{select:!0}),document.activeElement===E&&An(m))}return()=>{m.removeEventListener(Ed,g),setTimeout(()=>{const O=new CustomEvent(Nd,ey);m.addEventListener(Nd,v),m.dispatchEvent(O),O.defaultPrevented||An(E??document.body,{select:!0}),m.removeEventListener(Nd,v),ay.remove(S)},0)}}},[m,g,v,S]);const A=w.useCallback(E=>{if(!r&&!l||S.paused)return;const k=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,O=document.activeElement;if(k&&O){const q=E.currentTarget,[B,P]=jE(q);B&&P?!E.shiftKey&&O===P?(E.preventDefault(),r&&An(B,{select:!0})):E.shiftKey&&O===B&&(E.preventDefault(),r&&An(P,{select:!0})):O===q&&E.preventDefault()}},[r,l,S.paused]);return o.jsx(Wa.div,{tabIndex:-1,...h,ref:_,onKeyDown:A})});hv.displayName=_E;function SE(n,{select:a=!1}={}){const r=document.activeElement;for(const l of n)if(An(l,{select:a}),document.activeElement!==r)return}function jE(n){const a=mv(n),r=ty(a,n),l=ty(a.reverse(),n);return[r,l]}function mv(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 ty(n,a){for(const r of n)if(!EE(r,{upTo:a}))return r}function EE(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 NE(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&&NE(n)&&a&&n.select()}}var ay=TE();function TE(){let n=[];return{add(a){const r=n[0];a!==r&&r?.pause(),n=ny(n,a),n.unshift(a)},remove(a){n=ny(n,a),n[0]?.resume()}}}function ny(n,a){const r=[...n],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function AE(n){return n.filter(a=>a.tagName!=="A")}var CE="Portal",pv=w.forwardRef((n,a)=>{const{container:r,...l}=n,[c,d]=w.useState(!1);Ui(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?rE.createPortal(o.jsx(Wa.div,{...l,ref:a}),h):null});pv.displayName=CE;function kE(n,a){return w.useReducer((r,l)=>a[r][l]??r,n)}var Ho=n=>{const{present:a,children:r}=n,l=OE(a),c=typeof r=="function"?r({present:l.isPresent}):w.Children.only(r),d=ls(l.ref,RE(c));return typeof r=="function"||l.isPresent?w.cloneElement(c,{ref:d}):null};Ho.displayName="Presence";function OE(n){const[a,r]=w.useState(),l=w.useRef(null),c=w.useRef(n),d=w.useRef("none"),h=n?"mounted":"unmounted",[m,p]=kE(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const g=yo(l.current);d.current=m==="mounted"?g:"none"},[m]),Ui(()=>{const g=l.current,v=c.current;if(v!==n){const _=d.current,S=yo(g);n?p("MOUNT"):S==="none"||g?.display==="none"?p("UNMOUNT"):p(v&&_!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,p]),Ui(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,x=S=>{const E=yo(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&E&&(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)})}},_=S=>{S.target===a&&(d.current=yo(l.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",x),a.addEventListener("animationend",x),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",x),a.removeEventListener("animationend",x)}}else p("ANIMATION_END")},[a,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:w.useCallback(g=>{l.current=g?getComputedStyle(g):null,r(g)},[])}}function yo(n){return n?.animationName||"none"}function RE(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 Td=0;function DE(){w.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??sy()),document.body.insertAdjacentElement("beforeend",n[1]??sy()),Td++,()=>{Td===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Td--}},[])}function sy(){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 jo="right-scroll-bar-position",Eo="width-before-scroll-bar",ME="with-scroll-bars-hidden",zE="--removed-body-scroll-bar-size";function Ad(n,a){return typeof n=="function"?n(a):n&&(n.current=a),n}function UE(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 LE=typeof window<"u"?w.useLayoutEffect:w.useEffect,ry=new WeakMap;function BE(n,a){var r=UE(null,function(l){return n.forEach(function(c){return Ad(c,l)})});return LE(function(){var l=ry.get(r);if(l){var c=new Set(l),d=new Set(n),h=r.current;c.forEach(function(m){d.has(m)||Ad(m,null)}),d.forEach(function(m){c.has(m)||Ad(m,h)})}ry.set(r,n)},[n]),r}function qE(n){return n}function $E(n,a){a===void 0&&(a=qE);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 HE(n){n===void 0&&(n={});var a=$E(null);return a.options=wa({async:!0,ssr:!1},n),a}var gv=function(n){var a=n.sideCar,r=Nr(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))};gv.isSideCarExport=!0;function VE(n,a){return n.useMedium(a),gv}var yv=HE(),Cd=function(){},Vo=w.forwardRef(function(n,a){var r=w.useRef(null),l=w.useState({onScrollCapture:Cd,onWheelCapture:Cd,onTouchMoveCapture:Cd}),c=l[0],d=l[1],h=n.forwardProps,m=n.children,p=n.className,g=n.removeScrollBar,v=n.enabled,x=n.shards,_=n.sideCar,S=n.noRelative,A=n.noIsolation,E=n.inert,k=n.allowPinchZoom,O=n.as,q=O===void 0?"div":O,B=n.gapMode,P=Nr(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),W=_,Q=BE([r,a]),Y=wa(wa({},P),c);return w.createElement(w.Fragment,null,v&&w.createElement(W,{sideCar:yv,removeScrollBar:g,shards:x,noRelative:S,noIsolation:A,inert:E,setCallbacks:d,allowPinchZoom:!!k,lockRef:r,gapMode:B}),h?w.cloneElement(w.Children.only(m),wa(wa({},Y),{ref:Q})):w.createElement(q,wa({},Y,{className:p,ref:Q}),m))});Vo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Vo.classNames={fullWidth:Eo,zeroRight:jo};var IE=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function GE(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var a=IE();return a&&n.setAttribute("nonce",a),n}function PE(n,a){n.styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a))}function KE(n){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(n)}var YE=function(){var n=0,a=null;return{add:function(r){n==0&&(a=GE())&&(PE(a,r),KE(a)),n++},remove:function(){n--,!n&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},JE=function(){var n=YE();return function(a,r){w.useEffect(function(){return n.add(a),function(){n.remove()}},[a&&r])}},vv=function(){var n=JE(),a=function(r){var l=r.styles,c=r.dynamic;return n(l,c),null};return a},XE={left:0,top:0,right:0,gap:0},kd=function(n){return parseInt(n||"",10)||0},QE=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[kd(r),kd(l),kd(c)]},ZE=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return XE;var a=QE(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])}},FE=vv(),br="data-scroll-locked",WE=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
52
  .`.concat(ME,` {
53
53
  overflow: hidden `).concat(l,`;
54
54
  padding-right: `).concat(m,"px ").concat(l,`;
55
55
  }
56
- body[`).concat(vr,`] {
56
+ body[`).concat(br,`] {
57
57
  overflow: hidden `).concat(l,`;
58
58
  overscroll-behavior: contain;
59
59
  `).concat([a&&"position: relative ".concat(l,";"),r==="margin"&&`
@@ -82,16 +82,16 @@ ${O}`}class ot extends Error{constructor({message:a,code:r,cause:l,name:c}){var
82
82
  margin-right: 0 `).concat(l,`;
83
83
  }
84
84
 
85
- body[`).concat(vr,`] {
85
+ body[`).concat(br,`] {
86
86
  `).concat(zE,": ").concat(m,`px;
87
87
  }
88
- `)},iy=function(){var n=parseInt(document.body.getAttribute(vr)||"0",10);return isFinite(n)?n:0},e2=function(){w.useEffect(function(){return document.body.setAttribute(vr,(iy()+1).toString()),function(){var n=iy()-1;n<=0?document.body.removeAttribute(vr):document.body.setAttribute(vr,n.toString())}},[])},t2=function(n){var a=n.noRelative,r=n.noImportant,l=n.gapMode,c=l===void 0?"margin":l;e2();var d=w.useMemo(function(){return ZE(c)},[c]);return w.createElement(FE,{styles:WE(d,!a,c,r?"":"!important")})},Qd=!1;if(typeof window<"u")try{var vo=Object.defineProperty({},"passive",{get:function(){return Qd=!0,!0}});window.addEventListener("test",vo,vo),window.removeEventListener("test",vo,vo)}catch{Qd=!1}var or=Qd?{passive:!1}:!1,a2=function(n){return n.tagName==="TEXTAREA"},bv=function(n,a){if(!(n instanceof Element))return!1;var r=window.getComputedStyle(n);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!a2(n)&&r[a]==="visible")},n2=function(n){return bv(n,"overflowY")},s2=function(n){return bv(n,"overflowX")},ly=function(n,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=xv(n,l);if(c){var d=wv(n,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},r2=function(n){var a=n.scrollTop,r=n.scrollHeight,l=n.clientHeight;return[a,r,l]},i2=function(n){var a=n.scrollLeft,r=n.scrollWidth,l=n.clientWidth;return[a,r,l]},xv=function(n,a){return n==="v"?n2(a):s2(a)},wv=function(n,a){return n==="v"?r2(a):i2(a)},l2=function(n,a){return n==="h"&&a==="rtl"?-1:1},o2=function(n,a,r,l,c){var d=l2(n,window.getComputedStyle(a).direction),h=d*l,m=r.target,p=a.contains(m),g=!1,v=h>0,x=0,_=0;do{if(!m)break;var S=wv(n,m),A=S[0],E=S[1],k=S[2],O=E-k-d*A;(A||O)&&xv(n,m)&&(x+=O,_+=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(x)<1||!v&&Math.abs(_)<1)&&(g=!0),g},bo=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},oy=function(n){return[n.deltaX,n.deltaY]},cy=function(n){return n&&"current"in n?n.current:n},c2=function(n,a){return n[0]===a[0]&&n[1]===a[1]},u2=function(n){return`
88
+ `)},iy=function(){var n=parseInt(document.body.getAttribute(br)||"0",10);return isFinite(n)?n:0},e2=function(){w.useEffect(function(){return document.body.setAttribute(br,(iy()+1).toString()),function(){var n=iy()-1;n<=0?document.body.removeAttribute(br):document.body.setAttribute(br,n.toString())}},[])},t2=function(n){var a=n.noRelative,r=n.noImportant,l=n.gapMode,c=l===void 0?"margin":l;e2();var d=w.useMemo(function(){return ZE(c)},[c]);return w.createElement(FE,{styles:WE(d,!a,c,r?"":"!important")})},Qd=!1;if(typeof window<"u")try{var vo=Object.defineProperty({},"passive",{get:function(){return Qd=!0,!0}});window.addEventListener("test",vo,vo),window.removeEventListener("test",vo,vo)}catch{Qd=!1}var cr=Qd?{passive:!1}:!1,a2=function(n){return n.tagName==="TEXTAREA"},bv=function(n,a){if(!(n instanceof Element))return!1;var r=window.getComputedStyle(n);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!a2(n)&&r[a]==="visible")},n2=function(n){return bv(n,"overflowY")},s2=function(n){return bv(n,"overflowX")},ly=function(n,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=xv(n,l);if(c){var d=wv(n,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},r2=function(n){var a=n.scrollTop,r=n.scrollHeight,l=n.clientHeight;return[a,r,l]},i2=function(n){var a=n.scrollLeft,r=n.scrollWidth,l=n.clientWidth;return[a,r,l]},xv=function(n,a){return n==="v"?n2(a):s2(a)},wv=function(n,a){return n==="v"?r2(a):i2(a)},l2=function(n,a){return n==="h"&&a==="rtl"?-1:1},o2=function(n,a,r,l,c){var d=l2(n,window.getComputedStyle(a).direction),h=d*l,m=r.target,p=a.contains(m),g=!1,v=h>0,x=0,_=0;do{if(!m)break;var S=wv(n,m),A=S[0],E=S[1],k=S[2],O=E-k-d*A;(A||O)&&xv(n,m)&&(x+=O,_+=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(x)<1||!v&&Math.abs(_)<1)&&(g=!0),g},bo=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},oy=function(n){return[n.deltaX,n.deltaY]},cy=function(n){return n&&"current"in n?n.current:n},c2=function(n,a){return n[0]===a[0]&&n[1]===a[1]},u2=function(n){return`
89
89
  .block-interactivity-`.concat(n,` {pointer-events: none;}
90
90
  .allow-interactivity-`).concat(n,` {pointer-events: all;}
91
- `)},d2=0,cr=[];function f2(n){var a=w.useRef([]),r=w.useRef([0,0]),l=w.useRef(),c=w.useState(d2++)[0],d=w.useState(vv)[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 E=t1([n.lockRef.current],(n.shards||[]).map(cy),!0).filter(Boolean);return E.forEach(function(k){return k.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),E.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var m=w.useCallback(function(E,k){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!h.current.allowPinchZoom;var O=bo(E),q=r.current,L="deltaX"in E?E.deltaX:q[0]-O[0],P="deltaY"in E?E.deltaY:q[1]-O[1],W,Q=E.target,Y=Math.abs(L)>Math.abs(P)?"h":"v";if("touches"in E&&Y==="h"&&Q.type==="range")return!1;var J=window.getSelection(),fe=J&&J.anchorNode,Ie=fe?fe===Q||fe.contains(Q):!1;if(Ie)return!1;var pe=ly(Y,Q);if(!pe)return!0;if(pe?W=Y:(W=Y==="v"?"h":"v",pe=ly(Y,Q)),!pe)return!1;if(!l.current&&"changedTouches"in E&&(L||P)&&(l.current=W),!W)return!0;var ge=l.current||W;return o2(ge,k,E,ge==="h"?L:P)},[]),p=w.useCallback(function(E){var k=E;if(!(!cr.length||cr[cr.length-1]!==d)){var O="deltaY"in k?oy(k):bo(k),q=a.current.filter(function(W){return W.name===k.type&&(W.target===k.target||k.target===W.shadowParent)&&c2(W.delta,O)})[0];if(q&&q.should){k.cancelable&&k.preventDefault();return}if(!q){var L=(h.current.shards||[]).map(cy).filter(Boolean).filter(function(W){return W.contains(k.target)}),P=L.length>0?m(k,L[0]):!h.current.noIsolation;P&&k.cancelable&&k.preventDefault()}}},[]),g=w.useCallback(function(E,k,O,q){var L={name:E,delta:k,target:O,should:q,shadowParent:h2(O)};a.current.push(L),setTimeout(function(){a.current=a.current.filter(function(P){return P!==L})},1)},[]),v=w.useCallback(function(E){r.current=bo(E),l.current=void 0},[]),x=w.useCallback(function(E){g(E.type,oy(E),E.target,m(E,n.lockRef.current))},[]),_=w.useCallback(function(E){g(E.type,bo(E),E.target,m(E,n.lockRef.current))},[]);w.useEffect(function(){return cr.push(d),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:_}),document.addEventListener("wheel",p,or),document.addEventListener("touchmove",p,or),document.addEventListener("touchstart",v,or),function(){cr=cr.filter(function(E){return E!==d}),document.removeEventListener("wheel",p,or),document.removeEventListener("touchmove",p,or),document.removeEventListener("touchstart",v,or)}},[]);var S=n.removeScrollBar,A=n.inert;return w.createElement(w.Fragment,null,A?w.createElement(d,{styles:u2(c)}):null,S?w.createElement(t2,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function h2(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const m2=VE(yv,f2);var _v=w.forwardRef(function(n,a){return w.createElement(Vo,wa({},n,{ref:a,sideCar:m2}))});_v.classNames=Vo.classNames;var p2=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},ur=new WeakMap,xo=new WeakMap,wo={},Od=0,Sv=function(n){return n&&(n.host||Sv(n.parentNode))},g2=function(n,a){return a.map(function(r){if(n.contains(r))return r;var l=Sv(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})},y2=function(n,a,r,l){var c=g2(a,Array.isArray(n)?n:[n]);wo[r]||(wo[r]=new WeakMap);var d=wo[r],h=[],m=new Set,p=new Set(c),g=function(x){!x||m.has(x)||(m.add(x),g(x.parentNode))};c.forEach(g);var v=function(x){!x||p.has(x)||Array.prototype.forEach.call(x.children,function(_){if(m.has(_))v(_);else try{var S=_.getAttribute(l),A=S!==null&&S!=="false",E=(ur.get(_)||0)+1,k=(d.get(_)||0)+1;ur.set(_,E),d.set(_,k),h.push(_),E===1&&A&&xo.set(_,!0),k===1&&_.setAttribute(r,"true"),A||_.setAttribute(l,"true")}catch(O){console.error("aria-hidden: cannot operate on ",_,O)}})};return v(a),m.clear(),Od++,function(){h.forEach(function(x){var _=ur.get(x)-1,S=d.get(x)-1;ur.set(x,_),d.set(x,S),_||(xo.has(x)||x.removeAttribute(l),xo.delete(x)),S||x.removeAttribute(r)}),Od--,Od||(ur=new WeakMap,ur=new WeakMap,xo=new WeakMap,wo={})}},v2=function(n,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(n)?n:[n]),c=p2(n);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),y2(l,c,r,"aria-hidden")):function(){return null}};function b2(n){const a=x2(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(_2);if(p){const g=p.props.children,v=m.map(x=>x===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:x);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 x2(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=j2(c),m=S2(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Lo(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 w2=Symbol("radix.slottable");function _2(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===w2}function S2(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 j2(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 Io="Dialog",[jv]=Zj(Io),[E2,ma]=jv(Io),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]=aE({prop:l,defaultProp:c??!1,onChange:d,caller:Io});return o.jsx(E2,{scope:a,triggerRef:m,contentRef:p,contentId:jd(),titleId:jd(),descriptionId:jd(),open:g,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(x=>!x),[v]),modal:h,children:r})};Ev.displayName=Io;var Nv="DialogTrigger",N2=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Nv,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":ff(c.open),...l,ref:d,onClick:On(n.onClick,c.onOpenToggle)})});N2.displayName=Nv;var uf="DialogPortal",[T2,Tv]=jv(uf,{forceMount:void 0}),Av=n=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=n,d=ma(uf,a);return o.jsx(T2,{scope:a,forceMount:r,children:w.Children.map(l,h=>o.jsx(Ho,{present:r||d.open,children:o.jsx(pv,{asChild:!0,container:c,children:h})}))})};Av.displayName=uf;var Mo="DialogOverlay",Cv=w.forwardRef((n,a)=>{const r=Tv(Mo,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=ma(Mo,n.__scopeDialog);return d.modal?o.jsx(Ho,{present:l||d.open,children:o.jsx(C2,{...c,ref:a})}):null});Cv.displayName=Mo;var A2=b2("DialogOverlay.RemoveScroll"),C2=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Mo,r);return o.jsx(_v,{as:A2,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(Wa.div,{"data-state":ff(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),is="DialogContent",kv=w.forwardRef((n,a)=>{const r=Tv(is,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=ma(is,n.__scopeDialog);return o.jsx(Ho,{present:l||d.open,children:d.modal?o.jsx(k2,{...c,ref:a}):o.jsx(O2,{...c,ref:a})})});kv.displayName=is;var k2=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 v2(d)},[]),o.jsx(Ov,{...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())})}),O2=w.forwardRef((n,a)=>{const r=ma(is,n.__scopeDialog),l=w.useRef(!1),c=w.useRef(!1);return o.jsx(Ov,{...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()}})}),Ov=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 DE(),o.jsxs(o.Fragment,{children:[o.jsx(hv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(dv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":ff(m.open),...h,ref:g,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(R2,{titleId:m.titleId}),o.jsx(M2,{contentRef:p,descriptionId:m.descriptionId})]})]})}),df="DialogTitle",Rv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(df,r);return o.jsx(Wa.h2,{id:c.titleId,...l,ref:a})});Rv.displayName=df;var Dv="DialogDescription",Mv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Dv,r);return o.jsx(Wa.p,{id:c.descriptionId,...l,ref:a})});Mv.displayName=Dv;var zv="DialogClose",Uv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(zv,r);return o.jsx(Wa.button,{type:"button",...l,ref:a,onClick:On(n.onClick,()=>c.onOpenChange(!1))})});Uv.displayName=zv;function ff(n){return n?"open":"closed"}var Lv="DialogTitleWarning",[TN,Bv]=Qj(Lv,{contentName:is,titleName:df,docsSlug:"dialog"}),R2=({titleId:n})=>{const a=Bv(Lv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
91
+ `)},d2=0,ur=[];function f2(n){var a=w.useRef([]),r=w.useRef([0,0]),l=w.useRef(),c=w.useState(d2++)[0],d=w.useState(vv)[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 E=t1([n.lockRef.current],(n.shards||[]).map(cy),!0).filter(Boolean);return E.forEach(function(k){return k.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),E.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var m=w.useCallback(function(E,k){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!h.current.allowPinchZoom;var O=bo(E),q=r.current,B="deltaX"in E?E.deltaX:q[0]-O[0],P="deltaY"in E?E.deltaY:q[1]-O[1],W,Q=E.target,Y=Math.abs(B)>Math.abs(P)?"h":"v";if("touches"in E&&Y==="h"&&Q.type==="range")return!1;var J=window.getSelection(),fe=J&&J.anchorNode,Ge=fe?fe===Q||fe.contains(Q):!1;if(Ge)return!1;var pe=ly(Y,Q);if(!pe)return!0;if(pe?W=Y:(W=Y==="v"?"h":"v",pe=ly(Y,Q)),!pe)return!1;if(!l.current&&"changedTouches"in E&&(B||P)&&(l.current=W),!W)return!0;var ge=l.current||W;return o2(ge,k,E,ge==="h"?B:P)},[]),p=w.useCallback(function(E){var k=E;if(!(!ur.length||ur[ur.length-1]!==d)){var O="deltaY"in k?oy(k):bo(k),q=a.current.filter(function(W){return W.name===k.type&&(W.target===k.target||k.target===W.shadowParent)&&c2(W.delta,O)})[0];if(q&&q.should){k.cancelable&&k.preventDefault();return}if(!q){var B=(h.current.shards||[]).map(cy).filter(Boolean).filter(function(W){return W.contains(k.target)}),P=B.length>0?m(k,B[0]):!h.current.noIsolation;P&&k.cancelable&&k.preventDefault()}}},[]),g=w.useCallback(function(E,k,O,q){var B={name:E,delta:k,target:O,should:q,shadowParent:h2(O)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(P){return P!==B})},1)},[]),v=w.useCallback(function(E){r.current=bo(E),l.current=void 0},[]),x=w.useCallback(function(E){g(E.type,oy(E),E.target,m(E,n.lockRef.current))},[]),_=w.useCallback(function(E){g(E.type,bo(E),E.target,m(E,n.lockRef.current))},[]);w.useEffect(function(){return ur.push(d),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:_}),document.addEventListener("wheel",p,cr),document.addEventListener("touchmove",p,cr),document.addEventListener("touchstart",v,cr),function(){ur=ur.filter(function(E){return E!==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:u2(c)}):null,S?w.createElement(t2,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function h2(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const m2=VE(yv,f2);var _v=w.forwardRef(function(n,a){return w.createElement(Vo,wa({},n,{ref:a,sideCar:m2}))});_v.classNames=Vo.classNames;var p2=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},dr=new WeakMap,xo=new WeakMap,wo={},Od=0,Sv=function(n){return n&&(n.host||Sv(n.parentNode))},g2=function(n,a){return a.map(function(r){if(n.contains(r))return r;var l=Sv(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})},y2=function(n,a,r,l){var c=g2(a,Array.isArray(n)?n:[n]);wo[r]||(wo[r]=new WeakMap);var d=wo[r],h=[],m=new Set,p=new Set(c),g=function(x){!x||m.has(x)||(m.add(x),g(x.parentNode))};c.forEach(g);var v=function(x){!x||p.has(x)||Array.prototype.forEach.call(x.children,function(_){if(m.has(_))v(_);else try{var S=_.getAttribute(l),A=S!==null&&S!=="false",E=(dr.get(_)||0)+1,k=(d.get(_)||0)+1;dr.set(_,E),d.set(_,k),h.push(_),E===1&&A&&xo.set(_,!0),k===1&&_.setAttribute(r,"true"),A||_.setAttribute(l,"true")}catch(O){console.error("aria-hidden: cannot operate on ",_,O)}})};return v(a),m.clear(),Od++,function(){h.forEach(function(x){var _=dr.get(x)-1,S=d.get(x)-1;dr.set(x,_),d.set(x,S),_||(xo.has(x)||x.removeAttribute(l),xo.delete(x)),S||x.removeAttribute(r)}),Od--,Od||(dr=new WeakMap,dr=new WeakMap,xo=new WeakMap,wo={})}},v2=function(n,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(n)?n:[n]),c=p2(n);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),y2(l,c,r,"aria-hidden")):function(){return null}};function b2(n){const a=x2(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(_2);if(p){const g=p.props.children,v=m.map(x=>x===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:x);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 x2(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=j2(c),m=S2(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Lo(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 w2=Symbol("radix.slottable");function _2(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===w2}function S2(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 j2(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 Io="Dialog",[jv]=Zj(Io),[E2,ma]=jv(Io),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]=aE({prop:l,defaultProp:c??!1,onChange:d,caller:Io});return o.jsx(E2,{scope:a,triggerRef:m,contentRef:p,contentId:jd(),titleId:jd(),descriptionId:jd(),open:g,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(x=>!x),[v]),modal:h,children:r})};Ev.displayName=Io;var Nv="DialogTrigger",N2=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Nv,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":ff(c.open),...l,ref:d,onClick:On(n.onClick,c.onOpenToggle)})});N2.displayName=Nv;var uf="DialogPortal",[T2,Tv]=jv(uf,{forceMount:void 0}),Av=n=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=n,d=ma(uf,a);return o.jsx(T2,{scope:a,forceMount:r,children:w.Children.map(l,h=>o.jsx(Ho,{present:r||d.open,children:o.jsx(pv,{asChild:!0,container:c,children:h})}))})};Av.displayName=uf;var Mo="DialogOverlay",Cv=w.forwardRef((n,a)=>{const r=Tv(Mo,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=ma(Mo,n.__scopeDialog);return d.modal?o.jsx(Ho,{present:l||d.open,children:o.jsx(C2,{...c,ref:a})}):null});Cv.displayName=Mo;var A2=b2("DialogOverlay.RemoveScroll"),C2=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Mo,r);return o.jsx(_v,{as:A2,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(Wa.div,{"data-state":ff(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),is="DialogContent",kv=w.forwardRef((n,a)=>{const r=Tv(is,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=ma(is,n.__scopeDialog);return o.jsx(Ho,{present:l||d.open,children:d.modal?o.jsx(k2,{...c,ref:a}):o.jsx(O2,{...c,ref:a})})});kv.displayName=is;var k2=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 v2(d)},[]),o.jsx(Ov,{...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())})}),O2=w.forwardRef((n,a)=>{const r=ma(is,n.__scopeDialog),l=w.useRef(!1),c=w.useRef(!1);return o.jsx(Ov,{...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()}})}),Ov=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 DE(),o.jsxs(o.Fragment,{children:[o.jsx(hv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(dv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":ff(m.open),...h,ref:g,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(R2,{titleId:m.titleId}),o.jsx(M2,{contentRef:p,descriptionId:m.descriptionId})]})]})}),df="DialogTitle",Rv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(df,r);return o.jsx(Wa.h2,{id:c.titleId,...l,ref:a})});Rv.displayName=df;var Dv="DialogDescription",Mv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Dv,r);return o.jsx(Wa.p,{id:c.descriptionId,...l,ref:a})});Mv.displayName=Dv;var zv="DialogClose",Uv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(zv,r);return o.jsx(Wa.button,{type:"button",...l,ref:a,onClick:On(n.onClick,()=>c.onOpenChange(!1))})});Uv.displayName=zv;function ff(n){return n?"open":"closed"}var Lv="DialogTitleWarning",[TN,Bv]=Qj(Lv,{contentName:is,titleName:df,docsSlug:"dialog"}),R2=({titleId:n})=>{const a=Bv(Lv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
92
92
 
93
93
  If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
94
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},D2="DialogDescriptionWarning",M2=({contentRef:n,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Bv(D2).contentName}}.`;return w.useEffect(()=>{const c=n.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,n,a]),null},z2=Ev,U2=Av,L2=Cv,B2=kv,q2=Rv,$2=Mv,H2=Uv;function ss({...n}){return o.jsx(z2,{"data-slot":"dialog",...n})}function V2({...n}){return o.jsx(U2,{"data-slot":"dialog-portal",...n})}function I2({className:n,...a}){return o.jsx(L2,{"data-slot":"dialog-overlay",className:ke("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(V2,{"data-slot":"dialog-portal",children:[o.jsx(I2,{}),o.jsxs(B2,{"data-slot":"dialog-content",className:ke("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(H2,{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(Uo,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ea({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:ke("flex flex-col gap-2 text-center sm:text-left",n),...a})}function mr({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:ke("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...a})}function Na({className:n,...a}){return o.jsx(q2,{"data-slot":"dialog-title",className:ke("text-lg leading-none font-semibold",n),...a})}function Ta({className:n,...a}){return o.jsx($2,{"data-slot":"dialog-description",className:ke("text-muted-foreground text-sm",n),...a})}const Ae=w.forwardRef(({className:n,type:a,...r},l)=>o.jsx("input",{type:a,className:ke("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}));Ae.displayName="Input";var G2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],P2=G2.reduce((n,a)=>{const r=xy(`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}},{}),K2="Label",qv=w.forwardRef((n,a)=>o.jsx(P2.label,{...n,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(n.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));qv.displayName=K2;var Y2=qv;function ha({className:n,...a}){return o.jsx(Y2,{"data-slot":"label",className:ke("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 J2=Sy("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 Li({className:n,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:ke(J2({variant:a}),n),...r})}function Bi({className:n,...a}){return o.jsx("div",{"data-slot":"alert-description",className:ke("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",n),...a})}function hf({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:ke("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 uy(n){const a=n.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function X2(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 Q2(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 $v({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),E=async()=>{v(null),c("validating");const P=uy(d),W=m.trim(),Q=await ev(P,W);Q.valid?(Rj({url:P,anonKey:W}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(v(Q.error||"Connection failed. Please check your credentials."),c("credentials"))},k=d?X2(d):{valid:!1},O=m?Q2(m):{valid:!1},q=d?uy(d):"",L=d&&!d.startsWith("http")&&k.valid;return o.jsx(ss,{open:a,onOpenChange:P=>{!P&&r&&n()},children:o.jsxs(rs,{className:"sm:max-w-md",onPointerDownOutside:P=>{r||P.preventDefault()},onEscapeKeyDown:P=>{r||P.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(hf,{className:"w-9 h-9"}),o.jsx(Na,{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(Li,{children:o.jsxs(Bi,{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(Ti,{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(F,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(F,{onClick:()=>c("credentials"),className:"flex-1",children:"Continue Setup"})]})]})]}),l==="credentials"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{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(Li,{variant:"destructive",children:[o.jsx(qi,{className:"h-4 w-4"}),o.jsx(Bi,{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(Ae,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:P=>{h(P.target.value),_(!0)},onBlur:()=>_(!0),className:x&&d?k.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),x&&d&&k.valid&&o.jsx(Qa,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),L&&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]})]}),x&&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(Ae,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:P=>{p(P.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(F,{variant:"outline",onClick:()=>c("welcome"),className:"flex-1",children:"Back"}),r&&o.jsx(F,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(F,{onClick:E,disabled:!k.valid||!O.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{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(ra,{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(Ea,{children:[o.jsx(Na,{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 Z2({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 F2{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 F2;function W2({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 He.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(ef,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(qi,{className:"w-4 h-4 text-red-500"});default:return o.jsx(xr,{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(Ea,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(gy,{className:"w-5 h-5 text-primary"}),o.jsx(Na,{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(zo,{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(pr,{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(pr,{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: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:g.details.raw_response})]})]})]})]},g.id))})]})})}const eN={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 tN(){const{state:n,actions:a,dispatch:r}=Tr(),{openTerminal:l}=rv(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState(""),[v,x]=w.useState(null),[_,S]=w.useState(null),[A,E]=w.useState({}),[k,O]=w.useState(null),[q,L]=w.useState(!1),[P,W]=w.useState(null),Q=w.useCallback(H=>{r({type:"ADD_EMAIL",payload:H}),H.ai_analysis?.priority==="High"?(br.playAlert(),ne.success("High Priority Email Processed!")):(br.playNotify(),ne.info("New email processed"))},[r]),Y=w.useCallback(H=>{r({type:"UPDATE_EMAIL",payload:H})},[r]),J=w.useCallback(H=>{Ie(n.emailsOffset)},[n.emailsOffset]),{isSubscribed:fe}=Z2({userId:n.user?.id,onInsert:Q,onUpdate:Y,onDelete:J,enabled:n.isAuthenticated});w.useEffect(()=>{n.isAuthenticated?Ie():d(!1)},[v,n.isAuthenticated]);const Ie=async(H=0)=>{d(!0),await a.fetchEmails({category:v||void 0,search:p||void 0,offset:H}),d(!1)},pe=async()=>{if(n.accounts.length===0){ne.warning("Please connect an email account first");return}l(),m(!0);const H=await a.triggerSync();m(!1),H?(br.playSuccess(),ne.success("Sync completed! Check your emails.")):ne.error("Sync failed. Check account status for details.")},ge=async(H,K)=>{if(K==="delete"&&k!==H.id){O(H.id);return}O(null),E(_e=>({..._e,[H.id]:K}));const Ee=await a.executeAction(H.id,K);E(_e=>{const N={..._e};return delete N[H.id],N}),Ee&&(ne.success(`Email ${K==="delete"?"deleted":K==="archive"?"archived":"updated"}`),K==="delete"&&Ie(n.emailsOffset))},et=()=>{O(null)},nt=H=>{H.preventDefault(),Ie()},Ue=H=>{const K=H==="next"?n.emailsOffset+20:Math.max(0,n.emailsOffset-20);Ie(K)},U=H=>{W(H),L(!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(Rd,{className:"w-5 h-5 text-primary"}),"Recent Analysis"]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(F,{onClick:pe,size:"sm",variant:"outline",className:"shadow-sm",disabled:h,children:[o.jsx(wr,{className:ke("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"]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[o.jsxs("form",{onSubmit:nt,className:"flex-1 flex gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Cw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Ae,{placeholder:"Search emails...",value:p,onChange:H=>g(H.target.value),className:"pl-9"})]}),o.jsx(F,{type:"submit",size:"sm",children:"Search"})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(F,{size:"sm",variant:v===null?"secondary":"ghost",onClick:()=>x(null),children:"All"}),["spam","client","newsletter","support"].map(H=>o.jsx(F,{size:"sm",variant:v===H?"secondary":"ghost",onClick:()=>x(H),className:"capitalize",children:H},H))]})]}),c?o.jsx(Xj,{}):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(Rd,{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(F,{onClick:()=>{l(),pe()},disabled:h,children:[o.jsx(wr,{className:ke("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[n.emails.map(H=>o.jsx(nN,{email:H,onAction:ge,onViewTrace:U,onSelect:()=>S(H),isSelected:_?.id===H.id,loadingAction:A[H.id],isDeletePending:k===H.id,onCancelDelete:et},H.id)),o.jsx(W2,{isOpen:q,onOpenChange:L,email:P}),n.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(F,{variant:"outline",size:"sm",onClick:()=>Ue("prev"),disabled:n.emailsOffset===0,children:[o.jsx(Rx,{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(F,{variant:"outline",size:"sm",onClick:()=>Ue("next"),disabled:n.emailsOffset+20>=n.emailsTotal,children:["Next",o.jsx(Mx,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[o.jsxs(Et,{className:ke("p-6 border-primary/20",fe?"bg-primary/5":"bg-muted/50"),children:[o.jsx("h3",{className:"font-semibold text-primary mb-1",children:"Realtime Sync"}),o.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:fe?"Live updates enabled":"Waiting for connection..."}),o.jsxs("div",{className:ke("flex items-center gap-2 text-[10px] font-mono w-fit px-2 py-1 rounded-full border",fe?"text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border-emerald-500/20":"text-yellow-600 dark:text-yellow-400 bg-yellow-500/10 border-yellow-500/20"),children:[o.jsx("div",{className:ke("w-1.5 h-1.5 rounded-full",fe?"bg-emerald-500 animate-pulse":"bg-yellow-500")}),fe?"CONNECTED":"DISCONNECTED"]})]}),o.jsx(aN,{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.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(H=>H.is_enabled).length})]})]})]}),_&&o.jsxs(Et,{className:"p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Email Details"}),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:_.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),o.jsx("p",{className:"font-medium",children:_.subject})]}),_.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:_.ai_analysis.summary})]}),_.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:_.ai_analysis.key_points.map((H,K)=>o.jsx("li",{children:H},K))})]}),_.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(Ow,{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:_.ai_analysis.draft_response}),o.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:["* This draft is already saved in your ",_.email_accounts?.provider==="gmail"?"Gmail":"Outlook"," Drafts folder."]})]})]})]})]})]})]})}function aN({accounts:n,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){const[h,m]=w.useState(null),[p,g]=w.useState(!1),v=async(x,_)=>{m(x),await a(x,_),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(Mw,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsxs("div",{className:"mb-6 p-3 bg-muted/30 rounded-lg space-y-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("label",{className:"text-[11px] font-medium flex items-center gap-1",children:"Sync Interval (min)"}),p&&o.jsx(ra,{className:"w-3 h-3 animate-spin text-primary"})]}),o.jsx(Ae,{type:"number",min:1,max:60,className:"h-8 text-xs",value:l?.sync_interval_minutes||5,onChange:async x=>{const _=parseInt(x.target.value,10)||5;g(!0),await c({sync_interval_minutes:_}),g(!1)}}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Background sync frequency for all accounts."})]}),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(ra,{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(qi,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(F,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{d(),r(x.id)},disabled:x.last_sync_status==="syncing",children:o.jsx(wr,{className:ke("w-3 h-3",x.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(F,{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(Ew,{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(jx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Ae,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:(()=>{if(x.sync_start_date)return x.sync_start_date.substring(0,16);if(x.last_sync_checkpoint)if(x.provider==="gmail")try{const _=parseInt(x.last_sync_checkpoint);if(!isNaN(_))return new Date(_).toISOString().substring(0,16)}catch{}else return x.last_sync_checkpoint.substring(0,16);return x.last_sync_at?x.last_sync_at.substring(0,16):""})(),onChange:_=>v(x.id,{sync_start_date:_.target.value?new Date(_.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(aw,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Ae,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:x.sync_max_emails_per_run||50,onChange:_=>v(x.id,{sync_max_emails_per_run:parseInt(_.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 nN({email:n,onAction:a,onViewTrace:r,onSelect:l,isSelected:c,loadingAction:d,isDeletePending:h,onCancelDelete:m}){if(!n)return null;const p=eN[n.category||"other"],g=!!d,v=()=>{if(!n.email_accounts)return"#";const{provider:x,email_address:_}=n.email_accounts;return x==="gmail"?`https://mail.google.com/mail/u/${_}/#all/${n.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(n.external_id)}`};return o.jsx(Et,{className:ke("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:ke("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:ke("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",p),children:n.category||"unknown"}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:n.date?new Date(n.date).toLocaleDateString():""})]})]}),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(Md,{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(x=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:x},x))}):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:x=>x.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(F,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(n,"delete"),disabled:g,children:d==="delete"?o.jsx(ra,{className:"w-3 h-3 animate-spin"}):"Yes"}),o.jsx(F,{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(Ti,{className:"w-3.5 h-3.5"})}),o.jsx(F,{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(Fx,{className:"w-3.5 h-3.5"})}),o.jsx(F,{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(ra,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(To,{className:"w-3.5 h-3.5"})}),o.jsx(F,{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(ra,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(bx,{className:"w-3.5 h-3.5"})}),o.jsx(F,{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(ra,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(ew,{className:"w-3.5 h-3.5"})})]})})]})]})})}function sN(){const{state:n,actions:a}=Tr(),[r,l]=w.useState(!1),[c,d]=w.useState(!1),[h,m]=w.useState(null),[p,g]=w.useState(!1),[v,x]=w.useState(!1),[_,S]=w.useState({}),[A,E]=w.useState(!1),[k,O]=w.useState("credentials"),[q,L]=w.useState(""),[P,W]=w.useState(""),[Q,Y]=w.useState(""),[J,fe]=w.useState(""),[Ie,pe]=w.useState(!1),[ge,et]=w.useState(!1),[nt,Ue]=w.useState(!1),[U,H]=w.useState("credentials"),[K,Ee]=w.useState(""),[_e,N]=w.useState(""),[I,X]=w.useState(!1),[Z,ce]=w.useState(!1),[ye,ue]=w.useState(""),[Ge,Le]=w.useState("category"),[Nt,yt]=w.useState("newsletter"),[Ot,Hi]=w.useState("archive"),[ia,os]=w.useState(""),[cs,Vi]=w.useState(""),[Ar,Rn]=w.useState([]),[en,us]=w.useState(!1),[Ii,Gi]=w.useState(!1),[mt,ds]=w.useState(null);w.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),w.useEffect(()=>{n.settings&&S(n.settings)},[n.settings]);const Pi=async()=>{const B=n.rules.find(re=>re.name==="Auto-Trash Spam");if(!B){ne.error("System rule not found. Please sync your database.");return}ds("auto_trash_spam"),await a.toggleRule(B.id),ds(null)},Ki=async()=>{const B=n.rules.find(re=>re.name==="Smart Drafts");if(!B){ne.error("System rule not found. Please sync your database.");return}ds("smart_drafts"),await a.toggleRule(B.id),ds(null)},fs=w.useRef(null),Go=()=>{O("credentials"),L(""),W(""),Y(""),fe(""),E(!0)},Yi=B=>{L(B);try{const re=JSON.parse(B),Ke=re.installed||re.web||re;Ke.client_id&&W(Ke.client_id),Ke.client_secret&&Y(Ke.client_secret),re.installed?ne.success("Detected Desktop app credentials"):re.web&&ne.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Po=async()=>{if(!P||!Q){ne.error("Please provide both Client ID and Client Secret");return}pe(!0);try{if(await a.updateSettings({..._,google_client_id:P,google_client_secret:Q})){S(Ke=>({...Ke,google_client_id:P,google_client_secret:Q}));const re=await He.getGmailAuthUrl();if(re.data?.url)window.open(re.data.url,"_blank"),O("code"),ne.success("Please authorize in the opened tab, then paste the code here");else{const Ke=typeof re.error=="string"?re.error:re.error?.message;ne.error(Ke||"Failed to get OAuth URL")}}else ne.error("Failed to save credentials")}catch{ne.error("Failed to save credentials")}finally{pe(!1)}},Ko=async()=>{if(!J.trim()){ne.error("Please paste the authorization code");return}et(!0);try{const B=await He.connectGmail(J.trim());if(B.data?.success)ne.success("Gmail account connected successfully!"),E(!1),a.fetchAccounts();else{const re=typeof B.error=="string"?B.error:B.error?.message;ne.error(re||"Failed to connect Gmail")}}catch{ne.error("Failed to connect Gmail")}finally{et(!1)}},Dn=()=>{H("credentials"),Ee(""),N(""),Ue(!0)},At=async()=>{if(!K){ne.error("Please provide the Client ID");return}X(!0);try{if(await a.updateSettings({..._,microsoft_client_id:K,microsoft_tenant_id:_e||"common"})){S(Ke=>({...Ke,microsoft_client_id:K,microsoft_tenant_id:_e||"common"}));const re=await He.startMicrosoftDeviceFlow();if(re.data)m(re.data),H("device-code"),pa(re.data.deviceCode,re.data.interval);else{const Ke=typeof re.error=="string"?re.error:re.error?.message;ne.error(Ke||"Failed to start device flow")}}else ne.error("Failed to save credentials")}catch{ne.error("Failed to save credentials")}finally{X(!1)}},pa=async(B,re)=>{const Ke=setInterval(async()=>{try{const ga=await He.pollMicrosoftDeviceCode(B);ga.data?.status==="completed"?(clearInterval(Ke),m(null),d(!1),Ue(!1),ne.success("Outlook account connected"),a.fetchAccounts()):ga.error&&typeof ga.error=="object"&&ga.error.code}catch{}},re*1e3);setTimeout(()=>{clearInterval(Ke),c&&(m(null),d(!1),Ue(!1),ne.error("Connection timed out. Please try again."))},900*1e3)},Ct=async()=>{if(!ye){ne.error("Please name your rule");return}Gi(!0);try{const B={[Ge]:Nt};ia&&(B.older_than_days=parseInt(ia,10)),await a.createRule({name:ye,condition:B,action:Ot,instructions:Ot==="draft"?cs:void 0,attachments:Ot==="draft"?Ar:[],is_enabled:!0})?(ne.success("Rule created"),ce(!1),ue(""),os(""),Vi(""),Rn([]),a.fetchRules()):ne.error("Failed to create rule")}catch{ne.error("Failed to create rule")}finally{Gi(!1)}},Yo=async B=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(B)&&ne.success("Account disconnected")},Ji=async()=>{g(!0);const B=await a.updateSettings(_);g(!1),B&&ne.success("Settings saved")},Jo=async()=>{x(!0);try{const B=await He.testLlm({llm_model:_.llm_model||null,llm_base_url:_.llm_base_url||null,llm_api_key:_.llm_api_key||null});B.data?.success?ne.success(B.data.message):ne.error(B.data?.message||"Connection test failed")}catch{ne.error("Failed to test connection")}finally{x(!1)}},hs=async B=>{await a.toggleRule(B)},ms=async B=>{const re=B.target.files;if(!re||re.length===0)return;us(!0);const Ke=re[0],ga=Ke.name.split(".").pop(),Cr=`${Math.random().toString(36).substring(2)}.${ga}`,tn=`${n.user.id}/${Cr}`;try{const{error:gs}=await ct.storage.from("rule-attachments").upload(tn,Ke);if(gs)throw gs;const Xi={name:Ke.name,path:tn,type:Ke.type,size:Ke.size};Rn(Qi=>[...Qi,Xi]),ne.success("File uploaded")}catch(gs){console.error("Upload error:",gs),ne.error("Failed to upload file")}finally{us(!1),B.target.value=""}},ps=B=>{Rn(re=>re.filter(Ke=>Ke.path!==B))},Aa=B=>B==="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:E,children:o.jsxs(rs,{className:"sm:max-w-lg",children:[o.jsxs(Ea,{children:[o.jsxs(Na,{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(Gw,{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:B=>Yi(B.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(Ae,{placeholder:"xxx.apps.googleusercontent.com",value:P,onChange:B=>W(B.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Ae,{type:"password",placeholder:"GOCSPX-...",value:Q,onChange:B=>Y(B.target.value)})]})]})]}),o.jsxs(mr,{children:[o.jsx(F,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),o.jsxs(F,{onClick:Po,disabled:Ie||!P||!Q,children:[Ie?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(Ae,{placeholder:"4/0AQlEd8x...",value:J,onChange:B=>fe(B.target.value),className:"font-mono"})]})]}),o.jsxs(mr,{children:[o.jsx(F,{variant:"outline",onClick:()=>O("credentials"),children:"Back"}),o.jsxs(F,{onClick:Ko,disabled:ge||!J.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:Ue,children:o.jsxs(rs,{className:"sm:max-w-lg",children:[o.jsxs(Ea,{children:[o.jsxs(Na,{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:U==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),U==="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(Ae,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:B=>Ee(B.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),o.jsx(Ae,{placeholder:"common",value:_e,onChange:B=>N(B.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(mr,{children:[o.jsx(F,{variant:"outline",onClick:()=>Ue(!1),children:"Cancel"}),o.jsxs(F,{onClick:At,disabled:I||!K,children:[I?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(F,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ti,{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(mr,{children:o.jsx(F,{variant:"outline",onClick:()=>Ue(!1),children:"Cancel"})})]})]})}),o.jsx(ss,{open:Z,onOpenChange:ce,children:o.jsxs(rs,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{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(Ae,{placeholder:"e.g. Archive Newsletters",value:ye,onChange:B=>ue(B.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:B=>{Le(B.target.value),B.target.value==="category"?yt("newsletter"):B.target.value==="sentiment"?yt("Positive"):B.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:Nt,onChange:B=>yt(B.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:Nt,onChange:B=>yt(B.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:Nt,onChange:B=>yt(B.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(Ae,{placeholder:Ge==="sender_domain"?"rta.vn":Ge==="sender_email"?"john@example.com":"Keywords...",value:Nt,onChange:B=>yt(B.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(zo,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ae,{type:"number",min:"0",placeholder:"0",className:"w-24",value:ia,onChange:B=>os(B.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"}),o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background",value:Ot,onChange:B=>Hi(B.target.value),children:[o.jsx("option",{value:"archive",children:"Archive Email"}),o.jsx("option",{value:"delete",children:"Delete Email"}),o.jsx("option",{value:"draft",children:"Draft Reply"}),o.jsx("option",{value:"read",children:"Mark as Read"}),o.jsx("option",{value:"star",children:"Star / Flag"})]})]}),Ot==="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:cs,onChange:B=>Vi(B.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(vg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[Ar.map(B=>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:B.name}),o.jsx(F,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>ps(B.path),children:o.jsx(Uo,{className:"w-3 h-3"})})]},B.path)),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:ms,disabled:en}),o.jsxs(F,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:en,children:[en?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(wi,{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(mr,{children:[o.jsx(F,{variant:"outline",onClick:()=>ce(!1),children:"Cancel"}),o.jsxs(F,{onClick:Ct,disabled:Ii,children:[Ii?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(wi,{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(No,{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(B=>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(B.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:B.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:B.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[B.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(F,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>Yo(B.id),children:o.jsx(To,{className:"w-4 h-4"})})]})]},B.id)),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(F,{className:"w-full border-dashed",variant:"outline",onClick:Go,disabled:r||c,children:[r?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(wi,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(F,{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(wi,{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(F,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ti,{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(Md,{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(F,{variant:n.rules.find(B=>B.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Pi,disabled:mt==="auto_trash_spam",children:[mt==="auto_trash_spam"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(fd,{className:"w-4 h-4 mr-1"}),n.rules.find(B=>B.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(F,{variant:n.rules.find(B=>B.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:Ki,disabled:mt==="smart_drafts",children:[mt==="smart_drafts"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(fd,{className:"w-4 h-4 mr-1"}),n.rules.find(B=>B.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(F,{variant:"ghost",size:"sm",onClick:()=>ce(!0),children:[o.jsx(wi,{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(B=>B.name!=="Auto-Trash Spam"&&B.name!=="Smart Drafts").map(B=>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:B.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["→ ",B.action]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(F,{variant:B.is_enabled?"default":"outline",size:"sm",onClick:()=>hs(B.id),className:"h-7 px-2",children:[o.jsx(fd,{className:"w-3.5 h-3.5 mr-1"}),B.is_enabled?"On":"Off"]}),o.jsx(F,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>a.deleteRule(B.id),children:o.jsx(To,{className:"w-3 h-3"})})]})]}),B.instructions&&o.jsxs("p",{className:"text-[10px] text-muted-foreground italic border-t border-border/50 pt-1 mt-1 truncate",children:['"',B.instructions,'"']}),B.attachments&&B.attachments.length>0&&o.jsx("div",{className:"flex gap-1 mt-1",children:B.attachments.map(re=>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(vg,{className:"w-2.5 h-2.5"}),re.name]},re.path))})]},B.id))]})]})]})]}),o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(wr,{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(Ae,{placeholder:"gpt-4o-mini",value:_.llm_model||"",onChange:B=>S(re=>({...re,llm_model:B.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Base URL"}),o.jsx(Ae,{placeholder:"https://api.openai.com/v1",value:_.llm_base_url||"",onChange:B=>S(re=>({...re,llm_base_url:B.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(Ae,{type:"password",placeholder:"sk-...",value:_.llm_api_key||"",onChange:B=>S(re=>({...re,llm_api_key:B.target.value}))})]})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(F,{variant:"outline",onClick:Jo,disabled:v,children:[v?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(wr,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(F,{onClick:Ji,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:fs,children:o.jsxs(Et,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(Md,{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(Ae,{type:"password",placeholder:"...apps.googleusercontent.com",value:_.google_client_id||"",onChange:B=>S(re=>({...re,google_client_id:B.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Ae,{type:"password",placeholder:"GOCSPX-...",value:_.google_client_secret||"",onChange:B=>S(re=>({...re,google_client_secret:B.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(Ae,{type:"password",value:_.microsoft_client_id||"",onChange:B=>S(re=>({...re,microsoft_client_id:B.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),o.jsx(Ae,{type:"password",value:_.microsoft_client_secret||"",onChange:B=>S(re=>({...re,microsoft_client_secret:B.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),o.jsx(Ae,{placeholder:"common",value:_.microsoft_tenant_id||"",onChange:B=>S(re=>({...re,microsoft_tenant_id:B.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(F,{onClick:Ji,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 rN="modulepreload",iN=function(n){return"/"+n},dy={},lN=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let g=function(v){return Promise.all(v.map(x=>Promise.resolve(x).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};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=iN(v),v in dy)return;dy[v]=!0;const x=v.endsWith(".css"),_=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${_}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":rN,x||(S.as="script"),S.crossOrigin="",S.href=v,p&&S.setAttribute("nonce",p),document.head.appendChild(S),x)return new Promise((A,E)=>{S.addEventListener("load",A),S.addEventListener("error",()=>E(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 oN(){const[n,a]=w.useState("profile"),{state:r,actions:l}=Tr();w.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:yy},{id:"security",label:"Security",icon:Lw},{id:"database",label:"Supabase",icon:No}];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(cN,{}),n==="security"&&o.jsx(uN,{}),n==="database"&&o.jsx(dN,{})]})]})]})}function cN(){const{state:n,actions:a}=Tr(),[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(!1),[p,g]=w.useState(!1),[v,x]=w.useState(br.isEnabled());w.useEffect(()=>{n.profile&&(l(n.profile.first_name||""),d(n.profile.last_name||""))},[n.profile]);const _=()=>{const E=!v;br.setEnabled(E),x(E),E?(br.playSuccess(),ne.success("Sound effects enabled")):ne.info("Sound effects disabled")},S=async()=>{m(!0);const E=await a.updateProfile({first_name:r,last_name:c});m(!1),E&&ne.success("Profile updated")},A=async E=>{const k=E.target.files?.[0];if(!(!k||!n.user)){g(!0);try{const O=k.name.split(".").pop(),q=`${n.user.id}/avatar.${O}`,{data:L,error:P}=await ct.storage.from("avatars").upload(q,k,{upsert:!0});if(P)throw P;const{data:{publicUrl:W}}=ct.storage.from("avatars").getPublicUrl(q);await a.updateProfile({avatar_url:W}),ne.success("Avatar updated")}catch(O){console.error("Avatar upload error:",O),ne.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(yy,{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(Nx,{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(Ae,{id:"first-name",value:r,onChange:E=>l(E.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Ae,{id:"last-name",value:c,onChange:E=>d(E.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"email",children:"Email Address"}),o.jsx(Ae,{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(F,{variant:v?"default":"outline",size:"sm",onClick:_,className:"gap-2",children:[v?o.jsx(Xw,{className:"w-4 h-4"}):o.jsx(Zw,{className:"w-4 h-4"}),v?"Enabled":"Disabled"]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(F,{onClick:S,disabled:h,children:[h?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Tw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function uN(){const[n,a]=w.useState(""),[r,l]=w.useState(""),[c,d]=w.useState(!1),h=async()=>{if(!n){ne.error("Please enter a new password");return}if(n!==r){ne.error("Passwords do not match");return}if(n.length<6){ne.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await lN(async()=>{const{api:g}=await Promise.resolve().then(()=>Lj);return{api:g}},void 0),p=await m.changePassword(n);p.success?(ne.success("Password changed successfully"),a(""),l("")):ne.error(p.error?.message||"Failed to change password")}catch{ne.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(Ae,{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(Ae,{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(F,{onClick:h,disabled:c,children:[c?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(lw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function dN(){const[n,a]=w.useState(!1),r=Nr(),l=Mj(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(Dj(),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(No,{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(Li,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(Dd,{className:"h-4 w-4 text-amber-500"}),o.jsx(Bi,{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(F,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[o.jsx(Dd,{className:"w-4 h-4 mr-2"}),"Change Connection"]}),l==="ui"&&o.jsxs(F,{variant:"outline",onClick:c,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(To,{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(Ix,{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(F,{onClick:()=>a(!0),children:[o.jsx(No,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx($v,{open:n,onComplete:()=>a(!1),canClose:!0})]})}function fN({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=(_,S)=>{const A=S.replace(/[^0-9]/g,"");if(A.length===0){const O=a.split("");O[_]=" ",a.split("");let q=a.split("");_<q.length&&q.splice(_,1);const L=q.join("");r(L),_>0&&h.current[_-1]?.focus();return}a.split("");const E=[...a];E[_]=A[0],r(E.join("")),_<n-1&&h.current[_+1]?.focus();const k=E.join("");k.length===n&&l&&l(k)},v=(_,S)=>{S.key==="Backspace"&&!a[_]&&_>0||S.key==="ArrowLeft"&&_>0?h.current[_-1]?.focus():S.key==="ArrowRight"&&_<n-1&&h.current[_+1]?.focus()},x=_=>{_.preventDefault();const A=_.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,n);r(A);const E=Math.min(A.length,n-1);h.current[E]?.focus(),A.length===n&&l&&l(A)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:n}).map((_,S)=>o.jsx(Ae,{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:x,onFocus:()=>p(S),onBlur:()=>p(null),disabled:c,className:ke("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 hN({onSuccess:n,onConfigure:a}){const[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(""),[p,g]=w.useState(""),[v,x]=w.useState(!1),[_,S]=w.useState(!0),[A,E]=w.useState(!1),[k,O]=w.useState(""),[q,L]=w.useState("password"),[P,W]=w.useState("email"),[Q,Y]=w.useState("");w.useEffect(()=>{J()},[]);const J=async()=>{try{const{data:pe,error:ge}=await ct.from("init_state").select("is_initialized");if(ge){console.warn("[Login] Init check failed, defaulting to initialized (Login):",ge),E(!0);return}const et=pe?.[0]?.is_initialized>0;E(et)}catch(pe){if(console.warn("[Login] Init check exception, defaulting to initialized:",pe),pe.message?.includes("Invalid API key")||pe.status===401){console.warn("[Login] API Key invalid for REST check (likely Publishable Key). defaulting to Setup Mode (isInitialized=false)."),E(!1);return}E(!0)}finally{S(!1)}},fe=async pe=>{pe.preventDefault(),x(!0),O("");try{if(A){if(q==="password"){const{error:ge}=await ct.auth.signInWithPassword({email:r,password:c});if(ge)throw ge;ne.success("Logged in successfully"),n?.()}else if(P==="email"){const{error:ge}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(ge)throw ge;W("verify"),ne.success("Validation code sent to your email")}}else{const{data:ge,error:et}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:p}});if(et||!ge){if(et?.message?.includes("First user already exists")){ne.info("System already initialized. Please log in."),E(!0);return}throw new Error(et?.message||"Failed to create admin account")}ne.success("Admin account created! Signing you in...");const{error:nt}=await ct.auth.signInWithPassword({email:r,password:c});if(nt)throw nt;E(!0),n?.()}}catch(ge){O(ge?.message||"Authentication failed"),console.error("[Login] Error:",ge)}finally{x(!1)}},Ie=async()=>{x(!0),O("");try{const{data:pe,error:ge}=await ct.auth.verifyOtp({email:r,token:Q,type:"magiclink"});if(ge)throw ge;if(!pe.session)throw new Error("Failed to create session");ne.success("Logged in successfully"),n?.()}catch(pe){O(pe?.message||"Invalid code")}finally{x(!1)}};return _?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx(ra,{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(Uy,{})}),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(hf,{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":P==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:fe,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(Ae,{value:h,onChange:pe=>m(pe.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(Ae,{value:p,onChange:pe=>g(pe.target.value),required:!A,placeholder:"Doe"})]})]}),q==="password"||P==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Ae,{type:"email",placeholder:"admin@example.com",value:r,onChange:pe=>l(pe.target.value),required:!0,autoComplete:"email",disabled:P==="verify"})]}):null,q==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Ae,{type:"password",placeholder:"••••••••",value:c,onChange:pe=>d(pe.target.value),required:!0,minLength:6,autoComplete:A?"current-password":"new-password"})]}),q==="otp"&&P==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(fN,{value:Q,onChange:Y,length:6,onComplete:()=>{}})}),o.jsx(F,{type:"button",variant:"link",className:"w-full text-xs text-muted-foreground",onClick:()=>W("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(F,{type:"button",variant:"outline",className:"w-full border-destructive/50 hover:bg-destructive/20 text-destructive",onClick:a,children:"Update Connection Settings"})]})]}),o.jsxs(iv,{className:"flex flex-col gap-3",children:[q==="otp"&&P==="verify"?o.jsx(F,{type:"button",onClick:Ie,disabled:v||Q.length!==6,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx(ra,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify Code"}):o.jsx(F,{type:"submit",disabled:v||!r||q==="password"&&!c,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx(ra,{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(Rd,{className:"w-4 h-4 mr-2"}):o.jsx(fw,{className:"w-4 h-4 mr-2"}):o.jsx(Kw,{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(F,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{L("otp"),W("email"),O("")},children:[o.jsx(rw,{className:"w-4 h-4 mr-2"}),"Sign in with Code"]}):o.jsxs(F,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{L("password"),O("")},children:[o.jsx(wx,{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 Hv=void 0,mN=void 0;function pN(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 gN(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:Hv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function yN(n){const a=Hv,r=mN,l=await gN(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=pN(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 Vv="email_automator_migration_reminder_dismissed_at";function vN(n=24){try{const a=localStorage.getItem(Vv);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 bN(){try{localStorage.setItem(Vv,new Date().toISOString())}catch(n){console.error("Error dismissing migration reminder:",n)}}function xN({status:n,onDismiss:a,onLearnMore:r}){const[l,c]=w.useState(!0);if(!l)return null;const d=()=>{bN(),c(!1),a?.()},h=()=>{r?r():(navigator.clipboard.writeText("npx email-automator migrate"),ne.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(_r,{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(F,{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(Uo,{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(F,{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(F,{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 _o({code:n,label:a}){const[r,l]=w.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){ne.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(n),l(!0),window.setTimeout(()=>l(!1),2e3),ne.success("Copied to clipboard")}catch(h){console.error("Failed to copy:",h),ne.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(F,{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(Yx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function wN({open:n,onOpenChange:a,status:r}){const l=Nr(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState([]),[v,x]=w.useState(""),[_,S]=w.useState(""),A=w.useRef(null),E=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(!E){ne.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:E,dbPassword:v,accessToken:_})});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 L=new TextDecoder;for(;;){const{done:P,value:W}=await q.read();if(P)break;const Y=L.decode(W).split(`
96
- `).filter(Boolean);g(J=>[...J,...Y])}}catch(O){console.error(O),g(q=>[...q,`Error: ${O instanceof Error?O.message:String(O)}`]),ne.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(Ea,{children:[o.jsxs(Na,{className:"flex items-center gap-2 text-xl",children:[o.jsx(_r,{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(Li,{children:[o.jsx(xr,{className:"h-4 w-4"}),o.jsxs(Bi,{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(Ae,{id:"project-id",value:E,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(Ti,{className:"h-3 w-3"})]})]}),o.jsx(Ae,{id:"access-token",type:"password",placeholder:"sbp_...",value:_,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(Ae,{id:"db-password",type:"password",placeholder:"Your database password",value:v,onChange:O=>x(O.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Required if no access token is provided."})]}),o.jsx(F,{onClick:k,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx(ra,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(zd,{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:E||"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(_o,{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(_o,{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(_o,{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(_o,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Li,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(_r,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(Bi,{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(mr,{children:o.jsx(F,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function _N(){const[n,a]=w.useState([]),{isExpanded:r,setIsExpanded:l}=rv(),[c,d]=w.useState({});w.useEffect(()=>{h();const v=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},x=>{const _=x.new;_.event_type==="error"&&d(S=>({...S,[_.id]:!0})),a(S=>{const A=[_,...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(x=>({...x,[v]:!x[v]}))},p=v=>{switch(v){case"analysis":return o.jsx(ef,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(_r,{className:"w-3 h-3 text-red-500"});default:return o.jsx(xr,{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(zd,{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(yx,{className:"w-3 h-3"}),"LIVE"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(F,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:"Clear"}),o.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:o.jsx(yw,{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,x)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[x!==n.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:ke("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:ke("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(F,{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(Ux,{className:"w-3 h-3 mr-1"}):o.jsx(kx,{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:ke("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(_=>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(Ao,{className:"w-2.5 h-2.5"}),_]},_))})]}):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(xr,{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: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(pr,{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(pr,{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(pr,{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(pr,{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:v.details.raw_response})})]})]})]})]},v.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(F,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx(zd,{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 SN(){const{state:n,actions:a}=Tr(),[r,l]=w.useState(!1),[c,d]=w.useState("dashboard"),[h,m]=w.useState(!0),[p,g]=w.useState(!1);if(w.useEffect(()=>{const Q=new URLSearchParams(window.location.search).get("code");Q&&!p&&(async()=>{g(!0);try{const J=await He.connectGmail(Q);if(J.data?.success)ne.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),a.fetchAccounts());else{const fe=typeof J.error=="string"?J.error:J.error?.message;ne.error(fe||"Failed to connect Gmail")}}catch{ne.error("Connection failed")}finally{g(!1)}})()},[]),p)return o.jsx(Ni,{text:"Connecting account..."});const[v,x]=w.useState(null),[_,S]=w.useState(!1),[A,E]=w.useState(!1),[k,O]=w.useState(!1);w.useEffect(()=>{(async()=>{const Q=Nr();if(!Q){l(!0),m(!1);return}if((await ev(Q.url,Q.anonKey)).valid)n.isInitialized&&n.isAuthenticated&&(a.fetchAccounts(),a.fetchRules(),a.fetchSettings(),a.fetchProfile(),yN(ct).then(J=>{x(J),J.needsMigration&&!vN()&&S(!0)}));else{l(!0),m(!1);return}m(!1)})()},[n.isInitialized,n.isAuthenticated]);const q=()=>{E(!0),S(!1)},L={migrationStatus:v,showMigrationBanner:_,showMigrationModal:A,openMigrationModal:q,suppressMigrationBanner:k,setSuppressMigrationBanner:O};if(h)return o.jsx(Ni,{text:"Checking configuration..."});if(r)return o.jsx($v,{onComplete:()=>{l(!1),window.location.reload()}});if(!n.isInitialized)return o.jsx(Ni,{text:"Initializing..."});if(!n.isAuthenticated)return o.jsx(hN,{onConfigure:()=>l(!0)});const P=async()=>{await ct.auth.signOut(),ne.success("Logged out successfully")};return o.jsx(Hj,{value:L,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.jsx("div",{className:"flex items-center gap-4",children:o.jsxs("button",{onClick:()=>d("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(hf,{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:"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(F,{variant:c==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>d("dashboard"),className:"gap-2",children:[o.jsx(cw,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),o.jsxs(F,{variant:c==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>d("analytics"),className:"gap-2",children:[o.jsx(py,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),o.jsxs(F,{variant:c==="config"?"secondary":"ghost",size:"sm",onClick:()=>d("config"),className:"gap-2",children:[o.jsx(Dd,{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(Uy,{}),o.jsx(F,{variant:c==="account"?"secondary":"ghost",size:"sm",onClick:()=>d("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(Hx,{className:"w-5 h-5"})}),o.jsx(F,{variant:"ghost",size:"sm",onClick:P,className:"text-muted-foreground hover:text-foreground",title:"Sign out",children:o.jsx(mw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4",children:[c==="dashboard"&&o.jsx(tN,{}),c==="config"&&o.jsx(sN,{}),c==="analytics"&&o.jsx(EN,{}),c==="account"&&o.jsx(oN,{})]}),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})})}),v&&_&&!k&&o.jsx(xN,{status:v,onDismiss:()=>S(!1),onLearnMore:q}),v&&o.jsx(wN,{open:A,onOpenChange:E,status:v}),o.jsx(_N,{})]})})}function jN({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 He.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(ef,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(qi,{className:"w-4 h-4 text-red-500"});default:return o.jsx(xr,{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(Ea,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(gy,{className:"w-5 h-5 text-primary"}),o.jsx(Na,{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(Ni,{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,x)=>o.jsxs("div",{className:"relative pl-8",children:[x!==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(zo,{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(_=>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:_},_))]})]}),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 EN(){const{state:n,actions:a}=Tr(),[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(Ni,{text:"Loading analytics..."});const p=(v,x)=>{l(v),d(x),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(py,{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(So,{title:"Total Emails",value:g.totalEmails,color:"primary"}),o.jsx(So,{title:"Spam Caught",value:g.categoryCounts.spam||0,color:"destructive"}),o.jsx(So,{title:"Actions Taken",value:Object.values(g.actionCounts).reduce((v,x)=>v+x,0)-(g.actionCounts.none||0),color:"emerald"}),o.jsx(So,{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,x])=>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:x})]}),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:`${x/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,x])=>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:x})]},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 x=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:ke("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(zo,{className:"w-3 h-3"}),new Date(v.started_at).toLocaleString(),x!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[x,"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(jN,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function So({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 NN(){return o.jsx(t_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(Ij,{children:o.jsx(Vj,{children:o.jsxs(qj,{children:[o.jsx(SN,{}),o.jsx(Jj,{})]})})})})}ux.createRoot(document.getElementById("root")).render(o.jsx(fy.StrictMode,{children:o.jsx(NN,{})}));
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},D2="DialogDescriptionWarning",M2=({contentRef:n,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Bv(D2).contentName}}.`;return w.useEffect(()=>{const c=n.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,n,a]),null},z2=Ev,U2=Av,L2=Cv,B2=kv,q2=Rv,$2=Mv,H2=Uv;function ss({...n}){return o.jsx(z2,{"data-slot":"dialog",...n})}function V2({...n}){return o.jsx(U2,{"data-slot":"dialog-portal",...n})}function I2({className:n,...a}){return o.jsx(L2,{"data-slot":"dialog-overlay",className:ke("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(V2,{"data-slot":"dialog-portal",children:[o.jsx(I2,{}),o.jsxs(B2,{"data-slot":"dialog-content",className:ke("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(H2,{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(Uo,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ea({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:ke("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:ke("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...a})}function Na({className:n,...a}){return o.jsx(q2,{"data-slot":"dialog-title",className:ke("text-lg leading-none font-semibold",n),...a})}function Ta({className:n,...a}){return o.jsx($2,{"data-slot":"dialog-description",className:ke("text-muted-foreground text-sm",n),...a})}const Ae=w.forwardRef(({className:n,type:a,...r},l)=>o.jsx("input",{type:a,className:ke("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}));Ae.displayName="Input";var G2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],P2=G2.reduce((n,a)=>{const r=xy(`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}},{}),K2="Label",qv=w.forwardRef((n,a)=>o.jsx(P2.label,{...n,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(n.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));qv.displayName=K2;var Y2=qv;function ha({className:n,...a}){return o.jsx(Y2,{"data-slot":"label",className:ke("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 J2=Sy("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 Bi({className:n,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:ke(J2({variant:a}),n),...r})}function qi({className:n,...a}){return o.jsx("div",{"data-slot":"alert-description",className:ke("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",n),...a})}function hf({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:ke("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 uy(n){const a=n.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function X2(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 Q2(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 $v({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),E=async()=>{v(null),c("validating");const P=uy(d),W=m.trim(),Q=await ev(P,W);Q.valid?(Rj({url:P,anonKey:W}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(v(Q.error||"Connection failed. Please check your credentials."),c("credentials"))},k=d?X2(d):{valid:!1},O=m?Q2(m):{valid:!1},q=d?uy(d):"",B=d&&!d.startsWith("http")&&k.valid;return o.jsx(ss,{open:a,onOpenChange:P=>{!P&&r&&n()},children:o.jsxs(rs,{className:"sm:max-w-md",onPointerDownOutside:P=>{r||P.preventDefault()},onEscapeKeyDown:P=>{r||P.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(hf,{className:"w-9 h-9"}),o.jsx(Na,{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(Bi,{children:o.jsxs(qi,{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(Ai,{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(F,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(F,{onClick:()=>c("credentials"),className:"flex-1",children:"Continue Setup"})]})]})]}),l==="credentials"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{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(Bi,{variant:"destructive",children:[o.jsx($i,{className:"h-4 w-4"}),o.jsx(qi,{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(Ae,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:P=>{h(P.target.value),_(!0)},onBlur:()=>_(!0),className:x&&d?k.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),x&&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]})]}),x&&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(Ae,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:P=>{p(P.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(F,{variant:"outline",onClick:()=>c("welcome"),className:"flex-1",children:"Back"}),r&&o.jsx(F,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(F,{onClick:E,disabled:!k.valid||!O.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{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(ra,{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(Ea,{children:[o.jsx(Na,{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 Z2({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 F2{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 xr=new F2;function W2({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(ef,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx($i,{className:"w-4 h-4 text-red-500"});default:return o.jsx(wr,{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(Ea,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(gy,{className:"w-5 h-5 text-primary"}),o.jsx(Na,{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(zo,{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: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:g.details.raw_response})]})]})]})]},g.id))})]})})}const eN={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 tN(){const{state:n,actions:a,dispatch:r}=Ar(),{openTerminal:l}=rv(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState(""),[v,x]=w.useState(null),[_,S]=w.useState(null),[A,E]=w.useState({}),[k,O]=w.useState(null),[q,B]=w.useState(!1),[P,W]=w.useState(null),Q=w.useCallback(H=>{r({type:"ADD_EMAIL",payload:H}),H.ai_analysis?.priority==="High"?(xr.playAlert(),se.success("High Priority Email Processed!")):(xr.playNotify(),se.info("New email processed"))},[r]),Y=w.useCallback(H=>{r({type:"UPDATE_EMAIL",payload:H})},[r]),J=w.useCallback(H=>{Ge(n.emailsOffset)},[n.emailsOffset]),{isSubscribed:fe}=Z2({userId:n.user?.id,onInsert:Q,onUpdate:Y,onDelete:J,enabled:n.isAuthenticated});w.useEffect(()=>{n.isAuthenticated?Ge():d(!1)},[v,n.isAuthenticated]);const Ge=async(H=0)=>{d(!0),await a.fetchEmails({category:v||void 0,search:p||void 0,offset:H}),d(!1)},pe=async()=>{if(n.accounts.length===0){se.warning("Please connect an email account first");return}l(),m(!0);const H=await a.triggerSync();m(!1),H?(xr.playSuccess(),se.success("Sync completed! Check your emails.")):se.error("Sync failed. Check account status for details.")},ge=async(H,K)=>{if(K==="delete"&&k!==H.id){O(H.id);return}O(null),E(_e=>({..._e,[H.id]:K}));const Ee=await a.executeAction(H.id,K);E(_e=>{const N={..._e};return delete N[H.id],N}),Ee&&(se.success(`Email ${K==="delete"?"deleted":K==="archive"?"archived":"updated"}`),K==="delete"&&Ge(n.emailsOffset))},et=()=>{O(null)},nt=H=>{H.preventDefault(),Ge()},Le=H=>{const K=H==="next"?n.emailsOffset+20:Math.max(0,n.emailsOffset-20);Ge(K)},L=H=>{W(H),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(Rd,{className:"w-5 h-5 text-primary"}),"Recent Analysis"]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(F,{onClick:pe,size:"sm",variant:"outline",className:"shadow-sm",disabled:h,children:[o.jsx(_r,{className:ke("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"]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[o.jsxs("form",{onSubmit:nt,className:"flex-1 flex gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Cw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Ae,{placeholder:"Search emails...",value:p,onChange:H=>g(H.target.value),className:"pl-9"})]}),o.jsx(F,{type:"submit",size:"sm",children:"Search"})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(F,{size:"sm",variant:v===null?"secondary":"ghost",onClick:()=>x(null),children:"All"}),["spam","client","newsletter","support"].map(H=>o.jsx(F,{size:"sm",variant:v===H?"secondary":"ghost",onClick:()=>x(H),className:"capitalize",children:H},H))]})]}),c?o.jsx(Xj,{}):n.emails.length===0?o.jsxs(Nt,{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(Rd,{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(F,{onClick:()=>{l(),pe()},disabled:h,children:[o.jsx(_r,{className:ke("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[n.emails.map(H=>o.jsx(nN,{email:H,onAction:ge,onViewTrace:L,onSelect:()=>S(H),isSelected:_?.id===H.id,loadingAction:A[H.id],isDeletePending:k===H.id,onCancelDelete:et},H.id)),o.jsx(W2,{isOpen:q,onOpenChange:B,email:P}),n.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(F,{variant:"outline",size:"sm",onClick:()=>Le("prev"),disabled:n.emailsOffset===0,children:[o.jsx(Rx,{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(F,{variant:"outline",size:"sm",onClick:()=>Le("next"),disabled:n.emailsOffset+20>=n.emailsTotal,children:["Next",o.jsx(Mx,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[o.jsxs(Nt,{className:ke("p-6 border-primary/20",fe?"bg-primary/5":"bg-muted/50"),children:[o.jsx("h3",{className:"font-semibold text-primary mb-1",children:"Realtime Sync"}),o.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:fe?"Live updates enabled":"Waiting for connection..."}),o.jsxs("div",{className:ke("flex items-center gap-2 text-[10px] font-mono w-fit px-2 py-1 rounded-full border",fe?"text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border-emerald-500/20":"text-yellow-600 dark:text-yellow-400 bg-yellow-500/10 border-yellow-500/20"),children:[o.jsx("div",{className:ke("w-1.5 h-1.5 rounded-full",fe?"bg-emerald-500 animate-pulse":"bg-yellow-500")}),fe?"CONNECTED":"DISCONNECTED"]})]}),o.jsx(aN,{accounts:n.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:n.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(Nt,{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(H=>H.is_enabled).length})]})]})]}),_&&o.jsxs(Nt,{className:"p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Email Details"}),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:_.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),o.jsx("p",{className:"font-medium",children:_.subject})]}),_.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:_.ai_analysis.summary})]}),_.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:_.ai_analysis.key_points.map((H,K)=>o.jsx("li",{children:H},K))})]}),_.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(Ow,{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:_.ai_analysis.draft_response}),o.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:["* This draft is already saved in your ",_.email_accounts?.provider==="gmail"?"Gmail":"Outlook"," Drafts folder."]})]})]})]})]})]})]})}function aN({accounts:n,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){const[h,m]=w.useState(null),[p,g]=w.useState(!1),v=async(x,_)=>{m(x),await a(x,_),m(null)};return n.length===0?null:o.jsxs(Nt,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(Mw,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsxs("div",{className:"mb-6 p-3 bg-muted/30 rounded-lg space-y-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("label",{className:"text-[11px] font-medium flex items-center gap-1",children:"Sync Interval (min)"}),p&&o.jsx(ra,{className:"w-3 h-3 animate-spin text-primary"})]}),o.jsx(Ae,{type:"number",min:1,max:60,className:"h-8 text-xs",value:l?.sync_interval_minutes||5,onChange:async x=>{const _=parseInt(x.target.value,10)||5;g(!0),await c({sync_interval_minutes:_}),g(!1)}}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Background sync frequency for all accounts."})]}),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(ra,{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($i,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(F,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{d(),r(x.id)},disabled:x.last_sync_status==="syncing",children:o.jsx(_r,{className:ke("w-3 h-3",x.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(F,{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(Ew,{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(jx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Ae,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:(()=>{if(x.sync_start_date)return x.sync_start_date.substring(0,16);if(x.last_sync_checkpoint)if(x.provider==="gmail")try{const _=parseInt(x.last_sync_checkpoint);if(!isNaN(_))return new Date(_).toISOString().substring(0,16)}catch{}else return x.last_sync_checkpoint.substring(0,16);return x.last_sync_at?x.last_sync_at.substring(0,16):""})(),onChange:_=>v(x.id,{sync_start_date:_.target.value?new Date(_.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(aw,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Ae,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:x.sync_max_emails_per_run||50,onChange:_=>v(x.id,{sync_max_emails_per_run:parseInt(_.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 nN({email:n,onAction:a,onViewTrace:r,onSelect:l,isSelected:c,loadingAction:d,isDeletePending:h,onCancelDelete:m}){if(!n)return null;const p=eN[n.category||"other"],g=!!d,v=()=>{if(!n.email_accounts)return"#";const{provider:x,email_address:_}=n.email_accounts;return x==="gmail"?`https://mail.google.com/mail/u/${_}/#all/${n.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(n.external_id)}`};return o.jsx(Nt,{className:ke("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:ke("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:ke("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",p),children:n.category||"unknown"}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:n.date?new Date(n.date).toLocaleDateString():""})]})]}),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(Md,{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(x=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:x},x))}):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:x=>x.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(F,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(n,"delete"),disabled:g,children:d==="delete"?o.jsx(ra,{className:"w-3 h-3 animate-spin"}):"Yes"}),o.jsx(F,{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(Ai,{className:"w-3.5 h-3.5"})}),o.jsx(F,{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(Fx,{className:"w-3.5 h-3.5"})}),o.jsx(F,{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(ra,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(To,{className:"w-3.5 h-3.5"})}),o.jsx(F,{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(ra,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(bx,{className:"w-3.5 h-3.5"})}),o.jsx(F,{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(ra,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(ew,{className:"w-3.5 h-3.5"})})]})})]})]})})}function sN(){const{state:n,actions:a}=Ar(),[r,l]=w.useState(!1),[c,d]=w.useState(!1),[h,m]=w.useState(null),[p,g]=w.useState(!1),[v,x]=w.useState(!1),[_,S]=w.useState({}),[A,E]=w.useState(!1),[k,O]=w.useState("credentials"),[q,B]=w.useState(""),[P,W]=w.useState(""),[Q,Y]=w.useState(""),[J,fe]=w.useState(""),[Ge,pe]=w.useState(!1),[ge,et]=w.useState(!1),[nt,Le]=w.useState(!1),[L,H]=w.useState("credentials"),[K,Ee]=w.useState(""),[_e,N]=w.useState(""),[I,X]=w.useState(!1),[Z,ce]=w.useState(!1),[ye,ue]=w.useState(""),[Pe,Be]=w.useState("category"),[Tt,yt]=w.useState("newsletter"),[vt,os]=w.useState(["archive"]),[ia,cs]=w.useState(""),[us,Vi]=w.useState(""),[Cr,Rn]=w.useState([]),[en,ds]=w.useState(!1),[Ii,Gi]=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 Pi=async()=>{const z=n.rules.find(ne=>ne.name==="Auto-Trash Spam");if(!z){se.error("System rule not found. Please sync your database.");return}fs("auto_trash_spam"),await a.toggleRule(z.id),fs(null)},Ki=async()=>{const z=n.rules.find(ne=>ne.name==="Smart Drafts");if(!z){se.error("System rule not found. Please sync your database.");return}fs("smart_drafts"),await a.toggleRule(z.id),fs(null)},hs=w.useRef(null),Go=()=>{O("credentials"),B(""),W(""),Y(""),fe(""),E(!0)},Yi=z=>{B(z);try{const ne=JSON.parse(z),De=ne.installed||ne.web||ne;De.client_id&&W(De.client_id),De.client_secret&&Y(De.client_secret),ne.installed?se.success("Detected Desktop app credentials"):ne.web&&se.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Po=async()=>{if(!P||!Q){se.error("Please provide both Client ID and Client Secret");return}pe(!0);try{if(await a.updateSettings({..._,google_client_id:P,google_client_secret:Q})){S(De=>({...De,google_client_id:P,google_client_secret:Q}));const ne=await Ve.getGmailAuthUrl();if(ne.data?.url)window.open(ne.data.url,"_blank"),O("code"),se.success("Please authorize in the opened tab, then paste the code here");else{const De=typeof ne.error=="string"?ne.error:ne.error?.message;se.error(De||"Failed to get OAuth URL")}}else se.error("Failed to save credentials")}catch{se.error("Failed to save credentials")}finally{pe(!1)}},Ko=async()=>{if(!J.trim()){se.error("Please paste the authorization code");return}et(!0);try{const z=await Ve.connectGmail(J.trim());if(z.data?.success)se.success("Gmail account connected successfully!"),E(!1),a.fetchAccounts();else{const ne=typeof z.error=="string"?z.error:z.error?.message;se.error(ne||"Failed to connect Gmail")}}catch{se.error("Failed to connect Gmail")}finally{et(!1)}},Dn=()=>{H("credentials"),Ee(""),N(""),Le(!0)},Ct=async()=>{if(!K){se.error("Please provide the Client ID");return}X(!0);try{if(await a.updateSettings({..._,microsoft_client_id:K,microsoft_tenant_id:_e||"common"})){S(De=>({...De,microsoft_client_id:K,microsoft_tenant_id:_e||"common"}));const ne=await Ve.startMicrosoftDeviceFlow();if(ne.data)m(ne.data),H("device-code"),pa(ne.data.deviceCode,ne.data.interval);else{const De=typeof ne.error=="string"?ne.error:ne.error?.message;se.error(De||"Failed to start device flow")}}else se.error("Failed to save credentials")}catch{se.error("Failed to save credentials")}finally{X(!1)}},pa=async(z,ne)=>{const De=setInterval(async()=>{try{const ga=await Ve.pollMicrosoftDeviceCode(z);ga.data?.status==="completed"?(clearInterval(De),m(null),d(!1),Le(!1),se.success("Outlook account connected"),a.fetchAccounts()):ga.error&&typeof ga.error=="object"&&ga.error.code}catch{}},ne*1e3);setTimeout(()=>{clearInterval(De),c&&(m(null),d(!1),Le(!1),se.error("Connection timed out. Please try again."))},900*1e3)},kt=async()=>{if(!ye){se.error("Please name your rule");return}if(vt.length===0){se.error("Please select at least one action");return}Gi(!0);try{const z={[Pe]:Tt};ia&&(z.older_than_days=parseInt(ia,10));const ne=vt.includes("draft");await a.createRule({name:ye,condition:z,actions:vt,instructions:ne?us:void 0,attachments:ne?Cr:[],is_enabled:!0})?(se.success("Rule created"),ce(!1),ue(""),os(["archive"]),cs(""),Vi(""),Rn([]),a.fetchRules()):se.error("Failed to create rule")}catch{se.error("Failed to create rule")}finally{Gi(!1)}},Yo=async z=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(z)&&se.success("Account disconnected")},Ji=async()=>{g(!0);const z=await a.updateSettings(_);g(!1),z&&se.success("Settings saved")},Jo=async()=>{x(!0);try{const z=await Ve.testLlm({llm_model:_.llm_model||null,llm_base_url:_.llm_base_url||null,llm_api_key:_.llm_api_key||null});z.data?.success?se.success(z.data.message):se.error(z.data?.message||"Connection test failed")}catch{se.error("Failed to test connection")}finally{x(!1)}},ms=async z=>{await a.toggleRule(z)},ps=async z=>{const ne=z.target.files;if(!ne||ne.length===0)return;ds(!0);const De=ne[0],ga=De.name.split(".").pop(),kr=`${Math.random().toString(36).substring(2)}.${ga}`,tn=`${n.user.id}/${kr}`;try{const{error:ys}=await ct.storage.from("rule-attachments").upload(tn,De);if(ys)throw ys;const Xi={name:De.name,path:tn,type:De.type,size:De.size};Rn(Qi=>[...Qi,Xi]),se.success("File uploaded")}catch(ys){console.error("Upload error:",ys),se.error("Failed to upload file")}finally{ds(!1),z.target.value=""}},gs=z=>{Rn(ne=>ne.filter(De=>De.path!==z))},Aa=z=>z==="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:E,children:o.jsxs(rs,{className:"sm:max-w-lg",children:[o.jsxs(Ea,{children:[o.jsxs(Na,{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(Gw,{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:z=>Yi(z.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(Ae,{placeholder:"xxx.apps.googleusercontent.com",value:P,onChange:z=>W(z.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Ae,{type:"password",placeholder:"GOCSPX-...",value:Q,onChange:z=>Y(z.target.value)})]})]})]}),o.jsxs(pr,{children:[o.jsx(F,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),o.jsxs(F,{onClick:Po,disabled:Ge||!P||!Q,children:[Ge?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(Ae,{placeholder:"4/0AQlEd8x...",value:J,onChange:z=>fe(z.target.value),className:"font-mono"})]})]}),o.jsxs(pr,{children:[o.jsx(F,{variant:"outline",onClick:()=>O("credentials"),children:"Back"}),o.jsxs(F,{onClick:Ko,disabled:ge||!J.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:Le,children:o.jsxs(rs,{className:"sm:max-w-lg",children:[o.jsxs(Ea,{children:[o.jsxs(Na,{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:L==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),L==="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(Ae,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:z=>Ee(z.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),o.jsx(Ae,{placeholder:"common",value:_e,onChange:z=>N(z.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(F,{variant:"outline",onClick:()=>Le(!1),children:"Cancel"}),o.jsxs(F,{onClick:Ct,disabled:I||!K,children:[I?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(F,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ai,{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(F,{variant:"outline",onClick:()=>Le(!1),children:"Cancel"})})]})]})}),o.jsx(ss,{open:Z,onOpenChange:ce,children:o.jsxs(rs,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{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(Ae,{placeholder:"e.g. Archive Newsletters",value:ye,onChange:z=>ue(z.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:Pe,onChange:z=>{Be(z.target.value),z.target.value==="category"?yt("newsletter"):z.target.value==="sentiment"?yt("Positive"):z.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"}),Pe==="category"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:z=>yt(z.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"})]}):Pe==="sentiment"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:z=>yt(z.target.value),children:[o.jsx("option",{value:"Positive",children:"Positive"}),o.jsx("option",{value:"Neutral",children:"Neutral"}),o.jsx("option",{value:"Negative",children:"Negative"})]}):Pe==="priority"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:z=>yt(z.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(Ae,{placeholder:Pe==="sender_domain"?"rta.vn":Pe==="sender_email"?"john@example.com":"Keywords...",value:Tt,onChange:z=>yt(z.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(zo,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ae,{type:"number",min:"0",placeholder:"0",className:"w-24",value:ia,onChange:z=>cs(z.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(z=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${vt.includes(z.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:vt.includes(z.value),onChange:ne=>{ne.target.checked?os([...vt,z.value]):os(vt.filter(De=>De!==z.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:z.label})]},z.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:z=>Vi(z.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(vg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[Cr.map(z=>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:z.name}),o.jsx(F,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>gs(z.path),children:o.jsx(Uo,{className:"w-3 h-3"})})]},z.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(F,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:en,children:[en?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_i,{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(F,{variant:"outline",onClick:()=>ce(!1),children:"Cancel"}),o.jsxs(F,{onClick:kt,disabled:Ii,children:[Ii?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_i,{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(Nt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(No,{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(z=>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(z.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:z.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:z.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[z.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(F,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>Yo(z.id),children:o.jsx(To,{className:"w-4 h-4"})})]})]},z.id)),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(F,{className:"w-full border-dashed",variant:"outline",onClick:Go,disabled:r||c,children:[r?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_i,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(F,{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(_i,{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(F,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ai,{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(Nt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(Md,{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(F,{variant:n.rules.find(z=>z.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Pi,disabled:mt==="auto_trash_spam",children:[mt==="auto_trash_spam"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(fd,{className:"w-4 h-4 mr-1"}),n.rules.find(z=>z.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(F,{variant:n.rules.find(z=>z.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:Ki,disabled:mt==="smart_drafts",children:[mt==="smart_drafts"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(fd,{className:"w-4 h-4 mr-1"}),n.rules.find(z=>z.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(F,{variant:"ghost",size:"sm",onClick:()=>ce(!0),children:[o.jsx(_i,{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(z=>z.name!=="Auto-Trash Spam"&&z.name!=="Smart Drafts").map(z=>{const ne=z.actions&&z.actions.length>0?z.actions:z.action?[z.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:z.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["→ ",ne.join(" + ")]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(F,{variant:z.is_enabled?"default":"outline",size:"sm",onClick:()=>ms(z.id),className:"h-7 px-2",children:[o.jsx(fd,{className:"w-3.5 h-3.5 mr-1"}),z.is_enabled?"On":"Off"]}),o.jsx(F,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>a.deleteRule(z.id),children:o.jsx(To,{className:"w-3 h-3"})})]})]}),z.instructions&&o.jsxs("p",{className:"text-[10px] text-muted-foreground italic border-t border-border/50 pt-1 mt-1 truncate",children:['"',z.instructions,'"']}),z.attachments&&z.attachments.length>0&&o.jsx("div",{className:"flex gap-1 mt-1",children:z.attachments.map(De=>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(vg,{className:"w-2.5 h-2.5"}),De.name]},De.path))})]},z.id)})]})]})]})]}),o.jsxs(Nt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(_r,{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(Ae,{placeholder:"gpt-4o-mini",value:_.llm_model||"",onChange:z=>S(ne=>({...ne,llm_model:z.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Base URL"}),o.jsx(Ae,{placeholder:"https://api.openai.com/v1",value:_.llm_base_url||"",onChange:z=>S(ne=>({...ne,llm_base_url:z.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(Ae,{type:"password",placeholder:"sk-...",value:_.llm_api_key||"",onChange:z=>S(ne=>({...ne,llm_api_key:z.target.value}))})]})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(F,{variant:"outline",onClick:Jo,disabled:v,children:[v?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_r,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(F,{onClick:Ji,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(Nt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(Md,{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(Ae,{type:"password",placeholder:"...apps.googleusercontent.com",value:_.google_client_id||"",onChange:z=>S(ne=>({...ne,google_client_id:z.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Ae,{type:"password",placeholder:"GOCSPX-...",value:_.google_client_secret||"",onChange:z=>S(ne=>({...ne,google_client_secret:z.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(Ae,{type:"password",value:_.microsoft_client_id||"",onChange:z=>S(ne=>({...ne,microsoft_client_id:z.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),o.jsx(Ae,{type:"password",value:_.microsoft_client_secret||"",onChange:z=>S(ne=>({...ne,microsoft_client_secret:z.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),o.jsx(Ae,{placeholder:"common",value:_.microsoft_tenant_id||"",onChange:z=>S(ne=>({...ne,microsoft_tenant_id:z.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(F,{onClick:Ji,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 rN="modulepreload",iN=function(n){return"/"+n},dy={},lN=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let g=function(v){return Promise.all(v.map(x=>Promise.resolve(x).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};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=iN(v),v in dy)return;dy[v]=!0;const x=v.endsWith(".css"),_=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${_}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":rN,x||(S.as="script"),S.crossOrigin="",S.href=v,p&&S.setAttribute("nonce",p),document.head.appendChild(S),x)return new Promise((A,E)=>{S.addEventListener("load",A),S.addEventListener("error",()=>E(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 oN(){const[n,a]=w.useState("profile"),{state:r,actions:l}=Ar();w.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:yy},{id:"security",label:"Security",icon:Lw},{id:"database",label:"Supabase",icon:No}];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(cN,{}),n==="security"&&o.jsx(uN,{}),n==="database"&&o.jsx(dN,{})]})]})]})}function cN(){const{state:n,actions:a}=Ar(),[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(!1),[p,g]=w.useState(!1),[v,x]=w.useState(xr.isEnabled());w.useEffect(()=>{n.profile&&(l(n.profile.first_name||""),d(n.profile.last_name||""))},[n.profile]);const _=()=>{const E=!v;xr.setEnabled(E),x(E),E?(xr.playSuccess(),se.success("Sound effects enabled")):se.info("Sound effects disabled")},S=async()=>{m(!0);const E=await a.updateProfile({first_name:r,last_name:c});m(!1),E&&se.success("Profile updated")},A=async E=>{const k=E.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:P}=await ct.storage.from("avatars").upload(q,k,{upsert:!0});if(P)throw P;const{data:{publicUrl:W}}=ct.storage.from("avatars").getPublicUrl(q);await a.updateProfile({avatar_url:W}),se.success("Avatar updated")}catch(O){console.error("Avatar upload error:",O),se.error("Failed to upload avatar")}finally{g(!1)}}};return o.jsxs(Nt,{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(yy,{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(Nx,{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(Ae,{id:"first-name",value:r,onChange:E=>l(E.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Ae,{id:"last-name",value:c,onChange:E=>d(E.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"email",children:"Email Address"}),o.jsx(Ae,{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(F,{variant:v?"default":"outline",size:"sm",onClick:_,className:"gap-2",children:[v?o.jsx(Xw,{className:"w-4 h-4"}):o.jsx(Zw,{className:"w-4 h-4"}),v?"Enabled":"Disabled"]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(F,{onClick:S,disabled:h,children:[h?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Tw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function uN(){const[n,a]=w.useState(""),[r,l]=w.useState(""),[c,d]=w.useState(!1),h=async()=>{if(!n){se.error("Please enter a new password");return}if(n!==r){se.error("Passwords do not match");return}if(n.length<6){se.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await lN(async()=>{const{api:g}=await Promise.resolve().then(()=>Lj);return{api:g}},void 0),p=await m.changePassword(n);p.success?(se.success("Password changed successfully"),a(""),l("")):se.error(p.error?.message||"Failed to change password")}catch{se.error("An error occurred")}finally{d(!1)}};return o.jsxs(Nt,{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(Ae,{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(Ae,{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(F,{onClick:h,disabled:c,children:[c?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(lw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function dN(){const[n,a]=w.useState(!1),r=Tr(),l=Mj(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(Dj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(Nt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(No,{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(Bi,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(Dd,{className:"h-4 w-4 text-amber-500"}),o.jsx(qi,{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(F,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[o.jsx(Dd,{className:"w-4 h-4 mr-2"}),"Change Connection"]}),l==="ui"&&o.jsxs(F,{variant:"outline",onClick:c,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(To,{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(Ix,{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(F,{onClick:()=>a(!0),children:[o.jsx(No,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx($v,{open:n,onComplete:()=>a(!1),canClose:!0})]})}function fN({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=(_,S)=>{const A=S.replace(/[^0-9]/g,"");if(A.length===0){const O=a.split("");O[_]=" ",a.split("");let q=a.split("");_<q.length&&q.splice(_,1);const B=q.join("");r(B),_>0&&h.current[_-1]?.focus();return}a.split("");const E=[...a];E[_]=A[0],r(E.join("")),_<n-1&&h.current[_+1]?.focus();const k=E.join("");k.length===n&&l&&l(k)},v=(_,S)=>{S.key==="Backspace"&&!a[_]&&_>0||S.key==="ArrowLeft"&&_>0?h.current[_-1]?.focus():S.key==="ArrowRight"&&_<n-1&&h.current[_+1]?.focus()},x=_=>{_.preventDefault();const A=_.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,n);r(A);const E=Math.min(A.length,n-1);h.current[E]?.focus(),A.length===n&&l&&l(A)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:n}).map((_,S)=>o.jsx(Ae,{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:x,onFocus:()=>p(S),onBlur:()=>p(null),disabled:c,className:ke("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 hN({onSuccess:n,onConfigure:a}){const[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(""),[p,g]=w.useState(""),[v,x]=w.useState(!1),[_,S]=w.useState(!0),[A,E]=w.useState(!1),[k,O]=w.useState(""),[q,B]=w.useState("password"),[P,W]=w.useState("email"),[Q,Y]=w.useState("");w.useEffect(()=>{J()},[]);const J=async()=>{try{const{data:pe,error:ge}=await ct.from("init_state").select("is_initialized");if(ge){console.warn("[Login] Init check failed, defaulting to initialized (Login):",ge),E(!0);return}const et=pe?.[0]?.is_initialized>0;E(et)}catch(pe){if(console.warn("[Login] Init check exception, defaulting to initialized:",pe),pe.message?.includes("Invalid API key")||pe.status===401){console.warn("[Login] API Key invalid for REST check (likely Publishable Key). defaulting to Setup Mode (isInitialized=false)."),E(!1);return}E(!0)}finally{S(!1)}},fe=async pe=>{pe.preventDefault(),x(!0),O("");try{if(A){if(q==="password"){const{error:ge}=await ct.auth.signInWithPassword({email:r,password:c});if(ge)throw ge;se.success("Logged in successfully"),n?.()}else if(P==="email"){const{error:ge}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(ge)throw ge;W("verify"),se.success("Validation code sent to your email")}}else{const{data:ge,error:et}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:p}});if(et||!ge){if(et?.message?.includes("First user already exists")){se.info("System already initialized. Please log in."),E(!0);return}throw new Error(et?.message||"Failed to create admin account")}se.success("Admin account created! Signing you in...");const{error:nt}=await ct.auth.signInWithPassword({email:r,password:c});if(nt)throw nt;E(!0),n?.()}}catch(ge){O(ge?.message||"Authentication failed"),console.error("[Login] Error:",ge)}finally{x(!1)}},Ge=async()=>{x(!0),O("");try{const{data:pe,error:ge}=await ct.auth.verifyOtp({email:r,token:Q,type:"magiclink"});if(ge)throw ge;if(!pe.session)throw new Error("Failed to create session");se.success("Logged in successfully"),n?.()}catch(pe){O(pe?.message||"Invalid code")}finally{x(!1)}};return _?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx(ra,{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(Uy,{})}),o.jsxs(Nt,{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(hf,{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":P==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:fe,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(Ae,{value:h,onChange:pe=>m(pe.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(Ae,{value:p,onChange:pe=>g(pe.target.value),required:!A,placeholder:"Doe"})]})]}),q==="password"||P==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Ae,{type:"email",placeholder:"admin@example.com",value:r,onChange:pe=>l(pe.target.value),required:!0,autoComplete:"email",disabled:P==="verify"})]}):null,q==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Ae,{type:"password",placeholder:"••••••••",value:c,onChange:pe=>d(pe.target.value),required:!0,minLength:6,autoComplete:A?"current-password":"new-password"})]}),q==="otp"&&P==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(fN,{value:Q,onChange:Y,length:6,onComplete:()=>{}})}),o.jsx(F,{type:"button",variant:"link",className:"w-full text-xs text-muted-foreground",onClick:()=>W("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(F,{type:"button",variant:"outline",className:"w-full border-destructive/50 hover:bg-destructive/20 text-destructive",onClick:a,children:"Update Connection Settings"})]})]}),o.jsxs(iv,{className:"flex flex-col gap-3",children:[q==="otp"&&P==="verify"?o.jsx(F,{type:"button",onClick:Ge,disabled:v||Q.length!==6,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx(ra,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify Code"}):o.jsx(F,{type:"submit",disabled:v||!r||q==="password"&&!c,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx(ra,{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(Rd,{className:"w-4 h-4 mr-2"}):o.jsx(fw,{className:"w-4 h-4 mr-2"}):o.jsx(Kw,{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(F,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("otp"),W("email"),O("")},children:[o.jsx(rw,{className:"w-4 h-4 mr-2"}),"Sign in with Code"]}):o.jsxs(F,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("password"),O("")},children:[o.jsx(wx,{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 Hv=void 0,mN=void 0;function pN(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 gN(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:Hv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function yN(n){const a=Hv,r=mN,l=await gN(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=pN(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 Vv="email_automator_migration_reminder_dismissed_at";function vN(n=24){try{const a=localStorage.getItem(Vv);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 bN(){try{localStorage.setItem(Vv,new Date().toISOString())}catch(n){console.error("Error dismissing migration reminder:",n)}}function xN({status:n,onDismiss:a,onLearnMore:r}){const[l,c]=w.useState(!0);if(!l)return null;const d=()=>{bN(),c(!1),a?.()},h=()=>{r?r():(navigator.clipboard.writeText("npx email-automator migrate"),se.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(Sr,{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(F,{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(Uo,{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(F,{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(F,{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 _o({code:n,label:a}){const[r,l]=w.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){se.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(n),l(!0),window.setTimeout(()=>l(!1),2e3),se.success("Copied to clipboard")}catch(h){console.error("Failed to copy:",h),se.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(F,{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(Yx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function wN({open:n,onOpenChange:a,status:r}){const l=Tr(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState([]),[v,x]=w.useState(""),[_,S]=w.useState(""),A=w.useRef(null),E=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(!E){se.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:E,dbPassword:v,accessToken:_})});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:P,value:W}=await q.read();if(P)break;const Y=B.decode(W).split(`
96
+ `).filter(Boolean);g(J=>[...J,...Y])}}catch(O){console.error(O),g(q=>[...q,`Error: ${O instanceof Error?O.message:String(O)}`]),se.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(Ea,{children:[o.jsxs(Na,{className:"flex items-center gap-2 text-xl",children:[o.jsx(Sr,{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(Bi,{children:[o.jsx(wr,{className:"h-4 w-4"}),o.jsxs(qi,{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(Ae,{id:"project-id",value:E,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(Ai,{className:"h-3 w-3"})]})]}),o.jsx(Ae,{id:"access-token",type:"password",placeholder:"sbp_...",value:_,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(Ae,{id:"db-password",type:"password",placeholder:"Your database password",value:v,onChange:O=>x(O.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Required if no access token is provided."})]}),o.jsx(F,{onClick:k,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx(ra,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(zd,{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:E||"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(_o,{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(_o,{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(_o,{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(_o,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Bi,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(Sr,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(qi,{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(F,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function _N(){const[n,a]=w.useState([]),{isExpanded:r,setIsExpanded:l}=rv(),[c,d]=w.useState({});w.useEffect(()=>{h();const v=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},x=>{const _=x.new;_.event_type==="error"&&d(S=>({...S,[_.id]:!0})),a(S=>{const A=[_,...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(x=>({...x,[v]:!x[v]}))},p=v=>{switch(v){case"analysis":return o.jsx(ef,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(Sr,{className:"w-3 h-3 text-red-500"});default:return o.jsx(wr,{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(Nt,{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(zd,{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(yx,{className:"w-3 h-3"}),"LIVE"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(F,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:"Clear"}),o.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:o.jsx(yw,{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,x)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[x!==n.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:ke("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:ke("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(F,{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(Ux,{className:"w-3 h-3 mr-1"}):o.jsx(kx,{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:ke("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(_=>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(Ao,{className:"w-2.5 h-2.5"}),_]},_))})]}):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(wr,{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: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:v.details.raw_response})})]})]})]})]},v.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(F,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx(zd,{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 SN(){const{state:n,actions:a}=Ar(),[r,l]=w.useState(!1),[c,d]=w.useState("dashboard"),[h,m]=w.useState(!0),[p,g]=w.useState(!1);if(w.useEffect(()=>{const Q=new URLSearchParams(window.location.search).get("code");Q&&!p&&(async()=>{g(!0);try{const J=await Ve.connectGmail(Q);if(J.data?.success)se.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),a.fetchAccounts());else{const fe=typeof J.error=="string"?J.error:J.error?.message;se.error(fe||"Failed to connect Gmail")}}catch{se.error("Connection failed")}finally{g(!1)}})()},[]),p)return o.jsx(Ti,{text:"Connecting account..."});const[v,x]=w.useState(null),[_,S]=w.useState(!1),[A,E]=w.useState(!1),[k,O]=w.useState(!1);w.useEffect(()=>{(async()=>{const Q=Tr();if(!Q){l(!0),m(!1);return}if((await ev(Q.url,Q.anonKey)).valid)n.isInitialized&&n.isAuthenticated&&(a.fetchAccounts(),a.fetchRules(),a.fetchSettings(),a.fetchProfile(),yN(ct).then(J=>{x(J),J.needsMigration&&!vN()&&S(!0)}));else{l(!0),m(!1);return}m(!1)})()},[n.isInitialized,n.isAuthenticated]);const q=()=>{E(!0),S(!1)},B={migrationStatus:v,showMigrationBanner:_,showMigrationModal:A,openMigrationModal:q,suppressMigrationBanner:k,setSuppressMigrationBanner:O};if(h)return o.jsx(Ti,{text:"Checking configuration..."});if(r)return o.jsx($v,{onComplete:()=>{l(!1),window.location.reload()}});if(!n.isInitialized)return o.jsx(Ti,{text:"Initializing..."});if(!n.isAuthenticated)return o.jsx(hN,{onConfigure:()=>l(!0)});const P=async()=>{await ct.auth.signOut(),se.success("Logged out successfully")};return o.jsx(Hj,{value:B,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.jsx("div",{className:"flex items-center gap-4",children:o.jsxs("button",{onClick:()=>d("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(hf,{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:"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(F,{variant:c==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>d("dashboard"),className:"gap-2",children:[o.jsx(cw,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),o.jsxs(F,{variant:c==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>d("analytics"),className:"gap-2",children:[o.jsx(py,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),o.jsxs(F,{variant:c==="config"?"secondary":"ghost",size:"sm",onClick:()=>d("config"),className:"gap-2",children:[o.jsx(Dd,{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(Uy,{}),o.jsx(F,{variant:c==="account"?"secondary":"ghost",size:"sm",onClick:()=>d("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(Hx,{className:"w-5 h-5"})}),o.jsx(F,{variant:"ghost",size:"sm",onClick:P,className:"text-muted-foreground hover:text-foreground",title:"Sign out",children:o.jsx(mw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4",children:[c==="dashboard"&&o.jsx(tN,{}),c==="config"&&o.jsx(sN,{}),c==="analytics"&&o.jsx(EN,{}),c==="account"&&o.jsx(oN,{})]}),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})})}),v&&_&&!k&&o.jsx(xN,{status:v,onDismiss:()=>S(!1),onLearnMore:q}),v&&o.jsx(wN,{open:A,onOpenChange:E,status:v}),o.jsx(_N,{})]})})}function jN({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(ef,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx($i,{className:"w-4 h-4 text-red-500"});default:return o.jsx(wr,{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(Ea,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(gy,{className:"w-5 h-5 text-primary"}),o.jsx(Na,{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(Ti,{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,x)=>o.jsxs("div",{className:"relative pl-8",children:[x!==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(zo,{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(_=>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:_},_))]})]}),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 EN(){const{state:n,actions:a}=Ar(),[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(Ti,{text:"Loading analytics..."});const p=(v,x)=>{l(v),d(x),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(py,{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(So,{title:"Total Emails",value:g.totalEmails,color:"primary"}),o.jsx(So,{title:"Spam Caught",value:g.categoryCounts.spam||0,color:"destructive"}),o.jsx(So,{title:"Actions Taken",value:Object.values(g.actionCounts).reduce((v,x)=>v+x,0)-(g.actionCounts.none||0),color:"emerald"}),o.jsx(So,{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,x])=>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:x})]}),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:`${x/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,x])=>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:x})]},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 x=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:ke("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(zo,{className:"w-3 h-3"}),new Date(v.started_at).toLocaleString(),x!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[x,"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(jN,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function So({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 NN(){return o.jsx(t_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(Ij,{children:o.jsx(Vj,{children:o.jsxs(qj,{children:[o.jsx(SN,{}),o.jsx(Jj,{})]})})})})}ux.createRoot(document.getElementById("root")).render(o.jsx(fy.StrictMode,{children:o.jsx(NN,{})}));