@realtimex/email-automator 2.8.2 → 2.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
function ax(s,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 s)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(s,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(s,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 sf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var dd={exports:{}},Ri={};var cg;function sx(){if(cg)return Ri;cg=1;var s=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:s,type:l,key:h,ref:c!==void 0?c:null,props:d}}return Ri.Fragment=a,Ri.jsx=r,Ri.jsxs=r,Ri}var ug;function nx(){return ug||(ug=1,dd.exports=sx()),dd.exports}var o=nx(),fd={exports:{}},ye={};var dg;function rx(){if(dg)return ye;dg=1;var s=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"),w=Symbol.for("react.activity"),_=Symbol.iterator;function S(A){return A===null||typeof A!="object"?null:(A=_&&A[_]||A["@@iterator"],typeof A=="function"?A:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,O={};function D(A,V,X){this.props=A,this.context=V,this.refs=O,this.updater=X||E}D.prototype.isReactComponent={},D.prototype.setState=function(A,V){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,V,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function q(){}q.prototype=D.prototype;function B(A,V,X){this.props=A,this.context=V,this.refs=O,this.updater=X||E}var G=B.prototype=new q;G.constructor=B,j(G,D.prototype),G.isPureReactComponent=!0;var W=Array.isArray;function J(){}var P={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function ce(A,V,X){var F=X.ref;return{$$typeof:s,type:A,key:V,ref:F!==void 0?F:null,props:X}}function Je(A,V){return ce(A.type,V,A.props)}function ve(A){return typeof A=="object"&&A!==null&&A.$$typeof===s}function pe(A){var V={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(X){return V[X]})}var Ze=/\/+/g;function st(A,V){return typeof A=="object"&&A!==null&&A.key!=null?pe(""+A.key):V.toString(36)}function qe(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(J,J):(A.status="pending",A.then(function(V){A.status==="pending"&&(A.status="fulfilled",A.value=V)},function(V){A.status==="pending"&&(A.status="rejected",A.reason=V)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function k(A,V,X,F,de){var ge=typeof A;(ge==="undefined"||ge==="boolean")&&(A=null);var ue=!1;if(A===null)ue=!0;else switch(ge){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(A.$$typeof){case s:case a:ue=!0;break;case v:return ue=A._init,k(ue(A._payload),V,X,F,de)}}if(ue)return de=de(A),ue=F===""?"."+st(A,0):F,W(de)?(X="",ue!=null&&(X=ue.replace(Ze,"$&/")+"/"),k(de,V,X,"",function(kt){return kt})):de!=null&&(ve(de)&&(de=Je(de,X+(de.key==null||A&&A.key===de.key?"":(""+de.key).replace(Ze,"$&/")+"/")+ue)),V.push(de)),1;ue=0;var Ge=F===""?".":F+":";if(W(A))for(var Ue=0;Ue<A.length;Ue++)F=A[Ue],ge=Ge+st(F,Ue),ue+=k(F,V,X,ge,de);else if(Ue=S(A),typeof Ue=="function")for(A=Ue.call(A),Ue=0;!(F=A.next()).done;)F=F.value,ge=Ge+st(F,Ue++),ue+=k(F,V,X,ge,de);else if(ge==="object"){if(typeof A.then=="function")return k(qe(A),V,X,F,de);throw V=String(A),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return ue}function Y(A,V,X){if(A==null)return A;var F=[],de=0;return k(A,F,"","",function(ge){return V.call(X,ge,de++)}),F}function K(A){if(A._status===-1){var V=A._result;V=V(),V.then(function(X){(A._status===0||A._status===-1)&&(A._status=1,A._result=X)},function(X){(A._status===0||A._status===-1)&&(A._status=2,A._result=X)}),A._status===-1&&(A._status=0,A._result=V)}if(A._status===1)return A._result.default;throw A._result}var _e=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},je={map:Y,forEach:function(A,V,X){Y(A,function(){V.apply(this,arguments)},X)},count:function(A){var V=0;return Y(A,function(){V++}),V},toArray:function(A){return Y(A,function(V){return V})||[]},only:function(A){if(!ve(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return ye.Activity=w,ye.Children=je,ye.Component=D,ye.Fragment=r,ye.Profiler=c,ye.PureComponent=B,ye.StrictMode=l,ye.Suspense=p,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,ye.__COMPILER_RUNTIME={__proto__:null,c:function(A){return P.H.useMemoCache(A)}},ye.cache=function(A){return function(){return A.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(A,V,X){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var F=j({},A.props),de=A.key;if(V!=null)for(ge in V.key!==void 0&&(de=""+V.key),V)!Q.call(V,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&V.ref===void 0||(F[ge]=V[ge]);var ge=arguments.length-2;if(ge===1)F.children=X;else if(1<ge){for(var ue=Array(ge),Ge=0;Ge<ge;Ge++)ue[Ge]=arguments[Ge+2];F.children=ue}return ce(A.type,de,F)},ye.createContext=function(A){return A={$$typeof:h,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:d,_context:A},A},ye.createElement=function(A,V,X){var F,de={},ge=null;if(V!=null)for(F in V.key!==void 0&&(ge=""+V.key),V)Q.call(V,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(de[F]=V[F]);var ue=arguments.length-2;if(ue===1)de.children=X;else if(1<ue){for(var Ge=Array(ue),Ue=0;Ue<ue;Ue++)Ge[Ue]=arguments[Ue+2];de.children=Ge}if(A&&A.defaultProps)for(F in ue=A.defaultProps,ue)de[F]===void 0&&(de[F]=ue[F]);return ce(A,ge,de)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(A){return{$$typeof:m,render:A}},ye.isValidElement=ve,ye.lazy=function(A){return{$$typeof:v,_payload:{_status:-1,_result:A},_init:K}},ye.memo=function(A,V){return{$$typeof:g,type:A,compare:V===void 0?null:V}},ye.startTransition=function(A){var V=P.T,X={};P.T=X;try{var F=A(),de=P.S;de!==null&&de(X,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(J,_e)}catch(ge){_e(ge)}finally{V!==null&&X.types!==null&&(V.types=X.types),P.T=V}},ye.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},ye.use=function(A){return P.H.use(A)},ye.useActionState=function(A,V,X){return P.H.useActionState(A,V,X)},ye.useCallback=function(A,V){return P.H.useCallback(A,V)},ye.useContext=function(A){return P.H.useContext(A)},ye.useDebugValue=function(){},ye.useDeferredValue=function(A,V){return P.H.useDeferredValue(A,V)},ye.useEffect=function(A,V){return P.H.useEffect(A,V)},ye.useEffectEvent=function(A){return P.H.useEffectEvent(A)},ye.useId=function(){return P.H.useId()},ye.useImperativeHandle=function(A,V,X){return P.H.useImperativeHandle(A,V,X)},ye.useInsertionEffect=function(A,V){return P.H.useInsertionEffect(A,V)},ye.useLayoutEffect=function(A,V){return P.H.useLayoutEffect(A,V)},ye.useMemo=function(A,V){return P.H.useMemo(A,V)},ye.useOptimistic=function(A,V){return P.H.useOptimistic(A,V)},ye.useReducer=function(A,V,X){return P.H.useReducer(A,V,X)},ye.useRef=function(A){return P.H.useRef(A)},ye.useState=function(A){return P.H.useState(A)},ye.useSyncExternalStore=function(A,V,X){return P.H.useSyncExternalStore(A,V,X)},ye.useTransition=function(){return P.H.useTransition()},ye.version="19.2.3",ye}var fg;function nf(){return fg||(fg=1,fd.exports=rx()),fd.exports}var x=nf();const my=sf(x),rf=ax({__proto__:null,default:my},[x]);var hd={exports:{}},Di={},md={exports:{}},pd={};var hg;function ix(){return hg||(hg=1,(function(s){function a(k,Y){var K=k.length;k.push(Y);e:for(;0<K;){var _e=K-1>>>1,je=k[_e];if(0<c(je,Y))k[_e]=Y,k[K]=je,K=_e;else break e}}function r(k){return k.length===0?null:k[0]}function l(k){if(k.length===0)return null;var Y=k[0],K=k.pop();if(K!==Y){k[0]=K;e:for(var _e=0,je=k.length,A=je>>>1;_e<A;){var V=2*(_e+1)-1,X=k[V],F=V+1,de=k[F];if(0>c(X,K))F<je&&0>c(de,X)?(k[_e]=de,k[F]=K,_e=F):(k[_e]=X,k[V]=K,_e=V);else if(F<je&&0>c(de,K))k[_e]=de,k[F]=K,_e=F;else break e}}return Y}function c(k,Y){var K=k.sortIndex-Y.sortIndex;return K!==0?K:k.id-Y.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;s.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();s.unstable_now=function(){return h.now()-m}}var p=[],g=[],v=1,w=null,_=3,S=!1,E=!1,j=!1,O=!1,D=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function G(k){for(var Y=r(g);Y!==null;){if(Y.callback===null)l(g);else if(Y.startTime<=k)l(g),Y.sortIndex=Y.expirationTime,a(p,Y);else break;Y=r(g)}}function W(k){if(j=!1,G(k),!E)if(r(p)!==null)E=!0,J||(J=!0,pe());else{var Y=r(g);Y!==null&&qe(W,Y.startTime-k)}}var J=!1,P=-1,Q=5,ce=-1;function Je(){return O?!0:!(s.unstable_now()-ce<Q)}function ve(){if(O=!1,J){var k=s.unstable_now();ce=k;var Y=!0;try{e:{E=!1,j&&(j=!1,q(P),P=-1),S=!0;var K=_;try{t:{for(G(k),w=r(p);w!==null&&!(w.expirationTime>k&&Je());){var _e=w.callback;if(typeof _e=="function"){w.callback=null,_=w.priorityLevel;var je=_e(w.expirationTime<=k);if(k=s.unstable_now(),typeof je=="function"){w.callback=je,G(k),Y=!0;break t}w===r(p)&&l(p),G(k)}else l(p);w=r(p)}if(w!==null)Y=!0;else{var A=r(g);A!==null&&qe(W,A.startTime-k),Y=!1}}break e}finally{w=null,_=K,S=!1}Y=void 0}}finally{Y?pe():J=!1}}}var pe;if(typeof B=="function")pe=function(){B(ve)};else if(typeof MessageChannel<"u"){var Ze=new MessageChannel,st=Ze.port2;Ze.port1.onmessage=ve,pe=function(){st.postMessage(null)}}else pe=function(){D(ve,0)};function qe(k,Y){P=D(function(){k(s.unstable_now())},Y)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(k){k.callback=null},s.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<k?Math.floor(1e3/k):5},s.unstable_getCurrentPriorityLevel=function(){return _},s.unstable_next=function(k){switch(_){case 1:case 2:case 3:var Y=3;break;default:Y=_}var K=_;_=Y;try{return k()}finally{_=K}},s.unstable_requestPaint=function(){O=!0},s.unstable_runWithPriority=function(k,Y){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var K=_;_=k;try{return Y()}finally{_=K}},s.unstable_scheduleCallback=function(k,Y,K){var _e=s.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?_e+K:_e):K=_e,k){case 1:var je=-1;break;case 2:je=250;break;case 5:je=1073741823;break;case 4:je=1e4;break;default:je=5e3}return je=K+je,k={id:v++,callback:Y,priorityLevel:k,startTime:K,expirationTime:je,sortIndex:-1},K>_e?(k.sortIndex=K,a(g,k),r(p)===null&&k===r(g)&&(j?(q(P),P=-1):j=!0,qe(W,K-_e))):(k.sortIndex=je,a(p,k),E||S||(E=!0,J||(J=!0,pe()))),k},s.unstable_shouldYield=Je,s.unstable_wrapCallback=function(k){var Y=_;return function(){var K=_;_=Y;try{return k.apply(this,arguments)}finally{_=K}}}})(pd)),pd}var mg;function lx(){return mg||(mg=1,md.exports=ix()),md.exports}var gd={exports:{}},Ct={};var pg;function ox(){if(pg)return Ct;pg=1;var s=nf();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 w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:w==null?null:""+w,children:p,containerInfo:g,implementation:v}}var h=s.__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 Ct.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Ct.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)},Ct.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()}},Ct.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))},Ct.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},Ct.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var v=g.as,w=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:w,integrity:_,fetchPriority:S}):v==="script"&&l.d.X(p,{crossOrigin:w,integrity:_,fetchPriority:S,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Ct.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)},Ct.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var v=g.as,w=m(v,g.crossOrigin);l.d.L(p,v,{crossOrigin:w,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})}},Ct.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)},Ct.requestFormReset=function(p){l.d.r(p)},Ct.unstable_batchedUpdates=function(p,g){return p(g)},Ct.useFormState=function(p,g,v){return h.H.useFormState(p,g,v)},Ct.useFormStatus=function(){return h.H.useHostTransitionStatus()},Ct.version="19.2.3",Ct}var gg;function py(){if(gg)return gd.exports;gg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),gd.exports=ox(),gd.exports}var yg;function cx(){if(yg)return Di;yg=1;var s=lx(),a=nf(),r=py();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}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,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n: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 n=e,i=t;;){var u=n.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){n=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===n)return p(u),e;if(f===i)return p(u),t;f=f.sibling}throw Error(l(188))}if(n.return!==i.return)n=u,i=f;else{for(var y=!1,b=u.child;b;){if(b===n){y=!0,n=u,i=f;break}if(b===i){y=!0,i=u,n=f;break}b=b.sibling}if(!y){for(b=f.child;b;){if(b===n){y=!0,n=f,i=u;break}if(b===i){y=!0,i=f,n=u;break}b=b.sibling}if(!y)throw Error(l(189))}}if(n.alternate!==i)throw Error(l(190))}if(n.tag!==3)throw Error(l(188));return n.stateNode.current===n?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 w=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),B=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),Je=Symbol.for("react.memo_cache_sentinel"),ve=Symbol.iterator;function pe(e){return e===null||typeof e!="object"?null:(e=ve&&e[ve]||e["@@iterator"],typeof e=="function"?e:null)}var Ze=Symbol.for("react.client.reference");function st(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ze?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case D:return"Profiler";case O:return"StrictMode";case W:return"Suspense";case J:return"SuspenseList";case ce:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case B:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return t=e.displayName||null,t!==null?t:st(e.type)||"Memo";case Q:t=e._payload,e=e._init;try{return st(e(t))}catch{}}return null}var qe=Array.isArray,k=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},_e=[],je=-1;function A(e){return{current:e}}function V(e){0>je||(e.current=_e[je],_e[je]=null,je--)}function X(e,t){je++,_e[je]=e.current,e.current=t}var F=A(null),de=A(null),ge=A(null),ue=A(null);function Ge(e,t){switch(X(ge,t),X(de,e),X(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Rp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Rp(t),e=Dp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(F),X(F,e)}function Ue(){V(F),V(de),V(ge)}function kt(e){e.memoizedState!==null&&X(ue,e);var t=F.current,n=Dp(t,e.type);t!==n&&(X(de,e),X(F,n))}function pt(e){de.current===e&&(V(F),V(de)),ue.current===e&&(V(ue),Ai._currentValue=K)}var xt,ss;function la(e){if(xt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);xt=t&&t[1]||"",ss=-1<n.stack.indexOf(`
|
|
1
|
+
function ax(s,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 s)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(s,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(s,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 sf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var dd={exports:{}},Ri={};var cg;function sx(){if(cg)return Ri;cg=1;var s=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:s,type:l,key:h,ref:c!==void 0?c:null,props:d}}return Ri.Fragment=a,Ri.jsx=r,Ri.jsxs=r,Ri}var ug;function nx(){return ug||(ug=1,dd.exports=sx()),dd.exports}var o=nx(),fd={exports:{}},ye={};var dg;function rx(){if(dg)return ye;dg=1;var s=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"),y=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),_=Symbol.iterator;function S(A){return A===null||typeof A!="object"?null:(A=_&&A[_]||A["@@iterator"],typeof A=="function"?A:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,O={};function D(A,V,X){this.props=A,this.context=V,this.refs=O,this.updater=X||E}D.prototype.isReactComponent={},D.prototype.setState=function(A,V){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,V,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function q(){}q.prototype=D.prototype;function B(A,V,X){this.props=A,this.context=V,this.refs=O,this.updater=X||E}var G=B.prototype=new q;G.constructor=B,j(G,D.prototype),G.isPureReactComponent=!0;var W=Array.isArray;function J(){}var P={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function ce(A,V,X){var F=X.ref;return{$$typeof:s,type:A,key:V,ref:F!==void 0?F:null,props:X}}function Je(A,V){return ce(A.type,V,A.props)}function ve(A){return typeof A=="object"&&A!==null&&A.$$typeof===s}function pe(A){var V={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(X){return V[X]})}var Ze=/\/+/g;function st(A,V){return typeof A=="object"&&A!==null&&A.key!=null?pe(""+A.key):V.toString(36)}function qe(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(J,J):(A.status="pending",A.then(function(V){A.status==="pending"&&(A.status="fulfilled",A.value=V)},function(V){A.status==="pending"&&(A.status="rejected",A.reason=V)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function C(A,V,X,F,de){var ge=typeof A;(ge==="undefined"||ge==="boolean")&&(A=null);var ue=!1;if(A===null)ue=!0;else switch(ge){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(A.$$typeof){case s:case a:ue=!0;break;case g:return ue=A._init,C(ue(A._payload),V,X,F,de)}}if(ue)return de=de(A),ue=F===""?"."+st(A,0):F,W(de)?(X="",ue!=null&&(X=ue.replace(Ze,"$&/")+"/"),C(de,V,X,"",function(Ct){return Ct})):de!=null&&(ve(de)&&(de=Je(de,X+(de.key==null||A&&A.key===de.key?"":(""+de.key).replace(Ze,"$&/")+"/")+ue)),V.push(de)),1;ue=0;var Ge=F===""?".":F+":";if(W(A))for(var Ue=0;Ue<A.length;Ue++)F=A[Ue],ge=Ge+st(F,Ue),ue+=C(F,V,X,ge,de);else if(Ue=S(A),typeof Ue=="function")for(A=Ue.call(A),Ue=0;!(F=A.next()).done;)F=F.value,ge=Ge+st(F,Ue++),ue+=C(F,V,X,ge,de);else if(ge==="object"){if(typeof A.then=="function")return C(qe(A),V,X,F,de);throw V=String(A),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return ue}function Y(A,V,X){if(A==null)return A;var F=[],de=0;return C(A,F,"","",function(ge){return V.call(X,ge,de++)}),F}function K(A){if(A._status===-1){var V=A._result;V=V(),V.then(function(X){(A._status===0||A._status===-1)&&(A._status=1,A._result=X)},function(X){(A._status===0||A._status===-1)&&(A._status=2,A._result=X)}),A._status===-1&&(A._status=0,A._result=V)}if(A._status===1)return A._result.default;throw A._result}var _e=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},je={map:Y,forEach:function(A,V,X){Y(A,function(){V.apply(this,arguments)},X)},count:function(A){var V=0;return Y(A,function(){V++}),V},toArray:function(A){return Y(A,function(V){return V})||[]},only:function(A){if(!ve(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return ye.Activity=w,ye.Children=je,ye.Component=D,ye.Fragment=r,ye.Profiler=c,ye.PureComponent=B,ye.StrictMode=l,ye.Suspense=y,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,ye.__COMPILER_RUNTIME={__proto__:null,c:function(A){return P.H.useMemoCache(A)}},ye.cache=function(A){return function(){return A.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(A,V,X){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var F=j({},A.props),de=A.key;if(V!=null)for(ge in V.key!==void 0&&(de=""+V.key),V)!Q.call(V,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&V.ref===void 0||(F[ge]=V[ge]);var ge=arguments.length-2;if(ge===1)F.children=X;else if(1<ge){for(var ue=Array(ge),Ge=0;Ge<ge;Ge++)ue[Ge]=arguments[Ge+2];F.children=ue}return ce(A.type,de,F)},ye.createContext=function(A){return A={$$typeof:h,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:d,_context:A},A},ye.createElement=function(A,V,X){var F,de={},ge=null;if(V!=null)for(F in V.key!==void 0&&(ge=""+V.key),V)Q.call(V,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(de[F]=V[F]);var ue=arguments.length-2;if(ue===1)de.children=X;else if(1<ue){for(var Ge=Array(ue),Ue=0;Ue<ue;Ue++)Ge[Ue]=arguments[Ue+2];de.children=Ge}if(A&&A.defaultProps)for(F in ue=A.defaultProps,ue)de[F]===void 0&&(de[F]=ue[F]);return ce(A,ge,de)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(A){return{$$typeof:m,render:A}},ye.isValidElement=ve,ye.lazy=function(A){return{$$typeof:g,_payload:{_status:-1,_result:A},_init:K}},ye.memo=function(A,V){return{$$typeof:p,type:A,compare:V===void 0?null:V}},ye.startTransition=function(A){var V=P.T,X={};P.T=X;try{var F=A(),de=P.S;de!==null&&de(X,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(J,_e)}catch(ge){_e(ge)}finally{V!==null&&X.types!==null&&(V.types=X.types),P.T=V}},ye.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},ye.use=function(A){return P.H.use(A)},ye.useActionState=function(A,V,X){return P.H.useActionState(A,V,X)},ye.useCallback=function(A,V){return P.H.useCallback(A,V)},ye.useContext=function(A){return P.H.useContext(A)},ye.useDebugValue=function(){},ye.useDeferredValue=function(A,V){return P.H.useDeferredValue(A,V)},ye.useEffect=function(A,V){return P.H.useEffect(A,V)},ye.useEffectEvent=function(A){return P.H.useEffectEvent(A)},ye.useId=function(){return P.H.useId()},ye.useImperativeHandle=function(A,V,X){return P.H.useImperativeHandle(A,V,X)},ye.useInsertionEffect=function(A,V){return P.H.useInsertionEffect(A,V)},ye.useLayoutEffect=function(A,V){return P.H.useLayoutEffect(A,V)},ye.useMemo=function(A,V){return P.H.useMemo(A,V)},ye.useOptimistic=function(A,V){return P.H.useOptimistic(A,V)},ye.useReducer=function(A,V,X){return P.H.useReducer(A,V,X)},ye.useRef=function(A){return P.H.useRef(A)},ye.useState=function(A){return P.H.useState(A)},ye.useSyncExternalStore=function(A,V,X){return P.H.useSyncExternalStore(A,V,X)},ye.useTransition=function(){return P.H.useTransition()},ye.version="19.2.3",ye}var fg;function nf(){return fg||(fg=1,fd.exports=rx()),fd.exports}var x=nf();const my=sf(x),rf=ax({__proto__:null,default:my},[x]);var hd={exports:{}},Di={},md={exports:{}},pd={};var hg;function ix(){return hg||(hg=1,(function(s){function a(C,Y){var K=C.length;C.push(Y);e:for(;0<K;){var _e=K-1>>>1,je=C[_e];if(0<c(je,Y))C[_e]=Y,C[K]=je,K=_e;else break e}}function r(C){return C.length===0?null:C[0]}function l(C){if(C.length===0)return null;var Y=C[0],K=C.pop();if(K!==Y){C[0]=K;e:for(var _e=0,je=C.length,A=je>>>1;_e<A;){var V=2*(_e+1)-1,X=C[V],F=V+1,de=C[F];if(0>c(X,K))F<je&&0>c(de,X)?(C[_e]=de,C[F]=K,_e=F):(C[_e]=X,C[V]=K,_e=V);else if(F<je&&0>c(de,K))C[_e]=de,C[F]=K,_e=F;else break e}}return Y}function c(C,Y){var K=C.sortIndex-Y.sortIndex;return K!==0?K:C.id-Y.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;s.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();s.unstable_now=function(){return h.now()-m}}var y=[],p=[],g=1,w=null,_=3,S=!1,E=!1,j=!1,O=!1,D=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function G(C){for(var Y=r(p);Y!==null;){if(Y.callback===null)l(p);else if(Y.startTime<=C)l(p),Y.sortIndex=Y.expirationTime,a(y,Y);else break;Y=r(p)}}function W(C){if(j=!1,G(C),!E)if(r(y)!==null)E=!0,J||(J=!0,pe());else{var Y=r(p);Y!==null&&qe(W,Y.startTime-C)}}var J=!1,P=-1,Q=5,ce=-1;function Je(){return O?!0:!(s.unstable_now()-ce<Q)}function ve(){if(O=!1,J){var C=s.unstable_now();ce=C;var Y=!0;try{e:{E=!1,j&&(j=!1,q(P),P=-1),S=!0;var K=_;try{t:{for(G(C),w=r(y);w!==null&&!(w.expirationTime>C&&Je());){var _e=w.callback;if(typeof _e=="function"){w.callback=null,_=w.priorityLevel;var je=_e(w.expirationTime<=C);if(C=s.unstable_now(),typeof je=="function"){w.callback=je,G(C),Y=!0;break t}w===r(y)&&l(y),G(C)}else l(y);w=r(y)}if(w!==null)Y=!0;else{var A=r(p);A!==null&&qe(W,A.startTime-C),Y=!1}}break e}finally{w=null,_=K,S=!1}Y=void 0}}finally{Y?pe():J=!1}}}var pe;if(typeof B=="function")pe=function(){B(ve)};else if(typeof MessageChannel<"u"){var Ze=new MessageChannel,st=Ze.port2;Ze.port1.onmessage=ve,pe=function(){st.postMessage(null)}}else pe=function(){D(ve,0)};function qe(C,Y){P=D(function(){C(s.unstable_now())},Y)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(C){C.callback=null},s.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<C?Math.floor(1e3/C):5},s.unstable_getCurrentPriorityLevel=function(){return _},s.unstable_next=function(C){switch(_){case 1:case 2:case 3:var Y=3;break;default:Y=_}var K=_;_=Y;try{return C()}finally{_=K}},s.unstable_requestPaint=function(){O=!0},s.unstable_runWithPriority=function(C,Y){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var K=_;_=C;try{return Y()}finally{_=K}},s.unstable_scheduleCallback=function(C,Y,K){var _e=s.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?_e+K:_e):K=_e,C){case 1:var je=-1;break;case 2:je=250;break;case 5:je=1073741823;break;case 4:je=1e4;break;default:je=5e3}return je=K+je,C={id:g++,callback:Y,priorityLevel:C,startTime:K,expirationTime:je,sortIndex:-1},K>_e?(C.sortIndex=K,a(p,C),r(y)===null&&C===r(p)&&(j?(q(P),P=-1):j=!0,qe(W,K-_e))):(C.sortIndex=je,a(y,C),E||S||(E=!0,J||(J=!0,pe()))),C},s.unstable_shouldYield=Je,s.unstable_wrapCallback=function(C){var Y=_;return function(){var K=_;_=Y;try{return C.apply(this,arguments)}finally{_=K}}}})(pd)),pd}var mg;function lx(){return mg||(mg=1,md.exports=ix()),md.exports}var gd={exports:{}},kt={};var pg;function ox(){if(pg)return kt;pg=1;var s=nf();function a(y){var p="https://react.dev/errors/"+y;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+y+"; visit "+p+" 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(y,p,g){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:w==null?null:""+w,children:y,containerInfo:p,implementation:g}}var h=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(y,p){if(y==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,kt.createPortal=function(y,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(a(299));return d(y,p,null,g)},kt.flushSync=function(y){var p=h.T,g=l.p;try{if(h.T=null,l.p=2,y)return y()}finally{h.T=p,l.p=g,l.d.f()}},kt.preconnect=function(y,p){typeof y=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(y,p))},kt.prefetchDNS=function(y){typeof y=="string"&&l.d.D(y)},kt.preinit=function(y,p){if(typeof y=="string"&&p&&typeof p.as=="string"){var g=p.as,w=m(g,p.crossOrigin),_=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?l.d.S(y,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:w,integrity:_,fetchPriority:S}):g==="script"&&l.d.X(y,{crossOrigin:w,integrity:_,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},kt.preinitModule=function(y,p){if(typeof y=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=m(p.as,p.crossOrigin);l.d.M(y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(y)},kt.preload=function(y,p){if(typeof y=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,w=m(g,p.crossOrigin);l.d.L(y,g,{crossOrigin:w,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},kt.preloadModule=function(y,p){if(typeof y=="string")if(p){var g=m(p.as,p.crossOrigin);l.d.m(y,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(y)},kt.requestFormReset=function(y){l.d.r(y)},kt.unstable_batchedUpdates=function(y,p){return y(p)},kt.useFormState=function(y,p,g){return h.H.useFormState(y,p,g)},kt.useFormStatus=function(){return h.H.useHostTransitionStatus()},kt.version="19.2.3",kt}var gg;function py(){if(gg)return gd.exports;gg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),gd.exports=ox(),gd.exports}var yg;function cx(){if(yg)return Di;yg=1;var s=lx(),a=nf(),r=py();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}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,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n: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 y(e){if(d(e)!==e)throw Error(l(188))}function p(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var n=e,i=t;;){var u=n.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){n=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===n)return y(u),e;if(f===i)return y(u),t;f=f.sibling}throw Error(l(188))}if(n.return!==i.return)n=u,i=f;else{for(var v=!1,b=u.child;b;){if(b===n){v=!0,n=u,i=f;break}if(b===i){v=!0,i=u,n=f;break}b=b.sibling}if(!v){for(b=f.child;b;){if(b===n){v=!0,n=f,i=u;break}if(b===i){v=!0,i=f,n=u;break}b=b.sibling}if(!v)throw Error(l(189))}}if(n.alternate!==i)throw Error(l(190))}if(n.tag!==3)throw Error(l(188));return n.stateNode.current===n?e:t}function g(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=g(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),B=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),Je=Symbol.for("react.memo_cache_sentinel"),ve=Symbol.iterator;function pe(e){return e===null||typeof e!="object"?null:(e=ve&&e[ve]||e["@@iterator"],typeof e=="function"?e:null)}var Ze=Symbol.for("react.client.reference");function st(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ze?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case D:return"Profiler";case O:return"StrictMode";case W:return"Suspense";case J:return"SuspenseList";case ce:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case B:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return t=e.displayName||null,t!==null?t:st(e.type)||"Memo";case Q:t=e._payload,e=e._init;try{return st(e(t))}catch{}}return null}var qe=Array.isArray,C=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},_e=[],je=-1;function A(e){return{current:e}}function V(e){0>je||(e.current=_e[je],_e[je]=null,je--)}function X(e,t){je++,_e[je]=e.current,e.current=t}var F=A(null),de=A(null),ge=A(null),ue=A(null);function Ge(e,t){switch(X(ge,t),X(de,e),X(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Rp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Rp(t),e=Dp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(F),X(F,e)}function Ue(){V(F),V(de),V(ge)}function Ct(e){e.memoizedState!==null&&X(ue,e);var t=F.current,n=Dp(t,e.type);t!==n&&(X(de,e),X(F,n))}function pt(e){de.current===e&&(V(F),V(de)),ue.current===e&&(V(ue),Ai._currentValue=K)}var xt,ns;function la(e){if(xt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);xt=t&&t[1]||"",ns=-1<n.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+xt+e+
|
|
3
|
+
`+xt+e+ns}var rs=!1;function xn(e,t){if(!e||rs)return"";rs=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(L){var U=L}Reflect.construct(e,[],I)}else{try{I.call()}catch(L){U=L}e.call(I.prototype)}}else{try{throw Error()}catch(L){U=L}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(L){if(L&&U&&typeof L.stack=="string")return[L.stack,U.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(),v=f[0],b=f[1];if(v&&b){var N=v.split(`
|
|
4
4
|
`),z=b.split(`
|
|
5
5
|
`);for(u=i=0;i<N.length&&!N[i].includes("DetermineComponentFrameRoot");)i++;for(;u<z.length&&!z[u].includes("DetermineComponentFrameRoot");)u++;if(i===N.length||u===z.length)for(i=N.length-1,u=z.length-1;1<=i&&0<=u&&N[i]!==z[u];)u--;for(;1<=i&&0<=u;i--,u--)if(N[i]!==z[u]){if(i!==1||u!==1)do if(i--,u--,0>u||N[i]!==z[u]){var $=`
|
|
6
|
-
`+N[i].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=i&&0<=u);break}}}finally{
|
|
6
|
+
`+N[i].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=i&&0<=u);break}}}finally{rs=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?la(n):""}function wn(e,t){switch(e.tag){case 26:case 27:case 5:return la(e.type);case 16:return la("Lazy");case 13:return e.child!==t&&t!==null?la("Suspense Fallback"):la("Suspense");case 19:return la("SuspenseList");case 0:case 15:return xn(e.type,!1);case 11:return xn(e.type.render,!1);case 1:return xn(e.type,!0);case 31:return la("Activity");default:return""}}function qr(e){try{var t="",n=null;do t+=wn(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
|
|
7
7
|
Error generating stack: `+i.message+`
|
|
8
|
-
`+i.stack}}var rs=Object.prototype.hasOwnProperty,_n=s.unstable_scheduleCallback,is=s.unstable_cancelCallback,sl=s.unstable_shouldYield,qs=s.unstable_requestPaint,gt=s.unstable_now,nl=s.unstable_getCurrentPriorityLevel,$r=s.unstable_ImmediatePriority,Hr=s.unstable_UserBlockingPriority,Ra=s.unstable_NormalPriority,Sn=s.unstable_LowPriority,ya=s.unstable_IdlePriority,jn=s.log,Qo=s.unstable_setDisableYieldValue,$s=null,wt=null;function va(e){if(typeof jn=="function"&&Qo(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode($s,e)}catch{}}var Ot=Math.clz32?Math.clz32:Wo,Zo=Math.log,Fo=Math.LN2;function Wo(e){return e>>>=0,e===0?32:31-(Zo(e)/Fo|0)|0}var Nn=256,En=262144,Tn=4194304;function Da(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 An(e,t,n){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=Da(i):(y&=b,y!==0?u=Da(y):n||(n=b&~e,n!==0&&(u=Da(n))))):(b=i&~f,b!==0?u=Da(b):y!==0?u=Da(y):n||(n=i&~e,n!==0&&(u=Da(n)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,n=t&-t,f>=n||f===32&&(n&4194048)!==0)?t:u}function ls(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ec(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 rl(){var e=Tn;return Tn<<=1,(Tn&62914560)===0&&(Tn=4194304),e}function Vr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Hs(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tc(e,t,n,i,u,f){var y=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var b=e.entanglements,N=e.expirationTimes,z=e.hiddenUpdates;for(n=y&~n;0<n;){var $=31-Ot(n),I=1<<$;b[$]=0,N[$]=-1;var U=z[$];if(U!==null)for(z[$]=null,$=0;$<U.length;$++){var L=U[$];L!==null&&(L.lane&=-536870913)}n&=~I}i!==0&&R(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function R(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ot(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function ee(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Ot(n),u=1<<i;u&t|e[i]&t&&(e[i]|=t),n&=~u}}function ke(e,t){var n=t&-t;return n=(n&42)!==0?1:yt(n),(n&(e.suspendedLanes|t))!==0?0:n}function yt(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 Vs(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Is(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:ag(e.type))}function Gs(e,t){var n=Y.p;try{return Y.p=e,t()}finally{Y.p=n}}var ba=Math.random().toString(36).slice(2),ut="__reactFiber$"+ba,Dt="__reactProps$"+ba,kn="__reactContainer$"+ba,ac="__reactEvents$"+ba,Pv="__reactListeners$"+ba,Kv="__reactHandles$"+ba,bf="__reactResources$"+ba,Ir="__reactMarker$"+ba;function sc(e){delete e[ut],delete e[Dt],delete e[ac],delete e[Pv],delete e[Kv]}function Cn(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[kn]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=$p(e);e!==null;){if(n=e[ut])return n;e=$p(e)}return t}e=n,n=e.parentNode}return null}function On(e){if(e=e[ut]||e[kn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function Rn(e){var t=e[bf];return t||(t=e[bf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function vt(e){e[Ir]=!0}var xf=new Set,wf={};function Ps(e,t){Dn(e,t),Dn(e+"Capture",t)}function Dn(e,t){for(wf[e]=t,e=0;e<t.length;e++)xf.add(t[e])}var Yv=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]*$"),_f={},Sf={};function Jv(e){return rs.call(Sf,e)?!0:rs.call(_f,e)?!1:Yv.test(e)?Sf[e]=!0:(_f[e]=!0,!1)}function il(e,t,n){if(Jv(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){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,""+n)}}function ll(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Ma(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+i)}}function Zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xv(e,t,n){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){n=""+y,f.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(y){n=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function nc(e){if(!e._valueTracker){var t=jf(e)?"checked":"value";e._valueTracker=Xv(e,t,""+e[t])}}function Nf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=jf(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function ol(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 Qv=/[\n"\\]/g;function Ft(e){return e.replace(Qv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function rc(e,t,n,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=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?ic(e,y,Zt(t)):n!=null?ic(e,y,Zt(n)):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=""+Zt(b):e.removeAttribute("name")}function Ef(e,t,n,i,u,f,y,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||n!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){nc(e);return}n=n!=null?""+Zt(n):"",t=t!=null?""+Zt(t):n,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),nc(e)}function ic(e,t,n){t==="number"&&ol(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Mn(e,t,n,i){if(e=e.options,t){t={};for(var u=0;u<n.length;u++)t["$"+n[u]]=!0;for(n=0;n<e.length;n++)u=t.hasOwnProperty("$"+e[n].value),e[n].selected!==u&&(e[n].selected=u),u&&i&&(e[n].defaultSelected=!0)}else{for(n=""+Zt(n),t=null,u=0;u<e.length;u++){if(e[u].value===n){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Tf(e,t,n){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Zt(n):""}function Af(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(l(92));if(qe(i)){if(1<i.length)throw Error(l(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=Zt(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),nc(e)}function zn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Zv=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 kf(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!="number"||n===0||Zv.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Cf(e,t,n){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,n!=null){for(var i in n)!n.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)&&n[u]!==i&&kf(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&kf(e,f,t[f])}function lc(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 Fv=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"]]),Wv=/^[\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 cl(e){return Wv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function za(){}var oc=null;function cc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Un=null,Ln=null;function Of(e){var t=On(e);if(t&&(e=t.stateNode)){var n=e[Dt]||null;e:switch(e=t.stateNode,t.type){case"input":if(rc(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ft(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var u=i[Dt]||null;if(!u)throw Error(l(90));rc(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&Nf(i)}break e;case"textarea":Tf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Mn(e,!!n.multiple,t,!1)}}}var uc=!1;function Rf(e,t,n){if(uc)return e(t,n);uc=!0;try{var i=e(t);return i}finally{if(uc=!1,(Un!==null||Ln!==null)&&(Ql(),Un&&(t=Un,e=Ln,Ln=Un=null,Of(t),e)))for(t=0;t<e.length;t++)Of(e[t])}}function Pr(e,t){var n=e.stateNode;if(n===null)return null;var i=n[Dt]||null;if(i===null)return null;n=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(n&&typeof n!="function")throw Error(l(231,t,typeof n));return n}var Ua=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dc=!1;if(Ua)try{var Kr={};Object.defineProperty(Kr,"passive",{get:function(){dc=!0}}),window.addEventListener("test",Kr,Kr),window.removeEventListener("test",Kr,Kr)}catch{dc=!1}var os=null,fc=null,ul=null;function Df(){if(ul)return ul;var e,t=fc,n=t.length,i,u="value"in os?os.value:os.textContent,f=u.length;for(e=0;e<n&&t[e]===u[e];e++);var y=n-e;for(i=1;i<=y&&t[n-i]===u[f-i];i++);return ul=u.slice(e,1<i?1-i:void 0)}function dl(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 fl(){return!0}function Mf(){return!1}function Mt(e){function t(n,i,u,f,y){this._reactName=n,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(n=e[b],this[b]=n?n(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?fl:Mf,this.isPropagationStopped=Mf,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=fl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=fl)},persist:function(){},isPersistent:fl}),t}var Ks={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hl=Mt(Ks),Yr=w({},Ks,{view:0,detail:0}),e0=Mt(Yr),hc,mc,Jr,ml=w({},Yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,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!==Jr&&(Jr&&e.type==="mousemove"?(hc=e.screenX-Jr.screenX,mc=e.screenY-Jr.screenY):mc=hc=0,Jr=e),hc)},movementY:function(e){return"movementY"in e?e.movementY:mc}}),zf=Mt(ml),t0=w({},ml,{dataTransfer:0}),a0=Mt(t0),s0=w({},Yr,{relatedTarget:0}),pc=Mt(s0),n0=w({},Ks,{animationName:0,elapsedTime:0,pseudoElement:0}),r0=Mt(n0),i0=w({},Ks,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),l0=Mt(i0),o0=w({},Ks,{data:0}),Uf=Mt(o0),c0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},u0={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"},d0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function f0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=d0[e])?!!t[e]:!1}function gc(){return f0}var h0=w({},Yr,{key:function(e){if(e.key){var t=c0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=dl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?u0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(e){return e.type==="keypress"?dl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?dl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),m0=Mt(h0),p0=w({},ml,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lf=Mt(p0),g0=w({},Yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),y0=Mt(g0),v0=w({},Ks,{propertyName:0,elapsedTime:0,pseudoElement:0}),b0=Mt(v0),x0=w({},ml,{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}),w0=Mt(x0),_0=w({},Ks,{newState:0,oldState:0}),S0=Mt(_0),j0=[9,13,27,32],yc=Ua&&"CompositionEvent"in window,Xr=null;Ua&&"documentMode"in document&&(Xr=document.documentMode);var N0=Ua&&"TextEvent"in window&&!Xr,Bf=Ua&&(!yc||Xr&&8<Xr&&11>=Xr),qf=" ",$f=!1;function Hf(e,t){switch(e){case"keyup":return j0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bn=!1;function E0(e,t){switch(e){case"compositionend":return Vf(t);case"keypress":return t.which!==32?null:($f=!0,qf);case"textInput":return e=t.data,e===qf&&$f?null:e;default:return null}}function T0(e,t){if(Bn)return e==="compositionend"||!yc&&Hf(e,t)?(e=Df(),ul=fc=os=null,Bn=!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 Bf&&t.locale!=="ko"?null:t.data;default:return null}}var A0={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 If(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!A0[e.type]:t==="textarea"}function Gf(e,t,n,i){Un?Ln?Ln.push(i):Ln=[i]:Un=i,t=so(t,"onChange"),0<t.length&&(n=new hl("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var Qr=null,Zr=null;function k0(e){Ep(e,0)}function pl(e){var t=Gr(e);if(Nf(t))return e}function Pf(e,t){if(e==="change")return t}var Kf=!1;if(Ua){var vc;if(Ua){var bc="oninput"in document;if(!bc){var Yf=document.createElement("div");Yf.setAttribute("oninput","return;"),bc=typeof Yf.oninput=="function"}vc=bc}else vc=!1;Kf=vc&&(!document.documentMode||9<document.documentMode)}function Jf(){Qr&&(Qr.detachEvent("onpropertychange",Xf),Zr=Qr=null)}function Xf(e){if(e.propertyName==="value"&&pl(Zr)){var t=[];Gf(t,Zr,e,cc(e)),Rf(k0,t)}}function C0(e,t,n){e==="focusin"?(Jf(),Qr=t,Zr=n,Qr.attachEvent("onpropertychange",Xf)):e==="focusout"&&Jf()}function O0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return pl(Zr)}function R0(e,t){if(e==="click")return pl(t)}function D0(e,t){if(e==="input"||e==="change")return pl(t)}function M0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ht=typeof Object.is=="function"?Object.is:M0;function Fr(e,t){if(Ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var u=n[i];if(!rs.call(t,u)||!Ht(e[u],t[u]))return!1}return!0}function Qf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zf(e,t){var n=Qf(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Qf(n)}}function Ff(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ff(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ol(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ol(e.document)}return t}function xc(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 z0=Ua&&"documentMode"in document&&11>=document.documentMode,qn=null,wc=null,Wr=null,_c=!1;function eh(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_c||qn==null||qn!==ol(i)||(i=qn,"selectionStart"in i&&xc(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}),Wr&&Fr(Wr,i)||(Wr=i,i=so(wc,"onSelect"),0<i.length&&(t=new hl("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=qn)))}function Ys(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var $n={animationend:Ys("Animation","AnimationEnd"),animationiteration:Ys("Animation","AnimationIteration"),animationstart:Ys("Animation","AnimationStart"),transitionrun:Ys("Transition","TransitionRun"),transitionstart:Ys("Transition","TransitionStart"),transitioncancel:Ys("Transition","TransitionCancel"),transitionend:Ys("Transition","TransitionEnd")},Sc={},th={};Ua&&(th=document.createElement("div").style,"AnimationEvent"in window||(delete $n.animationend.animation,delete $n.animationiteration.animation,delete $n.animationstart.animation),"TransitionEvent"in window||delete $n.transitionend.transition);function Js(e){if(Sc[e])return Sc[e];if(!$n[e])return e;var t=$n[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in th)return Sc[e]=t[n];return e}var ah=Js("animationend"),sh=Js("animationiteration"),nh=Js("animationstart"),U0=Js("transitionrun"),L0=Js("transitionstart"),B0=Js("transitioncancel"),rh=Js("transitionend"),ih=new Map,jc="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(" ");jc.push("scrollEnd");function oa(e,t){ih.set(e,t),Ps(t,[e])}var gl=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)},Wt=[],Hn=0,Nc=0;function yl(){for(var e=Hn,t=Nc=Hn=0;t<e;){var n=Wt[t];Wt[t++]=null;var i=Wt[t];Wt[t++]=null;var u=Wt[t];Wt[t++]=null;var f=Wt[t];if(Wt[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&&lh(n,u,f)}}function vl(e,t,n,i){Wt[Hn++]=e,Wt[Hn++]=t,Wt[Hn++]=n,Wt[Hn++]=i,Nc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Ec(e,t,n,i){return vl(e,t,n,i),bl(e)}function Xs(e,t){return vl(e,null,null,t),bl(e)}function lh(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var u=!1,f=e.return;f!==null;)f.childLanes|=n,i=f.alternate,i!==null&&(i.childLanes|=n),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-Ot(n),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=n|536870912),f):null}function bl(e){if(50<wi)throw wi=0,zu=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Vn={};function q0(e,t,n,i){this.tag=e,this.key=n,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 Vt(e,t,n,i){return new q0(e,t,n,i)}function Tc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function La(e,t){var n=e.alternate;return n===null?(n=Vt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function oh(e,t){e.flags&=65011714;var n=e.alternate;return n===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=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function xl(e,t,n,i,u,f){var y=0;if(i=e,typeof e=="function")Tc(e)&&(y=1);else if(typeof e=="string")y=Gb(e,n,F.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ce:return e=Vt(31,n,t,u),e.elementType=ce,e.lanes=f,e;case j:return Qs(n.children,u,f,t);case O:y=8,u|=24;break;case D:return e=Vt(12,n,t,u|2),e.elementType=D,e.lanes=f,e;case W:return e=Vt(13,n,t,u),e.elementType=W,e.lanes=f,e;case J:return e=Vt(19,n,t,u),e.elementType=J,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:y=10;break e;case q:y=9;break e;case G:y=11;break e;case P:y=14;break e;case Q:y=16,i=null;break e}y=29,n=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=Vt(y,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Qs(e,t,n,i){return e=Vt(7,e,i,t),e.lanes=n,e}function Ac(e,t,n){return e=Vt(6,e,null,t),e.lanes=n,e}function ch(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function kc(e,t,n){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var uh=new WeakMap;function ea(e,t){if(typeof e=="object"&&e!==null){var n=uh.get(e);return n!==void 0?n:(t={value:e,source:t,stack:qr(t)},uh.set(e,t),t)}return{value:e,source:t,stack:qr(t)}}var In=[],Gn=0,wl=null,ei=0,ta=[],aa=0,cs=null,xa=1,wa="";function Ba(e,t){In[Gn++]=ei,In[Gn++]=wl,wl=e,ei=t}function dh(e,t,n){ta[aa++]=xa,ta[aa++]=wa,ta[aa++]=cs,cs=e;var i=xa;e=wa;var u=32-Ot(i)-1;i&=~(1<<u),n+=1;var f=32-Ot(t)+u;if(30<f){var y=u-u%5;f=(i&(1<<y)-1).toString(32),i>>=y,u-=y,xa=1<<32-Ot(t)+u|n<<u|i,wa=f+e}else xa=1<<f|n<<u|i,wa=e}function Cc(e){e.return!==null&&(Ba(e,1),dh(e,1,0))}function Oc(e){for(;e===wl;)wl=In[--Gn],In[Gn]=null,ei=In[--Gn],In[Gn]=null;for(;e===cs;)cs=ta[--aa],ta[aa]=null,wa=ta[--aa],ta[aa]=null,xa=ta[--aa],ta[aa]=null}function fh(e,t){ta[aa++]=xa,ta[aa++]=wa,ta[aa++]=cs,xa=t.id,wa=t.overflow,cs=e}var _t=null,Ke=null,Ce=!1,us=null,sa=!1,Rc=Error(l(519));function ds(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ti(ea(t,e)),Rc}function hh(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[ut]=e,t[Dt]=i,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<Si.length;n++)Ee(Si[n],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),Ef(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),Af(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||Cp(t.textContent,n)?(i.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),i.onScroll!=null&&Ee("scroll",t),i.onScrollEnd!=null&&Ee("scrollend",t),i.onClick!=null&&(t.onclick=za),t=!0):t=!1,t||ds(e,!0)}function mh(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:_t=_t.return}}function Pn(e){if(e!==_t)return!1;if(!Ce)return mh(e),Ce=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Qu(e.type,e.memoizedProps)),n=!n),n&&Ke&&ds(e),mh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=qp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=qp(e)}else t===27?(t=Ke,Ns(e.type)?(e=td,td=null,Ke=e):Ke=t):Ke=_t?ra(e.stateNode.nextSibling):null;return!0}function Zs(){Ke=_t=null,Ce=!1}function Dc(){var e=us;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),us=null),e}function ti(e){us===null?us=[e]:us.push(e)}var Mc=A(null),Fs=null,qa=null;function fs(e,t,n){X(Mc,t._currentValue),t._currentValue=n}function $a(e){e._currentValue=Mc.current,V(Mc)}function zc(e,t,n){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===n)break;e=e.return}}function Uc(e,t,n,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var b=f;f=u;for(var N=0;N<t.length;N++)if(b.context===t[N]){f.lanes|=n,b=f.alternate,b!==null&&(b.lanes|=n),zc(f.return,n,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|=n,f=y.alternate,f!==null&&(f.lanes|=n),zc(y,n,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 Kn(e,t,n,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;Ht(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(Ai):e=[Ai])}u=u.return}e!==null&&Uc(t,e,n,i),t.flags|=262144}function _l(e){for(e=e.firstContext;e!==null;){if(!Ht(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ws(e){Fs=e,qa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ph(Fs,e)}function Sl(e,t){return Fs===null&&Ws(e),ph(e,t)}function ph(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qa===null){if(e===null)throw Error(l(308));qa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qa=qa.next=t;return n}var $0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},H0=s.unstable_scheduleCallback,V0=s.unstable_NormalPriority,nt={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lc(){return{controller:new $0,data:new Map,refCount:0}}function ai(e){e.refCount--,e.refCount===0&&H0(V0,function(){e.controller.abort()})}var si=null,Bc=0,Yn=0,Jn=null;function I0(e,t){if(si===null){var n=si=[];Bc=0,Yn=Hu(),Jn={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Bc++,t.then(gh,gh),t}function gh(){if(--Bc===0&&si!==null){Jn!==null&&(Jn.status="fulfilled");var e=si;si=null,Yn=0,Jn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function G0(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(u){n.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<n.length;u++)(0,n[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<n.length;u++)(0,n[u])(void 0)}),i}var yh=k.S;k.S=function(e,t){ep=gt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&I0(e,t),yh!==null&&yh(e,t)};var en=A(null);function qc(){var e=en.current;return e!==null?e:Ie.pooledCache}function jl(e,t){t===null?X(en,en.current):X(en,t.pool)}function vh(){var e=qc();return e===null?null:{parent:nt._currentValue,pool:e}}var Xn=Error(l(460)),$c=Error(l(474)),Nl=Error(l(542)),El={then:function(){}};function bh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xh(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(za,za),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_h(e),e;default:if(typeof t.status=="string")t.then(za,za);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,_h(e),e}throw an=t,Xn}}function tn(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(an=n,Xn):n}}var an=null;function wh(){if(an===null)throw Error(l(459));var e=an;return an=null,e}function _h(e){if(e===Xn||e===Nl)throw Error(l(483))}var Qn=null,ni=0;function Tl(e){var t=ni;return ni+=1,Qn===null&&(Qn=[]),xh(Qn,e,t)}function ri(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Al(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 Sh(e){function t(C,T){if(e){var M=C.deletions;M===null?(C.deletions=[T],C.flags|=16):M.push(T)}}function n(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=La(C,T),C.index=0,C.sibling=null,C}function f(C,T,M){return C.index=M,e?(M=C.alternate,M!==null?(M=M.index,M<T?(C.flags|=67108866,T):M):(C.flags|=67108866,T)):(C.flags|=1048576,T)}function y(C){return e&&C.alternate===null&&(C.flags|=67108866),C}function b(C,T,M,H){return T===null||T.tag!==6?(T=Ac(M,C.mode,H),T.return=C,T):(T=u(T,M),T.return=C,T)}function N(C,T,M,H){var oe=M.type;return oe===j?$(C,T,M.props.children,H,M.key):T!==null&&(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===Q&&tn(oe)===T.type)?(T=u(T,M.props),ri(T,M),T.return=C,T):(T=xl(M.type,M.key,M.props,null,C.mode,H),ri(T,M),T.return=C,T)}function z(C,T,M,H){return T===null||T.tag!==4||T.stateNode.containerInfo!==M.containerInfo||T.stateNode.implementation!==M.implementation?(T=kc(M,C.mode,H),T.return=C,T):(T=u(T,M.children||[]),T.return=C,T)}function $(C,T,M,H,oe){return T===null||T.tag!==7?(T=Qs(M,C.mode,H,oe),T.return=C,T):(T=u(T,M),T.return=C,T)}function I(C,T,M){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=Ac(""+T,C.mode,M),T.return=C,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case S:return M=xl(T.type,T.key,T.props,null,C.mode,M),ri(M,T),M.return=C,M;case E:return T=kc(T,C.mode,M),T.return=C,T;case Q:return T=tn(T),I(C,T,M)}if(qe(T)||pe(T))return T=Qs(T,C.mode,M,null),T.return=C,T;if(typeof T.then=="function")return I(C,Tl(T),M);if(T.$$typeof===B)return I(C,Sl(C,T),M);Al(C,T)}return null}function U(C,T,M,H){var oe=T!==null?T.key:null;if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return oe!==null?null:b(C,T,""+M,H);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case S:return M.key===oe?N(C,T,M,H):null;case E:return M.key===oe?z(C,T,M,H):null;case Q:return M=tn(M),U(C,T,M,H)}if(qe(M)||pe(M))return oe!==null?null:$(C,T,M,H,null);if(typeof M.then=="function")return U(C,T,Tl(M),H);if(M.$$typeof===B)return U(C,T,Sl(C,M),H);Al(C,M)}return null}function L(C,T,M,H,oe){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return C=C.get(M)||null,b(T,C,""+H,oe);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return C=C.get(H.key===null?M:H.key)||null,N(T,C,H,oe);case E:return C=C.get(H.key===null?M:H.key)||null,z(T,C,H,oe);case Q:return H=tn(H),L(C,T,M,H,oe)}if(qe(H)||pe(H))return C=C.get(M)||null,$(T,C,H,oe,null);if(typeof H.then=="function")return L(C,T,M,Tl(H),oe);if(H.$$typeof===B)return L(C,T,M,Sl(T,H),oe);Al(T,H)}return null}function te(C,T,M,H){for(var oe=null,Re=null,ie=T,xe=T=0,Ae=null;ie!==null&&xe<M.length;xe++){ie.index>xe?(Ae=ie,ie=null):Ae=ie.sibling;var De=U(C,ie,M[xe],H);if(De===null){ie===null&&(ie=Ae);break}e&&ie&&De.alternate===null&&t(C,ie),T=f(De,T,xe),Re===null?oe=De:Re.sibling=De,Re=De,ie=Ae}if(xe===M.length)return n(C,ie),Ce&&Ba(C,xe),oe;if(ie===null){for(;xe<M.length;xe++)ie=I(C,M[xe],H),ie!==null&&(T=f(ie,T,xe),Re===null?oe=ie:Re.sibling=ie,Re=ie);return Ce&&Ba(C,xe),oe}for(ie=i(ie);xe<M.length;xe++)Ae=L(ie,C,xe,M[xe],H),Ae!==null&&(e&&Ae.alternate!==null&&ie.delete(Ae.key===null?xe:Ae.key),T=f(Ae,T,xe),Re===null?oe=Ae:Re.sibling=Ae,Re=Ae);return e&&ie.forEach(function(Cs){return t(C,Cs)}),Ce&&Ba(C,xe),oe}function fe(C,T,M,H){if(M==null)throw Error(l(151));for(var oe=null,Re=null,ie=T,xe=T=0,Ae=null,De=M.next();ie!==null&&!De.done;xe++,De=M.next()){ie.index>xe?(Ae=ie,ie=null):Ae=ie.sibling;var Cs=U(C,ie,De.value,H);if(Cs===null){ie===null&&(ie=Ae);break}e&&ie&&Cs.alternate===null&&t(C,ie),T=f(Cs,T,xe),Re===null?oe=Cs:Re.sibling=Cs,Re=Cs,ie=Ae}if(De.done)return n(C,ie),Ce&&Ba(C,xe),oe;if(ie===null){for(;!De.done;xe++,De=M.next())De=I(C,De.value,H),De!==null&&(T=f(De,T,xe),Re===null?oe=De:Re.sibling=De,Re=De);return Ce&&Ba(C,xe),oe}for(ie=i(ie);!De.done;xe++,De=M.next())De=L(ie,C,xe,De.value,H),De!==null&&(e&&De.alternate!==null&&ie.delete(De.key===null?xe:De.key),T=f(De,T,xe),Re===null?oe=De:Re.sibling=De,Re=De);return e&&ie.forEach(function(tx){return t(C,tx)}),Ce&&Ba(C,xe),oe}function Ve(C,T,M,H){if(typeof M=="object"&&M!==null&&M.type===j&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case S:e:{for(var oe=M.key;T!==null;){if(T.key===oe){if(oe=M.type,oe===j){if(T.tag===7){n(C,T.sibling),H=u(T,M.props.children),H.return=C,C=H;break e}}else if(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===Q&&tn(oe)===T.type){n(C,T.sibling),H=u(T,M.props),ri(H,M),H.return=C,C=H;break e}n(C,T);break}else t(C,T);T=T.sibling}M.type===j?(H=Qs(M.props.children,C.mode,H,M.key),H.return=C,C=H):(H=xl(M.type,M.key,M.props,null,C.mode,H),ri(H,M),H.return=C,C=H)}return y(C);case E:e:{for(oe=M.key;T!==null;){if(T.key===oe)if(T.tag===4&&T.stateNode.containerInfo===M.containerInfo&&T.stateNode.implementation===M.implementation){n(C,T.sibling),H=u(T,M.children||[]),H.return=C,C=H;break e}else{n(C,T);break}else t(C,T);T=T.sibling}H=kc(M,C.mode,H),H.return=C,C=H}return y(C);case Q:return M=tn(M),Ve(C,T,M,H)}if(qe(M))return te(C,T,M,H);if(pe(M)){if(oe=pe(M),typeof oe!="function")throw Error(l(150));return M=oe.call(M),fe(C,T,M,H)}if(typeof M.then=="function")return Ve(C,T,Tl(M),H);if(M.$$typeof===B)return Ve(C,T,Sl(C,M),H);Al(C,M)}return typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint"?(M=""+M,T!==null&&T.tag===6?(n(C,T.sibling),H=u(T,M),H.return=C,C=H):(n(C,T),H=Ac(M,C.mode,H),H.return=C,C=H),y(C)):n(C,T)}return function(C,T,M,H){try{ni=0;var oe=Ve(C,T,M,H);return Qn=null,oe}catch(ie){if(ie===Xn||ie===Nl)throw ie;var Re=Vt(29,ie,null,C.mode);return Re.lanes=H,Re.return=C,Re}}}var sn=Sh(!0),jh=Sh(!1),hs=!1;function Hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vc(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 ms(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ps(e,t,n){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=bl(e),lh(e,null,n),t}return vl(e,i,t,n),bl(e)}function ii(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ee(e,n)}}function Ic(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var u=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var y={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,n=n.next}while(n!==null);f===null?u=f=t:f=f.next=t}else u=f=t;n={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Gc=!1;function li(){if(Gc){var e=Jn;if(e!==null)throw e}}function oi(e,t,n,i){Gc=!1;var u=e.updateQueue;hs=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var N=b,z=N.next;N.next=null,y===null?f=z:y.next=z,y=N;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==y&&(b===null?$.firstBaseUpdate=z:b.next=z,$.lastBaseUpdate=N))}if(f!==null){var I=u.baseState;y=0,$=z=N=null,b=f;do{var U=b.lane&-536870913,L=U!==b.lane;if(L?(Te&U)===U:(i&U)===U){U!==0&&U===Yn&&(Gc=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var te=e,fe=b;U=t;var Ve=n;switch(fe.tag){case 1:if(te=fe.payload,typeof te=="function"){I=te.call(Ve,I,U);break e}I=te;break e;case 3:te.flags=te.flags&-65537|128;case 0:if(te=fe.payload,U=typeof te=="function"?te.call(Ve,I,U):te,U==null)break e;I=w({},I,U);break e;case 2:hs=!0}}U=b.callback,U!==null&&(e.flags|=64,L&&(e.flags|=8192),L=u.callbacks,L===null?u.callbacks=[U]:L.push(U))}else L={lane:U,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(z=$=L,N=I):$=$.next=L,y|=U;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;L=b,b=L.next,L.next=null,u.lastBaseUpdate=L,u.shared.pending=null}}while(!0);$===null&&(N=I),u.baseState=N,u.firstBaseUpdate=z,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),xs|=y,e.lanes=y,e.memoizedState=I}}function Nh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Eh(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Nh(n[e],t)}var Zn=A(null),kl=A(0);function Th(e,t){e=Xa,X(kl,e),X(Zn,t),Xa=e|t.baseLanes}function Pc(){X(kl,Xa),X(Zn,Zn.current)}function Kc(){Xa=kl.current,V(Zn),V(kl)}var It=A(null),na=null;function gs(e){var t=e.alternate;X(tt,tt.current&1),X(It,e),na===null&&(t===null||Zn.current!==null||t.memoizedState!==null)&&(na=e)}function Yc(e){X(tt,tt.current),X(It,e),na===null&&(na=e)}function Ah(e){e.tag===22?(X(tt,tt.current),X(It,e),na===null&&(na=e)):ys()}function ys(){X(tt,tt.current),X(It,It.current)}function Gt(e){V(It),na===e&&(na=null),V(tt)}var tt=A(0);function Cl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Wu(n)||ed(n)))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 Ha=0,be=null,$e=null,rt=null,Ol=!1,Fn=!1,nn=!1,Rl=0,ci=0,Wn=null,P0=0;function Fe(){throw Error(l(321))}function Jc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ht(e[n],t[n]))return!1;return!0}function Xc(e,t,n,i,u,f){return Ha=f,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?dm:uu,nn=!1,f=n(i,u),nn=!1,Fn&&(f=Ch(t,n,i,u)),kh(e),f}function kh(e){k.H=fi;var t=$e!==null&&$e.next!==null;if(Ha=0,rt=$e=be=null,Ol=!1,ci=0,Wn=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&_l(e)&&(it=!0))}function Ch(e,t,n,i){be=e;var u=0;do{if(Fn&&(Wn=null),ci=0,Fn=!1,25<=u)throw Error(l(301));if(u+=1,rt=$e=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}k.H=fm,f=t(n,i)}while(Fn);return f}function K0(){var e=k.H,t=e.useState()[0];return t=typeof t.then=="function"?ui(t):t,e=e.useState()[0],($e!==null?$e.memoizedState:null)!==e&&(be.flags|=1024),t}function Qc(){var e=Rl!==0;return Rl=0,e}function Zc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Fc(e){if(Ol){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ol=!1}Ha=0,rt=$e=be=null,Fn=!1,ci=Rl=0,Wn=null}function Rt(){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($e===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=$e.next;var t=rt===null?be.memoizedState:rt.next;if(t!==null)rt=t,$e=e;else{if(e===null)throw be.alternate===null?Error(l(467)):Error(l(310));$e=e,e={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},rt===null?be.memoizedState=rt=e:rt=rt.next=e}return rt}function Dl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ui(e){var t=ci;return ci+=1,Wn===null&&(Wn=[]),e=xh(Wn,e,t),t=be,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?dm:uu),e}function Ml(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ui(e);if(e.$$typeof===B)return St(e)}throw Error(l(438,String(e)))}function Wc(e){var t=null,n=be.updateQueue;if(n!==null&&(t=n.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}),n===null&&(n=Dl(),be.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=Je;return t.index++,n}function Va(e,t){return typeof t=="function"?t(e):t}function zl(e){var t=at();return eu(t,$e,e)}function eu(e,t,n){var i=e.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=n;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var b=y=null,N=null,z=t,$=!1;do{var I=z.lane&-536870913;if(I!==z.lane?(Te&I)===I:(Ha&I)===I){var U=z.revertLane;if(U===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),I===Yn&&($=!0);else if((Ha&U)===U){z=z.next,U===Yn&&($=!0);continue}else I={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(b=N=I,y=f):N=N.next=I,be.lanes|=U,xs|=U;I=z.action,nn&&n(f,I),f=z.hasEagerState?z.eagerState:n(f,I)}else U={lane:I,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(b=N=U,y=f):N=N.next=U,be.lanes|=I,xs|=I;z=z.next}while(z!==null&&z!==t);if(N===null?y=f:N.next=b,!Ht(f,e.memoizedState)&&(it=!0,$&&(n=Jn,n!==null)))throw n;e.memoizedState=f,e.baseState=y,e.baseQueue=N,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function tu(e){var t=at(),n=t.queue;if(n===null)throw Error(l(311));n.lastRenderedReducer=e;var i=n.dispatch,u=n.pending,f=t.memoizedState;if(u!==null){n.pending=null;var y=u=u.next;do f=e(f,y.action),y=y.next;while(y!==u);Ht(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,i]}function Oh(e,t,n){var i=be,u=at(),f=Ce;if(f){if(n===void 0)throw Error(l(407));n=n()}else n=t();var y=!Ht(($e||u).memoizedState,n);if(y&&(u.memoizedState=n,it=!0),u=u.queue,nu(Mh.bind(null,i,u,e),[e]),u.getSnapshot!==t||y||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,er(9,{destroy:void 0},Dh.bind(null,i,u,n,t),null),Ie===null)throw Error(l(349));f||(Ha&127)!==0||Rh(i,t,n)}return n}function Rh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t=Dl(),be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Dh(e,t,n,i){t.value=n,t.getSnapshot=i,zh(t)&&Uh(e)}function Mh(e,t,n){return n(function(){zh(t)&&Uh(e)})}function zh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ht(e,n)}catch{return!0}}function Uh(e){var t=Xs(e,2);t!==null&&qt(t,e,2)}function au(e){var t=Rt();if(typeof e=="function"){var n=e;if(e=n(),nn){va(!0);try{n()}finally{va(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:e},t}function Lh(e,t,n,i){return e.baseState=n,eu(e,$e,typeof i=="function"?i:Va)}function Y0(e,t,n,i,u){if(Bl(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)}};k.T!==null?n(!0):f.isTransition=!1,i(f),n=t.pending,n===null?(f.next=t.pending=f,Bh(t,f)):(f.next=n.next,t.pending=n.next=f)}}function Bh(e,t){var n=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=k.T,y={};k.T=y;try{var b=n(u,i),N=k.S;N!==null&&N(y,b),qh(e,t,b)}catch(z){su(e,t,z)}finally{f!==null&&y.types!==null&&(f.types=y.types),k.T=f}}else try{f=n(u,i),qh(e,t,f)}catch(z){su(e,t,z)}}function qh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){$h(e,t,i)},function(i){return su(e,t,i)}):$h(e,t,n)}function $h(e,t,n){t.status="fulfilled",t.value=n,Hh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Bh(e,n)))}function su(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,Hh(t),t=t.next;while(t!==i)}e.action=null}function Hh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Vh(e,t){return t}function Ih(e,t){if(Ce){var n=Ie.formState;if(n!==null){e:{var i=be;if(Ce){if(Ke){t:{for(var u=Ke,f=sa;u.nodeType!==8;){if(!f){u=null;break t}if(u=ra(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ke=ra(u.nextSibling),i=u.data==="F!";break e}}ds(i)}i=!1}i&&(t=n[0])}}return n=Rt(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vh,lastRenderedState:t},n.queue=i,n=om.bind(null,be,i),i.dispatch=n,i=au(!1),f=cu.bind(null,be,!1,i.queue),i=Rt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=Y0.bind(null,be,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function Gh(e){var t=at();return Ph(t,$e,e)}function Ph(e,t,n){if(t=eu(e,t,Vh)[0],e=zl(Va)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=ui(t)}catch(y){throw y===Xn?Nl:y}else i=t;t=at();var u=t.queue,f=u.dispatch;return n!==t.memoizedState&&(be.flags|=2048,er(9,{destroy:void 0},J0.bind(null,u,n),null)),[i,f,e]}function J0(e,t){e.action=t}function Kh(e){var t=at(),n=$e;if(n!==null)return Ph(t,n,e);at(),t=t.memoizedState,n=at();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function er(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=be.updateQueue,t===null&&(t=Dl(),be.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Yh(){return at().memoizedState}function Ul(e,t,n,i){var u=Rt();be.flags|=e,u.memoizedState=er(1|t,{destroy:void 0},n,i===void 0?null:i)}function Ll(e,t,n,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;$e!==null&&i!==null&&Jc(i,$e.memoizedState.deps)?u.memoizedState=er(t,f,n,i):(be.flags|=e,u.memoizedState=er(1|t,f,n,i))}function Jh(e,t){Ul(8390656,8,e,t)}function nu(e,t){Ll(2048,8,e,t)}function X0(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=Dl(),be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Xh(e){var t=at().memoizedState;return X0({ref:t,nextImpl:e}),function(){if((Me&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Qh(e,t){return Ll(4,2,e,t)}function Zh(e,t){return Ll(4,4,e,t)}function Fh(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Wh(e,t,n){n=n!=null?n.concat([e]):null,Ll(4,4,Fh.bind(null,t,e),n)}function ru(){}function em(e,t){var n=at();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&Jc(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function tm(e,t){var n=at();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Jc(t,i[1]))return i[0];if(i=e(),nn){va(!0);try{e()}finally{va(!1)}}return n.memoizedState=[i,t],i}function iu(e,t,n){return n===void 0||(Ha&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=ap(),be.lanes|=e,xs|=e,n)}function am(e,t,n,i){return Ht(n,t)?n:Zn.current!==null?(e=iu(e,n,i),Ht(e,t)||(it=!0),e):(Ha&42)===0||(Ha&1073741824)!==0&&(Te&261930)===0?(it=!0,e.memoizedState=n):(e=ap(),be.lanes|=e,xs|=e,t)}function sm(e,t,n,i,u){var f=Y.p;Y.p=f!==0&&8>f?f:8;var y=k.T,b={};k.T=b,cu(e,!1,t,n);try{var N=u(),z=k.S;if(z!==null&&z(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var $=G0(N,i);di(e,t,$,Yt(e))}else di(e,t,i,Yt(e))}catch(I){di(e,t,{then:function(){},status:"rejected",reason:I},Yt())}finally{Y.p=f,y!==null&&b.types!==null&&(y.types=b.types),k.T=y}}function Q0(){}function lu(e,t,n,i){if(e.tag!==5)throw Error(l(476));var u=nm(e).queue;sm(e,u,t,K,n===null?Q0:function(){return rm(e),n(i)})}function nm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:K},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function rm(e){var t=nm(e);t.next===null&&(t=e.alternate.memoizedState),di(e,t.next.queue,{},Yt())}function ou(){return St(Ai)}function im(){return at().memoizedState}function lm(){return at().memoizedState}function Z0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Yt();e=ms(n);var i=ps(t,e,n);i!==null&&(qt(i,t,n),ii(i,t,n)),t={cache:Lc()},e.payload=t;return}t=t.return}}function F0(e,t,n){var i=Yt();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Bl(e)?cm(t,n):(n=Ec(e,t,n,i),n!==null&&(qt(n,e,i),um(n,t,i)))}function om(e,t,n){var i=Yt();di(e,t,n,i)}function di(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bl(e))cm(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,n);if(u.hasEagerState=!0,u.eagerState=b,Ht(b,y))return vl(e,t,u,0),Ie===null&&yl(),!1}catch{}if(n=Ec(e,t,u,i),n!==null)return qt(n,e,i),um(n,t,i),!0}return!1}function cu(e,t,n,i){if(i={lane:2,revertLane:Hu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Bl(e)){if(t)throw Error(l(479))}else t=Ec(e,n,i,2),t!==null&&qt(t,e,2)}function Bl(e){var t=e.alternate;return e===be||t!==null&&t===be}function cm(e,t){Fn=Ol=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function um(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ee(e,n)}}var fi={readContext:St,use:Ml,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};fi.useEffectEvent=Fe;var dm={readContext:St,use:Ml,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Jh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ul(4194308,4,Fh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ul(4194308,4,e,t)},useInsertionEffect:function(e,t){Ul(4,2,e,t)},useMemo:function(e,t){var n=Rt();t=t===void 0?null:t;var i=e();if(nn){va(!0);try{e()}finally{va(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=Rt();if(n!==void 0){var u=n(t);if(nn){va(!0);try{n(t)}finally{va(!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=F0.bind(null,be,e),[i.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=au(e);var t=e.queue,n=om.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ru,useDeferredValue:function(e,t){var n=Rt();return iu(n,e,t)},useTransition:function(){var e=au(!1);return e=sm.bind(null,be,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=be,u=Rt();if(Ce){if(n===void 0)throw Error(l(407));n=n()}else{if(n=t(),Ie===null)throw Error(l(349));(Te&127)!==0||Rh(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,Jh(Mh.bind(null,i,f,e),[e]),i.flags|=2048,er(9,{destroy:void 0},Dh.bind(null,i,f,n,t),null),n},useId:function(){var e=Rt(),t=Ie.identifierPrefix;if(Ce){var n=wa,i=xa;n=(i&~(1<<32-Ot(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Rl++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=P0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ou,useFormState:Ih,useActionState:Ih,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=cu.bind(null,be,!0,n),n.dispatch=t,[e,t]},useMemoCache:Wc,useCacheRefresh:function(){return Rt().memoizedState=Z0.bind(null,be)},useEffectEvent:function(e){var t=Rt(),n={impl:e};return t.memoizedState=n,function(){if((Me&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}},uu={readContext:St,use:Ml,useCallback:em,useContext:St,useEffect:nu,useImperativeHandle:Wh,useInsertionEffect:Qh,useLayoutEffect:Zh,useMemo:tm,useReducer:zl,useRef:Yh,useState:function(){return zl(Va)},useDebugValue:ru,useDeferredValue:function(e,t){var n=at();return am(n,$e.memoizedState,e,t)},useTransition:function(){var e=zl(Va)[0],t=at().memoizedState;return[typeof e=="boolean"?e:ui(e),t]},useSyncExternalStore:Oh,useId:im,useHostTransitionStatus:ou,useFormState:Gh,useActionState:Gh,useOptimistic:function(e,t){var n=at();return Lh(n,$e,e,t)},useMemoCache:Wc,useCacheRefresh:lm};uu.useEffectEvent=Xh;var fm={readContext:St,use:Ml,useCallback:em,useContext:St,useEffect:nu,useImperativeHandle:Wh,useInsertionEffect:Qh,useLayoutEffect:Zh,useMemo:tm,useReducer:tu,useRef:Yh,useState:function(){return tu(Va)},useDebugValue:ru,useDeferredValue:function(e,t){var n=at();return $e===null?iu(n,e,t):am(n,$e.memoizedState,e,t)},useTransition:function(){var e=tu(Va)[0],t=at().memoizedState;return[typeof e=="boolean"?e:ui(e),t]},useSyncExternalStore:Oh,useId:im,useHostTransitionStatus:ou,useFormState:Kh,useActionState:Kh,useOptimistic:function(e,t){var n=at();return $e!==null?Lh(n,$e,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Wc,useCacheRefresh:lm};fm.useEffectEvent=Xh;function du(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var fu={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=ms(i);u.payload=t,n!=null&&(u.callback=n),t=ps(e,u,i),t!==null&&(qt(t,e,i),ii(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=ms(i);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=ps(e,u,i),t!==null&&(qt(t,e,i),ii(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Yt(),i=ms(n);i.tag=2,t!=null&&(i.callback=t),t=ps(e,i,n),t!==null&&(qt(t,e,n),ii(t,e,n))}};function hm(e,t,n,i,u,f,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,y):t.prototype&&t.prototype.isPureReactComponent?!Fr(n,i)||!Fr(u,f):!0}function mm(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&fu.enqueueReplaceState(t,t.state,null)}function rn(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=w({},n));for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n}function pm(e){gl(e)}function gm(e){console.error(e)}function ym(e){gl(e)}function ql(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function vm(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function hu(e,t,n){return n=ms(n),n.tag=3,n.payload={element:null},n.callback=function(){ql(e,t)},n}function bm(e){return e=ms(e),e.tag=3,e}function xm(e,t,n,i){var u=n.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){vm(t,n,i)}}var y=n.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){vm(t,n,i),typeof u!="function"&&(ws===null?ws=new Set([this]):ws.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function W0(e,t,n,i,u){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&Kn(t,n,u,!0),n=It.current,n!==null){switch(n.tag){case 31:case 13:return na===null?Zl():n.alternate===null&&We===0&&(We=3),n.flags&=-257,n.flags|=65536,n.lanes=u,i===El?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),Bu(e,i,u)),!1;case 22:return n.flags|=65536,i===El?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),Bu(e,i,u)),!1}throw Error(l(435,n.tag))}return Bu(e,i,u),Zl(),!1}if(Ce)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Rc&&(e=Error(l(422),{cause:i}),ti(ea(e,n)))):(i!==Rc&&(t=Error(l(423),{cause:i}),ti(ea(t,n))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=ea(i,n),u=hu(e.stateNode,i,u),Ic(e,u),We!==4&&(We=2)),!1;var f=Error(l(520),{cause:i});if(f=ea(f,n),xi===null?xi=[f]:xi.push(f),We!==4&&(We=2),t===null)return!0;i=ea(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=u&-u,n.lanes|=e,e=hu(n.stateNode,i,e),Ic(n,e),!1;case 1:if(t=n.type,f=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(ws===null||!ws.has(f))))return n.flags|=65536,u&=-u,n.lanes|=u,u=bm(u),xm(u,e,n,i),Ic(n,u),!1}n=n.return}while(n!==null);return!1}var mu=Error(l(461)),it=!1;function jt(e,t,n,i){t.child=e===null?jh(t,null,n,i):sn(t,e.child,n,i)}function wm(e,t,n,i,u){n=n.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 Ws(t),i=Xc(e,t,n,y,f,u),b=Qc(),e!==null&&!it?(Zc(e,t,u),Ia(e,t,u)):(Ce&&b&&Cc(t),t.flags|=1,jt(e,t,i,u),t.child)}function _m(e,t,n,i,u){if(e===null){var f=n.type;return typeof f=="function"&&!Tc(f)&&f.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=f,Sm(e,t,f,i,u)):(e=xl(n.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!_u(e,u)){var y=f.memoizedProps;if(n=n.compare,n=n!==null?n:Fr,n(y,i)&&e.ref===t.ref)return Ia(e,t,u)}return t.flags|=1,e=La(f,i),e.ref=t.ref,e.return=t,t.child=e}function Sm(e,t,n,i,u){if(e!==null){var f=e.memoizedProps;if(Fr(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,_u(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Ia(e,t,u)}return pu(e,t,n,i,u)}function jm(e,t,n,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|n:n,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 Nm(e,t,f,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&jl(t,f!==null?f.cachePool:null),f!==null?Th(t,f):Pc(),Ah(t);else return i=t.lanes=536870912,Nm(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(jl(t,f.cachePool),Th(t,f),ys(),t.memoizedState=null):(e!==null&&jl(t,null),Pc(),ys());return jt(e,t,u,n),t.child}function hi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Nm(e,t,n,i,u){var f=qc();return f=f===null?null:{parent:nt._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&jl(t,null),Pc(),Ah(t),e!==null&&Kn(e,t,i,!0),t.childLanes=u,null}function $l(e,t){return t=Vl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Em(e,t,n){return sn(t,e.child,null,n),e=$l(t,t.pendingProps),e.flags|=2,Gt(t),t.memoizedState=null,e}function eb(e,t,n){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ce){if(i.mode==="hidden")return e=$l(t,i),t.lanes=536870912,hi(null,e);if(Yc(t),(e=Ke)?(e=Bp(e,sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:cs!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=ch(e),n.return=t,t.child=n,_t=t,Ke=null)):e=null,e===null)throw ds(t);return t.lanes=536870912,null}return $l(t,i)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Yc(t),u)if(t.flags&256)t.flags&=-257,t=Em(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(it||Kn(e,t,n,!1),u=(n&e.childLanes)!==0,it||u){if(i=Ie,i!==null&&(y=ke(i,n),y!==0&&y!==f.retryLane))throw f.retryLane=y,Xs(e,y),qt(i,e,y),mu;Zl(),t=Em(e,t,n)}else e=f.treeContext,Ke=ra(y.nextSibling),_t=t,Ce=!0,us=null,sa=!1,e!==null&&fh(t,e),t=$l(t,i),t.flags|=4096;return t}return e=La(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Hl(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(l(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function pu(e,t,n,i,u){return Ws(t),n=Xc(e,t,n,i,void 0,u),i=Qc(),e!==null&&!it?(Zc(e,t,u),Ia(e,t,u)):(Ce&&i&&Cc(t),t.flags|=1,jt(e,t,n,u),t.child)}function Tm(e,t,n,i,u,f){return Ws(t),t.updateQueue=null,n=Ch(t,i,n,u),kh(e),i=Qc(),e!==null&&!it?(Zc(e,t,f),Ia(e,t,f)):(Ce&&i&&Cc(t),t.flags|=1,jt(e,t,n,f),t.child)}function Am(e,t,n,i,u){if(Ws(t),t.stateNode===null){var f=Vn,y=n.contextType;typeof y=="object"&&y!==null&&(f=St(y)),f=new n(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=fu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Hc(t),y=n.contextType,f.context=typeof y=="object"&&y!==null?St(y):Vn,f.state=t.memoizedState,y=n.getDerivedStateFromProps,typeof y=="function"&&(du(t,n,y,i),f.state=t.memoizedState),typeof n.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&&fu.enqueueReplaceState(f,f.state,null),oi(t,i,f,u),li(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var b=t.memoizedProps,N=rn(n,b);f.props=N;var z=f.context,$=n.contextType;y=Vn,typeof $=="object"&&$!==null&&(y=St($));var I=n.getDerivedStateFromProps;$=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||z!==y)&&mm(t,f,i,y),hs=!1;var U=t.memoizedState;f.state=U,oi(t,i,f,u),li(),z=t.memoizedState,b||U!==z||hs?(typeof I=="function"&&(du(t,n,I,i),z=t.memoizedState),(N=hs||hm(t,n,N,i,U,z,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=z),f.props=i,f.state=z,f.context=y,i=N):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Vc(e,t),y=t.memoizedProps,$=rn(n,y),f.props=$,I=t.pendingProps,U=f.context,z=n.contextType,N=Vn,typeof z=="object"&&z!==null&&(N=St(z)),b=n.getDerivedStateFromProps,(z=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==I||U!==N)&&mm(t,f,i,N),hs=!1,U=t.memoizedState,f.state=U,oi(t,i,f,u),li();var L=t.memoizedState;y!==I||U!==L||hs||e!==null&&e.dependencies!==null&&_l(e.dependencies)?(typeof b=="function"&&(du(t,n,b,i),L=t.memoizedState),($=hs||hm(t,n,$,i,U,L,N)||e!==null&&e.dependencies!==null&&_l(e.dependencies))?(z||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,L,N),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,L,N)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=L),f.props=i,f.state=L,f.context=N,i=$):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Hl(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=sn(t,e.child,null,u),t.child=sn(t,null,n,u)):jt(e,t,n,u),t.memoizedState=f.state,e=t.child):e=Ia(e,t,u),e}function km(e,t,n,i){return Zs(),t.flags|=256,jt(e,t,n,i),t.child}var gu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yu(e){return{baseLanes:e,cachePool:vh()}}function vu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Kt),e}function Cm(e,t,n){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?gs(t):ys(),(e=Ke)?(e=Bp(e,sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:cs!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=ch(e),n.return=t,t.child=n,_t=t,Ke=null)):e=null,e===null)throw ds(t);return ed(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(ys(),u=t.mode,b=Vl({mode:"hidden",children:b},u),i=Qs(i,u,n,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=yu(n),i.childLanes=vu(e,y,n),t.memoizedState=gu,hi(null,i)):(gs(t),bu(t,b))}var N=e.memoizedState;if(N!==null&&(b=N.dehydrated,b!==null)){if(f)t.flags&256?(gs(t),t.flags&=-257,t=xu(e,t,n)):t.memoizedState!==null?(ys(),t.child=e.child,t.flags|=128,t=null):(ys(),b=i.fallback,u=t.mode,i=Vl({mode:"visible",children:i.children},u),b=Qs(b,u,n,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,sn(t,e.child,null,n),i=t.child,i.memoizedState=yu(n),i.childLanes=vu(e,y,n),t.memoizedState=gu,t=hi(null,i));else if(gs(t),ed(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var z=y.dgst;y=z,i=Error(l(419)),i.stack="",i.digest=y,ti({value:i,source:null,stack:null}),t=xu(e,t,n)}else if(it||Kn(e,t,n,!1),y=(n&e.childLanes)!==0,it||y){if(y=Ie,y!==null&&(i=ke(y,n),i!==0&&i!==N.retryLane))throw N.retryLane=i,Xs(e,i),qt(y,e,i),mu;Wu(b)||Zl(),t=xu(e,t,n)}else Wu(b)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Ke=ra(b.nextSibling),_t=t,Ce=!0,us=null,sa=!1,e!==null&&fh(t,e),t=bu(t,i.children),t.flags|=4096);return t}return u?(ys(),b=i.fallback,u=t.mode,N=e.child,z=N.sibling,i=La(N,{mode:"hidden",children:i.children}),i.subtreeFlags=N.subtreeFlags&65011712,z!==null?b=La(z,b):(b=Qs(b,u,n,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,hi(null,i),i=t.child,b=e.child.memoizedState,b===null?b=yu(n):(u=b.cachePool,u!==null?(N=nt._currentValue,u=u.parent!==N?{parent:N,pool:N}:u):u=vh(),b={baseLanes:b.baseLanes|n,cachePool:u}),i.memoizedState=b,i.childLanes=vu(e,y,n),t.memoizedState=gu,hi(e.child,i)):(gs(t),n=e.child,e=n.sibling,n=La(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=n,t.memoizedState=null,n)}function bu(e,t){return t=Vl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Vl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function xu(e,t,n){return sn(t,e.child,null,n),e=bu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Om(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),zc(e.return,t,n)}function wu(e,t,n,i,u,f){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:u,treeForkCount:f}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=i,y.tail=n,y.tailMode=u,y.treeForkCount=f)}function Rm(e,t,n){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),jt(e,t,i,n),i=Ce?ei:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Om(e,n,t);else if(e.tag===19)Om(e,n,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(n=t.child,u=null;n!==null;)e=n.alternate,e!==null&&Cl(e)===null&&(u=n),n=n.sibling;n=u,n===null?(u=t.child,t.child=null):(u=n.sibling,n.sibling=null),wu(t,!1,u,n,f,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Cl(e)===null){t.child=u;break}e=u.sibling,u.sibling=n,n=u,u=e}wu(t,!0,n,null,f,i);break;case"together":wu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Ia(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),xs|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Kn(e,t,n,!1),(n&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,n=La(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=La(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function _u(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&_l(e)))}function tb(e,t,n){switch(t.tag){case 3:Ge(t,t.stateNode.containerInfo),fs(t,nt,e.memoizedState.cache),Zs();break;case 27:case 5:kt(t);break;case 4:Ge(t,t.stateNode.containerInfo);break;case 10:fs(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Yc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(gs(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Cm(e,t,n):(gs(t),e=Ia(e,t,n),e!==null?e.sibling:null);gs(t);break;case 19:var u=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(Kn(e,t,n,!1),i=(n&t.childLanes)!==0),u){if(i)return Rm(e,t,n);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,jm(e,t,n,t.pendingProps);case 24:fs(t,nt,e.memoizedState.cache)}return Ia(e,t,n)}function Dm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!_u(e,n)&&(t.flags&128)===0)return it=!1,tb(e,t,n);it=(e.flags&131072)!==0}else it=!1,Ce&&(t.flags&1048576)!==0&&dh(t,ei,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=tn(t.elementType),t.type=e,typeof e=="function")Tc(e)?(i=rn(e,i),t.tag=1,t=Am(null,t,e,i,n)):(t.tag=0,t=pu(null,t,e,i,n));else{if(e!=null){var u=e.$$typeof;if(u===G){t.tag=11,t=wm(null,t,e,i,n);break e}else if(u===P){t.tag=14,t=_m(null,t,e,i,n);break e}}throw t=st(e)||e,Error(l(306,t,""))}}return t;case 0:return pu(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,u=rn(i,t.pendingProps),Am(e,t,i,u,n);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,Vc(e,t),oi(t,i,null,n);var y=t.memoizedState;if(i=y.cache,fs(t,nt,i),i!==f.cache&&Uc(t,[nt],n,!0),li(),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=km(e,t,i,n);break e}else if(i!==u){u=ea(Error(l(424)),t),ti(u),t=km(e,t,i,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ke=ra(e.firstChild),_t=t,Ce=!0,us=null,sa=!0,n=jh(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zs(),i===u){t=Ia(e,t,n);break e}jt(e,t,i,n)}t=t.child}return t;case 26:return Hl(e,t),e===null?(n=Gp(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ce||(n=t.type,e=t.pendingProps,i=no(ge.current).createElement(n),i[ut]=t,i[Dt]=e,Nt(i,n,e),vt(i),t.stateNode=i):t.memoizedState=Gp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return kt(t),e===null&&Ce&&(i=t.stateNode=Hp(t.type,t.pendingProps,ge.current),_t=t,sa=!0,u=Ke,Ns(t.type)?(td=u,Ke=ra(i.firstChild)):Ke=u),jt(e,t,t.pendingProps.children,n),Hl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ce&&((u=i=Ke)&&(i=Ob(i,t.type,t.pendingProps,sa),i!==null?(t.stateNode=i,_t=t,Ke=ra(i.firstChild),sa=!1,u=!0):u=!1),u||ds(t)),kt(t),u=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,i=f.children,Qu(u,f)?i=null:y!==null&&Qu(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=Xc(e,t,K0,null,null,n),Ai._currentValue=u),Hl(e,t),jt(e,t,i,n),t.child;case 6:return e===null&&Ce&&((e=n=Ke)&&(n=Rb(n,t.pendingProps,sa),n!==null?(t.stateNode=n,_t=t,Ke=null,e=!0):e=!1),e||ds(t)),null;case 13:return Cm(e,t,n);case 4:return Ge(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=sn(t,null,i,n):jt(e,t,i,n),t.child;case 11:return wm(e,t,t.type,t.pendingProps,n);case 7:return jt(e,t,t.pendingProps,n),t.child;case 8:return jt(e,t,t.pendingProps.children,n),t.child;case 12:return jt(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,fs(t,t.type,i.value),jt(e,t,i.children,n),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Ws(t),u=St(u),i=i(u),t.flags|=1,jt(e,t,i,n),t.child;case 14:return _m(e,t,t.type,t.pendingProps,n);case 15:return Sm(e,t,t.type,t.pendingProps,n);case 19:return Rm(e,t,n);case 31:return eb(e,t,n);case 22:return jm(e,t,n,t.pendingProps);case 24:return Ws(t),i=St(nt),e===null?(u=qc(),u===null&&(u=Ie,f=Lc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},Hc(t),fs(t,nt,u)):((e.lanes&n)!==0&&(Vc(e,t),oi(t,null,null,n),li()),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),fs(t,nt,i)):(i=f.cache,fs(t,nt,i),i!==u.cache&&Uc(t,[nt],n,!0))),jt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Ga(e){e.flags|=4}function Su(e,t,n,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(ip())e.flags|=8192;else throw an=El,$c}else e.flags&=-16777217}function Mm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xp(t))if(ip())e.flags|=8192;else throw an=El,$c}function Il(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?rl():536870912,e.lanes|=t,nr|=t)}function mi(e,t){if(!Ce)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var u=e.child;u!==null;)n|=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;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function ab(e,t,n){var i=t.pendingProps;switch(Oc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return Ye(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),$a(nt),Ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pn(t)?Ga(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Dc())),Ye(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Ga(t),f!==null?(Ye(t),Mm(t,f)):(Ye(t),Su(t,u,null,i,n))):f?f!==e.memoizedState?(Ga(t),Ye(t),Mm(t,f)):(Ye(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ga(t),Ye(t),Su(t,u,e,i,n)),null;case 27:if(pt(t),n=ge.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}e=F.current,Pn(t)?hh(t):(e=Hp(u,i,n),t.stateNode=e,Ga(t))}return Ye(t),null;case 5:if(pt(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}if(f=F.current,Pn(t))hh(t);else{var y=no(ge.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[ut]=t,f[Dt]=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(Nt(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&&Ga(t)}}return Ye(t),Su(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(l(166));if(e=ge.current,Pn(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=_t,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||Cp(e.nodeValue,n)),e||ds(t,!0)}else e=no(e).createTextNode(i),e[ut]=t,t.stateNode=e}return Ye(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Pn(t),n!==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[ut]=t}else Zs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),e=!1}else n=Dc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Gt(t),t):(Gt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ye(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Pn(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[ut]=t}else Zs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),u=!1}else u=Dc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Gt(t),t):(Gt(t),null)}return Gt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(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)),n!==e&&n&&(t.child.flags|=8192),Il(t,t.updateQueue),Ye(t),null);case 4:return Ue(),e===null&&Pu(t.stateNode.containerInfo),Ye(t),null;case 10:return $a(t.type),Ye(t),null;case 19:if(V(tt),i=t.memoizedState,i===null)return Ye(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)mi(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=Cl(e),f!==null){for(t.flags|=128,mi(i,!1),e=f.updateQueue,t.updateQueue=e,Il(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oh(n,e),n=n.sibling;return X(tt,tt.current&1|2),Ce&&Ba(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&>()>Jl&&(t.flags|=128,u=!0,mi(i,!1),t.lanes=4194304)}else{if(!u)if(e=Cl(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Il(t,e),mi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!Ce)return Ye(t),null}else 2*gt()-i.renderingStartTime>Jl&&n!==536870912&&(t.flags|=128,u=!0,mi(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=gt(),e.sibling=null,n=tt.current,X(tt,u?n&1|2:n&1),Ce&&Ba(t,i.treeForkCount),e):(Ye(t),null);case 22:case 23:return Gt(t),Kc(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),n=t.updateQueue,n!==null&&Il(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&V(en),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),$a(nt),Ye(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function sb(e,t){switch(Oc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $a(nt),Ue(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(Gt(t),t.alternate===null)throw Error(l(340));Zs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Gt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Zs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(tt),null;case 4:return Ue(),null;case 10:return $a(t.type),null;case 22:case 23:return Gt(t),Kc(),e!==null&&V(en),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return $a(nt),null;case 25:return null;default:return null}}function zm(e,t){switch(Oc(t),t.tag){case 3:$a(nt),Ue();break;case 26:case 27:case 5:pt(t);break;case 4:Ue();break;case 31:t.memoizedState!==null&&Gt(t);break;case 13:Gt(t);break;case 19:V(tt);break;case 10:$a(t.type);break;case 22:case 23:Gt(t),Kc(),e!==null&&V(en);break;case 24:$a(nt)}}function pi(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var u=i.next;n=u;do{if((n.tag&e)===e){i=void 0;var f=n.create,y=n.inst;i=f(),y.destroy=i}n=n.next}while(n!==u)}}catch(b){Be(t,t.return,b)}}function vs(e,t,n){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var f=u.next;i=f;do{if((i.tag&e)===e){var y=i.inst,b=y.destroy;if(b!==void 0){y.destroy=void 0,u=t;var N=n,z=b;try{z()}catch($){Be(u,N,$)}}}i=i.next}while(i!==f)}}catch($){Be(t,t.return,$)}}function Um(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Eh(t,n)}catch(i){Be(e,e.return,i)}}}function Lm(e,t,n){n.props=rn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){Be(e,t,i)}}function gi(e,t){try{var n=e.ref;if(n!==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 n=="function"?e.refCleanup=n(i):n.current=i}}catch(u){Be(e,t,u)}}function _a(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(u){Be(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(u){Be(e,t,u)}else n.current=null}function Bm(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(u){Be(e,e.return,u)}}function ju(e,t,n){try{var i=e.stateNode;Nb(i,e.type,n,t),i[Dt]=t}catch(u){Be(e,e.return,u)}}function qm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ns(e.type)||e.tag===4}function Nu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qm(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&&Ns(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 Eu(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=za));else if(i!==4&&(i===27&&Ns(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Eu(e,t,n),e=e.sibling;e!==null;)Eu(e,t,n),e=e.sibling}function Gl(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&Ns(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Gl(e,t,n),e=e.sibling;e!==null;)Gl(e,t,n),e=e.sibling}function $m(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Nt(t,i,n),t[ut]=e,t[Dt]=n}catch(f){Be(e,e.return,f)}}var Pa=!1,lt=!1,Tu=!1,Hm=typeof WeakSet=="function"?WeakSet:Set,bt=null;function nb(e,t){if(e=e.containerInfo,Ju=fo,e=Wf(e),xc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var y=0,b=-1,N=-1,z=0,$=0,I=e,U=null;t:for(;;){for(var L;I!==n||u!==0&&I.nodeType!==3||(b=y+u),I!==f||i!==0&&I.nodeType!==3||(N=y+i),I.nodeType===3&&(y+=I.nodeValue.length),(L=I.firstChild)!==null;)U=I,I=L;for(;;){if(I===e)break t;if(U===n&&++z===u&&(b=y),U===f&&++$===i&&(N=y),(L=I.nextSibling)!==null)break;I=U,U=I.parentNode}I=L}n=b===-1||N===-1?null:{start:b,end:N}}else n=null}n=n||{start:0,end:0}}else n=null;for(Xu={focusedElem:e,selectionRange:n},fo=!1,bt=t;bt!==null;)if(t=bt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bt=e;else for(;bt!==null;){switch(t=bt,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(n=0;n<e.length;n++)u=e[n],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,n=t,u=f.memoizedProps,f=f.memoizedState,i=n.stateNode;try{var te=rn(n.type,u);e=i.getSnapshotBeforeUpdate(te,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(fe){Be(n,n.return,fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Fu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(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,bt=e;break}bt=t.return}}function Vm(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Ya(e,n),i&4&&pi(5,n);break;case 1:if(Ya(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(y){Be(n,n.return,y)}else{var u=rn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Be(n,n.return,y)}}i&64&&Um(n),i&512&&gi(n,n.return);break;case 3:if(Ya(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Eh(e,t)}catch(y){Be(n,n.return,y)}}break;case 27:t===null&&i&4&&$m(n);case 26:case 5:Ya(e,n),t===null&&i&4&&Bm(n),i&512&&gi(n,n.return);break;case 12:Ya(e,n);break;case 31:Ya(e,n),i&4&&Pm(e,n);break;case 13:Ya(e,n),i&4&&Km(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hb.bind(null,n),Db(e,n))));break;case 22:if(i=n.memoizedState!==null||Pa,!i){t=t!==null&&t.memoizedState!==null||lt,u=Pa;var f=lt;Pa=i,(lt=t)&&!f?Ja(e,n,(n.subtreeFlags&8772)!==0):Ya(e,n),Pa=u,lt=f}break;case 30:break;default:Ya(e,n)}}function Im(e){var t=e.alternate;t!==null&&(e.alternate=null,Im(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&sc(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,zt=!1;function Ka(e,t,n){for(n=n.child;n!==null;)Gm(e,t,n),n=n.sibling}function Gm(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount($s,n)}catch{}switch(n.tag){case 26:lt||_a(n,t),Ka(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lt||_a(n,t);var i=Xe,u=zt;Ns(n.type)&&(Xe=n.stateNode,zt=!1),Ka(e,t,n),Ni(n.stateNode),Xe=i,zt=u;break;case 5:lt||_a(n,t);case 6:if(i=Xe,u=zt,Xe=null,Ka(e,t,n),Xe=i,zt=u,Xe!==null)if(zt)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(n.stateNode)}catch(f){Be(n,t,f)}else try{Xe.removeChild(n.stateNode)}catch(f){Be(n,t,f)}break;case 18:Xe!==null&&(zt?(e=Xe,Up(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),fr(e)):Up(Xe,n.stateNode));break;case 4:i=Xe,u=zt,Xe=n.stateNode.containerInfo,zt=!0,Ka(e,t,n),Xe=i,zt=u;break;case 0:case 11:case 14:case 15:vs(2,n,t),lt||vs(4,n,t),Ka(e,t,n);break;case 1:lt||(_a(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&Lm(n,t,i)),Ka(e,t,n);break;case 21:Ka(e,t,n);break;case 22:lt=(i=lt)||n.memoizedState!==null,Ka(e,t,n),lt=i;break;default:Ka(e,t,n)}}function Pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{fr(e)}catch(n){Be(t,t.return,n)}}}function Km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{fr(e)}catch(n){Be(t,t.return,n)}}function rb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Hm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Hm),t;default:throw Error(l(435,e.tag))}}function Pl(e,t){var n=rb(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=mb.bind(null,e,i);i.then(u,u)}})}function Ut(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var u=n[i],f=e,y=t,b=y;e:for(;b!==null;){switch(b.tag){case 27:if(Ns(b.type)){Xe=b.stateNode,zt=!1;break e}break;case 5:Xe=b.stateNode,zt=!1;break e;case 3:case 4:Xe=b.stateNode.containerInfo,zt=!0;break e}b=b.return}if(Xe===null)throw Error(l(160));Gm(f,y,u),Xe=null,zt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ym(t,e),t=t.sibling}var ca=null;function Ym(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Lt(e),i&4&&(vs(3,e,e.return),pi(3,e),vs(5,e,e.return));break;case 1:Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),i&64&&Pa&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var u=ca;if(Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),i&4){var f=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Ir]||f[ut]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),Nt(f,i,n),f[ut]=e,vt(f),i=f;break e;case"link":var y=Yp("link","href",u).get(i+(n.href||""));if(y){for(var b=0;b<y.length;b++)if(f=y[b],f.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&f.getAttribute("rel")===(n.rel==null?null:n.rel)&&f.getAttribute("title")===(n.title==null?null:n.title)&&f.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){y.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;case"meta":if(y=Yp("meta","content",u).get(i+(n.content||""))){for(b=0;b<y.length;b++)if(f=y[b],f.getAttribute("content")===(n.content==null?null:""+n.content)&&f.getAttribute("name")===(n.name==null?null:n.name)&&f.getAttribute("property")===(n.property==null?null:n.property)&&f.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&f.getAttribute("charset")===(n.charSet==null?null:n.charSet)){y.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[ut]=e,vt(f),i=f}e.stateNode=i}else Jp(u,e.type,e.stateNode);else e.stateNode=Kp(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?Jp(u,e.type,e.stateNode):Kp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&ju(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),n!==null&&i&4&&ju(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),e.flags&32){u=e.stateNode;try{zn(u,"")}catch(te){Be(e,e.return,te)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,ju(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Tu=!0);break;case 6:if(Ut(t,e),Lt(e),i&4){if(e.stateNode===null)throw Error(l(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(te){Be(e,e.return,te)}}break;case 3:if(lo=null,u=ca,ca=ro(t.containerInfo),Ut(t,e),ca=u,Lt(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{fr(t.containerInfo)}catch(te){Be(e,e.return,te)}Tu&&(Tu=!1,Jm(e));break;case 4:i=ca,ca=ro(e.stateNode.containerInfo),Ut(t,e),Lt(e),ca=i;break;case 12:Ut(t,e),Lt(e);break;case 31:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Pl(e,i)));break;case 13:Ut(t,e),Lt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Yl=gt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Pl(e,i)));break;case 22:u=e.memoizedState!==null;var N=n!==null&&n.memoizedState!==null,z=Pa,$=lt;if(Pa=z||u,lt=$||N,Ut(t,e),lt=$,Pa=z,Lt(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||N||Pa||lt||ln(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){N=n=t;try{if(f=N.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=N.stateNode;var I=N.memoizedProps.style,U=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(te){Be(N,N.return,te)}}}else if(t.tag===6){if(n===null){N=t;try{N.stateNode.nodeValue=u?"":N.memoizedProps}catch(te){Be(N,N.return,te)}}}else if(t.tag===18){if(n===null){N=t;try{var L=N.stateNode;u?Lp(L,!0):Lp(N.stateNode,!1)}catch(te){Be(N,N.return,te)}}}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;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Pl(e,n))));break;case 19:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Pl(e,i)));break;case 30:break;case 21:break;default:Ut(t,e),Lt(e)}}function Lt(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(qm(i)){n=i;break}i=i.return}if(n==null)throw Error(l(160));switch(n.tag){case 27:var u=n.stateNode,f=Nu(e);Gl(e,f,u);break;case 5:var y=n.stateNode;n.flags&32&&(zn(y,""),n.flags&=-33);var b=Nu(e);Gl(e,b,y);break;case 3:case 4:var N=n.stateNode.containerInfo,z=Nu(e);Eu(e,z,N);break;default:throw Error(l(161))}}catch($){Be(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Jm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Jm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ya(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Vm(e,t.alternate,t),t=t.sibling}function ln(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:vs(4,t,t.return),ln(t);break;case 1:_a(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Lm(t,t.return,n),ln(t);break;case 27:Ni(t.stateNode);case 26:case 5:_a(t,t.return),ln(t);break;case 22:t.memoizedState===null&&ln(t);break;case 30:ln(t);break;default:ln(t)}e=e.sibling}}function Ja(e,t,n){for(n=n&&(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:Ja(u,f,n),pi(4,f);break;case 1:if(Ja(u,f,n),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(z){Be(i,i.return,z)}if(i=f,u=i.updateQueue,u!==null){var b=i.stateNode;try{var N=u.shared.hiddenCallbacks;if(N!==null)for(u.shared.hiddenCallbacks=null,u=0;u<N.length;u++)Nh(N[u],b)}catch(z){Be(i,i.return,z)}}n&&y&64&&Um(f),gi(f,f.return);break;case 27:$m(f);case 26:case 5:Ja(u,f,n),n&&i===null&&y&4&&Bm(f),gi(f,f.return);break;case 12:Ja(u,f,n);break;case 31:Ja(u,f,n),n&&y&4&&Pm(u,f);break;case 13:Ja(u,f,n),n&&y&4&&Km(u,f);break;case 22:f.memoizedState===null&&Ja(u,f,n),gi(f,f.return);break;case 30:break;default:Ja(u,f,n)}t=t.sibling}}function Au(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ai(n))}function ku(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ai(e))}function ua(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xm(e,t,n,i),t=t.sibling}function Xm(e,t,n,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ua(e,t,n,i),u&2048&&pi(9,t);break;case 1:ua(e,t,n,i);break;case 3:ua(e,t,n,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ai(e)));break;case 12:if(u&2048){ua(e,t,n,i),e=t.stateNode;try{var f=t.memoizedProps,y=f.id,b=f.onPostCommit;typeof b=="function"&&b(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Be(t,t.return,N)}}else ua(e,t,n,i);break;case 31:ua(e,t,n,i);break;case 13:ua(e,t,n,i);break;case 23:break;case 22:f=t.stateNode,y=t.alternate,t.memoizedState!==null?f._visibility&2?ua(e,t,n,i):yi(e,t):f._visibility&2?ua(e,t,n,i):(f._visibility|=2,tr(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Au(y,t);break;case 24:ua(e,t,n,i),u&2048&&ku(t.alternate,t);break;default:ua(e,t,n,i)}}function tr(e,t,n,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,y=t,b=n,N=i,z=y.flags;switch(y.tag){case 0:case 11:case 15:tr(f,y,b,N,u),pi(8,y);break;case 23:break;case 22:var $=y.stateNode;y.memoizedState!==null?$._visibility&2?tr(f,y,b,N,u):yi(f,y):($._visibility|=2,tr(f,y,b,N,u)),u&&z&2048&&Au(y.alternate,y);break;case 24:tr(f,y,b,N,u),u&&z&2048&&ku(y.alternate,y);break;default:tr(f,y,b,N,u)}t=t.sibling}}function yi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,u=i.flags;switch(i.tag){case 22:yi(n,i),u&2048&&Au(i.alternate,i);break;case 24:yi(n,i),u&2048&&ku(i.alternate,i);break;default:yi(n,i)}t=t.sibling}}var vi=8192;function ar(e,t,n){if(e.subtreeFlags&vi)for(e=e.child;e!==null;)Qm(e,t,n),e=e.sibling}function Qm(e,t,n){switch(e.tag){case 26:ar(e,t,n),e.flags&vi&&e.memoizedState!==null&&Pb(n,ca,e.memoizedState,e.memoizedProps);break;case 5:ar(e,t,n);break;case 3:case 4:var i=ca;ca=ro(e.stateNode.containerInfo),ar(e,t,n),ca=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=vi,vi=16777216,ar(e,t,n),vi=i):ar(e,t,n));break;default:ar(e,t,n)}}function Zm(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 bi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,Wm(i,e)}Zm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:bi(e),e.flags&2048&&vs(9,e,e.return);break;case 3:bi(e);break;case 12:bi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kl(e)):bi(e);break;default:bi(e)}}function Kl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,Wm(i,e)}Zm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:vs(8,t,t.return),Kl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Kl(t));break;default:Kl(t)}e=e.sibling}}function Wm(e,t){for(;bt!==null;){var n=bt;switch(n.tag){case 0:case 11:case 15:vs(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:ai(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,bt=i;else e:for(n=e;bt!==null;){i=bt;var u=i.sibling,f=i.return;if(Im(i),i===n){bt=null;break e}if(u!==null){u.return=f,bt=u;break e}bt=f}}}var ib={getCacheForType:function(e){var t=St(nt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return St(nt).controller.signal}},lb=typeof WeakMap=="function"?WeakMap:Map,Me=0,Ie=null,Ne=null,Te=0,Le=0,Pt=null,bs=!1,sr=!1,Cu=!1,Xa=0,We=0,xs=0,on=0,Ou=0,Kt=0,nr=0,xi=null,Bt=null,Ru=!1,Yl=0,ep=0,Jl=1/0,Xl=null,ws=null,dt=0,_s=null,rr=null,Qa=0,Du=0,Mu=null,tp=null,wi=0,zu=null;function Yt(){return(Me&2)!==0&&Te!==0?Te&-Te:k.T!==null?Hu():Is()}function ap(){if(Kt===0)if((Te&536870912)===0||Ce){var e=En;En<<=1,(En&3932160)===0&&(En=262144),Kt=e}else Kt=536870912;return e=It.current,e!==null&&(e.flags|=32),Kt}function qt(e,t,n){(e===Ie&&(Le===2||Le===9)||e.cancelPendingCommit!==null)&&(ir(e,0),Ss(e,Te,Kt,!1)),Hs(e,n),((Me&2)===0||e!==Ie)&&(e===Ie&&((Me&2)===0&&(on|=n),We===4&&Ss(e,Te,Kt,!1)),Sa(e))}function sp(e,t,n){if((Me&6)!==0)throw Error(l(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||ls(e,t),u=i?ub(e,t):Lu(e,t,!0),f=i;do{if(u===0){sr&&!i&&Ss(e,t,0,!1);break}else{if(n=e.current.alternate,f&&!ob(n)){u=Lu(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=xi;var N=b.current.memoizedState.isDehydrated;if(N&&(ir(b,y).flags|=256),y=Lu(b,y,!1),y!==2){if(Cu&&!N){b.errorRecoveryDisabledLanes|=f,on|=f,u=4;break e}f=Bt,Bt=u,f!==null&&(Bt===null?Bt=f:Bt.push.apply(Bt,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){ir(e,0),Ss(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:Ss(i,t,Kt,!bs);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Yl+300-gt(),10<u)){if(Ss(i,t,Kt,!bs),An(i,0,!0)!==0)break e;Qa=t,i.timeoutHandle=Mp(np.bind(null,i,n,Bt,Xl,Ru,t,Kt,on,nr,bs,f,"Throttled",-0,0),u);break e}np(i,n,Bt,Xl,Ru,t,Kt,on,nr,bs,f,null,-0,0)}}break}while(!0);Sa(e)}function np(e,t,n,i,u,f,y,b,N,z,$,I,U,L){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:za},Qm(t,f,I);var te=(f&62914560)===f?Yl-gt():(f&4194048)===f?ep-gt():0;if(te=Kb(I,te),te!==null){Qa=f,e.cancelPendingCommit=te(fp.bind(null,e,t,f,n,i,u,y,b,N,$,I,null,U,L)),Ss(e,f,y,!z);return}}fp(e,t,f,n,i,u,y,b,N)}function ob(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var u=n[i],f=u.getSnapshot;u=u.value;try{if(!Ht(f(),u))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Ss(e,t,n,i){t&=~Ou,t&=~on,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Ot(u),y=1<<f;i[f]=-1,u&=~y}n!==0&&R(e,n,t)}function Ql(){return(Me&6)===0?(_i(0),!1):!0}function Uu(){if(Ne!==null){if(Le===0)var e=Ne.return;else e=Ne,qa=Fs=null,Fc(e),Qn=null,ni=0,e=Ne;for(;e!==null;)zm(e.alternate,e),e=e.return;Ne=null}}function ir(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Ab(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Qa=0,Uu(),Ie=e,Ne=n=La(e.current,null),Te=t,Le=0,Pt=null,bs=!1,sr=ls(e,t),Cu=!1,nr=Kt=Ou=on=xs=We=0,Bt=xi=null,Ru=!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-Ot(i),f=1<<u;t|=e[u],i&=~f}return Xa=t,yl(),n}function rp(e,t){be=null,k.H=fi,t===Xn||t===Nl?(t=wh(),Le=3):t===$c?(t=wh(),Le=4):Le=t===mu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pt=t,Ne===null&&(We=1,ql(e,ea(t,e.current)))}function ip(){var e=It.current;return e===null?!0:(Te&4194048)===Te?na===null:(Te&62914560)===Te||(Te&536870912)!==0?e===na:!1}function lp(){var e=k.H;return k.H=fi,e===null?fi:e}function op(){var e=k.A;return k.A=ib,e}function Zl(){We=4,bs||(Te&4194048)!==Te&&It.current!==null||(sr=!0),(xs&134217727)===0&&(on&134217727)===0||Ie===null||Ss(Ie,Te,Kt,!1)}function Lu(e,t,n){var i=Me;Me|=2;var u=lp(),f=op();(Ie!==e||Te!==t)&&(Xl=null,ir(e,t)),t=!1;var y=We;e:do try{if(Le!==0&&Ne!==null){var b=Ne,N=Pt;switch(Le){case 8:Uu(),y=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var z=Le;if(Le=0,Pt=null,lr(e,b,N,z),n&&sr){y=0;break e}break;default:z=Le,Le=0,Pt=null,lr(e,b,N,z)}}cb(),y=We;break}catch($){rp(e,$)}while(!0);return t&&e.shellSuspendCounter++,qa=Fs=null,Me=i,k.H=u,k.A=f,Ne===null&&(Ie=null,Te=0,yl()),y}function cb(){for(;Ne!==null;)cp(Ne)}function ub(e,t){var n=Me;Me|=2;var i=lp(),u=op();Ie!==e||Te!==t?(Xl=null,Jl=gt()+500,ir(e,t)):sr=ls(e,t);e:do try{if(Le!==0&&Ne!==null){t=Ne;var f=Pt;t:switch(Le){case 1:Le=0,Pt=null,lr(e,t,f,1);break;case 2:case 9:if(bh(f)){Le=0,Pt=null,up(t);break}t=function(){Le!==2&&Le!==9||Ie!==e||(Le=7),Sa(e)},f.then(t,t);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:bh(f)?(Le=0,Pt=null,up(t)):(Le=0,Pt=null,lr(e,t,f,7));break;case 5:var y=null;switch(Ne.tag){case 26:y=Ne.memoizedState;case 5:case 27:var b=Ne;if(y?Xp(y):b.stateNode.complete){Le=0,Pt=null;var N=b.sibling;if(N!==null)Ne=N;else{var z=b.return;z!==null?(Ne=z,Fl(z)):Ne=null}break t}}Le=0,Pt=null,lr(e,t,f,5);break;case 6:Le=0,Pt=null,lr(e,t,f,6);break;case 8:Uu(),We=6;break e;default:throw Error(l(462))}}db();break}catch($){rp(e,$)}while(!0);return qa=Fs=null,k.H=i,k.A=u,Me=n,Ne!==null?0:(Ie=null,Te=0,yl(),We)}function db(){for(;Ne!==null&&!sl();)cp(Ne)}function cp(e){var t=Dm(e.alternate,e,Xa);e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function up(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Tm(n,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Tm(n,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:Fc(t);default:zm(n,t),t=Ne=oh(t,Xa),t=Dm(n,t,Xa)}e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function lr(e,t,n,i){qa=Fs=null,Fc(t),Qn=null,ni=0;var u=t.return;try{if(W0(e,u,t,n,Te)){We=1,ql(e,ea(n,e.current)),Ne=null;return}}catch(f){if(u!==null)throw Ne=u,f;We=1,ql(e,ea(n,e.current)),Ne=null;return}t.flags&32768?(Ce||i===1?e=!0:sr||(Te&536870912)!==0?e=!1:(bs=e=!0,(i===2||i===9||i===3||i===6)&&(i=It.current,i!==null&&i.tag===13&&(i.flags|=16384))),dp(t,e)):Fl(t)}function Fl(e){var t=e;do{if((t.flags&32768)!==0){dp(t,bs);return}e=t.return;var n=ab(t.alternate,t,Xa);if(n!==null){Ne=n;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);We===0&&(We=5)}function dp(e,t){do{var n=sb(e.alternate,e);if(n!==null){n.flags&=32767,Ne=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=n}while(e!==null);We=6,Ne=null}function fp(e,t,n,i,u,f,y,b,N){e.cancelPendingCommit=null;do Wl();while(dt!==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|=Nc,tc(e,n,f,y,b,N),e===Ie&&(Ne=Ie=null,Te=0),rr=t,_s=e,Qa=n,Du=f,Mu=u,tp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,pb(Ra,function(){return yp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=k.T,k.T=null,u=Y.p,Y.p=2,y=Me,Me|=4;try{nb(e,t,n)}finally{Me=y,Y.p=u,k.T=i}}dt=1,hp(),mp(),pp()}}function hp(){if(dt===1){dt=0;var e=_s,t=rr,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=k.T,k.T=null;var i=Y.p;Y.p=2;var u=Me;Me|=4;try{Ym(t,e);var f=Xu,y=Wf(e.containerInfo),b=f.focusedElem,N=f.selectionRange;if(y!==b&&b&&b.ownerDocument&&Ff(b.ownerDocument.documentElement,b)){if(N!==null&&xc(b)){var z=N.start,$=N.end;if($===void 0&&($=z),"selectionStart"in b)b.selectionStart=z,b.selectionEnd=Math.min($,b.value.length);else{var I=b.ownerDocument||document,U=I&&I.defaultView||window;if(U.getSelection){var L=U.getSelection(),te=b.textContent.length,fe=Math.min(N.start,te),Ve=N.end===void 0?fe:Math.min(N.end,te);!L.extend&&fe>Ve&&(y=Ve,Ve=fe,fe=y);var C=Zf(b,fe),T=Zf(b,Ve);if(C&&T&&(L.rangeCount!==1||L.anchorNode!==C.node||L.anchorOffset!==C.offset||L.focusNode!==T.node||L.focusOffset!==T.offset)){var M=I.createRange();M.setStart(C.node,C.offset),L.removeAllRanges(),fe>Ve?(L.addRange(M),L.extend(T.node,T.offset)):(M.setEnd(T.node,T.offset),L.addRange(M))}}}}for(I=[],L=b;L=L.parentNode;)L.nodeType===1&&I.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var H=I[b];H.element.scrollLeft=H.left,H.element.scrollTop=H.top}}fo=!!Ju,Xu=Ju=null}finally{Me=u,Y.p=i,k.T=n}}e.current=t,dt=2}}function mp(){if(dt===2){dt=0;var e=_s,t=rr,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=k.T,k.T=null;var i=Y.p;Y.p=2;var u=Me;Me|=4;try{Vm(e,t.alternate,t)}finally{Me=u,Y.p=i,k.T=n}}dt=3}}function pp(){if(dt===4||dt===3){dt=0,qs();var e=_s,t=rr,n=Qa,i=tp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,rr=_s=null,gp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(ws=null),Vs(n),t=t.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot($s,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=k.T,u=Y.p,Y.p=2,k.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{k.T=t,Y.p=u}}(Qa&3)!==0&&Wl(),Sa(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===zu?wi++:(wi=0,zu=e):wi=0,_i(0)}}function gp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ai(t)))}function Wl(){return hp(),mp(),pp(),yp()}function yp(){if(dt!==5)return!1;var e=_s,t=Du;Du=0;var n=Vs(Qa),i=k.T,u=Y.p;try{Y.p=32>n?32:n,k.T=null,n=Mu,Mu=null;var f=_s,y=Qa;if(dt=0,rr=_s=null,Qa=0,(Me&6)!==0)throw Error(l(331));var b=Me;if(Me|=4,Fm(f.current),Xm(f,f.current,y,n),Me=b,_i(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot($s,f)}catch{}return!0}finally{Y.p=u,k.T=i,gp(e,t)}}function vp(e,t,n){t=ea(n,t),t=hu(e.stateNode,t,2),e=ps(e,t,2),e!==null&&(Hs(e,2),Sa(e))}function Be(e,t,n){if(e.tag===3)vp(e,e,n);else for(;t!==null;){if(t.tag===3){vp(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(ws===null||!ws.has(i))){e=ea(n,e),n=bm(2),i=ps(t,n,2),i!==null&&(xm(n,i,t,e),Hs(i,2),Sa(i));break}}t=t.return}}function Bu(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new lb;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(n)||(Cu=!0,u.add(n),e=fb.bind(null,e,t,n),t.then(e,e))}function fb(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ie===e&&(Te&n)===n&&(We===4||We===3&&(Te&62914560)===Te&&300>gt()-Yl?(Me&2)===0&&ir(e,0):Ou|=n,nr===Te&&(nr=0)),Sa(e)}function bp(e,t){t===0&&(t=rl()),e=Xs(e,t),e!==null&&(Hs(e,t),Sa(e))}function hb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bp(e,n)}function mb(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(n=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),bp(e,n)}function pb(e,t){return _n(e,t)}var eo=null,or=null,qu=!1,to=!1,$u=!1,js=0;function Sa(e){e!==or&&e.next===null&&(or===null?eo=or=e:or=or.next=e),to=!0,qu||(qu=!0,yb())}function _i(e,t){if(!$u&&to){$u=!0;do for(var n=!1,i=eo;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-Ot(42|e)+1)-1,f&=u&~(y&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(n=!0,Sp(i,f))}else f=Te,f=An(i,i===Ie?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||ls(i,f)||(n=!0,Sp(i,f));i=i.next}while(n);$u=!1}}function gb(){xp()}function xp(){to=qu=!1;var e=0;js!==0&&Tb()&&(e=js);for(var t=gt(),n=null,i=eo;i!==null;){var u=i.next,f=wp(i,t);f===0?(i.next=null,n===null?eo=u:n.next=u,u===null&&(or=n)):(n=i,(e!==0||(f&3)!==0)&&(to=!0)),i=u}dt!==0&&dt!==5||_i(e),js!==0&&(js=0)}function wp(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-Ot(f),b=1<<y,N=u[y];N===-1?((b&n)===0||(b&i)!==0)&&(u[y]=ec(b,t)):N<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ie,n=Te,n=An(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(Le===2||Le===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&is(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||ls(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&is(i),Vs(n)){case 2:case 8:n=Hr;break;case 32:n=Ra;break;case 268435456:n=ya;break;default:n=Ra}return i=_p.bind(null,e),n=_n(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&is(i),e.callbackPriority=2,e.callbackNode=null,2}function _p(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Wl()&&e.callbackNode!==n)return null;var i=Te;return i=An(e,e===Ie?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(sp(e,i,t),wp(e,gt()),e.callbackNode!=null&&e.callbackNode===n?_p.bind(null,e):null)}function Sp(e,t){if(Wl())return null;sp(e,t,!0)}function yb(){kb(function(){(Me&6)!==0?_n($r,gb):xp()})}function Hu(){if(js===0){var e=Yn;e===0&&(e=Nn,Nn<<=1,(Nn&261888)===0&&(Nn=256)),js=e}return js}function jp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:cl(""+e)}function Np(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function vb(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=jp((u[Dt]||null).action),y=i.submitter;y&&(t=(t=y[Dt]||null)?jp(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var b=new hl("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(js!==0){var N=y?Np(u,y):new FormData(u);lu(n,{pending:!0,data:N,method:u.method,action:f},null,N)}}else typeof f=="function"&&(b.preventDefault(),N=y?Np(u,y):new FormData(u),lu(n,{pending:!0,data:N,method:u.method,action:f},f,N))},currentTarget:u}]})}}for(var Vu=0;Vu<jc.length;Vu++){var Iu=jc[Vu],bb=Iu.toLowerCase(),xb=Iu[0].toUpperCase()+Iu.slice(1);oa(bb,"on"+xb)}oa(ah,"onAnimationEnd"),oa(sh,"onAnimationIteration"),oa(nh,"onAnimationStart"),oa("dblclick","onDoubleClick"),oa("focusin","onFocus"),oa("focusout","onBlur"),oa(U0,"onTransitionRun"),oa(L0,"onTransitionStart"),oa(B0,"onTransitionCancel"),oa(rh,"onTransitionEnd"),Dn("onMouseEnter",["mouseout","mouseover"]),Dn("onMouseLeave",["mouseout","mouseover"]),Dn("onPointerEnter",["pointerout","pointerover"]),Dn("onPointerLeave",["pointerout","pointerover"]),Ps("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ps("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ps("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ps("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Si="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(" "),wb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Si));function Ep(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var y=i.length-1;0<=y;y--){var b=i[y],N=b.instance,z=b.currentTarget;if(b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=z;try{f(u)}catch($){gl($)}u.currentTarget=null,f=N}else for(y=0;y<i.length;y++){if(b=i[y],N=b.instance,z=b.currentTarget,b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=z;try{f(u)}catch($){gl($)}u.currentTarget=null,f=N}}}}function Ee(e,t){var n=t[ac];n===void 0&&(n=t[ac]=new Set);var i=e+"__bubble";n.has(i)||(Tp(t,e,2,!1),n.add(i))}function Gu(e,t,n){var i=0;t&&(i|=4),Tp(n,e,i,t)}var ao="_reactListening"+Math.random().toString(36).slice(2);function Pu(e){if(!e[ao]){e[ao]=!0,xf.forEach(function(n){n!=="selectionchange"&&(wb.has(n)||Gu(n,!1,e),Gu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ao]||(t[ao]=!0,Gu("selectionchange",!1,t))}}function Tp(e,t,n,i){switch(ag(t)){case 2:var u=Xb;break;case 8:u=Qb;break;default:u=id}n=u.bind(null,t,n,e),u=void 0,!dc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,n,{capture:!0,passive:u}):e.addEventListener(t,n,!0):u!==void 0?e.addEventListener(t,n,{passive:u}):e.addEventListener(t,n,!1)}function Ku(e,t,n,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var y=i.tag;if(y===3||y===4){var b=i.stateNode.containerInfo;if(b===u)break;if(y===4)for(y=i.return;y!==null;){var N=y.tag;if((N===3||N===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;b!==null;){if(y=Cn(b),y===null)return;if(N=y.tag,N===5||N===6||N===26||N===27){i=f=y;continue e}b=b.parentNode}}i=i.return}Rf(function(){var z=f,$=cc(n),I=[];e:{var U=ih.get(e);if(U!==void 0){var L=hl,te=e;switch(e){case"keypress":if(dl(n)===0)break e;case"keydown":case"keyup":L=m0;break;case"focusin":te="focus",L=pc;break;case"focusout":te="blur",L=pc;break;case"beforeblur":case"afterblur":L=pc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=zf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=a0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=y0;break;case ah:case sh:case nh:L=r0;break;case rh:L=b0;break;case"scroll":case"scrollend":L=e0;break;case"wheel":L=w0;break;case"copy":case"cut":case"paste":L=l0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Lf;break;case"toggle":case"beforetoggle":L=S0}var fe=(t&4)!==0,Ve=!fe&&(e==="scroll"||e==="scrollend"),C=fe?U!==null?U+"Capture":null:U;fe=[];for(var T=z,M;T!==null;){var H=T;if(M=H.stateNode,H=H.tag,H!==5&&H!==26&&H!==27||M===null||C===null||(H=Pr(T,C),H!=null&&fe.push(ji(T,H,M))),Ve)break;T=T.return}0<fe.length&&(U=new L(U,te,null,n,$),I.push({event:U,listeners:fe}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",U&&n!==oc&&(te=n.relatedTarget||n.fromElement)&&(Cn(te)||te[kn]))break e;if((L||U)&&(U=$.window===$?$:(U=$.ownerDocument)?U.defaultView||U.parentWindow:window,L?(te=n.relatedTarget||n.toElement,L=z,te=te?Cn(te):null,te!==null&&(Ve=d(te),fe=te.tag,te!==Ve||fe!==5&&fe!==27&&fe!==6)&&(te=null)):(L=null,te=z),L!==te)){if(fe=zf,H="onMouseLeave",C="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(fe=Lf,H="onPointerLeave",C="onPointerEnter",T="pointer"),Ve=L==null?U:Gr(L),M=te==null?U:Gr(te),U=new fe(H,T+"leave",L,n,$),U.target=Ve,U.relatedTarget=M,H=null,Cn($)===z&&(fe=new fe(C,T+"enter",te,n,$),fe.target=M,fe.relatedTarget=Ve,H=fe),Ve=H,L&&te)t:{for(fe=_b,C=L,T=te,M=0,H=C;H;H=fe(H))M++;H=0;for(var oe=T;oe;oe=fe(oe))H++;for(;0<M-H;)C=fe(C),M--;for(;0<H-M;)T=fe(T),H--;for(;M--;){if(C===T||T!==null&&C===T.alternate){fe=C;break t}C=fe(C),T=fe(T)}fe=null}else fe=null;L!==null&&Ap(I,U,L,fe,!1),te!==null&&Ve!==null&&Ap(I,Ve,te,fe,!0)}}e:{if(U=z?Gr(z):window,L=U.nodeName&&U.nodeName.toLowerCase(),L==="select"||L==="input"&&U.type==="file")var Re=Pf;else if(If(U))if(Kf)Re=D0;else{Re=O0;var ie=C0}else L=U.nodeName,!L||L.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?z&&lc(z.elementType)&&(Re=Pf):Re=R0;if(Re&&(Re=Re(e,z))){Gf(I,Re,n,$);break e}ie&&ie(e,U,z),e==="focusout"&&z&&U.type==="number"&&z.memoizedProps.value!=null&&ic(U,"number",U.value)}switch(ie=z?Gr(z):window,e){case"focusin":(If(ie)||ie.contentEditable==="true")&&(qn=ie,wc=z,Wr=null);break;case"focusout":Wr=wc=qn=null;break;case"mousedown":_c=!0;break;case"contextmenu":case"mouseup":case"dragend":_c=!1,eh(I,n,$);break;case"selectionchange":if(z0)break;case"keydown":case"keyup":eh(I,n,$)}var xe;if(yc)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else Bn?Hf(e,n)&&(Ae="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ae="onCompositionStart");Ae&&(Bf&&n.locale!=="ko"&&(Bn||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&Bn&&(xe=Df()):(os=$,fc="value"in os?os.value:os.textContent,Bn=!0)),ie=so(z,Ae),0<ie.length&&(Ae=new Uf(Ae,e,null,n,$),I.push({event:Ae,listeners:ie}),xe?Ae.data=xe:(xe=Vf(n),xe!==null&&(Ae.data=xe)))),(xe=N0?E0(e,n):T0(e,n))&&(Ae=so(z,"onBeforeInput"),0<Ae.length&&(ie=new Uf("onBeforeInput","beforeinput",null,n,$),I.push({event:ie,listeners:Ae}),ie.data=xe)),vb(I,e,z,n,$)}Ep(I,t)})}function ji(e,t,n){return{instance:e,listener:t,currentTarget:n}}function so(e,t){for(var n=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Pr(e,n),u!=null&&i.unshift(ji(e,u,f)),u=Pr(e,t),u!=null&&i.push(ji(e,u,f))),e.tag===3)return i;e=e.return}return[]}function _b(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ap(e,t,n,i,u){for(var f=t._reactName,y=[];n!==null&&n!==i;){var b=n,N=b.alternate,z=b.stateNode;if(b=b.tag,N!==null&&N===i)break;b!==5&&b!==26&&b!==27||z===null||(N=z,u?(z=Pr(n,f),z!=null&&y.unshift(ji(n,z,N))):u||(z=Pr(n,f),z!=null&&y.push(ji(n,z,N)))),n=n.return}y.length!==0&&e.push({event:t,listeners:y})}var Sb=/\r\n?/g,jb=/\u0000|\uFFFD/g;function kp(e){return(typeof e=="string"?e:""+e).replace(Sb,`
|
|
9
|
-
`).replace(jb,"")}function Cp(e,t){return t=kp(t),kp(e)===t}function He(e,t,n,i,u,f){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||zn(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&zn(e,""+i);break;case"className":ll(e,"class",i);break;case"tabIndex":ll(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":ll(e,n,i);break;case"style":Cf(e,i,f);break;case"data":if(t!=="object"){ll(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=cl(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(n,"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"&&(n==="formAction"?(t!=="input"&&He(e,t,"name",u.name,u,null),He(e,t,"formEncType",u.formEncType,u,null),He(e,t,"formMethod",u.formMethod,u,null),He(e,t,"formTarget",u.formTarget,u,null)):(He(e,t,"encType",u.encType,u,null),He(e,t,"method",u.method,u,null),He(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=cl(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=za);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}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}n=cl(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);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(n,""+i):e.removeAttribute(n);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(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),il(e,"popover",i);break;case"xlinkActuate":Ma(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ma(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ma(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ma(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ma(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ma(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":il(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Fv.get(n)||n,il(e,n,i))}}function Yu(e,t,n,i,u,f){switch(n){case"style":Cf(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}break;case"children":typeof i=="string"?zn(e,i):(typeof i=="number"||typeof i=="bigint")&&zn(e,""+i);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"onClick":i!=null&&(e.onclick=za);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wf.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(u=n.endsWith("Capture"),t=n.slice(2,u?n.length-7:void 0),f=e[Dt]||null,f=f!=null?f[n]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,u);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):il(e,n,i)}}}function Nt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var i=!1,u=!1,f;for(f in n)if(n.hasOwnProperty(f)){var y=n[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:He(e,t,f,y,n,null)}}u&&He(e,t,"srcSet",n.srcSet,n,null),i&&He(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var b=f=y=u=null,N=null,z=null;for(i in n)if(n.hasOwnProperty(i)){var $=n[i];if($!=null)switch(i){case"name":u=$;break;case"type":y=$;break;case"checked":N=$;break;case"defaultChecked":z=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(l(137,t));break;default:He(e,t,i,$,n,null)}}Ef(e,f,b,N,z,y,u,!1);return;case"select":Ee("invalid",e),i=y=f=null;for(u in n)if(n.hasOwnProperty(u)&&(b=n[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":y=b;break;case"multiple":i=b;default:He(e,t,u,b,n,null)}t=f,n=y,e.multiple=!!i,t!=null?Mn(e,!!i,t,!1):n!=null&&Mn(e,!!i,n,!0);return;case"textarea":Ee("invalid",e),f=u=i=null;for(y in n)if(n.hasOwnProperty(y)&&(b=n[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:He(e,t,y,b,n,null)}Af(e,i,u,f);return;case"option":for(N in n)n.hasOwnProperty(N)&&(i=n[N],i!=null)&&(N==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":He(e,t,N,i,n,null));return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(i=0;i<Si.length;i++)Ee(Si[i],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("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(z in n)if(n.hasOwnProperty(z)&&(i=n[z],i!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,z,i,n,null)}return;default:if(lc(t)){for($ in n)n.hasOwnProperty($)&&(i=n[$],i!==void 0&&Yu(e,t,$,i,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(i=n[b],i!=null&&He(e,t,b,i,n,null))}function Nb(e,t,n,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,b=null,N=null,z=null,$=null;for(L in n){var I=n[L];if(n.hasOwnProperty(L)&&I!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":N=I;default:i.hasOwnProperty(L)||He(e,t,L,null,i,I)}}for(var U in i){var L=i[U];if(I=n[U],i.hasOwnProperty(U)&&(L!=null||I!=null))switch(U){case"type":f=L;break;case"name":u=L;break;case"checked":z=L;break;case"defaultChecked":$=L;break;case"value":y=L;break;case"defaultValue":b=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==I&&He(e,t,U,L,i,I)}}rc(e,y,b,N,z,$,f,u);return;case"select":L=y=b=U=null;for(f in n)if(N=n[f],n.hasOwnProperty(f)&&N!=null)switch(f){case"value":break;case"multiple":L=N;default:i.hasOwnProperty(f)||He(e,t,f,null,i,N)}for(u in i)if(f=i[u],N=n[u],i.hasOwnProperty(u)&&(f!=null||N!=null))switch(u){case"value":U=f;break;case"defaultValue":b=f;break;case"multiple":y=f;default:f!==N&&He(e,t,u,f,i,N)}t=b,n=y,i=L,U!=null?Mn(e,!!n,U,!1):!!i!=!!n&&(t!=null?Mn(e,!!n,t,!0):Mn(e,!!n,n?[]:"",!1));return;case"textarea":L=U=null;for(b in n)if(u=n[b],n.hasOwnProperty(b)&&u!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:He(e,t,b,null,i,u)}for(y in i)if(u=i[y],f=n[y],i.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":U=u;break;case"defaultValue":L=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&He(e,t,y,u,i,f)}Tf(e,U,L);return;case"option":for(var te in n)U=n[te],n.hasOwnProperty(te)&&U!=null&&!i.hasOwnProperty(te)&&(te==="selected"?e.selected=!1:He(e,t,te,null,i,U));for(N in i)U=i[N],L=n[N],i.hasOwnProperty(N)&&U!==L&&(U!=null||L!=null)&&(N==="selected"?e.selected=U&&typeof U!="function"&&typeof U!="symbol":He(e,t,N,U,i,L));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var fe in n)U=n[fe],n.hasOwnProperty(fe)&&U!=null&&!i.hasOwnProperty(fe)&&He(e,t,fe,null,i,U);for(z in i)if(U=i[z],L=n[z],i.hasOwnProperty(z)&&U!==L&&(U!=null||L!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:He(e,t,z,U,i,L)}return;default:if(lc(t)){for(var Ve in n)U=n[Ve],n.hasOwnProperty(Ve)&&U!==void 0&&!i.hasOwnProperty(Ve)&&Yu(e,t,Ve,void 0,i,U);for($ in i)U=i[$],L=n[$],!i.hasOwnProperty($)||U===L||U===void 0&&L===void 0||Yu(e,t,$,U,i,L);return}}for(var C in n)U=n[C],n.hasOwnProperty(C)&&U!=null&&!i.hasOwnProperty(C)&&He(e,t,C,null,i,U);for(I in i)U=i[I],L=n[I],!i.hasOwnProperty(I)||U===L||U==null&&L==null||He(e,t,I,U,i,L)}function Op(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Eb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var u=n[i],f=u.transferSize,y=u.initiatorType,b=u.duration;if(f&&b&&Op(y)){for(y=0,b=u.responseEnd,i+=1;i<n.length;i++){var N=n[i],z=N.startTime;if(z>b)break;var $=N.transferSize,I=N.initiatorType;$&&Op(I)&&(N=N.responseEnd,y+=$*(N<b?1:(b-z)/(N-z)))}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 Ju=null,Xu=null;function no(e){return e.nodeType===9?e:e.ownerDocument}function Rp(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 Dp(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 Qu(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 Zu=null;function Tb(){var e=window.event;return e&&e.type==="popstate"?e===Zu?!1:(Zu=e,!0):(Zu=null,!1)}var Mp=typeof setTimeout=="function"?setTimeout:void 0,Ab=typeof clearTimeout=="function"?clearTimeout:void 0,zp=typeof Promise=="function"?Promise:void 0,kb=typeof queueMicrotask=="function"?queueMicrotask:typeof zp<"u"?function(e){return zp.resolve(null).then(e).catch(Cb)}:Mp;function Cb(e){setTimeout(function(){throw e})}function Ns(e){return e==="head"}function Up(e,t){var n=t,i=0;do{var u=n.nextSibling;if(e.removeChild(n),u&&u.nodeType===8)if(n=u.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(u),fr(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Ni(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Ni(n);for(var f=n.firstChild;f;){var y=f.nextSibling,b=f.nodeName;f[Ir]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||n.removeChild(f),f=y}}else n==="body"&&Ni(e.ownerDocument.body);n=u}while(n);fr(t)}function Lp(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function Fu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Fu(n),sc(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Ob(e,t,n,i){for(;e.nodeType===1;){var u=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Ir])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=ra(e.nextSibling),e===null)break}return null}function Rb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ra(e.nextSibling),e===null))return null;return e}function Bp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ra(e.nextSibling),e===null))return null;return e}function Wu(e){return e.data==="$?"||e.data==="$~"}function ed(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Db(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function ra(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 td=null;function qp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ra(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function $p(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Hp(e,t,n){switch(t=no(n),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 Ni(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);sc(e)}var ia=new Map,Vp=new Set;function ro(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Za=Y.d;Y.d={f:Mb,r:zb,D:Ub,C:Lb,L:Bb,m:qb,X:Hb,S:$b,M:Vb};function Mb(){var e=Za.f(),t=Ql();return e||t}function zb(e){var t=On(e);t!==null&&t.tag===5&&t.type==="form"?rm(t):Za.r(e)}var cr=typeof document>"u"?null:document;function Ip(e,t,n){var i=cr;if(i&&typeof t=="string"&&t){var u=Ft(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),Vp.has(u)||(Vp.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function Ub(e){Za.D(e),Ip("dns-prefetch",e,null)}function Lb(e,t){Za.C(e,t),Ip("preconnect",e,t)}function Bb(e,t,n){Za.L(e,t,n);var i=cr;if(i&&e&&t){var u='link[rel="preload"][as="'+Ft(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+Ft(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+Ft(n.imageSizes)+'"]')):u+='[href="'+Ft(e)+'"]';var f=u;switch(t){case"style":f=ur(e);break;case"script":f=dr(e)}ia.has(f)||(e=w({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ia.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Ei(f))||t==="script"&&i.querySelector(Ti(f))||(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function qb(e,t){Za.m(e,t);var n=cr;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Ft(i)+'"][href="'+Ft(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=dr(e)}if(!ia.has(f)&&(e=w({rel:"modulepreload",href:e},t),ia.set(f,e),n.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ti(f)))return}i=n.createElement("link"),Nt(i,"link",e),vt(i),n.head.appendChild(i)}}}function $b(e,t,n){Za.S(e,t,n);var i=cr;if(i&&e){var u=Rn(i).hoistableStyles,f=ur(e);t=t||"default";var y=u.get(f);if(!y){var b={loading:0,preload:null};if(y=i.querySelector(Ei(f)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ia.get(f))&&ad(e,n);var N=y=i.createElement("link");vt(N),Nt(N,"link",e),N._p=new Promise(function(z,$){N.onload=z,N.onerror=$}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,io(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},u.set(f,y)}}}function Hb(e,t){Za.X(e,t);var n=cr;if(n&&e){var i=Rn(n).hoistableScripts,u=dr(e),f=i.get(u);f||(f=n.querySelector(Ti(u)),f||(e=w({src:e,async:!0},t),(t=ia.get(u))&&sd(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Vb(e,t){Za.M(e,t);var n=cr;if(n&&e){var i=Rn(n).hoistableScripts,u=dr(e),f=i.get(u);f||(f=n.querySelector(Ti(u)),f||(e=w({src:e,async:!0,type:"module"},t),(t=ia.get(u))&&sd(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Gp(e,t,n,i){var u=(u=ge.current)?ro(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=ur(n.href),n=Rn(u).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=ur(n.href);var f=Rn(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(Ei(e)))&&!f._p&&(y.instance=f,y.state.loading=5),ia.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ia.set(e,n),f||Ib(u,e,n,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=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=dr(n),n=Rn(u).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function ur(e){return'href="'+Ft(e)+'"'}function Ei(e){return'link[rel="stylesheet"]['+e+"]"}function Pp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Ib(e,t,n,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}),Nt(t,"link",n),vt(t),e.head.appendChild(t))}function dr(e){return'[src="'+Ft(e)+'"]'}function Ti(e){return"script[async]"+e}function Kp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Ft(n.href)+'"]');if(i)return t.instance=i,vt(i),i;var u=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),vt(i),Nt(i,"style",u),io(i,n.precedence,e),t.instance=i;case"stylesheet":u=ur(n.href);var f=e.querySelector(Ei(u));if(f)return t.state.loading|=4,t.instance=f,vt(f),f;i=Pp(n),(u=ia.get(u))&&ad(i,u),f=(e.ownerDocument||e).createElement("link"),vt(f);var y=f;return y._p=new Promise(function(b,N){y.onload=b,y.onerror=N}),Nt(f,"link",i),t.state.loading|=4,io(f,n.precedence,e),t.instance=f;case"script":return f=dr(n.src),(u=e.querySelector(Ti(f)))?(t.instance=u,vt(u),u):(i=n,(u=ia.get(f))&&(i=w({},n),sd(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),vt(u),Nt(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,io(i,n.precedence,e));return t.instance}function io(e,t,n){for(var i=n.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=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function ad(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function sd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var lo=null;function Yp(e,t,n){if(lo===null){var i=new Map,u=lo=new Map;u.set(n,i)}else u=lo,i=u.get(n),i||(i=new Map,u.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),u=0;u<n.length;u++){var f=n[u];if(!(f[Ir]||f[ut]||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 Jp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Gb(e,t,n){if(n===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 Xp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Pb(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var u=ur(i.href),f=t.querySelector(Ei(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=oo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,vt(f);return}f=t.ownerDocument||t,i=Pp(i),(u=ia.get(u))&&ad(i,u),f=f.createElement("link"),vt(f);var y=f;y._p=new Promise(function(b,N){y.onload=b,y.onerror=N}),Nt(f,"link",i),n.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=oo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var nd=0;function Kb(e,t){return e.stylesheets&&e.count===0&&uo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&uo(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&nd===0&&(nd=62500*Eb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&uo(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>nd?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function oo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)uo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var co=null;function uo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,co=new Map,t.forEach(Yb,e),co=null,oo.call(e))}function Yb(e,t){if(!(t.state.loading&4)){var n=co.get(e);if(n)var i=n.get(null);else{n=new Map,co.set(e,n);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")&&(n.set(y.dataset.precedence,y),i=y)}i&&n.set(null,i)}u=t.instance,y=u.getAttribute("data-precedence"),f=n.get(y)||i,f===i&&n.set(null,u),n.set(y,u),this.count++,i=oo.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 Ai={$$typeof:B,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Jb(e,t,n,i,u,f,y,b,N){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Vr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vr(0),this.hiddenUpdates=Vr(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Qp(e,t,n,i,u,f,y,b,N,z,$,I){return e=new Jb(e,t,n,y,N,z,$,I,b),t=1,f===!0&&(t|=24),f=Vt(3,null,null,t),e.current=f,f.stateNode=e,t=Lc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:n,cache:t},Hc(f),e}function Zp(e){return e?(e=Vn,e):Vn}function Fp(e,t,n,i,u,f){u=Zp(u),i.context===null?i.context=u:i.pendingContext=u,i=ms(t),i.payload={element:n},f=f===void 0?null:f,f!==null&&(i.callback=f),n=ps(e,i,t),n!==null&&(qt(n,e,t),ii(n,e,t))}function Wp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function rd(e,t){Wp(e,t),(e=e.alternate)&&Wp(e,t)}function eg(e){if(e.tag===13||e.tag===31){var t=Xs(e,67108864);t!==null&&qt(t,e,67108864),rd(e,67108864)}}function tg(e){if(e.tag===13||e.tag===31){var t=Yt();t=yt(t);var n=Xs(e,t);n!==null&&qt(n,e,t),rd(e,t)}}var fo=!0;function Xb(e,t,n,i){var u=k.T;k.T=null;var f=Y.p;try{Y.p=2,id(e,t,n,i)}finally{Y.p=f,k.T=u}}function Qb(e,t,n,i){var u=k.T;k.T=null;var f=Y.p;try{Y.p=8,id(e,t,n,i)}finally{Y.p=f,k.T=u}}function id(e,t,n,i){if(fo){var u=ld(i);if(u===null)Ku(e,t,i,ho,n),sg(e,i);else if(Fb(u,e,t,n,i))i.stopPropagation();else if(sg(e,i),t&4&&-1<Zb.indexOf(e)){for(;u!==null;){var f=On(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=Da(f.pendingLanes);if(y!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;y;){var N=1<<31-Ot(y);b.entanglements[1]|=N,y&=~N}Sa(f),(Me&6)===0&&(Jl=gt()+500,_i(0))}}break;case 31:case 13:b=Xs(f,2),b!==null&&qt(b,f,2),Ql(),rd(f,2)}if(f=ld(i),f===null&&Ku(e,t,i,ho,n),f===u)break;u=f}u!==null&&i.stopPropagation()}else Ku(e,t,i,null,n)}}function ld(e){return e=cc(e),od(e)}var ho=null;function od(e){if(ho=null,e=Cn(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ho=e,null}function ag(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(nl()){case $r:return 2;case Hr:return 8;case Ra:case Sn:return 32;case ya:return 268435456;default:return 32}default:return 32}}var cd=!1,Es=null,Ts=null,As=null,ki=new Map,Ci=new Map,ks=[],Zb="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 sg(e,t){switch(e){case"focusin":case"focusout":Es=null;break;case"dragenter":case"dragleave":Ts=null;break;case"mouseover":case"mouseout":As=null;break;case"pointerover":case"pointerout":ki.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ci.delete(t.pointerId)}}function Oi(e,t,n,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=On(t),t!==null&&eg(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Fb(e,t,n,i,u){switch(t){case"focusin":return Es=Oi(Es,e,t,n,i,u),!0;case"dragenter":return Ts=Oi(Ts,e,t,n,i,u),!0;case"mouseover":return As=Oi(As,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return ki.set(f,Oi(ki.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,Ci.set(f,Oi(Ci.get(f)||null,e,t,n,i,u)),!0}return!1}function ng(e){var t=Cn(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,Gs(e.priority,function(){tg(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,Gs(e.priority,function(){tg(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function mo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ld(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);oc=i,n.target.dispatchEvent(i),oc=null}else return t=On(n),t!==null&&eg(t),e.blockedOn=n,!1;t.shift()}return!0}function rg(e,t,n){mo(e)&&n.delete(t)}function Wb(){cd=!1,Es!==null&&mo(Es)&&(Es=null),Ts!==null&&mo(Ts)&&(Ts=null),As!==null&&mo(As)&&(As=null),ki.forEach(rg),Ci.forEach(rg)}function po(e,t){e.blockedOn===t&&(e.blockedOn=null,cd||(cd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Wb)))}var go=null;function ig(e){go!==e&&(go=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){go===e&&(go=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(od(i||n)===null)continue;break}var f=On(n);f!==null&&(e.splice(t,3),t-=3,lu(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function fr(e){function t(N){return po(N,e)}Es!==null&&po(Es,e),Ts!==null&&po(Ts,e),As!==null&&po(As,e),ki.forEach(t),Ci.forEach(t);for(var n=0;n<ks.length;n++){var i=ks[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<ks.length&&(n=ks[0],n.blockedOn===null);)ng(n),n.blockedOn===null&&ks.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var u=n[i],f=n[i+1],y=u[Dt]||null;if(typeof f=="function")y||ig(n);else if(y){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[Dt]||null)b=y.formAction;else if(od(u)!==null)continue}else b=y.action;typeof b=="function"?n[i+1]=b:(n.splice(i,3),i-=3),ig(n)}}}function lg(){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(n,20)}function n(){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(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function ud(e){this._internalRoot=e}yo.prototype.render=ud.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var n=t.current,i=Yt();Fp(n,i,e,t,null,null)},yo.prototype.unmount=ud.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fp(e.current,2,null,e,null,null),Ql(),t[kn]=null}};function yo(e){this._internalRoot=e}yo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Is();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ks.length&&t!==0&&t<ks[n].priority;n++);ks.splice(n,0,e),n===0&&ng(e)}};var og=a.version;if(og!=="19.2.3")throw Error(l(527,og,"19.2.3"));Y.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 ex={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vo.isDisabled&&vo.supportsFiber)try{$s=vo.inject(ex),wt=vo}catch{}}return Di.createRoot=function(e,t){if(!c(e))throw Error(l(299));var n=!1,i="",u=pm,f=gm,y=ym;return t!=null&&(t.unstable_strictMode===!0&&(n=!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=Qp(e,1,!1,null,null,n,i,null,u,f,y,lg),e[kn]=t.current,Pu(e),new ud(t)},Di.hydrateRoot=function(e,t,n){if(!c(e))throw Error(l(299));var i=!1,u="",f=pm,y=gm,b=ym,N=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(y=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError),n.formState!==void 0&&(N=n.formState)),t=Qp(e,1,!0,t,n??null,i,u,N,f,y,b,lg),t.context=Zp(null),n=t.current,i=Yt(),i=yt(i),u=ms(i),u.callback=null,ps(n,u,i),n=i,t.current.lanes=n,Hs(t,n),Sa(t),e[kn]=t.current,Pu(e),new yo(t)},Di.version="19.2.3",Di}var vg;function ux(){if(vg)return hd.exports;vg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),hd.exports=cx(),hd.exports}var dx=ux();const fx=sf(dx);const hx=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mx=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),bg=s=>{const a=mx(s);return a.charAt(0).toUpperCase()+a.slice(1)},gy=(...s)=>s.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),px=s=>{for(const a in s)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var gx={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 yx=x.forwardRef(({color:s="currentColor",size:a=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},p)=>x.createElement("svg",{ref:p,...gx,width:a,height:a,stroke:s,strokeWidth:l?Number(r)*24/Number(a):r,className:gy("lucide",c),...!d&&!px(m)&&{"aria-hidden":"true"},...m},[...h.map(([g,v])=>x.createElement(g,v)),...Array.isArray(d)?d:[d]]));const re=(s,a)=>{const r=x.forwardRef(({className:l,...c},d)=>x.createElement(yx,{ref:d,iconNode:a,className:gy(`lucide-${hx(bg(s))}`,`lucide-${s}`,l),...c}));return r.displayName=bg(s),r};const vx=[["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"}]],bx=re("activity",vx);const xx=[["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"}]],wx=re("archive",xx);const _x=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Sx=re("arrow-down",_x);const jx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Nx=re("arrow-left",jx);const Ex=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Tx=re("arrow-up",Ex);const Ax=[["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"}]],$i=re("brain",Ax);const kx=[["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"}]],Cx=re("calendar",kx);const Ox=[["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"}]],Rx=re("camera",Ox);const Dx=[["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"}]],yy=re("chart-column",Dx);const Mx=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ja=re("check",Mx);const zx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ux=re("chevron-down",zx);const Lx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bx=re("chevron-left",Lx);const qx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$x=re("chevron-right",qx);const Hx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Vx=re("chevron-up",Hx);const Ix=[["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"}]],Dr=re("circle-alert",Ix);const Gx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Hi=re("circle-check-big",Gx);const Px=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],lf=re("circle-check",Px);const Kx=[["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"}]],Yx=re("circle-user",Kx);const Jx=[["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"}]],Xx=re("circle-x",Jx);const Qx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Cr=re("clock",Qx);const Zx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],zs=re("code",Zx);const Fx=[["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"}]],Wx=re("copy",Fx);const ew=[["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"}]],of=re("cpu",ew);const tw=[["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"}]],Vi=re("database",tw);const aw=[["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"}]],Ii=re("external-link",aw);const sw=[["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"}]],nw=re("eye",sw);const rw=[["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"}]],iw=re("flag",rw);const lw=[["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"}]],ow=re("hash",lw);const cw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Or=re("info",cw);const uw=[["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"}]],dw=re("key-round",uw);const fw=[["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"}]],hw=re("key",fw);const mw=[["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"}]],pw=re("layout-dashboard",mw);const gw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$t=re("loader-circle",gw);const yw=[["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"}]],vw=re("log-in",yw);const bw=[["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"}]],xw=re("log-out",bw);const ww=[["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"}]],Bd=re("mail",ww);const _w=[["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"}]],Sw=re("minimize-2",_w);const jw=[["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"}]],Nw=re("moon",jw);const Ew=[["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"}]],xg=re("paperclip",Ew);const Tw=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],yd=re("pen",Tw);const Aw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Mi=re("plus",Aw);const kw=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],vd=re("power",kw);const Cw=[["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"}]],Bs=re("refresh-cw",Cw);const Ow=[["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"}]],vy=re("rotate-ccw",Ow);const Rw=[["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"}]],Dw=re("save",Rw);const Mw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zw=re("search",Mw);const Uw=[["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"}]],Lw=re("send",Uw);const Bw=[["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"}]],qd=re("settings",Bw);const qw=[["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"}]],$w=re("settings-2",qw);const Hw=[["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"}]],$d=re("shield-check",Hw);const Vw=[["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"}]],Iw=re("shield",Vw);const Gw=[["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"}]],Pw=re("sun",Gw);const Kw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Hd=re("terminal",Kw);const Yw=[["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"}]],zo=re("trash-2",Yw);const Jw=[["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"}]],Rr=re("triangle-alert",Jw);const Xw=[["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"}]],Qw=re("upload",Xw);const Zw=[["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"}]],Fw=re("user-plus",Zw);const Ww=[["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"}]],by=re("user",Ww);const e_=[["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"}]],t_=re("volume-2",e_);const a_=[["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"}]],s_=re("volume-x",a_);const n_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],tl=re("x",n_);const r_=[["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"}]],Uo=re("zap",r_),i_={theme:"system",setTheme:()=>null},xy=x.createContext(i_);function l_({children:s,defaultTheme:a="system",storageKey:r="vite-ui-theme"}){const[l,c]=x.useState(()=>localStorage.getItem(r)||a);x.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(xy.Provider,{value:d,children:s})}const o_=()=>{const s=x.useContext(xy);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s};function wg(s,a){if(typeof s=="function")return s(a);s!=null&&(s.current=a)}function Io(...s){return a=>{let r=!1;const l=s.map(c=>{const d=wg(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():wg(s[c],null)}}}}function bn(...s){return x.useCallback(Io(...s),s)}var c_=Symbol.for("react.lazy"),Lo=rf[" use ".trim().toString()];function u_(s){return typeof s=="object"&&s!==null&&"then"in s}function wy(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===c_&&"_payload"in s&&u_(s._payload)}function _y(s){const a=f_(s),r=x.forwardRef((l,c)=>{let{children:d,...h}=l;wy(d)&&typeof Lo=="function"&&(d=Lo(d._payload));const m=x.Children.toArray(d),p=m.find(m_);if(p){const g=p.props.children,v=m.map(w=>w===p?x.Children.count(g)>1?x.Children.only(null):x.isValidElement(g)?g.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(g)?x.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}var d_=_y("Slot");function f_(s){const a=x.forwardRef((r,l)=>{let{children:c,...d}=r;if(wy(c)&&typeof Lo=="function"&&(c=Lo(c._payload)),x.isValidElement(c)){const h=g_(c),m=p_(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Io(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var h_=Symbol("radix.slottable");function m_(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===h_}function p_(s,a){const r={...a};for(const l in a){const c=s[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{...s,...r}}function g_(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}function Sy(s){var a,r,l="";if(typeof s=="string"||typeof s=="number")l+=s;else if(typeof s=="object")if(Array.isArray(s)){var c=s.length;for(a=0;a<c;a++)s[a]&&(r=Sy(s[a]))&&(l&&(l+=" "),l+=r)}else for(r in s)s[r]&&(l&&(l+=" "),l+=r);return l}function jy(){for(var s,a,r=0,l="",c=arguments.length;r<c;r++)(s=arguments[r])&&(a=Sy(s))&&(l&&(l+=" "),l+=a);return l}const _g=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,Sg=jy,Ny=(s,a)=>r=>{var l;if(a?.variants==null)return Sg(s,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(g=>{const v=r?.[g],w=d?.[g];if(v===null)return null;const _=_g(v)||_g(w);return c[g][_]}),m=r&&Object.entries(r).reduce((g,v)=>{let[w,_]=v;return _===void 0||(g[w]=_),g},{}),p=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((g,v)=>{let{class:w,className:_,...S}=v;return Object.entries(S).every(E=>{let[j,O]=E;return Array.isArray(O)?O.includes({...d,...m}[j]):{...d,...m}[j]===O})?[...g,w,_]:g},[]);return Sg(s,h,p,r?.class,r?.className)},y_=(s,a)=>{const r=new Array(s.length+a.length);for(let l=0;l<s.length;l++)r[l]=s[l];for(let l=0;l<a.length;l++)r[s.length+l]=a[l];return r},v_=(s,a)=>({classGroupId:s,validator:a}),Ey=(s=new Map,a=null,r)=>({nextPart:s,validators:a,classGroupId:r}),Bo="-",jg=[],b_="arbitrary..",x_=s=>{const a=__(s),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=s;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return w_(h);const m=h.split(Bo),p=m[0]===""&&m.length>1?1:0;return Ty(m,p,a)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=l[h],g=r[h];return p?g?y_(g,p):p:g||jg}return r[h]||jg}}},Ty=(s,a,r)=>{if(s.length-a===0)return r.classGroupId;const c=s[a],d=r.nextPart.get(c);if(d){const g=Ty(s,a+1,d);if(g)return g}const h=r.validators;if(h===null)return;const m=a===0?s.join(Bo):s.slice(a).join(Bo),p=h.length;for(let g=0;g<p;g++){const v=h[g];if(v.validator(m))return v.classGroupId}},w_=s=>s.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=s.slice(1,-1),r=a.indexOf(":"),l=a.slice(0,r);return l?b_+l:void 0})(),__=s=>{const{theme:a,classGroups:r}=s;return S_(r,a)},S_=(s,a)=>{const r=Ey();for(const l in s){const c=s[l];cf(c,r,l,a)}return r},cf=(s,a,r,l)=>{const c=s.length;for(let d=0;d<c;d++){const h=s[d];j_(h,a,r,l)}},j_=(s,a,r,l)=>{if(typeof s=="string"){N_(s,a,r);return}if(typeof s=="function"){E_(s,a,r,l);return}T_(s,a,r,l)},N_=(s,a,r)=>{const l=s===""?a:Ay(a,s);l.classGroupId=r},E_=(s,a,r,l)=>{if(A_(s)){cf(s(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(v_(r,s))},T_=(s,a,r,l)=>{const c=Object.entries(s),d=c.length;for(let h=0;h<d;h++){const[m,p]=c[h];cf(p,Ay(a,m),r,l)}},Ay=(s,a)=>{let r=s;const l=a.split(Bo),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=Ey(),r.nextPart.set(h,m)),r=m}return r},A_=s=>"isThemeGetter"in s&&s.isThemeGetter===!0,k_=s=>{if(s<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),l=Object.create(null);const c=(d,h)=>{r[d]=h,a++,a>s&&(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)}}},Vd="!",Ng=":",C_=[],Eg=(s,a,r,l,c)=>({modifiers:s,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),O_=s=>{const{prefix:a,experimentalParseClassName:r}=s;let l=c=>{const d=[];let h=0,m=0,p=0,g;const v=c.length;for(let j=0;j<v;j++){const O=c[j];if(h===0&&m===0){if(O===Ng){d.push(c.slice(p,j)),p=j+1;continue}if(O==="/"){g=j;continue}}O==="["?h++:O==="]"?h--:O==="("?m++:O===")"&&m--}const w=d.length===0?c:c.slice(p);let _=w,S=!1;w.endsWith(Vd)?(_=w.slice(0,-1),S=!0):w.startsWith(Vd)&&(_=w.slice(1),S=!0);const E=g&&g>p?g-p:void 0;return Eg(d,S,_,E)};if(a){const c=a+Ng,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):Eg(C_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},R_=s=>{const a=new Map;return s.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}},D_=s=>({cache:k_(s.cacheSize),parseClassName:O_(s),sortModifiers:R_(s),...x_(s)}),M_=/\s+/,z_=(s,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=s.trim().split(M_);let p="";for(let g=m.length-1;g>=0;g-=1){const v=m[g],{isExternal:w,modifiers:_,hasImportantModifier:S,baseClassName:E,maybePostfixModifierPosition:j}=r(v);if(w){p=v+(p.length>0?" "+p:p);continue}let O=!!j,D=l(O?E.substring(0,j):E);if(!D){if(!O){p=v+(p.length>0?" "+p:p);continue}if(D=l(E),!D){p=v+(p.length>0?" "+p:p);continue}O=!1}const q=_.length===0?"":_.length===1?_[0]:d(_).join(":"),B=S?q+Vd:q,G=B+D;if(h.indexOf(G)>-1)continue;h.push(G);const W=c(D,O);for(let J=0;J<W.length;++J){const P=W[J];h.push(B+P)}p=v+(p.length>0?" "+p:p)}return p},U_=(...s)=>{let a=0,r,l,c="";for(;a<s.length;)(r=s[a++])&&(l=ky(r))&&(c&&(c+=" "),c+=l);return c},ky=s=>{if(typeof s=="string")return s;let a,r="";for(let l=0;l<s.length;l++)s[l]&&(a=ky(s[l]))&&(r&&(r+=" "),r+=a);return r},L_=(s,...a)=>{let r,l,c,d;const h=p=>{const g=a.reduce((v,w)=>w(v),s());return r=D_(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=z_(p,r);return c(p,v),v};return d=h,(...p)=>d(U_(...p))},B_=[],ft=s=>{const a=r=>r[s]||B_;return a.isThemeGetter=!0,a},Cy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Oy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,q_=/^\d+\/\d+$/,$_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H_=/\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$/,V_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,I_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hr=s=>q_.test(s),we=s=>!!s&&!Number.isNaN(Number(s)),Os=s=>!!s&&Number.isInteger(Number(s)),bd=s=>s.endsWith("%")&&we(s.slice(0,-1)),Fa=s=>$_.test(s),P_=()=>!0,K_=s=>H_.test(s)&&!V_.test(s),Ry=()=>!1,Y_=s=>I_.test(s),J_=s=>G_.test(s),X_=s=>!ae(s)&&!se(s),Q_=s=>Mr(s,zy,Ry),ae=s=>Cy.test(s),cn=s=>Mr(s,Uy,K_),xd=s=>Mr(s,t1,we),Tg=s=>Mr(s,Dy,Ry),Z_=s=>Mr(s,My,J_),bo=s=>Mr(s,Ly,Y_),se=s=>Oy.test(s),zi=s=>zr(s,Uy),F_=s=>zr(s,a1),Ag=s=>zr(s,Dy),W_=s=>zr(s,zy),e1=s=>zr(s,My),xo=s=>zr(s,Ly,!0),Mr=(s,a,r)=>{const l=Cy.exec(s);return l?l[1]?a(l[1]):r(l[2]):!1},zr=(s,a,r=!1)=>{const l=Oy.exec(s);return l?l[1]?a(l[1]):r:!1},Dy=s=>s==="position"||s==="percentage",My=s=>s==="image"||s==="url",zy=s=>s==="length"||s==="size"||s==="bg-size",Uy=s=>s==="length",t1=s=>s==="number",a1=s=>s==="family-name",Ly=s=>s==="shadow",s1=()=>{const s=ft("color"),a=ft("font"),r=ft("text"),l=ft("font-weight"),c=ft("tracking"),d=ft("leading"),h=ft("breakpoint"),m=ft("container"),p=ft("spacing"),g=ft("radius"),v=ft("shadow"),w=ft("inset-shadow"),_=ft("text-shadow"),S=ft("drop-shadow"),E=ft("blur"),j=ft("perspective"),O=ft("aspect"),D=ft("ease"),q=ft("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...G(),se,ae],J=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],Q=()=>[se,ae,p],ce=()=>[hr,"full","auto",...Q()],Je=()=>[Os,"none","subgrid",se,ae],ve=()=>["auto",{span:["full",Os,se,ae]},Os,se,ae],pe=()=>[Os,"auto",se,ae],Ze=()=>["auto","min","max","fr",se,ae],st=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],qe=()=>["start","end","center","stretch","center-safe","end-safe"],k=()=>["auto",...Q()],Y=()=>[hr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],K=()=>[s,se,ae],_e=()=>[...G(),Ag,Tg,{position:[se,ae]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",W_,Q_,{size:[se,ae]}],V=()=>[bd,zi,cn],X=()=>["","none","full",g,se,ae],F=()=>["",we,zi,cn],de=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[we,bd,Ag,Tg],Ge=()=>["","none",E,se,ae],Ue=()=>["none",we,se,ae],kt=()=>["none",we,se,ae],pt=()=>[we,se,ae],xt=()=>[hr,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fa],breakpoint:[Fa],color:[P_],container:[Fa],"drop-shadow":[Fa],ease:["in","out","in-out"],font:[X_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fa],shadow:[Fa],spacing:["px",we],text:[Fa],"text-shadow":[Fa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",hr,ae,se,O]}],container:["container"],columns:[{columns:[we,ae,se,m]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ce()}],"inset-x":[{"inset-x":ce()}],"inset-y":[{"inset-y":ce()}],start:[{start:ce()}],end:[{end:ce()}],top:[{top:ce()}],right:[{right:ce()}],bottom:[{bottom:ce()}],left:[{left:ce()}],visibility:["visible","invisible","collapse"],z:[{z:[Os,"auto",se,ae]}],basis:[{basis:[hr,"full","auto",m,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[we,hr,"auto","initial","none",ae]}],grow:[{grow:["",we,se,ae]}],shrink:[{shrink:["",we,se,ae]}],order:[{order:[Os,"first","last","none",se,ae]}],"grid-cols":[{"grid-cols":Je()}],"col-start-end":[{col:ve()}],"col-start":[{"col-start":pe()}],"col-end":[{"col-end":pe()}],"grid-rows":[{"grid-rows":Je()}],"row-start-end":[{row:ve()}],"row-start":[{"row-start":pe()}],"row-end":[{"row-end":pe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ze()}],"auto-rows":[{"auto-rows":Ze()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...st(),"normal"]}],"justify-items":[{"justify-items":[...qe(),"normal"]}],"justify-self":[{"justify-self":["auto",...qe()]}],"align-content":[{content:["normal",...st()]}],"align-items":[{items:[...qe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...qe(),{baseline:["","last"]}]}],"place-content":[{"place-content":st()}],"place-items":[{"place-items":[...qe(),"baseline"]}],"place-self":[{"place-self":["auto",...qe()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[m,"screen",...Y()]}],"min-w":[{"min-w":[m,"screen","none",...Y()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",r,zi,cn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,se,xd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bd,ae]}],"font-family":[{font:[F_,ae,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,se,ae]}],"line-clamp":[{"line-clamp":[we,"none",se,xd]}],leading:[{leading:[d,...Q()]}],"list-image":[{"list-image":["none",se,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[we,"from-font","auto",se,cn]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[we,"auto",se,ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",se,ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_e()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Os,se,ae],radial:["",se,ae],conic:[Os,se,ae]},e1,Z_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded: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:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[we,se,ae]}],"outline-w":[{outline:["",we,zi,cn]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",v,xo,bo]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",w,xo,bo]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[we,cn]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",_,xo,bo]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[we,se,ae]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"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":[se,ae]}],"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":G()}],"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:_e()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,ae]}],filter:[{filter:["","none",se,ae]}],blur:[{blur:Ge()}],brightness:[{brightness:[we,se,ae]}],contrast:[{contrast:[we,se,ae]}],"drop-shadow":[{"drop-shadow":["","none",S,xo,bo]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",we,se,ae]}],"hue-rotate":[{"hue-rotate":[we,se,ae]}],invert:[{invert:["",we,se,ae]}],saturate:[{saturate:[we,se,ae]}],sepia:[{sepia:["",we,se,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",se,ae]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[we,se,ae]}],"backdrop-contrast":[{"backdrop-contrast":[we,se,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",we,se,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[we,se,ae]}],"backdrop-invert":[{"backdrop-invert":["",we,se,ae]}],"backdrop-opacity":[{"backdrop-opacity":[we,se,ae]}],"backdrop-saturate":[{"backdrop-saturate":[we,se,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",we,se,ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[we,"initial",se,ae]}],ease:[{ease:["linear","initial",D,se,ae]}],delay:[{delay:[we,se,ae]}],animate:[{animate:["none",q,se,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,se,ae]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:Ue()}],"rotate-x":[{"rotate-x":Ue()}],"rotate-y":[{"rotate-y":Ue()}],"rotate-z":[{"rotate-z":Ue()}],scale:[{scale:kt()}],"scale-x":[{"scale-x":kt()}],"scale-y":[{"scale-y":kt()}],"scale-z":[{"scale-z":kt()}],"scale-3d":["scale-3d"],skew:[{skew:pt()}],"skew-x":[{"skew-x":pt()}],"skew-y":[{"skew-y":pt()}],transform:[{transform:[se,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xt()}],"translate-x":[{"translate-x":xt()}],"translate-y":[{"translate-y":xt()}],"translate-z":[{"translate-z":xt()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",se,ae]}],"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":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",se,ae]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[we,zi,cn,xd]}],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"]}},n1=L_(s1);function Oe(...s){return n1(jy(s))}const r1=Ny("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"}}),Z=x.forwardRef(({className:s,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?d_:"button";return o.jsx(h,{className:Oe(r1({variant:a,size:r,className:s})),ref:d,...c})});Z.displayName="Button";function By(){const{setTheme:s,theme:a}=o_();return o.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>s(a==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground w-8 px-0",title:`Switch to ${a==="dark"?"light":"dark"} mode`,children:[a==="dark"?o.jsx(Pw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(Nw,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var Na=function(){return Na=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},Na.apply(this,arguments)};function Ur(s,a){var r={};for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&a.indexOf(l)<0&&(r[l]=s[l]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(s);c<l.length;c++)a.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(s,l[c])&&(r[l[c]]=s[l[c]]);return r}function i1(s,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(w){h(w)}}function p(v){try{g(l.throw(v))}catch(w){h(w)}}function g(v){v.done?d(v.value):c(v.value).then(m,p)}g((l=l.apply(s,a||[])).next())})}function l1(s,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 s.concat(d||Array.prototype.slice.call(a))}const o1=s=>s?(...a)=>s(...a):(...a)=>fetch(...a);class uf extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class c1 extends uf{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class kg extends uf{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class Cg extends uf{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Id;(function(s){s.Any="any",s.ApNortheast1="ap-northeast-1",s.ApNortheast2="ap-northeast-2",s.ApSouth1="ap-south-1",s.ApSoutheast1="ap-southeast-1",s.ApSoutheast2="ap-southeast-2",s.CaCentral1="ca-central-1",s.EuCentral1="eu-central-1",s.EuWest1="eu-west-1",s.EuWest2="eu-west-2",s.EuWest3="eu-west-3",s.SaEast1="sa-east-1",s.UsEast1="us-east-1",s.UsWest1="us-west-1",s.UsWest2="us-west-2"})(Id||(Id={}));class u1{constructor(a,{headers:r={},customFetch:l,region:c=Id.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=o1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return i1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:p,body:g,signal:v,timeout:w}=l;let _={},{region:S}=l;S||(S=this.region);const E=new URL(`${this.url}/${r}`);S&&S!=="any"&&(_["x-region"]=S,E.searchParams.set("forceFunctionRegion",S));let j;g&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&g instanceof Blob||g instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",j=g):typeof g=="string"?(_["Content-Type"]="text/plain",j=g):typeof FormData<"u"&&g instanceof FormData?j=g:(_["Content-Type"]="application/json",j=JSON.stringify(g)):g&&typeof g!="string"&&!(typeof Blob<"u"&&g instanceof Blob)&&!(g instanceof ArrayBuffer)&&!(typeof FormData<"u"&&g instanceof FormData)?j=JSON.stringify(g):j=g;let O=v;w&&(h=new AbortController,d=setTimeout(()=>h.abort(),w),v?(O=h.signal,v.addEventListener("abort",()=>h.abort())):O=h.signal);const D=yield this.fetch(E.toString(),{method:p||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),m),body:j,signal:O}).catch(W=>{throw new c1(W)}),q=D.headers.get("x-relay-error");if(q&&q==="true")throw new kg(D);if(!D.ok)throw new Cg(D);let B=((c=D.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),G;return B==="application/json"?G=yield D.json():B==="application/octet-stream"||B==="application/pdf"?G=yield D.blob():B==="text/event-stream"?G=D:B==="multipart/form-data"?G=yield D.formData():G=yield D.text(),{data:G,error:null,response:D}}catch(m){return{data:null,error:m,response:m instanceof Cg||m instanceof kg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var d1=class extends Error{constructor(s){super(s.message),this.name="PostgrestError",this.details=s.details,this.hint=s.hint,this.code=s.code}},f1=class{constructor(s){var a,r;this.shouldThrowOnError=!1,this.method=s.method,this.url=s.url,this.headers=new Headers(s.headers),this.schema=s.schema,this.body=s.body,this.shouldThrowOnError=(a=s.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=s.signal,this.isMaybeSingle=(r=s.isMaybeSingle)!==null&&r!==void 0?r:!1,s.fetch?this.fetch=s.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(s,a){return this.headers=new Headers(this.headers),this.headers.set(s,a),this}then(s,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 w,_;if(r.method!=="HEAD"){var S;const D=await d.text();D===""||(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=D:m=JSON.parse(D))}const j=(w=r.headers.get("Prefer"))===null||w===void 0?void 0:w.match(/count=(exact|planned|estimated)/),O=(_=d.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");j&&O&&O.length>1&&(p=parseInt(O[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 E;const j=await d.text();try{h=JSON.parse(j),Array.isArray(h)&&d.status===404&&(m=[],h=null,g=200,v="OK")}catch{d.status===404&&j===""?(g=204,v="No Content"):h={message:j}}if(h&&r.isMaybeSingle&&(!(h==null||(E=h.details)===null||E===void 0)&&E.includes("0 rows"))&&(h=null,g=200,v="OK"),h&&r.shouldThrowOnError)throw new d1(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,w,_;const E=(g=p?.message)!==null&&g!==void 0?g:"",j=(v=p?.code)!==null&&v!==void 0?v:"";m=`${(w=d?.name)!==null&&w!==void 0?w:"FetchError"}: ${d?.message}`,m+=`
|
|
8
|
+
`+i.stack}}var is=Object.prototype.hasOwnProperty,_n=s.unstable_scheduleCallback,ls=s.unstable_cancelCallback,sl=s.unstable_shouldYield,qs=s.unstable_requestPaint,gt=s.unstable_now,nl=s.unstable_getCurrentPriorityLevel,$r=s.unstable_ImmediatePriority,Hr=s.unstable_UserBlockingPriority,Da=s.unstable_NormalPriority,Sn=s.unstable_LowPriority,ya=s.unstable_IdlePriority,jn=s.log,Qo=s.unstable_setDisableYieldValue,$s=null,wt=null;function va(e){if(typeof jn=="function"&&Qo(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode($s,e)}catch{}}var Ot=Math.clz32?Math.clz32:Wo,Zo=Math.log,Fo=Math.LN2;function Wo(e){return e>>>=0,e===0?32:31-(Zo(e)/Fo|0)|0}var Nn=256,En=262144,Tn=4194304;function Ma(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 An(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~f,i!==0?u=Ma(i):(v&=b,v!==0?u=Ma(v):n||(n=b&~e,n!==0&&(u=Ma(n))))):(b=i&~f,b!==0?u=Ma(b):v!==0?u=Ma(v):n||(n=i&~e,n!==0&&(u=Ma(n)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,n=t&-t,f>=n||f===32&&(n&4194048)!==0)?t:u}function os(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ec(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 rl(){var e=Tn;return Tn<<=1,(Tn&62914560)===0&&(Tn=4194304),e}function Vr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Hs(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tc(e,t,n,i,u,f){var v=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var b=e.entanglements,N=e.expirationTimes,z=e.hiddenUpdates;for(n=v&~n;0<n;){var $=31-Ot(n),I=1<<$;b[$]=0,N[$]=-1;var U=z[$];if(U!==null)for(z[$]=null,$=0;$<U.length;$++){var L=U[$];L!==null&&(L.lane&=-536870913)}n&=~I}i!==0&&R(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(v&~t))}function R(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ot(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function ee(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Ot(n),u=1<<i;u&t|e[i]&t&&(e[i]|=t),n&=~u}}function Ce(e,t){var n=t&-t;return n=(n&42)!==0?1:yt(n),(n&(e.suspendedLanes|t))!==0?0:n}function yt(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 Vs(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Is(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:ag(e.type))}function Gs(e,t){var n=Y.p;try{return Y.p=e,t()}finally{Y.p=n}}var ba=Math.random().toString(36).slice(2),ut="__reactFiber$"+ba,Dt="__reactProps$"+ba,Cn="__reactContainer$"+ba,ac="__reactEvents$"+ba,Pv="__reactListeners$"+ba,Kv="__reactHandles$"+ba,bf="__reactResources$"+ba,Ir="__reactMarker$"+ba;function sc(e){delete e[ut],delete e[Dt],delete e[ac],delete e[Pv],delete e[Kv]}function kn(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Cn]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=$p(e);e!==null;){if(n=e[ut])return n;e=$p(e)}return t}e=n,n=e.parentNode}return null}function On(e){if(e=e[ut]||e[Cn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function Rn(e){var t=e[bf];return t||(t=e[bf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function vt(e){e[Ir]=!0}var xf=new Set,wf={};function Ps(e,t){Dn(e,t),Dn(e+"Capture",t)}function Dn(e,t){for(wf[e]=t,e=0;e<t.length;e++)xf.add(t[e])}var Yv=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]*$"),_f={},Sf={};function Jv(e){return is.call(Sf,e)?!0:is.call(_f,e)?!1:Yv.test(e)?Sf[e]=!0:(_f[e]=!0,!1)}function il(e,t,n){if(Jv(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){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,""+n)}}function ll(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function za(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+i)}}function Zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xv(e,t,n){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(v){n=""+v,f.call(this,v)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(v){n=""+v},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function nc(e){if(!e._valueTracker){var t=jf(e)?"checked":"value";e._valueTracker=Xv(e,t,""+e[t])}}function Nf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=jf(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function ol(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 Qv=/[\n"\\]/g;function Ft(e){return e.replace(Qv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function rc(e,t,n,i,u,f,v,b){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),t!=null?v==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),t!=null?ic(e,v,Zt(t)):n!=null?ic(e,v,Zt(n)):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=""+Zt(b):e.removeAttribute("name")}function Ef(e,t,n,i,u,f,v,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||n!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){nc(e);return}n=n!=null?""+Zt(n):"",t=t!=null?""+Zt(t):n,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,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),nc(e)}function ic(e,t,n){t==="number"&&ol(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Mn(e,t,n,i){if(e=e.options,t){t={};for(var u=0;u<n.length;u++)t["$"+n[u]]=!0;for(n=0;n<e.length;n++)u=t.hasOwnProperty("$"+e[n].value),e[n].selected!==u&&(e[n].selected=u),u&&i&&(e[n].defaultSelected=!0)}else{for(n=""+Zt(n),t=null,u=0;u<e.length;u++){if(e[u].value===n){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Tf(e,t,n){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Zt(n):""}function Af(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(l(92));if(qe(i)){if(1<i.length)throw Error(l(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=Zt(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),nc(e)}function zn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Zv=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 Cf(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!="number"||n===0||Zv.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function kf(e,t,n){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,n!=null){for(var i in n)!n.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)&&n[u]!==i&&Cf(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&Cf(e,f,t[f])}function lc(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 Fv=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"]]),Wv=/^[\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 cl(e){return Wv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ua(){}var oc=null;function cc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Un=null,Ln=null;function Of(e){var t=On(e);if(t&&(e=t.stateNode)){var n=e[Dt]||null;e:switch(e=t.stateNode,t.type){case"input":if(rc(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ft(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var u=i[Dt]||null;if(!u)throw Error(l(90));rc(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&Nf(i)}break e;case"textarea":Tf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Mn(e,!!n.multiple,t,!1)}}}var uc=!1;function Rf(e,t,n){if(uc)return e(t,n);uc=!0;try{var i=e(t);return i}finally{if(uc=!1,(Un!==null||Ln!==null)&&(Ql(),Un&&(t=Un,e=Ln,Ln=Un=null,Of(t),e)))for(t=0;t<e.length;t++)Of(e[t])}}function Pr(e,t){var n=e.stateNode;if(n===null)return null;var i=n[Dt]||null;if(i===null)return null;n=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(n&&typeof n!="function")throw Error(l(231,t,typeof n));return n}var La=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dc=!1;if(La)try{var Kr={};Object.defineProperty(Kr,"passive",{get:function(){dc=!0}}),window.addEventListener("test",Kr,Kr),window.removeEventListener("test",Kr,Kr)}catch{dc=!1}var cs=null,fc=null,ul=null;function Df(){if(ul)return ul;var e,t=fc,n=t.length,i,u="value"in cs?cs.value:cs.textContent,f=u.length;for(e=0;e<n&&t[e]===u[e];e++);var v=n-e;for(i=1;i<=v&&t[n-i]===u[f-i];i++);return ul=u.slice(e,1<i?1-i:void 0)}function dl(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 fl(){return!0}function Mf(){return!1}function Mt(e){function t(n,i,u,f,v){this._reactName=n,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=v,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(n=e[b],this[b]=n?n(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?fl:Mf,this.isPropagationStopped=Mf,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=fl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=fl)},persist:function(){},isPersistent:fl}),t}var Ks={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hl=Mt(Ks),Yr=w({},Ks,{view:0,detail:0}),e0=Mt(Yr),hc,mc,Jr,ml=w({},Yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,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!==Jr&&(Jr&&e.type==="mousemove"?(hc=e.screenX-Jr.screenX,mc=e.screenY-Jr.screenY):mc=hc=0,Jr=e),hc)},movementY:function(e){return"movementY"in e?e.movementY:mc}}),zf=Mt(ml),t0=w({},ml,{dataTransfer:0}),a0=Mt(t0),s0=w({},Yr,{relatedTarget:0}),pc=Mt(s0),n0=w({},Ks,{animationName:0,elapsedTime:0,pseudoElement:0}),r0=Mt(n0),i0=w({},Ks,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),l0=Mt(i0),o0=w({},Ks,{data:0}),Uf=Mt(o0),c0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},u0={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"},d0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function f0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=d0[e])?!!t[e]:!1}function gc(){return f0}var h0=w({},Yr,{key:function(e){if(e.key){var t=c0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=dl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?u0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(e){return e.type==="keypress"?dl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?dl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),m0=Mt(h0),p0=w({},ml,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lf=Mt(p0),g0=w({},Yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),y0=Mt(g0),v0=w({},Ks,{propertyName:0,elapsedTime:0,pseudoElement:0}),b0=Mt(v0),x0=w({},ml,{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}),w0=Mt(x0),_0=w({},Ks,{newState:0,oldState:0}),S0=Mt(_0),j0=[9,13,27,32],yc=La&&"CompositionEvent"in window,Xr=null;La&&"documentMode"in document&&(Xr=document.documentMode);var N0=La&&"TextEvent"in window&&!Xr,Bf=La&&(!yc||Xr&&8<Xr&&11>=Xr),qf=" ",$f=!1;function Hf(e,t){switch(e){case"keyup":return j0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bn=!1;function E0(e,t){switch(e){case"compositionend":return Vf(t);case"keypress":return t.which!==32?null:($f=!0,qf);case"textInput":return e=t.data,e===qf&&$f?null:e;default:return null}}function T0(e,t){if(Bn)return e==="compositionend"||!yc&&Hf(e,t)?(e=Df(),ul=fc=cs=null,Bn=!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 Bf&&t.locale!=="ko"?null:t.data;default:return null}}var A0={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 If(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!A0[e.type]:t==="textarea"}function Gf(e,t,n,i){Un?Ln?Ln.push(i):Ln=[i]:Un=i,t=so(t,"onChange"),0<t.length&&(n=new hl("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var Qr=null,Zr=null;function C0(e){Ep(e,0)}function pl(e){var t=Gr(e);if(Nf(t))return e}function Pf(e,t){if(e==="change")return t}var Kf=!1;if(La){var vc;if(La){var bc="oninput"in document;if(!bc){var Yf=document.createElement("div");Yf.setAttribute("oninput","return;"),bc=typeof Yf.oninput=="function"}vc=bc}else vc=!1;Kf=vc&&(!document.documentMode||9<document.documentMode)}function Jf(){Qr&&(Qr.detachEvent("onpropertychange",Xf),Zr=Qr=null)}function Xf(e){if(e.propertyName==="value"&&pl(Zr)){var t=[];Gf(t,Zr,e,cc(e)),Rf(C0,t)}}function k0(e,t,n){e==="focusin"?(Jf(),Qr=t,Zr=n,Qr.attachEvent("onpropertychange",Xf)):e==="focusout"&&Jf()}function O0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return pl(Zr)}function R0(e,t){if(e==="click")return pl(t)}function D0(e,t){if(e==="input"||e==="change")return pl(t)}function M0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ht=typeof Object.is=="function"?Object.is:M0;function Fr(e,t){if(Ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var u=n[i];if(!is.call(t,u)||!Ht(e[u],t[u]))return!1}return!0}function Qf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zf(e,t){var n=Qf(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Qf(n)}}function Ff(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ff(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ol(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ol(e.document)}return t}function xc(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 z0=La&&"documentMode"in document&&11>=document.documentMode,qn=null,wc=null,Wr=null,_c=!1;function eh(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_c||qn==null||qn!==ol(i)||(i=qn,"selectionStart"in i&&xc(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}),Wr&&Fr(Wr,i)||(Wr=i,i=so(wc,"onSelect"),0<i.length&&(t=new hl("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=qn)))}function Ys(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var $n={animationend:Ys("Animation","AnimationEnd"),animationiteration:Ys("Animation","AnimationIteration"),animationstart:Ys("Animation","AnimationStart"),transitionrun:Ys("Transition","TransitionRun"),transitionstart:Ys("Transition","TransitionStart"),transitioncancel:Ys("Transition","TransitionCancel"),transitionend:Ys("Transition","TransitionEnd")},Sc={},th={};La&&(th=document.createElement("div").style,"AnimationEvent"in window||(delete $n.animationend.animation,delete $n.animationiteration.animation,delete $n.animationstart.animation),"TransitionEvent"in window||delete $n.transitionend.transition);function Js(e){if(Sc[e])return Sc[e];if(!$n[e])return e;var t=$n[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in th)return Sc[e]=t[n];return e}var ah=Js("animationend"),sh=Js("animationiteration"),nh=Js("animationstart"),U0=Js("transitionrun"),L0=Js("transitionstart"),B0=Js("transitioncancel"),rh=Js("transitionend"),ih=new Map,jc="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(" ");jc.push("scrollEnd");function oa(e,t){ih.set(e,t),Ps(t,[e])}var gl=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)},Wt=[],Hn=0,Nc=0;function yl(){for(var e=Hn,t=Nc=Hn=0;t<e;){var n=Wt[t];Wt[t++]=null;var i=Wt[t];Wt[t++]=null;var u=Wt[t];Wt[t++]=null;var f=Wt[t];if(Wt[t++]=null,i!==null&&u!==null){var v=i.pending;v===null?u.next=u:(u.next=v.next,v.next=u),i.pending=u}f!==0&&lh(n,u,f)}}function vl(e,t,n,i){Wt[Hn++]=e,Wt[Hn++]=t,Wt[Hn++]=n,Wt[Hn++]=i,Nc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Ec(e,t,n,i){return vl(e,t,n,i),bl(e)}function Xs(e,t){return vl(e,null,null,t),bl(e)}function lh(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var u=!1,f=e.return;f!==null;)f.childLanes|=n,i=f.alternate,i!==null&&(i.childLanes|=n),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-Ot(n),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=n|536870912),f):null}function bl(e){if(50<wi)throw wi=0,zu=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Vn={};function q0(e,t,n,i){this.tag=e,this.key=n,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 Vt(e,t,n,i){return new q0(e,t,n,i)}function Tc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ba(e,t){var n=e.alternate;return n===null?(n=Vt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function oh(e,t){e.flags&=65011714;var n=e.alternate;return n===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=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function xl(e,t,n,i,u,f){var v=0;if(i=e,typeof e=="function")Tc(e)&&(v=1);else if(typeof e=="string")v=Gb(e,n,F.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ce:return e=Vt(31,n,t,u),e.elementType=ce,e.lanes=f,e;case j:return Qs(n.children,u,f,t);case O:v=8,u|=24;break;case D:return e=Vt(12,n,t,u|2),e.elementType=D,e.lanes=f,e;case W:return e=Vt(13,n,t,u),e.elementType=W,e.lanes=f,e;case J:return e=Vt(19,n,t,u),e.elementType=J,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:v=10;break e;case q:v=9;break e;case G:v=11;break e;case P:v=14;break e;case Q:v=16,i=null;break e}v=29,n=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=Vt(v,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Qs(e,t,n,i){return e=Vt(7,e,i,t),e.lanes=n,e}function Ac(e,t,n){return e=Vt(6,e,null,t),e.lanes=n,e}function ch(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Cc(e,t,n){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var uh=new WeakMap;function ea(e,t){if(typeof e=="object"&&e!==null){var n=uh.get(e);return n!==void 0?n:(t={value:e,source:t,stack:qr(t)},uh.set(e,t),t)}return{value:e,source:t,stack:qr(t)}}var In=[],Gn=0,wl=null,ei=0,ta=[],aa=0,us=null,xa=1,wa="";function qa(e,t){In[Gn++]=ei,In[Gn++]=wl,wl=e,ei=t}function dh(e,t,n){ta[aa++]=xa,ta[aa++]=wa,ta[aa++]=us,us=e;var i=xa;e=wa;var u=32-Ot(i)-1;i&=~(1<<u),n+=1;var f=32-Ot(t)+u;if(30<f){var v=u-u%5;f=(i&(1<<v)-1).toString(32),i>>=v,u-=v,xa=1<<32-Ot(t)+u|n<<u|i,wa=f+e}else xa=1<<f|n<<u|i,wa=e}function kc(e){e.return!==null&&(qa(e,1),dh(e,1,0))}function Oc(e){for(;e===wl;)wl=In[--Gn],In[Gn]=null,ei=In[--Gn],In[Gn]=null;for(;e===us;)us=ta[--aa],ta[aa]=null,wa=ta[--aa],ta[aa]=null,xa=ta[--aa],ta[aa]=null}function fh(e,t){ta[aa++]=xa,ta[aa++]=wa,ta[aa++]=us,xa=t.id,wa=t.overflow,us=e}var _t=null,Ke=null,ke=!1,ds=null,sa=!1,Rc=Error(l(519));function fs(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ti(ea(t,e)),Rc}function hh(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[ut]=e,t[Dt]=i,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<Si.length;n++)Ee(Si[n],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),Ef(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),Af(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||kp(t.textContent,n)?(i.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),i.onScroll!=null&&Ee("scroll",t),i.onScrollEnd!=null&&Ee("scrollend",t),i.onClick!=null&&(t.onclick=Ua),t=!0):t=!1,t||fs(e,!0)}function mh(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:_t=_t.return}}function Pn(e){if(e!==_t)return!1;if(!ke)return mh(e),ke=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Qu(e.type,e.memoizedProps)),n=!n),n&&Ke&&fs(e),mh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=qp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=qp(e)}else t===27?(t=Ke,Es(e.type)?(e=td,td=null,Ke=e):Ke=t):Ke=_t?ra(e.stateNode.nextSibling):null;return!0}function Zs(){Ke=_t=null,ke=!1}function Dc(){var e=ds;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),ds=null),e}function ti(e){ds===null?ds=[e]:ds.push(e)}var Mc=A(null),Fs=null,$a=null;function hs(e,t,n){X(Mc,t._currentValue),t._currentValue=n}function Ha(e){e._currentValue=Mc.current,V(Mc)}function zc(e,t,n){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===n)break;e=e.return}}function Uc(e,t,n,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var v=u.child;f=f.firstContext;e:for(;f!==null;){var b=f;f=u;for(var N=0;N<t.length;N++)if(b.context===t[N]){f.lanes|=n,b=f.alternate,b!==null&&(b.lanes|=n),zc(f.return,n,e),i||(v=null);break e}f=b.next}}else if(u.tag===18){if(v=u.return,v===null)throw Error(l(341));v.lanes|=n,f=v.alternate,f!==null&&(f.lanes|=n),zc(v,n,e),v=null}else v=u.child;if(v!==null)v.return=u;else for(v=u;v!==null;){if(v===e){v=null;break}if(u=v.sibling,u!==null){u.return=v.return,v=u;break}v=v.return}u=v}}function Kn(e,t,n,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 v=u.alternate;if(v===null)throw Error(l(387));if(v=v.memoizedProps,v!==null){var b=u.type;Ht(u.pendingProps.value,v.value)||(e!==null?e.push(b):e=[b])}}else if(u===ue.current){if(v=u.alternate,v===null)throw Error(l(387));v.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Ai):e=[Ai])}u=u.return}e!==null&&Uc(t,e,n,i),t.flags|=262144}function _l(e){for(e=e.firstContext;e!==null;){if(!Ht(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ws(e){Fs=e,$a=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ph(Fs,e)}function Sl(e,t){return Fs===null&&Ws(e),ph(e,t)}function ph(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},$a===null){if(e===null)throw Error(l(308));$a=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else $a=$a.next=t;return n}var $0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},H0=s.unstable_scheduleCallback,V0=s.unstable_NormalPriority,nt={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lc(){return{controller:new $0,data:new Map,refCount:0}}function ai(e){e.refCount--,e.refCount===0&&H0(V0,function(){e.controller.abort()})}var si=null,Bc=0,Yn=0,Jn=null;function I0(e,t){if(si===null){var n=si=[];Bc=0,Yn=Hu(),Jn={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Bc++,t.then(gh,gh),t}function gh(){if(--Bc===0&&si!==null){Jn!==null&&(Jn.status="fulfilled");var e=si;si=null,Yn=0,Jn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function G0(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(u){n.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<n.length;u++)(0,n[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<n.length;u++)(0,n[u])(void 0)}),i}var yh=C.S;C.S=function(e,t){ep=gt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&I0(e,t),yh!==null&&yh(e,t)};var en=A(null);function qc(){var e=en.current;return e!==null?e:Ie.pooledCache}function jl(e,t){t===null?X(en,en.current):X(en,t.pool)}function vh(){var e=qc();return e===null?null:{parent:nt._currentValue,pool:e}}var Xn=Error(l(460)),$c=Error(l(474)),Nl=Error(l(542)),El={then:function(){}};function bh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xh(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ua,Ua),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_h(e),e;default:if(typeof t.status=="string")t.then(Ua,Ua);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,_h(e),e}throw an=t,Xn}}function tn(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(an=n,Xn):n}}var an=null;function wh(){if(an===null)throw Error(l(459));var e=an;return an=null,e}function _h(e){if(e===Xn||e===Nl)throw Error(l(483))}var Qn=null,ni=0;function Tl(e){var t=ni;return ni+=1,Qn===null&&(Qn=[]),xh(Qn,e,t)}function ri(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Al(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 Sh(e){function t(k,T){if(e){var M=k.deletions;M===null?(k.deletions=[T],k.flags|=16):M.push(T)}}function n(k,T){if(!e)return null;for(;T!==null;)t(k,T),T=T.sibling;return null}function i(k){for(var T=new Map;k!==null;)k.key!==null?T.set(k.key,k):T.set(k.index,k),k=k.sibling;return T}function u(k,T){return k=Ba(k,T),k.index=0,k.sibling=null,k}function f(k,T,M){return k.index=M,e?(M=k.alternate,M!==null?(M=M.index,M<T?(k.flags|=67108866,T):M):(k.flags|=67108866,T)):(k.flags|=1048576,T)}function v(k){return e&&k.alternate===null&&(k.flags|=67108866),k}function b(k,T,M,H){return T===null||T.tag!==6?(T=Ac(M,k.mode,H),T.return=k,T):(T=u(T,M),T.return=k,T)}function N(k,T,M,H){var oe=M.type;return oe===j?$(k,T,M.props.children,H,M.key):T!==null&&(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===Q&&tn(oe)===T.type)?(T=u(T,M.props),ri(T,M),T.return=k,T):(T=xl(M.type,M.key,M.props,null,k.mode,H),ri(T,M),T.return=k,T)}function z(k,T,M,H){return T===null||T.tag!==4||T.stateNode.containerInfo!==M.containerInfo||T.stateNode.implementation!==M.implementation?(T=Cc(M,k.mode,H),T.return=k,T):(T=u(T,M.children||[]),T.return=k,T)}function $(k,T,M,H,oe){return T===null||T.tag!==7?(T=Qs(M,k.mode,H,oe),T.return=k,T):(T=u(T,M),T.return=k,T)}function I(k,T,M){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=Ac(""+T,k.mode,M),T.return=k,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case S:return M=xl(T.type,T.key,T.props,null,k.mode,M),ri(M,T),M.return=k,M;case E:return T=Cc(T,k.mode,M),T.return=k,T;case Q:return T=tn(T),I(k,T,M)}if(qe(T)||pe(T))return T=Qs(T,k.mode,M,null),T.return=k,T;if(typeof T.then=="function")return I(k,Tl(T),M);if(T.$$typeof===B)return I(k,Sl(k,T),M);Al(k,T)}return null}function U(k,T,M,H){var oe=T!==null?T.key:null;if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return oe!==null?null:b(k,T,""+M,H);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case S:return M.key===oe?N(k,T,M,H):null;case E:return M.key===oe?z(k,T,M,H):null;case Q:return M=tn(M),U(k,T,M,H)}if(qe(M)||pe(M))return oe!==null?null:$(k,T,M,H,null);if(typeof M.then=="function")return U(k,T,Tl(M),H);if(M.$$typeof===B)return U(k,T,Sl(k,M),H);Al(k,M)}return null}function L(k,T,M,H,oe){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return k=k.get(M)||null,b(T,k,""+H,oe);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return k=k.get(H.key===null?M:H.key)||null,N(T,k,H,oe);case E:return k=k.get(H.key===null?M:H.key)||null,z(T,k,H,oe);case Q:return H=tn(H),L(k,T,M,H,oe)}if(qe(H)||pe(H))return k=k.get(M)||null,$(T,k,H,oe,null);if(typeof H.then=="function")return L(k,T,M,Tl(H),oe);if(H.$$typeof===B)return L(k,T,M,Sl(T,H),oe);Al(T,H)}return null}function ae(k,T,M,H){for(var oe=null,Re=null,ie=T,xe=T=0,Ae=null;ie!==null&&xe<M.length;xe++){ie.index>xe?(Ae=ie,ie=null):Ae=ie.sibling;var De=U(k,ie,M[xe],H);if(De===null){ie===null&&(ie=Ae);break}e&&ie&&De.alternate===null&&t(k,ie),T=f(De,T,xe),Re===null?oe=De:Re.sibling=De,Re=De,ie=Ae}if(xe===M.length)return n(k,ie),ke&&qa(k,xe),oe;if(ie===null){for(;xe<M.length;xe++)ie=I(k,M[xe],H),ie!==null&&(T=f(ie,T,xe),Re===null?oe=ie:Re.sibling=ie,Re=ie);return ke&&qa(k,xe),oe}for(ie=i(ie);xe<M.length;xe++)Ae=L(ie,k,xe,M[xe],H),Ae!==null&&(e&&Ae.alternate!==null&&ie.delete(Ae.key===null?xe:Ae.key),T=f(Ae,T,xe),Re===null?oe=Ae:Re.sibling=Ae,Re=Ae);return e&&ie.forEach(function(Os){return t(k,Os)}),ke&&qa(k,xe),oe}function fe(k,T,M,H){if(M==null)throw Error(l(151));for(var oe=null,Re=null,ie=T,xe=T=0,Ae=null,De=M.next();ie!==null&&!De.done;xe++,De=M.next()){ie.index>xe?(Ae=ie,ie=null):Ae=ie.sibling;var Os=U(k,ie,De.value,H);if(Os===null){ie===null&&(ie=Ae);break}e&&ie&&Os.alternate===null&&t(k,ie),T=f(Os,T,xe),Re===null?oe=Os:Re.sibling=Os,Re=Os,ie=Ae}if(De.done)return n(k,ie),ke&&qa(k,xe),oe;if(ie===null){for(;!De.done;xe++,De=M.next())De=I(k,De.value,H),De!==null&&(T=f(De,T,xe),Re===null?oe=De:Re.sibling=De,Re=De);return ke&&qa(k,xe),oe}for(ie=i(ie);!De.done;xe++,De=M.next())De=L(ie,k,xe,De.value,H),De!==null&&(e&&De.alternate!==null&&ie.delete(De.key===null?xe:De.key),T=f(De,T,xe),Re===null?oe=De:Re.sibling=De,Re=De);return e&&ie.forEach(function(tx){return t(k,tx)}),ke&&qa(k,xe),oe}function Ve(k,T,M,H){if(typeof M=="object"&&M!==null&&M.type===j&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case S:e:{for(var oe=M.key;T!==null;){if(T.key===oe){if(oe=M.type,oe===j){if(T.tag===7){n(k,T.sibling),H=u(T,M.props.children),H.return=k,k=H;break e}}else if(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===Q&&tn(oe)===T.type){n(k,T.sibling),H=u(T,M.props),ri(H,M),H.return=k,k=H;break e}n(k,T);break}else t(k,T);T=T.sibling}M.type===j?(H=Qs(M.props.children,k.mode,H,M.key),H.return=k,k=H):(H=xl(M.type,M.key,M.props,null,k.mode,H),ri(H,M),H.return=k,k=H)}return v(k);case E:e:{for(oe=M.key;T!==null;){if(T.key===oe)if(T.tag===4&&T.stateNode.containerInfo===M.containerInfo&&T.stateNode.implementation===M.implementation){n(k,T.sibling),H=u(T,M.children||[]),H.return=k,k=H;break e}else{n(k,T);break}else t(k,T);T=T.sibling}H=Cc(M,k.mode,H),H.return=k,k=H}return v(k);case Q:return M=tn(M),Ve(k,T,M,H)}if(qe(M))return ae(k,T,M,H);if(pe(M)){if(oe=pe(M),typeof oe!="function")throw Error(l(150));return M=oe.call(M),fe(k,T,M,H)}if(typeof M.then=="function")return Ve(k,T,Tl(M),H);if(M.$$typeof===B)return Ve(k,T,Sl(k,M),H);Al(k,M)}return typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint"?(M=""+M,T!==null&&T.tag===6?(n(k,T.sibling),H=u(T,M),H.return=k,k=H):(n(k,T),H=Ac(M,k.mode,H),H.return=k,k=H),v(k)):n(k,T)}return function(k,T,M,H){try{ni=0;var oe=Ve(k,T,M,H);return Qn=null,oe}catch(ie){if(ie===Xn||ie===Nl)throw ie;var Re=Vt(29,ie,null,k.mode);return Re.lanes=H,Re.return=k,Re}}}var sn=Sh(!0),jh=Sh(!1),ms=!1;function Hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vc(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 ps(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function gs(e,t,n){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=bl(e),lh(e,null,n),t}return vl(e,i,t,n),bl(e)}function ii(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ee(e,n)}}function Ic(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var u=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var v={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};f===null?u=f=v:f=f.next=v,n=n.next}while(n!==null);f===null?u=f=t:f=f.next=t}else u=f=t;n={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Gc=!1;function li(){if(Gc){var e=Jn;if(e!==null)throw e}}function oi(e,t,n,i){Gc=!1;var u=e.updateQueue;ms=!1;var f=u.firstBaseUpdate,v=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var N=b,z=N.next;N.next=null,v===null?f=z:v.next=z,v=N;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==v&&(b===null?$.firstBaseUpdate=z:b.next=z,$.lastBaseUpdate=N))}if(f!==null){var I=u.baseState;v=0,$=z=N=null,b=f;do{var U=b.lane&-536870913,L=U!==b.lane;if(L?(Te&U)===U:(i&U)===U){U!==0&&U===Yn&&(Gc=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ae=e,fe=b;U=t;var Ve=n;switch(fe.tag){case 1:if(ae=fe.payload,typeof ae=="function"){I=ae.call(Ve,I,U);break e}I=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=fe.payload,U=typeof ae=="function"?ae.call(Ve,I,U):ae,U==null)break e;I=w({},I,U);break e;case 2:ms=!0}}U=b.callback,U!==null&&(e.flags|=64,L&&(e.flags|=8192),L=u.callbacks,L===null?u.callbacks=[U]:L.push(U))}else L={lane:U,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(z=$=L,N=I):$=$.next=L,v|=U;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;L=b,b=L.next,L.next=null,u.lastBaseUpdate=L,u.shared.pending=null}}while(!0);$===null&&(N=I),u.baseState=N,u.firstBaseUpdate=z,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),ws|=v,e.lanes=v,e.memoizedState=I}}function Nh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Eh(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Nh(n[e],t)}var Zn=A(null),Cl=A(0);function Th(e,t){e=Qa,X(Cl,e),X(Zn,t),Qa=e|t.baseLanes}function Pc(){X(Cl,Qa),X(Zn,Zn.current)}function Kc(){Qa=Cl.current,V(Zn),V(Cl)}var It=A(null),na=null;function ys(e){var t=e.alternate;X(tt,tt.current&1),X(It,e),na===null&&(t===null||Zn.current!==null||t.memoizedState!==null)&&(na=e)}function Yc(e){X(tt,tt.current),X(It,e),na===null&&(na=e)}function Ah(e){e.tag===22?(X(tt,tt.current),X(It,e),na===null&&(na=e)):vs()}function vs(){X(tt,tt.current),X(It,It.current)}function Gt(e){V(It),na===e&&(na=null),V(tt)}var tt=A(0);function kl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Wu(n)||ed(n)))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 Va=0,be=null,$e=null,rt=null,Ol=!1,Fn=!1,nn=!1,Rl=0,ci=0,Wn=null,P0=0;function Fe(){throw Error(l(321))}function Jc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ht(e[n],t[n]))return!1;return!0}function Xc(e,t,n,i,u,f){return Va=f,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,C.H=e===null||e.memoizedState===null?dm:uu,nn=!1,f=n(i,u),nn=!1,Fn&&(f=kh(t,n,i,u)),Ch(e),f}function Ch(e){C.H=fi;var t=$e!==null&&$e.next!==null;if(Va=0,rt=$e=be=null,Ol=!1,ci=0,Wn=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&_l(e)&&(it=!0))}function kh(e,t,n,i){be=e;var u=0;do{if(Fn&&(Wn=null),ci=0,Fn=!1,25<=u)throw Error(l(301));if(u+=1,rt=$e=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}C.H=fm,f=t(n,i)}while(Fn);return f}function K0(){var e=C.H,t=e.useState()[0];return t=typeof t.then=="function"?ui(t):t,e=e.useState()[0],($e!==null?$e.memoizedState:null)!==e&&(be.flags|=1024),t}function Qc(){var e=Rl!==0;return Rl=0,e}function Zc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Fc(e){if(Ol){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ol=!1}Va=0,rt=$e=be=null,Fn=!1,ci=Rl=0,Wn=null}function Rt(){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($e===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=$e.next;var t=rt===null?be.memoizedState:rt.next;if(t!==null)rt=t,$e=e;else{if(e===null)throw be.alternate===null?Error(l(467)):Error(l(310));$e=e,e={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},rt===null?be.memoizedState=rt=e:rt=rt.next=e}return rt}function Dl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ui(e){var t=ci;return ci+=1,Wn===null&&(Wn=[]),e=xh(Wn,e,t),t=be,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,C.H=t===null||t.memoizedState===null?dm:uu),e}function Ml(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ui(e);if(e.$$typeof===B)return St(e)}throw Error(l(438,String(e)))}function Wc(e){var t=null,n=be.updateQueue;if(n!==null&&(t=n.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}),n===null&&(n=Dl(),be.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=Je;return t.index++,n}function Ia(e,t){return typeof t=="function"?t(e):t}function zl(e){var t=at();return eu(t,$e,e)}function eu(e,t,n){var i=e.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=n;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var v=u.next;u.next=f.next,f.next=v}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var b=v=null,N=null,z=t,$=!1;do{var I=z.lane&-536870913;if(I!==z.lane?(Te&I)===I:(Va&I)===I){var U=z.revertLane;if(U===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),I===Yn&&($=!0);else if((Va&U)===U){z=z.next,U===Yn&&($=!0);continue}else I={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(b=N=I,v=f):N=N.next=I,be.lanes|=U,ws|=U;I=z.action,nn&&n(f,I),f=z.hasEagerState?z.eagerState:n(f,I)}else U={lane:I,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(b=N=U,v=f):N=N.next=U,be.lanes|=I,ws|=I;z=z.next}while(z!==null&&z!==t);if(N===null?v=f:N.next=b,!Ht(f,e.memoizedState)&&(it=!0,$&&(n=Jn,n!==null)))throw n;e.memoizedState=f,e.baseState=v,e.baseQueue=N,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function tu(e){var t=at(),n=t.queue;if(n===null)throw Error(l(311));n.lastRenderedReducer=e;var i=n.dispatch,u=n.pending,f=t.memoizedState;if(u!==null){n.pending=null;var v=u=u.next;do f=e(f,v.action),v=v.next;while(v!==u);Ht(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,i]}function Oh(e,t,n){var i=be,u=at(),f=ke;if(f){if(n===void 0)throw Error(l(407));n=n()}else n=t();var v=!Ht(($e||u).memoizedState,n);if(v&&(u.memoizedState=n,it=!0),u=u.queue,nu(Mh.bind(null,i,u,e),[e]),u.getSnapshot!==t||v||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,er(9,{destroy:void 0},Dh.bind(null,i,u,n,t),null),Ie===null)throw Error(l(349));f||(Va&127)!==0||Rh(i,t,n)}return n}function Rh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t=Dl(),be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Dh(e,t,n,i){t.value=n,t.getSnapshot=i,zh(t)&&Uh(e)}function Mh(e,t,n){return n(function(){zh(t)&&Uh(e)})}function zh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ht(e,n)}catch{return!0}}function Uh(e){var t=Xs(e,2);t!==null&&qt(t,e,2)}function au(e){var t=Rt();if(typeof e=="function"){var n=e;if(e=n(),nn){va(!0);try{n()}finally{va(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:e},t}function Lh(e,t,n,i){return e.baseState=n,eu(e,$e,typeof i=="function"?i:Ia)}function Y0(e,t,n,i,u){if(Bl(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(v){f.listeners.push(v)}};C.T!==null?n(!0):f.isTransition=!1,i(f),n=t.pending,n===null?(f.next=t.pending=f,Bh(t,f)):(f.next=n.next,t.pending=n.next=f)}}function Bh(e,t){var n=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=C.T,v={};C.T=v;try{var b=n(u,i),N=C.S;N!==null&&N(v,b),qh(e,t,b)}catch(z){su(e,t,z)}finally{f!==null&&v.types!==null&&(f.types=v.types),C.T=f}}else try{f=n(u,i),qh(e,t,f)}catch(z){su(e,t,z)}}function qh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){$h(e,t,i)},function(i){return su(e,t,i)}):$h(e,t,n)}function $h(e,t,n){t.status="fulfilled",t.value=n,Hh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Bh(e,n)))}function su(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,Hh(t),t=t.next;while(t!==i)}e.action=null}function Hh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Vh(e,t){return t}function Ih(e,t){if(ke){var n=Ie.formState;if(n!==null){e:{var i=be;if(ke){if(Ke){t:{for(var u=Ke,f=sa;u.nodeType!==8;){if(!f){u=null;break t}if(u=ra(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ke=ra(u.nextSibling),i=u.data==="F!";break e}}fs(i)}i=!1}i&&(t=n[0])}}return n=Rt(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vh,lastRenderedState:t},n.queue=i,n=om.bind(null,be,i),i.dispatch=n,i=au(!1),f=cu.bind(null,be,!1,i.queue),i=Rt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=Y0.bind(null,be,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function Gh(e){var t=at();return Ph(t,$e,e)}function Ph(e,t,n){if(t=eu(e,t,Vh)[0],e=zl(Ia)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=ui(t)}catch(v){throw v===Xn?Nl:v}else i=t;t=at();var u=t.queue,f=u.dispatch;return n!==t.memoizedState&&(be.flags|=2048,er(9,{destroy:void 0},J0.bind(null,u,n),null)),[i,f,e]}function J0(e,t){e.action=t}function Kh(e){var t=at(),n=$e;if(n!==null)return Ph(t,n,e);at(),t=t.memoizedState,n=at();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function er(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=be.updateQueue,t===null&&(t=Dl(),be.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Yh(){return at().memoizedState}function Ul(e,t,n,i){var u=Rt();be.flags|=e,u.memoizedState=er(1|t,{destroy:void 0},n,i===void 0?null:i)}function Ll(e,t,n,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;$e!==null&&i!==null&&Jc(i,$e.memoizedState.deps)?u.memoizedState=er(t,f,n,i):(be.flags|=e,u.memoizedState=er(1|t,f,n,i))}function Jh(e,t){Ul(8390656,8,e,t)}function nu(e,t){Ll(2048,8,e,t)}function X0(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=Dl(),be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Xh(e){var t=at().memoizedState;return X0({ref:t,nextImpl:e}),function(){if((Me&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Qh(e,t){return Ll(4,2,e,t)}function Zh(e,t){return Ll(4,4,e,t)}function Fh(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Wh(e,t,n){n=n!=null?n.concat([e]):null,Ll(4,4,Fh.bind(null,t,e),n)}function ru(){}function em(e,t){var n=at();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&Jc(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function tm(e,t){var n=at();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Jc(t,i[1]))return i[0];if(i=e(),nn){va(!0);try{e()}finally{va(!1)}}return n.memoizedState=[i,t],i}function iu(e,t,n){return n===void 0||(Va&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=ap(),be.lanes|=e,ws|=e,n)}function am(e,t,n,i){return Ht(n,t)?n:Zn.current!==null?(e=iu(e,n,i),Ht(e,t)||(it=!0),e):(Va&42)===0||(Va&1073741824)!==0&&(Te&261930)===0?(it=!0,e.memoizedState=n):(e=ap(),be.lanes|=e,ws|=e,t)}function sm(e,t,n,i,u){var f=Y.p;Y.p=f!==0&&8>f?f:8;var v=C.T,b={};C.T=b,cu(e,!1,t,n);try{var N=u(),z=C.S;if(z!==null&&z(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var $=G0(N,i);di(e,t,$,Yt(e))}else di(e,t,i,Yt(e))}catch(I){di(e,t,{then:function(){},status:"rejected",reason:I},Yt())}finally{Y.p=f,v!==null&&b.types!==null&&(v.types=b.types),C.T=v}}function Q0(){}function lu(e,t,n,i){if(e.tag!==5)throw Error(l(476));var u=nm(e).queue;sm(e,u,t,K,n===null?Q0:function(){return rm(e),n(i)})}function nm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:K},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function rm(e){var t=nm(e);t.next===null&&(t=e.alternate.memoizedState),di(e,t.next.queue,{},Yt())}function ou(){return St(Ai)}function im(){return at().memoizedState}function lm(){return at().memoizedState}function Z0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Yt();e=ps(n);var i=gs(t,e,n);i!==null&&(qt(i,t,n),ii(i,t,n)),t={cache:Lc()},e.payload=t;return}t=t.return}}function F0(e,t,n){var i=Yt();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Bl(e)?cm(t,n):(n=Ec(e,t,n,i),n!==null&&(qt(n,e,i),um(n,t,i)))}function om(e,t,n){var i=Yt();di(e,t,n,i)}function di(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bl(e))cm(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var v=t.lastRenderedState,b=f(v,n);if(u.hasEagerState=!0,u.eagerState=b,Ht(b,v))return vl(e,t,u,0),Ie===null&&yl(),!1}catch{}if(n=Ec(e,t,u,i),n!==null)return qt(n,e,i),um(n,t,i),!0}return!1}function cu(e,t,n,i){if(i={lane:2,revertLane:Hu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Bl(e)){if(t)throw Error(l(479))}else t=Ec(e,n,i,2),t!==null&&qt(t,e,2)}function Bl(e){var t=e.alternate;return e===be||t!==null&&t===be}function cm(e,t){Fn=Ol=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function um(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ee(e,n)}}var fi={readContext:St,use:Ml,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};fi.useEffectEvent=Fe;var dm={readContext:St,use:Ml,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Jh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ul(4194308,4,Fh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ul(4194308,4,e,t)},useInsertionEffect:function(e,t){Ul(4,2,e,t)},useMemo:function(e,t){var n=Rt();t=t===void 0?null:t;var i=e();if(nn){va(!0);try{e()}finally{va(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=Rt();if(n!==void 0){var u=n(t);if(nn){va(!0);try{n(t)}finally{va(!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=F0.bind(null,be,e),[i.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=au(e);var t=e.queue,n=om.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ru,useDeferredValue:function(e,t){var n=Rt();return iu(n,e,t)},useTransition:function(){var e=au(!1);return e=sm.bind(null,be,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=be,u=Rt();if(ke){if(n===void 0)throw Error(l(407));n=n()}else{if(n=t(),Ie===null)throw Error(l(349));(Te&127)!==0||Rh(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,Jh(Mh.bind(null,i,f,e),[e]),i.flags|=2048,er(9,{destroy:void 0},Dh.bind(null,i,f,n,t),null),n},useId:function(){var e=Rt(),t=Ie.identifierPrefix;if(ke){var n=wa,i=xa;n=(i&~(1<<32-Ot(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Rl++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=P0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ou,useFormState:Ih,useActionState:Ih,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=cu.bind(null,be,!0,n),n.dispatch=t,[e,t]},useMemoCache:Wc,useCacheRefresh:function(){return Rt().memoizedState=Z0.bind(null,be)},useEffectEvent:function(e){var t=Rt(),n={impl:e};return t.memoizedState=n,function(){if((Me&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}},uu={readContext:St,use:Ml,useCallback:em,useContext:St,useEffect:nu,useImperativeHandle:Wh,useInsertionEffect:Qh,useLayoutEffect:Zh,useMemo:tm,useReducer:zl,useRef:Yh,useState:function(){return zl(Ia)},useDebugValue:ru,useDeferredValue:function(e,t){var n=at();return am(n,$e.memoizedState,e,t)},useTransition:function(){var e=zl(Ia)[0],t=at().memoizedState;return[typeof e=="boolean"?e:ui(e),t]},useSyncExternalStore:Oh,useId:im,useHostTransitionStatus:ou,useFormState:Gh,useActionState:Gh,useOptimistic:function(e,t){var n=at();return Lh(n,$e,e,t)},useMemoCache:Wc,useCacheRefresh:lm};uu.useEffectEvent=Xh;var fm={readContext:St,use:Ml,useCallback:em,useContext:St,useEffect:nu,useImperativeHandle:Wh,useInsertionEffect:Qh,useLayoutEffect:Zh,useMemo:tm,useReducer:tu,useRef:Yh,useState:function(){return tu(Ia)},useDebugValue:ru,useDeferredValue:function(e,t){var n=at();return $e===null?iu(n,e,t):am(n,$e.memoizedState,e,t)},useTransition:function(){var e=tu(Ia)[0],t=at().memoizedState;return[typeof e=="boolean"?e:ui(e),t]},useSyncExternalStore:Oh,useId:im,useHostTransitionStatus:ou,useFormState:Kh,useActionState:Kh,useOptimistic:function(e,t){var n=at();return $e!==null?Lh(n,$e,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Wc,useCacheRefresh:lm};fm.useEffectEvent=Xh;function du(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var fu={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=ps(i);u.payload=t,n!=null&&(u.callback=n),t=gs(e,u,i),t!==null&&(qt(t,e,i),ii(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=ps(i);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=gs(e,u,i),t!==null&&(qt(t,e,i),ii(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Yt(),i=ps(n);i.tag=2,t!=null&&(i.callback=t),t=gs(e,i,n),t!==null&&(qt(t,e,n),ii(t,e,n))}};function hm(e,t,n,i,u,f,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,v):t.prototype&&t.prototype.isPureReactComponent?!Fr(n,i)||!Fr(u,f):!0}function mm(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&fu.enqueueReplaceState(t,t.state,null)}function rn(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=w({},n));for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n}function pm(e){gl(e)}function gm(e){console.error(e)}function ym(e){gl(e)}function ql(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function vm(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function hu(e,t,n){return n=ps(n),n.tag=3,n.payload={element:null},n.callback=function(){ql(e,t)},n}function bm(e){return e=ps(e),e.tag=3,e}function xm(e,t,n,i){var u=n.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){vm(t,n,i)}}var v=n.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){vm(t,n,i),typeof u!="function"&&(_s===null?_s=new Set([this]):_s.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function W0(e,t,n,i,u){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&Kn(t,n,u,!0),n=It.current,n!==null){switch(n.tag){case 31:case 13:return na===null?Zl():n.alternate===null&&We===0&&(We=3),n.flags&=-257,n.flags|=65536,n.lanes=u,i===El?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),Bu(e,i,u)),!1;case 22:return n.flags|=65536,i===El?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),Bu(e,i,u)),!1}throw Error(l(435,n.tag))}return Bu(e,i,u),Zl(),!1}if(ke)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Rc&&(e=Error(l(422),{cause:i}),ti(ea(e,n)))):(i!==Rc&&(t=Error(l(423),{cause:i}),ti(ea(t,n))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=ea(i,n),u=hu(e.stateNode,i,u),Ic(e,u),We!==4&&(We=2)),!1;var f=Error(l(520),{cause:i});if(f=ea(f,n),xi===null?xi=[f]:xi.push(f),We!==4&&(We=2),t===null)return!0;i=ea(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=u&-u,n.lanes|=e,e=hu(n.stateNode,i,e),Ic(n,e),!1;case 1:if(t=n.type,f=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(_s===null||!_s.has(f))))return n.flags|=65536,u&=-u,n.lanes|=u,u=bm(u),xm(u,e,n,i),Ic(n,u),!1}n=n.return}while(n!==null);return!1}var mu=Error(l(461)),it=!1;function jt(e,t,n,i){t.child=e===null?jh(t,null,n,i):sn(t,e.child,n,i)}function wm(e,t,n,i,u){n=n.render;var f=t.ref;if("ref"in i){var v={};for(var b in i)b!=="ref"&&(v[b]=i[b])}else v=i;return Ws(t),i=Xc(e,t,n,v,f,u),b=Qc(),e!==null&&!it?(Zc(e,t,u),Ga(e,t,u)):(ke&&b&&kc(t),t.flags|=1,jt(e,t,i,u),t.child)}function _m(e,t,n,i,u){if(e===null){var f=n.type;return typeof f=="function"&&!Tc(f)&&f.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=f,Sm(e,t,f,i,u)):(e=xl(n.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!_u(e,u)){var v=f.memoizedProps;if(n=n.compare,n=n!==null?n:Fr,n(v,i)&&e.ref===t.ref)return Ga(e,t,u)}return t.flags|=1,e=Ba(f,i),e.ref=t.ref,e.return=t,t.child=e}function Sm(e,t,n,i,u){if(e!==null){var f=e.memoizedProps;if(Fr(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,_u(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Ga(e,t,u)}return pu(e,t,n,i,u)}function jm(e,t,n,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|n:n,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 Nm(e,t,f,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&jl(t,f!==null?f.cachePool:null),f!==null?Th(t,f):Pc(),Ah(t);else return i=t.lanes=536870912,Nm(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(jl(t,f.cachePool),Th(t,f),vs(),t.memoizedState=null):(e!==null&&jl(t,null),Pc(),vs());return jt(e,t,u,n),t.child}function hi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Nm(e,t,n,i,u){var f=qc();return f=f===null?null:{parent:nt._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&jl(t,null),Pc(),Ah(t),e!==null&&Kn(e,t,i,!0),t.childLanes=u,null}function $l(e,t){return t=Vl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Em(e,t,n){return sn(t,e.child,null,n),e=$l(t,t.pendingProps),e.flags|=2,Gt(t),t.memoizedState=null,e}function eb(e,t,n){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(i.mode==="hidden")return e=$l(t,i),t.lanes=536870912,hi(null,e);if(Yc(t),(e=Ke)?(e=Bp(e,sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:us!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=ch(e),n.return=t,t.child=n,_t=t,Ke=null)):e=null,e===null)throw fs(t);return t.lanes=536870912,null}return $l(t,i)}var f=e.memoizedState;if(f!==null){var v=f.dehydrated;if(Yc(t),u)if(t.flags&256)t.flags&=-257,t=Em(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(it||Kn(e,t,n,!1),u=(n&e.childLanes)!==0,it||u){if(i=Ie,i!==null&&(v=Ce(i,n),v!==0&&v!==f.retryLane))throw f.retryLane=v,Xs(e,v),qt(i,e,v),mu;Zl(),t=Em(e,t,n)}else e=f.treeContext,Ke=ra(v.nextSibling),_t=t,ke=!0,ds=null,sa=!1,e!==null&&fh(t,e),t=$l(t,i),t.flags|=4096;return t}return e=Ba(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Hl(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(l(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function pu(e,t,n,i,u){return Ws(t),n=Xc(e,t,n,i,void 0,u),i=Qc(),e!==null&&!it?(Zc(e,t,u),Ga(e,t,u)):(ke&&i&&kc(t),t.flags|=1,jt(e,t,n,u),t.child)}function Tm(e,t,n,i,u,f){return Ws(t),t.updateQueue=null,n=kh(t,i,n,u),Ch(e),i=Qc(),e!==null&&!it?(Zc(e,t,f),Ga(e,t,f)):(ke&&i&&kc(t),t.flags|=1,jt(e,t,n,f),t.child)}function Am(e,t,n,i,u){if(Ws(t),t.stateNode===null){var f=Vn,v=n.contextType;typeof v=="object"&&v!==null&&(f=St(v)),f=new n(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=fu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Hc(t),v=n.contextType,f.context=typeof v=="object"&&v!==null?St(v):Vn,f.state=t.memoizedState,v=n.getDerivedStateFromProps,typeof v=="function"&&(du(t,n,v,i),f.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(v=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),v!==f.state&&fu.enqueueReplaceState(f,f.state,null),oi(t,i,f,u),li(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var b=t.memoizedProps,N=rn(n,b);f.props=N;var z=f.context,$=n.contextType;v=Vn,typeof $=="object"&&$!==null&&(v=St($));var I=n.getDerivedStateFromProps;$=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||z!==v)&&mm(t,f,i,v),ms=!1;var U=t.memoizedState;f.state=U,oi(t,i,f,u),li(),z=t.memoizedState,b||U!==z||ms?(typeof I=="function"&&(du(t,n,I,i),z=t.memoizedState),(N=ms||hm(t,n,N,i,U,z,v))?($||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=z),f.props=i,f.state=z,f.context=v,i=N):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Vc(e,t),v=t.memoizedProps,$=rn(n,v),f.props=$,I=t.pendingProps,U=f.context,z=n.contextType,N=Vn,typeof z=="object"&&z!==null&&(N=St(z)),b=n.getDerivedStateFromProps,(z=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(v!==I||U!==N)&&mm(t,f,i,N),ms=!1,U=t.memoizedState,f.state=U,oi(t,i,f,u),li();var L=t.memoizedState;v!==I||U!==L||ms||e!==null&&e.dependencies!==null&&_l(e.dependencies)?(typeof b=="function"&&(du(t,n,b,i),L=t.memoizedState),($=ms||hm(t,n,$,i,U,L,N)||e!==null&&e.dependencies!==null&&_l(e.dependencies))?(z||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,L,N),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,L,N)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=L),f.props=i,f.state=L,f.context=N,i=$):(typeof f.componentDidUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Hl(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=sn(t,e.child,null,u),t.child=sn(t,null,n,u)):jt(e,t,n,u),t.memoizedState=f.state,e=t.child):e=Ga(e,t,u),e}function Cm(e,t,n,i){return Zs(),t.flags|=256,jt(e,t,n,i),t.child}var gu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yu(e){return{baseLanes:e,cachePool:vh()}}function vu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Kt),e}function km(e,t,n){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,v;if((v=f)||(v=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),v&&(u=!0,t.flags&=-129),v=(t.flags&32)!==0,t.flags&=-33,e===null){if(ke){if(u?ys(t):vs(),(e=Ke)?(e=Bp(e,sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:us!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=ch(e),n.return=t,t.child=n,_t=t,Ke=null)):e=null,e===null)throw fs(t);return ed(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(vs(),u=t.mode,b=Vl({mode:"hidden",children:b},u),i=Qs(i,u,n,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=yu(n),i.childLanes=vu(e,v,n),t.memoizedState=gu,hi(null,i)):(ys(t),bu(t,b))}var N=e.memoizedState;if(N!==null&&(b=N.dehydrated,b!==null)){if(f)t.flags&256?(ys(t),t.flags&=-257,t=xu(e,t,n)):t.memoizedState!==null?(vs(),t.child=e.child,t.flags|=128,t=null):(vs(),b=i.fallback,u=t.mode,i=Vl({mode:"visible",children:i.children},u),b=Qs(b,u,n,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,sn(t,e.child,null,n),i=t.child,i.memoizedState=yu(n),i.childLanes=vu(e,v,n),t.memoizedState=gu,t=hi(null,i));else if(ys(t),ed(b)){if(v=b.nextSibling&&b.nextSibling.dataset,v)var z=v.dgst;v=z,i=Error(l(419)),i.stack="",i.digest=v,ti({value:i,source:null,stack:null}),t=xu(e,t,n)}else if(it||Kn(e,t,n,!1),v=(n&e.childLanes)!==0,it||v){if(v=Ie,v!==null&&(i=Ce(v,n),i!==0&&i!==N.retryLane))throw N.retryLane=i,Xs(e,i),qt(v,e,i),mu;Wu(b)||Zl(),t=xu(e,t,n)}else Wu(b)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Ke=ra(b.nextSibling),_t=t,ke=!0,ds=null,sa=!1,e!==null&&fh(t,e),t=bu(t,i.children),t.flags|=4096);return t}return u?(vs(),b=i.fallback,u=t.mode,N=e.child,z=N.sibling,i=Ba(N,{mode:"hidden",children:i.children}),i.subtreeFlags=N.subtreeFlags&65011712,z!==null?b=Ba(z,b):(b=Qs(b,u,n,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,hi(null,i),i=t.child,b=e.child.memoizedState,b===null?b=yu(n):(u=b.cachePool,u!==null?(N=nt._currentValue,u=u.parent!==N?{parent:N,pool:N}:u):u=vh(),b={baseLanes:b.baseLanes|n,cachePool:u}),i.memoizedState=b,i.childLanes=vu(e,v,n),t.memoizedState=gu,hi(e.child,i)):(ys(t),n=e.child,e=n.sibling,n=Ba(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(v=t.deletions,v===null?(t.deletions=[e],t.flags|=16):v.push(e)),t.child=n,t.memoizedState=null,n)}function bu(e,t){return t=Vl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Vl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function xu(e,t,n){return sn(t,e.child,null,n),e=bu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Om(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),zc(e.return,t,n)}function wu(e,t,n,i,u,f){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:u,treeForkCount:f}:(v.isBackwards=t,v.rendering=null,v.renderingStartTime=0,v.last=i,v.tail=n,v.tailMode=u,v.treeForkCount=f)}function Rm(e,t,n){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var v=tt.current,b=(v&2)!==0;if(b?(v=v&1|2,t.flags|=128):v&=1,X(tt,v),jt(e,t,i,n),i=ke?ei:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Om(e,n,t);else if(e.tag===19)Om(e,n,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(n=t.child,u=null;n!==null;)e=n.alternate,e!==null&&kl(e)===null&&(u=n),n=n.sibling;n=u,n===null?(u=t.child,t.child=null):(u=n.sibling,n.sibling=null),wu(t,!1,u,n,f,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&kl(e)===null){t.child=u;break}e=u.sibling,u.sibling=n,n=u,u=e}wu(t,!0,n,null,f,i);break;case"together":wu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Ga(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ws|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Kn(e,t,n,!1),(n&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,n=Ba(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ba(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function _u(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&_l(e)))}function tb(e,t,n){switch(t.tag){case 3:Ge(t,t.stateNode.containerInfo),hs(t,nt,e.memoizedState.cache),Zs();break;case 27:case 5:Ct(t);break;case 4:Ge(t,t.stateNode.containerInfo);break;case 10:hs(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Yc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(ys(t),t.flags|=128,null):(n&t.child.childLanes)!==0?km(e,t,n):(ys(t),e=Ga(e,t,n),e!==null?e.sibling:null);ys(t);break;case 19:var u=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(Kn(e,t,n,!1),i=(n&t.childLanes)!==0),u){if(i)return Rm(e,t,n);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,jm(e,t,n,t.pendingProps);case 24:hs(t,nt,e.memoizedState.cache)}return Ga(e,t,n)}function Dm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!_u(e,n)&&(t.flags&128)===0)return it=!1,tb(e,t,n);it=(e.flags&131072)!==0}else it=!1,ke&&(t.flags&1048576)!==0&&dh(t,ei,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=tn(t.elementType),t.type=e,typeof e=="function")Tc(e)?(i=rn(e,i),t.tag=1,t=Am(null,t,e,i,n)):(t.tag=0,t=pu(null,t,e,i,n));else{if(e!=null){var u=e.$$typeof;if(u===G){t.tag=11,t=wm(null,t,e,i,n);break e}else if(u===P){t.tag=14,t=_m(null,t,e,i,n);break e}}throw t=st(e)||e,Error(l(306,t,""))}}return t;case 0:return pu(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,u=rn(i,t.pendingProps),Am(e,t,i,u,n);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,Vc(e,t),oi(t,i,null,n);var v=t.memoizedState;if(i=v.cache,hs(t,nt,i),i!==f.cache&&Uc(t,[nt],n,!0),li(),i=v.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:v.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Cm(e,t,i,n);break e}else if(i!==u){u=ea(Error(l(424)),t),ti(u),t=Cm(e,t,i,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ke=ra(e.firstChild),_t=t,ke=!0,ds=null,sa=!0,n=jh(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zs(),i===u){t=Ga(e,t,n);break e}jt(e,t,i,n)}t=t.child}return t;case 26:return Hl(e,t),e===null?(n=Gp(t.type,null,t.pendingProps,null))?t.memoizedState=n:ke||(n=t.type,e=t.pendingProps,i=no(ge.current).createElement(n),i[ut]=t,i[Dt]=e,Nt(i,n,e),vt(i),t.stateNode=i):t.memoizedState=Gp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ct(t),e===null&&ke&&(i=t.stateNode=Hp(t.type,t.pendingProps,ge.current),_t=t,sa=!0,u=Ke,Es(t.type)?(td=u,Ke=ra(i.firstChild)):Ke=u),jt(e,t,t.pendingProps.children,n),Hl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ke&&((u=i=Ke)&&(i=Ob(i,t.type,t.pendingProps,sa),i!==null?(t.stateNode=i,_t=t,Ke=ra(i.firstChild),sa=!1,u=!0):u=!1),u||fs(t)),Ct(t),u=t.type,f=t.pendingProps,v=e!==null?e.memoizedProps:null,i=f.children,Qu(u,f)?i=null:v!==null&&Qu(u,v)&&(t.flags|=32),t.memoizedState!==null&&(u=Xc(e,t,K0,null,null,n),Ai._currentValue=u),Hl(e,t),jt(e,t,i,n),t.child;case 6:return e===null&&ke&&((e=n=Ke)&&(n=Rb(n,t.pendingProps,sa),n!==null?(t.stateNode=n,_t=t,Ke=null,e=!0):e=!1),e||fs(t)),null;case 13:return km(e,t,n);case 4:return Ge(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=sn(t,null,i,n):jt(e,t,i,n),t.child;case 11:return wm(e,t,t.type,t.pendingProps,n);case 7:return jt(e,t,t.pendingProps,n),t.child;case 8:return jt(e,t,t.pendingProps.children,n),t.child;case 12:return jt(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,hs(t,t.type,i.value),jt(e,t,i.children,n),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Ws(t),u=St(u),i=i(u),t.flags|=1,jt(e,t,i,n),t.child;case 14:return _m(e,t,t.type,t.pendingProps,n);case 15:return Sm(e,t,t.type,t.pendingProps,n);case 19:return Rm(e,t,n);case 31:return eb(e,t,n);case 22:return jm(e,t,n,t.pendingProps);case 24:return Ws(t),i=St(nt),e===null?(u=qc(),u===null&&(u=Ie,f=Lc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},Hc(t),hs(t,nt,u)):((e.lanes&n)!==0&&(Vc(e,t),oi(t,null,null,n),li()),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),hs(t,nt,i)):(i=f.cache,hs(t,nt,i),i!==u.cache&&Uc(t,[nt],n,!0))),jt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Pa(e){e.flags|=4}function Su(e,t,n,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(ip())e.flags|=8192;else throw an=El,$c}else e.flags&=-16777217}function Mm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xp(t))if(ip())e.flags|=8192;else throw an=El,$c}function Il(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?rl():536870912,e.lanes|=t,nr|=t)}function mi(e,t){if(!ke)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var u=e.child;u!==null;)n|=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;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function ab(e,t,n){var i=t.pendingProps;switch(Oc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return Ye(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Ha(nt),Ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pn(t)?Pa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Dc())),Ye(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Pa(t),f!==null?(Ye(t),Mm(t,f)):(Ye(t),Su(t,u,null,i,n))):f?f!==e.memoizedState?(Pa(t),Ye(t),Mm(t,f)):(Ye(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Pa(t),Ye(t),Su(t,u,e,i,n)),null;case 27:if(pt(t),n=ge.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Pa(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}e=F.current,Pn(t)?hh(t):(e=Hp(u,i,n),t.stateNode=e,Pa(t))}return Ye(t),null;case 5:if(pt(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Pa(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}if(f=F.current,Pn(t))hh(t);else{var v=no(ge.current);switch(f){case 1:f=v.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=v.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=v.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?v.createElement("select",{is:i.is}):v.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?v.createElement(u,{is:i.is}):v.createElement(u)}}f[ut]=t,f[Dt]=i;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)f.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=f;e:switch(Nt(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&&Pa(t)}}return Ye(t),Su(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Pa(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(l(166));if(e=ge.current,Pn(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=_t,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||kp(e.nodeValue,n)),e||fs(t,!0)}else e=no(e).createTextNode(i),e[ut]=t,t.stateNode=e}return Ye(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Pn(t),n!==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[ut]=t}else Zs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),e=!1}else n=Dc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Gt(t),t):(Gt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ye(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Pn(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[ut]=t}else Zs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),u=!1}else u=Dc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Gt(t),t):(Gt(t),null)}return Gt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(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)),n!==e&&n&&(t.child.flags|=8192),Il(t,t.updateQueue),Ye(t),null);case 4:return Ue(),e===null&&Pu(t.stateNode.containerInfo),Ye(t),null;case 10:return Ha(t.type),Ye(t),null;case 19:if(V(tt),i=t.memoizedState,i===null)return Ye(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)mi(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=kl(e),f!==null){for(t.flags|=128,mi(i,!1),e=f.updateQueue,t.updateQueue=e,Il(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oh(n,e),n=n.sibling;return X(tt,tt.current&1|2),ke&&qa(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&>()>Jl&&(t.flags|=128,u=!0,mi(i,!1),t.lanes=4194304)}else{if(!u)if(e=kl(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Il(t,e),mi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!ke)return Ye(t),null}else 2*gt()-i.renderingStartTime>Jl&&n!==536870912&&(t.flags|=128,u=!0,mi(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=gt(),e.sibling=null,n=tt.current,X(tt,u?n&1|2:n&1),ke&&qa(t,i.treeForkCount),e):(Ye(t),null);case 22:case 23:return Gt(t),Kc(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),n=t.updateQueue,n!==null&&Il(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&V(en),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ha(nt),Ye(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function sb(e,t){switch(Oc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ha(nt),Ue(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(Gt(t),t.alternate===null)throw Error(l(340));Zs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Gt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Zs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(tt),null;case 4:return Ue(),null;case 10:return Ha(t.type),null;case 22:case 23:return Gt(t),Kc(),e!==null&&V(en),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ha(nt),null;case 25:return null;default:return null}}function zm(e,t){switch(Oc(t),t.tag){case 3:Ha(nt),Ue();break;case 26:case 27:case 5:pt(t);break;case 4:Ue();break;case 31:t.memoizedState!==null&&Gt(t);break;case 13:Gt(t);break;case 19:V(tt);break;case 10:Ha(t.type);break;case 22:case 23:Gt(t),Kc(),e!==null&&V(en);break;case 24:Ha(nt)}}function pi(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var u=i.next;n=u;do{if((n.tag&e)===e){i=void 0;var f=n.create,v=n.inst;i=f(),v.destroy=i}n=n.next}while(n!==u)}}catch(b){Be(t,t.return,b)}}function bs(e,t,n){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 v=i.inst,b=v.destroy;if(b!==void 0){v.destroy=void 0,u=t;var N=n,z=b;try{z()}catch($){Be(u,N,$)}}}i=i.next}while(i!==f)}}catch($){Be(t,t.return,$)}}function Um(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Eh(t,n)}catch(i){Be(e,e.return,i)}}}function Lm(e,t,n){n.props=rn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){Be(e,t,i)}}function gi(e,t){try{var n=e.ref;if(n!==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 n=="function"?e.refCleanup=n(i):n.current=i}}catch(u){Be(e,t,u)}}function _a(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(u){Be(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(u){Be(e,t,u)}else n.current=null}function Bm(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(u){Be(e,e.return,u)}}function ju(e,t,n){try{var i=e.stateNode;Nb(i,e.type,n,t),i[Dt]=t}catch(u){Be(e,e.return,u)}}function qm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Es(e.type)||e.tag===4}function Nu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qm(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&&Es(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 Eu(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ua));else if(i!==4&&(i===27&&Es(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Eu(e,t,n),e=e.sibling;e!==null;)Eu(e,t,n),e=e.sibling}function Gl(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&Es(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Gl(e,t,n),e=e.sibling;e!==null;)Gl(e,t,n),e=e.sibling}function $m(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Nt(t,i,n),t[ut]=e,t[Dt]=n}catch(f){Be(e,e.return,f)}}var Ka=!1,lt=!1,Tu=!1,Hm=typeof WeakSet=="function"?WeakSet:Set,bt=null;function nb(e,t){if(e=e.containerInfo,Ju=fo,e=Wf(e),xc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var v=0,b=-1,N=-1,z=0,$=0,I=e,U=null;t:for(;;){for(var L;I!==n||u!==0&&I.nodeType!==3||(b=v+u),I!==f||i!==0&&I.nodeType!==3||(N=v+i),I.nodeType===3&&(v+=I.nodeValue.length),(L=I.firstChild)!==null;)U=I,I=L;for(;;){if(I===e)break t;if(U===n&&++z===u&&(b=v),U===f&&++$===i&&(N=v),(L=I.nextSibling)!==null)break;I=U,U=I.parentNode}I=L}n=b===-1||N===-1?null:{start:b,end:N}}else n=null}n=n||{start:0,end:0}}else n=null;for(Xu={focusedElem:e,selectionRange:n},fo=!1,bt=t;bt!==null;)if(t=bt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bt=e;else for(;bt!==null;){switch(t=bt,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(n=0;n<e.length;n++)u=e[n],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,n=t,u=f.memoizedProps,f=f.memoizedState,i=n.stateNode;try{var ae=rn(n.type,u);e=i.getSnapshotBeforeUpdate(ae,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(fe){Be(n,n.return,fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Fu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(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,bt=e;break}bt=t.return}}function Vm(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Ja(e,n),i&4&&pi(5,n);break;case 1:if(Ja(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(v){Be(n,n.return,v)}else{var u=rn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(v){Be(n,n.return,v)}}i&64&&Um(n),i&512&&gi(n,n.return);break;case 3:if(Ja(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Eh(e,t)}catch(v){Be(n,n.return,v)}}break;case 27:t===null&&i&4&&$m(n);case 26:case 5:Ja(e,n),t===null&&i&4&&Bm(n),i&512&&gi(n,n.return);break;case 12:Ja(e,n);break;case 31:Ja(e,n),i&4&&Pm(e,n);break;case 13:Ja(e,n),i&4&&Km(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hb.bind(null,n),Db(e,n))));break;case 22:if(i=n.memoizedState!==null||Ka,!i){t=t!==null&&t.memoizedState!==null||lt,u=Ka;var f=lt;Ka=i,(lt=t)&&!f?Xa(e,n,(n.subtreeFlags&8772)!==0):Ja(e,n),Ka=u,lt=f}break;case 30:break;default:Ja(e,n)}}function Im(e){var t=e.alternate;t!==null&&(e.alternate=null,Im(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&sc(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,zt=!1;function Ya(e,t,n){for(n=n.child;n!==null;)Gm(e,t,n),n=n.sibling}function Gm(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount($s,n)}catch{}switch(n.tag){case 26:lt||_a(n,t),Ya(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lt||_a(n,t);var i=Xe,u=zt;Es(n.type)&&(Xe=n.stateNode,zt=!1),Ya(e,t,n),Ni(n.stateNode),Xe=i,zt=u;break;case 5:lt||_a(n,t);case 6:if(i=Xe,u=zt,Xe=null,Ya(e,t,n),Xe=i,zt=u,Xe!==null)if(zt)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(n.stateNode)}catch(f){Be(n,t,f)}else try{Xe.removeChild(n.stateNode)}catch(f){Be(n,t,f)}break;case 18:Xe!==null&&(zt?(e=Xe,Up(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),fr(e)):Up(Xe,n.stateNode));break;case 4:i=Xe,u=zt,Xe=n.stateNode.containerInfo,zt=!0,Ya(e,t,n),Xe=i,zt=u;break;case 0:case 11:case 14:case 15:bs(2,n,t),lt||bs(4,n,t),Ya(e,t,n);break;case 1:lt||(_a(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&Lm(n,t,i)),Ya(e,t,n);break;case 21:Ya(e,t,n);break;case 22:lt=(i=lt)||n.memoizedState!==null,Ya(e,t,n),lt=i;break;default:Ya(e,t,n)}}function Pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{fr(e)}catch(n){Be(t,t.return,n)}}}function Km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{fr(e)}catch(n){Be(t,t.return,n)}}function rb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Hm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Hm),t;default:throw Error(l(435,e.tag))}}function Pl(e,t){var n=rb(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=mb.bind(null,e,i);i.then(u,u)}})}function Ut(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var u=n[i],f=e,v=t,b=v;e:for(;b!==null;){switch(b.tag){case 27:if(Es(b.type)){Xe=b.stateNode,zt=!1;break e}break;case 5:Xe=b.stateNode,zt=!1;break e;case 3:case 4:Xe=b.stateNode.containerInfo,zt=!0;break e}b=b.return}if(Xe===null)throw Error(l(160));Gm(f,v,u),Xe=null,zt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ym(t,e),t=t.sibling}var ca=null;function Ym(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Lt(e),i&4&&(bs(3,e,e.return),pi(3,e),bs(5,e,e.return));break;case 1:Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),i&64&&Ka&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var u=ca;if(Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),i&4){var f=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Ir]||f[ut]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),Nt(f,i,n),f[ut]=e,vt(f),i=f;break e;case"link":var v=Yp("link","href",u).get(i+(n.href||""));if(v){for(var b=0;b<v.length;b++)if(f=v[b],f.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&f.getAttribute("rel")===(n.rel==null?null:n.rel)&&f.getAttribute("title")===(n.title==null?null:n.title)&&f.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){v.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;case"meta":if(v=Yp("meta","content",u).get(i+(n.content||""))){for(b=0;b<v.length;b++)if(f=v[b],f.getAttribute("content")===(n.content==null?null:""+n.content)&&f.getAttribute("name")===(n.name==null?null:n.name)&&f.getAttribute("property")===(n.property==null?null:n.property)&&f.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&f.getAttribute("charset")===(n.charSet==null?null:n.charSet)){v.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[ut]=e,vt(f),i=f}e.stateNode=i}else Jp(u,e.type,e.stateNode);else e.stateNode=Kp(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?Jp(u,e.type,e.stateNode):Kp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&ju(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),n!==null&&i&4&&ju(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),e.flags&32){u=e.stateNode;try{zn(u,"")}catch(ae){Be(e,e.return,ae)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,ju(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Tu=!0);break;case 6:if(Ut(t,e),Lt(e),i&4){if(e.stateNode===null)throw Error(l(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(ae){Be(e,e.return,ae)}}break;case 3:if(lo=null,u=ca,ca=ro(t.containerInfo),Ut(t,e),ca=u,Lt(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{fr(t.containerInfo)}catch(ae){Be(e,e.return,ae)}Tu&&(Tu=!1,Jm(e));break;case 4:i=ca,ca=ro(e.stateNode.containerInfo),Ut(t,e),Lt(e),ca=i;break;case 12:Ut(t,e),Lt(e);break;case 31:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Pl(e,i)));break;case 13:Ut(t,e),Lt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Yl=gt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Pl(e,i)));break;case 22:u=e.memoizedState!==null;var N=n!==null&&n.memoizedState!==null,z=Ka,$=lt;if(Ka=z||u,lt=$||N,Ut(t,e),lt=$,Ka=z,Lt(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||N||Ka||lt||ln(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){N=n=t;try{if(f=N.stateNode,u)v=f.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{b=N.stateNode;var I=N.memoizedProps.style,U=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(ae){Be(N,N.return,ae)}}}else if(t.tag===6){if(n===null){N=t;try{N.stateNode.nodeValue=u?"":N.memoizedProps}catch(ae){Be(N,N.return,ae)}}}else if(t.tag===18){if(n===null){N=t;try{var L=N.stateNode;u?Lp(L,!0):Lp(N.stateNode,!1)}catch(ae){Be(N,N.return,ae)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Pl(e,n))));break;case 19:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Pl(e,i)));break;case 30:break;case 21:break;default:Ut(t,e),Lt(e)}}function Lt(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(qm(i)){n=i;break}i=i.return}if(n==null)throw Error(l(160));switch(n.tag){case 27:var u=n.stateNode,f=Nu(e);Gl(e,f,u);break;case 5:var v=n.stateNode;n.flags&32&&(zn(v,""),n.flags&=-33);var b=Nu(e);Gl(e,b,v);break;case 3:case 4:var N=n.stateNode.containerInfo,z=Nu(e);Eu(e,z,N);break;default:throw Error(l(161))}}catch($){Be(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Jm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Jm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ja(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Vm(e,t.alternate,t),t=t.sibling}function ln(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:bs(4,t,t.return),ln(t);break;case 1:_a(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Lm(t,t.return,n),ln(t);break;case 27:Ni(t.stateNode);case 26:case 5:_a(t,t.return),ln(t);break;case 22:t.memoizedState===null&&ln(t);break;case 30:ln(t);break;default:ln(t)}e=e.sibling}}function Xa(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,v=f.flags;switch(f.tag){case 0:case 11:case 15:Xa(u,f,n),pi(4,f);break;case 1:if(Xa(u,f,n),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(z){Be(i,i.return,z)}if(i=f,u=i.updateQueue,u!==null){var b=i.stateNode;try{var N=u.shared.hiddenCallbacks;if(N!==null)for(u.shared.hiddenCallbacks=null,u=0;u<N.length;u++)Nh(N[u],b)}catch(z){Be(i,i.return,z)}}n&&v&64&&Um(f),gi(f,f.return);break;case 27:$m(f);case 26:case 5:Xa(u,f,n),n&&i===null&&v&4&&Bm(f),gi(f,f.return);break;case 12:Xa(u,f,n);break;case 31:Xa(u,f,n),n&&v&4&&Pm(u,f);break;case 13:Xa(u,f,n),n&&v&4&&Km(u,f);break;case 22:f.memoizedState===null&&Xa(u,f,n),gi(f,f.return);break;case 30:break;default:Xa(u,f,n)}t=t.sibling}}function Au(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ai(n))}function Cu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ai(e))}function ua(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xm(e,t,n,i),t=t.sibling}function Xm(e,t,n,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ua(e,t,n,i),u&2048&&pi(9,t);break;case 1:ua(e,t,n,i);break;case 3:ua(e,t,n,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ai(e)));break;case 12:if(u&2048){ua(e,t,n,i),e=t.stateNode;try{var f=t.memoizedProps,v=f.id,b=f.onPostCommit;typeof b=="function"&&b(v,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Be(t,t.return,N)}}else ua(e,t,n,i);break;case 31:ua(e,t,n,i);break;case 13:ua(e,t,n,i);break;case 23:break;case 22:f=t.stateNode,v=t.alternate,t.memoizedState!==null?f._visibility&2?ua(e,t,n,i):yi(e,t):f._visibility&2?ua(e,t,n,i):(f._visibility|=2,tr(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Au(v,t);break;case 24:ua(e,t,n,i),u&2048&&Cu(t.alternate,t);break;default:ua(e,t,n,i)}}function tr(e,t,n,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,v=t,b=n,N=i,z=v.flags;switch(v.tag){case 0:case 11:case 15:tr(f,v,b,N,u),pi(8,v);break;case 23:break;case 22:var $=v.stateNode;v.memoizedState!==null?$._visibility&2?tr(f,v,b,N,u):yi(f,v):($._visibility|=2,tr(f,v,b,N,u)),u&&z&2048&&Au(v.alternate,v);break;case 24:tr(f,v,b,N,u),u&&z&2048&&Cu(v.alternate,v);break;default:tr(f,v,b,N,u)}t=t.sibling}}function yi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,u=i.flags;switch(i.tag){case 22:yi(n,i),u&2048&&Au(i.alternate,i);break;case 24:yi(n,i),u&2048&&Cu(i.alternate,i);break;default:yi(n,i)}t=t.sibling}}var vi=8192;function ar(e,t,n){if(e.subtreeFlags&vi)for(e=e.child;e!==null;)Qm(e,t,n),e=e.sibling}function Qm(e,t,n){switch(e.tag){case 26:ar(e,t,n),e.flags&vi&&e.memoizedState!==null&&Pb(n,ca,e.memoizedState,e.memoizedProps);break;case 5:ar(e,t,n);break;case 3:case 4:var i=ca;ca=ro(e.stateNode.containerInfo),ar(e,t,n),ca=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=vi,vi=16777216,ar(e,t,n),vi=i):ar(e,t,n));break;default:ar(e,t,n)}}function Zm(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 bi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,Wm(i,e)}Zm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:bi(e),e.flags&2048&&bs(9,e,e.return);break;case 3:bi(e);break;case 12:bi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kl(e)):bi(e);break;default:bi(e)}}function Kl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,Wm(i,e)}Zm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:bs(8,t,t.return),Kl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Kl(t));break;default:Kl(t)}e=e.sibling}}function Wm(e,t){for(;bt!==null;){var n=bt;switch(n.tag){case 0:case 11:case 15:bs(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:ai(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,bt=i;else e:for(n=e;bt!==null;){i=bt;var u=i.sibling,f=i.return;if(Im(i),i===n){bt=null;break e}if(u!==null){u.return=f,bt=u;break e}bt=f}}}var ib={getCacheForType:function(e){var t=St(nt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return St(nt).controller.signal}},lb=typeof WeakMap=="function"?WeakMap:Map,Me=0,Ie=null,Ne=null,Te=0,Le=0,Pt=null,xs=!1,sr=!1,ku=!1,Qa=0,We=0,ws=0,on=0,Ou=0,Kt=0,nr=0,xi=null,Bt=null,Ru=!1,Yl=0,ep=0,Jl=1/0,Xl=null,_s=null,dt=0,Ss=null,rr=null,Za=0,Du=0,Mu=null,tp=null,wi=0,zu=null;function Yt(){return(Me&2)!==0&&Te!==0?Te&-Te:C.T!==null?Hu():Is()}function ap(){if(Kt===0)if((Te&536870912)===0||ke){var e=En;En<<=1,(En&3932160)===0&&(En=262144),Kt=e}else Kt=536870912;return e=It.current,e!==null&&(e.flags|=32),Kt}function qt(e,t,n){(e===Ie&&(Le===2||Le===9)||e.cancelPendingCommit!==null)&&(ir(e,0),js(e,Te,Kt,!1)),Hs(e,n),((Me&2)===0||e!==Ie)&&(e===Ie&&((Me&2)===0&&(on|=n),We===4&&js(e,Te,Kt,!1)),Sa(e))}function sp(e,t,n){if((Me&6)!==0)throw Error(l(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||os(e,t),u=i?ub(e,t):Lu(e,t,!0),f=i;do{if(u===0){sr&&!i&&js(e,t,0,!1);break}else{if(n=e.current.alternate,f&&!ob(n)){u=Lu(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){t=v;e:{var b=e;u=xi;var N=b.current.memoizedState.isDehydrated;if(N&&(ir(b,v).flags|=256),v=Lu(b,v,!1),v!==2){if(ku&&!N){b.errorRecoveryDisabledLanes|=f,on|=f,u=4;break e}f=Bt,Bt=u,f!==null&&(Bt===null?Bt=f:Bt.push.apply(Bt,f))}u=v}if(f=!1,u!==2)continue}}if(u===1){ir(e,0),js(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:js(i,t,Kt,!xs);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Yl+300-gt(),10<u)){if(js(i,t,Kt,!xs),An(i,0,!0)!==0)break e;Za=t,i.timeoutHandle=Mp(np.bind(null,i,n,Bt,Xl,Ru,t,Kt,on,nr,xs,f,"Throttled",-0,0),u);break e}np(i,n,Bt,Xl,Ru,t,Kt,on,nr,xs,f,null,-0,0)}}break}while(!0);Sa(e)}function np(e,t,n,i,u,f,v,b,N,z,$,I,U,L){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ua},Qm(t,f,I);var ae=(f&62914560)===f?Yl-gt():(f&4194048)===f?ep-gt():0;if(ae=Kb(I,ae),ae!==null){Za=f,e.cancelPendingCommit=ae(fp.bind(null,e,t,f,n,i,u,v,b,N,$,I,null,U,L)),js(e,f,v,!z);return}}fp(e,t,f,n,i,u,v,b,N)}function ob(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var u=n[i],f=u.getSnapshot;u=u.value;try{if(!Ht(f(),u))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 js(e,t,n,i){t&=~Ou,t&=~on,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Ot(u),v=1<<f;i[f]=-1,u&=~v}n!==0&&R(e,n,t)}function Ql(){return(Me&6)===0?(_i(0),!1):!0}function Uu(){if(Ne!==null){if(Le===0)var e=Ne.return;else e=Ne,$a=Fs=null,Fc(e),Qn=null,ni=0,e=Ne;for(;e!==null;)zm(e.alternate,e),e=e.return;Ne=null}}function ir(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Ab(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Za=0,Uu(),Ie=e,Ne=n=Ba(e.current,null),Te=t,Le=0,Pt=null,xs=!1,sr=os(e,t),ku=!1,nr=Kt=Ou=on=ws=We=0,Bt=xi=null,Ru=!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-Ot(i),f=1<<u;t|=e[u],i&=~f}return Qa=t,yl(),n}function rp(e,t){be=null,C.H=fi,t===Xn||t===Nl?(t=wh(),Le=3):t===$c?(t=wh(),Le=4):Le=t===mu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pt=t,Ne===null&&(We=1,ql(e,ea(t,e.current)))}function ip(){var e=It.current;return e===null?!0:(Te&4194048)===Te?na===null:(Te&62914560)===Te||(Te&536870912)!==0?e===na:!1}function lp(){var e=C.H;return C.H=fi,e===null?fi:e}function op(){var e=C.A;return C.A=ib,e}function Zl(){We=4,xs||(Te&4194048)!==Te&&It.current!==null||(sr=!0),(ws&134217727)===0&&(on&134217727)===0||Ie===null||js(Ie,Te,Kt,!1)}function Lu(e,t,n){var i=Me;Me|=2;var u=lp(),f=op();(Ie!==e||Te!==t)&&(Xl=null,ir(e,t)),t=!1;var v=We;e:do try{if(Le!==0&&Ne!==null){var b=Ne,N=Pt;switch(Le){case 8:Uu(),v=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var z=Le;if(Le=0,Pt=null,lr(e,b,N,z),n&&sr){v=0;break e}break;default:z=Le,Le=0,Pt=null,lr(e,b,N,z)}}cb(),v=We;break}catch($){rp(e,$)}while(!0);return t&&e.shellSuspendCounter++,$a=Fs=null,Me=i,C.H=u,C.A=f,Ne===null&&(Ie=null,Te=0,yl()),v}function cb(){for(;Ne!==null;)cp(Ne)}function ub(e,t){var n=Me;Me|=2;var i=lp(),u=op();Ie!==e||Te!==t?(Xl=null,Jl=gt()+500,ir(e,t)):sr=os(e,t);e:do try{if(Le!==0&&Ne!==null){t=Ne;var f=Pt;t:switch(Le){case 1:Le=0,Pt=null,lr(e,t,f,1);break;case 2:case 9:if(bh(f)){Le=0,Pt=null,up(t);break}t=function(){Le!==2&&Le!==9||Ie!==e||(Le=7),Sa(e)},f.then(t,t);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:bh(f)?(Le=0,Pt=null,up(t)):(Le=0,Pt=null,lr(e,t,f,7));break;case 5:var v=null;switch(Ne.tag){case 26:v=Ne.memoizedState;case 5:case 27:var b=Ne;if(v?Xp(v):b.stateNode.complete){Le=0,Pt=null;var N=b.sibling;if(N!==null)Ne=N;else{var z=b.return;z!==null?(Ne=z,Fl(z)):Ne=null}break t}}Le=0,Pt=null,lr(e,t,f,5);break;case 6:Le=0,Pt=null,lr(e,t,f,6);break;case 8:Uu(),We=6;break e;default:throw Error(l(462))}}db();break}catch($){rp(e,$)}while(!0);return $a=Fs=null,C.H=i,C.A=u,Me=n,Ne!==null?0:(Ie=null,Te=0,yl(),We)}function db(){for(;Ne!==null&&!sl();)cp(Ne)}function cp(e){var t=Dm(e.alternate,e,Qa);e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function up(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Tm(n,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Tm(n,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:Fc(t);default:zm(n,t),t=Ne=oh(t,Qa),t=Dm(n,t,Qa)}e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function lr(e,t,n,i){$a=Fs=null,Fc(t),Qn=null,ni=0;var u=t.return;try{if(W0(e,u,t,n,Te)){We=1,ql(e,ea(n,e.current)),Ne=null;return}}catch(f){if(u!==null)throw Ne=u,f;We=1,ql(e,ea(n,e.current)),Ne=null;return}t.flags&32768?(ke||i===1?e=!0:sr||(Te&536870912)!==0?e=!1:(xs=e=!0,(i===2||i===9||i===3||i===6)&&(i=It.current,i!==null&&i.tag===13&&(i.flags|=16384))),dp(t,e)):Fl(t)}function Fl(e){var t=e;do{if((t.flags&32768)!==0){dp(t,xs);return}e=t.return;var n=ab(t.alternate,t,Qa);if(n!==null){Ne=n;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);We===0&&(We=5)}function dp(e,t){do{var n=sb(e.alternate,e);if(n!==null){n.flags&=32767,Ne=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=n}while(e!==null);We=6,Ne=null}function fp(e,t,n,i,u,f,v,b,N){e.cancelPendingCommit=null;do Wl();while(dt!==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|=Nc,tc(e,n,f,v,b,N),e===Ie&&(Ne=Ie=null,Te=0),rr=t,Ss=e,Za=n,Du=f,Mu=u,tp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,pb(Da,function(){return yp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=C.T,C.T=null,u=Y.p,Y.p=2,v=Me,Me|=4;try{nb(e,t,n)}finally{Me=v,Y.p=u,C.T=i}}dt=1,hp(),mp(),pp()}}function hp(){if(dt===1){dt=0;var e=Ss,t=rr,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=C.T,C.T=null;var i=Y.p;Y.p=2;var u=Me;Me|=4;try{Ym(t,e);var f=Xu,v=Wf(e.containerInfo),b=f.focusedElem,N=f.selectionRange;if(v!==b&&b&&b.ownerDocument&&Ff(b.ownerDocument.documentElement,b)){if(N!==null&&xc(b)){var z=N.start,$=N.end;if($===void 0&&($=z),"selectionStart"in b)b.selectionStart=z,b.selectionEnd=Math.min($,b.value.length);else{var I=b.ownerDocument||document,U=I&&I.defaultView||window;if(U.getSelection){var L=U.getSelection(),ae=b.textContent.length,fe=Math.min(N.start,ae),Ve=N.end===void 0?fe:Math.min(N.end,ae);!L.extend&&fe>Ve&&(v=Ve,Ve=fe,fe=v);var k=Zf(b,fe),T=Zf(b,Ve);if(k&&T&&(L.rangeCount!==1||L.anchorNode!==k.node||L.anchorOffset!==k.offset||L.focusNode!==T.node||L.focusOffset!==T.offset)){var M=I.createRange();M.setStart(k.node,k.offset),L.removeAllRanges(),fe>Ve?(L.addRange(M),L.extend(T.node,T.offset)):(M.setEnd(T.node,T.offset),L.addRange(M))}}}}for(I=[],L=b;L=L.parentNode;)L.nodeType===1&&I.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var H=I[b];H.element.scrollLeft=H.left,H.element.scrollTop=H.top}}fo=!!Ju,Xu=Ju=null}finally{Me=u,Y.p=i,C.T=n}}e.current=t,dt=2}}function mp(){if(dt===2){dt=0;var e=Ss,t=rr,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=C.T,C.T=null;var i=Y.p;Y.p=2;var u=Me;Me|=4;try{Vm(e,t.alternate,t)}finally{Me=u,Y.p=i,C.T=n}}dt=3}}function pp(){if(dt===4||dt===3){dt=0,qs();var e=Ss,t=rr,n=Za,i=tp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,rr=Ss=null,gp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(_s=null),Vs(n),t=t.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot($s,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=C.T,u=Y.p,Y.p=2,C.T=null;try{for(var f=e.onRecoverableError,v=0;v<i.length;v++){var b=i[v];f(b.value,{componentStack:b.stack})}}finally{C.T=t,Y.p=u}}(Za&3)!==0&&Wl(),Sa(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===zu?wi++:(wi=0,zu=e):wi=0,_i(0)}}function gp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ai(t)))}function Wl(){return hp(),mp(),pp(),yp()}function yp(){if(dt!==5)return!1;var e=Ss,t=Du;Du=0;var n=Vs(Za),i=C.T,u=Y.p;try{Y.p=32>n?32:n,C.T=null,n=Mu,Mu=null;var f=Ss,v=Za;if(dt=0,rr=Ss=null,Za=0,(Me&6)!==0)throw Error(l(331));var b=Me;if(Me|=4,Fm(f.current),Xm(f,f.current,v,n),Me=b,_i(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot($s,f)}catch{}return!0}finally{Y.p=u,C.T=i,gp(e,t)}}function vp(e,t,n){t=ea(n,t),t=hu(e.stateNode,t,2),e=gs(e,t,2),e!==null&&(Hs(e,2),Sa(e))}function Be(e,t,n){if(e.tag===3)vp(e,e,n);else for(;t!==null;){if(t.tag===3){vp(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(_s===null||!_s.has(i))){e=ea(n,e),n=bm(2),i=gs(t,n,2),i!==null&&(xm(n,i,t,e),Hs(i,2),Sa(i));break}}t=t.return}}function Bu(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new lb;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(n)||(ku=!0,u.add(n),e=fb.bind(null,e,t,n),t.then(e,e))}function fb(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ie===e&&(Te&n)===n&&(We===4||We===3&&(Te&62914560)===Te&&300>gt()-Yl?(Me&2)===0&&ir(e,0):Ou|=n,nr===Te&&(nr=0)),Sa(e)}function bp(e,t){t===0&&(t=rl()),e=Xs(e,t),e!==null&&(Hs(e,t),Sa(e))}function hb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bp(e,n)}function mb(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(n=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),bp(e,n)}function pb(e,t){return _n(e,t)}var eo=null,or=null,qu=!1,to=!1,$u=!1,Ns=0;function Sa(e){e!==or&&e.next===null&&(or===null?eo=or=e:or=or.next=e),to=!0,qu||(qu=!0,yb())}function _i(e,t){if(!$u&&to){$u=!0;do for(var n=!1,i=eo;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var v=i.suspendedLanes,b=i.pingedLanes;f=(1<<31-Ot(42|e)+1)-1,f&=u&~(v&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(n=!0,Sp(i,f))}else f=Te,f=An(i,i===Ie?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||os(i,f)||(n=!0,Sp(i,f));i=i.next}while(n);$u=!1}}function gb(){xp()}function xp(){to=qu=!1;var e=0;Ns!==0&&Tb()&&(e=Ns);for(var t=gt(),n=null,i=eo;i!==null;){var u=i.next,f=wp(i,t);f===0?(i.next=null,n===null?eo=u:n.next=u,u===null&&(or=n)):(n=i,(e!==0||(f&3)!==0)&&(to=!0)),i=u}dt!==0&&dt!==5||_i(e),Ns!==0&&(Ns=0)}function wp(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var v=31-Ot(f),b=1<<v,N=u[v];N===-1?((b&n)===0||(b&i)!==0)&&(u[v]=ec(b,t)):N<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ie,n=Te,n=An(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(Le===2||Le===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&ls(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||os(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&ls(i),Vs(n)){case 2:case 8:n=Hr;break;case 32:n=Da;break;case 268435456:n=ya;break;default:n=Da}return i=_p.bind(null,e),n=_n(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&ls(i),e.callbackPriority=2,e.callbackNode=null,2}function _p(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Wl()&&e.callbackNode!==n)return null;var i=Te;return i=An(e,e===Ie?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(sp(e,i,t),wp(e,gt()),e.callbackNode!=null&&e.callbackNode===n?_p.bind(null,e):null)}function Sp(e,t){if(Wl())return null;sp(e,t,!0)}function yb(){Cb(function(){(Me&6)!==0?_n($r,gb):xp()})}function Hu(){if(Ns===0){var e=Yn;e===0&&(e=Nn,Nn<<=1,(Nn&261888)===0&&(Nn=256)),Ns=e}return Ns}function jp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:cl(""+e)}function Np(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function vb(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=jp((u[Dt]||null).action),v=i.submitter;v&&(t=(t=v[Dt]||null)?jp(t.formAction):v.getAttribute("formAction"),t!==null&&(f=t,v=null));var b=new hl("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ns!==0){var N=v?Np(u,v):new FormData(u);lu(n,{pending:!0,data:N,method:u.method,action:f},null,N)}}else typeof f=="function"&&(b.preventDefault(),N=v?Np(u,v):new FormData(u),lu(n,{pending:!0,data:N,method:u.method,action:f},f,N))},currentTarget:u}]})}}for(var Vu=0;Vu<jc.length;Vu++){var Iu=jc[Vu],bb=Iu.toLowerCase(),xb=Iu[0].toUpperCase()+Iu.slice(1);oa(bb,"on"+xb)}oa(ah,"onAnimationEnd"),oa(sh,"onAnimationIteration"),oa(nh,"onAnimationStart"),oa("dblclick","onDoubleClick"),oa("focusin","onFocus"),oa("focusout","onBlur"),oa(U0,"onTransitionRun"),oa(L0,"onTransitionStart"),oa(B0,"onTransitionCancel"),oa(rh,"onTransitionEnd"),Dn("onMouseEnter",["mouseout","mouseover"]),Dn("onMouseLeave",["mouseout","mouseover"]),Dn("onPointerEnter",["pointerout","pointerover"]),Dn("onPointerLeave",["pointerout","pointerover"]),Ps("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ps("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ps("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ps("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Si="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(" "),wb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Si));function Ep(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var v=i.length-1;0<=v;v--){var b=i[v],N=b.instance,z=b.currentTarget;if(b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=z;try{f(u)}catch($){gl($)}u.currentTarget=null,f=N}else for(v=0;v<i.length;v++){if(b=i[v],N=b.instance,z=b.currentTarget,b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=z;try{f(u)}catch($){gl($)}u.currentTarget=null,f=N}}}}function Ee(e,t){var n=t[ac];n===void 0&&(n=t[ac]=new Set);var i=e+"__bubble";n.has(i)||(Tp(t,e,2,!1),n.add(i))}function Gu(e,t,n){var i=0;t&&(i|=4),Tp(n,e,i,t)}var ao="_reactListening"+Math.random().toString(36).slice(2);function Pu(e){if(!e[ao]){e[ao]=!0,xf.forEach(function(n){n!=="selectionchange"&&(wb.has(n)||Gu(n,!1,e),Gu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ao]||(t[ao]=!0,Gu("selectionchange",!1,t))}}function Tp(e,t,n,i){switch(ag(t)){case 2:var u=Xb;break;case 8:u=Qb;break;default:u=id}n=u.bind(null,t,n,e),u=void 0,!dc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,n,{capture:!0,passive:u}):e.addEventListener(t,n,!0):u!==void 0?e.addEventListener(t,n,{passive:u}):e.addEventListener(t,n,!1)}function Ku(e,t,n,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var v=i.tag;if(v===3||v===4){var b=i.stateNode.containerInfo;if(b===u)break;if(v===4)for(v=i.return;v!==null;){var N=v.tag;if((N===3||N===4)&&v.stateNode.containerInfo===u)return;v=v.return}for(;b!==null;){if(v=kn(b),v===null)return;if(N=v.tag,N===5||N===6||N===26||N===27){i=f=v;continue e}b=b.parentNode}}i=i.return}Rf(function(){var z=f,$=cc(n),I=[];e:{var U=ih.get(e);if(U!==void 0){var L=hl,ae=e;switch(e){case"keypress":if(dl(n)===0)break e;case"keydown":case"keyup":L=m0;break;case"focusin":ae="focus",L=pc;break;case"focusout":ae="blur",L=pc;break;case"beforeblur":case"afterblur":L=pc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=zf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=a0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=y0;break;case ah:case sh:case nh:L=r0;break;case rh:L=b0;break;case"scroll":case"scrollend":L=e0;break;case"wheel":L=w0;break;case"copy":case"cut":case"paste":L=l0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Lf;break;case"toggle":case"beforetoggle":L=S0}var fe=(t&4)!==0,Ve=!fe&&(e==="scroll"||e==="scrollend"),k=fe?U!==null?U+"Capture":null:U;fe=[];for(var T=z,M;T!==null;){var H=T;if(M=H.stateNode,H=H.tag,H!==5&&H!==26&&H!==27||M===null||k===null||(H=Pr(T,k),H!=null&&fe.push(ji(T,H,M))),Ve)break;T=T.return}0<fe.length&&(U=new L(U,ae,null,n,$),I.push({event:U,listeners:fe}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",U&&n!==oc&&(ae=n.relatedTarget||n.fromElement)&&(kn(ae)||ae[Cn]))break e;if((L||U)&&(U=$.window===$?$:(U=$.ownerDocument)?U.defaultView||U.parentWindow:window,L?(ae=n.relatedTarget||n.toElement,L=z,ae=ae?kn(ae):null,ae!==null&&(Ve=d(ae),fe=ae.tag,ae!==Ve||fe!==5&&fe!==27&&fe!==6)&&(ae=null)):(L=null,ae=z),L!==ae)){if(fe=zf,H="onMouseLeave",k="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(fe=Lf,H="onPointerLeave",k="onPointerEnter",T="pointer"),Ve=L==null?U:Gr(L),M=ae==null?U:Gr(ae),U=new fe(H,T+"leave",L,n,$),U.target=Ve,U.relatedTarget=M,H=null,kn($)===z&&(fe=new fe(k,T+"enter",ae,n,$),fe.target=M,fe.relatedTarget=Ve,H=fe),Ve=H,L&&ae)t:{for(fe=_b,k=L,T=ae,M=0,H=k;H;H=fe(H))M++;H=0;for(var oe=T;oe;oe=fe(oe))H++;for(;0<M-H;)k=fe(k),M--;for(;0<H-M;)T=fe(T),H--;for(;M--;){if(k===T||T!==null&&k===T.alternate){fe=k;break t}k=fe(k),T=fe(T)}fe=null}else fe=null;L!==null&&Ap(I,U,L,fe,!1),ae!==null&&Ve!==null&&Ap(I,Ve,ae,fe,!0)}}e:{if(U=z?Gr(z):window,L=U.nodeName&&U.nodeName.toLowerCase(),L==="select"||L==="input"&&U.type==="file")var Re=Pf;else if(If(U))if(Kf)Re=D0;else{Re=O0;var ie=k0}else L=U.nodeName,!L||L.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?z&&lc(z.elementType)&&(Re=Pf):Re=R0;if(Re&&(Re=Re(e,z))){Gf(I,Re,n,$);break e}ie&&ie(e,U,z),e==="focusout"&&z&&U.type==="number"&&z.memoizedProps.value!=null&&ic(U,"number",U.value)}switch(ie=z?Gr(z):window,e){case"focusin":(If(ie)||ie.contentEditable==="true")&&(qn=ie,wc=z,Wr=null);break;case"focusout":Wr=wc=qn=null;break;case"mousedown":_c=!0;break;case"contextmenu":case"mouseup":case"dragend":_c=!1,eh(I,n,$);break;case"selectionchange":if(z0)break;case"keydown":case"keyup":eh(I,n,$)}var xe;if(yc)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else Bn?Hf(e,n)&&(Ae="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ae="onCompositionStart");Ae&&(Bf&&n.locale!=="ko"&&(Bn||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&Bn&&(xe=Df()):(cs=$,fc="value"in cs?cs.value:cs.textContent,Bn=!0)),ie=so(z,Ae),0<ie.length&&(Ae=new Uf(Ae,e,null,n,$),I.push({event:Ae,listeners:ie}),xe?Ae.data=xe:(xe=Vf(n),xe!==null&&(Ae.data=xe)))),(xe=N0?E0(e,n):T0(e,n))&&(Ae=so(z,"onBeforeInput"),0<Ae.length&&(ie=new Uf("onBeforeInput","beforeinput",null,n,$),I.push({event:ie,listeners:Ae}),ie.data=xe)),vb(I,e,z,n,$)}Ep(I,t)})}function ji(e,t,n){return{instance:e,listener:t,currentTarget:n}}function so(e,t){for(var n=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Pr(e,n),u!=null&&i.unshift(ji(e,u,f)),u=Pr(e,t),u!=null&&i.push(ji(e,u,f))),e.tag===3)return i;e=e.return}return[]}function _b(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ap(e,t,n,i,u){for(var f=t._reactName,v=[];n!==null&&n!==i;){var b=n,N=b.alternate,z=b.stateNode;if(b=b.tag,N!==null&&N===i)break;b!==5&&b!==26&&b!==27||z===null||(N=z,u?(z=Pr(n,f),z!=null&&v.unshift(ji(n,z,N))):u||(z=Pr(n,f),z!=null&&v.push(ji(n,z,N)))),n=n.return}v.length!==0&&e.push({event:t,listeners:v})}var Sb=/\r\n?/g,jb=/\u0000|\uFFFD/g;function Cp(e){return(typeof e=="string"?e:""+e).replace(Sb,`
|
|
9
|
+
`).replace(jb,"")}function kp(e,t){return t=Cp(t),Cp(e)===t}function He(e,t,n,i,u,f){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||zn(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&zn(e,""+i);break;case"className":ll(e,"class",i);break;case"tabIndex":ll(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":ll(e,n,i);break;case"style":kf(e,i,f);break;case"data":if(t!=="object"){ll(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=cl(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(n,"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"&&(n==="formAction"?(t!=="input"&&He(e,t,"name",u.name,u,null),He(e,t,"formEncType",u.formEncType,u,null),He(e,t,"formMethod",u.formMethod,u,null),He(e,t,"formTarget",u.formTarget,u,null)):(He(e,t,"encType",u.encType,u,null),He(e,t,"method",u.method,u,null),He(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=cl(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=Ua);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}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}n=cl(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);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(n,""+i):e.removeAttribute(n);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(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),il(e,"popover",i);break;case"xlinkActuate":za(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":za(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":za(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":za(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":za(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":za(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":za(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":za(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":za(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":il(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Fv.get(n)||n,il(e,n,i))}}function Yu(e,t,n,i,u,f){switch(n){case"style":kf(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}break;case"children":typeof i=="string"?zn(e,i):(typeof i=="number"||typeof i=="bigint")&&zn(e,""+i);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"onClick":i!=null&&(e.onclick=Ua);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wf.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(u=n.endsWith("Capture"),t=n.slice(2,u?n.length-7:void 0),f=e[Dt]||null,f=f!=null?f[n]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,u);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):il(e,n,i)}}}function Nt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var i=!1,u=!1,f;for(f in n)if(n.hasOwnProperty(f)){var v=n[f];if(v!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,f,v,n,null)}}u&&He(e,t,"srcSet",n.srcSet,n,null),i&&He(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var b=f=v=u=null,N=null,z=null;for(i in n)if(n.hasOwnProperty(i)){var $=n[i];if($!=null)switch(i){case"name":u=$;break;case"type":v=$;break;case"checked":N=$;break;case"defaultChecked":z=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(l(137,t));break;default:He(e,t,i,$,n,null)}}Ef(e,f,b,N,z,v,u,!1);return;case"select":Ee("invalid",e),i=v=f=null;for(u in n)if(n.hasOwnProperty(u)&&(b=n[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":v=b;break;case"multiple":i=b;default:He(e,t,u,b,n,null)}t=f,n=v,e.multiple=!!i,t!=null?Mn(e,!!i,t,!1):n!=null&&Mn(e,!!i,n,!0);return;case"textarea":Ee("invalid",e),f=u=i=null;for(v in n)if(n.hasOwnProperty(v)&&(b=n[v],b!=null))switch(v){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:He(e,t,v,b,n,null)}Af(e,i,u,f);return;case"option":for(N in n)n.hasOwnProperty(N)&&(i=n[N],i!=null)&&(N==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":He(e,t,N,i,n,null));return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(i=0;i<Si.length;i++)Ee(Si[i],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("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(z in n)if(n.hasOwnProperty(z)&&(i=n[z],i!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,z,i,n,null)}return;default:if(lc(t)){for($ in n)n.hasOwnProperty($)&&(i=n[$],i!==void 0&&Yu(e,t,$,i,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(i=n[b],i!=null&&He(e,t,b,i,n,null))}function Nb(e,t,n,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,v=null,b=null,N=null,z=null,$=null;for(L in n){var I=n[L];if(n.hasOwnProperty(L)&&I!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":N=I;default:i.hasOwnProperty(L)||He(e,t,L,null,i,I)}}for(var U in i){var L=i[U];if(I=n[U],i.hasOwnProperty(U)&&(L!=null||I!=null))switch(U){case"type":f=L;break;case"name":u=L;break;case"checked":z=L;break;case"defaultChecked":$=L;break;case"value":v=L;break;case"defaultValue":b=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==I&&He(e,t,U,L,i,I)}}rc(e,v,b,N,z,$,f,u);return;case"select":L=v=b=U=null;for(f in n)if(N=n[f],n.hasOwnProperty(f)&&N!=null)switch(f){case"value":break;case"multiple":L=N;default:i.hasOwnProperty(f)||He(e,t,f,null,i,N)}for(u in i)if(f=i[u],N=n[u],i.hasOwnProperty(u)&&(f!=null||N!=null))switch(u){case"value":U=f;break;case"defaultValue":b=f;break;case"multiple":v=f;default:f!==N&&He(e,t,u,f,i,N)}t=b,n=v,i=L,U!=null?Mn(e,!!n,U,!1):!!i!=!!n&&(t!=null?Mn(e,!!n,t,!0):Mn(e,!!n,n?[]:"",!1));return;case"textarea":L=U=null;for(b in n)if(u=n[b],n.hasOwnProperty(b)&&u!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:He(e,t,b,null,i,u)}for(v in i)if(u=i[v],f=n[v],i.hasOwnProperty(v)&&(u!=null||f!=null))switch(v){case"value":U=u;break;case"defaultValue":L=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&He(e,t,v,u,i,f)}Tf(e,U,L);return;case"option":for(var ae in n)U=n[ae],n.hasOwnProperty(ae)&&U!=null&&!i.hasOwnProperty(ae)&&(ae==="selected"?e.selected=!1:He(e,t,ae,null,i,U));for(N in i)U=i[N],L=n[N],i.hasOwnProperty(N)&&U!==L&&(U!=null||L!=null)&&(N==="selected"?e.selected=U&&typeof U!="function"&&typeof U!="symbol":He(e,t,N,U,i,L));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var fe in n)U=n[fe],n.hasOwnProperty(fe)&&U!=null&&!i.hasOwnProperty(fe)&&He(e,t,fe,null,i,U);for(z in i)if(U=i[z],L=n[z],i.hasOwnProperty(z)&&U!==L&&(U!=null||L!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:He(e,t,z,U,i,L)}return;default:if(lc(t)){for(var Ve in n)U=n[Ve],n.hasOwnProperty(Ve)&&U!==void 0&&!i.hasOwnProperty(Ve)&&Yu(e,t,Ve,void 0,i,U);for($ in i)U=i[$],L=n[$],!i.hasOwnProperty($)||U===L||U===void 0&&L===void 0||Yu(e,t,$,U,i,L);return}}for(var k in n)U=n[k],n.hasOwnProperty(k)&&U!=null&&!i.hasOwnProperty(k)&&He(e,t,k,null,i,U);for(I in i)U=i[I],L=n[I],!i.hasOwnProperty(I)||U===L||U==null&&L==null||He(e,t,I,U,i,L)}function Op(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Eb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var u=n[i],f=u.transferSize,v=u.initiatorType,b=u.duration;if(f&&b&&Op(v)){for(v=0,b=u.responseEnd,i+=1;i<n.length;i++){var N=n[i],z=N.startTime;if(z>b)break;var $=N.transferSize,I=N.initiatorType;$&&Op(I)&&(N=N.responseEnd,v+=$*(N<b?1:(b-z)/(N-z)))}if(--i,t+=8*(f+v)/(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 Ju=null,Xu=null;function no(e){return e.nodeType===9?e:e.ownerDocument}function Rp(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 Dp(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 Qu(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 Zu=null;function Tb(){var e=window.event;return e&&e.type==="popstate"?e===Zu?!1:(Zu=e,!0):(Zu=null,!1)}var Mp=typeof setTimeout=="function"?setTimeout:void 0,Ab=typeof clearTimeout=="function"?clearTimeout:void 0,zp=typeof Promise=="function"?Promise:void 0,Cb=typeof queueMicrotask=="function"?queueMicrotask:typeof zp<"u"?function(e){return zp.resolve(null).then(e).catch(kb)}:Mp;function kb(e){setTimeout(function(){throw e})}function Es(e){return e==="head"}function Up(e,t){var n=t,i=0;do{var u=n.nextSibling;if(e.removeChild(n),u&&u.nodeType===8)if(n=u.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(u),fr(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Ni(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Ni(n);for(var f=n.firstChild;f;){var v=f.nextSibling,b=f.nodeName;f[Ir]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||n.removeChild(f),f=v}}else n==="body"&&Ni(e.ownerDocument.body);n=u}while(n);fr(t)}function Lp(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function Fu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Fu(n),sc(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Ob(e,t,n,i){for(;e.nodeType===1;){var u=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Ir])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=ra(e.nextSibling),e===null)break}return null}function Rb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ra(e.nextSibling),e===null))return null;return e}function Bp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ra(e.nextSibling),e===null))return null;return e}function Wu(e){return e.data==="$?"||e.data==="$~"}function ed(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Db(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function ra(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 td=null;function qp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ra(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function $p(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Hp(e,t,n){switch(t=no(n),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 Ni(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);sc(e)}var ia=new Map,Vp=new Set;function ro(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Fa=Y.d;Y.d={f:Mb,r:zb,D:Ub,C:Lb,L:Bb,m:qb,X:Hb,S:$b,M:Vb};function Mb(){var e=Fa.f(),t=Ql();return e||t}function zb(e){var t=On(e);t!==null&&t.tag===5&&t.type==="form"?rm(t):Fa.r(e)}var cr=typeof document>"u"?null:document;function Ip(e,t,n){var i=cr;if(i&&typeof t=="string"&&t){var u=Ft(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),Vp.has(u)||(Vp.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function Ub(e){Fa.D(e),Ip("dns-prefetch",e,null)}function Lb(e,t){Fa.C(e,t),Ip("preconnect",e,t)}function Bb(e,t,n){Fa.L(e,t,n);var i=cr;if(i&&e&&t){var u='link[rel="preload"][as="'+Ft(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+Ft(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+Ft(n.imageSizes)+'"]')):u+='[href="'+Ft(e)+'"]';var f=u;switch(t){case"style":f=ur(e);break;case"script":f=dr(e)}ia.has(f)||(e=w({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ia.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Ei(f))||t==="script"&&i.querySelector(Ti(f))||(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function qb(e,t){Fa.m(e,t);var n=cr;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Ft(i)+'"][href="'+Ft(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=dr(e)}if(!ia.has(f)&&(e=w({rel:"modulepreload",href:e},t),ia.set(f,e),n.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ti(f)))return}i=n.createElement("link"),Nt(i,"link",e),vt(i),n.head.appendChild(i)}}}function $b(e,t,n){Fa.S(e,t,n);var i=cr;if(i&&e){var u=Rn(i).hoistableStyles,f=ur(e);t=t||"default";var v=u.get(f);if(!v){var b={loading:0,preload:null};if(v=i.querySelector(Ei(f)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ia.get(f))&&ad(e,n);var N=v=i.createElement("link");vt(N),Nt(N,"link",e),N._p=new Promise(function(z,$){N.onload=z,N.onerror=$}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,io(v,t,i)}v={type:"stylesheet",instance:v,count:1,state:b},u.set(f,v)}}}function Hb(e,t){Fa.X(e,t);var n=cr;if(n&&e){var i=Rn(n).hoistableScripts,u=dr(e),f=i.get(u);f||(f=n.querySelector(Ti(u)),f||(e=w({src:e,async:!0},t),(t=ia.get(u))&&sd(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Vb(e,t){Fa.M(e,t);var n=cr;if(n&&e){var i=Rn(n).hoistableScripts,u=dr(e),f=i.get(u);f||(f=n.querySelector(Ti(u)),f||(e=w({src:e,async:!0,type:"module"},t),(t=ia.get(u))&&sd(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Gp(e,t,n,i){var u=(u=ge.current)?ro(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=ur(n.href),n=Rn(u).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=ur(n.href);var f=Rn(u).hoistableStyles,v=f.get(e);if(v||(u=u.ownerDocument||u,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,v),(f=u.querySelector(Ei(e)))&&!f._p&&(v.instance=f,v.state.loading=5),ia.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ia.set(e,n),f||Ib(u,e,n,v.state))),t&&i===null)throw Error(l(528,""));return v}if(t&&i!==null)throw Error(l(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=dr(n),n=Rn(u).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function ur(e){return'href="'+Ft(e)+'"'}function Ei(e){return'link[rel="stylesheet"]['+e+"]"}function Pp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Ib(e,t,n,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}),Nt(t,"link",n),vt(t),e.head.appendChild(t))}function dr(e){return'[src="'+Ft(e)+'"]'}function Ti(e){return"script[async]"+e}function Kp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Ft(n.href)+'"]');if(i)return t.instance=i,vt(i),i;var u=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),vt(i),Nt(i,"style",u),io(i,n.precedence,e),t.instance=i;case"stylesheet":u=ur(n.href);var f=e.querySelector(Ei(u));if(f)return t.state.loading|=4,t.instance=f,vt(f),f;i=Pp(n),(u=ia.get(u))&&ad(i,u),f=(e.ownerDocument||e).createElement("link"),vt(f);var v=f;return v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),Nt(f,"link",i),t.state.loading|=4,io(f,n.precedence,e),t.instance=f;case"script":return f=dr(n.src),(u=e.querySelector(Ti(f)))?(t.instance=u,vt(u),u):(i=n,(u=ia.get(f))&&(i=w({},n),sd(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),vt(u),Nt(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,io(i,n.precedence,e));return t.instance}function io(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,v=0;v<i.length;v++){var b=i[v];if(b.dataset.precedence===t)f=b;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function ad(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function sd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var lo=null;function Yp(e,t,n){if(lo===null){var i=new Map,u=lo=new Map;u.set(n,i)}else u=lo,i=u.get(n),i||(i=new Map,u.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),u=0;u<n.length;u++){var f=n[u];if(!(f[Ir]||f[ut]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var v=f.getAttribute(t)||"";v=e+v;var b=i.get(v);b?b.push(f):i.set(v,[f])}}return i}function Jp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Gb(e,t,n){if(n===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 Xp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Pb(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var u=ur(i.href),f=t.querySelector(Ei(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=oo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,vt(f);return}f=t.ownerDocument||t,i=Pp(i),(u=ia.get(u))&&ad(i,u),f=f.createElement("link"),vt(f);var v=f;v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),Nt(f,"link",i),n.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=oo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var nd=0;function Kb(e,t){return e.stylesheets&&e.count===0&&uo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&uo(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&nd===0&&(nd=62500*Eb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&uo(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>nd?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function oo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)uo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var co=null;function uo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,co=new Map,t.forEach(Yb,e),co=null,oo.call(e))}function Yb(e,t){if(!(t.state.loading&4)){var n=co.get(e);if(n)var i=n.get(null);else{n=new Map,co.set(e,n);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var v=u[f];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(n.set(v.dataset.precedence,v),i=v)}i&&n.set(null,i)}u=t.instance,v=u.getAttribute("data-precedence"),f=n.get(v)||i,f===i&&n.set(null,u),n.set(v,u),this.count++,i=oo.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 Ai={$$typeof:B,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Jb(e,t,n,i,u,f,v,b,N){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Vr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vr(0),this.hiddenUpdates=Vr(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Qp(e,t,n,i,u,f,v,b,N,z,$,I){return e=new Jb(e,t,n,v,N,z,$,I,b),t=1,f===!0&&(t|=24),f=Vt(3,null,null,t),e.current=f,f.stateNode=e,t=Lc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:n,cache:t},Hc(f),e}function Zp(e){return e?(e=Vn,e):Vn}function Fp(e,t,n,i,u,f){u=Zp(u),i.context===null?i.context=u:i.pendingContext=u,i=ps(t),i.payload={element:n},f=f===void 0?null:f,f!==null&&(i.callback=f),n=gs(e,i,t),n!==null&&(qt(n,e,t),ii(n,e,t))}function Wp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function rd(e,t){Wp(e,t),(e=e.alternate)&&Wp(e,t)}function eg(e){if(e.tag===13||e.tag===31){var t=Xs(e,67108864);t!==null&&qt(t,e,67108864),rd(e,67108864)}}function tg(e){if(e.tag===13||e.tag===31){var t=Yt();t=yt(t);var n=Xs(e,t);n!==null&&qt(n,e,t),rd(e,t)}}var fo=!0;function Xb(e,t,n,i){var u=C.T;C.T=null;var f=Y.p;try{Y.p=2,id(e,t,n,i)}finally{Y.p=f,C.T=u}}function Qb(e,t,n,i){var u=C.T;C.T=null;var f=Y.p;try{Y.p=8,id(e,t,n,i)}finally{Y.p=f,C.T=u}}function id(e,t,n,i){if(fo){var u=ld(i);if(u===null)Ku(e,t,i,ho,n),sg(e,i);else if(Fb(u,e,t,n,i))i.stopPropagation();else if(sg(e,i),t&4&&-1<Zb.indexOf(e)){for(;u!==null;){var f=On(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var v=Ma(f.pendingLanes);if(v!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;v;){var N=1<<31-Ot(v);b.entanglements[1]|=N,v&=~N}Sa(f),(Me&6)===0&&(Jl=gt()+500,_i(0))}}break;case 31:case 13:b=Xs(f,2),b!==null&&qt(b,f,2),Ql(),rd(f,2)}if(f=ld(i),f===null&&Ku(e,t,i,ho,n),f===u)break;u=f}u!==null&&i.stopPropagation()}else Ku(e,t,i,null,n)}}function ld(e){return e=cc(e),od(e)}var ho=null;function od(e){if(ho=null,e=kn(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ho=e,null}function ag(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(nl()){case $r:return 2;case Hr:return 8;case Da:case Sn:return 32;case ya:return 268435456;default:return 32}default:return 32}}var cd=!1,Ts=null,As=null,Cs=null,Ci=new Map,ki=new Map,ks=[],Zb="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 sg(e,t){switch(e){case"focusin":case"focusout":Ts=null;break;case"dragenter":case"dragleave":As=null;break;case"mouseover":case"mouseout":Cs=null;break;case"pointerover":case"pointerout":Ci.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ki.delete(t.pointerId)}}function Oi(e,t,n,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=On(t),t!==null&&eg(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Fb(e,t,n,i,u){switch(t){case"focusin":return Ts=Oi(Ts,e,t,n,i,u),!0;case"dragenter":return As=Oi(As,e,t,n,i,u),!0;case"mouseover":return Cs=Oi(Cs,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return Ci.set(f,Oi(Ci.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,ki.set(f,Oi(ki.get(f)||null,e,t,n,i,u)),!0}return!1}function ng(e){var t=kn(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,Gs(e.priority,function(){tg(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,Gs(e.priority,function(){tg(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function mo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ld(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);oc=i,n.target.dispatchEvent(i),oc=null}else return t=On(n),t!==null&&eg(t),e.blockedOn=n,!1;t.shift()}return!0}function rg(e,t,n){mo(e)&&n.delete(t)}function Wb(){cd=!1,Ts!==null&&mo(Ts)&&(Ts=null),As!==null&&mo(As)&&(As=null),Cs!==null&&mo(Cs)&&(Cs=null),Ci.forEach(rg),ki.forEach(rg)}function po(e,t){e.blockedOn===t&&(e.blockedOn=null,cd||(cd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Wb)))}var go=null;function ig(e){go!==e&&(go=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){go===e&&(go=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(od(i||n)===null)continue;break}var f=On(n);f!==null&&(e.splice(t,3),t-=3,lu(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function fr(e){function t(N){return po(N,e)}Ts!==null&&po(Ts,e),As!==null&&po(As,e),Cs!==null&&po(Cs,e),Ci.forEach(t),ki.forEach(t);for(var n=0;n<ks.length;n++){var i=ks[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<ks.length&&(n=ks[0],n.blockedOn===null);)ng(n),n.blockedOn===null&&ks.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var u=n[i],f=n[i+1],v=u[Dt]||null;if(typeof f=="function")v||ig(n);else if(v){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,v=f[Dt]||null)b=v.formAction;else if(od(u)!==null)continue}else b=v.action;typeof b=="function"?n[i+1]=b:(n.splice(i,3),i-=3),ig(n)}}}function lg(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(v){return u=v})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(n,20)}function n(){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(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function ud(e){this._internalRoot=e}yo.prototype.render=ud.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var n=t.current,i=Yt();Fp(n,i,e,t,null,null)},yo.prototype.unmount=ud.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fp(e.current,2,null,e,null,null),Ql(),t[Cn]=null}};function yo(e){this._internalRoot=e}yo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Is();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ks.length&&t!==0&&t<ks[n].priority;n++);ks.splice(n,0,e),n===0&&ng(e)}};var og=a.version;if(og!=="19.2.3")throw Error(l(527,og,"19.2.3"));Y.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=p(t),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var ex={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:C,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vo.isDisabled&&vo.supportsFiber)try{$s=vo.inject(ex),wt=vo}catch{}}return Di.createRoot=function(e,t){if(!c(e))throw Error(l(299));var n=!1,i="",u=pm,f=gm,v=ym;return t!=null&&(t.unstable_strictMode===!0&&(n=!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&&(v=t.onRecoverableError)),t=Qp(e,1,!1,null,null,n,i,null,u,f,v,lg),e[Cn]=t.current,Pu(e),new ud(t)},Di.hydrateRoot=function(e,t,n){if(!c(e))throw Error(l(299));var i=!1,u="",f=pm,v=gm,b=ym,N=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(v=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError),n.formState!==void 0&&(N=n.formState)),t=Qp(e,1,!0,t,n??null,i,u,N,f,v,b,lg),t.context=Zp(null),n=t.current,i=Yt(),i=yt(i),u=ps(i),u.callback=null,gs(n,u,i),n=i,t.current.lanes=n,Hs(t,n),Sa(t),e[Cn]=t.current,Pu(e),new yo(t)},Di.version="19.2.3",Di}var vg;function ux(){if(vg)return hd.exports;vg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),hd.exports=cx(),hd.exports}var dx=ux();const fx=sf(dx);const hx=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mx=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),bg=s=>{const a=mx(s);return a.charAt(0).toUpperCase()+a.slice(1)},gy=(...s)=>s.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),px=s=>{for(const a in s)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var gx={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 yx=x.forwardRef(({color:s="currentColor",size:a=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},y)=>x.createElement("svg",{ref:y,...gx,width:a,height:a,stroke:s,strokeWidth:l?Number(r)*24/Number(a):r,className:gy("lucide",c),...!d&&!px(m)&&{"aria-hidden":"true"},...m},[...h.map(([p,g])=>x.createElement(p,g)),...Array.isArray(d)?d:[d]]));const re=(s,a)=>{const r=x.forwardRef(({className:l,...c},d)=>x.createElement(yx,{ref:d,iconNode:a,className:gy(`lucide-${hx(bg(s))}`,`lucide-${s}`,l),...c}));return r.displayName=bg(s),r};const vx=[["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"}]],bx=re("activity",vx);const xx=[["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"}]],wx=re("archive",xx);const _x=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Sx=re("arrow-down",_x);const jx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Nx=re("arrow-left",jx);const Ex=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Tx=re("arrow-up",Ex);const Ax=[["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"}]],$i=re("brain",Ax);const Cx=[["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"}]],kx=re("calendar",Cx);const Ox=[["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"}]],Rx=re("camera",Ox);const Dx=[["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"}]],yy=re("chart-column",Dx);const Mx=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ja=re("check",Mx);const zx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ux=re("chevron-down",zx);const Lx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bx=re("chevron-left",Lx);const qx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$x=re("chevron-right",qx);const Hx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Vx=re("chevron-up",Hx);const Ix=[["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"}]],Dr=re("circle-alert",Ix);const Gx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Hi=re("circle-check-big",Gx);const Px=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],lf=re("circle-check",Px);const Kx=[["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"}]],Yx=re("circle-user",Kx);const Jx=[["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"}]],Xx=re("circle-x",Jx);const Qx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],kr=re("clock",Qx);const Zx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Us=re("code",Zx);const Fx=[["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"}]],Wx=re("copy",Fx);const ew=[["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"}]],of=re("cpu",ew);const tw=[["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"}]],Vi=re("database",tw);const aw=[["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"}]],Ii=re("external-link",aw);const sw=[["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"}]],nw=re("eye",sw);const rw=[["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"}]],iw=re("flag",rw);const lw=[["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"}]],ow=re("hash",lw);const cw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Or=re("info",cw);const uw=[["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"}]],dw=re("key-round",uw);const fw=[["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"}]],hw=re("key",fw);const mw=[["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"}]],pw=re("layout-dashboard",mw);const gw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$t=re("loader-circle",gw);const yw=[["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"}]],vw=re("log-in",yw);const bw=[["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"}]],xw=re("log-out",bw);const ww=[["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"}]],Bd=re("mail",ww);const _w=[["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"}]],Sw=re("minimize-2",_w);const jw=[["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"}]],Nw=re("moon",jw);const Ew=[["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"}]],xg=re("paperclip",Ew);const Tw=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],yd=re("pen",Tw);const Aw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Mi=re("plus",Aw);const Cw=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],vd=re("power",Cw);const kw=[["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"}]],Bs=re("refresh-cw",kw);const Ow=[["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"}]],vy=re("rotate-ccw",Ow);const Rw=[["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"}]],Dw=re("save",Rw);const Mw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zw=re("search",Mw);const Uw=[["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"}]],Lw=re("send",Uw);const Bw=[["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"}]],qd=re("settings",Bw);const qw=[["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"}]],$w=re("settings-2",qw);const Hw=[["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"}]],$d=re("shield-check",Hw);const Vw=[["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"}]],Iw=re("shield",Vw);const Gw=[["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"}]],Pw=re("sun",Gw);const Kw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Hd=re("terminal",Kw);const Yw=[["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"}]],zo=re("trash-2",Yw);const Jw=[["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"}]],Rr=re("triangle-alert",Jw);const Xw=[["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"}]],Qw=re("upload",Xw);const Zw=[["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"}]],Fw=re("user-plus",Zw);const Ww=[["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"}]],by=re("user",Ww);const e_=[["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"}]],t_=re("volume-2",e_);const a_=[["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"}]],s_=re("volume-x",a_);const n_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],tl=re("x",n_);const r_=[["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"}]],Uo=re("zap",r_),i_={theme:"system",setTheme:()=>null},xy=x.createContext(i_);function l_({children:s,defaultTheme:a="system",storageKey:r="vite-ui-theme"}){const[l,c]=x.useState(()=>localStorage.getItem(r)||a);x.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(xy.Provider,{value:d,children:s})}const o_=()=>{const s=x.useContext(xy);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s};function wg(s,a){if(typeof s=="function")return s(a);s!=null&&(s.current=a)}function Io(...s){return a=>{let r=!1;const l=s.map(c=>{const d=wg(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():wg(s[c],null)}}}}function bn(...s){return x.useCallback(Io(...s),s)}var c_=Symbol.for("react.lazy"),Lo=rf[" use ".trim().toString()];function u_(s){return typeof s=="object"&&s!==null&&"then"in s}function wy(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===c_&&"_payload"in s&&u_(s._payload)}function _y(s){const a=f_(s),r=x.forwardRef((l,c)=>{let{children:d,...h}=l;wy(d)&&typeof Lo=="function"&&(d=Lo(d._payload));const m=x.Children.toArray(d),y=m.find(m_);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}var d_=_y("Slot");function f_(s){const a=x.forwardRef((r,l)=>{let{children:c,...d}=r;if(wy(c)&&typeof Lo=="function"&&(c=Lo(c._payload)),x.isValidElement(c)){const h=g_(c),m=p_(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Io(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var h_=Symbol("radix.slottable");function m_(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===h_}function p_(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function g_(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}function Sy(s){var a,r,l="";if(typeof s=="string"||typeof s=="number")l+=s;else if(typeof s=="object")if(Array.isArray(s)){var c=s.length;for(a=0;a<c;a++)s[a]&&(r=Sy(s[a]))&&(l&&(l+=" "),l+=r)}else for(r in s)s[r]&&(l&&(l+=" "),l+=r);return l}function jy(){for(var s,a,r=0,l="",c=arguments.length;r<c;r++)(s=arguments[r])&&(a=Sy(s))&&(l&&(l+=" "),l+=a);return l}const _g=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,Sg=jy,Ny=(s,a)=>r=>{var l;if(a?.variants==null)return Sg(s,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(p=>{const g=r?.[p],w=d?.[p];if(g===null)return null;const _=_g(g)||_g(w);return c[p][_]}),m=r&&Object.entries(r).reduce((p,g)=>{let[w,_]=g;return _===void 0||(p[w]=_),p},{}),y=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((p,g)=>{let{class:w,className:_,...S}=g;return Object.entries(S).every(E=>{let[j,O]=E;return Array.isArray(O)?O.includes({...d,...m}[j]):{...d,...m}[j]===O})?[...p,w,_]:p},[]);return Sg(s,h,y,r?.class,r?.className)},y_=(s,a)=>{const r=new Array(s.length+a.length);for(let l=0;l<s.length;l++)r[l]=s[l];for(let l=0;l<a.length;l++)r[s.length+l]=a[l];return r},v_=(s,a)=>({classGroupId:s,validator:a}),Ey=(s=new Map,a=null,r)=>({nextPart:s,validators:a,classGroupId:r}),Bo="-",jg=[],b_="arbitrary..",x_=s=>{const a=__(s),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=s;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return w_(h);const m=h.split(Bo),y=m[0]===""&&m.length>1?1:0;return Ty(m,y,a)},getConflictingClassGroupIds:(h,m)=>{if(m){const y=l[h],p=r[h];return y?p?y_(p,y):y:p||jg}return r[h]||jg}}},Ty=(s,a,r)=>{if(s.length-a===0)return r.classGroupId;const c=s[a],d=r.nextPart.get(c);if(d){const p=Ty(s,a+1,d);if(p)return p}const h=r.validators;if(h===null)return;const m=a===0?s.join(Bo):s.slice(a).join(Bo),y=h.length;for(let p=0;p<y;p++){const g=h[p];if(g.validator(m))return g.classGroupId}},w_=s=>s.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=s.slice(1,-1),r=a.indexOf(":"),l=a.slice(0,r);return l?b_+l:void 0})(),__=s=>{const{theme:a,classGroups:r}=s;return S_(r,a)},S_=(s,a)=>{const r=Ey();for(const l in s){const c=s[l];cf(c,r,l,a)}return r},cf=(s,a,r,l)=>{const c=s.length;for(let d=0;d<c;d++){const h=s[d];j_(h,a,r,l)}},j_=(s,a,r,l)=>{if(typeof s=="string"){N_(s,a,r);return}if(typeof s=="function"){E_(s,a,r,l);return}T_(s,a,r,l)},N_=(s,a,r)=>{const l=s===""?a:Ay(a,s);l.classGroupId=r},E_=(s,a,r,l)=>{if(A_(s)){cf(s(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(v_(r,s))},T_=(s,a,r,l)=>{const c=Object.entries(s),d=c.length;for(let h=0;h<d;h++){const[m,y]=c[h];cf(y,Ay(a,m),r,l)}},Ay=(s,a)=>{let r=s;const l=a.split(Bo),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=Ey(),r.nextPart.set(h,m)),r=m}return r},A_=s=>"isThemeGetter"in s&&s.isThemeGetter===!0,C_=s=>{if(s<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),l=Object.create(null);const c=(d,h)=>{r[d]=h,a++,a>s&&(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)}}},Vd="!",Ng=":",k_=[],Eg=(s,a,r,l,c)=>({modifiers:s,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),O_=s=>{const{prefix:a,experimentalParseClassName:r}=s;let l=c=>{const d=[];let h=0,m=0,y=0,p;const g=c.length;for(let j=0;j<g;j++){const O=c[j];if(h===0&&m===0){if(O===Ng){d.push(c.slice(y,j)),y=j+1;continue}if(O==="/"){p=j;continue}}O==="["?h++:O==="]"?h--:O==="("?m++:O===")"&&m--}const w=d.length===0?c:c.slice(y);let _=w,S=!1;w.endsWith(Vd)?(_=w.slice(0,-1),S=!0):w.startsWith(Vd)&&(_=w.slice(1),S=!0);const E=p&&p>y?p-y:void 0;return Eg(d,S,_,E)};if(a){const c=a+Ng,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):Eg(k_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},R_=s=>{const a=new Map;return s.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]==="[",y=a.has(h);m||y?(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}},D_=s=>({cache:C_(s.cacheSize),parseClassName:O_(s),sortModifiers:R_(s),...x_(s)}),M_=/\s+/,z_=(s,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=s.trim().split(M_);let y="";for(let p=m.length-1;p>=0;p-=1){const g=m[p],{isExternal:w,modifiers:_,hasImportantModifier:S,baseClassName:E,maybePostfixModifierPosition:j}=r(g);if(w){y=g+(y.length>0?" "+y:y);continue}let O=!!j,D=l(O?E.substring(0,j):E);if(!D){if(!O){y=g+(y.length>0?" "+y:y);continue}if(D=l(E),!D){y=g+(y.length>0?" "+y:y);continue}O=!1}const q=_.length===0?"":_.length===1?_[0]:d(_).join(":"),B=S?q+Vd:q,G=B+D;if(h.indexOf(G)>-1)continue;h.push(G);const W=c(D,O);for(let J=0;J<W.length;++J){const P=W[J];h.push(B+P)}y=g+(y.length>0?" "+y:y)}return y},U_=(...s)=>{let a=0,r,l,c="";for(;a<s.length;)(r=s[a++])&&(l=Cy(r))&&(c&&(c+=" "),c+=l);return c},Cy=s=>{if(typeof s=="string")return s;let a,r="";for(let l=0;l<s.length;l++)s[l]&&(a=Cy(s[l]))&&(r&&(r+=" "),r+=a);return r},L_=(s,...a)=>{let r,l,c,d;const h=y=>{const p=a.reduce((g,w)=>w(g),s());return r=D_(p),l=r.cache.get,c=r.cache.set,d=m,m(y)},m=y=>{const p=l(y);if(p)return p;const g=z_(y,r);return c(y,g),g};return d=h,(...y)=>d(U_(...y))},B_=[],ft=s=>{const a=r=>r[s]||B_;return a.isThemeGetter=!0,a},ky=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Oy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,q_=/^\d+\/\d+$/,$_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H_=/\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$/,V_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,I_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hr=s=>q_.test(s),we=s=>!!s&&!Number.isNaN(Number(s)),Rs=s=>!!s&&Number.isInteger(Number(s)),bd=s=>s.endsWith("%")&&we(s.slice(0,-1)),Wa=s=>$_.test(s),P_=()=>!0,K_=s=>H_.test(s)&&!V_.test(s),Ry=()=>!1,Y_=s=>I_.test(s),J_=s=>G_.test(s),X_=s=>!se(s)&&!ne(s),Q_=s=>Mr(s,zy,Ry),se=s=>ky.test(s),cn=s=>Mr(s,Uy,K_),xd=s=>Mr(s,t1,we),Tg=s=>Mr(s,Dy,Ry),Z_=s=>Mr(s,My,J_),bo=s=>Mr(s,Ly,Y_),ne=s=>Oy.test(s),zi=s=>zr(s,Uy),F_=s=>zr(s,a1),Ag=s=>zr(s,Dy),W_=s=>zr(s,zy),e1=s=>zr(s,My),xo=s=>zr(s,Ly,!0),Mr=(s,a,r)=>{const l=ky.exec(s);return l?l[1]?a(l[1]):r(l[2]):!1},zr=(s,a,r=!1)=>{const l=Oy.exec(s);return l?l[1]?a(l[1]):r:!1},Dy=s=>s==="position"||s==="percentage",My=s=>s==="image"||s==="url",zy=s=>s==="length"||s==="size"||s==="bg-size",Uy=s=>s==="length",t1=s=>s==="number",a1=s=>s==="family-name",Ly=s=>s==="shadow",s1=()=>{const s=ft("color"),a=ft("font"),r=ft("text"),l=ft("font-weight"),c=ft("tracking"),d=ft("leading"),h=ft("breakpoint"),m=ft("container"),y=ft("spacing"),p=ft("radius"),g=ft("shadow"),w=ft("inset-shadow"),_=ft("text-shadow"),S=ft("drop-shadow"),E=ft("blur"),j=ft("perspective"),O=ft("aspect"),D=ft("ease"),q=ft("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...G(),ne,se],J=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],Q=()=>[ne,se,y],ce=()=>[hr,"full","auto",...Q()],Je=()=>[Rs,"none","subgrid",ne,se],ve=()=>["auto",{span:["full",Rs,ne,se]},Rs,ne,se],pe=()=>[Rs,"auto",ne,se],Ze=()=>["auto","min","max","fr",ne,se],st=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],qe=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...Q()],Y=()=>[hr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],K=()=>[s,ne,se],_e=()=>[...G(),Ag,Tg,{position:[ne,se]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",W_,Q_,{size:[ne,se]}],V=()=>[bd,zi,cn],X=()=>["","none","full",p,ne,se],F=()=>["",we,zi,cn],de=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[we,bd,Ag,Tg],Ge=()=>["","none",E,ne,se],Ue=()=>["none",we,ne,se],Ct=()=>["none",we,ne,se],pt=()=>[we,ne,se],xt=()=>[hr,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wa],breakpoint:[Wa],color:[P_],container:[Wa],"drop-shadow":[Wa],ease:["in","out","in-out"],font:[X_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wa],shadow:[Wa],spacing:["px",we],text:[Wa],"text-shadow":[Wa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",hr,se,ne,O]}],container:["container"],columns:[{columns:[we,se,ne,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:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ce()}],"inset-x":[{"inset-x":ce()}],"inset-y":[{"inset-y":ce()}],start:[{start:ce()}],end:[{end:ce()}],top:[{top:ce()}],right:[{right:ce()}],bottom:[{bottom:ce()}],left:[{left:ce()}],visibility:["visible","invisible","collapse"],z:[{z:[Rs,"auto",ne,se]}],basis:[{basis:[hr,"full","auto",m,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[we,hr,"auto","initial","none",se]}],grow:[{grow:["",we,ne,se]}],shrink:[{shrink:["",we,ne,se]}],order:[{order:[Rs,"first","last","none",ne,se]}],"grid-cols":[{"grid-cols":Je()}],"col-start-end":[{col:ve()}],"col-start":[{"col-start":pe()}],"col-end":[{"col-end":pe()}],"grid-rows":[{"grid-rows":Je()}],"row-start-end":[{row:ve()}],"row-start":[{"row-start":pe()}],"row-end":[{"row-end":pe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ze()}],"auto-rows":[{"auto-rows":Ze()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...st(),"normal"]}],"justify-items":[{"justify-items":[...qe(),"normal"]}],"justify-self":[{"justify-self":["auto",...qe()]}],"align-content":[{content:["normal",...st()]}],"align-items":[{items:[...qe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...qe(),{baseline:["","last"]}]}],"place-content":[{"place-content":st()}],"place-items":[{"place-items":[...qe(),"baseline"]}],"place-self":[{"place-self":["auto",...qe()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[m,"screen",...Y()]}],"min-w":[{"min-w":[m,"screen","none",...Y()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",r,zi,cn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,ne,xd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bd,se]}],"font-family":[{font:[F_,se,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,ne,se]}],"line-clamp":[{"line-clamp":[we,"none",ne,xd]}],leading:[{leading:[d,...Q()]}],"list-image":[{"list-image":["none",ne,se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ne,se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[we,"from-font","auto",ne,cn]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[we,"auto",ne,se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ne,se]}],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",ne,se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_e()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Rs,ne,se],radial:["",ne,se],conic:[Rs,ne,se]},e1,Z_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded: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:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[we,ne,se]}],"outline-w":[{outline:["",we,zi,cn]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",g,xo,bo]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",w,xo,bo]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[we,cn]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",_,xo,bo]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[we,ne,se]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"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":[ne,se]}],"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":G()}],"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:_e()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ne,se]}],filter:[{filter:["","none",ne,se]}],blur:[{blur:Ge()}],brightness:[{brightness:[we,ne,se]}],contrast:[{contrast:[we,ne,se]}],"drop-shadow":[{"drop-shadow":["","none",S,xo,bo]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",we,ne,se]}],"hue-rotate":[{"hue-rotate":[we,ne,se]}],invert:[{invert:["",we,ne,se]}],saturate:[{saturate:[we,ne,se]}],sepia:[{sepia:["",we,ne,se]}],"backdrop-filter":[{"backdrop-filter":["","none",ne,se]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[we,ne,se]}],"backdrop-contrast":[{"backdrop-contrast":[we,ne,se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",we,ne,se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[we,ne,se]}],"backdrop-invert":[{"backdrop-invert":["",we,ne,se]}],"backdrop-opacity":[{"backdrop-opacity":[we,ne,se]}],"backdrop-saturate":[{"backdrop-saturate":[we,ne,se]}],"backdrop-sepia":[{"backdrop-sepia":["",we,ne,se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ne,se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[we,"initial",ne,se]}],ease:[{ease:["linear","initial",D,ne,se]}],delay:[{delay:[we,ne,se]}],animate:[{animate:["none",q,ne,se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,ne,se]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:Ue()}],"rotate-x":[{"rotate-x":Ue()}],"rotate-y":[{"rotate-y":Ue()}],"rotate-z":[{"rotate-z":Ue()}],scale:[{scale:Ct()}],"scale-x":[{"scale-x":Ct()}],"scale-y":[{"scale-y":Ct()}],"scale-z":[{"scale-z":Ct()}],"scale-3d":["scale-3d"],skew:[{skew:pt()}],"skew-x":[{"skew-x":pt()}],"skew-y":[{"skew-y":pt()}],transform:[{transform:[ne,se,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xt()}],"translate-x":[{"translate-x":xt()}],"translate-y":[{"translate-y":xt()}],"translate-z":[{"translate-z":xt()}],"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",ne,se]}],"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":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",ne,se]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[we,zi,cn,xd]}],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"]}},n1=L_(s1);function Oe(...s){return n1(jy(s))}const r1=Ny("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"}}),Z=x.forwardRef(({className:s,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?d_:"button";return o.jsx(h,{className:Oe(r1({variant:a,size:r,className:s})),ref:d,...c})});Z.displayName="Button";function By(){const{setTheme:s,theme:a}=o_();return o.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>s(a==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground w-8 px-0",title:`Switch to ${a==="dark"?"light":"dark"} mode`,children:[a==="dark"?o.jsx(Pw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(Nw,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var Na=function(){return Na=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},Na.apply(this,arguments)};function Ur(s,a){var r={};for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&a.indexOf(l)<0&&(r[l]=s[l]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(s);c<l.length;c++)a.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(s,l[c])&&(r[l[c]]=s[l[c]]);return r}function i1(s,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(g){try{p(l.next(g))}catch(w){h(w)}}function y(g){try{p(l.throw(g))}catch(w){h(w)}}function p(g){g.done?d(g.value):c(g.value).then(m,y)}p((l=l.apply(s,a||[])).next())})}function l1(s,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 s.concat(d||Array.prototype.slice.call(a))}const o1=s=>s?(...a)=>s(...a):(...a)=>fetch(...a);class uf extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class c1 extends uf{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class Cg extends uf{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class kg extends uf{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Id;(function(s){s.Any="any",s.ApNortheast1="ap-northeast-1",s.ApNortheast2="ap-northeast-2",s.ApSouth1="ap-south-1",s.ApSoutheast1="ap-southeast-1",s.ApSoutheast2="ap-southeast-2",s.CaCentral1="ca-central-1",s.EuCentral1="eu-central-1",s.EuWest1="eu-west-1",s.EuWest2="eu-west-2",s.EuWest3="eu-west-3",s.SaEast1="sa-east-1",s.UsEast1="us-east-1",s.UsWest1="us-west-1",s.UsWest2="us-west-2"})(Id||(Id={}));class u1{constructor(a,{headers:r={},customFetch:l,region:c=Id.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=o1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return i1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:y,body:p,signal:g,timeout:w}=l;let _={},{region:S}=l;S||(S=this.region);const E=new URL(`${this.url}/${r}`);S&&S!=="any"&&(_["x-region"]=S,E.searchParams.set("forceFunctionRegion",S));let j;p&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",j=p):typeof p=="string"?(_["Content-Type"]="text/plain",j=p):typeof FormData<"u"&&p instanceof FormData?j=p:(_["Content-Type"]="application/json",j=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?j=JSON.stringify(p):j=p;let O=g;w&&(h=new AbortController,d=setTimeout(()=>h.abort(),w),g?(O=h.signal,g.addEventListener("abort",()=>h.abort())):O=h.signal);const D=yield this.fetch(E.toString(),{method:y||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),m),body:j,signal:O}).catch(W=>{throw new c1(W)}),q=D.headers.get("x-relay-error");if(q&&q==="true")throw new Cg(D);if(!D.ok)throw new kg(D);let B=((c=D.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),G;return B==="application/json"?G=yield D.json():B==="application/octet-stream"||B==="application/pdf"?G=yield D.blob():B==="text/event-stream"?G=D:B==="multipart/form-data"?G=yield D.formData():G=yield D.text(),{data:G,error:null,response:D}}catch(m){return{data:null,error:m,response:m instanceof kg||m instanceof Cg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var d1=class extends Error{constructor(s){super(s.message),this.name="PostgrestError",this.details=s.details,this.hint=s.hint,this.code=s.code}},f1=class{constructor(s){var a,r;this.shouldThrowOnError=!1,this.method=s.method,this.url=s.url,this.headers=new Headers(s.headers),this.schema=s.schema,this.body=s.body,this.shouldThrowOnError=(a=s.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=s.signal,this.isMaybeSingle=(r=s.isMaybeSingle)!==null&&r!==void 0?r:!1,s.fetch?this.fetch=s.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(s,a){return this.headers=new Headers(this.headers),this.headers.set(s,a),this}then(s,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,y=null,p=d.status,g=d.statusText;if(d.ok){var w,_;if(r.method!=="HEAD"){var S;const D=await d.text();D===""||(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=D:m=JSON.parse(D))}const j=(w=r.headers.get("Prefer"))===null||w===void 0?void 0:w.match(/count=(exact|planned|estimated)/),O=(_=d.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");j&&O&&O.length>1&&(y=parseInt(O[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,y=null,p=406,g="Not Acceptable"):m.length===1?m=m[0]:m=null)}else{var E;const j=await d.text();try{h=JSON.parse(j),Array.isArray(h)&&d.status===404&&(m=[],h=null,p=200,g="OK")}catch{d.status===404&&j===""?(p=204,g="No Content"):h={message:j}}if(h&&r.isMaybeSingle&&(!(h==null||(E=h.details)===null||E===void 0)&&E.includes("0 rows"))&&(h=null,p=200,g="OK"),h&&r.shouldThrowOnError)throw new d1(h)}return{error:h,data:m,count:y,status:p,statusText:g}});return this.shouldThrowOnError||(c=c.catch(d=>{var h;let m="";const y=d?.cause;if(y){var p,g,w,_;const E=(p=y?.message)!==null&&p!==void 0?p:"",j=(g=y?.code)!==null&&g!==void 0?g:"";m=`${(w=d?.name)!==null&&w!==void 0?w:"FetchError"}: ${d?.message}`,m+=`
|
|
10
10
|
|
|
11
|
-
Caused by: ${(_=
|
|
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(s,a)}returns(){return this}overrideTypes(){return this}},h1=class extends f1{select(s){let a=!1;const r=(s??"*").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(s,{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},`:""}${s}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(s,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${s}`),this}range(s,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,`${s}`),this.url.searchParams.set(d,`${a-s+1}`),this}abortSignal(s){return this.signal=s,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:s=!1,verbose:a=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[s?"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(s){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${s}`),this}};const Og=new RegExp("[,()]");var Sr=class extends h1{eq(s,a){return this.url.searchParams.append(s,`eq.${a}`),this}neq(s,a){return this.url.searchParams.append(s,`neq.${a}`),this}gt(s,a){return this.url.searchParams.append(s,`gt.${a}`),this}gte(s,a){return this.url.searchParams.append(s,`gte.${a}`),this}lt(s,a){return this.url.searchParams.append(s,`lt.${a}`),this}lte(s,a){return this.url.searchParams.append(s,`lte.${a}`),this}like(s,a){return this.url.searchParams.append(s,`like.${a}`),this}likeAllOf(s,a){return this.url.searchParams.append(s,`like(all).{${a.join(",")}}`),this}likeAnyOf(s,a){return this.url.searchParams.append(s,`like(any).{${a.join(",")}}`),this}ilike(s,a){return this.url.searchParams.append(s,`ilike.${a}`),this}ilikeAllOf(s,a){return this.url.searchParams.append(s,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(s,a){return this.url.searchParams.append(s,`ilike(any).{${a.join(",")}}`),this}regexMatch(s,a){return this.url.searchParams.append(s,`match.${a}`),this}regexIMatch(s,a){return this.url.searchParams.append(s,`imatch.${a}`),this}is(s,a){return this.url.searchParams.append(s,`is.${a}`),this}isDistinct(s,a){return this.url.searchParams.append(s,`isdistinct.${a}`),this}in(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Og.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`in.(${r})`),this}notIn(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Og.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`not.in.(${r})`),this}contains(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cs.{${a.join(",")}}`):this.url.searchParams.append(s,`cs.${JSON.stringify(a)}`),this}containedBy(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cd.{${a.join(",")}}`):this.url.searchParams.append(s,`cd.${JSON.stringify(a)}`),this}rangeGt(s,a){return this.url.searchParams.append(s,`sr.${a}`),this}rangeGte(s,a){return this.url.searchParams.append(s,`nxl.${a}`),this}rangeLt(s,a){return this.url.searchParams.append(s,`sl.${a}`),this}rangeLte(s,a){return this.url.searchParams.append(s,`nxr.${a}`),this}rangeAdjacent(s,a){return this.url.searchParams.append(s,`adj.${a}`),this}overlaps(s,a){return typeof a=="string"?this.url.searchParams.append(s,`ov.${a}`):this.url.searchParams.append(s,`ov.{${a.join(",")}}`),this}textSearch(s,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(s,`${c}fts${d}.${a}`),this}match(s){return Object.entries(s).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(s,a,r){return this.url.searchParams.append(s,`not.${a}.${r}`),this}or(s,{foreignTable:a,referencedTable:r=a}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${s})`),this}filter(s,a,r){return this.url.searchParams.append(s,`${a}.${r}`),this}},m1=class{constructor(s,{headers:a={},schema:r,fetch:l}){this.url=s,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(s,a){const{head:r=!1,count:l}=a??{},c=r?"HEAD":"GET";let d=!1;const h=(s??"*").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 Sr({method:c,url:m,headers:p,schema:this.schema,fetch:this.fetch})}insert(s,{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(s)){const m=s.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 Sr({method:c,url:d,headers:h,schema:this.schema,body:s,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(s,{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(s)){const g=s.reduce((v,w)=>v.concat(Object.keys(w)),[]);if(g.length>0){const v=[...new Set(g)].map(w=>`"${w}"`);m.searchParams.set("columns",v.join(","))}}return new Sr({method:h,url:m,headers:p,schema:this.schema,body:s,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(s,{count:a}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return a&&d.append("Prefer",`count=${a}`),new Sr({method:l,url:c,headers:d,schema:this.schema,body:s,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:s}={}){var a;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return s&&c.append("Prefer",`count=${s}`),new Sr({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},p1=class qy{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 m1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new qy(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)),w=l&&Object.values(r).some(v);w?(m="POST",g=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([S,E])=>E!==void 0).map(([S,E])=>[S,Array.isArray(E)?`{${E.join(",")}}`:`${E}`]).forEach(([S,E])=>{p.searchParams.append(S,E)})):(m="POST",g=r);const _=new Headers(this.headers);return w?_.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&_.set("Prefer",`count=${d}`),new Sr({method:m,url:p,headers:_,schema:this.schemaName,body:g,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class g1{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:
|
|
11
|
+
Caused by: ${(_=y?.name)!==null&&_!==void 0?_:"Error"}: ${E}`,j&&(m+=` (${j})`),y?.stack&&(m+=`
|
|
12
|
+
${y.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(s,a)}returns(){return this}overrideTypes(){return this}},h1=class extends f1{select(s){let a=!1;const r=(s??"*").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(s,{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},`:""}${s}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(s,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${s}`),this}range(s,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,`${s}`),this.url.searchParams.set(d,`${a-s+1}`),this}abortSignal(s){return this.signal=s,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:s=!1,verbose:a=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[s?"analyze":null,a?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),y=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${y}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(s){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${s}`),this}};const Og=new RegExp("[,()]");var Sr=class extends h1{eq(s,a){return this.url.searchParams.append(s,`eq.${a}`),this}neq(s,a){return this.url.searchParams.append(s,`neq.${a}`),this}gt(s,a){return this.url.searchParams.append(s,`gt.${a}`),this}gte(s,a){return this.url.searchParams.append(s,`gte.${a}`),this}lt(s,a){return this.url.searchParams.append(s,`lt.${a}`),this}lte(s,a){return this.url.searchParams.append(s,`lte.${a}`),this}like(s,a){return this.url.searchParams.append(s,`like.${a}`),this}likeAllOf(s,a){return this.url.searchParams.append(s,`like(all).{${a.join(",")}}`),this}likeAnyOf(s,a){return this.url.searchParams.append(s,`like(any).{${a.join(",")}}`),this}ilike(s,a){return this.url.searchParams.append(s,`ilike.${a}`),this}ilikeAllOf(s,a){return this.url.searchParams.append(s,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(s,a){return this.url.searchParams.append(s,`ilike(any).{${a.join(",")}}`),this}regexMatch(s,a){return this.url.searchParams.append(s,`match.${a}`),this}regexIMatch(s,a){return this.url.searchParams.append(s,`imatch.${a}`),this}is(s,a){return this.url.searchParams.append(s,`is.${a}`),this}isDistinct(s,a){return this.url.searchParams.append(s,`isdistinct.${a}`),this}in(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Og.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`in.(${r})`),this}notIn(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Og.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`not.in.(${r})`),this}contains(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cs.{${a.join(",")}}`):this.url.searchParams.append(s,`cs.${JSON.stringify(a)}`),this}containedBy(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cd.{${a.join(",")}}`):this.url.searchParams.append(s,`cd.${JSON.stringify(a)}`),this}rangeGt(s,a){return this.url.searchParams.append(s,`sr.${a}`),this}rangeGte(s,a){return this.url.searchParams.append(s,`nxl.${a}`),this}rangeLt(s,a){return this.url.searchParams.append(s,`sl.${a}`),this}rangeLte(s,a){return this.url.searchParams.append(s,`nxr.${a}`),this}rangeAdjacent(s,a){return this.url.searchParams.append(s,`adj.${a}`),this}overlaps(s,a){return typeof a=="string"?this.url.searchParams.append(s,`ov.${a}`):this.url.searchParams.append(s,`ov.{${a.join(",")}}`),this}textSearch(s,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(s,`${c}fts${d}.${a}`),this}match(s){return Object.entries(s).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(s,a,r){return this.url.searchParams.append(s,`not.${a}.${r}`),this}or(s,{foreignTable:a,referencedTable:r=a}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${s})`),this}filter(s,a,r){return this.url.searchParams.append(s,`${a}.${r}`),this}},m1=class{constructor(s,{headers:a={},schema:r,fetch:l}){this.url=s,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(s,a){const{head:r=!1,count:l}=a??{},c=r?"HEAD":"GET";let d=!1;const h=(s??"*").split("").map(p=>/\s/.test(p)&&!d?"":(p==='"'&&(d=!d),p)).join(""),{url:m,headers:y}=this.cloneRequestState();return m.searchParams.set("select",h),l&&y.append("Prefer",`count=${l}`),new Sr({method:c,url:m,headers:y,schema:this.schema,fetch:this.fetch})}insert(s,{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(s)){const m=s.reduce((y,p)=>y.concat(Object.keys(p)),[]);if(m.length>0){const y=[...new Set(m)].map(p=>`"${p}"`);d.searchParams.set("columns",y.join(","))}}return new Sr({method:c,url:d,headers:h,schema:this.schema,body:s,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(s,{onConflict:a,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:y}=this.cloneRequestState();if(y.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),a!==void 0&&m.searchParams.set("on_conflict",a),l&&y.append("Prefer",`count=${l}`),c||y.append("Prefer","missing=default"),Array.isArray(s)){const p=s.reduce((g,w)=>g.concat(Object.keys(w)),[]);if(p.length>0){const g=[...new Set(p)].map(w=>`"${w}"`);m.searchParams.set("columns",g.join(","))}}return new Sr({method:h,url:m,headers:y,schema:this.schema,body:s,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(s,{count:a}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return a&&d.append("Prefer",`count=${a}`),new Sr({method:l,url:c,headers:d,schema:this.schema,body:s,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:s}={}){var a;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return s&&c.append("Prefer",`count=${s}`),new Sr({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},p1=class qy{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 m1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new qy(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 y=new URL(`${this.url}/rpc/${a}`);let p;const g=S=>S!==null&&typeof S=="object"&&(!Array.isArray(S)||S.some(g)),w=l&&Object.values(r).some(g);w?(m="POST",p=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([S,E])=>E!==void 0).map(([S,E])=>[S,Array.isArray(E)?`{${E.join(",")}}`:`${E}`]).forEach(([S,E])=>{y.searchParams.append(S,E)})):(m="POST",p=r);const _=new Headers(this.headers);return w?_.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&_.set("Prefer",`count=${d}`),new Sr({method:m,url:y,headers:_,schema:this.schemaName,body:p,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class g1{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 y1="2.90.1",v1=`realtime-js/${y1}`,$y="1.0.0",b1="2.0.0",Rg=$y,Gd=1e4,x1=1e3,w1=100;var Ds;(function(s){s[s.connecting=0]="connecting",s[s.open=1]="open",s[s.closing=2]="closing",s[s.closed=3]="closed"})(Ds||(Ds={}));var ht;(function(s){s.closed="closed",s.errored="errored",s.joined="joined",s.joining="joining",s.leaving="leaving"})(ht||(ht={}));var ma;(function(s){s.close="phx_close",s.error="phx_error",s.join="phx_join",s.reply="phx_reply",s.leave="phx_leave",s.access_token="access_token"})(ma||(ma={}));var Pd;(function(s){s.websocket="websocket"})(Pd||(Pd={}));var hn;(function(s){s.Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed"})(hn||(hn={}));class _1{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):{},w=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(w.length>255)throw new Error(`metadata length ${w.length} exceeds maximum of 255`);const _=this.USER_BROADCAST_PUSH_META_LENGTH+p.length+m.length+h.length+g.length+w.length,S=new ArrayBuffer(this.HEADER_LENGTH+_);let E=new DataView(S),j=0;E.setUint8(j++,this.KINDS.userBroadcastPush),E.setUint8(j++,p.length),E.setUint8(j++,m.length),E.setUint8(j++,h.length),E.setUint8(j++,g.length),E.setUint8(j++,w.length),E.setUint8(j++,r),Array.from(p,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(m,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(h,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(g,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(w,D=>E.setUint8(j++,D.charCodeAt(0)));var O=new Uint8Array(S.byteLength+l.byteLength);return O.set(new Uint8Array(S),0),O.set(new Uint8Array(l),S.byteLength),O.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 w=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(_)):_,E={type:this.BROADCAST_EVENT,event:v,payload:S};return h>0&&(E.meta=JSON.parse(w)),{join_ref:null,ref:null,topic:g,event:this.BROADCAST_EVENT,payload:E}}_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 Hy{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(s){s.abstime="abstime",s.bool="bool",s.date="date",s.daterange="daterange",s.float4="float4",s.float8="float8",s.int2="int2",s.int4="int4",s.int4range="int4range",s.int8="int8",s.int8range="int8range",s.json="json",s.jsonb="jsonb",s.money="money",s.numeric="numeric",s.oid="oid",s.reltime="reltime",s.text="text",s.time="time",s.timestamp="timestamp",s.timestamptz="timestamptz",s.timetz="timetz",s.tsrange="tsrange",s.tstzrange="tstzrange"})(Pe||(Pe={}));const Dg=(s,a,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return a?Object.keys(a).reduce((d,h)=>(d[h]=S1(h,s,a,c),d),{}):{}},S1=(s,a,r,l)=>{const c=a.find(m=>m.name===s),d=c?.type,h=r[s];return d&&!l.includes(d)?Vy(d,h):Kd(h)},Vy=(s,a)=>{if(s.charAt(0)==="_"){const r=s.slice(1,s.length);return T1(a,r)}switch(s){case Pe.bool:return j1(a);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return N1(a);case Pe.json:case Pe.jsonb:return E1(a);case Pe.timestamp:return A1(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 Kd(a);default:return Kd(a)}},Kd=s=>s,j1=s=>{switch(s){case"t":return!0;case"f":return!1;default:return s}},N1=s=>{if(typeof s=="string"){const a=parseFloat(s);if(!Number.isNaN(a))return a}return s},E1=s=>{if(typeof s=="string")try{return JSON.parse(s)}catch{return s}return s},T1=(s,a)=>{if(typeof s!="string")return s;const r=s.length-1,l=s[r];if(s[0]==="{"&&l==="}"){let d;const h=s.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Vy(a,m))}return s},A1=s=>typeof s=="string"?s.replace(" ","T"):s,Iy=s=>{const a=new URL(s);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 wd{constructor(a,r,l={},c=Gd){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 Mg;(function(s){s.SYNC="sync",s.JOIN="join",s.LEAVE="leave"})(Mg||(Mg={}));class Li{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=Li.syncState(this.state,c,d,h),this.pendingDiffs.forEach(p=>{this.state=Li.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=Li.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 w=d[g];if(w){const _=v.map(O=>O.presence_ref),S=w.map(O=>O.presence_ref),E=v.filter(O=>S.indexOf(O.presence_ref)<0),j=w.filter(O=>_.indexOf(O.presence_ref)<0);E.length>0&&(m[g]=E),j.length>0&&(p[g]=j)}else m[g]=v}),this.syncDiff(d,{joins:m,leaves:p},l,c)}static syncDiff(a,r,l,c){const{joins:d,leaves:h}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return l||(l=()=>{}),c||(c=()=>{}),this.map(d,(m,p)=>{var g;const v=(g=a[m])!==null&&g!==void 0?g:[];if(a[m]=this.cloneDeep(p),v.length>0){const w=a[m].map(S=>S.presence_ref),_=v.filter(S=>w.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(w=>w.presence_ref);g=g.filter(w=>v.indexOf(w.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 zg;(function(s){s.ALL="*",s.INSERT="INSERT",s.UPDATE="UPDATE",s.DELETE="DELETE"})(zg||(zg={}));var Bi;(function(s){s.BROADCAST="broadcast",s.PRESENCE="presence",s.POSTGRES_CHANGES="postgres_changes",s.SYSTEM="system"})(Bi||(Bi={}));var Wa;(function(s){s.SUBSCRIBED="SUBSCRIBED",s.TIMED_OUT="TIMED_OUT",s.CLOSED="CLOSED",s.CHANNEL_ERROR="CHANNEL_ERROR"})(Wa||(Wa={}));class Tr{constructor(a,r={config:{}},l){var c,d;if(this.topic=a,this.params=r,this.socket=l,this.bindings={},this.state=ht.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 wd(this,ma.join,this.params,this.timeout),this.rejoinTimer=new Hy(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ht.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=ht.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ma.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new Li(this),this.broadcastEndpointURL=Iy(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==ht.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[Bi.PRESENCE]&&this.bindings[Bi.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,w={},_={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:v}),postgres_changes:g,private:p};this.socket.accessTokenValue&&(w.access_token=this.socket.accessTokenValue),this._onError(S=>a?.(Wa.CHANNEL_ERROR,S)),this._onClose(()=>a?.(Wa.CLOSED)),this.updateJoinPayload(Object.assign({config:_},w)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:S})=>{var E;if(this.socket._isManualToken()||this.socket.setAuth(),S===void 0){a?.(Wa.SUBSCRIBED);return}else{const j=this.bindings.postgres_changes,O=(E=j?.length)!==null&&E!==void 0?E:0,D=[];for(let q=0;q<O;q++){const B=j[q],{filter:{event:G,schema:W,table:J,filter:P}}=B,Q=S&&S[q];if(Q&&Q.event===G&&Tr.isFilterValueEqual(Q.schema,W)&&Tr.isFilterValueEqual(Q.table,J)&&Tr.isFilterValueEqual(Q.filter,P))D.push(Object.assign(Object.assign({},B),{id:Q.id}));else{this.unsubscribe(),this.state=ht.errored,a?.(Wa.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=D,a&&a(Wa.SUBSCRIBED);return}}).receive("error",S=>{this.state=ht.errored,a?.(Wa.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{a?.(Wa.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===ht.joined&&a===Bi.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=ht.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ma.close,"leave",this._joinRef())};this.joinPush.destroy();let l=null;return new Promise(c=>{l=new wd(this,ma.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=ht.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 wd(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>w1){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}=ma;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 E,j,O;return((E=S.filter)===null||E===void 0?void 0:E.event)==="*"||((O=(j=S.filter)===null||j===void 0?void 0:j.event)===null||O===void 0?void 0:O.toLocaleLowerCase())===h}).map(S=>S.callback(_,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var E,j,O,D,q,B,G,W;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const J=S.id,P=(E=S.filter)===null||E===void 0?void 0:E.event;return J&&((j=r.ids)===null||j===void 0?void 0:j.includes(J))&&(P==="*"||P?.toLocaleLowerCase()===((O=r.data)===null||O===void 0?void 0:O.type.toLocaleLowerCase()))&&(!(!((D=S.filter)===null||D===void 0)&&D.table)||S.filter.table===((q=r.data)===null||q===void 0?void 0:q.table))}else{const J=(G=(B=S?.filter)===null||B===void 0?void 0:B.event)===null||G===void 0?void 0:G.toLocaleLowerCase();return J==="*"||J===((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 E=_.data,{schema:j,table:O,commit_timestamp:D,type:q,errors:B}=E;_=Object.assign(Object.assign({},{schema:j,table:O,commit_timestamp:D,eventType:q,new:{},old:{},errors:B}),this._getPayloadRecords(E))}S.callback(_,l)})}_isClosed(){return this.state===ht.closed}_isJoined(){return this.state===ht.joined}_isJoining(){return this.state===ht.joining}_isLeaving(){return this.state===ht.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&&Tr.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(ma.close,{},a)}_onError(a){this._on(ma.error,{},r=>a(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(a=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ht.joining,this.joinPush.resend(a))}_getPayloadRecords(a){const r={new:{},old:{}};return(a.type==="INSERT"||a.type==="UPDATE")&&(r.new=Dg(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Dg(a.columns,a.old_record)),r}}const _d=()=>{},wo={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},k1=[1e3,2e3,5e3,1e4],C1=1e4,O1=`
|
|
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 y1="2.90.1",v1=`realtime-js/${y1}`,$y="1.0.0",b1="2.0.0",Rg=$y,Gd=1e4,x1=1e3,w1=100;var Ms;(function(s){s[s.connecting=0]="connecting",s[s.open=1]="open",s[s.closing=2]="closing",s[s.closed=3]="closed"})(Ms||(Ms={}));var ht;(function(s){s.closed="closed",s.errored="errored",s.joined="joined",s.joining="joining",s.leaving="leaving"})(ht||(ht={}));var ma;(function(s){s.close="phx_close",s.error="phx_error",s.join="phx_join",s.reply="phx_reply",s.leave="phx_leave",s.access_token="access_token"})(ma||(ma={}));var Pd;(function(s){s.websocket="websocket"})(Pd||(Pd={}));var hn;(function(s){s.Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed"})(hn||(hn={}));class _1{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:"",y=(d=a.join_ref)!==null&&d!==void 0?d:"",p=a.payload.event,g=this.allowedMetadataKeys?this._pick(a.payload,this.allowedMetadataKeys):{},w=Object.keys(g).length===0?"":JSON.stringify(g);if(y.length>255)throw new Error(`joinRef length ${y.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(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(w.length>255)throw new Error(`metadata length ${w.length} exceeds maximum of 255`);const _=this.USER_BROADCAST_PUSH_META_LENGTH+y.length+m.length+h.length+p.length+w.length,S=new ArrayBuffer(this.HEADER_LENGTH+_);let E=new DataView(S),j=0;E.setUint8(j++,this.KINDS.userBroadcastPush),E.setUint8(j++,y.length),E.setUint8(j++,m.length),E.setUint8(j++,h.length),E.setUint8(j++,p.length),E.setUint8(j++,w.length),E.setUint8(j++,r),Array.from(y,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(m,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(h,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(p,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(w,D=>E.setUint8(j++,D.charCodeAt(0)));var O=new Uint8Array(S.byteLength+l.byteLength);return O.set(new Uint8Array(S),0),O.set(new Uint8Array(l),S.byteLength),O.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,y]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:y})}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 y=this.HEADER_LENGTH+4;const p=l.decode(a.slice(y,y+c));y=y+c;const g=l.decode(a.slice(y,y+d));y=y+d;const w=l.decode(a.slice(y,y+h));y=y+h;const _=a.slice(y,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(_)):_,E={type:this.BROADCAST_EVENT,event:g,payload:S};return h>0&&(E.meta=JSON.parse(w)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:E}}_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 Hy{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(s){s.abstime="abstime",s.bool="bool",s.date="date",s.daterange="daterange",s.float4="float4",s.float8="float8",s.int2="int2",s.int4="int4",s.int4range="int4range",s.int8="int8",s.int8range="int8range",s.json="json",s.jsonb="jsonb",s.money="money",s.numeric="numeric",s.oid="oid",s.reltime="reltime",s.text="text",s.time="time",s.timestamp="timestamp",s.timestamptz="timestamptz",s.timetz="timetz",s.tsrange="tsrange",s.tstzrange="tstzrange"})(Pe||(Pe={}));const Dg=(s,a,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return a?Object.keys(a).reduce((d,h)=>(d[h]=S1(h,s,a,c),d),{}):{}},S1=(s,a,r,l)=>{const c=a.find(m=>m.name===s),d=c?.type,h=r[s];return d&&!l.includes(d)?Vy(d,h):Kd(h)},Vy=(s,a)=>{if(s.charAt(0)==="_"){const r=s.slice(1,s.length);return T1(a,r)}switch(s){case Pe.bool:return j1(a);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return N1(a);case Pe.json:case Pe.jsonb:return E1(a);case Pe.timestamp:return A1(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 Kd(a);default:return Kd(a)}},Kd=s=>s,j1=s=>{switch(s){case"t":return!0;case"f":return!1;default:return s}},N1=s=>{if(typeof s=="string"){const a=parseFloat(s);if(!Number.isNaN(a))return a}return s},E1=s=>{if(typeof s=="string")try{return JSON.parse(s)}catch{return s}return s},T1=(s,a)=>{if(typeof s!="string")return s;const r=s.length-1,l=s[r];if(s[0]==="{"&&l==="}"){let d;const h=s.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Vy(a,m))}return s},A1=s=>typeof s=="string"?s.replace(" ","T"):s,Iy=s=>{const a=new URL(s);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 wd{constructor(a,r,l={},c=Gd){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 Mg;(function(s){s.SYNC="sync",s.JOIN="join",s.LEAVE="leave"})(Mg||(Mg={}));class Li{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=Li.syncState(this.state,c,d,h),this.pendingDiffs.forEach(y=>{this.state=Li.syncDiff(this.state,y,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=Li.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={},y={};return this.map(d,(p,g)=>{h[p]||(y[p]=g)}),this.map(h,(p,g)=>{const w=d[p];if(w){const _=g.map(O=>O.presence_ref),S=w.map(O=>O.presence_ref),E=g.filter(O=>S.indexOf(O.presence_ref)<0),j=w.filter(O=>_.indexOf(O.presence_ref)<0);E.length>0&&(m[p]=E),j.length>0&&(y[p]=j)}else m[p]=g}),this.syncDiff(d,{joins:m,leaves:y},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,y)=>{var p;const g=(p=a[m])!==null&&p!==void 0?p:[];if(a[m]=this.cloneDeep(y),g.length>0){const w=a[m].map(S=>S.presence_ref),_=g.filter(S=>w.indexOf(S.presence_ref)<0);a[m].unshift(..._)}l(m,g,y)}),this.map(h,(m,y)=>{let p=a[m];if(!p)return;const g=y.map(w=>w.presence_ref);p=p.filter(w=>g.indexOf(w.presence_ref)<0),a[m]=p,c(m,p,y),p.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 zg;(function(s){s.ALL="*",s.INSERT="INSERT",s.UPDATE="UPDATE",s.DELETE="DELETE"})(zg||(zg={}));var Bi;(function(s){s.BROADCAST="broadcast",s.PRESENCE="presence",s.POSTGRES_CHANGES="postgres_changes",s.SYSTEM="system"})(Bi||(Bi={}));var es;(function(s){s.SUBSCRIBED="SUBSCRIBED",s.TIMED_OUT="TIMED_OUT",s.CLOSED="CLOSED",s.CHANNEL_ERROR="CHANNEL_ERROR"})(es||(es={}));class Tr{constructor(a,r={config:{}},l){var c,d;if(this.topic=a,this.params=r,this.socket=l,this.bindings={},this.state=ht.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 wd(this,ma.join,this.params,this.timeout),this.rejoinTimer=new Hy(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ht.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=ht.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ma.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new Li(this),this.broadcastEndpointURL=Iy(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==ht.closed){const{config:{broadcast:h,presence:m,private:y}}=this.params,p=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(S=>S.filter))!==null&&c!==void 0?c:[],g=!!this.bindings[Bi.PRESENCE]&&this.bindings[Bi.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,w={},_={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:g}),postgres_changes:p,private:y};this.socket.accessTokenValue&&(w.access_token=this.socket.accessTokenValue),this._onError(S=>a?.(es.CHANNEL_ERROR,S)),this._onClose(()=>a?.(es.CLOSED)),this.updateJoinPayload(Object.assign({config:_},w)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:S})=>{var E;if(this.socket._isManualToken()||this.socket.setAuth(),S===void 0){a?.(es.SUBSCRIBED);return}else{const j=this.bindings.postgres_changes,O=(E=j?.length)!==null&&E!==void 0?E:0,D=[];for(let q=0;q<O;q++){const B=j[q],{filter:{event:G,schema:W,table:J,filter:P}}=B,Q=S&&S[q];if(Q&&Q.event===G&&Tr.isFilterValueEqual(Q.schema,W)&&Tr.isFilterValueEqual(Q.table,J)&&Tr.isFilterValueEqual(Q.filter,P))D.push(Object.assign(Object.assign({},B),{id:Q.id}));else{this.unsubscribe(),this.state=ht.errored,a?.(es.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=D,a&&a(es.SUBSCRIBED);return}}).receive("error",S=>{this.state=ht.errored,a?.(es.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{a?.(es.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===ht.joined&&a===Bi.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 y=m.statusText;try{const p=await m.json();y=p.error||p.message||y}catch{}return Promise.reject(new Error(y))}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 y={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,y,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=p.body)===null||c===void 0?void 0:c.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,y;const p=this._push(a.type,a,r.timeout||this.timeout);a.type==="broadcast"&&!(!((y=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||y===void 0)&&y.ack)&&d("ok"),p.receive("ok",()=>d("ok")),p.receive("error",()=>d("error")),p.receive("timeout",()=>d("timed out"))})}updateJoinPayload(a){this.joinPush.updatePayload(a)}unsubscribe(a=this.timeout){this.state=ht.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ma.close,"leave",this._joinRef())};this.joinPush.destroy();let l=null;return new Promise(c=>{l=new wd(this,ma.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=ht.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 wd(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>w1){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:y,leave:p,join:g}=ma;if(l&&[m,y,p,g].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 E,j,O;return((E=S.filter)===null||E===void 0?void 0:E.event)==="*"||((O=(j=S.filter)===null||j===void 0?void 0:j.event)===null||O===void 0?void 0:O.toLocaleLowerCase())===h}).map(S=>S.callback(_,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var E,j,O,D,q,B,G,W;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const J=S.id,P=(E=S.filter)===null||E===void 0?void 0:E.event;return J&&((j=r.ids)===null||j===void 0?void 0:j.includes(J))&&(P==="*"||P?.toLocaleLowerCase()===((O=r.data)===null||O===void 0?void 0:O.type.toLocaleLowerCase()))&&(!(!((D=S.filter)===null||D===void 0)&&D.table)||S.filter.table===((q=r.data)===null||q===void 0?void 0:q.table))}else{const J=(G=(B=S?.filter)===null||B===void 0?void 0:B.event)===null||G===void 0?void 0:G.toLocaleLowerCase();return J==="*"||J===((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 E=_.data,{schema:j,table:O,commit_timestamp:D,type:q,errors:B}=E;_=Object.assign(Object.assign({},{schema:j,table:O,commit_timestamp:D,eventType:q,new:{},old:{},errors:B}),this._getPayloadRecords(E))}S.callback(_,l)})}_isClosed(){return this.state===ht.closed}_isJoined(){return this.state===ht.joined}_isJoining(){return this.state===ht.joining}_isLeaving(){return this.state===ht.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&&Tr.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(ma.close,{},a)}_onError(a){this._on(ma.error,{},r=>a(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(a=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ht.joining,this.joinPush.resend(a))}_getPayloadRecords(a){const r={new:{},old:{}};return(a.type==="INSERT"||a.type==="UPDATE")&&(r.new=Dg(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Dg(a.columns,a.old_record)),r}}const _d=()=>{},wo={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},C1=[1e3,2e3,5e3,1e4],k1=1e4,O1=`
|
|
17
17
|
addEventListener("message", (e) => {
|
|
18
18
|
if (e.data.event === "start") {
|
|
19
19
|
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
@@ -31,9 +31,9 @@ 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 Ds.connecting:return hn.Connecting;case Ds.open:return hn.Open;case Ds.closing:return hn.Closing;default:return hn.Closed}}isConnected(){return this.connectionState()===hn.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 Tr(`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(x1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},wo.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===Ds.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Ds.open||this.conn.readyState===Ds.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(ma.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([O1],{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:v1};r&&c.updateJoinPayload(d),c.joinedOnce&&c._isJoined()&&c._push(ma.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 Hy(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},wo.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(a){var r,l,c,d,h,m,p,g,v,w,_,S;switch(this.transport=(r=a?.transport)!==null&&r!==void 0?r:null,this.timeout=(l=a?.timeout)!==null&&l!==void 0?l:Gd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:wo.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:_d,this.vsn=(p=a?.vsn)!==null&&p!==void 0?p:Rg,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:(E=>k1[E-1]||C1),this.vsn){case $y:this.encode=(v=a?.encode)!==null&&v!==void 0?v:((E,j)=>j(JSON.stringify(E))),this.decode=(w=a?.decode)!==null&&w!==void 0?w:((E,j)=>j(JSON.parse(E)));break;case b1: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 Gi=class extends Error{constructor(s,a){super(s),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 D1(s,a,r){const l=new URL(a,s);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function M1(s){return!s||s.type==="none"?{}:s.type==="bearer"?{Authorization:`Bearer ${s.token}`}:s.type==="header"?{[s.name]:s.value}:s.type==="custom"?await s.getHeaders():{}}function z1(s){const a=s.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=D1(s.baseUrl,l,c),p=await M1(s.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(),w=(g.headers.get("content-type")||"").includes("application/json"),_=w&&v?JSON.parse(v):v;if(!g.ok){const S=w?_:void 0,E=S?.error;throw new Gi(E?.message??`Request failed with status ${g.status}`,{status:g.status,icebergType:E?.type,icebergCode:E?.code,details:S})}return{status:g.status,headers:g.headers,data:_}}}}function _o(s){return s.join("")}var U1=class{constructor(s,a=""){this.client=s,this.prefix=a}async listNamespaces(s){const a=s?{parent:_o(s.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(s,a){const r={namespace:s.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(s){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${_o(s.namespace)}`})}async loadNamespaceMetadata(s){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_o(s.namespace)}`})).data.properties}}async namespaceExists(s){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${_o(s.namespace)}`}),!0}catch(a){if(a instanceof Gi&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(s,a){try{return await this.createNamespace(s,a)}catch(r){if(r instanceof Gi&&r.status===409)return;throw r}}};function mr(s){return s.join("")}var L1=class{constructor(s,a="",r){this.client=s,this.prefix=a,this.accessDelegation=r}async listTables(s){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables`})).data.identifiers}async createTable(s,a){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables`,body:a,headers:r})).data.metadata}async updateTable(s,a){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables/${s.name}`,body:a});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(s,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables/${s.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(s){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables/${s.name}`,headers:a})).data.metadata}async tableExists(s){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables/${s.name}`,headers:a}),!0}catch(r){if(r instanceof Gi&&r.status===404)return!1;throw r}}async createTableIfNotExists(s,a){try{return await this.createTable(s,a)}catch(r){if(r instanceof Gi&&r.status===409)return await this.loadTable({namespace:s.namespace,name:a.name});throw r}}},B1=class{constructor(s){let a="v1";s.catalogName&&(a+=`/${s.catalogName}`);const r=s.baseUrl.endsWith("/")?s.baseUrl:`${s.baseUrl}/`;this.client=z1({baseUrl:r,auth:s.auth,fetchImpl:s.fetch}),this.accessDelegation=s.accessDelegation?.join(","),this.namespaceOps=new U1(this.client,a),this.tableOps=new L1(this.client,a,this.accessDelegation)}async listNamespaces(s){return this.namespaceOps.listNamespaces(s)}async createNamespace(s,a){return this.namespaceOps.createNamespace(s,a)}async dropNamespace(s){await this.namespaceOps.dropNamespace(s)}async loadNamespaceMetadata(s){return this.namespaceOps.loadNamespaceMetadata(s)}async listTables(s){return this.tableOps.listTables(s)}async createTable(s,a){return this.tableOps.createTable(s,a)}async updateTable(s,a){return this.tableOps.updateTable(s,a)}async dropTable(s,a){await this.tableOps.dropTable(s,a)}async loadTable(s){return this.tableOps.loadTable(s)}async namespaceExists(s){return this.namespaceOps.namespaceExists(s)}async tableExists(s){return this.tableOps.tableExists(s)}async createNamespaceIfNotExists(s,a){return this.namespaceOps.createNamespaceIfNotExists(s,a)}async createTableIfNotExists(s,a){return this.tableOps.createTableIfNotExists(s,a)}},Go=class extends Error{constructor(s){super(s),this.__isStorageError=!0,this.name="StorageError"}};function Qe(s){return typeof s=="object"&&s!==null&&"__isStorageError"in s}var q1=class extends Go{constructor(s,a,r){super(s),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Yd=class extends Go{constructor(s,a){super(s),this.name="StorageUnknownError",this.originalError=a}};const df=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),$1=()=>Response,Jd=s=>{if(Array.isArray(s))return s.map(r=>Jd(r));if(typeof s=="function"||s!==Object(s))return s;const a={};return Object.entries(s).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));a[c]=Jd(l)}),a},H1=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},V1=s=>!s||typeof s!="string"||s.length===0||s.length>100||s.trim()!==s||s.includes("/")||s.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(s);function Pi(s){"@babel/helpers - typeof";return Pi=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},Pi(s)}function I1(s,a){if(Pi(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Pi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function G1(s){var a=I1(s,"string");return Pi(a)=="symbol"?a:a+""}function P1(s,a,r){return(a=G1(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Ug(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function me(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Ug(Object(r),!0).forEach(function(l){P1(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Ug(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const Sd=s=>{var a;return s.msg||s.message||s.error_description||(typeof s.error=="string"?s.error:(a=s.error)===null||a===void 0?void 0:a.message)||JSON.stringify(s)},K1=async(s,a,r)=>{s instanceof await $1()&&!r?.noResolveJson?s.json().then(l=>{const c=s.status||500,d=l?.statusCode||c+"";a(new q1(Sd(l),c,d))}).catch(l=>{a(new Yd(Sd(l),l))}):a(new Yd(Sd(s),s))},Y1=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="GET"||!l?c:(H1(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 al(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,Y1(a,l,c,d)).then(p=>{if(!p.ok)throw p;return l?.noResolveJson?p:p.json()}).then(p=>h(p)).catch(p=>K1(p,m,l))})}async function Ki(s,a,r,l){return al(s,"GET",a,r,l)}async function ha(s,a,r,l,c){return al(s,"POST",a,l,c,r)}async function Xd(s,a,r,l,c){return al(s,"PUT",a,l,c,r)}async function J1(s,a,r,l){return al(s,"HEAD",a,me(me({},r),{},{noResolveJson:!0}),l)}async function ff(s,a,r,l,c){return al(s,"DELETE",a,l,c,r)}var X1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a}then(s,a){return this.execute().then(s,a)}async execute(){var s=this;try{return{data:(await s.downloadFn()).body,error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};let Gy;Gy=Symbol.toStringTag;var Q1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a,this[Gy]="BlobDownloadBuilder",this.promise=null}asStream(){return new X1(this.downloadFn,this.shouldThrowOnError)}then(s,a){return this.getPromise().then(s,a)}catch(s){return this.getPromise().catch(s)}finally(s){return this.getPromise().finally(s)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var s=this;try{return{data:await(await s.downloadFn()).blob(),error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};const Z1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Lg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var F1=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1,this.url=s,this.headers=a,this.bucketId=r,this.fetch=df(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(s,a,r,l){var c=this;try{let d;const h=me(me({},Lg),l);let m=me(me({},c.headers),s==="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),w=await(s=="PUT"?Xd:ha)(c.fetch,`${c.url}/object/${v}`,d,me({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:g,id:w.Id,fullPath:w.Key},error:null}}catch(d){if(c.shouldThrowOnError)throw d;if(Qe(d))return{data:null,error:d};throw d}}async upload(s,a,r){return this.uploadOrUpdate("POST",s,a,r)}async uploadToSignedUrl(s,a,r,l){var c=this;const d=c._removeEmptyFolders(s),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:Lg.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 Xd(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(s,a){var r=this;try{let l=r._getFinalPath(s);const c=me({},r.headers);a?.upsert&&(c["x-upsert"]="true");const d=await ha(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 Go("No token returned by API");return{data:{signedUrl:h.toString(),path:s,token:m},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async update(s,a,r){return this.uploadOrUpdate("PUT",s,a,r)}async move(s,a,r){var l=this;try{return{data:await ha(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:s,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(s,a,r){var l=this;try{return{data:{path:(await ha(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:s,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(s,a,r){var l=this;try{let c=l._getFinalPath(s),d=await ha(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(s,a,r){var l=this;try{const c=await ha(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:a,paths:s},{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(s,a){const r=typeof a?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(a?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(s),h=()=>Ki(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new Q1(h,this.shouldThrowOnError)}async info(s){var a=this;const r=a._getFinalPath(s);try{return{data:Jd(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(s){var a=this;const r=a._getFinalPath(s);try{return await J1(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 Yd){const c=l.originalError;if([400,404].includes(c?.status))return{data:!1,error:l}}throw l}}getPublicUrl(s,a){const r=this._getFinalPath(s),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(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/object/${a.bucketId}`,{prefixes:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async list(s,a,r){var l=this;try{const c=me(me(me({},Z1),a),{},{prefix:s||""});return{data:await ha(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(s,a){var r=this;try{const l=me({},s);return{data:await ha(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(s){return JSON.stringify(s)}toBase64(s){return typeof Buffer<"u"?Buffer.from(s).toString("base64"):btoa(s)}_getFinalPath(s){return`${this.bucketId}/${s.replace(/^\/+/,"")}`}_removeEmptyFolders(s){return s.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(s){const a=[];return s.width&&a.push(`width=${s.width}`),s.height&&a.push(`height=${s.height}`),s.resize&&a.push(`resize=${s.resize}`),s.format&&a.push(`format=${s.format}`),s.quality&&a.push(`quality=${s.quality}`),a.join("&")}};const Py="2.90.1",Ky={"X-Client-Info":`storage-js/${Py}`};var W1=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1;const c=new URL(s);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({},Ky),a),this.fetch=df(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(s){var a=this;try{const r=a.listBucketOptionsToQueryString(s);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(s){var a=this;try{return{data:await Ki(a.fetch,`${a.url}/bucket/${s}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async createBucket(s,a={public:!1}){var r=this;try{return{data:await ha(r.fetch,`${r.url}/bucket`,{id:s,name:s,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(s,a){var r=this;try{return{data:await Xd(r.fetch,`${r.url}/bucket/${s}`,{id:s,name:s,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(s){var a=this;try{return{data:await ha(a.fetch,`${a.url}/bucket/${s}/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(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(s){const a={};return s&&("limit"in s&&(a.limit=String(s.limit)),"offset"in s&&(a.offset=String(s.offset)),s.search&&(a.search=s.search),s.sortColumn&&(a.sortColumn=s.sortColumn),s.sortOrder&&(a.sortOrder=s.sortOrder)),Object.keys(a).length>0?"?"+new URLSearchParams(a).toString():""}},eS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},Ky),a),this.fetch=df(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await ha(a.fetch,`${a.url}/bucket`,{name:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async listBuckets(s){var a=this;try{const r=new URLSearchParams;s?.limit!==void 0&&r.set("limit",s.limit.toString()),s?.offset!==void 0&&r.set("offset",s.offset.toString()),s?.sortColumn&&r.set("sortColumn",s.sortColumn),s?.sortOrder&&r.set("sortOrder",s.sortOrder),s?.search&&r.set("search",s.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(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}from(s){var a=this;if(!V1(s))throw new Go("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 B1({baseUrl:this.url,catalogName:s,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 hf={"X-Client-Info":`storage-js/${Py}`,"Content-Type":"application/json"};var Yy=class extends Error{constructor(s){super(s),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Xt(s){return typeof s=="object"&&s!==null&&"__isStorageVectorsError"in s}var jd=class extends Yy{constructor(s,a,r){super(s),this.name="StorageVectorsApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},tS=class extends Yy{constructor(s,a){super(s),this.name="StorageVectorsUnknownError",this.originalError=a}};const mf=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),aS=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},Bg=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),sS=async(s,a,r)=>{if(s&&typeof s=="object"&&"status"in s&&"ok"in s&&typeof s.status=="number"&&!r?.noResolveJson){const l=s.status||500,c=s;if(typeof c.json=="function")c.json().then(d=>{const h=d?.statusCode||d?.code||l+"";a(new jd(Bg(d),l,h))}).catch(()=>{const d=l+"";a(new jd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new jd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new tS(Bg(s),s))},nS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return l?(aS(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 rS(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,nS(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=>sS(p,m,l))})}async function Qt(s,a,r,l,c){return rS(s,"POST",a,l,c,r)}var iS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateIndex`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:s,indexName:a},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}async listIndexes(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListIndexes`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:s,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}},lS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(s){var a=this;try{if(s.vectors.length<1||s.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Qt(a.fetch,`${a.url}/PutVectors`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listVectors(s){var a=this;try{if(s.segmentCount!==void 0){if(s.segmentCount<1||s.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(s.segmentIndex!==void 0&&(s.segmentIndex<0||s.segmentIndex>=s.segmentCount))throw new Error(`segmentIndex must be between 0 and ${s.segmentCount-1}`)}return{data:await Qt(a.fetch,`${a.url}/ListVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async queryVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/QueryVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteVectors(s){var a=this;try{if(s.keys.length<1||s.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Qt(a.fetch,`${a.url}/DeleteVectors`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},oS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listBuckets(s={}){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListVectorBuckets`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},cS=class extends oS{constructor(s,a={}){super(s,a.headers||{},a.fetch)}from(s){return new uS(this.url,this.headers,s,this.fetch)}async createBucket(s){var a=()=>super.createBucket,r=this;return a().call(r,s)}async getBucket(s){var a=()=>super.getBucket,r=this;return a().call(r,s)}async listBuckets(s={}){var a=()=>super.listBuckets,r=this;return a().call(r,s)}async deleteBucket(s){var a=()=>super.deleteBucket,r=this;return a().call(r,s)}},uS=class extends iS{constructor(s,a,r,l){super(s,a,l),this.vectorBucketName=r}async createIndex(s){var a=()=>super.createIndex,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(s={}){var a=()=>super.listIndexes,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(s){var a=()=>super.getIndex,r=this;return a().call(r,r.vectorBucketName,s)}async deleteIndex(s){var a=()=>super.deleteIndex,r=this;return a().call(r,r.vectorBucketName,s)}index(s){return new dS(this.url,this.headers,this.vectorBucketName,s,this.fetch)}},dS=class extends lS{constructor(s,a,r,l,c){super(s,a,c),this.vectorBucketName=r,this.indexName=l}async putVectors(s){var a=()=>super.putVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(s){var a=()=>super.getVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(s={}){var a=()=>super.listVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(s){var a=()=>super.queryVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(s){var a=()=>super.deleteVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},fS=class extends W1{constructor(s,a={},r,l){super(s,a,r,l)}from(s){return new F1(this.url,this.headers,s,this.fetch)}get vectors(){return new cS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new eS(this.url+"/iceberg",this.headers,this.fetch)}};const Jy="2.90.1",jr=30*1e3,Qd=3,Nd=Qd*jr,hS="http://localhost:9999",mS="supabase.auth.token",pS={"X-Client-Info":`gotrue-js/${Jy}`},Zd="X-Supabase-Api-Version",Xy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},gS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,yS=600*1e3;class Yi extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function le(s){return typeof s=="object"&&s!==null&&"__isAuthError"in s}class vS extends Yi{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function bS(s){return le(s)&&s.name==="AuthApiError"}class mn extends Yi{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class ts extends Yi{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Jt extends ts{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function xS(s){return le(s)&&s.name==="AuthSessionMissingError"}class pr extends ts{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class So extends ts{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class jo extends ts{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 wS(s){return le(s)&&s.name==="AuthImplicitGrantRedirectError"}class qg extends ts{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 _S extends ts{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 Fd extends ts{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function Ed(s){return le(s)&&s.name==="AuthRetryableFetchError"}class $g extends ts{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Wd extends ts{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const qo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Hg=`
|
|
35
|
-
\r=`.split(""),SS=(()=>{const s=new Array(128);for(let a=0;a<s.length;a+=1)s[a]=-1;for(let a=0;a<Hg.length;a+=1)s[Hg[a].charCodeAt(0)]=-2;for(let a=0;a<qo.length;a+=1)s[qo[a].charCodeAt(0)]=a;return s})();function Vg(s,a,r){if(s!==null)for(a.queue=a.queue<<8|s,a.queuedBits+=8;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(qo[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(qo[l]),a.queuedBits-=6}}function Qy(s,a,r){const l=SS[s];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(s)}"`)}}function Ig(s){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{ES(h,l,r)};for(let h=0;h<s.length;h+=1)Qy(s.charCodeAt(h),c,d);return a.join("")}function jS(s,a){if(s<=127){a(s);return}else if(s<=2047){a(192|s>>6),a(128|s&63);return}else if(s<=65535){a(224|s>>12),a(128|s>>6&63),a(128|s&63);return}else if(s<=1114111){a(240|s>>18),a(128|s>>12&63),a(128|s>>6&63),a(128|s&63);return}throw new Error(`Unrecognized Unicode codepoint: ${s.toString(16)}`)}function NS(s,a){for(let r=0;r<s.length;r+=1){let l=s.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(s.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}jS(l,a)}}function ES(s,a,r){if(a.utf8seq===0){if(s<=127){r(s);return}for(let l=1;l<6;l+=1)if((s>>7-l&1)===0){a.utf8seq=l;break}if(a.utf8seq===2)a.codepoint=s&31;else if(a.utf8seq===3)a.codepoint=s&15;else if(a.utf8seq===4)a.codepoint=s&7;else throw new Error("Invalid UTF-8 sequence");a.utf8seq-=1}else if(a.utf8seq>0){if(s<=127)throw new Error("Invalid UTF-8 sequence");a.codepoint=a.codepoint<<6|s&63,a.utf8seq-=1,a.utf8seq===0&&r(a.codepoint)}}function Ar(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<s.length;c+=1)Qy(s.charCodeAt(c),r,l);return new Uint8Array(a)}function TS(s){const a=[];return NS(s,r=>a.push(r)),new Uint8Array(a)}function pn(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};return s.forEach(c=>Vg(c,r,l)),Vg(null,r,l),a.join("")}function AS(s){return Math.round(Date.now()/1e3)+s}function kS(){return Symbol("auth-callback")}const Tt=()=>typeof window<"u"&&typeof document<"u",un={tested:!1,writable:!1},Zy=()=>{if(!Tt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(un.tested)return un.writable;const s=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(s,s),globalThis.localStorage.removeItem(s),un.tested=!0,un.writable=!0}catch{un.tested=!0,un.writable=!1}return un.writable};function CS(s){const a={},r=new URL(s);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 Fy=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),OS=s=>typeof s=="object"&&s!==null&&"status"in s&&"ok"in s&&"json"in s&&typeof s.json=="function",Nr=async(s,a,r)=>{await s.setItem(a,JSON.stringify(r))},dn=async(s,a)=>{const r=await s.getItem(a);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Et=async(s,a)=>{await s.removeItem(a)};class Po{constructor(){this.promise=new Po.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}Po.promiseConstructor=Promise;function Td(s){const a=s.split(".");if(a.length!==3)throw new Wd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!gS.test(a[l]))throw new Wd("JWT not in base64url format");return{header:JSON.parse(Ig(a[0])),payload:JSON.parse(Ig(a[1])),signature:Ar(a[2]),raw:{header:a[0],payload:a[1]}}}async function RS(s){return await new Promise(a=>{setTimeout(()=>a(null),s)})}function DS(s,a){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await s(d);if(!a(d,null,h)){l(h);return}}catch(h){if(!a(d,h)){c(h);return}}})()})}function MS(s){return("0"+s.toString(16)).substr(-2)}function zS(){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,MS).join("")}async function US(s){const r=new TextEncoder().encode(s),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function LS(s){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."),s;const r=await US(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function gr(s,a,r=!1){const l=zS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await Nr(s,`${a}-code-verifier`,c);const d=await LS(l);return[d,l===d?"plain":"s256"]}const BS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function qS(s){const a=s.headers.get(Zd);if(!a||!a.match(BS))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function $S(s){if(!s)throw new Error("Missing exp claim");const a=Math.floor(Date.now()/1e3);if(s<=a)throw new Error("JWT has expired")}function HS(s){switch(s){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 VS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function yr(s){if(!VS.test(s))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ad(){const s={};return new Proxy(s,{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 IS(s,a){return new Proxy(s,{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 Gg(s){return JSON.parse(JSON.stringify(s))}const fn=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),GS=[502,503,504];async function Pg(s){var a;if(!OS(s))throw new Fd(fn(s),0);if(GS.includes(s.status))throw new Fd(fn(s),s.status);let r;try{r=await s.json()}catch(d){throw new mn(fn(d),d)}let l;const c=qS(s);if(c&&c.getTime()>=Xy["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 $g(fn(r),s.status,((a=r.weak_password)===null||a===void 0?void 0:a.reasons)||[]);if(l==="session_not_found")throw new Jt}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 $g(fn(r),s.status,r.weak_password.reasons);throw new vS(fn(r),s.status||500,l)}const PS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="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(s,a,r,l){var c;const d=Object.assign({},l?.headers);d[Zd]||(d[Zd]=Xy["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 KS(s,a,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(p):{data:Object.assign({},p),error:null}}async function KS(s,a,r,l,c,d){const h=PS(a,l,c,d);let m;try{m=await s(r,Object.assign({},h))}catch(p){throw console.error(p),new Fd(fn(p),0)}if(m.ok||await Pg(m),l?.noResolveJson)return m;try{return await m.json()}catch(p){await Pg(p)}}function fa(s){var a;let r=null;XS(s)&&(r=Object.assign({},s),s.expires_at||(r.expires_at=AS(s.expires_in)));const l=(a=s.user)!==null&&a!==void 0?a:s;return{data:{session:r,user:l},error:null}}function Kg(s){const a=fa(s);return!a.error&&s.weak_password&&typeof s.weak_password=="object"&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.message&&typeof s.weak_password.message=="string"&&s.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(a.data.weak_password=s.weak_password),a}function Ms(s){var a;return{data:{user:(a=s.user)!==null&&a!==void 0?a:s},error:null}}function YS(s){return{data:s,error:null}}function JS(s){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=s,h=Ur(s,["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 Yg(s){return s}function XS(s){return s.access_token&&s.refresh_token&&s.expires_in}const kd=["global","local","others"];class QS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Fy(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=kd[0]){if(kd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${kd.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:Ms})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Ur(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:JS,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:Ms})}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:Yg});if(v.error)throw v.error;const w=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(E=>{const j=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),O=JSON.parse(E.split(";")[1].split("=")[1]);g[`${O}Page`]=j}),g.total=parseInt(_)),{data:Object.assign(Object.assign({},w),g),error:null}}catch(g){if(le(g))return{data:{users:[]},error:g};throw g}}async getUserById(a){yr(a);try{return await he(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:Ms})}catch(r){if(le(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){yr(a);try{return await he(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:Ms})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){yr(a);try{return await he(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ms})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){yr(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){yr(a.userId),yr(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:Yg});if(v.error)throw v.error;const w=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(E=>{const j=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),O=JSON.parse(E.split(";")[1].split("=")[1]);g[`${O}Page`]=j}),g.total=parseInt(_)),{data:Object.assign(Object.assign({},w),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 Jg(s={}){return{getItem:a=>s[a]||null,setItem:(a,r)=>{s[a]=r},removeItem:a=>{delete s[a]}}}const vr={debug:!!(globalThis&&Zy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Wy extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class ZS extends Wy{}async function FS(s,a,r){vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",s,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),vr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",s)},a),await Promise.resolve().then(()=>globalThis.navigator.locks.request(s,a===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:l.signal},async c=>{if(c){vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",s,c.name);try{return await r()}finally{vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",s,c.name)}}else{if(a===0)throw vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",s),new ZS(`Acquiring an exclusive Navigator LockManager lock "${s}" immediately failed`);if(vr.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 WS(){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 ev(s){if(!/^0x[a-fA-F0-9]{40}$/.test(s))throw new Error(`@supabase/auth-js: Address "${s}" is invalid.`);return s.toLowerCase()}function ej(s){return parseInt(s,16)}function tj(s){const a=new TextEncoder().encode(s);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function aj(s){var a;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:p,resources:g,scheme:v,uri:w,version:_}=s;{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(!w)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=s.statement)===null||a===void 0)&&a.includes(`
|
|
36
|
-
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${s.statement}`)}const S=ev(s.address),E=
|
|
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 Ms.connecting:return hn.Connecting;case Ms.open:return hn.Open;case Ms.closing:return hn.Closing;default:return hn.Closed}}isConnected(){return this.connectionState()===hn.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 Tr(`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 y;(y=this.conn)===null||y===void 0||y.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(x1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},wo.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 p=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",p)}catch(g){this.log("error","error in heartbeat callback",g)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:l,event:c,payload:d,ref:h}=r,m=h?`(${h})`:"",y=d.status||"";this.log("receive",`${y} ${l} ${c} ${m}`.trim(),d),this.channels.filter(p=>p._isMember(l)).forEach(p=>p._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===Ms.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Ms.open||this.conn.readyState===Ms.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(ma.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([O1],{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:v1};r&&c.updateJoinPayload(d),c.joinedOnce&&c._isJoined()&&c._push(ma.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 Hy(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},wo.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(a){var r,l,c,d,h,m,y,p,g,w,_,S;switch(this.transport=(r=a?.transport)!==null&&r!==void 0?r:null,this.timeout=(l=a?.timeout)!==null&&l!==void 0?l:Gd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:wo.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:_d,this.vsn=(y=a?.vsn)!==null&&y!==void 0?y:Rg,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=(p=a?.reconnectAfterMs)!==null&&p!==void 0?p:(E=>C1[E-1]||k1),this.vsn){case $y:this.encode=(g=a?.encode)!==null&&g!==void 0?g:((E,j)=>j(JSON.stringify(E))),this.decode=(w=a?.decode)!==null&&w!==void 0?w:((E,j)=>j(JSON.parse(E)));break;case b1: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 Gi=class extends Error{constructor(s,a){super(s),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 D1(s,a,r){const l=new URL(a,s);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function M1(s){return!s||s.type==="none"?{}:s.type==="bearer"?{Authorization:`Bearer ${s.token}`}:s.type==="header"?{[s.name]:s.value}:s.type==="custom"?await s.getHeaders():{}}function z1(s){const a=s.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=D1(s.baseUrl,l,c),y=await M1(s.auth),p=await a(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...y,...h},body:d?JSON.stringify(d):void 0}),g=await p.text(),w=(p.headers.get("content-type")||"").includes("application/json"),_=w&&g?JSON.parse(g):g;if(!p.ok){const S=w?_:void 0,E=S?.error;throw new Gi(E?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:E?.type,icebergCode:E?.code,details:S})}return{status:p.status,headers:p.headers,data:_}}}}function _o(s){return s.join("")}var U1=class{constructor(s,a=""){this.client=s,this.prefix=a}async listNamespaces(s){const a=s?{parent:_o(s.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(s,a){const r={namespace:s.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(s){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${_o(s.namespace)}`})}async loadNamespaceMetadata(s){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_o(s.namespace)}`})).data.properties}}async namespaceExists(s){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${_o(s.namespace)}`}),!0}catch(a){if(a instanceof Gi&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(s,a){try{return await this.createNamespace(s,a)}catch(r){if(r instanceof Gi&&r.status===409)return;throw r}}};function mr(s){return s.join("")}var L1=class{constructor(s,a="",r){this.client=s,this.prefix=a,this.accessDelegation=r}async listTables(s){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables`})).data.identifiers}async createTable(s,a){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables`,body:a,headers:r})).data.metadata}async updateTable(s,a){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables/${s.name}`,body:a});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(s,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables/${s.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(s){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables/${s.name}`,headers:a})).data.metadata}async tableExists(s){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${mr(s.namespace)}/tables/${s.name}`,headers:a}),!0}catch(r){if(r instanceof Gi&&r.status===404)return!1;throw r}}async createTableIfNotExists(s,a){try{return await this.createTable(s,a)}catch(r){if(r instanceof Gi&&r.status===409)return await this.loadTable({namespace:s.namespace,name:a.name});throw r}}},B1=class{constructor(s){let a="v1";s.catalogName&&(a+=`/${s.catalogName}`);const r=s.baseUrl.endsWith("/")?s.baseUrl:`${s.baseUrl}/`;this.client=z1({baseUrl:r,auth:s.auth,fetchImpl:s.fetch}),this.accessDelegation=s.accessDelegation?.join(","),this.namespaceOps=new U1(this.client,a),this.tableOps=new L1(this.client,a,this.accessDelegation)}async listNamespaces(s){return this.namespaceOps.listNamespaces(s)}async createNamespace(s,a){return this.namespaceOps.createNamespace(s,a)}async dropNamespace(s){await this.namespaceOps.dropNamespace(s)}async loadNamespaceMetadata(s){return this.namespaceOps.loadNamespaceMetadata(s)}async listTables(s){return this.tableOps.listTables(s)}async createTable(s,a){return this.tableOps.createTable(s,a)}async updateTable(s,a){return this.tableOps.updateTable(s,a)}async dropTable(s,a){await this.tableOps.dropTable(s,a)}async loadTable(s){return this.tableOps.loadTable(s)}async namespaceExists(s){return this.namespaceOps.namespaceExists(s)}async tableExists(s){return this.tableOps.tableExists(s)}async createNamespaceIfNotExists(s,a){return this.namespaceOps.createNamespaceIfNotExists(s,a)}async createTableIfNotExists(s,a){return this.tableOps.createTableIfNotExists(s,a)}},Go=class extends Error{constructor(s){super(s),this.__isStorageError=!0,this.name="StorageError"}};function Qe(s){return typeof s=="object"&&s!==null&&"__isStorageError"in s}var q1=class extends Go{constructor(s,a,r){super(s),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Yd=class extends Go{constructor(s,a){super(s),this.name="StorageUnknownError",this.originalError=a}};const df=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),$1=()=>Response,Jd=s=>{if(Array.isArray(s))return s.map(r=>Jd(r));if(typeof s=="function"||s!==Object(s))return s;const a={};return Object.entries(s).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));a[c]=Jd(l)}),a},H1=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},V1=s=>!s||typeof s!="string"||s.length===0||s.length>100||s.trim()!==s||s.includes("/")||s.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(s);function Pi(s){"@babel/helpers - typeof";return Pi=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},Pi(s)}function I1(s,a){if(Pi(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Pi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function G1(s){var a=I1(s,"string");return Pi(a)=="symbol"?a:a+""}function P1(s,a,r){return(a=G1(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Ug(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function me(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Ug(Object(r),!0).forEach(function(l){P1(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Ug(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const Sd=s=>{var a;return s.msg||s.message||s.error_description||(typeof s.error=="string"?s.error:(a=s.error)===null||a===void 0?void 0:a.message)||JSON.stringify(s)},K1=async(s,a,r)=>{s instanceof await $1()&&!r?.noResolveJson?s.json().then(l=>{const c=s.status||500,d=l?.statusCode||c+"";a(new q1(Sd(l),c,d))}).catch(l=>{a(new Yd(Sd(l),l))}):a(new Yd(Sd(s),s))},Y1=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="GET"||!l?c:(H1(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 al(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,Y1(a,l,c,d)).then(y=>{if(!y.ok)throw y;return l?.noResolveJson?y:y.json()}).then(y=>h(y)).catch(y=>K1(y,m,l))})}async function Ki(s,a,r,l){return al(s,"GET",a,r,l)}async function ha(s,a,r,l,c){return al(s,"POST",a,l,c,r)}async function Xd(s,a,r,l,c){return al(s,"PUT",a,l,c,r)}async function J1(s,a,r,l){return al(s,"HEAD",a,me(me({},r),{},{noResolveJson:!0}),l)}async function ff(s,a,r,l,c){return al(s,"DELETE",a,l,c,r)}var X1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a}then(s,a){return this.execute().then(s,a)}async execute(){var s=this;try{return{data:(await s.downloadFn()).body,error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};let Gy;Gy=Symbol.toStringTag;var Q1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a,this[Gy]="BlobDownloadBuilder",this.promise=null}asStream(){return new X1(this.downloadFn,this.shouldThrowOnError)}then(s,a){return this.getPromise().then(s,a)}catch(s){return this.getPromise().catch(s)}finally(s){return this.getPromise().finally(s)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var s=this;try{return{data:await(await s.downloadFn()).blob(),error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};const Z1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Lg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var F1=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1,this.url=s,this.headers=a,this.bucketId=r,this.fetch=df(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(s,a,r,l){var c=this;try{let d;const h=me(me({},Lg),l);let m=me(me({},c.headers),s==="POST"&&{"x-upsert":String(h.upsert)});const y=h.metadata;typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),y&&d.append("metadata",c.encodeMetadata(y)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),y&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(y))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,y&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(y))),(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 p=c._removeEmptyFolders(a),g=c._getFinalPath(p),w=await(s=="PUT"?Xd:ha)(c.fetch,`${c.url}/object/${g}`,d,me({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:p,id:w.Id,fullPath:w.Key},error:null}}catch(d){if(c.shouldThrowOnError)throw d;if(Qe(d))return{data:null,error:d};throw d}}async upload(s,a,r){return this.uploadOrUpdate("POST",s,a,r)}async uploadToSignedUrl(s,a,r,l){var c=this;const d=c._removeEmptyFolders(s),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);m.searchParams.set("token",a);try{let y;const p=me({upsert:Lg.upsert},l),g=me(me({},c.headers),{"x-upsert":String(p.upsert)});return typeof Blob<"u"&&r instanceof Blob?(y=new FormData,y.append("cacheControl",p.cacheControl),y.append("",r)):typeof FormData<"u"&&r instanceof FormData?(y=r,y.append("cacheControl",p.cacheControl)):(y=r,g["cache-control"]=`max-age=${p.cacheControl}`,g["content-type"]=p.contentType),{data:{path:d,fullPath:(await Xd(c.fetch,m.toString(),y,{headers:g})).Key},error:null}}catch(y){if(c.shouldThrowOnError)throw y;if(Qe(y))return{data:null,error:y};throw y}}async createSignedUploadUrl(s,a){var r=this;try{let l=r._getFinalPath(s);const c=me({},r.headers);a?.upsert&&(c["x-upsert"]="true");const d=await ha(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 Go("No token returned by API");return{data:{signedUrl:h.toString(),path:s,token:m},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async update(s,a,r){return this.uploadOrUpdate("PUT",s,a,r)}async move(s,a,r){var l=this;try{return{data:await ha(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:s,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(s,a,r){var l=this;try{return{data:{path:(await ha(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:s,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(s,a,r){var l=this;try{let c=l._getFinalPath(s),d=await ha(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(s,a,r){var l=this;try{const c=await ha(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:a,paths:s},{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(s,a){const r=typeof a?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(a?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(s),h=()=>Ki(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new Q1(h,this.shouldThrowOnError)}async info(s){var a=this;const r=a._getFinalPath(s);try{return{data:Jd(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(s){var a=this;const r=a._getFinalPath(s);try{return await J1(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 Yd){const c=l.originalError;if([400,404].includes(c?.status))return{data:!1,error:l}}throw l}}getPublicUrl(s,a){const r=this._getFinalPath(s),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(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/object/${a.bucketId}`,{prefixes:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async list(s,a,r){var l=this;try{const c=me(me(me({},Z1),a),{},{prefix:s||""});return{data:await ha(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(s,a){var r=this;try{const l=me({},s);return{data:await ha(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(s){return JSON.stringify(s)}toBase64(s){return typeof Buffer<"u"?Buffer.from(s).toString("base64"):btoa(s)}_getFinalPath(s){return`${this.bucketId}/${s.replace(/^\/+/,"")}`}_removeEmptyFolders(s){return s.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(s){const a=[];return s.width&&a.push(`width=${s.width}`),s.height&&a.push(`height=${s.height}`),s.resize&&a.push(`resize=${s.resize}`),s.format&&a.push(`format=${s.format}`),s.quality&&a.push(`quality=${s.quality}`),a.join("&")}};const Py="2.90.1",Ky={"X-Client-Info":`storage-js/${Py}`};var W1=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1;const c=new URL(s);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({},Ky),a),this.fetch=df(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(s){var a=this;try{const r=a.listBucketOptionsToQueryString(s);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(s){var a=this;try{return{data:await Ki(a.fetch,`${a.url}/bucket/${s}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async createBucket(s,a={public:!1}){var r=this;try{return{data:await ha(r.fetch,`${r.url}/bucket`,{id:s,name:s,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(s,a){var r=this;try{return{data:await Xd(r.fetch,`${r.url}/bucket/${s}`,{id:s,name:s,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(s){var a=this;try{return{data:await ha(a.fetch,`${a.url}/bucket/${s}/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(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(s){const a={};return s&&("limit"in s&&(a.limit=String(s.limit)),"offset"in s&&(a.offset=String(s.offset)),s.search&&(a.search=s.search),s.sortColumn&&(a.sortColumn=s.sortColumn),s.sortOrder&&(a.sortOrder=s.sortOrder)),Object.keys(a).length>0?"?"+new URLSearchParams(a).toString():""}},eS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},Ky),a),this.fetch=df(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await ha(a.fetch,`${a.url}/bucket`,{name:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async listBuckets(s){var a=this;try{const r=new URLSearchParams;s?.limit!==void 0&&r.set("limit",s.limit.toString()),s?.offset!==void 0&&r.set("offset",s.offset.toString()),s?.sortColumn&&r.set("sortColumn",s.sortColumn),s?.sortOrder&&r.set("sortOrder",s.sortOrder),s?.search&&r.set("search",s.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(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}from(s){var a=this;if(!V1(s))throw new Go("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 B1({baseUrl:this.url,catalogName:s,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(y){if(l)throw y;return{data:null,error:y}}}}})}};const hf={"X-Client-Info":`storage-js/${Py}`,"Content-Type":"application/json"};var Yy=class extends Error{constructor(s){super(s),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Xt(s){return typeof s=="object"&&s!==null&&"__isStorageVectorsError"in s}var jd=class extends Yy{constructor(s,a,r){super(s),this.name="StorageVectorsApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},tS=class extends Yy{constructor(s,a){super(s),this.name="StorageVectorsUnknownError",this.originalError=a}};const mf=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),aS=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},Bg=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),sS=async(s,a,r)=>{if(s&&typeof s=="object"&&"status"in s&&"ok"in s&&typeof s.status=="number"&&!r?.noResolveJson){const l=s.status||500,c=s;if(typeof c.json=="function")c.json().then(d=>{const h=d?.statusCode||d?.code||l+"";a(new jd(Bg(d),l,h))}).catch(()=>{const d=l+"";a(new jd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new jd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new tS(Bg(s),s))},nS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return l?(aS(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 rS(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,nS(a,l,c,d)).then(y=>{if(!y.ok)throw y;if(l?.noResolveJson)return y;const p=y.headers.get("content-type");return!p||!p.includes("application/json")?{}:y.json()}).then(y=>h(y)).catch(y=>sS(y,m,l))})}async function Qt(s,a,r,l,c){return rS(s,"POST",a,l,c,r)}var iS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateIndex`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:s,indexName:a},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}async listIndexes(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListIndexes`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:s,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}},lS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(s){var a=this;try{if(s.vectors.length<1||s.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Qt(a.fetch,`${a.url}/PutVectors`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listVectors(s){var a=this;try{if(s.segmentCount!==void 0){if(s.segmentCount<1||s.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(s.segmentIndex!==void 0&&(s.segmentIndex<0||s.segmentIndex>=s.segmentCount))throw new Error(`segmentIndex must be between 0 and ${s.segmentCount-1}`)}return{data:await Qt(a.fetch,`${a.url}/ListVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async queryVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/QueryVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteVectors(s){var a=this;try{if(s.keys.length<1||s.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Qt(a.fetch,`${a.url}/DeleteVectors`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},oS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listBuckets(s={}){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListVectorBuckets`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},cS=class extends oS{constructor(s,a={}){super(s,a.headers||{},a.fetch)}from(s){return new uS(this.url,this.headers,s,this.fetch)}async createBucket(s){var a=()=>super.createBucket,r=this;return a().call(r,s)}async getBucket(s){var a=()=>super.getBucket,r=this;return a().call(r,s)}async listBuckets(s={}){var a=()=>super.listBuckets,r=this;return a().call(r,s)}async deleteBucket(s){var a=()=>super.deleteBucket,r=this;return a().call(r,s)}},uS=class extends iS{constructor(s,a,r,l){super(s,a,l),this.vectorBucketName=r}async createIndex(s){var a=()=>super.createIndex,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(s={}){var a=()=>super.listIndexes,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(s){var a=()=>super.getIndex,r=this;return a().call(r,r.vectorBucketName,s)}async deleteIndex(s){var a=()=>super.deleteIndex,r=this;return a().call(r,r.vectorBucketName,s)}index(s){return new dS(this.url,this.headers,this.vectorBucketName,s,this.fetch)}},dS=class extends lS{constructor(s,a,r,l,c){super(s,a,c),this.vectorBucketName=r,this.indexName=l}async putVectors(s){var a=()=>super.putVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(s){var a=()=>super.getVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(s={}){var a=()=>super.listVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(s){var a=()=>super.queryVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(s){var a=()=>super.deleteVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},fS=class extends W1{constructor(s,a={},r,l){super(s,a,r,l)}from(s){return new F1(this.url,this.headers,s,this.fetch)}get vectors(){return new cS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new eS(this.url+"/iceberg",this.headers,this.fetch)}};const Jy="2.90.1",jr=30*1e3,Qd=3,Nd=Qd*jr,hS="http://localhost:9999",mS="supabase.auth.token",pS={"X-Client-Info":`gotrue-js/${Jy}`},Zd="X-Supabase-Api-Version",Xy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},gS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,yS=600*1e3;class Yi extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function le(s){return typeof s=="object"&&s!==null&&"__isAuthError"in s}class vS extends Yi{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function bS(s){return le(s)&&s.name==="AuthApiError"}class mn extends Yi{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class as extends Yi{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Jt extends as{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function xS(s){return le(s)&&s.name==="AuthSessionMissingError"}class pr extends as{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class So extends as{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class jo extends as{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 wS(s){return le(s)&&s.name==="AuthImplicitGrantRedirectError"}class qg extends as{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 _S extends as{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 Fd extends as{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function Ed(s){return le(s)&&s.name==="AuthRetryableFetchError"}class $g extends as{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Wd extends as{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const qo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Hg=`
|
|
35
|
+
\r=`.split(""),SS=(()=>{const s=new Array(128);for(let a=0;a<s.length;a+=1)s[a]=-1;for(let a=0;a<Hg.length;a+=1)s[Hg[a].charCodeAt(0)]=-2;for(let a=0;a<qo.length;a+=1)s[qo[a].charCodeAt(0)]=a;return s})();function Vg(s,a,r){if(s!==null)for(a.queue=a.queue<<8|s,a.queuedBits+=8;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(qo[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(qo[l]),a.queuedBits-=6}}function Qy(s,a,r){const l=SS[s];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(s)}"`)}}function Ig(s){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{ES(h,l,r)};for(let h=0;h<s.length;h+=1)Qy(s.charCodeAt(h),c,d);return a.join("")}function jS(s,a){if(s<=127){a(s);return}else if(s<=2047){a(192|s>>6),a(128|s&63);return}else if(s<=65535){a(224|s>>12),a(128|s>>6&63),a(128|s&63);return}else if(s<=1114111){a(240|s>>18),a(128|s>>12&63),a(128|s>>6&63),a(128|s&63);return}throw new Error(`Unrecognized Unicode codepoint: ${s.toString(16)}`)}function NS(s,a){for(let r=0;r<s.length;r+=1){let l=s.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(s.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}jS(l,a)}}function ES(s,a,r){if(a.utf8seq===0){if(s<=127){r(s);return}for(let l=1;l<6;l+=1)if((s>>7-l&1)===0){a.utf8seq=l;break}if(a.utf8seq===2)a.codepoint=s&31;else if(a.utf8seq===3)a.codepoint=s&15;else if(a.utf8seq===4)a.codepoint=s&7;else throw new Error("Invalid UTF-8 sequence");a.utf8seq-=1}else if(a.utf8seq>0){if(s<=127)throw new Error("Invalid UTF-8 sequence");a.codepoint=a.codepoint<<6|s&63,a.utf8seq-=1,a.utf8seq===0&&r(a.codepoint)}}function Ar(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<s.length;c+=1)Qy(s.charCodeAt(c),r,l);return new Uint8Array(a)}function TS(s){const a=[];return NS(s,r=>a.push(r)),new Uint8Array(a)}function pn(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};return s.forEach(c=>Vg(c,r,l)),Vg(null,r,l),a.join("")}function AS(s){return Math.round(Date.now()/1e3)+s}function CS(){return Symbol("auth-callback")}const Tt=()=>typeof window<"u"&&typeof document<"u",un={tested:!1,writable:!1},Zy=()=>{if(!Tt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(un.tested)return un.writable;const s=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(s,s),globalThis.localStorage.removeItem(s),un.tested=!0,un.writable=!0}catch{un.tested=!0,un.writable=!1}return un.writable};function kS(s){const a={},r=new URL(s);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 Fy=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),OS=s=>typeof s=="object"&&s!==null&&"status"in s&&"ok"in s&&"json"in s&&typeof s.json=="function",Nr=async(s,a,r)=>{await s.setItem(a,JSON.stringify(r))},dn=async(s,a)=>{const r=await s.getItem(a);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Et=async(s,a)=>{await s.removeItem(a)};class Po{constructor(){this.promise=new Po.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}Po.promiseConstructor=Promise;function Td(s){const a=s.split(".");if(a.length!==3)throw new Wd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!gS.test(a[l]))throw new Wd("JWT not in base64url format");return{header:JSON.parse(Ig(a[0])),payload:JSON.parse(Ig(a[1])),signature:Ar(a[2]),raw:{header:a[0],payload:a[1]}}}async function RS(s){return await new Promise(a=>{setTimeout(()=>a(null),s)})}function DS(s,a){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await s(d);if(!a(d,null,h)){l(h);return}}catch(h){if(!a(d,h)){c(h);return}}})()})}function MS(s){return("0"+s.toString(16)).substr(-2)}function zS(){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,MS).join("")}async function US(s){const r=new TextEncoder().encode(s),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function LS(s){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."),s;const r=await US(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function gr(s,a,r=!1){const l=zS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await Nr(s,`${a}-code-verifier`,c);const d=await LS(l);return[d,l===d?"plain":"s256"]}const BS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function qS(s){const a=s.headers.get(Zd);if(!a||!a.match(BS))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function $S(s){if(!s)throw new Error("Missing exp claim");const a=Math.floor(Date.now()/1e3);if(s<=a)throw new Error("JWT has expired")}function HS(s){switch(s){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 VS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function yr(s){if(!VS.test(s))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ad(){const s={};return new Proxy(s,{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 IS(s,a){return new Proxy(s,{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 Gg(s){return JSON.parse(JSON.stringify(s))}const fn=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),GS=[502,503,504];async function Pg(s){var a;if(!OS(s))throw new Fd(fn(s),0);if(GS.includes(s.status))throw new Fd(fn(s),s.status);let r;try{r=await s.json()}catch(d){throw new mn(fn(d),d)}let l;const c=qS(s);if(c&&c.getTime()>=Xy["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 $g(fn(r),s.status,((a=r.weak_password)===null||a===void 0?void 0:a.reasons)||[]);if(l==="session_not_found")throw new Jt}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 $g(fn(r),s.status,r.weak_password.reasons);throw new vS(fn(r),s.status||500,l)}const PS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="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(s,a,r,l){var c;const d=Object.assign({},l?.headers);d[Zd]||(d[Zd]=Xy["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():"",y=await KS(s,a,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(y):{data:Object.assign({},y),error:null}}async function KS(s,a,r,l,c,d){const h=PS(a,l,c,d);let m;try{m=await s(r,Object.assign({},h))}catch(y){throw console.error(y),new Fd(fn(y),0)}if(m.ok||await Pg(m),l?.noResolveJson)return m;try{return await m.json()}catch(y){await Pg(y)}}function fa(s){var a;let r=null;XS(s)&&(r=Object.assign({},s),s.expires_at||(r.expires_at=AS(s.expires_in)));const l=(a=s.user)!==null&&a!==void 0?a:s;return{data:{session:r,user:l},error:null}}function Kg(s){const a=fa(s);return!a.error&&s.weak_password&&typeof s.weak_password=="object"&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.message&&typeof s.weak_password.message=="string"&&s.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(a.data.weak_password=s.weak_password),a}function zs(s){var a;return{data:{user:(a=s.user)!==null&&a!==void 0?a:s},error:null}}function YS(s){return{data:s,error:null}}function JS(s){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=s,h=Ur(s,["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},y=Object.assign({},h);return{data:{properties:m,user:y},error:null}}function Yg(s){return s}function XS(s){return s.access_token&&s.refresh_token&&s.expires_in}const Cd=["global","local","others"];class QS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Fy(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=Cd[0]){if(Cd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Cd.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:zs})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Ur(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:JS,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:zs})}catch(r){if(le(r))return{data:{user:null},error:r};throw r}}async listUsers(a){var r,l,c,d,h,m,y;try{const p={nextPage:null,lastPage:0,total:0},g=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:Yg});if(g.error)throw g.error;const w=await g.json(),_=(h=g.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(y=(m=g.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&y!==void 0?y:[];return S.length>0&&(S.forEach(E=>{const j=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),O=JSON.parse(E.split(";")[1].split("=")[1]);p[`${O}Page`]=j}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},w),p),error:null}}catch(p){if(le(p))return{data:{users:[]},error:p};throw p}}async getUserById(a){yr(a);try{return await he(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:zs})}catch(r){if(le(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){yr(a);try{return await he(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:zs})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){yr(a);try{return await he(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:zs})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){yr(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){yr(a.userId),yr(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,y;try{const p={nextPage:null,lastPage:0,total:0},g=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:Yg});if(g.error)throw g.error;const w=await g.json(),_=(h=g.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(y=(m=g.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&y!==void 0?y:[];return S.length>0&&(S.forEach(E=>{const j=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),O=JSON.parse(E.split(";")[1].split("=")[1]);p[`${O}Page`]=j}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},w),p),error:null}}catch(p){if(le(p))return{data:{clients:[]},error:p};throw p}}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 Jg(s={}){return{getItem:a=>s[a]||null,setItem:(a,r)=>{s[a]=r},removeItem:a=>{delete s[a]}}}const vr={debug:!!(globalThis&&Zy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Wy extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class ZS extends Wy{}async function FS(s,a,r){vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",s,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),vr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",s)},a),await Promise.resolve().then(()=>globalThis.navigator.locks.request(s,a===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:l.signal},async c=>{if(c){vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",s,c.name);try{return await r()}finally{vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",s,c.name)}}else{if(a===0)throw vr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",s),new ZS(`Acquiring an exclusive Navigator LockManager lock "${s}" immediately failed`);if(vr.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 WS(){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 ev(s){if(!/^0x[a-fA-F0-9]{40}$/.test(s))throw new Error(`@supabase/auth-js: Address "${s}" is invalid.`);return s.toLowerCase()}function ej(s){return parseInt(s,16)}function tj(s){const a=new TextEncoder().encode(s);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function aj(s){var a;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:y,resources:p,scheme:g,uri:w,version:_}=s;{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(!w)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=s.statement)===null||a===void 0)&&a.includes(`
|
|
36
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${s.statement}`)}const S=ev(s.address),E=g?`${g}://${l}`:l,j=s.statement?`${s.statement}
|
|
37
37
|
`:"",O=`${E} wants you to sign in with your Ethereum account:
|
|
38
38
|
${S}
|
|
39
39
|
|
|
@@ -43,17 +43,17 @@ Chain ID: ${r}${h?`
|
|
|
43
43
|
Nonce: ${h}`:""}
|
|
44
44
|
Issued At: ${d.toISOString()}`;if(c&&(D+=`
|
|
45
45
|
Expiration Time: ${c.toISOString()}`),m&&(D+=`
|
|
46
|
-
Not Before: ${m.toISOString()}`),
|
|
47
|
-
Request ID: ${
|
|
48
|
-
Resources:`;for(const B of
|
|
46
|
+
Not Before: ${m.toISOString()}`),y&&(D+=`
|
|
47
|
+
Request ID: ${y}`),p){let q=`
|
|
48
|
+
Resources:`;for(const B of p){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
49
|
- ${B}`}D+=q}return`${O}
|
|
50
|
-
${D}`}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 $o extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function sj({error:s,options:a}){var r,l,c;const{publicKey:d}=a;if(!d)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else if(s.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:s});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:s});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:s})}else{if(s.name==="InvalidStateError")return new ot({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:s});if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.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:s}):new ot({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:s});if(s.name==="SecurityError"){const h=window.location.hostname;if(tv(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:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.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:s})}else if(s.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:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}function nj({error:s,options:a}){const{publicKey:r}=a;if(!r)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else{if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.name==="SecurityError"){const l=window.location.hostname;if(tv(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:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.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:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}class rj{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 ij=new rj;function lj(s){if(!s)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(s);const{challenge:a,user:r,excludeCredentials:l}=s,c=Ur(s,["challenge","user","excludeCredentials"]),d=Ar(a).buffer,h=Object.assign(Object.assign({},r),{id:Ar(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:Ar(g.id).buffer,type:g.type||"public-key",transports:g.transports})}}return m}function oj(s){if(!s)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(s);const{challenge:a,allowCredentials:r}=s,l=Ur(s,["challenge","allowCredentials"]),c=Ar(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:Ar(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function cj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s;return{id:s.id,rawId:s.id,response:{attestationObject:pn(new Uint8Array(s.response.attestationObject)),clientDataJSON:pn(new Uint8Array(s.response.clientDataJSON))},type:"public-key",clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function uj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s,l=s.getClientExtensionResults(),c=s.response;return{id:s.id,rawId:s.id,response:{authenticatorData:pn(new Uint8Array(c.authenticatorData)),clientDataJSON:pn(new Uint8Array(c.clientDataJSON)),signature:pn(new Uint8Array(c.signature)),userHandle:c.userHandle?pn(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function tv(s){return s==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(s)}function Xg(){var s,a;return!!(Tt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((s=navigator?.credentials)===null||s===void 0?void 0:s.create)=="function"&&typeof((a=navigator?.credentials)===null||a===void 0?void 0:a.get)=="function")}async function dj(s){try{const a=await navigator.credentials.create(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new $o("Browser returned unexpected credential type",a)}:{data:null,error:new $o("Empty credential response",a)}}catch(a){return{data:null,error:sj({error:a,options:s})}}}async function fj(s){try{const a=await navigator.credentials.get(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new $o("Browser returned unexpected credential type",a)}:{data:null,error:new $o("Empty credential response",a)}}catch(a){return{data:null,error:nj({error:a,options:s})}}}const hj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},mj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ho(...s){const a=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of s)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]=Ho(m,h):l[d]=Ho(h)}else l[d]=h}return l}function pj(s,a){return Ho(hj,s,a||{})}function gj(s,a){return Ho(mj,s,a||{})}class yj{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??ij.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=pj(h.webauthn.credential_options.publicKey,d?.create),{data:v,error:w}=await dj({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:w}}case"request":{const g=gj(h.webauthn.credential_options.publicKey,d?.request),{data:v,error:w}=await fj(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:w}}}}catch(h){return le(h)?{data:null,error:h}:{data:null,error:new mn("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 Yi("rpId is required for WebAuthn authentication")};try{if(!Xg())return{data:null,error:new mn("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 mn("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 Yi("rpId is required for WebAuthn registration")};try{if(!Xg())return{data:null,error:new mn("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 w;return(w=v.data)===null||w===void 0?void 0:w.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 mn("Unexpected error in register",h)}}}}WS();const vj={url:hS,storageKey:mS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:pS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Qg(s,a,r){return await r()}const br={};class Ji{get jwks(){var a,r;return(r=(a=br[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){br[this.storageKey]=Object.assign(Object.assign({},br[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=br[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){br[this.storageKey]=Object.assign(Object.assign({},br[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({},vj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Ji.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Ji.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Tt()){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 QS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Fy(d.fetch),this.lock=d.lock||Qg,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&&Tt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=FS:this.lock=Qg,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 yj(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:Zy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Jg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Jg(this.memoryStorage)),Tt()&&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} (${Jy}) ${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(Tt()&&(r=CS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Tt()&&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),wS(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 mn("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:fa}),{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:w,options:_}=a;let S=null,E=null;this.flowType==="pkce"&&([S,E]=await gr(this.storage,this.storageKey)),d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_?.emailRedirectTo,body:{email:v,password:w,data:(r=_?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:_?.captchaToken},code_challenge:S,code_challenge_method:E},xform:fa})}else if("phone"in a){const{phone:v,password:w,options:_}=a;d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:w,data:(l=_?.data)!==null&&l!==void 0?l:{},channel:(c=_?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:_?.captchaToken}},xform:fa})}else throw new So("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await Et(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 Et(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:Kg})}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:Kg})}else throw new So("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 pr;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,w,_;let S,E;if("message"in a)S=a.message,E=a.signature;else{const{chain:j,wallet:O,statement:D,options:q}=a;let B;if(Tt())if(typeof O=="object")B=O;else{const ce=window;if("ethereum"in ce&&typeof ce.ethereum=="object"&&"request"in ce.ethereum&&typeof ce.ethereum.request=="function")B=ce.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 O!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");B=O}const G=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),W=await B.request({method:"eth_requestAccounts"}).then(ce=>ce).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 J=ev(W[0]);let P=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!P){const ce=await B.request({method:"eth_chainId"});P=ej(ce)}const Q={domain:G.host,address:J,statement:D,uri:G.href,version:"1",chainId:P,nonce:(c=q?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=q?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=q?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(p=q?.signInWithEthereum)===null||p===void 0?void 0:p.notBefore,requestId:(g=q?.signInWithEthereum)===null||g===void 0?void 0:g.requestId,resources:(v=q?.signInWithEthereum)===null||v===void 0?void 0:v.resources};S=aj(Q),E=await B.request({method:"personal_sign",params:[tj(S),J]})}try{const{data:j,error:O}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:E},!((w=a.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=a.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:fa});if(O)throw O;if(!j||!j.session||!j.user){const D=new pr;return this._returnResult({data:{user:null,session:null},error:D})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:O})}catch(j){if(le(j))return this._returnResult({data:{user:null,session:null},error:j});throw j}}async signInWithSolana(a){var r,l,c,d,h,m,p,g,v,w,_,S;let E,j;if("message"in a)E=a.message,j=a.signature;else{const{chain:O,wallet:D,statement:q,options:B}=a;let G;if(Tt())if(typeof D=="object")G=D;else{const J=window;if("solana"in J&&typeof J.solana=="object"&&("signIn"in J.solana&&typeof J.solana.signIn=="function"||"signMessage"in J.solana&&typeof J.solana.signMessage=="function"))G=J.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof D!="object"||!B?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");G=D}const W=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in G&&G.signIn){const J=await G.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},B?.signInWithSolana),{version:"1",domain:W.host,uri:W.href}),q?{statement:q}:null));let P;if(Array.isArray(J)&&J[0]&&typeof J[0]=="object")P=J[0];else if(J&&typeof J=="object"&&"signedMessage"in J&&"signature"in J)P=J;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)E=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),j=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in G)||typeof G.signMessage!="function"||!("publicKey"in G)||typeof G!="object"||!G.publicKey||!("toBase58"in G.publicKey)||typeof G.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${W.host} wants you to sign in with your Solana account:`,G.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}`]:[],...!((w=(v=B?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||w===void 0)&&w.length?["Resources",...B.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
|
|
51
|
-
`);const J=await G.signMessage(new TextEncoder().encode(E),"utf8");if(!J||!(J instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=J}}try{const{data:O,error:D}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:pn(j)},!((_=a.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(S=a.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:fa});if(D)throw D;if(!O||!O.session||!O.user){const q=new pr;return this._returnResult({data:{user:null,session:null},error:q})}return O.session&&(await this._saveSession(O.session),await this._notifyAllSubscribers("SIGNED_IN",O.session)),this._returnResult({data:Object.assign({},O),error:D})}catch(O){if(le(O))return this._returnResult({data:{user:null,session:null},error:O});throw O}}async _exchangeCodeForSession(a){const r=await dn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new _S;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:fa});if(await Et(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new pr;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 Et(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:fa}),{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 pr;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 gr(this.storage,this.storageKey));const{error:w}=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:w})}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 So("You must provide either an email or phone number.")}catch(m){if(await Et(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:fa});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 gr(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:YS});return!((d=g.data)===null||d===void 0)&&d.url&&Tt()&&!(!((h=a.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(g.data.url),this._returnResult(g)}catch(m){if(await Et(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 Jt;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 So("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 dn(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()<Nd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",a.expires_at),!l){if(this.userStorage){const h=await dn(this.userStorage,this.storageKey+"-user");h?.user?a.user=h.user:a.user=Ad()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=IS(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:Ms}):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 Jt}: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:Ms})})}catch(r){if(le(r))return xS(r)&&(await this._removeSession(),await Et(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 Jt;const h=c.session;let m=null,p=null;this.flowType==="pkce"&&a.email!=null&&([m,p]=await gr(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:Ms});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 Et(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 Jt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=Td(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 Jt;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(!Tt())throw new jo("No browser detected.");if(a.error||a.error_description||a.error_code)throw new jo(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 qg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new jo("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 qg("No code detected.");const{data:q,error:B}=await this._exchangeCodeForSession(a.code);if(B)throw B;const G=new URL(window.location.href);return G.searchParams.delete("code"),window.history.replaceState(window.history.state,"",G.toString()),{data:{session:q.session,redirectType:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:d,refresh_token:h,expires_in:m,expires_at:p,token_type:g}=a;if(!d||!m||!h||!g)throw new jo("No session defined in URL");const v=Math.round(Date.now()/1e3),w=parseInt(m);let _=v+w;p&&(_=parseInt(p));const S=_-v;S*1e3<=jr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${w}s`);const E=_-w;v-E>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",E,_,v):v-E<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",E,_,v);const{data:j,error:O}=await this._getUser(d);if(O)throw O;const D={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:w,expires_at:_,refresh_token:h,token_type:g,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:D,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 dn(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&&!(bS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=kS(),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 gr(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 Et(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:w,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=w.session)===null||g===void 0?void 0:g.access_token)!==null&&v!==void 0?v:void 0})});if(c)throw c;return Tt()&&!(!((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,w=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:fa}),{data:_,error:S}=w;return S?this._returnResult({data:{user:null,session:null},error:S}):!_||!_.session||!_.user?this._returnResult({data:{user:null,session:null},error:new pr}):(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),this._returnResult({data:_,error:S}))}catch(c){if(await Et(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 DS(async c=>(c>0&&await RS(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:fa})),(c,d)=>{const h=200*Math.pow(2,c);return d&&Ed(d)&&Date.now()+h-l<jr})}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),Tt()&&!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 dn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await dn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Nr(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:Ad()}else if(c&&!c.user&&!c.user){const h=await dn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await Et(this.storage,this.storageKey+"-user"),await Nr(this.storage,this.storageKey,c)):c.user=Ad()}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()<Nd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${Nd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),Ed(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 Jt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const c=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(c,"begin");try{this.refreshingDeferred=new Po;const{data:d,error:h}=await this._refreshAccessToken(a);if(h)throw h;if(!d.session)throw new Jt;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 Ed(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 Et(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 Nr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Gg(c);await Nr(this.storage,this.storageKey,d)}else{const c=Gg(r);await Nr(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Et(this.storage,this.storageKey),await Et(this.storage,this.storageKey+"-code-verifier"),await Et(this.storage,this.storageKey+"-user"),this.userStorage&&await Et(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&Tt()&&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(),jr);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)/jr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${jr}ms, refresh threshold is ${Qd} ticks`),c<=Qd&&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 Wy)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Tt()||!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 gr(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"?cj(a.webauthn.credential_response):uj(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:lj(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:oj(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}=Td(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 Jt})})}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 Jt});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&&Tt()&&!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 Jt});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&&Tt()&&!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 Jt})})}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 Jt})})}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+yS>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:E}=await this.getSession();if(E||!S.session)return this._returnResult({data:null,error:E});l=S.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:p}}=Td(l);r?.allowExpired||$S(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=HS(c.alg),w=await crypto.subtle.importKey("jwk",g,v,!0,["verify"]);if(!await crypto.subtle.verify(v,w,h,TS(`${m}.${p}`)))throw new Wd("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}}}Ji.nextInstanceID={};const bj=Ji,xj="2.90.1";let Ui="";typeof Deno<"u"?Ui="deno":typeof document<"u"?Ui="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ui="react-native":Ui="node";const wj={"X-Client-Info":`supabase-js-${Ui}/${xj}`},_j={headers:wj},Sj={schema:"public"},jj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Nj={};function Xi(s){"@babel/helpers - typeof";return Xi=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},Xi(s)}function Ej(s,a){if(Xi(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Xi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function Tj(s){var a=Ej(s,"string");return Xi(a)=="symbol"?a:a+""}function Aj(s,a,r){return(a=Tj(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Zg(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function et(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Zg(Object(r),!0).forEach(function(l){Aj(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Zg(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const kj=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),Cj=()=>Headers,Oj=(s,a,r)=>{const l=kj(r),c=Cj();return async(d,h)=>{var m;const p=(m=await a())!==null&&m!==void 0?m:s;let g=new c(h?.headers);return g.has("apikey")||g.set("apikey",s),g.has("Authorization")||g.set("Authorization",`Bearer ${p}`),l(d,et(et({},h),{},{headers:g}))}};function Rj(s){return s.endsWith("/")?s:s+"/"}function Dj(s,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=s,{db:p,auth:g,realtime:v,global:w}=a,_={db:et(et({},p),c),auth:et(et({},g),d),realtime:et(et({},v),h),storage:{},global:et(et(et({},w),m),{},{headers:et(et({},(r=w?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return s.accessToken?_.accessToken=s.accessToken:delete _.accessToken,_}function Mj(s){const a=s?.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(Rj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var zj=class extends bj{constructor(s){super(s)}},Uj=class{constructor(s,a,r){var l,c;this.supabaseUrl=s,this.supabaseKey=a;const d=Mj(s);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:Sj,realtime:Nj,auth:et(et({},jj),{},{storageKey:h}),global:_j},p=Dj(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,w)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(w)} 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=Oj(a,this._getAccessToken.bind(this),p.global.fetch),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this)},p.realtime)),this.accessToken&&this.accessToken().then(v=>this.realtime.setAuth(v)).catch(v=>console.warn("Failed to set initial Realtime auth token:",v)),this.rest=new p1(new URL("rest/v1",d).href,{headers:this.headers,schema:p.db.schema,fetch:this.fetch}),this.storage=new fS(this.storageUrl.href,this.headers,this.fetch,r?.storage),p.accessToken||this._listenForAuthEvents()}get functions(){return new u1(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(s){return this.rest.from(s)}schema(s){return this.rest.schema(s)}rpc(s,a={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(s,a,r)}channel(s,a={config:{}}){return this.realtime.channel(s,a)}getChannels(){return this.realtime.getChannels()}removeChannel(s){return this.realtime.removeChannel(s)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var s=this,a,r;if(s.accessToken)return await s.accessToken();const{data:l}=await s.auth.getSession();return(a=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:s.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:p,throwOnError:g},v,w){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new zj({url:this.authUrl.href,headers:et(et({},_),v),storageKey:d,autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:p,throwOnError:g,fetch:w,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(s){return new R1(this.realtimeUrl.href,et(et({},s),{},{params:et(et({},{apikey:this.supabaseKey}),s?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((s,a)=>{this._handleTokenChanged(s,"CLIENT",a?.access_token)})}_handleTokenChanged(s,a,r){(s==="TOKEN_REFRESHED"||s==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):s==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Fg=(s,a,r)=>new Uj(s,a,r);function Lj(){if(typeof window<"u")return!1;const s=globalThis.process;if(!s)return!1;const a=s.version;if(a==null)return!1;const r=a.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Lj()&&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 Ko="email_automator_supabase_config";function Lr(){try{const s=localStorage.getItem(Ko);if(s)return JSON.parse(s)}catch(s){console.error("Error reading Supabase config:",s)}return null}function Bj(s){try{localStorage.setItem(Ko,JSON.stringify(s))}catch(a){console.error("Error saving Supabase config:",a)}}function qj(){try{localStorage.removeItem(Ko)}catch(s){console.error("Error clearing Supabase config:",s)}}async function av(s,a){try{if(!s.startsWith("http://")&&!s.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(`${s}/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 $j(){return localStorage.getItem(Ko)?"ui":"none"}function Hj(){const s=Lr();return!s||!s.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Fg("https://placeholder.supabase.co","placeholder-key")):Fg(s.url,s.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=Hj();function Wg(){const s=Lr(),a=s?`${s.url}/functions/v1`:"",r=s?s.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 Vj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=Wg();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=Wg(),c={...r?.headers||{},"X-Supabase-Url":l.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":l.anonKey};return this.request(this.expressApiUrl,a,{...r,headers:c})}async getGmailAuthUrl(){return this.edgeRequest("/auth-gmail?action=url",{method:"GET"})}async connectGmail(a){return this.edgeRequest("/auth-gmail",{method:"POST",body:JSON.stringify({code:a})})}async startMicrosoftDeviceFlow(){return this.edgeRequest("/auth-microsoft?action=device-flow",{method:"POST"})}async pollMicrosoftDeviceCode(a){return this.edgeRequest("/auth-microsoft?action=poll",{method:"POST",body:JSON.stringify({deviceCode:a})})}async getAccounts(){return this.edgeRequest("/api-v1-accounts")}async disconnectAccount(a){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"DELETE"})}async updateAccount(a,r){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async getEmails(a={}){const r=new URLSearchParams;return a.limit&&r.set("limit",a.limit.toString()),a.offset&&r.set("offset",a.offset.toString()),a.category&&r.set("category",a.category),a.search&&r.set("search",a.search),a.sort_by&&r.set("sort_by",a.sort_by),a.sort_order&&r.set("sort_order",a.sort_order),this.edgeRequest(`/api-v1-emails?${r}`)}async getEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`)}async getEmailEvents(a){return this.edgeRequest(`/api-v1-emails/${a}/events`)}async deleteEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`,{method:"DELETE"})}async getCategorySummary(){return this.edgeRequest("/api-v1-emails/summary/categories")}async retryEmail(a){return this.expressRequest(`/api/emails/${a}/retry`,{method:"POST"})}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 ze=new Vj;async function sv(s){ze.setSupabaseClient(s);const{data:{session:a}}=await s.auth.getSession();a?.access_token&&ze.setToken(a.access_token),s.auth.onAuthStateChange((r,l)=>{ze.setToken(l?.access_token||null)})}const Ij=Object.freeze(Object.defineProperty({__proto__:null,api:ze,initializeApi:sv},Symbol.toStringTag,{value:"Module"}));function Gj({userId:s,onInsert:a,onUpdate:r,onDelete:l,enabled:c=!0}){const d=x.useRef(null);return x.useEffect(()=>{if(!c||!s)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)}},[s,c,a,r,l]),{isSubscribed:!!d.current}}class Pj{ctx=null;enabled=!1;constructor(){const a=localStorage.getItem("ea_sounds_enabled");this.enabled=a!=="false"}setEnabled(a){this.enabled=a,localStorage.setItem("ea_sounds_enabled",a?"true":"false")}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])}playStart(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="sine",r.frequency.setValueAtTime(440,a.currentTime),r.frequency.exponentialRampToValueAtTime(880,a.currentTime+.2),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.05,a.currentTime+.05),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.2),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.2),this.haptic(10)}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 Us=new Pj;let Qi=[],ef=new Set;function nv(){ef.forEach(s=>s())}const ne={success:(s,a)=>No("success",s,a),error:(s,a)=>No("error",s,a),info:(s,a)=>No("info",s,a),warning:(s,a)=>No("warning",s,a)};function No(s,a,r=5e3){const l=Math.random().toString(36).substr(2,9);Qi=[...Qi,{id:l,type:s,message:a,duration:r}],nv(),r>0&&setTimeout(()=>rv(l),r)}function rv(s){Qi=Qi.filter(a=>a.id!==s),nv()}function Kj(){const[,s]=x.useState(0);return x.useEffect(()=>{const a=()=>s(r=>r+1);return ef.add(a),()=>{ef.delete(a)}},[]),Qi}const Yj={success:Hi,error:Dr,info:Or,warning:Rr},Jj={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 Xj({toast:s}){const a=Yj[s.type];return o.jsxs("div",{className:Oe("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-right-full duration-300",Jj[s.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:s.message}),o.jsx("button",{onClick:()=>rv(s.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(tl,{className:"w-4 h-4"})})]})}function Qj(){const s=Kj();return s.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:s.map(a=>o.jsx(Xj,{toast:a},a.id))})}function da(s,a){return s?typeof s=="string"?s:s.message||a:a}const iv={user:null,isAuthenticated:!1,profile:null,emails:[],accounts:[],rules:[],settings:null,stats:null,isLoading:!0,isInitialized:!1,error:null,selectedEmailId:null,emailsTotal:0,emailsOffset:0,sortBy:"created_at",sortOrder:"desc"};function Zj(s,a){switch(a.type){case"SET_USER":return{...s,user:a.payload,isAuthenticated:!!a.payload,isLoading:!1};case"SET_LOADING":return{...s,isLoading:a.payload};case"SET_INITIALIZED":return{...s,isInitialized:a.payload};case"SET_ERROR":return{...s,error:a.payload,isLoading:!1};case"SET_EMAILS":return{...s,emails:a.payload.emails,emailsTotal:a.payload.total,emailsOffset:a.payload.offset,sortBy:a.payload.sortBy||s.sortBy,sortOrder:a.payload.sortOrder||s.sortOrder};case"ADD_EMAIL":return{...s,emails:[a.payload,...s.emails],emailsTotal:s.emailsTotal+1};case"UPDATE_EMAIL":return{...s,emails:s.emails.map(r=>r.id===a.payload.id?a.payload:r)};case"SET_PROFILE":return{...s,profile:a.payload};case"UPDATE_PROFILE":return{...s,profile:a.payload};case"SET_ACCOUNTS":return{...s,accounts:a.payload};case"ADD_ACCOUNT":return{...s,accounts:[a.payload,...s.accounts]};case"REMOVE_ACCOUNT":return{...s,accounts:s.accounts.filter(r=>r.id!==a.payload)};case"SET_RULES":return{...s,rules:a.payload};case"ADD_RULE":return{...s,rules:[a.payload,...s.rules]};case"UPDATE_RULE":return{...s,rules:s.rules.map(r=>r.id===a.payload.id?a.payload:r)};case"REMOVE_RULE":return{...s,rules:s.rules.filter(r=>r.id!==a.payload)};case"SET_SETTINGS":return{...s,settings:a.payload};case"SET_STATS":return{...s,stats:a.payload};case"SET_SELECTED_EMAIL":return{...s,selectedEmailId:a.payload};case"CLEAR_DATA":return{...iv,isLoading:!1,isInitialized:!0};default:return s}}const lv=x.createContext(null);function Fj({children:s}){const[a,r]=x.useReducer(Zj,iv),l=x.useCallback(p=>{r({type:"ADD_EMAIL",payload:p}),p.ai_analysis?.priority==="High"?(Us.playAlert(),ne.success("High Priority Email Processed!")):(Us.playNotify(),ne.info("New email processed"))},[r]),c=x.useCallback(p=>{r({type:"UPDATE_EMAIL",payload:p})},[r]),d=x.useCallback(p=>{},[r]),{isSubscribed:h}=Gj({userId:a.user?.id,onInsert:l,onUpdate:c,onDelete:d,enabled:a.isAuthenticated});x.useEffect(()=>{async function p(){if(!Lr()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:v}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(v&&v.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await sv(ct);const{data:{session:w}}=await ct.auth.getSession();r({type:"SET_USER",payload:w?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:_}}=ct.auth.onAuthStateChange((S,E)=>{r({type:"SET_USER",payload:E?.user||null}),E||r({type:"CLEAR_DATA"})});return()=>_.unsubscribe()}catch(v){console.error("[AppContext] Init error:",v),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}p()},[]);const m={fetchEmails:async(p={})=>{const g=await ze.getEmails({limit:20,offset:p.offset||0,category:p.category,search:p.search,sort_by:p.sortBy||a.sortBy,sort_order:p.sortOrder||a.sortOrder});g.data&&r({type:"SET_EMAILS",payload:{emails:g.data.emails,total:g.data.total,offset:p.offset||0,sortBy:p.sortBy,sortOrder:p.sortOrder}})},fetchAccounts:async()=>{const p=await ze.getAccounts();p.data&&r({type:"SET_ACCOUNTS",payload:p.data.accounts})},fetchRules:async()=>{const p=await ze.getRules();p.data&&r({type:"SET_RULES",payload:p.data.rules})},fetchSettings:async()=>{const p=await ze.getSettings();p.data&&r({type:"SET_SETTINGS",payload:p.data.settings})},fetchProfile:async()=>{const p=await ze.getProfile();p.data&&r({type:"SET_PROFILE",payload:p.data})},fetchStats:async()=>{const p=await ze.getStats();p.data&&r({type:"SET_STATS",payload:p.data.stats})},executeAction:async(p,g,v)=>{const w=await ze.executeAction(p,g,v);if(w.data?.success){const _=a.emails.find(S=>S.id===p);return _&&r({type:"UPDATE_EMAIL",payload:{..._,action_taken:g}}),!0}return r({type:"SET_ERROR",payload:da(w.error,"Action failed")}),!1},triggerSync:async p=>{const g=p?await ze.triggerSync(p):await ze.syncAll();return await m.fetchAccounts(),g.error?(r({type:"SET_ERROR",payload:da(g.error,"Sync failed")}),!1):!0},disconnectAccount:async p=>{const g=await ze.disconnectAccount(p);return g.data?.success?(r({type:"REMOVE_ACCOUNT",payload:p}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to disconnect")}),!1)},updateSettings:async p=>{const g=await ze.updateSettings(p);return g.data?(r({type:"SET_SETTINGS",payload:g.data.settings}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to update settings")}),!1)},updateProfile:async p=>{const g=await ze.updateProfile(p);return g.data?(r({type:"UPDATE_PROFILE",payload:g.data}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to update profile")}),!1)},updateAccount:async(p,g)=>{const v=await ze.updateAccount(p,g);return v.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(w=>w.id===p?{...w,...g}:w)}),!0):(r({type:"SET_ERROR",payload:da(v.error,"Failed to update account")}),!1)},retryProcessing:async p=>{const g=await ze.retryEmail(p);if(g.data?.success){const v=a.emails.find(w=>w.id===p);return v&&r({type:"UPDATE_EMAIL",payload:{...v,processing_status:"pending",processing_error:null}}),!0}return r({type:"SET_ERROR",payload:da(g.error,"Retry failed")}),!1},createRule:async p=>{const g=await ze.createRule(p);return g.data?(r({type:"ADD_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to create rule")}),!1)},updateRule:async(p,g)=>{const v=await ze.updateRule(p,g);return v.data?(r({type:"UPDATE_RULE",payload:v.data.rule}),!0):(r({type:"SET_ERROR",payload:da(v.error,"Failed to update rule")}),!1)},deleteRule:async p=>{const g=await ze.deleteRule(p);return g.data?.success?(r({type:"REMOVE_RULE",payload:p}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to delete rule")}),!1)},toggleRule:async p=>{const g=await ze.toggleRule(p);return g.data?(r({type:"UPDATE_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to toggle rule")}),!1)}};return o.jsx(lv.Provider,{value:{state:a,isSubscribed:h,dispatch:r,actions:m},children:s})}function Br(){const s=x.useContext(lv);if(!s)throw new Error("useApp must be used within AppProvider");return s}const Wj=x.createContext(void 0);function eN({children:s,value:a}){return o.jsx(Wj.Provider,{value:a,children:s})}const ov=x.createContext(null);function tN({children:s}){const[a,r]=x.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(ov.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:s})}function cv(){const s=x.useContext(ov);if(!s)throw new Error("useTerminal must be used within a TerminalProvider");return s}const At=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("rounded-xl border bg-card text-card-foreground shadow",s),...a}));At.displayName="Card";const Ea=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("flex flex-col space-y-1.5 p-6",s),...a}));Ea.displayName="CardHeader";const Ta=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("font-semibold leading-none tracking-tight",s),...a}));Ta.displayName="CardTitle";const es=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("text-sm text-muted-foreground",s),...a}));es.displayName="CardDescription";const Aa=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("p-6 pt-0",s),...a}));Aa.displayName="CardContent";const uv=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("flex items-center p-6 pt-0",s),...a}));uv.displayName="CardFooter";class aN extends x.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(At,{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(Rr,{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(Z,{onClick:this.handleReset,variant:"outline",children:[o.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(Z,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function mt({size:s="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:Oe("flex flex-col items-center justify-center gap-3",a),children:[o.jsx($t,{className:Oe("animate-spin text-primary",l[s])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function qi({text:s="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(mt,{size:"lg",text:s})})}function sN(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(mt,{size:"md"})})}function Ls(s,a,{checkForDefaultPrevented:r=!0}={}){return function(c){if(s?.(c),r===!1||!c.defaultPrevented)return a?.(c)}}function nN(s,a){const r=x.createContext(a),l=d=>{const{children:h,...m}=d,p=x.useMemo(()=>m,Object.values(m));return o.jsx(r.Provider,{value:p,children:h})};l.displayName=s+"Provider";function c(d){const h=x.useContext(r);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[l,c]}function rN(s,a=[]){let r=[];function l(d,h){const m=x.createContext(h),p=r.length;r=[...r,h];const g=w=>{const{scope:_,children:S,...E}=w,j=_?.[s]?.[p]||m,O=x.useMemo(()=>E,Object.values(E));return o.jsx(j.Provider,{value:O,children:S})};g.displayName=d+"Provider";function v(w,_){const S=_?.[s]?.[p]||m,E=x.useContext(S);if(E)return E;if(h!==void 0)return h;throw new Error(`\`${w}\` must be used within \`${d}\``)}return[g,v]}const c=()=>{const d=r.map(h=>x.createContext(h));return function(m){const p=m?.[s]||d;return x.useMemo(()=>({[`__scope${s}`]:{...m,[s]:p}}),[m,p])}};return c.scopeName=s,[l,iN(c,...a)]}function iN(...s){const a=s[0];if(s.length===1)return a;const r=()=>{const l=s.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const h=l.reduce((m,{useScope:p,scopeName:g})=>{const w=p(d)[`__scope${g}`];return{...m,...w}},{});return x.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var Zi=globalThis?.document?x.useLayoutEffect:()=>{},lN=rf[" useId ".trim().toString()]||(()=>{}),oN=0;function Cd(s){const[a,r]=x.useState(lN());return Zi(()=>{r(l=>l??String(oN++))},[s]),s||(a?`radix-${a}`:"")}var cN=rf[" useInsertionEffect ".trim().toString()]||Zi;function uN({prop:s,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=dN({defaultProp:a,onChange:r}),m=s!==void 0,p=m?s:c;{const v=x.useRef(s!==void 0);x.useEffect(()=>{const w=v.current;w!==m&&console.warn(`${l} is changing from ${w?"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=x.useCallback(v=>{if(m){const w=fN(v)?v(s):v;w!==s&&h.current?.(w)}else d(v)},[m,s,d,h]);return[p,g]}function dN({defaultProp:s,onChange:a}){const[r,l]=x.useState(s),c=x.useRef(r),d=x.useRef(a);return cN(()=>{d.current=a},[a]),x.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function fN(s){return typeof s=="function"}var dv=py();const hN=sf(dv);function mN(s){const a=pN(s),r=x.forwardRef((l,c)=>{const{children:d,...h}=l,m=x.Children.toArray(d),p=m.find(yN);if(p){const g=p.props.children,v=m.map(w=>w===p?x.Children.count(g)>1?x.Children.only(null):x.isValidElement(g)?g.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(g)?x.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function pN(s){const a=x.forwardRef((r,l)=>{const{children:c,...d}=r;if(x.isValidElement(c)){const h=bN(c),m=vN(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Io(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var gN=Symbol("radix.slottable");function yN(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===gN}function vN(s,a){const r={...a};for(const l in a){const c=s[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{...s,...r}}function bN(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var xN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],as=xN.reduce((s,a)=>{const r=mN(`Primitive.${a}`),l=x.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}`,{...s,[a]:l}},{});function wN(s,a){s&&dv.flushSync(()=>s.dispatchEvent(a))}function Fi(s){const a=x.useRef(s);return x.useEffect(()=>{a.current=s}),x.useMemo(()=>(...r)=>a.current?.(...r),[])}function _N(s,a=globalThis?.document){const r=Fi(s);x.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 SN="DismissableLayer",tf="dismissableLayer.update",jN="dismissableLayer.pointerDownOutside",NN="dismissableLayer.focusOutside",ey,fv=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hv=x.forwardRef((s,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...p}=s,g=x.useContext(fv),[v,w]=x.useState(null),_=v?.ownerDocument??globalThis?.document,[,S]=x.useState({}),E=bn(a,P=>w(P)),j=Array.from(g.layers),[O]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),D=j.indexOf(O),q=v?j.indexOf(v):-1,B=g.layersWithOutsidePointerEventsDisabled.size>0,G=q>=D,W=AN(P=>{const Q=P.target,ce=[...g.branches].some(Je=>Je.contains(Q));!G||ce||(c?.(P),h?.(P),P.defaultPrevented||m?.())},_),J=kN(P=>{const Q=P.target;[...g.branches].some(Je=>Je.contains(Q))||(d?.(P),h?.(P),P.defaultPrevented||m?.())},_);return _N(P=>{q===g.layers.size-1&&(l?.(P),!P.defaultPrevented&&m&&(P.preventDefault(),m()))},_),x.useEffect(()=>{if(v)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(ey=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),ty(),()=>{r&&g.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=ey)}},[v,_,r,g]),x.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),ty())},[v,g]),x.useEffect(()=>{const P=()=>S({});return document.addEventListener(tf,P),()=>document.removeEventListener(tf,P)},[]),o.jsx(as.div,{...p,ref:E,style:{pointerEvents:B?G?"auto":"none":void 0,...s.style},onFocusCapture:Ls(s.onFocusCapture,J.onFocusCapture),onBlurCapture:Ls(s.onBlurCapture,J.onBlurCapture),onPointerDownCapture:Ls(s.onPointerDownCapture,W.onPointerDownCapture)})});hv.displayName=SN;var EN="DismissableLayerBranch",TN=x.forwardRef((s,a)=>{const r=x.useContext(fv),l=x.useRef(null),c=bn(a,l);return x.useEffect(()=>{const d=l.current;if(d)return r.branches.add(d),()=>{r.branches.delete(d)}},[r.branches]),o.jsx(as.div,{...s,ref:c})});TN.displayName=EN;function AN(s,a=globalThis?.document){const r=Fi(s),l=x.useRef(!1),c=x.useRef(()=>{});return x.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let p=function(){mv(jN,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 kN(s,a=globalThis?.document){const r=Fi(s),l=x.useRef(!1);return x.useEffect(()=>{const c=d=>{d.target&&!l.current&&mv(NN,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 ty(){const s=new CustomEvent(tf);document.dispatchEvent(s)}function mv(s,a,r,{discrete:l}){const c=r.originalEvent.target,d=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:r});a&&c.addEventListener(s,a,{once:!0}),l?wN(c,d):c.dispatchEvent(d)}var Od="focusScope.autoFocusOnMount",Rd="focusScope.autoFocusOnUnmount",ay={bubbles:!1,cancelable:!0},CN="FocusScope",pv=x.forwardRef((s,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=s,[m,p]=x.useState(null),g=Fi(c),v=Fi(d),w=x.useRef(null),_=bn(a,j=>p(j)),S=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(l){let j=function(B){if(S.paused||!m)return;const G=B.target;m.contains(G)?w.current=G:Rs(w.current,{select:!0})},O=function(B){if(S.paused||!m)return;const G=B.relatedTarget;G!==null&&(m.contains(G)||Rs(w.current,{select:!0}))},D=function(B){if(document.activeElement===document.body)for(const W of B)W.removedNodes.length>0&&Rs(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",O);const q=new MutationObserver(D);return m&&q.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",O),q.disconnect()}}},[l,m,S.paused]),x.useEffect(()=>{if(m){ny.add(S);const j=document.activeElement;if(!m.contains(j)){const D=new CustomEvent(Od,ay);m.addEventListener(Od,g),m.dispatchEvent(D),D.defaultPrevented||(ON(UN(gv(m)),{select:!0}),document.activeElement===j&&Rs(m))}return()=>{m.removeEventListener(Od,g),setTimeout(()=>{const D=new CustomEvent(Rd,ay);m.addEventListener(Rd,v),m.dispatchEvent(D),D.defaultPrevented||Rs(j??document.body,{select:!0}),m.removeEventListener(Rd,v),ny.remove(S)},0)}}},[m,g,v,S]);const E=x.useCallback(j=>{if(!r&&!l||S.paused)return;const O=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,D=document.activeElement;if(O&&D){const q=j.currentTarget,[B,G]=RN(q);B&&G?!j.shiftKey&&D===G?(j.preventDefault(),r&&Rs(B,{select:!0})):j.shiftKey&&D===B&&(j.preventDefault(),r&&Rs(G,{select:!0})):D===q&&j.preventDefault()}},[r,l,S.paused]);return o.jsx(as.div,{tabIndex:-1,...h,ref:_,onKeyDown:E})});pv.displayName=CN;function ON(s,{select:a=!1}={}){const r=document.activeElement;for(const l of s)if(Rs(l,{select:a}),document.activeElement!==r)return}function RN(s){const a=gv(s),r=sy(a,s),l=sy(a.reverse(),s);return[r,l]}function gv(s){const a=[],r=document.createTreeWalker(s,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 sy(s,a){for(const r of s)if(!DN(r,{upTo:a}))return r}function DN(s,{upTo:a}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(a!==void 0&&s===a)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function MN(s){return s instanceof HTMLInputElement&&"select"in s}function Rs(s,{select:a=!1}={}){if(s&&s.focus){const r=document.activeElement;s.focus({preventScroll:!0}),s!==r&&MN(s)&&a&&s.select()}}var ny=zN();function zN(){let s=[];return{add(a){const r=s[0];a!==r&&r?.pause(),s=ry(s,a),s.unshift(a)},remove(a){s=ry(s,a),s[0]?.resume()}}}function ry(s,a){const r=[...s],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function UN(s){return s.filter(a=>a.tagName!=="A")}var LN="Portal",yv=x.forwardRef((s,a)=>{const{container:r,...l}=s,[c,d]=x.useState(!1);Zi(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?hN.createPortal(o.jsx(as.div,{...l,ref:a}),h):null});yv.displayName=LN;function BN(s,a){return x.useReducer((r,l)=>a[r][l]??r,s)}var Yo=s=>{const{present:a,children:r}=s,l=qN(a),c=typeof r=="function"?r({present:l.isPresent}):x.Children.only(r),d=bn(l.ref,$N(c));return typeof r=="function"||l.isPresent?x.cloneElement(c,{ref:d}):null};Yo.displayName="Presence";function qN(s){const[a,r]=x.useState(),l=x.useRef(null),c=x.useRef(s),d=x.useRef("none"),h=s?"mounted":"unmounted",[m,p]=BN(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const g=Eo(l.current);d.current=m==="mounted"?g:"none"},[m]),Zi(()=>{const g=l.current,v=c.current;if(v!==s){const _=d.current,S=Eo(g);s?p("MOUNT"):S==="none"||g?.display==="none"?p("UNMOUNT"):p(v&&_!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,p]),Zi(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,w=S=>{const j=Eo(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&j&&(p("ANIMATION_END"),!c.current)){const O=a.style.animationFillMode;a.style.animationFillMode="forwards",g=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=O)})}},_=S=>{S.target===a&&(d.current=Eo(l.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",w),a.addEventListener("animationend",w),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",w),a.removeEventListener("animationend",w)}}else p("ANIMATION_END")},[a,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:x.useCallback(g=>{l.current=g?getComputedStyle(g):null,r(g)},[])}}function Eo(s){return s?.animationName||"none"}function $N(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Dd=0;function HN(){x.useEffect(()=>{const s=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",s[0]??iy()),document.body.insertAdjacentElement("beforeend",s[1]??iy()),Dd++,()=>{Dd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Dd--}},[])}function iy(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var Do="right-scroll-bar-position",Mo="width-before-scroll-bar",VN="with-scroll-bars-hidden",IN="--removed-body-scroll-bar-size";function Md(s,a){return typeof s=="function"?s(a):s&&(s.current=a),s}function GN(s,a){var r=x.useState(function(){return{value:s,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 PN=typeof window<"u"?x.useLayoutEffect:x.useEffect,ly=new WeakMap;function KN(s,a){var r=GN(null,function(l){return s.forEach(function(c){return Md(c,l)})});return PN(function(){var l=ly.get(r);if(l){var c=new Set(l),d=new Set(s),h=r.current;c.forEach(function(m){d.has(m)||Md(m,null)}),d.forEach(function(m){c.has(m)||Md(m,h)})}ly.set(r,s)},[s]),r}function YN(s){return s}function JN(s,a){a===void 0&&(a=YN);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]:s},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 XN(s){s===void 0&&(s={});var a=JN(null);return a.options=Na({async:!0,ssr:!1},s),a}var vv=function(s){var a=s.sideCar,r=Ur(s,["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 x.createElement(l,Na({},r))};vv.isSideCarExport=!0;function QN(s,a){return s.useMedium(a),vv}var bv=XN(),zd=function(){},Jo=x.forwardRef(function(s,a){var r=x.useRef(null),l=x.useState({onScrollCapture:zd,onWheelCapture:zd,onTouchMoveCapture:zd}),c=l[0],d=l[1],h=s.forwardProps,m=s.children,p=s.className,g=s.removeScrollBar,v=s.enabled,w=s.shards,_=s.sideCar,S=s.noRelative,E=s.noIsolation,j=s.inert,O=s.allowPinchZoom,D=s.as,q=D===void 0?"div":D,B=s.gapMode,G=Ur(s,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),W=_,J=KN([r,a]),P=Na(Na({},G),c);return x.createElement(x.Fragment,null,v&&x.createElement(W,{sideCar:bv,removeScrollBar:g,shards:w,noRelative:S,noIsolation:E,inert:j,setCallbacks:d,allowPinchZoom:!!O,lockRef:r,gapMode:B}),h?x.cloneElement(x.Children.only(m),Na(Na({},P),{ref:J})):x.createElement(q,Na({},P,{className:p,ref:J}),m))});Jo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Jo.classNames={fullWidth:Mo,zeroRight:Do};var ZN=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function FN(){if(!document)return null;var s=document.createElement("style");s.type="text/css";var a=ZN();return a&&s.setAttribute("nonce",a),s}function WN(s,a){s.styleSheet?s.styleSheet.cssText=a:s.appendChild(document.createTextNode(a))}function e2(s){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(s)}var t2=function(){var s=0,a=null;return{add:function(r){s==0&&(a=FN())&&(WN(a,r),e2(a)),s++},remove:function(){s--,!s&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},a2=function(){var s=t2();return function(a,r){x.useEffect(function(){return s.add(a),function(){s.remove()}},[a&&r])}},xv=function(){var s=a2(),a=function(r){var l=r.styles,c=r.dynamic;return s(l,c),null};return a},s2={left:0,top:0,right:0,gap:0},Ud=function(s){return parseInt(s||"",10)||0},n2=function(s){var a=window.getComputedStyle(document.body),r=a[s==="padding"?"paddingLeft":"marginLeft"],l=a[s==="padding"?"paddingTop":"marginTop"],c=a[s==="padding"?"paddingRight":"marginRight"];return[Ud(r),Ud(l),Ud(c)]},r2=function(s){if(s===void 0&&(s="margin"),typeof window>"u")return s2;var a=n2(s),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])}},i2=xv(),kr="data-scroll-locked",l2=function(s,a,r,l){var c=s.left,d=s.top,h=s.right,m=s.gap;return r===void 0&&(r="margin"),`
|
|
50
|
+
${D}`}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 $o extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function sj({error:s,options:a}){var r,l,c;const{publicKey:d}=a;if(!d)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else if(s.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:s});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:s});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:s})}else{if(s.name==="InvalidStateError")return new ot({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:s});if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.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:s}):new ot({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:s});if(s.name==="SecurityError"){const h=window.location.hostname;if(tv(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:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.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:s})}else if(s.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:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}function nj({error:s,options:a}){const{publicKey:r}=a;if(!r)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else{if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.name==="SecurityError"){const l=window.location.hostname;if(tv(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:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.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:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}class rj{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 ij=new rj;function lj(s){if(!s)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(s);const{challenge:a,user:r,excludeCredentials:l}=s,c=Ur(s,["challenge","user","excludeCredentials"]),d=Ar(a).buffer,h=Object.assign(Object.assign({},r),{id:Ar(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 y=0;y<l.length;y++){const p=l[y];m.excludeCredentials[y]=Object.assign(Object.assign({},p),{id:Ar(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return m}function oj(s){if(!s)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(s);const{challenge:a,allowCredentials:r}=s,l=Ur(s,["challenge","allowCredentials"]),c=Ar(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:Ar(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function cj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s;return{id:s.id,rawId:s.id,response:{attestationObject:pn(new Uint8Array(s.response.attestationObject)),clientDataJSON:pn(new Uint8Array(s.response.clientDataJSON))},type:"public-key",clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function uj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s,l=s.getClientExtensionResults(),c=s.response;return{id:s.id,rawId:s.id,response:{authenticatorData:pn(new Uint8Array(c.authenticatorData)),clientDataJSON:pn(new Uint8Array(c.clientDataJSON)),signature:pn(new Uint8Array(c.signature)),userHandle:c.userHandle?pn(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function tv(s){return s==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(s)}function Xg(){var s,a;return!!(Tt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((s=navigator?.credentials)===null||s===void 0?void 0:s.create)=="function"&&typeof((a=navigator?.credentials)===null||a===void 0?void 0:a.get)=="function")}async function dj(s){try{const a=await navigator.credentials.create(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new $o("Browser returned unexpected credential type",a)}:{data:null,error:new $o("Empty credential response",a)}}catch(a){return{data:null,error:sj({error:a,options:s})}}}async function fj(s){try{const a=await navigator.credentials.get(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new $o("Browser returned unexpected credential type",a)}:{data:null,error:new $o("Empty credential response",a)}}catch(a){return{data:null,error:nj({error:a,options:s})}}}const hj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},mj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ho(...s){const a=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of s)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]=Ho(m,h):l[d]=Ho(h)}else l[d]=h}return l}function pj(s,a){return Ho(hj,s,a||{})}function gj(s,a){return Ho(mj,s,a||{})}class yj{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 y=c??ij.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:p}=h.webauthn.credential_options.publicKey;p.name||(p.name=`${p.id}:${l}`),p.displayName||(p.displayName=p.name)}switch(h.webauthn.type){case"create":{const p=pj(h.webauthn.credential_options.publicKey,d?.create),{data:g,error:w}=await dj({publicKey:p,signal:y});return g?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}case"request":{const p=gj(h.webauthn.credential_options.publicKey,d?.request),{data:g,error:w}=await fj(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:p,signal:y}));return g?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}}}catch(h){return le(h)?{data:null,error:h}:{data:null,error:new mn("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 Yi("rpId is required for WebAuthn authentication")};try{if(!Xg())return{data:null,error:new mn("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:y}=h;return this._verify({factorId:a,challengeId:h.challengeId,webauthn:{type:y.type,rpId:r,rpOrigins:l,credential_response:y.credential_response}})}catch(h){return le(h)?{data:null,error:h}:{data:null,error:new mn("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 Yi("rpId is required for WebAuthn registration")};try{if(!Xg())return{data:null,error:new mn("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(g=>{var w;return(w=g.data)===null||w===void 0?void 0:w.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===a&&_.status!=="unverified")}).then(g=>g?this.client.mfa.unenroll({factorId:g?.id}):void 0),{data:null,error:m};const{data:y,error:p}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return y?this._verify({factorId:h.id,challengeId:y.challengeId,webauthn:{rpId:r,rpOrigins:l,type:y.webauthn.type,credential_response:y.webauthn.credential_response}}):{data:null,error:p}}catch(h){return le(h)?{data:null,error:h}:{data:null,error:new mn("Unexpected error in register",h)}}}}WS();const vj={url:hS,storageKey:mS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:pS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Qg(s,a,r){return await r()}const br={};class Ji{get jwks(){var a,r;return(r=(a=br[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){br[this.storageKey]=Object.assign(Object.assign({},br[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=br[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){br[this.storageKey]=Object.assign(Object.assign({},br[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({},vj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Ji.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Ji.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Tt()){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 QS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Fy(d.fetch),this.lock=d.lock||Qg,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&&Tt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=FS:this.lock=Qg,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 yj(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:Zy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Jg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Jg(this.memoryStorage)),Tt()&&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} (${Jy}) ${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(Tt()&&(r=kS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Tt()&&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),wS(d)){const y=(a=d.details)===null||a===void 0?void 0:a.code;if(y==="identity_already_exists"||y==="identity_not_found"||y==="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 mn("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:fa}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const y=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},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:g,password:w,options:_}=a;let S=null,E=null;this.flowType==="pkce"&&([S,E]=await gr(this.storage,this.storageKey)),d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_?.emailRedirectTo,body:{email:g,password:w,data:(r=_?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:_?.captchaToken},code_challenge:S,code_challenge_method:E},xform:fa})}else if("phone"in a){const{phone:g,password:w,options:_}=a;d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:g,password:w,data:(l=_?.data)!==null&&l!==void 0?l:{},channel:(c=_?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:_?.captchaToken}},xform:fa})}else throw new So("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await Et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const y=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},error:null})}catch(d){if(await Et(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:Kg})}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:Kg})}else throw new So("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 pr;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,y,p,g,w,_;let S,E;if("message"in a)S=a.message,E=a.signature;else{const{chain:j,wallet:O,statement:D,options:q}=a;let B;if(Tt())if(typeof O=="object")B=O;else{const ce=window;if("ethereum"in ce&&typeof ce.ethereum=="object"&&"request"in ce.ethereum&&typeof ce.ethereum.request=="function")B=ce.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 O!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");B=O}const G=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),W=await B.request({method:"eth_requestAccounts"}).then(ce=>ce).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 J=ev(W[0]);let P=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!P){const ce=await B.request({method:"eth_chainId"});P=ej(ce)}const Q={domain:G.host,address:J,statement:D,uri:G.href,version:"1",chainId:P,nonce:(c=q?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=q?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=q?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(y=q?.signInWithEthereum)===null||y===void 0?void 0:y.notBefore,requestId:(p=q?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(g=q?.signInWithEthereum)===null||g===void 0?void 0:g.resources};S=aj(Q),E=await B.request({method:"personal_sign",params:[tj(S),J]})}try{const{data:j,error:O}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:E},!((w=a.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=a.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:fa});if(O)throw O;if(!j||!j.session||!j.user){const D=new pr;return this._returnResult({data:{user:null,session:null},error:D})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:O})}catch(j){if(le(j))return this._returnResult({data:{user:null,session:null},error:j});throw j}}async signInWithSolana(a){var r,l,c,d,h,m,y,p,g,w,_,S;let E,j;if("message"in a)E=a.message,j=a.signature;else{const{chain:O,wallet:D,statement:q,options:B}=a;let G;if(Tt())if(typeof D=="object")G=D;else{const J=window;if("solana"in J&&typeof J.solana=="object"&&("signIn"in J.solana&&typeof J.solana.signIn=="function"||"signMessage"in J.solana&&typeof J.solana.signMessage=="function"))G=J.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof D!="object"||!B?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");G=D}const W=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in G&&G.signIn){const J=await G.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},B?.signInWithSolana),{version:"1",domain:W.host,uri:W.href}),q?{statement:q}:null));let P;if(Array.isArray(J)&&J[0]&&typeof J[0]=="object")P=J[0];else if(J&&typeof J=="object"&&"signedMessage"in J&&"signature"in J)P=J;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)E=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),j=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in G)||typeof G.signMessage!="function"||!("publicKey"in G)||typeof G!="object"||!G.publicKey||!("toBase58"in G.publicKey)||typeof G.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${W.host} wants you to sign in with your Solana account:`,G.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}`]:[],...!((y=B?.signInWithSolana)===null||y===void 0)&&y.nonce?[`Nonce: ${B.signInWithSolana.nonce}`]:[],...!((p=B?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${B.signInWithSolana.requestId}`]:[],...!((w=(g=B?.signInWithSolana)===null||g===void 0?void 0:g.resources)===null||w===void 0)&&w.length?["Resources",...B.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
|
|
51
|
+
`);const J=await G.signMessage(new TextEncoder().encode(E),"utf8");if(!J||!(J instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=J}}try{const{data:O,error:D}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:pn(j)},!((_=a.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(S=a.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:fa});if(D)throw D;if(!O||!O.session||!O.user){const q=new pr;return this._returnResult({data:{user:null,session:null},error:q})}return O.session&&(await this._saveSession(O.session),await this._notifyAllSubscribers("SIGNED_IN",O.session)),this._returnResult({data:Object.assign({},O),error:D})}catch(O){if(le(O))return this._returnResult({data:{user:null,session:null},error:O});throw O}}async _exchangeCodeForSession(a){const r=await dn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new _S;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:fa});if(await Et(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new pr;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 Et(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:fa}),{data:y,error:p}=m;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!y||!y.session||!y.user){const g=new pr;return this._returnResult({data:{user:null,session:null},error:g})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:y,error:p})}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:y}=a;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await gr(this.storage,this.storageKey));const{error:w}=await he(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=y?.data)!==null&&r!==void 0?r:{},create_user:(l=y?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:y?.captchaToken},code_challenge:p,code_challenge_method:g},redirectTo:y?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:w})}if("phone"in a){const{phone:m,options:y}=a,{data:p,error:g}=await he(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=y?.data)!==null&&c!==void 0?c:{},create_user:(d=y?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:y?.captchaToken},channel:(h=y?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:g})}throw new So("You must provide either an email or phone number.")}catch(m){if(await Et(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:fa});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const y=h.session,p=h.user;return y?.access_token&&(await this._saveSession(y),await this._notifyAllSubscribers(a.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},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,y=null;this.flowType==="pkce"&&([m,y]=await gr(this.storage,this.storageKey));const p=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:y}),headers:this.headers,xform:YS});return!((d=p.data)===null||d===void 0)&&d.url&&Tt()&&!(!((h=a.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(m){if(await Et(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 Jt;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 So("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 dn(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()<Nd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",a.expires_at),!l){if(this.userStorage){const h=await dn(this.userStorage,this.storageKey+"-user");h?.user?a.user=h.user:a.user=Ad()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=IS(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:zs}):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 Jt}: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:zs})})}catch(r){if(le(r))return xS(r)&&(await this._removeSession(),await Et(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 Jt;const h=c.session;let m=null,y=null;this.flowType==="pkce"&&a.email!=null&&([m,y]=await gr(this.storage,this.storageKey));const{data:p,error:g}=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:y}),jwt:h.access_token,xform:zs});if(g)throw g;return h.user=p.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await Et(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 Jt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=Td(a.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:y}=await this._callRefreshToken(a.refresh_token);if(y)return this._returnResult({data:{user:null,session:null},error:y});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:y}=await this._getUser(a.access_token);if(y)throw y;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 Jt;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(!Tt())throw new jo("No browser detected.");if(a.error||a.error_description||a.error_code)throw new jo(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 qg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new jo("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 qg("No code detected.");const{data:q,error:B}=await this._exchangeCodeForSession(a.code);if(B)throw B;const G=new URL(window.location.href);return G.searchParams.delete("code"),window.history.replaceState(window.history.state,"",G.toString()),{data:{session:q.session,redirectType:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:d,refresh_token:h,expires_in:m,expires_at:y,token_type:p}=a;if(!d||!m||!h||!p)throw new jo("No session defined in URL");const g=Math.round(Date.now()/1e3),w=parseInt(m);let _=g+w;y&&(_=parseInt(y));const S=_-g;S*1e3<=jr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${w}s`);const E=_-w;g-E>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",E,_,g):g-E<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",E,_,g);const{data:j,error:O}=await this._getUser(d);if(O)throw O;const D={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:w,expires_at:_,refresh_token:h,token_type:p,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:D,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 dn(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&&!(bS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=CS(),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 gr(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 Et(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,y,p,g;const{data:w,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:(y=a.options)===null||y===void 0?void 0:y.queryParams,skipBrowserRedirect:!0});return await he(this.fetch,"GET",S,{headers:this.headers,jwt:(g=(p=w.session)===null||p===void 0?void 0:p.access_token)!==null&&g!==void 0?g:void 0})});if(c)throw c;return Tt()&&!(!((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:y,access_token:p,nonce:g}=a,w=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:y,access_token:p,nonce:g,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:fa}),{data:_,error:S}=w;return S?this._returnResult({data:{user:null,session:null},error:S}):!_||!_.session||!_.user?this._returnResult({data:{user:null,session:null},error:new pr}):(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),this._returnResult({data:_,error:S}))}catch(c){if(await Et(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 DS(async c=>(c>0&&await RS(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:fa})),(c,d)=>{const h=200*Math.pow(2,c);return d&&Ed(d)&&Date.now()+h-l<jr})}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),Tt()&&!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 dn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await dn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Nr(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:Ad()}else if(c&&!c.user&&!c.user){const h=await dn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await Et(this.storage,this.storageKey+"-user"),await Nr(this.storage,this.storageKey,c)):c.user=Ad()}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()<Nd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${Nd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),Ed(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 Jt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const c=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(c,"begin");try{this.refreshingDeferred=new Po;const{data:d,error:h}=await this._refreshAccessToken(a);if(h)throw h;if(!d.session)throw new Jt;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 Ed(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(y){d.push(y)}});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 Et(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 Nr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Gg(c);await Nr(this.storage,this.storageKey,d)}else{const c=Gg(r);await Nr(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Et(this.storage,this.storageKey),await Et(this.storage,this.storageKey+"-code-verifier"),await Et(this.storage,this.storageKey+"-user"),this.userStorage&&await Et(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&Tt()&&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(),jr);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)/jr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${jr}ms, refresh threshold is ${Qd} ticks`),c<=Qd&&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 Wy)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Tt()||!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 gr(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:y,error:p}=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 p?this._returnResult({data:null,error:p}):(a.factorType==="totp"&&y.type==="totp"&&(!((c=y?.totp)===null||c===void 0)&&c.qr_code)&&(y.totp.qr_code=`data:image/svg+xml;utf-8,${y.totp.qr_code}`),this._returnResult({data:y,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"?cj(a.webauthn.credential_response):uj(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:y}=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 y?this._returnResult({data:null,error:y}):(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:y}))})}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:lj(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:oj(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}=Td(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(g=>g.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const p=d.amr||[];return{data:{currentLevel:h,nextLevel:m,currentAuthenticationMethods:p},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 Jt})})}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 Jt});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&&Tt()&&!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 Jt});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&&Tt()&&!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 Jt})})}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 Jt})})}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+yS>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:E}=await this.getSession();if(E||!S.session)return this._returnResult({data:null,error:E});l=S.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:y}}=Td(l);r?.allowExpired||$S(d.exp);const p=!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(!p){const{error:S}=await this.getUser(l);if(S)throw S;return{data:{claims:d,header:c,signature:h},error:null}}const g=HS(c.alg),w=await crypto.subtle.importKey("jwk",p,g,!0,["verify"]);if(!await crypto.subtle.verify(g,w,h,TS(`${m}.${y}`)))throw new Wd("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}}}Ji.nextInstanceID={};const bj=Ji,xj="2.90.1";let Ui="";typeof Deno<"u"?Ui="deno":typeof document<"u"?Ui="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ui="react-native":Ui="node";const wj={"X-Client-Info":`supabase-js-${Ui}/${xj}`},_j={headers:wj},Sj={schema:"public"},jj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Nj={};function Xi(s){"@babel/helpers - typeof";return Xi=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},Xi(s)}function Ej(s,a){if(Xi(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Xi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function Tj(s){var a=Ej(s,"string");return Xi(a)=="symbol"?a:a+""}function Aj(s,a,r){return(a=Tj(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Zg(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function et(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Zg(Object(r),!0).forEach(function(l){Aj(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Zg(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const Cj=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),kj=()=>Headers,Oj=(s,a,r)=>{const l=Cj(r),c=kj();return async(d,h)=>{var m;const y=(m=await a())!==null&&m!==void 0?m:s;let p=new c(h?.headers);return p.has("apikey")||p.set("apikey",s),p.has("Authorization")||p.set("Authorization",`Bearer ${y}`),l(d,et(et({},h),{},{headers:p}))}};function Rj(s){return s.endsWith("/")?s:s+"/"}function Dj(s,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=s,{db:y,auth:p,realtime:g,global:w}=a,_={db:et(et({},y),c),auth:et(et({},p),d),realtime:et(et({},g),h),storage:{},global:et(et(et({},w),m),{},{headers:et(et({},(r=w?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return s.accessToken?_.accessToken=s.accessToken:delete _.accessToken,_}function Mj(s){const a=s?.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(Rj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var zj=class extends bj{constructor(s){super(s)}},Uj=class{constructor(s,a,r){var l,c;this.supabaseUrl=s,this.supabaseKey=a;const d=Mj(s);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:Sj,realtime:Nj,auth:et(et({},jj),{},{storageKey:h}),global:_j},y=Dj(r??{},m);if(this.storageKey=(l=y.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=y.global.headers)!==null&&c!==void 0?c:{},y.accessToken)this.accessToken=y.accessToken,this.auth=new Proxy({},{get:(g,w)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(w)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=y.auth)!==null&&p!==void 0?p:{},this.headers,y.global.fetch)}this.fetch=Oj(a,this._getAccessToken.bind(this),y.global.fetch),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this)},y.realtime)),this.accessToken&&this.accessToken().then(g=>this.realtime.setAuth(g)).catch(g=>console.warn("Failed to set initial Realtime auth token:",g)),this.rest=new p1(new URL("rest/v1",d).href,{headers:this.headers,schema:y.db.schema,fetch:this.fetch}),this.storage=new fS(this.storageUrl.href,this.headers,this.fetch,r?.storage),y.accessToken||this._listenForAuthEvents()}get functions(){return new u1(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(s){return this.rest.from(s)}schema(s){return this.rest.schema(s)}rpc(s,a={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(s,a,r)}channel(s,a={config:{}}){return this.realtime.channel(s,a)}getChannels(){return this.realtime.getChannels()}removeChannel(s){return this.realtime.removeChannel(s)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var s=this,a,r;if(s.accessToken)return await s.accessToken();const{data:l}=await s.auth.getSession();return(a=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:s.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:y,throwOnError:p},g,w){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new zj({url:this.authUrl.href,headers:et(et({},_),g),storageKey:d,autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:y,throwOnError:p,fetch:w,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(s){return new R1(this.realtimeUrl.href,et(et({},s),{},{params:et(et({},{apikey:this.supabaseKey}),s?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((s,a)=>{this._handleTokenChanged(s,"CLIENT",a?.access_token)})}_handleTokenChanged(s,a,r){(s==="TOKEN_REFRESHED"||s==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):s==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Fg=(s,a,r)=>new Uj(s,a,r);function Lj(){if(typeof window<"u")return!1;const s=globalThis.process;if(!s)return!1;const a=s.version;if(a==null)return!1;const r=a.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Lj()&&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 Ko="email_automator_supabase_config";function Lr(){try{const s=localStorage.getItem(Ko);if(s)return JSON.parse(s)}catch(s){console.error("Error reading Supabase config:",s)}return null}function Bj(s){try{localStorage.setItem(Ko,JSON.stringify(s))}catch(a){console.error("Error saving Supabase config:",a)}}function qj(){try{localStorage.removeItem(Ko)}catch(s){console.error("Error clearing Supabase config:",s)}}async function av(s,a){try{if(!s.startsWith("http://")&&!s.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(`${s}/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 $j(){return localStorage.getItem(Ko)?"ui":"none"}function Hj(){const s=Lr();return!s||!s.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Fg("https://placeholder.supabase.co","placeholder-key")):Fg(s.url,s.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=Hj();function Wg(){const s=Lr(),a=s?`${s.url}/functions/v1`:"",r=s?s.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 Vj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=Wg();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 p=await m.json().catch(()=>({})),g=typeof p.error=="string"?p.error:p.error?.message||`Request failed: ${m.status}`;return{error:{code:p.error?.code||"API_ERROR",message:g}}}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=Wg(),c={...r?.headers||{},"X-Supabase-Url":l.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":l.anonKey};return this.request(this.expressApiUrl,a,{...r,headers:c})}async getGmailAuthUrl(){return this.edgeRequest("/auth-gmail?action=url",{method:"GET"})}async connectGmail(a){return this.edgeRequest("/auth-gmail",{method:"POST",body:JSON.stringify({code:a})})}async startMicrosoftDeviceFlow(){return this.edgeRequest("/auth-microsoft?action=device-flow",{method:"POST"})}async pollMicrosoftDeviceCode(a){return this.edgeRequest("/auth-microsoft?action=poll",{method:"POST",body:JSON.stringify({deviceCode:a})})}async getAccounts(){return this.edgeRequest("/api-v1-accounts")}async disconnectAccount(a){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"DELETE"})}async updateAccount(a,r){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async getEmails(a={}){const r=new URLSearchParams;return a.limit&&r.set("limit",a.limit.toString()),a.offset&&r.set("offset",a.offset.toString()),a.category&&r.set("category",a.category),a.search&&r.set("search",a.search),a.sort_by&&r.set("sort_by",a.sort_by),a.sort_order&&r.set("sort_order",a.sort_order),this.edgeRequest(`/api-v1-emails?${r}`)}async getEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`)}async getEmailEvents(a){return this.edgeRequest(`/api-v1-emails/${a}/events`)}async deleteEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`,{method:"DELETE"})}async getCategorySummary(){return this.edgeRequest("/api-v1-emails/summary/categories")}async retryEmail(a){return this.expressRequest(`/api/emails/${a}/retry`,{method:"POST"})}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 ze=new Vj;async function sv(s){ze.setSupabaseClient(s);const{data:{session:a}}=await s.auth.getSession();a?.access_token&&ze.setToken(a.access_token),s.auth.onAuthStateChange((r,l)=>{ze.setToken(l?.access_token||null)})}const Ij=Object.freeze(Object.defineProperty({__proto__:null,api:ze,initializeApi:sv},Symbol.toStringTag,{value:"Module"}));function Gj({userId:s,onInsert:a,onUpdate:r,onDelete:l,enabled:c=!0}){const[d,h]=x.useState(!1);return x.useEffect(()=>{if(!c||!s){h(!1);return}const m=ct.channel(`emails-realtime-${s}`).on("postgres_changes",{event:"*",schema:"public",table:"emails"},y=>{y.eventType==="INSERT"?a?.(y.new):y.eventType==="UPDATE"?r?.(y.new):y.eventType==="DELETE"&&l?.(y.old.id)}).subscribe(y=>{h(y==="SUBSCRIBED")});return()=>{ct.removeChannel(m)}},[s,c,a,r,l]),{isSubscribed:d}}class Pj{ctx=null;enabled=!1;constructor(){const a=localStorage.getItem("ea_sounds_enabled");this.enabled=a!=="false"}setEnabled(a){this.enabled=a,localStorage.setItem("ea_sounds_enabled",a?"true":"false")}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])}playStart(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="sine",r.frequency.setValueAtTime(440,a.currentTime),r.frequency.exponentialRampToValueAtTime(880,a.currentTime+.2),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.05,a.currentTime+.05),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.2),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.2),this.haptic(10)}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 Ea=new Pj;let Qi=[],ef=new Set;function nv(){ef.forEach(s=>s())}const te={success:(s,a)=>No("success",s,a),error:(s,a)=>No("error",s,a),info:(s,a)=>No("info",s,a),warning:(s,a)=>No("warning",s,a)};function No(s,a,r=5e3){const l=Math.random().toString(36).substr(2,9);Qi=[...Qi,{id:l,type:s,message:a,duration:r}],nv(),r>0&&setTimeout(()=>rv(l),r)}function rv(s){Qi=Qi.filter(a=>a.id!==s),nv()}function Kj(){const[,s]=x.useState(0);return x.useEffect(()=>{const a=()=>s(r=>r+1);return ef.add(a),()=>{ef.delete(a)}},[]),Qi}const Yj={success:Hi,error:Dr,info:Or,warning:Rr},Jj={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 Xj({toast:s}){const a=Yj[s.type];return o.jsxs("div",{className:Oe("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-right-full duration-300",Jj[s.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:s.message}),o.jsx("button",{onClick:()=>rv(s.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(tl,{className:"w-4 h-4"})})]})}function Qj(){const s=Kj();return s.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:s.map(a=>o.jsx(Xj,{toast:a},a.id))})}function da(s,a){return s?typeof s=="string"?s:s.message||a:a}const iv={user:null,isAuthenticated:!1,profile:null,emails:[],accounts:[],rules:[],settings:null,stats:null,isLoading:!0,isInitialized:!1,error:null,selectedEmailId:null,emailsTotal:0,emailsOffset:0,sortBy:"created_at",sortOrder:"desc",activeCategory:null,activeSearch:""};function Zj(s,a){switch(a.type){case"SET_USER":return{...s,user:a.payload,isAuthenticated:!!a.payload,isLoading:!1};case"SET_LOADING":return{...s,isLoading:a.payload};case"SET_INITIALIZED":return{...s,isInitialized:a.payload};case"SET_ERROR":return{...s,error:a.payload,isLoading:!1};case"SET_EMAILS":return{...s,emails:a.payload.emails,emailsTotal:a.payload.total,emailsOffset:a.payload.offset,activeCategory:a.payload.category!==void 0?a.payload.category:s.activeCategory,activeSearch:a.payload.search!==void 0?a.payload.search:s.activeSearch,sortBy:a.payload.sortBy||s.sortBy,sortOrder:a.payload.sortOrder||s.sortOrder};case"ADD_EMAIL":{const r=a.payload,l=!s.activeCategory||r.category===s.activeCategory,c=!s.activeSearch||r.subject?.toLowerCase().includes(s.activeSearch.toLowerCase())||r.sender?.toLowerCase().includes(s.activeSearch.toLowerCase());return!l||!c?{...s,emailsTotal:s.emailsTotal+1}:{...s,emails:[r,...s.emails],emailsTotal:s.emailsTotal+1}}case"UPDATE_EMAIL":{const r=a.payload;if(s.emails.findIndex(h=>h.id===r.id)!==-1)return{...s,emails:s.emails.map(h=>h.id===r.id?r:h)};const c=!s.activeCategory||r.category===s.activeCategory,d=!s.activeSearch||r.subject?.toLowerCase().includes(s.activeSearch.toLowerCase())||r.sender?.toLowerCase().includes(s.activeSearch.toLowerCase());return c&&d?{...s,emails:[r,...s.emails]}:s}case"REMOVE_EMAIL":return{...s,emails:s.emails.filter(r=>r.id!==a.payload),emailsTotal:Math.max(0,s.emailsTotal-1)};case"SET_PROFILE":return{...s,profile:a.payload};case"UPDATE_PROFILE":return{...s,profile:a.payload};case"SET_ACCOUNTS":return{...s,accounts:a.payload};case"ADD_ACCOUNT":return{...s,accounts:[a.payload,...s.accounts]};case"REMOVE_ACCOUNT":return{...s,accounts:s.accounts.filter(r=>r.id!==a.payload)};case"SET_RULES":return{...s,rules:a.payload};case"ADD_RULE":return{...s,rules:[a.payload,...s.rules]};case"UPDATE_RULE":return{...s,rules:s.rules.map(r=>r.id===a.payload.id?a.payload:r)};case"REMOVE_RULE":return{...s,rules:s.rules.filter(r=>r.id!==a.payload)};case"SET_SETTINGS":return{...s,settings:a.payload};case"SET_STATS":return{...s,stats:a.payload};case"SET_SELECTED_EMAIL":return{...s,selectedEmailId:a.payload};case"CLEAR_DATA":return{...iv,isLoading:!1,isInitialized:!0};default:return s}}const lv=x.createContext(null);function Fj({children:s}){const[a,r]=x.useReducer(Zj,iv),l=x.useCallback(async(p,g=3,w=500)=>{for(let _=1;_<=g;_++){const S=await ze.getEmail(p);if(S.data?.email)return S.data.email;_<g&&await new Promise(E=>setTimeout(E,w))}return null},[]),c=x.useCallback(async p=>{const g=await l(p.id);g&&(r({type:"ADD_EMAIL",payload:g}),g.processing_status==="completed"&&(g.ai_analysis?.priority==="High"?(Ea.playAlert(),te.success("High Priority Email Processed!")):(Ea.playNotify(),te.info("New email processed"))))},[r,l]),d=x.useCallback(async p=>{const g=await l(p.id);g&&(r({type:"UPDATE_EMAIL",payload:g}),g.processing_status==="completed"&&p.processing_status==="completed"&&(g.ai_analysis?.priority==="High"?(Ea.playAlert(),te.success("High Priority Email Processed!")):(Ea.playNotify(),te.info("Email analysis complete"))))},[r,l]),h=x.useCallback(p=>{r({type:"REMOVE_EMAIL",payload:p})},[r]),{isSubscribed:m}=Gj({userId:a.user?.id,onInsert:c,onUpdate:d,onDelete:h,enabled:a.isAuthenticated});x.useEffect(()=>{async function p(){if(!Lr()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:w}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(w&&w.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await sv(ct);const{data:{session:_}}=await ct.auth.getSession();r({type:"SET_USER",payload:_?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:S}}=ct.auth.onAuthStateChange((E,j)=>{r({type:"SET_USER",payload:j?.user||null}),j||r({type:"CLEAR_DATA"})});return()=>S.unsubscribe()}catch(w){console.error("[AppContext] Init error:",w),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}p()},[]);const y={fetchEmails:async(p={})=>{const g=await ze.getEmails({limit:20,offset:p.offset||0,category:p.category,search:p.search,sort_by:p.sortBy||a.sortBy,sort_order:p.sortOrder||a.sortOrder});g.data&&r({type:"SET_EMAILS",payload:{emails:g.data.emails,total:g.data.total,offset:p.offset||0,category:p.category||null,search:p.search||"",sortBy:p.sortBy,sortOrder:p.sortOrder}})},fetchAccounts:async()=>{const p=await ze.getAccounts();p.data&&r({type:"SET_ACCOUNTS",payload:p.data.accounts})},fetchRules:async()=>{const p=await ze.getRules();p.data&&r({type:"SET_RULES",payload:p.data.rules})},fetchSettings:async()=>{const p=await ze.getSettings();p.data&&r({type:"SET_SETTINGS",payload:p.data.settings})},fetchProfile:async()=>{const p=await ze.getProfile();p.data&&r({type:"SET_PROFILE",payload:p.data})},fetchStats:async()=>{const p=await ze.getStats();p.data&&r({type:"SET_STATS",payload:p.data.stats})},executeAction:async(p,g,w)=>{const _=await ze.executeAction(p,g,w);if(_.data?.success){const S=a.emails.find(E=>E.id===p);return S&&r({type:"UPDATE_EMAIL",payload:{...S,action_taken:g}}),!0}return r({type:"SET_ERROR",payload:da(_.error,"Action failed")}),!1},triggerSync:async p=>{const g=p?await ze.triggerSync(p):await ze.syncAll();return await y.fetchAccounts(),g.error?(r({type:"SET_ERROR",payload:da(g.error,"Sync failed")}),!1):!0},disconnectAccount:async p=>{const g=await ze.disconnectAccount(p);return g.data?.success?(r({type:"REMOVE_ACCOUNT",payload:p}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to disconnect")}),!1)},updateSettings:async p=>{const g=await ze.updateSettings(p);return g.data?(r({type:"SET_SETTINGS",payload:g.data.settings}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to update settings")}),!1)},updateProfile:async p=>{const g=await ze.updateProfile(p);return g.data?(r({type:"UPDATE_PROFILE",payload:g.data}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to update profile")}),!1)},updateAccount:async(p,g)=>{const w=await ze.updateAccount(p,g);return w.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(_=>_.id===p?{..._,...g}:_)}),!0):(r({type:"SET_ERROR",payload:da(w.error,"Failed to update account")}),!1)},retryProcessing:async p=>{const g=await ze.retryEmail(p);if(g.data?.success){const w=a.emails.find(_=>_.id===p);return w&&r({type:"UPDATE_EMAIL",payload:{...w,processing_status:"pending",processing_error:null}}),!0}return r({type:"SET_ERROR",payload:da(g.error,"Retry failed")}),!1},createRule:async p=>{const g=await ze.createRule(p);return g.data?(r({type:"ADD_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to create rule")}),!1)},updateRule:async(p,g)=>{const w=await ze.updateRule(p,g);return w.data?(r({type:"UPDATE_RULE",payload:w.data.rule}),!0):(r({type:"SET_ERROR",payload:da(w.error,"Failed to update rule")}),!1)},deleteRule:async p=>{const g=await ze.deleteRule(p);return g.data?.success?(r({type:"REMOVE_RULE",payload:p}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to delete rule")}),!1)},toggleRule:async p=>{const g=await ze.toggleRule(p);return g.data?(r({type:"UPDATE_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to toggle rule")}),!1)}};return o.jsx(lv.Provider,{value:{state:a,isSubscribed:m,dispatch:r,actions:y},children:s})}function Br(){const s=x.useContext(lv);if(!s)throw new Error("useApp must be used within AppProvider");return s}const Wj=x.createContext(void 0);function eN({children:s,value:a}){return o.jsx(Wj.Provider,{value:a,children:s})}const ov=x.createContext(null);function tN({children:s}){const[a,r]=x.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(ov.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:s})}function cv(){const s=x.useContext(ov);if(!s)throw new Error("useTerminal must be used within a TerminalProvider");return s}const At=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("rounded-xl border bg-card text-card-foreground shadow",s),...a}));At.displayName="Card";const Ta=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("flex flex-col space-y-1.5 p-6",s),...a}));Ta.displayName="CardHeader";const Aa=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("font-semibold leading-none tracking-tight",s),...a}));Aa.displayName="CardTitle";const ts=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("text-sm text-muted-foreground",s),...a}));ts.displayName="CardDescription";const Ca=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("p-6 pt-0",s),...a}));Ca.displayName="CardContent";const uv=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("flex items-center p-6 pt-0",s),...a}));uv.displayName="CardFooter";class aN extends x.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(At,{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(Rr,{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(Z,{onClick:this.handleReset,variant:"outline",children:[o.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(Z,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function mt({size:s="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:Oe("flex flex-col items-center justify-center gap-3",a),children:[o.jsx($t,{className:Oe("animate-spin text-primary",l[s])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function qi({text:s="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(mt,{size:"lg",text:s})})}function sN(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(mt,{size:"md"})})}function Ls(s,a,{checkForDefaultPrevented:r=!0}={}){return function(c){if(s?.(c),r===!1||!c.defaultPrevented)return a?.(c)}}function nN(s,a){const r=x.createContext(a),l=d=>{const{children:h,...m}=d,y=x.useMemo(()=>m,Object.values(m));return o.jsx(r.Provider,{value:y,children:h})};l.displayName=s+"Provider";function c(d){const h=x.useContext(r);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[l,c]}function rN(s,a=[]){let r=[];function l(d,h){const m=x.createContext(h),y=r.length;r=[...r,h];const p=w=>{const{scope:_,children:S,...E}=w,j=_?.[s]?.[y]||m,O=x.useMemo(()=>E,Object.values(E));return o.jsx(j.Provider,{value:O,children:S})};p.displayName=d+"Provider";function g(w,_){const S=_?.[s]?.[y]||m,E=x.useContext(S);if(E)return E;if(h!==void 0)return h;throw new Error(`\`${w}\` must be used within \`${d}\``)}return[p,g]}const c=()=>{const d=r.map(h=>x.createContext(h));return function(m){const y=m?.[s]||d;return x.useMemo(()=>({[`__scope${s}`]:{...m,[s]:y}}),[m,y])}};return c.scopeName=s,[l,iN(c,...a)]}function iN(...s){const a=s[0];if(s.length===1)return a;const r=()=>{const l=s.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const h=l.reduce((m,{useScope:y,scopeName:p})=>{const w=y(d)[`__scope${p}`];return{...m,...w}},{});return x.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var Zi=globalThis?.document?x.useLayoutEffect:()=>{},lN=rf[" useId ".trim().toString()]||(()=>{}),oN=0;function kd(s){const[a,r]=x.useState(lN());return Zi(()=>{r(l=>l??String(oN++))},[s]),s||(a?`radix-${a}`:"")}var cN=rf[" useInsertionEffect ".trim().toString()]||Zi;function uN({prop:s,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=dN({defaultProp:a,onChange:r}),m=s!==void 0,y=m?s:c;{const g=x.useRef(s!==void 0);x.useEffect(()=>{const w=g.current;w!==m&&console.warn(`${l} is changing from ${w?"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.`),g.current=m},[m,l])}const p=x.useCallback(g=>{if(m){const w=fN(g)?g(s):g;w!==s&&h.current?.(w)}else d(g)},[m,s,d,h]);return[y,p]}function dN({defaultProp:s,onChange:a}){const[r,l]=x.useState(s),c=x.useRef(r),d=x.useRef(a);return cN(()=>{d.current=a},[a]),x.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function fN(s){return typeof s=="function"}var dv=py();const hN=sf(dv);function mN(s){const a=pN(s),r=x.forwardRef((l,c)=>{const{children:d,...h}=l,m=x.Children.toArray(d),y=m.find(yN);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function pN(s){const a=x.forwardRef((r,l)=>{const{children:c,...d}=r;if(x.isValidElement(c)){const h=bN(c),m=vN(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Io(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var gN=Symbol("radix.slottable");function yN(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===gN}function vN(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function bN(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var xN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ss=xN.reduce((s,a)=>{const r=mN(`Primitive.${a}`),l=x.forwardRef((c,d)=>{const{asChild:h,...m}=c,y=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(y,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...s,[a]:l}},{});function wN(s,a){s&&dv.flushSync(()=>s.dispatchEvent(a))}function Fi(s){const a=x.useRef(s);return x.useEffect(()=>{a.current=s}),x.useMemo(()=>(...r)=>a.current?.(...r),[])}function _N(s,a=globalThis?.document){const r=Fi(s);x.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 SN="DismissableLayer",tf="dismissableLayer.update",jN="dismissableLayer.pointerDownOutside",NN="dismissableLayer.focusOutside",ey,fv=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hv=x.forwardRef((s,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...y}=s,p=x.useContext(fv),[g,w]=x.useState(null),_=g?.ownerDocument??globalThis?.document,[,S]=x.useState({}),E=bn(a,P=>w(P)),j=Array.from(p.layers),[O]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),D=j.indexOf(O),q=g?j.indexOf(g):-1,B=p.layersWithOutsidePointerEventsDisabled.size>0,G=q>=D,W=AN(P=>{const Q=P.target,ce=[...p.branches].some(Je=>Je.contains(Q));!G||ce||(c?.(P),h?.(P),P.defaultPrevented||m?.())},_),J=CN(P=>{const Q=P.target;[...p.branches].some(Je=>Je.contains(Q))||(d?.(P),h?.(P),P.defaultPrevented||m?.())},_);return _N(P=>{q===p.layers.size-1&&(l?.(P),!P.defaultPrevented&&m&&(P.preventDefault(),m()))},_),x.useEffect(()=>{if(g)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(ey=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(g)),p.layers.add(g),ty(),()=>{r&&p.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=ey)}},[g,_,r,p]),x.useEffect(()=>()=>{g&&(p.layers.delete(g),p.layersWithOutsidePointerEventsDisabled.delete(g),ty())},[g,p]),x.useEffect(()=>{const P=()=>S({});return document.addEventListener(tf,P),()=>document.removeEventListener(tf,P)},[]),o.jsx(ss.div,{...y,ref:E,style:{pointerEvents:B?G?"auto":"none":void 0,...s.style},onFocusCapture:Ls(s.onFocusCapture,J.onFocusCapture),onBlurCapture:Ls(s.onBlurCapture,J.onBlurCapture),onPointerDownCapture:Ls(s.onPointerDownCapture,W.onPointerDownCapture)})});hv.displayName=SN;var EN="DismissableLayerBranch",TN=x.forwardRef((s,a)=>{const r=x.useContext(fv),l=x.useRef(null),c=bn(a,l);return x.useEffect(()=>{const d=l.current;if(d)return r.branches.add(d),()=>{r.branches.delete(d)}},[r.branches]),o.jsx(ss.div,{...s,ref:c})});TN.displayName=EN;function AN(s,a=globalThis?.document){const r=Fi(s),l=x.useRef(!1),c=x.useRef(()=>{});return x.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let y=function(){mv(jN,r,p,{discrete:!0})};const p={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=y,a.addEventListener("click",c.current,{once:!0})):y()}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 CN(s,a=globalThis?.document){const r=Fi(s),l=x.useRef(!1);return x.useEffect(()=>{const c=d=>{d.target&&!l.current&&mv(NN,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 ty(){const s=new CustomEvent(tf);document.dispatchEvent(s)}function mv(s,a,r,{discrete:l}){const c=r.originalEvent.target,d=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:r});a&&c.addEventListener(s,a,{once:!0}),l?wN(c,d):c.dispatchEvent(d)}var Od="focusScope.autoFocusOnMount",Rd="focusScope.autoFocusOnUnmount",ay={bubbles:!1,cancelable:!0},kN="FocusScope",pv=x.forwardRef((s,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=s,[m,y]=x.useState(null),p=Fi(c),g=Fi(d),w=x.useRef(null),_=bn(a,j=>y(j)),S=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(l){let j=function(B){if(S.paused||!m)return;const G=B.target;m.contains(G)?w.current=G:Ds(w.current,{select:!0})},O=function(B){if(S.paused||!m)return;const G=B.relatedTarget;G!==null&&(m.contains(G)||Ds(w.current,{select:!0}))},D=function(B){if(document.activeElement===document.body)for(const W of B)W.removedNodes.length>0&&Ds(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",O);const q=new MutationObserver(D);return m&&q.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",O),q.disconnect()}}},[l,m,S.paused]),x.useEffect(()=>{if(m){ny.add(S);const j=document.activeElement;if(!m.contains(j)){const D=new CustomEvent(Od,ay);m.addEventListener(Od,p),m.dispatchEvent(D),D.defaultPrevented||(ON(UN(gv(m)),{select:!0}),document.activeElement===j&&Ds(m))}return()=>{m.removeEventListener(Od,p),setTimeout(()=>{const D=new CustomEvent(Rd,ay);m.addEventListener(Rd,g),m.dispatchEvent(D),D.defaultPrevented||Ds(j??document.body,{select:!0}),m.removeEventListener(Rd,g),ny.remove(S)},0)}}},[m,p,g,S]);const E=x.useCallback(j=>{if(!r&&!l||S.paused)return;const O=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,D=document.activeElement;if(O&&D){const q=j.currentTarget,[B,G]=RN(q);B&&G?!j.shiftKey&&D===G?(j.preventDefault(),r&&Ds(B,{select:!0})):j.shiftKey&&D===B&&(j.preventDefault(),r&&Ds(G,{select:!0})):D===q&&j.preventDefault()}},[r,l,S.paused]);return o.jsx(ss.div,{tabIndex:-1,...h,ref:_,onKeyDown:E})});pv.displayName=kN;function ON(s,{select:a=!1}={}){const r=document.activeElement;for(const l of s)if(Ds(l,{select:a}),document.activeElement!==r)return}function RN(s){const a=gv(s),r=sy(a,s),l=sy(a.reverse(),s);return[r,l]}function gv(s){const a=[],r=document.createTreeWalker(s,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 sy(s,a){for(const r of s)if(!DN(r,{upTo:a}))return r}function DN(s,{upTo:a}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(a!==void 0&&s===a)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function MN(s){return s instanceof HTMLInputElement&&"select"in s}function Ds(s,{select:a=!1}={}){if(s&&s.focus){const r=document.activeElement;s.focus({preventScroll:!0}),s!==r&&MN(s)&&a&&s.select()}}var ny=zN();function zN(){let s=[];return{add(a){const r=s[0];a!==r&&r?.pause(),s=ry(s,a),s.unshift(a)},remove(a){s=ry(s,a),s[0]?.resume()}}}function ry(s,a){const r=[...s],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function UN(s){return s.filter(a=>a.tagName!=="A")}var LN="Portal",yv=x.forwardRef((s,a)=>{const{container:r,...l}=s,[c,d]=x.useState(!1);Zi(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?hN.createPortal(o.jsx(ss.div,{...l,ref:a}),h):null});yv.displayName=LN;function BN(s,a){return x.useReducer((r,l)=>a[r][l]??r,s)}var Yo=s=>{const{present:a,children:r}=s,l=qN(a),c=typeof r=="function"?r({present:l.isPresent}):x.Children.only(r),d=bn(l.ref,$N(c));return typeof r=="function"||l.isPresent?x.cloneElement(c,{ref:d}):null};Yo.displayName="Presence";function qN(s){const[a,r]=x.useState(),l=x.useRef(null),c=x.useRef(s),d=x.useRef("none"),h=s?"mounted":"unmounted",[m,y]=BN(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const p=Eo(l.current);d.current=m==="mounted"?p:"none"},[m]),Zi(()=>{const p=l.current,g=c.current;if(g!==s){const _=d.current,S=Eo(p);s?y("MOUNT"):S==="none"||p?.display==="none"?y("UNMOUNT"):y(g&&_!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,y]),Zi(()=>{if(a){let p;const g=a.ownerDocument.defaultView??window,w=S=>{const j=Eo(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&j&&(y("ANIMATION_END"),!c.current)){const O=a.style.animationFillMode;a.style.animationFillMode="forwards",p=g.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=O)})}},_=S=>{S.target===a&&(d.current=Eo(l.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",w),a.addEventListener("animationend",w),()=>{g.clearTimeout(p),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",w),a.removeEventListener("animationend",w)}}else y("ANIMATION_END")},[a,y]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:x.useCallback(p=>{l.current=p?getComputedStyle(p):null,r(p)},[])}}function Eo(s){return s?.animationName||"none"}function $N(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Dd=0;function HN(){x.useEffect(()=>{const s=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",s[0]??iy()),document.body.insertAdjacentElement("beforeend",s[1]??iy()),Dd++,()=>{Dd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Dd--}},[])}function iy(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var Do="right-scroll-bar-position",Mo="width-before-scroll-bar",VN="with-scroll-bars-hidden",IN="--removed-body-scroll-bar-size";function Md(s,a){return typeof s=="function"?s(a):s&&(s.current=a),s}function GN(s,a){var r=x.useState(function(){return{value:s,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 PN=typeof window<"u"?x.useLayoutEffect:x.useEffect,ly=new WeakMap;function KN(s,a){var r=GN(null,function(l){return s.forEach(function(c){return Md(c,l)})});return PN(function(){var l=ly.get(r);if(l){var c=new Set(l),d=new Set(s),h=r.current;c.forEach(function(m){d.has(m)||Md(m,null)}),d.forEach(function(m){c.has(m)||Md(m,h)})}ly.set(r,s)},[s]),r}function YN(s){return s}function JN(s,a){a===void 0&&(a=YN);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]:s},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 y=function(){var g=h;h=[],g.forEach(d)},p=function(){return Promise.resolve().then(y)};p(),r={push:function(g){h.push(g),p()},filter:function(g){return h=h.filter(g),r}}}};return c}function XN(s){s===void 0&&(s={});var a=JN(null);return a.options=Na({async:!0,ssr:!1},s),a}var vv=function(s){var a=s.sideCar,r=Ur(s,["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 x.createElement(l,Na({},r))};vv.isSideCarExport=!0;function QN(s,a){return s.useMedium(a),vv}var bv=XN(),zd=function(){},Jo=x.forwardRef(function(s,a){var r=x.useRef(null),l=x.useState({onScrollCapture:zd,onWheelCapture:zd,onTouchMoveCapture:zd}),c=l[0],d=l[1],h=s.forwardProps,m=s.children,y=s.className,p=s.removeScrollBar,g=s.enabled,w=s.shards,_=s.sideCar,S=s.noRelative,E=s.noIsolation,j=s.inert,O=s.allowPinchZoom,D=s.as,q=D===void 0?"div":D,B=s.gapMode,G=Ur(s,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),W=_,J=KN([r,a]),P=Na(Na({},G),c);return x.createElement(x.Fragment,null,g&&x.createElement(W,{sideCar:bv,removeScrollBar:p,shards:w,noRelative:S,noIsolation:E,inert:j,setCallbacks:d,allowPinchZoom:!!O,lockRef:r,gapMode:B}),h?x.cloneElement(x.Children.only(m),Na(Na({},P),{ref:J})):x.createElement(q,Na({},P,{className:y,ref:J}),m))});Jo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Jo.classNames={fullWidth:Mo,zeroRight:Do};var ZN=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function FN(){if(!document)return null;var s=document.createElement("style");s.type="text/css";var a=ZN();return a&&s.setAttribute("nonce",a),s}function WN(s,a){s.styleSheet?s.styleSheet.cssText=a:s.appendChild(document.createTextNode(a))}function eE(s){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(s)}var tE=function(){var s=0,a=null;return{add:function(r){s==0&&(a=FN())&&(WN(a,r),eE(a)),s++},remove:function(){s--,!s&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},aE=function(){var s=tE();return function(a,r){x.useEffect(function(){return s.add(a),function(){s.remove()}},[a&&r])}},xv=function(){var s=aE(),a=function(r){var l=r.styles,c=r.dynamic;return s(l,c),null};return a},sE={left:0,top:0,right:0,gap:0},Ud=function(s){return parseInt(s||"",10)||0},nE=function(s){var a=window.getComputedStyle(document.body),r=a[s==="padding"?"paddingLeft":"marginLeft"],l=a[s==="padding"?"paddingTop":"marginTop"],c=a[s==="padding"?"paddingRight":"marginRight"];return[Ud(r),Ud(l),Ud(c)]},rE=function(s){if(s===void 0&&(s="margin"),typeof window>"u")return sE;var a=nE(s),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])}},iE=xv(),Cr="data-scroll-locked",lE=function(s,a,r,l){var c=s.left,d=s.top,h=s.right,m=s.gap;return r===void 0&&(r="margin"),`
|
|
52
52
|
.`.concat(VN,` {
|
|
53
53
|
overflow: hidden `).concat(l,`;
|
|
54
54
|
padding-right: `).concat(m,"px ").concat(l,`;
|
|
55
55
|
}
|
|
56
|
-
body[`).concat(
|
|
56
|
+
body[`).concat(Cr,`] {
|
|
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 @@ ${D}`}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(
|
|
85
|
+
body[`).concat(Cr,`] {
|
|
86
86
|
`).concat(IN,": ").concat(m,`px;
|
|
87
87
|
}
|
|
88
|
-
`)},oy=function(){var s=parseInt(document.body.getAttribute(
|
|
88
|
+
`)},oy=function(){var s=parseInt(document.body.getAttribute(Cr)||"0",10);return isFinite(s)?s:0},oE=function(){x.useEffect(function(){return document.body.setAttribute(Cr,(oy()+1).toString()),function(){var s=oy()-1;s<=0?document.body.removeAttribute(Cr):document.body.setAttribute(Cr,s.toString())}},[])},cE=function(s){var a=s.noRelative,r=s.noImportant,l=s.gapMode,c=l===void 0?"margin":l;oE();var d=x.useMemo(function(){return rE(c)},[c]);return x.createElement(iE,{styles:lE(d,!a,c,r?"":"!important")})},af=!1;if(typeof window<"u")try{var To=Object.defineProperty({},"passive",{get:function(){return af=!0,!0}});window.addEventListener("test",To,To),window.removeEventListener("test",To,To)}catch{af=!1}var xr=af?{passive:!1}:!1,uE=function(s){return s.tagName==="TEXTAREA"},wv=function(s,a){if(!(s instanceof Element))return!1;var r=window.getComputedStyle(s);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!uE(s)&&r[a]==="visible")},dE=function(s){return wv(s,"overflowY")},fE=function(s){return wv(s,"overflowX")},cy=function(s,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=_v(s,l);if(c){var d=Sv(s,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},hE=function(s){var a=s.scrollTop,r=s.scrollHeight,l=s.clientHeight;return[a,r,l]},mE=function(s){var a=s.scrollLeft,r=s.scrollWidth,l=s.clientWidth;return[a,r,l]},_v=function(s,a){return s==="v"?dE(a):fE(a)},Sv=function(s,a){return s==="v"?hE(a):mE(a)},pE=function(s,a){return s==="h"&&a==="rtl"?-1:1},gE=function(s,a,r,l,c){var d=pE(s,window.getComputedStyle(a).direction),h=d*l,m=r.target,y=a.contains(m),p=!1,g=h>0,w=0,_=0;do{if(!m)break;var S=Sv(s,m),E=S[0],j=S[1],O=S[2],D=j-O-d*E;(E||D)&&_v(s,m)&&(w+=D,_+=E);var q=m.parentNode;m=q&&q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?q.host:q}while(!y&&m!==document.body||y&&(a.contains(m)||a===m));return(g&&Math.abs(w)<1||!g&&Math.abs(_)<1)&&(p=!0),p},Ao=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},uy=function(s){return[s.deltaX,s.deltaY]},dy=function(s){return s&&"current"in s?s.current:s},yE=function(s,a){return s[0]===a[0]&&s[1]===a[1]},vE=function(s){return`
|
|
89
89
|
.block-interactivity-`.concat(s,` {pointer-events: none;}
|
|
90
90
|
.allow-interactivity-`).concat(s,` {pointer-events: all;}
|
|
91
|
-
`)},b2=0,wr=[];function x2(s){var a=x.useRef([]),r=x.useRef([0,0]),l=x.useRef(),c=x.useState(b2++)[0],d=x.useState(xv)[0],h=x.useRef(s);x.useEffect(function(){h.current=s},[s]),x.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(c));var j=l1([s.lockRef.current],(s.shards||[]).map(dy),!0).filter(Boolean);return j.forEach(function(O){return O.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(O){return O.classList.remove("allow-interactivity-".concat(c))})}}},[s.inert,s.lockRef.current,s.shards]);var m=x.useCallback(function(j,O){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!h.current.allowPinchZoom;var D=Ao(j),q=r.current,B="deltaX"in j?j.deltaX:q[0]-D[0],G="deltaY"in j?j.deltaY:q[1]-D[1],W,J=j.target,P=Math.abs(B)>Math.abs(G)?"h":"v";if("touches"in j&&P==="h"&&J.type==="range")return!1;var Q=window.getSelection(),ce=Q&&Q.anchorNode,Je=ce?ce===J||ce.contains(J):!1;if(Je)return!1;var ve=cy(P,J);if(!ve)return!0;if(ve?W=P:(W=P==="v"?"h":"v",ve=cy(P,J)),!ve)return!1;if(!l.current&&"changedTouches"in j&&(B||G)&&(l.current=W),!W)return!0;var pe=l.current||W;return g2(pe,O,j,pe==="h"?B:G)},[]),p=x.useCallback(function(j){var O=j;if(!(!wr.length||wr[wr.length-1]!==d)){var D="deltaY"in O?uy(O):Ao(O),q=a.current.filter(function(W){return W.name===O.type&&(W.target===O.target||O.target===W.shadowParent)&&y2(W.delta,D)})[0];if(q&&q.should){O.cancelable&&O.preventDefault();return}if(!q){var B=(h.current.shards||[]).map(dy).filter(Boolean).filter(function(W){return W.contains(O.target)}),G=B.length>0?m(O,B[0]):!h.current.noIsolation;G&&O.cancelable&&O.preventDefault()}}},[]),g=x.useCallback(function(j,O,D,q){var B={name:j,delta:O,target:D,should:q,shadowParent:w2(D)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(G){return G!==B})},1)},[]),v=x.useCallback(function(j){r.current=Ao(j),l.current=void 0},[]),w=x.useCallback(function(j){g(j.type,uy(j),j.target,m(j,s.lockRef.current))},[]),_=x.useCallback(function(j){g(j.type,Ao(j),j.target,m(j,s.lockRef.current))},[]);x.useEffect(function(){return wr.push(d),s.setCallbacks({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:_}),document.addEventListener("wheel",p,xr),document.addEventListener("touchmove",p,xr),document.addEventListener("touchstart",v,xr),function(){wr=wr.filter(function(j){return j!==d}),document.removeEventListener("wheel",p,xr),document.removeEventListener("touchmove",p,xr),document.removeEventListener("touchstart",v,xr)}},[]);var S=s.removeScrollBar,E=s.inert;return x.createElement(x.Fragment,null,E?x.createElement(d,{styles:v2(c)}):null,S?x.createElement(c2,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function w2(s){for(var a=null;s!==null;)s instanceof ShadowRoot&&(a=s.host,s=s.host),s=s.parentNode;return a}const _2=QN(bv,x2);var jv=x.forwardRef(function(s,a){return x.createElement(Jo,Na({},s,{ref:a,sideCar:_2}))});jv.classNames=Jo.classNames;var S2=function(s){if(typeof document>"u")return null;var a=Array.isArray(s)?s[0]:s;return a.ownerDocument.body},_r=new WeakMap,ko=new WeakMap,Co={},Ld=0,Nv=function(s){return s&&(s.host||Nv(s.parentNode))},j2=function(s,a){return a.map(function(r){if(s.contains(r))return r;var l=Nv(r);return l&&s.contains(l)?l:(console.error("aria-hidden",r,"in not contained inside",s,". Doing nothing"),null)}).filter(function(r){return!!r})},N2=function(s,a,r,l){var c=j2(a,Array.isArray(s)?s:[s]);Co[r]||(Co[r]=new WeakMap);var d=Co[r],h=[],m=new Set,p=new Set(c),g=function(w){!w||m.has(w)||(m.add(w),g(w.parentNode))};c.forEach(g);var v=function(w){!w||p.has(w)||Array.prototype.forEach.call(w.children,function(_){if(m.has(_))v(_);else try{var S=_.getAttribute(l),E=S!==null&&S!=="false",j=(_r.get(_)||0)+1,O=(d.get(_)||0)+1;_r.set(_,j),d.set(_,O),h.push(_),j===1&&E&&ko.set(_,!0),O===1&&_.setAttribute(r,"true"),E||_.setAttribute(l,"true")}catch(D){console.error("aria-hidden: cannot operate on ",_,D)}})};return v(a),m.clear(),Ld++,function(){h.forEach(function(w){var _=_r.get(w)-1,S=d.get(w)-1;_r.set(w,_),d.set(w,S),_||(ko.has(w)||w.removeAttribute(l),ko.delete(w)),S||w.removeAttribute(r)}),Ld--,Ld||(_r=new WeakMap,_r=new WeakMap,ko=new WeakMap,Co={})}},E2=function(s,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(s)?s:[s]),c=S2(s);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),N2(l,c,r,"aria-hidden")):function(){return null}};function T2(s){const a=A2(s),r=x.forwardRef((l,c)=>{const{children:d,...h}=l,m=x.Children.toArray(d),p=m.find(C2);if(p){const g=p.props.children,v=m.map(w=>w===p?x.Children.count(g)>1?x.Children.only(null):x.isValidElement(g)?g.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(g)?x.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function A2(s){const a=x.forwardRef((r,l)=>{const{children:c,...d}=r;if(x.isValidElement(c)){const h=R2(c),m=O2(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Io(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var k2=Symbol("radix.slottable");function C2(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===k2}function O2(s,a){const r={...a};for(const l in a){const c=s[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{...s,...r}}function R2(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Xo="Dialog",[Ev]=rN(Xo),[D2,ga]=Ev(Xo),Tv=s=>{const{__scopeDialog:a,children:r,open:l,defaultOpen:c,onOpenChange:d,modal:h=!0}=s,m=x.useRef(null),p=x.useRef(null),[g,v]=uN({prop:l,defaultProp:c??!1,onChange:d,caller:Xo});return o.jsx(D2,{scope:a,triggerRef:m,contentRef:p,contentId:Cd(),titleId:Cd(),descriptionId:Cd(),open:g,onOpenChange:v,onOpenToggle:x.useCallback(()=>v(w=>!w),[v]),modal:h,children:r})};Tv.displayName=Xo;var Av="DialogTrigger",M2=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Av,r),d=bn(a,c.triggerRef);return o.jsx(as.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":yf(c.open),...l,ref:d,onClick:Ls(s.onClick,c.onOpenToggle)})});M2.displayName=Av;var pf="DialogPortal",[z2,kv]=Ev(pf,{forceMount:void 0}),Cv=s=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=s,d=ga(pf,a);return o.jsx(z2,{scope:a,forceMount:r,children:x.Children.map(l,h=>o.jsx(Yo,{present:r||d.open,children:o.jsx(yv,{asChild:!0,container:c,children:h})}))})};Cv.displayName=pf;var Vo="DialogOverlay",Ov=x.forwardRef((s,a)=>{const r=kv(Vo,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=ga(Vo,s.__scopeDialog);return d.modal?o.jsx(Yo,{present:l||d.open,children:o.jsx(L2,{...c,ref:a})}):null});Ov.displayName=Vo;var U2=T2("DialogOverlay.RemoveScroll"),L2=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Vo,r);return o.jsx(jv,{as:U2,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(as.div,{"data-state":yf(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),vn="DialogContent",Rv=x.forwardRef((s,a)=>{const r=kv(vn,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=ga(vn,s.__scopeDialog);return o.jsx(Yo,{present:l||d.open,children:d.modal?o.jsx(B2,{...c,ref:a}):o.jsx(q2,{...c,ref:a})})});Rv.displayName=vn;var B2=x.forwardRef((s,a)=>{const r=ga(vn,s.__scopeDialog),l=x.useRef(null),c=bn(a,r.contentRef,l);return x.useEffect(()=>{const d=l.current;if(d)return E2(d)},[]),o.jsx(Dv,{...s,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ls(s.onCloseAutoFocus,d=>{d.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ls(s.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:Ls(s.onFocusOutside,d=>d.preventDefault())})}),q2=x.forwardRef((s,a)=>{const r=ga(vn,s.__scopeDialog),l=x.useRef(!1),c=x.useRef(!1);return o.jsx(Dv,{...s,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{s.onCloseAutoFocus?.(d),d.defaultPrevented||(l.current||r.triggerRef.current?.focus(),d.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:d=>{s.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()}})}),Dv=x.forwardRef((s,a)=>{const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,...h}=s,m=ga(vn,r),p=x.useRef(null),g=bn(a,p);return HN(),o.jsxs(o.Fragment,{children:[o.jsx(pv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(hv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":yf(m.open),...h,ref:g,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx($2,{titleId:m.titleId}),o.jsx(V2,{contentRef:p,descriptionId:m.descriptionId})]})]})}),gf="DialogTitle",Mv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(gf,r);return o.jsx(as.h2,{id:c.titleId,...l,ref:a})});Mv.displayName=gf;var zv="DialogDescription",Uv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(zv,r);return o.jsx(as.p,{id:c.descriptionId,...l,ref:a})});Uv.displayName=zv;var Lv="DialogClose",Bv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Lv,r);return o.jsx(as.button,{type:"button",...l,ref:a,onClick:Ls(s.onClick,()=>c.onOpenChange(!1))})});Bv.displayName=Lv;function yf(s){return s?"open":"closed"}var qv="DialogTitleWarning",[ME,$v]=nN(qv,{contentName:vn,titleName:gf,docsSlug:"dialog"}),$2=({titleId:s})=>{const a=$v(qv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
|
|
91
|
+
`)},bE=0,wr=[];function xE(s){var a=x.useRef([]),r=x.useRef([0,0]),l=x.useRef(),c=x.useState(bE++)[0],d=x.useState(xv)[0],h=x.useRef(s);x.useEffect(function(){h.current=s},[s]),x.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(c));var j=l1([s.lockRef.current],(s.shards||[]).map(dy),!0).filter(Boolean);return j.forEach(function(O){return O.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(O){return O.classList.remove("allow-interactivity-".concat(c))})}}},[s.inert,s.lockRef.current,s.shards]);var m=x.useCallback(function(j,O){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!h.current.allowPinchZoom;var D=Ao(j),q=r.current,B="deltaX"in j?j.deltaX:q[0]-D[0],G="deltaY"in j?j.deltaY:q[1]-D[1],W,J=j.target,P=Math.abs(B)>Math.abs(G)?"h":"v";if("touches"in j&&P==="h"&&J.type==="range")return!1;var Q=window.getSelection(),ce=Q&&Q.anchorNode,Je=ce?ce===J||ce.contains(J):!1;if(Je)return!1;var ve=cy(P,J);if(!ve)return!0;if(ve?W=P:(W=P==="v"?"h":"v",ve=cy(P,J)),!ve)return!1;if(!l.current&&"changedTouches"in j&&(B||G)&&(l.current=W),!W)return!0;var pe=l.current||W;return gE(pe,O,j,pe==="h"?B:G)},[]),y=x.useCallback(function(j){var O=j;if(!(!wr.length||wr[wr.length-1]!==d)){var D="deltaY"in O?uy(O):Ao(O),q=a.current.filter(function(W){return W.name===O.type&&(W.target===O.target||O.target===W.shadowParent)&&yE(W.delta,D)})[0];if(q&&q.should){O.cancelable&&O.preventDefault();return}if(!q){var B=(h.current.shards||[]).map(dy).filter(Boolean).filter(function(W){return W.contains(O.target)}),G=B.length>0?m(O,B[0]):!h.current.noIsolation;G&&O.cancelable&&O.preventDefault()}}},[]),p=x.useCallback(function(j,O,D,q){var B={name:j,delta:O,target:D,should:q,shadowParent:wE(D)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(G){return G!==B})},1)},[]),g=x.useCallback(function(j){r.current=Ao(j),l.current=void 0},[]),w=x.useCallback(function(j){p(j.type,uy(j),j.target,m(j,s.lockRef.current))},[]),_=x.useCallback(function(j){p(j.type,Ao(j),j.target,m(j,s.lockRef.current))},[]);x.useEffect(function(){return wr.push(d),s.setCallbacks({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:_}),document.addEventListener("wheel",y,xr),document.addEventListener("touchmove",y,xr),document.addEventListener("touchstart",g,xr),function(){wr=wr.filter(function(j){return j!==d}),document.removeEventListener("wheel",y,xr),document.removeEventListener("touchmove",y,xr),document.removeEventListener("touchstart",g,xr)}},[]);var S=s.removeScrollBar,E=s.inert;return x.createElement(x.Fragment,null,E?x.createElement(d,{styles:vE(c)}):null,S?x.createElement(cE,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function wE(s){for(var a=null;s!==null;)s instanceof ShadowRoot&&(a=s.host,s=s.host),s=s.parentNode;return a}const _E=QN(bv,xE);var jv=x.forwardRef(function(s,a){return x.createElement(Jo,Na({},s,{ref:a,sideCar:_E}))});jv.classNames=Jo.classNames;var SE=function(s){if(typeof document>"u")return null;var a=Array.isArray(s)?s[0]:s;return a.ownerDocument.body},_r=new WeakMap,Co=new WeakMap,ko={},Ld=0,Nv=function(s){return s&&(s.host||Nv(s.parentNode))},jE=function(s,a){return a.map(function(r){if(s.contains(r))return r;var l=Nv(r);return l&&s.contains(l)?l:(console.error("aria-hidden",r,"in not contained inside",s,". Doing nothing"),null)}).filter(function(r){return!!r})},NE=function(s,a,r,l){var c=jE(a,Array.isArray(s)?s:[s]);ko[r]||(ko[r]=new WeakMap);var d=ko[r],h=[],m=new Set,y=new Set(c),p=function(w){!w||m.has(w)||(m.add(w),p(w.parentNode))};c.forEach(p);var g=function(w){!w||y.has(w)||Array.prototype.forEach.call(w.children,function(_){if(m.has(_))g(_);else try{var S=_.getAttribute(l),E=S!==null&&S!=="false",j=(_r.get(_)||0)+1,O=(d.get(_)||0)+1;_r.set(_,j),d.set(_,O),h.push(_),j===1&&E&&Co.set(_,!0),O===1&&_.setAttribute(r,"true"),E||_.setAttribute(l,"true")}catch(D){console.error("aria-hidden: cannot operate on ",_,D)}})};return g(a),m.clear(),Ld++,function(){h.forEach(function(w){var _=_r.get(w)-1,S=d.get(w)-1;_r.set(w,_),d.set(w,S),_||(Co.has(w)||w.removeAttribute(l),Co.delete(w)),S||w.removeAttribute(r)}),Ld--,Ld||(_r=new WeakMap,_r=new WeakMap,Co=new WeakMap,ko={})}},EE=function(s,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(s)?s:[s]),c=SE(s);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),NE(l,c,r,"aria-hidden")):function(){return null}};function TE(s){const a=AE(s),r=x.forwardRef((l,c)=>{const{children:d,...h}=l,m=x.Children.toArray(d),y=m.find(kE);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function AE(s){const a=x.forwardRef((r,l)=>{const{children:c,...d}=r;if(x.isValidElement(c)){const h=RE(c),m=OE(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Io(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var CE=Symbol("radix.slottable");function kE(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===CE}function OE(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function RE(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Xo="Dialog",[Ev]=rN(Xo),[DE,ga]=Ev(Xo),Tv=s=>{const{__scopeDialog:a,children:r,open:l,defaultOpen:c,onOpenChange:d,modal:h=!0}=s,m=x.useRef(null),y=x.useRef(null),[p,g]=uN({prop:l,defaultProp:c??!1,onChange:d,caller:Xo});return o.jsx(DE,{scope:a,triggerRef:m,contentRef:y,contentId:kd(),titleId:kd(),descriptionId:kd(),open:p,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(w=>!w),[g]),modal:h,children:r})};Tv.displayName=Xo;var Av="DialogTrigger",ME=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Av,r),d=bn(a,c.triggerRef);return o.jsx(ss.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":yf(c.open),...l,ref:d,onClick:Ls(s.onClick,c.onOpenToggle)})});ME.displayName=Av;var pf="DialogPortal",[zE,Cv]=Ev(pf,{forceMount:void 0}),kv=s=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=s,d=ga(pf,a);return o.jsx(zE,{scope:a,forceMount:r,children:x.Children.map(l,h=>o.jsx(Yo,{present:r||d.open,children:o.jsx(yv,{asChild:!0,container:c,children:h})}))})};kv.displayName=pf;var Vo="DialogOverlay",Ov=x.forwardRef((s,a)=>{const r=Cv(Vo,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=ga(Vo,s.__scopeDialog);return d.modal?o.jsx(Yo,{present:l||d.open,children:o.jsx(LE,{...c,ref:a})}):null});Ov.displayName=Vo;var UE=TE("DialogOverlay.RemoveScroll"),LE=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Vo,r);return o.jsx(jv,{as:UE,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(ss.div,{"data-state":yf(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),vn="DialogContent",Rv=x.forwardRef((s,a)=>{const r=Cv(vn,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=ga(vn,s.__scopeDialog);return o.jsx(Yo,{present:l||d.open,children:d.modal?o.jsx(BE,{...c,ref:a}):o.jsx(qE,{...c,ref:a})})});Rv.displayName=vn;var BE=x.forwardRef((s,a)=>{const r=ga(vn,s.__scopeDialog),l=x.useRef(null),c=bn(a,r.contentRef,l);return x.useEffect(()=>{const d=l.current;if(d)return EE(d)},[]),o.jsx(Dv,{...s,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ls(s.onCloseAutoFocus,d=>{d.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ls(s.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:Ls(s.onFocusOutside,d=>d.preventDefault())})}),qE=x.forwardRef((s,a)=>{const r=ga(vn,s.__scopeDialog),l=x.useRef(!1),c=x.useRef(!1);return o.jsx(Dv,{...s,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{s.onCloseAutoFocus?.(d),d.defaultPrevented||(l.current||r.triggerRef.current?.focus(),d.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:d=>{s.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()}})}),Dv=x.forwardRef((s,a)=>{const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,...h}=s,m=ga(vn,r),y=x.useRef(null),p=bn(a,y);return HN(),o.jsxs(o.Fragment,{children:[o.jsx(pv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(hv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":yf(m.open),...h,ref:p,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx($E,{titleId:m.titleId}),o.jsx(VE,{contentRef:y,descriptionId:m.descriptionId})]})]})}),gf="DialogTitle",Mv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(gf,r);return o.jsx(ss.h2,{id:c.titleId,...l,ref:a})});Mv.displayName=gf;var zv="DialogDescription",Uv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(zv,r);return o.jsx(ss.p,{id:c.descriptionId,...l,ref:a})});Uv.displayName=zv;var Lv="DialogClose",Bv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Lv,r);return o.jsx(ss.button,{type:"button",...l,ref:a,onClick:Ls(s.onClick,()=>c.onOpenChange(!1))})});Bv.displayName=Lv;function yf(s){return s?"open":"closed"}var qv="DialogTitleWarning",[M2,$v]=nN(qv,{contentName:vn,titleName:gf,docsSlug:"dialog"}),$E=({titleId:s})=>{const a=$v(qv),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 x.useEffect(()=>{s&&(document.getElementById(s)||console.error(r))},[r,s]),null},H2="DialogDescriptionWarning",V2=({contentRef:s,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$v(H2).contentName}}.`;return x.useEffect(()=>{const c=s.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,s,a]),null},I2=Tv,G2=Cv,P2=Ov,K2=Rv,Y2=Mv,J2=Uv,X2=Bv;function gn({...s}){return o.jsx(I2,{"data-slot":"dialog",...s})}function Q2({...s}){return o.jsx(G2,{"data-slot":"dialog-portal",...s})}function Z2({className:s,...a}){return o.jsx(P2,{"data-slot":"dialog-overlay",className:Oe("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",s),...a})}function yn({className:s,children:a,...r}){return o.jsxs(Q2,{"data-slot":"dialog-portal",children:[o.jsx(Z2,{}),o.jsxs(K2,{"data-slot":"dialog-content",className:Oe("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",s),...r,children:[a,o.jsxs(X2,{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(tl,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ka({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:Oe("flex flex-col gap-2 text-center sm:text-left",s),...a})}function Er({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:Oe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",s),...a})}function Ca({className:s,...a}){return o.jsx(Y2,{"data-slot":"dialog-title",className:Oe("text-lg leading-none font-semibold",s),...a})}function Oa({className:s,...a}){return o.jsx(J2,{"data-slot":"dialog-description",className:Oe("text-muted-foreground text-sm",s),...a})}const Se=x.forwardRef(({className:s,type:a,...r},l)=>o.jsx("input",{type:a,className:Oe("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",s),ref:l,...r}));Se.displayName="Input";var F2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],W2=F2.reduce((s,a)=>{const r=_y(`Primitive.${a}`),l=x.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}`,{...s,[a]:l}},{}),eE="Label",Hv=x.forwardRef((s,a)=>o.jsx(W2.label,{...s,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(s.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Hv.displayName=eE;var tE=Hv;function pa({className:s,...a}){return o.jsx(tE,{"data-slot":"label",className:Oe("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",s),...a})}const aE=Ny("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 Wi({className:s,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:Oe(aE({variant:a}),s),...r})}function el({className:s,...a}){return o.jsx("div",{"data-slot":"alert-description",className:Oe("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...a})}function vf({className:s}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Oe("w-9 h-9",s),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 fy(s){const a=s.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function sE(s){const a=s.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 nE(s){const a=s.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 Vv({onComplete:s,open:a=!0,canClose:r=!1}){const[l,c]=x.useState("welcome"),[d,h]=x.useState(""),[m,p]=x.useState(""),[g,v]=x.useState(null),[w,_]=x.useState(!1),[S,E]=x.useState(!1),j=async()=>{v(null),c("validating");const G=fy(d),W=m.trim(),J=await av(G,W);J.valid?(Bj({url:G,anonKey:W}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(v(J.error||"Connection failed. Please check your credentials."),c("credentials"))},O=d?sE(d):{valid:!1},D=m?nE(m):{valid:!1},q=d?fy(d):"",B=d&&!d.startsWith("http")&&O.valid;return o.jsx(gn,{open:a,onOpenChange:G=>{!G&&r&&s()},children:o.jsxs(yn,{className:"sm:max-w-md",onPointerDownOutside:G=>{r||G.preventDefault()},onEscapeKeyDown:G=>{r||G.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(ka,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(vf,{className:"w-9 h-9"}),o.jsx(Ca,{children:"Welcome to Email Automator"})]}),o.jsx(Oa,{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(Wi,{children:o.jsxs(el,{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(Ii,{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(Z,{variant:"outline",onClick:s,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:()=>c("credentials"),className:"flex-1",children:"Continue Setup"})]})]})]}),l==="credentials"&&o.jsxs(o.Fragment,{children:[o.jsxs(ka,{children:[o.jsx(Ca,{children:"Connect to Supabase"}),o.jsx(Oa,{children:"Enter your connection details below."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[g&&o.jsxs(Wi,{variant:"destructive",children:[o.jsx(Dr,{className:"h-4 w-4"}),o.jsx(el,{children:g})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"supabase-url",children:"Project URL or ID"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:G=>{h(G.target.value),_(!0)},onBlur:()=>_(!0),className:w&&d?O.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),w&&d&&O.valid&&o.jsx(ja,{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(ja,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),o.jsxs("span",{children:["Will use: ",q]})]}),w&&d&&O.message&&!O.valid&&o.jsx("p",{className:"text-xs text-destructive",children:O.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"anon-key",children:"Anon Public Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:G=>{p(G.target.value),E(!0)},onBlur:()=>E(!0),className:S&&m?D.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),S&&m&&D.valid&&o.jsx(ja,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),S&&m&&D.message&&o.jsx("p",{className:`text-xs ${D.valid?"text-green-600 dark:text-green-400":"text-destructive"}`,children:D.message})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Z,{variant:"outline",onClick:()=>c("welcome"),className:"flex-1",children:"Back"}),r&&o.jsx(Z,{variant:"outline",onClick:s,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:j,disabled:!O.valid||!D.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(ka,{children:[o.jsx(Ca,{children:"Validating Connection"}),o.jsx(Oa,{children:"Verifying your credentials with Supabase..."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx($t,{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(ka,{children:[o.jsx(Ca,{children:"Success!"}),o.jsx(Oa,{children:"Your database is connected."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(Hi,{className:"h-12 w-12 text-green-500 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restarting application..."})]})]})]})})}function rE({email:s,isOpen:a,onOpenChange:r,onRetry:l}){const[c,d]=x.useState([]),[h,m]=x.useState(!1);x.useEffect(()=>{a&&s&&p()},[a,s]);const p=async()=>{if(s){m(!0);try{const v=await ze.getEmailEvents(s.id);v.data&&d(v.data.events)}catch(v){console.error("Failed to fetch trace:",v)}finally{m(!1)}}},g=v=>{switch(v){case"analysis":return o.jsx($i,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Uo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Dr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Or,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(gn,{open:a,onOpenChange:r,children:o.jsxs(yn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(ka,{className:"p-6 border-b flex flex-row items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(of,{className:"w-5 h-5 text-primary"}),o.jsx(Ca,{children:"AI Processing Trace"})]}),o.jsx(Oa,{children:"Step-by-step log of how the AI analyzed and acted on this email."})]}),s?.processing_status==="failed"&&l&&o.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>{l(s),r(!1)},className:"gap-2 text-destructive border-destructive/20 hover:bg-destructive/10",children:[o.jsx(Bs,{className:"w-3.5 h-3.5"}),"Retry Job"]})]}),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(mt,{})}):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 email."}):c.map((v,w)=>o.jsxs("div",{className:"relative pl-8",children:[w!==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.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground/70",children:v.agent_state}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Cr,{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.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-foreground/90",children:v.details?.message}),v.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(zs,{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-60 overflow-y-auto font-mono",children:v.details.system_prompt})]}),v.details?.content_preview&&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(zs,{className:"w-3 h-3"})," Email Content (sent to LLM)"]}),o.jsx("pre",{className:"text-[10px] bg-blue-500/5 p-2 rounded border border-blue-500/10 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:v.details.content_preview})]})]}),v.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:v.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:v.details?.sentiment||"Analyzing..."})]})]}),v.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(zs,{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:v.details?.system_prompt})]}),v.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(zs,{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(v.details._raw_response),null,2)})]}),v.details?.usage&&o.jsxs("div",{className:"flex gap-4 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Prompt:"}),o.jsx("span",{className:"font-mono font-bold",children:v.details.usage.prompt_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Completion:"}),o.jsx("span",{className:"font-mono font-bold",children:v.details.usage.completion_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Total:"}),o.jsx("span",{className:"font-mono font-bold text-primary",children:v.details.usage.total_tokens})]})]})]}),v.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: ",v.details?.action]}),o.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',v.details?.reason,'"']})]}),o.jsx(lf,{className:"w-5 h-5 text-emerald-500"})]}),v.event_type==="error"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:typeof v.details?.error=="object"?v.details.error.message||JSON.stringify(v.details.error):v.details?.error}),v.details?.raw_response&&o.jsx("pre",{className:"text-[10px] bg-red-500/5 p-2 rounded border border-red-500/10 overflow-x-auto whitespace-pre-wrap font-mono",children:typeof v.details.raw_response=="object"?JSON.stringify(v.details.raw_response,null,2):v.details.raw_response})]})]})]})]},v.id))})]})})}const iE={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 lE(){const{state:s,actions:a,dispatch:r}=Br(),{openTerminal:l}=cv(),[c,d]=x.useState(!0),[h,m]=x.useState(!1),[p,g]=x.useState(""),[v,w]=x.useState(null),[_,S]=x.useState(null),[E,j]=x.useState({}),[O,D]=x.useState(null),[q,B]=x.useState(!1),[G,W]=x.useState(null);x.useEffect(()=>{s.isAuthenticated?(J(),a.fetchStats()):d(!1)},[v,s.isAuthenticated]);const J=async(k=0)=>{d(!0),await a.fetchEmails({category:v||void 0,search:p||void 0,offset:k,sortBy:s.sortBy,sortOrder:s.sortOrder}),d(!1)},P=k=>{a.fetchEmails({category:v||void 0,search:p||void 0,offset:0,sortBy:k,sortOrder:s.sortOrder})},Q=()=>{a.fetchEmails({category:v||void 0,search:p||void 0,offset:0,sortBy:s.sortBy,sortOrder:s.sortOrder==="asc"?"desc":"asc"})},ce=async()=>{if(s.accounts.length===0){ne.warning("Please connect an email account first");return}Us.playStart(),l(),m(!0);const k=await a.triggerSync();m(!1),k?(Us.playSuccess(),ne.success("Sync completed! Check your emails.")):ne.error("Sync failed. Check account status for details.")},Je=async(k,Y)=>{if(Y==="delete"&&O!==k.id){D(k.id);return}D(null),j(_e=>({..._e,[k.id]:Y}));const K=await a.executeAction(k.id,Y);j(_e=>{const je={..._e};return delete je[k.id],je}),K&&(ne.success(`Email ${Y==="delete"?"deleted":Y==="archive"?"archived":"updated"}`),Y==="delete"&&J(s.emailsOffset))},ve=()=>{D(null)},pe=k=>{k.preventDefault(),J()},Ze=k=>{const Y=k==="next"?s.emailsOffset+20:Math.max(0,s.emailsOffset-20);J(Y)},st=k=>{W(k),B(!0)},qe=async k=>{await a.retryProcessing(k.id)&&ne.success("Retrying email processing...")};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(Bd,{className:"w-5 h-5 text-primary"}),"Recent Analysis"]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(Z,{onClick:ce,size:"sm",variant:"default",className:"h-9 shadow-md px-4",disabled:h,children:[o.jsx(Bs,{className:Oe("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),h?"Syncing...":"Sync Now"]}),o.jsxs("span",{className:"h-9 text-xs font-medium text-muted-foreground bg-secondary px-3 py-1 rounded-md border border-border flex items-center",children:[s.emailsTotal," emails"]})]})]}),h&&o.jsxs("div",{className:"bg-primary/5 border border-primary/20 p-4 rounded-lg flex items-center justify-between animate-in fade-in slide-in-from-top-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o.jsx($t,{className:"w-5 h-5 text-primary animate-spin"})}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-sm",children:"Sync in progress..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Fetching and analyzing emails. New emails will appear below automatically."})]})]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:l,className:"h-8 text-xs",children:[o.jsx(of,{className:"w-3.5 h-3.5 mr-2"}),"View Logs"]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-center",children:[o.jsxs("form",{onSubmit:pe,className:"flex-1 flex gap-2 w-full",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(zw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Se,{placeholder:"Search emails...",value:p,onChange:k=>g(k.target.value),className:"pl-9 h-9"})]}),o.jsx(Z,{type:"submit",size:"sm",className:"h-9 px-4",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50 h-9",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-full",value:s.sortBy,onChange:k=>P(k.target.value),children:[o.jsx("option",{value:"date",children:"Received Time"}),o.jsx("option",{value:"created_at",children:"Processed Time"})]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-primary",onClick:Q,title:s.sortOrder==="asc"?"Sorting: Oldest First":"Sorting: Newest First",children:s.sortOrder==="asc"?o.jsx(Tx,{className:"w-3.5 h-3.5"}):o.jsx(Sx,{className:"w-3.5 h-3.5"})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(Z,{size:"sm",variant:v===null?"secondary":"ghost",onClick:()=>w(null),children:"All"}),["spam","client","newsletter","support"].map(k=>o.jsx(Z,{size:"sm",variant:v===k?"secondary":"ghost",onClick:()=>w(k),className:"capitalize",children:k},k))]}),c?o.jsx(sN,{}):s.emails.length===0?o.jsxs(At,{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(Bd,{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:s.accounts.length===0?"Connect your email account to get started.":"Try syncing or adjusting your filters."}),s.accounts.length>0&&o.jsxs(Z,{onClick:()=>{l(),ce()},disabled:h,children:[o.jsx(Bs,{className:Oe("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[s.emails.map(k=>o.jsx(uE,{email:k,onAction:Je,onRetry:qe,onViewTrace:st,onSelect:()=>S(k),isSelected:_?.id===k.id,loadingAction:E[k.id],isDeletePending:O===k.id,onCancelDelete:ve},k.id)),o.jsx(rE,{isOpen:q,onOpenChange:B,email:G,onRetry:qe}),s.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("prev"),disabled:s.emailsOffset===0,children:[o.jsx(Bx,{className:"w-4 h-4 mr-1"}),"Previous"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.emailsOffset+1," - ",Math.min(s.emailsOffset+20,s.emailsTotal)," of ",s.emailsTotal]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("next"),disabled:s.emailsOffset+20>=s.emailsTotal,children:["Next",o.jsx($x,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[_&&o.jsxs(At,{className:"p-6 border-primary/20 bg-primary/5 animate-in slide-in-from-right-5",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"font-semibold",children:"Email Details"}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>S(null),children:o.jsx(tl,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"From:"}),o.jsx("p",{className:"font-medium truncate",children:_.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((k,Y)=>o.jsx("li",{children:k},Y))})]}),_.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(Lw,{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."]})]})]})]})]}),o.jsx(oE,{accounts:s.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:s.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(vy,{className:"w-4 h-4 text-primary"}),"Sync History"]}),o.jsx("div",{className:"space-y-4",children:!s.stats?.recentSyncs||s.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No sync history available."}):s.stats.recentSyncs.slice(0,5).map(k=>o.jsxs("div",{className:"flex justify-between items-start text-sm border-b last:border-0 pb-3 last:pb-0",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Oe("w-1.5 h-1.5 rounded-full",k.status==="success"?"bg-emerald-500":k.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(k.started_at).toLocaleDateString()," ",new Date(k.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),o.jsxs("p",{className:"text-[10px] text-muted-foreground pl-3.5",children:["Processed: ",o.jsx("span",{className:"font-medium text-foreground",children:k.emails_processed})," • Actioned: ",o.jsx("span",{className:"font-medium text-foreground",children:k.emails_deleted+k.emails_drafted})]}),k.error_message&&o.jsx("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:k.error_message,children:k.error_message})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:k.status==="running"?"Running":k.completed_at?`${Math.round((new Date(k.completed_at).getTime()-new Date(k.started_at).getTime())/1e3)}s`:"..."})]},k.id))})]}),o.jsxs(At,{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:s.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:s.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:s.rules.filter(k=>k.is_enabled).length})]})]})]})]})]})}function oE({accounts:s,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){return s.length===0?null:o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx($w,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsx("div",{className:"space-y-6",children:s.map(h=>o.jsx(cE,{account:h,onUpdate:a,onSync:r,openTerminal:d},h.id))})]})}function cE({account:s,onUpdate:a,onSync:r,openTerminal:l}){const[c,d]=x.useState(!1),[h,m]=x.useState(""),[p,g]=x.useState(""),v=E=>{if(!E)return"";const j=typeof E=="string"&&/^\d+$/.test(E)?parseInt(E):E,O=new Date(j);if(isNaN(O.getTime()))return"";const D=q=>q<10?"0"+q:q;return O.getFullYear()+"-"+D(O.getMonth()+1)+"-"+D(O.getDate())+"T"+D(O.getHours())+":"+D(O.getMinutes())};x.useEffect(()=>{const E=s.sync_start_date||s.last_sync_checkpoint||s.last_sync_at;m(v(E)),g((s.sync_max_emails_per_run||50).toString())},[s.id,s.sync_start_date,s.last_sync_checkpoint,s.last_sync_at,s.sync_max_emails_per_run]);const w=async E=>{d(!0),await a(s.id,E),d(!1)},_=()=>{const E=s.sync_start_date?new Date(s.sync_start_date).toISOString():"",j=h?new Date(h).toISOString():"";j!==E&&w({sync_start_date:j||null})},S=()=>{const E=parseInt(p,10)||50;E!==s.sync_max_emails_per_run&&w({sync_max_emails_per_run:E})};return 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:s.email_address,children:s.email_address}),o.jsxs("div",{className:"flex items-center gap-1",children:[s.last_sync_status==="syncing"?o.jsx($t,{className:"w-3 h-3 text-primary animate-spin"}):s.last_sync_status==="success"?o.jsx(lf,{className:"w-3 h-3 text-emerald-500"}):s.last_sync_status==="error"?o.jsx("span",{title:s.last_sync_error||"Error",children:o.jsx(Dr,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{l(),r(s.id)},disabled:s.last_sync_status==="syncing",children:o.jsx(Bs,{className:Oe("w-3 h-3",s.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(Z,{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(s.id,{last_sync_checkpoint:null}),disabled:s.last_sync_status==="syncing",children:o.jsx(vy,{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(Cx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Se,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:h,onChange:E=>m(E.target.value),onBlur:_,disabled:c||s.last_sync_status==="syncing"})]}),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(ow,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Se,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:p,onChange:E=>g(E.target.value),onBlur:S,disabled:c||s.last_sync_status==="syncing"})]})]}),s.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Last sync: ",new Date(s.last_sync_at).toLocaleString()]}),s.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:s.last_sync_error,children:["Error: ",s.last_sync_error]})]})}function uE({email:s,onAction:a,onRetry:r,onViewTrace:l,onSelect:c,isSelected:d,loadingAction:h,isDeletePending:m,onCancelDelete:p}){if(!s)return null;const g=iE[s.category||"other"],v=!!h,w=()=>{if(!s.email_accounts)return"#";const{provider:_,email_address:S}=s.email_accounts;return _==="gmail"?`https://mail.google.com/mail/u/${S}/#all/${s.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(s.external_id)}`};return o.jsx(At,{className:Oe("hover:shadow-md transition-shadow group cursor-pointer",d&&"ring-2 ring-primary"),onClick:c,children:o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex justify-between items-start mb-3 gap-4",children:[o.jsxs("div",{className:"flex gap-3 flex-1 min-w-0",children:[o.jsx("div",{className:Oe("w-8 h-8 rounded-full flex-shrink-0 flex items-center justify-center font-bold text-white text-xs",s.category==="spam"?"bg-destructive":"bg-primary"),children:s.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:s.subject||"No Subject"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",title:s.sender||"",children:s.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:Oe("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",g),children:s.category||"unknown"}),o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.processing_status==="pending"&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(Cr,{className:"w-2.5 h-2.5"})," Queued"]}),s.processing_status==="processing"&&o.jsxs("span",{className:"text-[9px] text-blue-600 dark:text-blue-400 bg-blue-500/10 border border-blue-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($t,{className:"w-2.5 h-2.5 animate-spin"})," Analyzing"]}),s.processing_status==="completed"&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($i,{className:"w-2.5 h-2.5"})," Analyzed"]}),s.processing_status==="failed"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("span",{className:"text-[9px] text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",title:s.processing_error||"Unknown error",children:[o.jsx(Dr,{className:"w-2.5 h-2.5"})," Failed"]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-5 w-5 text-red-600 hover:bg-red-500/10",onClick:_=>{_.stopPropagation(),r(s)},title:"Retry Processing",children:o.jsx(Bs,{className:"w-2.5 h-2.5"})})]}),!s.processing_status&&!s.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($t,{className:"w-2.5 h-2.5 animate-spin"})," Pending"]}),!s.processing_status&&s.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($i,{className:"w-2.5 h-2.5"})," Analyzed"]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-2 text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:s.date?new Date(s.date).toLocaleString():"",className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"REC:"})," ",s.date?new Date(s.date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsx("span",{className:"opacity-30",children:"•"}),o.jsxs("span",{title:new Date(s.created_at).toLocaleString(),className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"PROC:"})," ",new Date(s.created_at).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:s.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($d,{className:"w-3.5 h-3.5 text-emerald-500"}),"Suggested:",s.suggested_actions&&s.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:s.suggested_actions.map(_=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:_},_))}):o.jsx("span",{className:"text-foreground",children:s.suggested_action||"none"}),s.actions_taken&&s.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:s.actions_taken.join(", "),children:["(Done: ",s.actions_taken.join(", "),")"]}):s.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(Done: ",s.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:_=>_.stopPropagation(),children:m?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(Z,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(s,"delete"),disabled:v,children:h==="delete"?o.jsx($t,{className:"w-3 h-3 animate-spin"}):"Yes"}),o.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:p,disabled:v,children:"No"})]}):o.jsxs(o.Fragment,{children:[o.jsx("a",{href:w(),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 ${s.email_accounts?.provider==="gmail"?"Gmail":"Outlook"}`,children:o.jsx(Ii,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>l(s),title:"View AI Trace (Prompt/Response)",children:o.jsx(nw,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>a(s,"delete"),disabled:v,title:"Delete",children:h==="delete"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(zo,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>a(s,"archive"),disabled:v,title:"Archive",children:h==="archive"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(wx,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>a(s,"flag"),disabled:v,title:"Flag",children:h==="flag"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(iw,{className:"w-3.5 h-3.5"})})]})})]})]})})}function dE(){const{state:s,actions:a}=Br(),[r,l]=x.useState(!1),[c,d]=x.useState(!1),[h,m]=x.useState(null),[p,g]=x.useState(!1),[v,w]=x.useState(!1),[_,S]=x.useState({}),[E,j]=x.useState(!1),[O,D]=x.useState("credentials"),[q,B]=x.useState(""),[G,W]=x.useState(""),[J,P]=x.useState(""),[Q,ce]=x.useState(""),[Je,ve]=x.useState(!1),[pe,Ze]=x.useState(!1),[st,qe]=x.useState(!1),[k,Y]=x.useState("credentials"),[K,_e]=x.useState(""),[je,A]=x.useState(""),[V,X]=x.useState(!1),[F,de]=x.useState(!1),[ge,ue]=x.useState(""),[Ge,Ue]=x.useState("category"),[kt,pt]=x.useState("newsletter"),[xt,ss]=x.useState(["archive"]),[la,ns]=x.useState(""),[xn,wn]=x.useState(""),[qr,rs]=x.useState(""),[_n,is]=x.useState(""),[sl,qs]=x.useState([]),[gt,nl]=x.useState(!1),[$r,Hr]=x.useState(!1),[Ra,Sn]=x.useState(null),[ya,jn]=x.useState(null);x.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),x.useEffect(()=>{s.settings&&S(s.settings)},[s.settings]);const Qo=async()=>{const R=s.rules.find(ee=>ee.name==="Auto-Trash Spam");if(!R){ne.error("System rule not found. Please sync your database.");return}Sn("auto_trash_spam"),await a.toggleRule(R.id),Sn(null)},$s=async()=>{const R=s.rules.find(ee=>ee.name==="Smart Drafts");if(!R){ne.error("System rule not found. Please sync your database.");return}Sn("smart_drafts"),await a.toggleRule(R.id),Sn(null)},wt=R=>{jn(R),ue(R.name);const ee=R.condition,yt=Object.keys(ee).filter(Is=>Is!=="older_than_days")[0]||"category";Ue(yt),pt(ee[yt]||""),ns(ee.older_than_days?.toString()||"");const Vs=R.actions&&R.actions.length>0?R.actions:R.action?[R.action]:["archive"];ss(Vs),wn(R.instructions||""),rs(R.description||""),is(R.intent||""),qs(R.attachments||[]),de(!0)},va=x.useRef(null),Ot=()=>{D("credentials"),B(""),W(""),P(""),ce(""),j(!0)},Zo=R=>{B(R);try{const ee=JSON.parse(R),ke=ee.installed||ee.web||ee;ke.client_id&&W(ke.client_id),ke.client_secret&&P(ke.client_secret),ee.installed?ne.success("Detected Desktop app credentials"):ee.web&&ne.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Fo=async()=>{if(!G||!J){ne.error("Please provide both Client ID and Client Secret");return}ve(!0);try{if(await a.updateSettings({..._,google_client_id:G,google_client_secret:J})){S(ke=>({...ke,google_client_id:G,google_client_secret:J}));const ee=await ze.getGmailAuthUrl();if(ee.data?.url)window.open(ee.data.url,"_blank"),D("code"),ne.success("Please authorize in the opened tab, then paste the code here");else{const ke=typeof ee.error=="string"?ee.error:ee.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{ve(!1)}},Wo=async()=>{if(!Q.trim()){ne.error("Please paste the authorization code");return}Ze(!0);try{const R=await ze.connectGmail(Q.trim());if(R.data?.success)ne.success("Gmail account connected successfully!"),j(!1),a.fetchAccounts();else{const ee=typeof R.error=="string"?R.error:R.error?.message;ne.error(ee||"Failed to connect Gmail")}}catch{ne.error("Failed to connect Gmail")}finally{Ze(!1)}},Nn=()=>{Y("credentials"),_e(""),A(""),qe(!0)},En=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:je||"common"})){S(ke=>({...ke,microsoft_client_id:K,microsoft_tenant_id:je||"common"}));const ee=await ze.startMicrosoftDeviceFlow();if(ee.data)m(ee.data),Y("device-code"),Tn(ee.data.deviceCode,ee.data.interval);else{const ke=typeof ee.error=="string"?ee.error:ee.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)}},Tn=async(R,ee)=>{const ke=setInterval(async()=>{try{const yt=await ze.pollMicrosoftDeviceCode(R);yt.data?.status==="completed"?(clearInterval(ke),m(null),d(!1),qe(!1),ne.success("Outlook account connected"),a.fetchAccounts()):yt.error&&typeof yt.error=="object"&&yt.error.code}catch{}},ee*1e3);setTimeout(()=>{clearInterval(ke),c&&(m(null),d(!1),qe(!1),ne.error("Connection timed out. Please try again."))},900*1e3)},Da=async()=>{if(!ge){ne.error("Please name your rule");return}if(xt.length===0){ne.error("Please select at least one action");return}Hr(!0);try{const R={[Ge]:kt};la&&(R.older_than_days=parseInt(la,10));const ee=xt.includes("draft"),ke={name:ge,description:qr||void 0,intent:_n||void 0,condition:R,actions:xt,instructions:ee?xn:void 0,attachments:ee?sl:[],is_enabled:!0};let yt=!1;ya?yt=await a.updateRule(ya.id,ke):yt=await a.createRule(ke),yt?(ne.success(ya?"Rule updated":"Rule created"),de(!1),jn(null),ue(""),ss(["archive"]),ns(""),wn(""),rs(""),is(""),qs([]),a.fetchRules()):ne.error(`Failed to ${ya?"update":"create"} rule`)}catch{ne.error("An error occurred while saving the rule")}finally{Hr(!1)}},An=async R=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(R)&&ne.success("Account disconnected")},ls=async()=>{g(!0);const R=await a.updateSettings(_);g(!1),R&&ne.success("Settings saved")},ec=async()=>{w(!0);try{const R=await ze.testLlm({llm_model:_.llm_model||null,llm_base_url:_.llm_base_url||null,llm_api_key:_.llm_api_key||null});R.data?.success?ne.success(R.data.message):ne.error(R.data?.message||"Connection test failed")}catch{ne.error("Failed to test connection")}finally{w(!1)}},rl=async R=>{await a.toggleRule(R)},Vr=async R=>{const ee=R.target.files;if(!ee||ee.length===0)return;nl(!0);const ke=ee[0],yt=ke.name.split(".").pop(),Vs=`${Math.random().toString(36).substring(2)}.${yt}`,Is=`${s.user.id}/${Vs}`;try{const{error:Gs}=await ct.storage.from("rule-attachments").upload(Is,ke);if(Gs)throw Gs;const ba={name:ke.name,path:Is,type:ke.type,size:ke.size};qs(ut=>[...ut,ba]),ne.success("File uploaded")}catch(Gs){console.error("Upload error:",Gs),ne.error("Failed to upload file")}finally{nl(!1),R.target.value=""}},Hs=R=>{qs(ee=>ee.filter(ke=>ke.path!==R))},tc=R=>R==="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(gn,{open:E,onOpenChange:j,children:o.jsxs(yn,{className:"sm:max-w-lg",children:[o.jsxs(ka,{children:[o.jsxs(Ca,{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(Oa,{children:O==="credentials"?"Enter your Google OAuth credentials to connect your Gmail account.":"Paste the authorization code from Google to complete the connection."})]}),O==="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(Qw,{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:R=>Zo(R.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(Se,{placeholder:"xxx.apps.googleusercontent.com",value:G,onChange:R=>W(R.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Se,{type:"password",placeholder:"GOCSPX-...",value:J,onChange:R=>P(R.target.value)})]})]})]}),o.jsxs(Er,{children:[o.jsx(Z,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Fo,disabled:Je||!G||!J,children:[Je?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{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(Se,{placeholder:"4/0AQlEd8x...",value:Q,onChange:R=>ce(R.target.value),className:"font-mono"})]})]}),o.jsxs(Er,{children:[o.jsx(Z,{variant:"outline",onClick:()=>D("credentials"),children:"Back"}),o.jsxs(Z,{onClick:Wo,disabled:pe||!Q.trim(),children:[pe?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Connect"]})]})]})]})}),o.jsx(gn,{open:st,onOpenChange:qe,children:o.jsxs(yn,{className:"sm:max-w-lg",children:[o.jsxs(ka,{children:[o.jsxs(Ca,{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(Oa,{children:k==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),k==="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(Se,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:R=>_e(R.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),o.jsx(Se,{placeholder:"common",value:je,onChange:R=>A(R.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(Er,{children:[o.jsx(Z,{variant:"outline",onClick:()=>qe(!1),children:"Cancel"}),o.jsxs(Z,{onClick:En,disabled:V||!K,children:[V?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{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(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ii,{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(mt,{size:"sm"}),"Waiting for authorization..."]})})]}),o.jsx(Er,{children:o.jsx(Z,{variant:"outline",onClick:()=>qe(!1),children:"Cancel"})})]})]})}),o.jsx(gn,{open:F,onOpenChange:R=>{de(R),R||jn(null)},children:o.jsxs(yn,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[o.jsxs(ka,{className:"p-6 border-b",children:[o.jsx(Ca,{children:ya?"Edit Auto-Pilot Rule":"Create Auto-Pilot Rule"}),o.jsx(Oa,{children:"Define a condition based on AI analysis to trigger an action."})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Rule Name"}),o.jsx(Se,{placeholder:"e.g. Archive Newsletters",value:ge,onChange:R=>ue(R.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Description"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:"e.g. Handle all marketing newsletters and promotional content from subscription services",value:qr,onChange:R=>rs(R.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Describe what this rule is for. The AI uses this to semantically match emails."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Intent"}),o.jsx(Se,{placeholder:"e.g. Politely decline all sales pitches",value:_n,onChange:R=>is(R.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"The goal of this rule. Used to generate appropriate draft replies."})]}),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:R=>{Ue(R.target.value),R.target.value==="category"?pt("newsletter"):R.target.value==="sentiment"?pt("Positive"):R.target.value==="priority"?pt("High"):pt("")},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:kt,onChange:R=>pt(R.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:kt,onChange:R=>pt(R.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:kt,onChange:R=>pt(R.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(Se,{placeholder:Ge==="sender_domain"?"rta.vn":Ge==="sender_email"?"john@example.com":"Keywords...",value:kt,onChange:R=>pt(R.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(Cr,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Se,{type:"number",min:"0",placeholder:"0",className:"w-24",value:la,onChange:R=>ns(R.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(R=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${xt.includes(R.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:xt.includes(R.value),onChange:ee=>{ee.target.checked?ss([...xt,R.value]):ss(xt.filter(ke=>ke!==R.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:R.label})]},R.value))})]}),xt.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:xn,onChange:R=>wn(R.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(xg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[sl.map(R=>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:R.name}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>Hs(R.path),children:o.jsx(tl,{className:"w-3 h-3"})})]},R.path)),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:Vr,disabled:gt}),o.jsxs(Z,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:gt,children:[gt?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{className:"w-3 h-3 mr-2"}),gt?"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(Er,{className:"p-6 border-t bg-secondary/5",children:[o.jsx(Z,{variant:"outline",onClick:()=>de(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Da,disabled:$r,children:[$r?o.jsx(mt,{size:"sm",className:"mr-2"}):ya?o.jsx(ja,{className:"w-4 h-4 mr-2"}):o.jsx(Mi,{className:"w-4 h-4 mr-2"}),ya?"Save Changes":"Create Rule"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx(Vi,{className:"w-5 h-5 text-primary"}),"Connected Accounts"]}),o.jsx(es,{children:"Manage your email providers"})]}),o.jsxs(Aa,{className:"space-y-4",children:[s.accounts.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No accounts connected yet"}):s.accounts.map(R=>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:[tc(R.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:R.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:R.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[R.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(Z,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>An(R.id),children:o.jsx(zo,{className:"w-4 h-4"})})]})]},R.id)),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Ot,disabled:r||c,children:[r?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Nn,disabled:r||c,children:[c&&!h?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{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(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ii,{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(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx($d,{className:"w-5 h-5 text-emerald-500"}),"Auto-Pilot Rules"]}),o.jsx(es,{children:"Configure AI automation behavior"})]}),o.jsxs(Aa,{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("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const R=s.rules.find(ee=>ee.name==="Auto-Trash Spam");R&&wt(R)},title:"Edit Logic",children:o.jsx(yd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(R=>R.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Qo,disabled:Ra==="auto_trash_spam",children:[Ra==="auto_trash_spam"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(vd,{className:"w-4 h-4 mr-1"}),s.rules.find(R=>R.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("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const R=s.rules.find(ee=>ee.name==="Smart Drafts");R&&wt(R)},title:"Edit Logic",children:o.jsx(yd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(R=>R.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:$s,disabled:Ra==="smart_drafts",children:[Ra==="smart_drafts"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(vd,{className:"w-4 h-4 mr-1"}),s.rules.find(R=>R.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(Z,{variant:"ghost",size:"sm",onClick:()=>{jn(null),ue(""),rs(""),is(""),ss(["archive"]),ns(""),wn(""),qs([]),de(!0)},children:[o.jsx(Mi,{className:"w-4 h-4 mr-1"})," Add Rule"]})]}),s.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"}),s.rules.length>0&&s.rules.filter(R=>R.name!=="Auto-Trash Spam"&&R.name!=="Smart Drafts").map(R=>{const ee=R.actions&&R.actions.length>0?R.actions:R.action?[R.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:R.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["→ ",ee.join(" + ")]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>wt(R),title:"Edit Rule",children:o.jsx(yd,{className:"w-3.5 h-3.5 text-muted-foreground"})}),o.jsxs(Z,{variant:R.is_enabled?"default":"outline",size:"sm",onClick:()=>rl(R.id),className:"h-7 px-2",children:[o.jsx(vd,{className:"w-3.5 h-3.5 mr-1"}),R.is_enabled?"On":"Off"]}),o.jsx(Z,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>a.deleteRule(R.id),children:o.jsx(zo,{className:"w-3 h-3"})})]})]}),R.instructions&&o.jsxs("p",{className:"text-[10px] text-muted-foreground italic border-t border-border/50 pt-1 mt-1 truncate",children:['"',R.instructions,'"']}),R.attachments&&R.attachments.length>0&&o.jsx("div",{className:"flex gap-1 mt-1",children:R.attachments.map(ke=>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(xg,{className:"w-2.5 h-2.5"}),ke.name]},ke.path))})]},R.id)})]})]})]})]}),o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx(Bs,{className:"w-5 h-5 text-indigo-500"}),"Model Configuration"]}),o.jsx(es,{children:"Configure Local LLM or API settings"})]}),o.jsxs(Aa,{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(Se,{placeholder:"gpt-4o-mini",value:_.llm_model||"",onChange:R=>S(ee=>({...ee,llm_model:R.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Base URL"}),o.jsx(Se,{placeholder:"https://api.openai.com/v1",value:_.llm_base_url||"",onChange:R=>S(ee=>({...ee,llm_base_url:R.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(Se,{type:"password",placeholder:"sk-...",value:_.llm_api_key||"",onChange:R=>S(ee=>({...ee,llm_api_key:R.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Vi,{className:"w-4 h-4"}),"Local Storage Path (.eml)"]}),o.jsx(Se,{placeholder:"./data/emails",value:_.storage_path||"",onChange:R=>S(ee=>({...ee,storage_path:R.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Absolute or relative path where raw emails will be saved before analysis. Default: ./data/emails"})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Cr,{className:"w-4 h-4"}),"Background Sync Interval (minutes)"]}),o.jsx(Se,{type:"number",min:1,max:1440,value:_.sync_interval_minutes||5,onChange:R=>S(ee=>({...ee,sync_interval_minutes:parseInt(R.target.value,10)||5}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"How often the system checks for new emails in the background."})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(Z,{variant:"outline",onClick:ec,disabled:v,children:[v?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(Z,{onClick:ls,disabled:p,children:[p?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})]})]})]}),o.jsx("div",{ref:va,children:o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx($d,{className:"w-5 h-5 text-orange-500"}),"Provider Credentials (Advanced)"]}),o.jsx(es,{children:"Bring Your Own Keys (BYOK). Configure your own OAuth credentials here. Leave empty to use system defaults."})]}),o.jsxs(Aa,{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(Se,{type:"password",placeholder:"...apps.googleusercontent.com",value:_.google_client_id||"",onChange:R=>S(ee=>({...ee,google_client_id:R.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Se,{type:"password",placeholder:"GOCSPX-...",value:_.google_client_secret||"",onChange:R=>S(ee=>({...ee,google_client_secret:R.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(Se,{type:"password",value:_.microsoft_client_id||"",onChange:R=>S(ee=>({...ee,microsoft_client_id:R.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),o.jsx(Se,{type:"password",value:_.microsoft_client_secret||"",onChange:R=>S(ee=>({...ee,microsoft_client_secret:R.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),o.jsx(Se,{placeholder:"common",value:_.microsoft_tenant_id||"",onChange:R=>S(ee=>({...ee,microsoft_tenant_id:R.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(Z,{onClick:ls,disabled:p,variant:"secondary",children:[p?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})})]})]})})]})}const fE="modulepreload",hE=function(s){return"/"+s},hy={},mE=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let g=function(v){return Promise.all(v.map(w=>Promise.resolve(w).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=hE(v),v in hy)return;hy[v]=!0;const w=v.endsWith(".css"),_=w?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${_}`))return;const S=document.createElement("link");if(S.rel=w?"stylesheet":fE,w||(S.as="script"),S.crossOrigin="",S.href=v,p&&S.setAttribute("nonce",p),document.head.appendChild(S),w)return new Promise((E,j)=>{S.addEventListener("load",E),S.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${v}`)))})}))}function d(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return c.then(m=>{for(const p of m||[])p.status==="rejected"&&d(p.reason);return a().catch(d)})};function pE(){const[s,a]=x.useState("profile"),{state:r,actions:l}=Br();x.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:by},{id:"security",label:"Security",icon:Iw},{id:"database",label:"Supabase",icon:Vi}];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.jsxs("aside",{className:"w-full md:w-64 flex flex-col justify-between",children:[o.jsx("nav",{className:"space-y-1",children:c.map(d=>{const h=d.icon,m=s===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:"mt-8 px-4 py-4 border-t border-border/40 text-center md:text-left",children:[o.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-widest mb-1",children:"Version"}),o.jsxs("p",{className:"text-xs font-mono text-muted-foreground/70",children:["v","2.8.2"]})]})]}),o.jsxs("div",{className:"flex-1 space-y-6",children:[s==="profile"&&o.jsx(gE,{}),s==="security"&&o.jsx(yE,{}),s==="database"&&o.jsx(vE,{})]})]})]})}function gE(){const{state:s,actions:a}=Br(),[r,l]=x.useState(""),[c,d]=x.useState(""),[h,m]=x.useState(!1),[p,g]=x.useState(!1),[v,w]=x.useState(Us.isEnabled());x.useEffect(()=>{s.profile&&(l(s.profile.first_name||""),d(s.profile.last_name||""))},[s.profile]);const _=()=>{const j=!v;Us.setEnabled(j),w(j),j?(Us.playSuccess(),ne.success("Sound effects enabled")):ne.info("Sound effects disabled")},S=async()=>{m(!0);const j=await a.updateProfile({first_name:r,last_name:c});m(!1),j&&ne.success("Profile updated")},E=async j=>{const O=j.target.files?.[0];if(!(!O||!s.user)){g(!0);try{const D=O.name.split(".").pop(),q=`${s.user.id}/avatar.${D}`,{data:B,error:G}=await ct.storage.from("avatars").upload(q,O,{upsert:!0});if(G)throw G;const{data:{publicUrl:W}}=ct.storage.from("avatars").getPublicUrl(q);await a.updateProfile({avatar_url:W}),ne.success("Avatar updated")}catch(D){console.error("Avatar upload error:",D),ne.error("Failed to upload avatar")}finally{g(!1)}}};return o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsx(Ta,{children:"Profile Information"}),o.jsx(es,{children:"Update your personal details and avatar."})]}),o.jsxs(Aa,{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:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(by,{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(Rx,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:E,disabled:p})]}),p&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(mt,{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(pa,{htmlFor:"first-name",children:"First Name"}),o.jsx(Se,{id:"first-name",value:r,onChange:j=>l(j.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Se,{id:"last-name",value:c,onChange:j=>d(j.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"email",children:"Email Address"}),o.jsx(Se,{id:"email",value:s.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(Z,{variant:v?"default":"outline",size:"sm",onClick:_,className:"gap-2",children:[v?o.jsx(t_,{className:"w-4 h-4"}):o.jsx(s_,{className:"w-4 h-4"}),v?"Enabled":"Disabled"]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(Z,{onClick:S,disabled:h,children:[h?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Dw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function yE(){const[s,a]=x.useState(""),[r,l]=x.useState(""),[c,d]=x.useState(!1),h=async()=>{if(!s){ne.error("Please enter a new password");return}if(s!==r){ne.error("Passwords do not match");return}if(s.length<6){ne.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await mE(async()=>{const{api:g}=await Promise.resolve().then(()=>Ij);return{api:g}},void 0),p=await m.changePassword(s);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(At,{children:[o.jsxs(Ea,{children:[o.jsx(Ta,{children:"Security"}),o.jsx(es,{children:"Manage your password and account security."})]}),o.jsxs(Aa,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"new-password",children:"New Password"}),o.jsx(Se,{id:"new-password",type:"password",value:s,onChange:m=>a(m.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"confirm-password",children:"Confirm New Password"}),o.jsx(Se,{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(Z,{onClick:h,disabled:c,children:[c?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(hw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function vE(){const[s,a]=x.useState(!1),r=Lr(),l=$j(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(qj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx(Vi,{className:"w-5 h-5 text-primary"}),"Supabase Connection"]}),o.jsx(es,{children:"Manage your database configuration (BYOK - Bring Your Own Keys)."})]}),o.jsx(Aa,{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(Hi,{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(Wi,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(qd,{className:"h-4 w-4 text-amber-500"}),o.jsx(el,{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(Z,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[o.jsx(qd,{className:"w-4 h-4 mr-2"}),"Change Connection"]}),l==="ui"&&o.jsxs(Z,{variant:"outline",onClick:c,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(zo,{className:"w-4 h-4 mr-2"}),"Clear Config"]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(pa,{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(Xx,{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(Z,{onClick:()=>a(!0),children:[o.jsx(Vi,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx(Vv,{open:s,onComplete:()=>a(!1),canClose:!0})]})}function bE({length:s=6,value:a,onChange:r,onComplete:l,disabled:c=!1,error:d=!1}){const h=x.useRef([]),[m,p]=x.useState(null),g=(_,S)=>{const E=S.replace(/[^0-9]/g,"");if(E.length===0){const D=a.split("");D[_]=" ",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 j=[...a];j[_]=E[0],r(j.join("")),_<s-1&&h.current[_+1]?.focus();const O=j.join("");O.length===s&&l&&l(O)},v=(_,S)=>{S.key==="Backspace"&&!a[_]&&_>0||S.key==="ArrowLeft"&&_>0?h.current[_-1]?.focus():S.key==="ArrowRight"&&_<s-1&&h.current[_+1]?.focus()},w=_=>{_.preventDefault();const E=_.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,s);r(E);const j=Math.min(E.length,s-1);h.current[j]?.focus(),E.length===s&&l&&l(E)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:s}).map((_,S)=>o.jsx(Se,{ref:E=>{h.current[S]=E},type:"text",inputMode:"numeric",maxLength:1,value:a[S]||"",onChange:E=>g(S,E.target.value),onKeyDown:E=>v(S,E),onPaste:w,onFocus:()=>p(S),onBlur:()=>p(null),disabled:c,className:Oe("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 xE({onSuccess:s,onConfigure:a}){const[r,l]=x.useState(""),[c,d]=x.useState(""),[h,m]=x.useState(""),[p,g]=x.useState(""),[v,w]=x.useState(!1),[_,S]=x.useState(!0),[E,j]=x.useState(!1),[O,D]=x.useState(""),[q,B]=x.useState("password"),[G,W]=x.useState("email"),[J,P]=x.useState("");x.useEffect(()=>{Q()},[]);const Q=async()=>{try{const{data:ve,error:pe}=await ct.from("init_state").select("is_initialized");if(pe){console.warn("[Login] Init check failed, defaulting to initialized (Login):",pe),j(!0);return}const Ze=ve?.[0]?.is_initialized>0;j(Ze)}catch(ve){if(console.warn("[Login] Init check exception, defaulting to initialized:",ve),ve.message?.includes("Invalid API key")||ve.status===401){console.warn("[Login] API Key invalid for REST check (likely Publishable Key). defaulting to Setup Mode (isInitialized=false)."),j(!1);return}j(!0)}finally{S(!1)}},ce=async ve=>{ve.preventDefault(),w(!0),D("");try{if(E){if(q==="password"){const{error:pe}=await ct.auth.signInWithPassword({email:r,password:c});if(pe)throw pe;ne.success("Logged in successfully"),s?.()}else if(G==="email"){const{error:pe}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(pe)throw pe;W("verify"),ne.success("Validation code sent to your email")}}else{const{data:pe,error:Ze}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:p}});if(Ze||!pe){if(Ze?.message?.includes("First user already exists")){ne.info("System already initialized. Please log in."),j(!0);return}throw new Error(Ze?.message||"Failed to create admin account")}ne.success("Admin account created! Signing you in...");const{error:st}=await ct.auth.signInWithPassword({email:r,password:c});if(st)throw st;j(!0),s?.()}}catch(pe){D(pe?.message||"Authentication failed"),console.error("[Login] Error:",pe)}finally{w(!1)}},Je=async()=>{w(!0),D("");try{const{data:ve,error:pe}=await ct.auth.verifyOtp({email:r,token:J,type:"magiclink"});if(pe)throw pe;if(!ve.session)throw new Error("Failed to create session");ne.success("Logged in successfully"),s?.()}catch(ve){D(ve?.message||"Invalid code")}finally{w(!1)}};return _?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx($t,{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(By,{})}),o.jsxs(At,{className:"w-full max-w-md shadow-2xl",children:[o.jsxs(Ea,{className:"text-center",children:[o.jsx("div",{className:"mx-auto bg-primary/10 p-4 rounded-full w-fit mb-4",children:o.jsx(vf,{className:"w-12 h-12"})}),o.jsx(Ta,{className:"text-2xl",children:E?"Welcome Back":"Welcome to Email Automator"}),o.jsx(es,{children:E?q==="password"?"Sign in to access your email automation":G==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:ce,children:[o.jsxs(Aa,{className:"space-y-4",children:[!E&&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(Se,{value:h,onChange:ve=>m(ve.target.value),required:!E,placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Last Name"}),o.jsx(Se,{value:p,onChange:ve=>g(ve.target.value),required:!E,placeholder:"Doe"})]})]}),q==="password"||G==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Se,{type:"email",placeholder:"admin@example.com",value:r,onChange:ve=>l(ve.target.value),required:!0,autoComplete:"email",disabled:G==="verify"})]}):null,q==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Se,{type:"password",placeholder:"••••••••",value:c,onChange:ve=>d(ve.target.value),required:!0,minLength:6,autoComplete:E?"current-password":"new-password"})]}),q==="otp"&&G==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(bE,{value:J,onChange:P,length:6,onComplete:()=>{}})}),o.jsx(Z,{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:O}),O.includes("configuration")||O.includes("Invalid API key")||O.includes("API key")&&a&&o.jsx(Z,{type:"button",variant:"outline",className:"w-full border-destructive/50 hover:bg-destructive/20 text-destructive",onClick:a,children:"Update Connection Settings"})]})]}),o.jsxs(uv,{className:"flex flex-col gap-3",children:[q==="otp"&&G==="verify"?o.jsx(Z,{type:"button",onClick:Je,disabled:v||J.length!==6,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify Code"}):o.jsx(Z,{type:"submit",disabled:v||!r||q==="password"&&!c,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),E?q==="otp"?"Send Code":"Signing in...":"Creating Account..."]}):o.jsxs(o.Fragment,{children:[E?q==="otp"?o.jsx(Bd,{className:"w-4 h-4 mr-2"}):o.jsx(vw,{className:"w-4 h-4 mr-2"}):o.jsx(Fw,{className:"w-4 h-4 mr-2"}),E?q==="otp"?"Send Login Code":"Sign In":"Create Admin Account"]})}),E&&o.jsx("div",{className:"flex flex-col gap-2 w-full",children:q==="password"?o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("otp"),W("email"),D("")},children:[o.jsx(dw,{className:"w-4 h-4 mr-2"}),"Sign in with Code"]}):o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("password"),D("")},children:[o.jsx(Nx,{className:"w-4 h-4 mr-2"}),"Sign in with Password"]})}),E&&o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"New users must be invited by an admin."})]})]})]})]})}const Iv=void 0,wE=void 0;function _E(s,a){const r=s.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 SE(s){try{const{data:a,error:r}=await s.rpc("get_latest_migration_timestamp");return r?(console.warn("Could not get latest migration timestamp:",r.message),{version:null,latestMigrationTimestamp:null}):{version:Iv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function jE(s){const a=Iv,r=wE,l=await SE(s);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=_E(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 Gv="email_automator_migration_reminder_dismissed_at";function NE(s=24){try{const a=localStorage.getItem(Gv);if(!a)return!1;const r=new Date(a).getTime();return(Date.now()-r)/(1e3*60*60)<s}catch(a){return console.error("Error checking migration reminder:",a),!1}}function EE(){try{localStorage.setItem(Gv,new Date().toISOString())}catch(s){console.error("Error dismissing migration reminder:",s)}}function TE({status:s,onDismiss:a,onLearnMore:r}){const[l,c]=x.useState(!0);if(!l)return null;const d=()=>{EE(),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(Rr,{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(Z,{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(tl,{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 (",s.appVersion,") requires a database schema update."]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Z,{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(Z,{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 Oo({code:s,label:a}){const[r,l]=x.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){ne.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(s),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:s})}),o.jsxs(Z,{type:"button",size:"icon",variant:"ghost",className:"absolute right-2 top-2 h-8 w-8",onClick:d,disabled:!c,children:[r?o.jsx(ja,{className:"h-4 w-4 text-green-600"}):o.jsx(Wx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function AE({open:s,onOpenChange:a,status:r}){const l=Lr(),[c,d]=x.useState(!0),[h,m]=x.useState(!1),[p,g]=x.useState([]),[v,w]=x.useState(""),[_,S]=x.useState(""),E=x.useRef(null),j=x.useMemo(()=>{const D=l?.url;if(!D)return"";try{return new URL(D).hostname.split(".")[0]||""}catch{return""}},[l?.url]);x.useEffect(()=>{E.current&&E.current.scrollIntoView({behavior:"smooth"})},[p]);const O=async()=>{if(!j){ne.error("Missing Project ID");return}m(!0),g(["Initializing migration..."]);try{const D=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:j,dbPassword:v,accessToken:_})});if(!D.ok)throw new Error(`Server returned ${D.status}: ${D.statusText}`);const q=D.body?.getReader();if(!q)throw new Error("No response stream received.");const B=new TextDecoder;for(;;){const{done:G,value:W}=await q.read();if(G)break;const P=B.decode(W).split(`
|
|
96
|
-
`).filter(Boolean);
|
|
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(Oo,{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(Oo,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Wi,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(Rr,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(el,{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(Er,{children:o.jsx(Z,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function kE(){const[s,a]=x.useState([]),{isExpanded:r,setIsExpanded:l}=cv(),[c,d]=x.useState({});x.useEffect(()=>{h();const v=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},w=>{const _=w.new;_.event_type==="error"&&d(S=>({...S,[_.id]:!0})),a(S=>{const E=[_,...S];return E.length>100?E.slice(0,100):E})}).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(w=>({...w,[v]:!w[v]}))},p=v=>{if(v.details?.is_completion)return o.jsx(Hi,{className:"w-3 h-3 text-emerald-500"});switch(v.event_type){case"analysis":return o.jsx($i,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Uo,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(Rr,{className:"w-3 h-3 text-red-500"});default:return o.jsx(Or,{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(At,{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(Ea,{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(Hd,{className:"w-4 h-4 text-primary"}),o.jsx(Ta,{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(bx,{className:"w-3 h-3"}),"LIVE"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:"Clear"}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:o.jsx(Sw,{className:"w-4 h-4"})})]})]}),o.jsxs(Aa,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[s.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:"Waiting for agent activity..."}),s.map((v,w)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[w!==s.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:Oe("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",v.details?.is_completion&&"border-emerald-500/50 bg-emerald-500/5"),children:p(v)}),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:Oe("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(Z,{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(Vx,{className:"w-3 h-3 mr-1"}):o.jsx(Ux,{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:Oe("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(Uo,{className:"w-2.5 h-2.5"}),_]},_))}),v.details.usage&&o.jsx("div",{className:"pt-1.5 flex items-center gap-3 text-[9px] text-muted-foreground/70 border-t border-purple-500/10 mt-1",children:o.jsxs("span",{children:["Tokens: ",v.details.usage.prompt_tokens," (in) + ",v.details.usage.completion_tokens," (out) = ",o.jsx("span",{className:"text-purple-500 font-bold",children:v.details.usage.total_tokens})]})})]}):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(Or,{className:"w-3 h-3"}),v.details.reason]})]}):v.event_type==="error"&&v.details?o.jsx("div",{className:"bg-red-500/5 border border-red-500/10 rounded-lg p-2.5 text-red-600 dark:text-red-400 font-medium",children:typeof v.details.error=="object"?v.details.error.message||JSON.stringify(v.details.error):v.details.error}):v.details?.is_completion?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 dark:text-emerald-400 font-bold uppercase text-[9px] tracking-[0.2em]",children:[o.jsx(Hi,{className:"w-3.5 h-3.5"}),"Batch Sync Finished"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-1",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Processed"}),o.jsx("p",{className:"text-sm font-bold",children:v.details.total_processed||0})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Actions"}),o.jsx("p",{className:"text-sm font-bold text-emerald-500",children:(v.details.deleted||0)+(v.details.drafted||0)})]})]}),v.details.errors>0&&o.jsxs("p",{className:"text-[10px] text-red-500 font-bold pt-1 border-t border-emerald-500/10",children:["⚠️ ",v.details.errors," items failed to process."]})]}):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(zs,{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(zs,{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(zs,{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(zs,{className:"w-3 h-3"})," Raw Response (from Error)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all whitespace-pre-wrap",children:typeof v.details.raw_response=="object"?JSON.stringify(v.details.raw_response,null,2):v.details.raw_response})})]})]})]})]},v.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(Z,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx(Hd,{className:"w-4 h-4 mr-2"}),"Live Activity",s.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 CE(){const{state:s,isSubscribed:a,actions:r}=Br(),[l,c]=x.useState(!1),[d,h]=x.useState("dashboard"),[m,p]=x.useState(!0),[g,v]=x.useState(!1);if(x.useEffect(()=>{const J=()=>{if(Us.isEnabled()){const P=new(window.AudioContext||window.webkitAudioContext);P.state==="suspended"&&P.resume()}window.removeEventListener("click",J),window.removeEventListener("keydown",J)};return window.addEventListener("click",J),window.addEventListener("keydown",J),()=>{window.removeEventListener("click",J),window.removeEventListener("keydown",J)}},[]),x.useEffect(()=>{const P=new URLSearchParams(window.location.search).get("code");P&&!g&&(async()=>{v(!0);try{const ce=await ze.connectGmail(P);if(ce.data?.success)ne.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),r.fetchAccounts());else{const Je=typeof ce.error=="string"?ce.error:ce.error?.message;ne.error(Je||"Failed to connect Gmail")}}catch{ne.error("Connection failed")}finally{v(!1)}})()},[]),g)return o.jsx(qi,{text:"Connecting account..."});const[w,_]=x.useState(null),[S,E]=x.useState(!1),[j,O]=x.useState(!1),[D,q]=x.useState(!1);x.useEffect(()=>{(async()=>{const P=Lr();if(!P){c(!0),p(!1);return}if((await av(P.url,P.anonKey)).valid)s.isInitialized&&s.isAuthenticated&&(r.fetchAccounts(),r.fetchRules(),r.fetchSettings(),r.fetchProfile(),jE(ct).then(ce=>{_(ce),ce.needsMigration&&!NE()&&E(!0)}));else{c(!0),p(!1);return}p(!1)})()},[s.isInitialized,s.isAuthenticated]);const B=()=>{O(!0),E(!1)},G={migrationStatus:w,showMigrationBanner:S,showMigrationModal:j,openMigrationModal:B,suppressMigrationBanner:D,setSuppressMigrationBanner:q};if(m)return o.jsx(qi,{text:"Checking configuration..."});if(l)return o.jsx(Vv,{onComplete:()=>{c(!1),window.location.reload()}});if(!s.isInitialized)return o.jsx(qi,{text:"Initializing..."});if(!s.isAuthenticated)return o.jsx(xE,{onConfigure:()=>c(!0)});const W=async()=>{await ct.auth.signOut(),ne.success("Logged out successfully")};return o.jsx(eN,{value:G,children:o.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[o.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{onClick:()=>h("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(vf,{className:"w-8 h-8"}),o.jsx("span",{className:"hidden sm:inline",children:"Email Automator"}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),o.jsxs("div",{className:Oe("flex items-center gap-1.5 px-2 h-6 rounded-full text-[10px] font-bold border transition-colors",a?"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 dark:text-emerald-400":"bg-yellow-500/10 text-yellow-600 border-yellow-500/20 dark:text-yellow-400"),children:[o.jsxs("div",{className:"relative flex items-center justify-center",children:[a&&o.jsx("span",{className:"absolute inline-flex h-3 w-3 rounded-full bg-emerald-500/40 animate-ping"}),o.jsx("div",{className:Oe("relative w-2 h-2 rounded-full",a?"bg-emerald-500":"bg-yellow-500")})]}),o.jsx("span",{className:"hidden xs:inline leading-none",children:a?"LIVE":"OFFLINE"})]})]}),o.jsxs("div",{className:"flex gap-4 items-center",children:[o.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[o.jsxs(Z,{variant:d==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>h("dashboard"),className:"gap-2",children:[o.jsx(pw,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),o.jsxs(Z,{variant:d==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>h("analytics"),className:"gap-2",children:[o.jsx(yy,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),o.jsxs(Z,{variant:d==="config"?"secondary":"ghost",size:"sm",onClick:()=>h("config"),className:"gap-2",children:[o.jsx(qd,{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(By,{}),o.jsx(Z,{variant:d==="account"?"secondary":"ghost",size:"sm",onClick:()=>h("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:"Account Settings",children:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(Yx,{className:"w-5 h-5"})}),o.jsx(Z,{variant:"ghost",size:"sm",onClick:W,className:"text-muted-foreground hover:text-foreground w-8 px-0",title:"Sign out",children:o.jsx(xw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4 mb-12",children:[d==="dashboard"&&o.jsx(lE,{}),d==="config"&&o.jsx(dE,{}),d==="analytics"&&o.jsx(RE,{}),d==="account"&&o.jsx(pE,{})]}),o.jsx("footer",{className:"max-w-7xl mx-auto px-4 sm:px-8 pb-8 text-center sm:text-left",children:o.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/40 uppercase tracking-[0.2em]",children:["Email Automator ",o.jsx("span",{className:"mx-1",children:"•"})," v","2.8.2"]})}),s.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:s.error})})}),w&&S&&!D&&o.jsx(TE,{status:w,onDismiss:()=>E(!1),onLearnMore:B}),w&&o.jsx(AE,{open:j,onOpenChange:O,status:w}),o.jsx(kE,{})]})})}function OE({runId:s,accountEmail:a,isOpen:r,onOpenChange:l}){const[c,d]=x.useState([]),[h,m]=x.useState(!1);x.useEffect(()=>{r&&s&&p()},[r,s]);const p=async()=>{if(s){m(!0);try{const v=await ze.getRunEvents(s);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($i,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Uo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Dr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Or,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(gn,{open:r,onOpenChange:l,children:o.jsxs(yn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(ka,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(of,{className:"w-5 h-5 text-primary"}),o.jsx(Ca,{children:"Sync Run Trace"})]}),o.jsx(Oa,{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(qi,{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,w)=>o.jsxs("div",{className:"relative pl-8",children:[w!==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(Cr,{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.details?.usage&&o.jsxs("div",{className:"flex gap-3 pt-1.5 mt-1 border-t border-border/50 text-[9px] text-muted-foreground",children:[o.jsxs("span",{children:["In: ",o.jsx("b",{children:v.details.usage.prompt_tokens})]}),o.jsxs("span",{children:["Out: ",o.jsx("b",{children:v.details.usage.completion_tokens})]}),o.jsxs("span",{children:["Total: ",o.jsx("span",{className:"text-primary font-bold",children:v.details.usage.total_tokens})]})]})]}),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(lf,{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 RE(){const{state:s,actions:a}=Br(),[r,l]=x.useState(null),[c,d]=x.useState(void 0),[h,m]=x.useState(!1);if(x.useEffect(()=>{a.fetchStats()},[]),!s.stats)return o.jsx(qi,{text:"Loading analytics..."});const p=(v,w)=>{l(v),d(w),m(!0)},{stats:g}=s;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(yy,{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(Ro,{title:"Total Emails",value:g.totalEmails,color:"primary"}),o.jsx(Ro,{title:"Spam Caught",value:g.categoryCounts.spam||0,color:"destructive"}),o.jsx(Ro,{title:"Actions Taken",value:Object.values(g.actionCounts).reduce((v,w)=>v+w,0)-(g.actionCounts.none||0),color:"emerald"}),o.jsx(Ro,{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,w])=>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:w})]}),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:`${w/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,w])=>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:w})]},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 w=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:Oe("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(Cr,{className:"w-3 h-3"}),new Date(v.started_at).toLocaleString(),w!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[w,"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(OE,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function Ro({title:s,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:s}),o.jsx("p",{className:`text-3xl font-bold ${l[r]||""}`,children:a})]})}function DE(){return o.jsx(l_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(aN,{children:o.jsx(tN,{children:o.jsxs(Fj,{children:[o.jsx(CE,{}),o.jsx(Qj,{})]})})})})}fx.createRoot(document.getElementById("root")).render(o.jsx(my.StrictMode,{children:o.jsx(DE,{})}));
|
|
95
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return x.useEffect(()=>{s&&(document.getElementById(s)||console.error(r))},[r,s]),null},HE="DialogDescriptionWarning",VE=({contentRef:s,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$v(HE).contentName}}.`;return x.useEffect(()=>{const c=s.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,s,a]),null},IE=Tv,GE=kv,PE=Ov,KE=Rv,YE=Mv,JE=Uv,XE=Bv;function gn({...s}){return o.jsx(IE,{"data-slot":"dialog",...s})}function QE({...s}){return o.jsx(GE,{"data-slot":"dialog-portal",...s})}function ZE({className:s,...a}){return o.jsx(PE,{"data-slot":"dialog-overlay",className:Oe("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",s),...a})}function yn({className:s,children:a,...r}){return o.jsxs(QE,{"data-slot":"dialog-portal",children:[o.jsx(ZE,{}),o.jsxs(KE,{"data-slot":"dialog-content",className:Oe("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",s),...r,children:[a,o.jsxs(XE,{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(tl,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ka({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:Oe("flex flex-col gap-2 text-center sm:text-left",s),...a})}function Er({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:Oe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",s),...a})}function Oa({className:s,...a}){return o.jsx(YE,{"data-slot":"dialog-title",className:Oe("text-lg leading-none font-semibold",s),...a})}function Ra({className:s,...a}){return o.jsx(JE,{"data-slot":"dialog-description",className:Oe("text-muted-foreground text-sm",s),...a})}const Se=x.forwardRef(({className:s,type:a,...r},l)=>o.jsx("input",{type:a,className:Oe("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",s),ref:l,...r}));Se.displayName="Input";var FE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],WE=FE.reduce((s,a)=>{const r=_y(`Primitive.${a}`),l=x.forwardRef((c,d)=>{const{asChild:h,...m}=c,y=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(y,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...s,[a]:l}},{}),e2="Label",Hv=x.forwardRef((s,a)=>o.jsx(WE.label,{...s,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(s.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Hv.displayName=e2;var t2=Hv;function pa({className:s,...a}){return o.jsx(t2,{"data-slot":"label",className:Oe("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",s),...a})}const a2=Ny("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 Wi({className:s,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:Oe(a2({variant:a}),s),...r})}function el({className:s,...a}){return o.jsx("div",{"data-slot":"alert-description",className:Oe("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...a})}function vf({className:s}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Oe("w-9 h-9",s),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 fy(s){const a=s.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function s2(s){const a=s.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 n2(s){const a=s.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 Vv({onComplete:s,open:a=!0,canClose:r=!1}){const[l,c]=x.useState("welcome"),[d,h]=x.useState(""),[m,y]=x.useState(""),[p,g]=x.useState(null),[w,_]=x.useState(!1),[S,E]=x.useState(!1),j=async()=>{g(null),c("validating");const G=fy(d),W=m.trim(),J=await av(G,W);J.valid?(Bj({url:G,anonKey:W}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(g(J.error||"Connection failed. Please check your credentials."),c("credentials"))},O=d?s2(d):{valid:!1},D=m?n2(m):{valid:!1},q=d?fy(d):"",B=d&&!d.startsWith("http")&&O.valid;return o.jsx(gn,{open:a,onOpenChange:G=>{!G&&r&&s()},children:o.jsxs(yn,{className:"sm:max-w-md",onPointerDownOutside:G=>{r||G.preventDefault()},onEscapeKeyDown:G=>{r||G.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(ka,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(vf,{className:"w-9 h-9"}),o.jsx(Oa,{children:"Welcome to Email Automator"})]}),o.jsx(Ra,{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(Wi,{children:o.jsxs(el,{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(Ii,{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(Z,{variant:"outline",onClick:s,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:()=>c("credentials"),className:"flex-1",children:"Continue Setup"})]})]})]}),l==="credentials"&&o.jsxs(o.Fragment,{children:[o.jsxs(ka,{children:[o.jsx(Oa,{children:"Connect to Supabase"}),o.jsx(Ra,{children:"Enter your connection details below."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[p&&o.jsxs(Wi,{variant:"destructive",children:[o.jsx(Dr,{className:"h-4 w-4"}),o.jsx(el,{children:p})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"supabase-url",children:"Project URL or ID"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:G=>{h(G.target.value),_(!0)},onBlur:()=>_(!0),className:w&&d?O.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),w&&d&&O.valid&&o.jsx(ja,{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(ja,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),o.jsxs("span",{children:["Will use: ",q]})]}),w&&d&&O.message&&!O.valid&&o.jsx("p",{className:"text-xs text-destructive",children:O.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"anon-key",children:"Anon Public Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:G=>{y(G.target.value),E(!0)},onBlur:()=>E(!0),className:S&&m?D.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),S&&m&&D.valid&&o.jsx(ja,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),S&&m&&D.message&&o.jsx("p",{className:`text-xs ${D.valid?"text-green-600 dark:text-green-400":"text-destructive"}`,children:D.message})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Z,{variant:"outline",onClick:()=>c("welcome"),className:"flex-1",children:"Back"}),r&&o.jsx(Z,{variant:"outline",onClick:s,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:j,disabled:!O.valid||!D.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(ka,{children:[o.jsx(Oa,{children:"Validating Connection"}),o.jsx(Ra,{children:"Verifying your credentials with Supabase..."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx($t,{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(ka,{children:[o.jsx(Oa,{children:"Success!"}),o.jsx(Ra,{children:"Your database is connected."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(Hi,{className:"h-12 w-12 text-green-500 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restarting application..."})]})]})]})})}function r2({email:s,isOpen:a,onOpenChange:r,onRetry:l}){const[c,d]=x.useState([]),[h,m]=x.useState(!1);x.useEffect(()=>{a&&s&&y()},[a,s]);const y=async()=>{if(s){m(!0);try{const g=await ze.getEmailEvents(s.id);g.data&&d(g.data.events)}catch(g){console.error("Failed to fetch trace:",g)}finally{m(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx($i,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Uo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Dr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Or,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(gn,{open:a,onOpenChange:r,children:o.jsxs(yn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(ka,{className:"p-6 border-b flex flex-row items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(of,{className:"w-5 h-5 text-primary"}),o.jsx(Oa,{children:"AI Processing Trace"})]}),o.jsx(Ra,{children:"Step-by-step log of how the AI analyzed and acted on this email."})]}),s?.processing_status==="failed"&&l&&o.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>{l(s),r(!1)},className:"gap-2 text-destructive border-destructive/20 hover:bg-destructive/10",children:[o.jsx(Bs,{className:"w-3.5 h-3.5"}),"Retry Job"]})]}),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(mt,{})}):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 email."}):c.map((g,w)=>o.jsxs("div",{className:"relative pl-8",children:[w!==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: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(kr,{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.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-foreground/90",children:g.details?.message}),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(Us,{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-60 overflow-y-auto font-mono",children:g.details.system_prompt})]}),g.details?.content_preview&&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(Us,{className:"w-3 h-3"})," Email Content (sent to LLM)"]}),o.jsx("pre",{className:"text-[10px] bg-blue-500/5 p-2 rounded border border-blue-500/10 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details.content_preview})]})]}),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(Us,{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(Us,{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.details?.usage&&o.jsxs("div",{className:"flex gap-4 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Prompt:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.prompt_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Completion:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.completion_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Total:"}),o.jsx("span",{className:"font-mono font-bold text-primary",children:g.details.usage.total_tokens})]})]})]}),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(lf,{className:"w-5 h-5 text-emerald-500"})]}),g.event_type==="error"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:typeof g.details?.error=="object"?g.details.error.message||JSON.stringify(g.details.error):g.details?.error}),g.details?.raw_response&&o.jsx("pre",{className:"text-[10px] bg-red-500/5 p-2 rounded border border-red-500/10 overflow-x-auto whitespace-pre-wrap font-mono",children:typeof g.details.raw_response=="object"?JSON.stringify(g.details.raw_response,null,2):g.details.raw_response})]})]})]})]},g.id))})]})})}const i2={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 l2(){const{state:s,actions:a,dispatch:r}=Br(),{openTerminal:l}=cv(),[c,d]=x.useState(!0),[h,m]=x.useState(!1),[y,p]=x.useState(""),[g,w]=x.useState(null),[_,S]=x.useState(null),[E,j]=x.useState({}),[O,D]=x.useState(null),[q,B]=x.useState(!1),[G,W]=x.useState(null);x.useEffect(()=>{s.isAuthenticated?(J(),a.fetchStats()):d(!1)},[g,s.isAuthenticated]);const J=async(C=0)=>{d(!0),await a.fetchEmails({category:g||void 0,search:y||void 0,offset:C,sortBy:s.sortBy,sortOrder:s.sortOrder}),d(!1)},P=C=>{a.fetchEmails({category:g||void 0,search:y||void 0,offset:0,sortBy:C,sortOrder:s.sortOrder})},Q=()=>{a.fetchEmails({category:g||void 0,search:y||void 0,offset:0,sortBy:s.sortBy,sortOrder:s.sortOrder==="asc"?"desc":"asc"})},ce=async()=>{if(s.accounts.length===0){te.warning("Please connect an email account first");return}Ea.playStart(),l(),m(!0);const C=await a.triggerSync();m(!1),C?(Ea.playSuccess(),te.success("Sync completed! Check your emails.")):te.error("Sync failed. Check account status for details.")},Je=async(C,Y)=>{if(Y==="delete"&&O!==C.id){D(C.id);return}D(null),j(_e=>({..._e,[C.id]:Y}));const K=await a.executeAction(C.id,Y);j(_e=>{const je={..._e};return delete je[C.id],je}),K&&(te.success(`Email ${Y==="delete"?"deleted":Y==="archive"?"archived":"updated"}`),Y==="delete"&&J(s.emailsOffset))},ve=()=>{D(null)},pe=C=>{C.preventDefault(),J()},Ze=C=>{const Y=C==="next"?s.emailsOffset+20:Math.max(0,s.emailsOffset-20);J(Y)},st=C=>{W(C),B(!0)},qe=async C=>{await a.retryProcessing(C.id)&&te.success("Retrying email processing...")};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(Bd,{className:"w-5 h-5 text-primary"}),"Recent Analysis"]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(Z,{onClick:ce,size:"sm",variant:"default",className:"h-9 shadow-md px-4",disabled:h,children:[o.jsx(Bs,{className:Oe("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),h?"Syncing...":"Sync Now"]}),o.jsxs("span",{className:"h-9 text-xs font-medium text-muted-foreground bg-secondary px-3 py-1 rounded-md border border-border flex items-center",children:[s.emailsTotal," emails"]})]})]}),h&&o.jsxs("div",{className:"bg-primary/5 border border-primary/20 p-4 rounded-lg flex items-center justify-between animate-in fade-in slide-in-from-top-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o.jsx($t,{className:"w-5 h-5 text-primary animate-spin"})}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-sm",children:"Sync in progress..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Fetching and analyzing emails. New emails will appear below automatically."})]})]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:l,className:"h-8 text-xs",children:[o.jsx(of,{className:"w-3.5 h-3.5 mr-2"}),"View Logs"]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-center",children:[o.jsxs("form",{onSubmit:pe,className:"flex-1 flex gap-2 w-full",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(zw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Se,{placeholder:"Search emails...",value:y,onChange:C=>p(C.target.value),className:"pl-9 h-9"})]}),o.jsx(Z,{type:"submit",size:"sm",className:"h-9 px-4",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50 h-9",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-full",value:s.sortBy,onChange:C=>P(C.target.value),children:[o.jsx("option",{value:"date",children:"Received Time"}),o.jsx("option",{value:"created_at",children:"Processed Time"})]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-primary",onClick:Q,title:s.sortOrder==="asc"?"Sorting: Oldest First":"Sorting: Newest First",children:s.sortOrder==="asc"?o.jsx(Tx,{className:"w-3.5 h-3.5"}):o.jsx(Sx,{className:"w-3.5 h-3.5"})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(Z,{size:"sm",variant:s.activeCategory===null?"secondary":"ghost",onClick:()=>w(null),children:"All"}),["spam","client","newsletter","support"].map(C=>o.jsx(Z,{size:"sm",variant:s.activeCategory===C?"secondary":"ghost",onClick:()=>w(C),className:"capitalize",children:C},C))]}),c?o.jsx(sN,{}):s.emails.length===0?o.jsxs(At,{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(Bd,{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:s.accounts.length===0?"Connect your email account to get started.":"Try syncing or adjusting your filters."}),s.accounts.length>0&&o.jsxs(Z,{onClick:()=>{l(),ce()},disabled:h,children:[o.jsx(Bs,{className:Oe("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[s.emails.map(C=>o.jsx(u2,{email:C,onAction:Je,onRetry:qe,onViewTrace:st,onSelect:()=>S(C),isSelected:_?.id===C.id,loadingAction:E[C.id],isDeletePending:O===C.id,onCancelDelete:ve},C.id)),o.jsx(r2,{isOpen:q,onOpenChange:B,email:G,onRetry:qe}),s.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("prev"),disabled:s.emailsOffset===0,children:[o.jsx(Bx,{className:"w-4 h-4 mr-1"}),"Previous"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.emailsOffset+1," - ",Math.min(s.emailsOffset+20,s.emailsTotal)," of ",s.emailsTotal]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("next"),disabled:s.emailsOffset+20>=s.emailsTotal,children:["Next",o.jsx($x,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[_&&o.jsxs(At,{className:"p-6 border-primary/20 bg-primary/5 animate-in slide-in-from-right-5",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"font-semibold",children:"Email Details"}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>S(null),children:o.jsx(tl,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"From:"}),o.jsx("p",{className:"font-medium truncate",children:_.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((C,Y)=>o.jsx("li",{children:C},Y))})]}),_.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(Lw,{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."]})]})]})]})]}),o.jsx(o2,{accounts:s.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:s.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(vy,{className:"w-4 h-4 text-primary"}),"Sync History"]}),o.jsx("div",{className:"space-y-4",children:!s.stats?.recentSyncs||s.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No sync history available."}):s.stats.recentSyncs.slice(0,5).map(C=>o.jsxs("div",{className:"flex justify-between items-start text-sm border-b last:border-0 pb-3 last:pb-0",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Oe("w-1.5 h-1.5 rounded-full",C.status==="success"?"bg-emerald-500":C.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(C.started_at).toLocaleDateString()," ",new Date(C.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),o.jsxs("p",{className:"text-[10px] text-muted-foreground pl-3.5",children:["Processed: ",o.jsx("span",{className:"font-medium text-foreground",children:C.emails_processed})," • Actioned: ",o.jsx("span",{className:"font-medium text-foreground",children:C.emails_deleted+C.emails_drafted})]}),C.error_message&&o.jsx("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:C.error_message,children:C.error_message})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:C.status==="running"?"Running":C.completed_at?`${Math.round((new Date(C.completed_at).getTime()-new Date(C.started_at).getTime())/1e3)}s`:"..."})]},C.id))})]}),o.jsxs(At,{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:s.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:s.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:s.rules.filter(C=>C.is_enabled).length})]})]})]})]})]})}function o2({accounts:s,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){return s.length===0?null:o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx($w,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsx("div",{className:"space-y-6",children:s.map(h=>o.jsx(c2,{account:h,onUpdate:a,onSync:r,openTerminal:d},h.id))})]})}function c2({account:s,onUpdate:a,onSync:r,openTerminal:l}){const[c,d]=x.useState(!1),[h,m]=x.useState(""),[y,p]=x.useState(""),g=E=>{if(!E)return"";const j=typeof E=="string"&&/^\d+$/.test(E)?parseInt(E):E,O=new Date(j);if(isNaN(O.getTime()))return"";const D=q=>q<10?"0"+q:q;return O.getFullYear()+"-"+D(O.getMonth()+1)+"-"+D(O.getDate())+"T"+D(O.getHours())+":"+D(O.getMinutes())};x.useEffect(()=>{const E=s.sync_start_date||s.last_sync_checkpoint||s.last_sync_at;m(g(E)),p((s.sync_max_emails_per_run||50).toString())},[s.id,s.sync_start_date,s.last_sync_checkpoint,s.last_sync_at,s.sync_max_emails_per_run]);const w=async E=>{d(!0),await a(s.id,E),d(!1)},_=()=>{const E=s.sync_start_date?new Date(s.sync_start_date).toISOString():"",j=h?new Date(h).toISOString():"";j!==E&&w({sync_start_date:j||null})},S=()=>{const E=parseInt(y,10)||50;E!==s.sync_max_emails_per_run&&w({sync_max_emails_per_run:E})};return 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:s.email_address,children:s.email_address}),o.jsxs("div",{className:"flex items-center gap-1",children:[s.last_sync_status==="syncing"?o.jsx($t,{className:"w-3 h-3 text-primary animate-spin"}):s.last_sync_status==="success"?o.jsx(lf,{className:"w-3 h-3 text-emerald-500"}):s.last_sync_status==="error"?o.jsx("span",{title:s.last_sync_error||"Error",children:o.jsx(Dr,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{l(),r(s.id)},disabled:s.last_sync_status==="syncing",children:o.jsx(Bs,{className:Oe("w-3 h-3",s.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(Z,{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(s.id,{last_sync_checkpoint:null}),disabled:s.last_sync_status==="syncing",children:o.jsx(vy,{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(kx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Se,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:h,onChange:E=>m(E.target.value),onBlur:_,disabled:c||s.last_sync_status==="syncing"})]}),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(ow,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Se,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:y,onChange:E=>p(E.target.value),onBlur:S,disabled:c||s.last_sync_status==="syncing"})]})]}),s.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Last sync: ",new Date(s.last_sync_at).toLocaleString()]}),s.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:s.last_sync_error,children:["Error: ",s.last_sync_error]})]})}function u2({email:s,onAction:a,onRetry:r,onViewTrace:l,onSelect:c,isSelected:d,loadingAction:h,isDeletePending:m,onCancelDelete:y}){if(!s)return null;const p=i2[s.category||"other"],g=!!h,w=()=>{if(!s.email_accounts)return"#";const{provider:_,email_address:S}=s.email_accounts;return _==="gmail"?`https://mail.google.com/mail/u/${S}/#all/${s.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(s.external_id)}`};return o.jsx(At,{className:Oe("hover:shadow-md transition-shadow group cursor-pointer",d&&"ring-2 ring-primary"),onClick:c,children:o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex justify-between items-start mb-3 gap-4",children:[o.jsxs("div",{className:"flex gap-3 flex-1 min-w-0",children:[o.jsx("div",{className:Oe("w-8 h-8 rounded-full flex-shrink-0 flex items-center justify-center font-bold text-white text-xs",s.category==="spam"?"bg-destructive":"bg-primary"),children:s.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:s.subject||"No Subject"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",title:s.sender||"",children:s.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:Oe("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",p),children:s.category||"unknown"}),o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.processing_status==="pending"&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(kr,{className:"w-2.5 h-2.5"})," Queued"]}),s.processing_status==="processing"&&o.jsxs("span",{className:"text-[9px] text-blue-600 dark:text-blue-400 bg-blue-500/10 border border-blue-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($t,{className:"w-2.5 h-2.5 animate-spin"})," Analyzing"]}),s.processing_status==="completed"&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($i,{className:"w-2.5 h-2.5"})," Analyzed"]}),s.processing_status==="failed"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("span",{className:"text-[9px] text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",title:s.processing_error||"Unknown error",children:[o.jsx(Dr,{className:"w-2.5 h-2.5"})," Failed"]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-5 w-5 text-red-600 hover:bg-red-500/10",onClick:_=>{_.stopPropagation(),r(s)},title:"Retry Processing",children:o.jsx(Bs,{className:"w-2.5 h-2.5"})})]}),!s.processing_status&&!s.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($t,{className:"w-2.5 h-2.5 animate-spin"})," Pending"]}),!s.processing_status&&s.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($i,{className:"w-2.5 h-2.5"})," Analyzed"]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-2 text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:s.date?new Date(s.date).toLocaleString():"",className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"REC:"})," ",s.date?new Date(s.date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsx("span",{className:"opacity-30",children:"•"}),o.jsxs("span",{title:new Date(s.created_at).toLocaleString(),className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"PROC:"})," ",new Date(s.created_at).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:s.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($d,{className:"w-3.5 h-3.5 text-emerald-500"}),"Suggested:",s.suggested_actions&&s.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:s.suggested_actions.map(_=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:_},_))}):o.jsx("span",{className:"text-foreground",children:s.suggested_action||"none"}),s.actions_taken&&s.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:s.actions_taken.join(", "),children:["(Done: ",s.actions_taken.join(", "),")"]}):s.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(Done: ",s.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:_=>_.stopPropagation(),children:m?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(Z,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(s,"delete"),disabled:g,children:h==="delete"?o.jsx($t,{className:"w-3 h-3 animate-spin"}):"Yes"}),o.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:y,disabled:g,children:"No"})]}):o.jsxs(o.Fragment,{children:[o.jsx("a",{href:w(),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 ${s.email_accounts?.provider==="gmail"?"Gmail":"Outlook"}`,children:o.jsx(Ii,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>l(s),title:"View AI Trace (Prompt/Response)",children:o.jsx(nw,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>a(s,"delete"),disabled:g,title:"Delete",children:h==="delete"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(zo,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>a(s,"archive"),disabled:g,title:"Archive",children:h==="archive"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(wx,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>a(s,"flag"),disabled:g,title:"Flag",children:h==="flag"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(iw,{className:"w-3.5 h-3.5"})})]})})]})]})})}function d2(){const{state:s,actions:a}=Br(),[r,l]=x.useState(!1),[c,d]=x.useState(!1),[h,m]=x.useState(null),[y,p]=x.useState(!1),[g,w]=x.useState(!1),[_,S]=x.useState({}),[E,j]=x.useState(!1),[O,D]=x.useState("credentials"),[q,B]=x.useState(""),[G,W]=x.useState(""),[J,P]=x.useState(""),[Q,ce]=x.useState(""),[Je,ve]=x.useState(!1),[pe,Ze]=x.useState(!1),[st,qe]=x.useState(!1),[C,Y]=x.useState("credentials"),[K,_e]=x.useState(""),[je,A]=x.useState(""),[V,X]=x.useState(!1),[F,de]=x.useState(!1),[ge,ue]=x.useState(""),[Ge,Ue]=x.useState("category"),[Ct,pt]=x.useState("newsletter"),[xt,ns]=x.useState(["archive"]),[la,rs]=x.useState(""),[xn,wn]=x.useState(""),[qr,is]=x.useState(""),[_n,ls]=x.useState(""),[sl,qs]=x.useState([]),[gt,nl]=x.useState(!1),[$r,Hr]=x.useState(!1),[Da,Sn]=x.useState(null),[ya,jn]=x.useState(null);x.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),x.useEffect(()=>{s.settings&&S(s.settings)},[s.settings]);const Qo=async()=>{const R=s.rules.find(ee=>ee.name==="Auto-Trash Spam");if(!R){te.error("System rule not found. Please sync your database.");return}Sn("auto_trash_spam"),await a.toggleRule(R.id),Sn(null)},$s=async()=>{const R=s.rules.find(ee=>ee.name==="Smart Drafts");if(!R){te.error("System rule not found. Please sync your database.");return}Sn("smart_drafts"),await a.toggleRule(R.id),Sn(null)},wt=R=>{jn(R),ue(R.name);const ee=R.condition,yt=Object.keys(ee).filter(Is=>Is!=="older_than_days")[0]||"category";Ue(yt),pt(ee[yt]||""),rs(ee.older_than_days?.toString()||"");const Vs=R.actions&&R.actions.length>0?R.actions:R.action?[R.action]:["archive"];ns(Vs),wn(R.instructions||""),is(R.description||""),ls(R.intent||""),qs(R.attachments||[]),de(!0)},va=x.useRef(null),Ot=()=>{D("credentials"),B(""),W(""),P(""),ce(""),j(!0)},Zo=R=>{B(R);try{const ee=JSON.parse(R),Ce=ee.installed||ee.web||ee;Ce.client_id&&W(Ce.client_id),Ce.client_secret&&P(Ce.client_secret),ee.installed?te.success("Detected Desktop app credentials"):ee.web&&te.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Fo=async()=>{if(!G||!J){te.error("Please provide both Client ID and Client Secret");return}ve(!0);try{if(await a.updateSettings({..._,google_client_id:G,google_client_secret:J})){S(Ce=>({...Ce,google_client_id:G,google_client_secret:J}));const ee=await ze.getGmailAuthUrl();if(ee.data?.url)window.open(ee.data.url,"_blank"),D("code"),te.success("Please authorize in the opened tab, then paste the code here");else{const Ce=typeof ee.error=="string"?ee.error:ee.error?.message;te.error(Ce||"Failed to get OAuth URL")}}else te.error("Failed to save credentials")}catch{te.error("Failed to save credentials")}finally{ve(!1)}},Wo=async()=>{if(!Q.trim()){te.error("Please paste the authorization code");return}Ze(!0);try{const R=await ze.connectGmail(Q.trim());if(R.data?.success)te.success("Gmail account connected successfully!"),j(!1),a.fetchAccounts();else{const ee=typeof R.error=="string"?R.error:R.error?.message;te.error(ee||"Failed to connect Gmail")}}catch{te.error("Failed to connect Gmail")}finally{Ze(!1)}},Nn=()=>{Y("credentials"),_e(""),A(""),qe(!0)},En=async()=>{if(!K){te.error("Please provide the Client ID");return}X(!0);try{if(await a.updateSettings({..._,microsoft_client_id:K,microsoft_tenant_id:je||"common"})){S(Ce=>({...Ce,microsoft_client_id:K,microsoft_tenant_id:je||"common"}));const ee=await ze.startMicrosoftDeviceFlow();if(ee.data)m(ee.data),Y("device-code"),Tn(ee.data.deviceCode,ee.data.interval);else{const Ce=typeof ee.error=="string"?ee.error:ee.error?.message;te.error(Ce||"Failed to start device flow")}}else te.error("Failed to save credentials")}catch{te.error("Failed to save credentials")}finally{X(!1)}},Tn=async(R,ee)=>{const Ce=setInterval(async()=>{try{const yt=await ze.pollMicrosoftDeviceCode(R);yt.data?.status==="completed"?(clearInterval(Ce),m(null),d(!1),qe(!1),te.success("Outlook account connected"),a.fetchAccounts()):yt.error&&typeof yt.error=="object"&&yt.error.code}catch{}},ee*1e3);setTimeout(()=>{clearInterval(Ce),c&&(m(null),d(!1),qe(!1),te.error("Connection timed out. Please try again."))},900*1e3)},Ma=async()=>{if(!ge){te.error("Please name your rule");return}if(xt.length===0){te.error("Please select at least one action");return}Hr(!0);try{const R={[Ge]:Ct};la&&(R.older_than_days=parseInt(la,10));const ee=xt.includes("draft"),Ce={name:ge,description:qr||void 0,intent:_n||void 0,condition:R,actions:xt,instructions:ee?xn:void 0,attachments:ee?sl:[],is_enabled:!0};let yt=!1;ya?yt=await a.updateRule(ya.id,Ce):yt=await a.createRule(Ce),yt?(te.success(ya?"Rule updated":"Rule created"),de(!1),jn(null),ue(""),ns(["archive"]),rs(""),wn(""),is(""),ls(""),qs([]),a.fetchRules()):te.error(`Failed to ${ya?"update":"create"} rule`)}catch{te.error("An error occurred while saving the rule")}finally{Hr(!1)}},An=async R=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(R)&&te.success("Account disconnected")},os=async()=>{p(!0);const R=await a.updateSettings(_);p(!1),R&&te.success("Settings saved")},ec=async()=>{w(!0);try{const R=await ze.testLlm({llm_model:_.llm_model||null,llm_base_url:_.llm_base_url||null,llm_api_key:_.llm_api_key||null});R.data?.success?te.success(R.data.message):te.error(R.data?.message||"Connection test failed")}catch{te.error("Failed to test connection")}finally{w(!1)}},rl=async R=>{await a.toggleRule(R)},Vr=async R=>{const ee=R.target.files;if(!ee||ee.length===0)return;nl(!0);const Ce=ee[0],yt=Ce.name.split(".").pop(),Vs=`${Math.random().toString(36).substring(2)}.${yt}`,Is=`${s.user.id}/${Vs}`;try{const{error:Gs}=await ct.storage.from("rule-attachments").upload(Is,Ce);if(Gs)throw Gs;const ba={name:Ce.name,path:Is,type:Ce.type,size:Ce.size};qs(ut=>[...ut,ba]),te.success("File uploaded")}catch(Gs){console.error("Upload error:",Gs),te.error("Failed to upload file")}finally{nl(!1),R.target.value=""}},Hs=R=>{qs(ee=>ee.filter(Ce=>Ce.path!==R))},tc=R=>R==="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(gn,{open:E,onOpenChange:j,children:o.jsxs(yn,{className:"sm:max-w-lg",children:[o.jsxs(ka,{children:[o.jsxs(Oa,{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(Ra,{children:O==="credentials"?"Enter your Google OAuth credentials to connect your Gmail account.":"Paste the authorization code from Google to complete the connection."})]}),O==="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(Qw,{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:R=>Zo(R.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(Se,{placeholder:"xxx.apps.googleusercontent.com",value:G,onChange:R=>W(R.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Se,{type:"password",placeholder:"GOCSPX-...",value:J,onChange:R=>P(R.target.value)})]})]})]}),o.jsxs(Er,{children:[o.jsx(Z,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Fo,disabled:Je||!G||!J,children:[Je?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{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(Se,{placeholder:"4/0AQlEd8x...",value:Q,onChange:R=>ce(R.target.value),className:"font-mono"})]})]}),o.jsxs(Er,{children:[o.jsx(Z,{variant:"outline",onClick:()=>D("credentials"),children:"Back"}),o.jsxs(Z,{onClick:Wo,disabled:pe||!Q.trim(),children:[pe?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Connect"]})]})]})]})}),o.jsx(gn,{open:st,onOpenChange:qe,children:o.jsxs(yn,{className:"sm:max-w-lg",children:[o.jsxs(ka,{children:[o.jsxs(Oa,{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(Ra,{children:C==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),C==="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(Se,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:R=>_e(R.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),o.jsx(Se,{placeholder:"common",value:je,onChange:R=>A(R.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(Er,{children:[o.jsx(Z,{variant:"outline",onClick:()=>qe(!1),children:"Cancel"}),o.jsxs(Z,{onClick:En,disabled:V||!K,children:[V?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{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(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ii,{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(mt,{size:"sm"}),"Waiting for authorization..."]})})]}),o.jsx(Er,{children:o.jsx(Z,{variant:"outline",onClick:()=>qe(!1),children:"Cancel"})})]})]})}),o.jsx(gn,{open:F,onOpenChange:R=>{de(R),R||jn(null)},children:o.jsxs(yn,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[o.jsxs(ka,{className:"p-6 border-b",children:[o.jsx(Oa,{children:ya?"Edit Auto-Pilot Rule":"Create Auto-Pilot Rule"}),o.jsx(Ra,{children:"Define a condition based on AI analysis to trigger an action."})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Rule Name"}),o.jsx(Se,{placeholder:"e.g. Archive Newsletters",value:ge,onChange:R=>ue(R.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Description"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:"e.g. Handle all marketing newsletters and promotional content from subscription services",value:qr,onChange:R=>is(R.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Describe what this rule is for. The AI uses this to semantically match emails."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Intent"}),o.jsx(Se,{placeholder:"e.g. Politely decline all sales pitches",value:_n,onChange:R=>ls(R.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"The goal of this rule. Used to generate appropriate draft replies."})]}),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:R=>{Ue(R.target.value),R.target.value==="category"?pt("newsletter"):R.target.value==="sentiment"?pt("Positive"):R.target.value==="priority"?pt("High"):pt("")},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:Ct,onChange:R=>pt(R.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:Ct,onChange:R=>pt(R.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:Ct,onChange:R=>pt(R.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(Se,{placeholder:Ge==="sender_domain"?"rta.vn":Ge==="sender_email"?"john@example.com":"Keywords...",value:Ct,onChange:R=>pt(R.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(kr,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Se,{type:"number",min:"0",placeholder:"0",className:"w-24",value:la,onChange:R=>rs(R.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(R=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${xt.includes(R.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:xt.includes(R.value),onChange:ee=>{ee.target.checked?ns([...xt,R.value]):ns(xt.filter(Ce=>Ce!==R.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:R.label})]},R.value))})]}),xt.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:xn,onChange:R=>wn(R.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(xg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[sl.map(R=>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:R.name}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>Hs(R.path),children:o.jsx(tl,{className:"w-3 h-3"})})]},R.path)),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:Vr,disabled:gt}),o.jsxs(Z,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:gt,children:[gt?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{className:"w-3 h-3 mr-2"}),gt?"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(Er,{className:"p-6 border-t bg-secondary/5",children:[o.jsx(Z,{variant:"outline",onClick:()=>de(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Ma,disabled:$r,children:[$r?o.jsx(mt,{size:"sm",className:"mr-2"}):ya?o.jsx(ja,{className:"w-4 h-4 mr-2"}):o.jsx(Mi,{className:"w-4 h-4 mr-2"}),ya?"Save Changes":"Create Rule"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs(At,{children:[o.jsxs(Ta,{children:[o.jsxs(Aa,{className:"flex items-center gap-2",children:[o.jsx(Vi,{className:"w-5 h-5 text-primary"}),"Connected Accounts"]}),o.jsx(ts,{children:"Manage your email providers"})]}),o.jsxs(Ca,{className:"space-y-4",children:[s.accounts.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No accounts connected yet"}):s.accounts.map(R=>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:[tc(R.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:R.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:R.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[R.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(Z,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>An(R.id),children:o.jsx(zo,{className:"w-4 h-4"})})]})]},R.id)),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Ot,disabled:r||c,children:[r?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Nn,disabled:r||c,children:[c&&!h?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{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(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ii,{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(At,{children:[o.jsxs(Ta,{children:[o.jsxs(Aa,{className:"flex items-center gap-2",children:[o.jsx($d,{className:"w-5 h-5 text-emerald-500"}),"Auto-Pilot Rules"]}),o.jsx(ts,{children:"Configure AI automation behavior"})]}),o.jsxs(Ca,{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("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const R=s.rules.find(ee=>ee.name==="Auto-Trash Spam");R&&wt(R)},title:"Edit Logic",children:o.jsx(yd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(R=>R.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Qo,disabled:Da==="auto_trash_spam",children:[Da==="auto_trash_spam"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(vd,{className:"w-4 h-4 mr-1"}),s.rules.find(R=>R.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("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const R=s.rules.find(ee=>ee.name==="Smart Drafts");R&&wt(R)},title:"Edit Logic",children:o.jsx(yd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(R=>R.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:$s,disabled:Da==="smart_drafts",children:[Da==="smart_drafts"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(vd,{className:"w-4 h-4 mr-1"}),s.rules.find(R=>R.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(Z,{variant:"ghost",size:"sm",onClick:()=>{jn(null),ue(""),is(""),ls(""),ns(["archive"]),rs(""),wn(""),qs([]),de(!0)},children:[o.jsx(Mi,{className:"w-4 h-4 mr-1"})," Add Rule"]})]}),s.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"}),s.rules.length>0&&s.rules.filter(R=>R.name!=="Auto-Trash Spam"&&R.name!=="Smart Drafts").map(R=>{const ee=R.actions&&R.actions.length>0?R.actions:R.action?[R.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:R.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["→ ",ee.join(" + ")]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>wt(R),title:"Edit Rule",children:o.jsx(yd,{className:"w-3.5 h-3.5 text-muted-foreground"})}),o.jsxs(Z,{variant:R.is_enabled?"default":"outline",size:"sm",onClick:()=>rl(R.id),className:"h-7 px-2",children:[o.jsx(vd,{className:"w-3.5 h-3.5 mr-1"}),R.is_enabled?"On":"Off"]}),o.jsx(Z,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>a.deleteRule(R.id),children:o.jsx(zo,{className:"w-3 h-3"})})]})]}),R.instructions&&o.jsxs("p",{className:"text-[10px] text-muted-foreground italic border-t border-border/50 pt-1 mt-1 truncate",children:['"',R.instructions,'"']}),R.attachments&&R.attachments.length>0&&o.jsx("div",{className:"flex gap-1 mt-1",children:R.attachments.map(Ce=>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(xg,{className:"w-2.5 h-2.5"}),Ce.name]},Ce.path))})]},R.id)})]})]})]})]}),o.jsxs(At,{children:[o.jsxs(Ta,{children:[o.jsxs(Aa,{className:"flex items-center gap-2",children:[o.jsx(Bs,{className:"w-5 h-5 text-indigo-500"}),"Model Configuration"]}),o.jsx(ts,{children:"Configure Local LLM or API settings"})]}),o.jsxs(Ca,{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(Se,{placeholder:"gpt-4o-mini",value:_.llm_model||"",onChange:R=>S(ee=>({...ee,llm_model:R.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Base URL"}),o.jsx(Se,{placeholder:"https://api.openai.com/v1",value:_.llm_base_url||"",onChange:R=>S(ee=>({...ee,llm_base_url:R.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(Se,{type:"password",placeholder:"sk-...",value:_.llm_api_key||"",onChange:R=>S(ee=>({...ee,llm_api_key:R.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Vi,{className:"w-4 h-4"}),"Local Storage Path (.eml)"]}),o.jsx(Se,{placeholder:"./data/emails",value:_.storage_path||"",onChange:R=>S(ee=>({...ee,storage_path:R.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Absolute or relative path where raw emails will be saved before analysis. Default: ./data/emails"})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(kr,{className:"w-4 h-4"}),"Background Sync Interval (minutes)"]}),o.jsx(Se,{type:"number",min:1,max:1440,value:_.sync_interval_minutes||5,onChange:R=>S(ee=>({...ee,sync_interval_minutes:parseInt(R.target.value,10)||5}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"How often the system checks for new emails in the background."})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(Z,{variant:"outline",onClick:ec,disabled:g,children:[g?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(Z,{onClick:os,disabled:y,children:[y?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})]})]})]}),o.jsx("div",{ref:va,children:o.jsxs(At,{children:[o.jsxs(Ta,{children:[o.jsxs(Aa,{className:"flex items-center gap-2",children:[o.jsx($d,{className:"w-5 h-5 text-orange-500"}),"Provider Credentials (Advanced)"]}),o.jsx(ts,{children:"Bring Your Own Keys (BYOK). Configure your own OAuth credentials here. Leave empty to use system defaults."})]}),o.jsxs(Ca,{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(Se,{type:"password",placeholder:"...apps.googleusercontent.com",value:_.google_client_id||"",onChange:R=>S(ee=>({...ee,google_client_id:R.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Se,{type:"password",placeholder:"GOCSPX-...",value:_.google_client_secret||"",onChange:R=>S(ee=>({...ee,google_client_secret:R.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(Se,{type:"password",value:_.microsoft_client_id||"",onChange:R=>S(ee=>({...ee,microsoft_client_id:R.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),o.jsx(Se,{type:"password",value:_.microsoft_client_secret||"",onChange:R=>S(ee=>({...ee,microsoft_client_secret:R.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),o.jsx(Se,{placeholder:"common",value:_.microsoft_tenant_id||"",onChange:R=>S(ee=>({...ee,microsoft_tenant_id:R.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(Z,{onClick:os,disabled:y,variant:"secondary",children:[y?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})})]})]})})]})}const f2="modulepreload",h2=function(s){return"/"+s},hy={},m2=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let p=function(g){return Promise.all(g.map(w=>Promise.resolve(w).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};var h=p;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),y=m?.nonce||m?.getAttribute("nonce");c=p(r.map(g=>{if(g=h2(g),g in hy)return;hy[g]=!0;const w=g.endsWith(".css"),_=w?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${_}`))return;const S=document.createElement("link");if(S.rel=w?"stylesheet":f2,w||(S.as="script"),S.crossOrigin="",S.href=g,y&&S.setAttribute("nonce",y),document.head.appendChild(S),w)return new Promise((E,j)=>{S.addEventListener("load",E),S.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(m){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=m,window.dispatchEvent(y),!y.defaultPrevented)throw m}return c.then(m=>{for(const y of m||[])y.status==="rejected"&&d(y.reason);return a().catch(d)})};function p2(){const[s,a]=x.useState("profile"),{state:r,actions:l}=Br();x.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:by},{id:"security",label:"Security",icon:Iw},{id:"database",label:"Supabase",icon:Vi}];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.jsxs("aside",{className:"w-full md:w-64 flex flex-col justify-between",children:[o.jsx("nav",{className:"space-y-1",children:c.map(d=>{const h=d.icon,m=s===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:"mt-8 px-4 py-4 border-t border-border/40 text-center md:text-left",children:[o.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-widest mb-1",children:"Version"}),o.jsxs("p",{className:"text-xs font-mono text-muted-foreground/70",children:["v","2.8.4"]})]})]}),o.jsxs("div",{className:"flex-1 space-y-6",children:[s==="profile"&&o.jsx(g2,{}),s==="security"&&o.jsx(y2,{}),s==="database"&&o.jsx(v2,{})]})]})]})}function g2(){const{state:s,actions:a}=Br(),[r,l]=x.useState(""),[c,d]=x.useState(""),[h,m]=x.useState(!1),[y,p]=x.useState(!1),[g,w]=x.useState(Ea.isEnabled());x.useEffect(()=>{s.profile&&(l(s.profile.first_name||""),d(s.profile.last_name||""))},[s.profile]);const _=()=>{const j=!g;Ea.setEnabled(j),w(j),j?(Ea.playSuccess(),te.success("Sound effects enabled")):te.info("Sound effects disabled")},S=async()=>{m(!0);const j=await a.updateProfile({first_name:r,last_name:c});m(!1),j&&te.success("Profile updated")},E=async j=>{const O=j.target.files?.[0];if(!(!O||!s.user)){p(!0);try{const D=O.name.split(".").pop(),q=`${s.user.id}/avatar.${D}`,{data:B,error:G}=await ct.storage.from("avatars").upload(q,O,{upsert:!0});if(G)throw G;const{data:{publicUrl:W}}=ct.storage.from("avatars").getPublicUrl(q);await a.updateProfile({avatar_url:W}),te.success("Avatar updated")}catch(D){console.error("Avatar upload error:",D),te.error("Failed to upload avatar")}finally{p(!1)}}};return o.jsxs(At,{children:[o.jsxs(Ta,{children:[o.jsx(Aa,{children:"Profile Information"}),o.jsx(ts,{children:"Update your personal details and avatar."})]}),o.jsxs(Ca,{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:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(by,{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(Rx,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:E,disabled:y})]}),y&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(mt,{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(pa,{htmlFor:"first-name",children:"First Name"}),o.jsx(Se,{id:"first-name",value:r,onChange:j=>l(j.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Se,{id:"last-name",value:c,onChange:j=>d(j.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"email",children:"Email Address"}),o.jsx(Se,{id:"email",value:s.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(Z,{variant:g?"default":"outline",size:"sm",onClick:_,className:"gap-2",children:[g?o.jsx(t_,{className:"w-4 h-4"}):o.jsx(s_,{className:"w-4 h-4"}),g?"Enabled":"Disabled"]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(Z,{onClick:S,disabled:h,children:[h?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Dw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function y2(){const[s,a]=x.useState(""),[r,l]=x.useState(""),[c,d]=x.useState(!1),h=async()=>{if(!s){te.error("Please enter a new password");return}if(s!==r){te.error("Passwords do not match");return}if(s.length<6){te.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await m2(async()=>{const{api:p}=await Promise.resolve().then(()=>Ij);return{api:p}},void 0),y=await m.changePassword(s);y.success?(te.success("Password changed successfully"),a(""),l("")):te.error(y.error?.message||"Failed to change password")}catch{te.error("An error occurred")}finally{d(!1)}};return o.jsxs(At,{children:[o.jsxs(Ta,{children:[o.jsx(Aa,{children:"Security"}),o.jsx(ts,{children:"Manage your password and account security."})]}),o.jsxs(Ca,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"new-password",children:"New Password"}),o.jsx(Se,{id:"new-password",type:"password",value:s,onChange:m=>a(m.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"confirm-password",children:"Confirm New Password"}),o.jsx(Se,{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(Z,{onClick:h,disabled:c,children:[c?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(hw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function v2(){const[s,a]=x.useState(!1),r=Lr(),l=$j(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(qj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(At,{children:[o.jsxs(Ta,{children:[o.jsxs(Aa,{className:"flex items-center gap-2",children:[o.jsx(Vi,{className:"w-5 h-5 text-primary"}),"Supabase Connection"]}),o.jsx(ts,{children:"Manage your database configuration (BYOK - Bring Your Own Keys)."})]}),o.jsx(Ca,{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(Hi,{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(Wi,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(qd,{className:"h-4 w-4 text-amber-500"}),o.jsx(el,{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(Z,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[o.jsx(qd,{className:"w-4 h-4 mr-2"}),"Change Connection"]}),l==="ui"&&o.jsxs(Z,{variant:"outline",onClick:c,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(zo,{className:"w-4 h-4 mr-2"}),"Clear Config"]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(pa,{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(Xx,{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(Z,{onClick:()=>a(!0),children:[o.jsx(Vi,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx(Vv,{open:s,onComplete:()=>a(!1),canClose:!0})]})}function b2({length:s=6,value:a,onChange:r,onComplete:l,disabled:c=!1,error:d=!1}){const h=x.useRef([]),[m,y]=x.useState(null),p=(_,S)=>{const E=S.replace(/[^0-9]/g,"");if(E.length===0){const D=a.split("");D[_]=" ",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 j=[...a];j[_]=E[0],r(j.join("")),_<s-1&&h.current[_+1]?.focus();const O=j.join("");O.length===s&&l&&l(O)},g=(_,S)=>{S.key==="Backspace"&&!a[_]&&_>0||S.key==="ArrowLeft"&&_>0?h.current[_-1]?.focus():S.key==="ArrowRight"&&_<s-1&&h.current[_+1]?.focus()},w=_=>{_.preventDefault();const E=_.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,s);r(E);const j=Math.min(E.length,s-1);h.current[j]?.focus(),E.length===s&&l&&l(E)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:s}).map((_,S)=>o.jsx(Se,{ref:E=>{h.current[S]=E},type:"text",inputMode:"numeric",maxLength:1,value:a[S]||"",onChange:E=>p(S,E.target.value),onKeyDown:E=>g(S,E),onPaste:w,onFocus:()=>y(S),onBlur:()=>y(null),disabled:c,className:Oe("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 x2({onSuccess:s,onConfigure:a}){const[r,l]=x.useState(""),[c,d]=x.useState(""),[h,m]=x.useState(""),[y,p]=x.useState(""),[g,w]=x.useState(!1),[_,S]=x.useState(!0),[E,j]=x.useState(!1),[O,D]=x.useState(""),[q,B]=x.useState("password"),[G,W]=x.useState("email"),[J,P]=x.useState("");x.useEffect(()=>{Q()},[]);const Q=async()=>{try{const{data:ve,error:pe}=await ct.from("init_state").select("is_initialized");if(pe){console.warn("[Login] Init check failed, defaulting to initialized (Login):",pe),j(!0);return}const Ze=ve?.[0]?.is_initialized>0;j(Ze)}catch(ve){if(console.warn("[Login] Init check exception, defaulting to initialized:",ve),ve.message?.includes("Invalid API key")||ve.status===401){console.warn("[Login] API Key invalid for REST check (likely Publishable Key). defaulting to Setup Mode (isInitialized=false)."),j(!1);return}j(!0)}finally{S(!1)}},ce=async ve=>{ve.preventDefault(),w(!0),D("");try{if(E){if(q==="password"){const{error:pe}=await ct.auth.signInWithPassword({email:r,password:c});if(pe)throw pe;te.success("Logged in successfully"),s?.()}else if(G==="email"){const{error:pe}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(pe)throw pe;W("verify"),te.success("Validation code sent to your email")}}else{const{data:pe,error:Ze}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:y}});if(Ze||!pe){if(Ze?.message?.includes("First user already exists")){te.info("System already initialized. Please log in."),j(!0);return}throw new Error(Ze?.message||"Failed to create admin account")}te.success("Admin account created! Signing you in...");const{error:st}=await ct.auth.signInWithPassword({email:r,password:c});if(st)throw st;j(!0),s?.()}}catch(pe){D(pe?.message||"Authentication failed"),console.error("[Login] Error:",pe)}finally{w(!1)}},Je=async()=>{w(!0),D("");try{const{data:ve,error:pe}=await ct.auth.verifyOtp({email:r,token:J,type:"magiclink"});if(pe)throw pe;if(!ve.session)throw new Error("Failed to create session");te.success("Logged in successfully"),s?.()}catch(ve){D(ve?.message||"Invalid code")}finally{w(!1)}};return _?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx($t,{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(By,{})}),o.jsxs(At,{className:"w-full max-w-md shadow-2xl",children:[o.jsxs(Ta,{className:"text-center",children:[o.jsx("div",{className:"mx-auto bg-primary/10 p-4 rounded-full w-fit mb-4",children:o.jsx(vf,{className:"w-12 h-12"})}),o.jsx(Aa,{className:"text-2xl",children:E?"Welcome Back":"Welcome to Email Automator"}),o.jsx(ts,{children:E?q==="password"?"Sign in to access your email automation":G==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:ce,children:[o.jsxs(Ca,{className:"space-y-4",children:[!E&&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(Se,{value:h,onChange:ve=>m(ve.target.value),required:!E,placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Last Name"}),o.jsx(Se,{value:y,onChange:ve=>p(ve.target.value),required:!E,placeholder:"Doe"})]})]}),q==="password"||G==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Se,{type:"email",placeholder:"admin@example.com",value:r,onChange:ve=>l(ve.target.value),required:!0,autoComplete:"email",disabled:G==="verify"})]}):null,q==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Se,{type:"password",placeholder:"••••••••",value:c,onChange:ve=>d(ve.target.value),required:!0,minLength:6,autoComplete:E?"current-password":"new-password"})]}),q==="otp"&&G==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(b2,{value:J,onChange:P,length:6,onComplete:()=>{}})}),o.jsx(Z,{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:O}),O.includes("configuration")||O.includes("Invalid API key")||O.includes("API key")&&a&&o.jsx(Z,{type:"button",variant:"outline",className:"w-full border-destructive/50 hover:bg-destructive/20 text-destructive",onClick:a,children:"Update Connection Settings"})]})]}),o.jsxs(uv,{className:"flex flex-col gap-3",children:[q==="otp"&&G==="verify"?o.jsx(Z,{type:"button",onClick:Je,disabled:g||J.length!==6,className:"w-full",children:g?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify Code"}):o.jsx(Z,{type:"submit",disabled:g||!r||q==="password"&&!c,className:"w-full",children:g?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),E?q==="otp"?"Send Code":"Signing in...":"Creating Account..."]}):o.jsxs(o.Fragment,{children:[E?q==="otp"?o.jsx(Bd,{className:"w-4 h-4 mr-2"}):o.jsx(vw,{className:"w-4 h-4 mr-2"}):o.jsx(Fw,{className:"w-4 h-4 mr-2"}),E?q==="otp"?"Send Login Code":"Sign In":"Create Admin Account"]})}),E&&o.jsx("div",{className:"flex flex-col gap-2 w-full",children:q==="password"?o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("otp"),W("email"),D("")},children:[o.jsx(dw,{className:"w-4 h-4 mr-2"}),"Sign in with Code"]}):o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("password"),D("")},children:[o.jsx(Nx,{className:"w-4 h-4 mr-2"}),"Sign in with Password"]})}),E&&o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"New users must be invited by an admin."})]})]})]})]})}const Iv=void 0,w2=void 0;function _2(s,a){const r=s.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 S2(s){try{const{data:a,error:r}=await s.rpc("get_latest_migration_timestamp");return r?(console.warn("Could not get latest migration timestamp:",r.message),{version:null,latestMigrationTimestamp:null}):{version:Iv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function j2(s){const a=Iv,r=w2,l=await S2(s);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=_2(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 Gv="email_automator_migration_reminder_dismissed_at";function N2(s=24){try{const a=localStorage.getItem(Gv);if(!a)return!1;const r=new Date(a).getTime();return(Date.now()-r)/(1e3*60*60)<s}catch(a){return console.error("Error checking migration reminder:",a),!1}}function E2(){try{localStorage.setItem(Gv,new Date().toISOString())}catch(s){console.error("Error dismissing migration reminder:",s)}}function T2({status:s,onDismiss:a,onLearnMore:r}){const[l,c]=x.useState(!0);if(!l)return null;const d=()=>{E2(),c(!1),a?.()},h=()=>{r?r():(navigator.clipboard.writeText("npx email-automator migrate"),te.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(Rr,{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(Z,{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(tl,{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 (",s.appVersion,") requires a database schema update."]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Z,{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(Z,{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 Oo({code:s,label:a}){const[r,l]=x.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){te.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(s),l(!0),window.setTimeout(()=>l(!1),2e3),te.success("Copied to clipboard")}catch(h){console.error("Failed to copy:",h),te.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:s})}),o.jsxs(Z,{type:"button",size:"icon",variant:"ghost",className:"absolute right-2 top-2 h-8 w-8",onClick:d,disabled:!c,children:[r?o.jsx(ja,{className:"h-4 w-4 text-green-600"}):o.jsx(Wx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function A2({open:s,onOpenChange:a,status:r}){const l=Lr(),[c,d]=x.useState(!0),[h,m]=x.useState(!1),[y,p]=x.useState([]),[g,w]=x.useState(""),[_,S]=x.useState(""),E=x.useRef(null),j=x.useMemo(()=>{const D=l?.url;if(!D)return"";try{return new URL(D).hostname.split(".")[0]||""}catch{return""}},[l?.url]);x.useEffect(()=>{E.current&&E.current.scrollIntoView({behavior:"smooth"})},[y]);const O=async()=>{if(!j){te.error("Missing Project ID");return}m(!0),p(["Initializing migration..."]);try{const D=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:j,dbPassword:g,accessToken:_})});if(!D.ok)throw new Error(`Server returned ${D.status}: ${D.statusText}`);const q=D.body?.getReader();if(!q)throw new Error("No response stream received.");const B=new TextDecoder;for(;;){const{done:G,value:W}=await q.read();if(G)break;const P=B.decode(W).split(`
|
|
96
|
+
`).filter(Boolean);p(Q=>[...Q,...P])}}catch(D){console.error(D),p(q=>[...q,`Error: ${D instanceof Error?D.message:String(D)}`]),te.error("Migration failed. Check logs for details.")}finally{m(!1)}};return o.jsx(gn,{open:s,onOpenChange:D=>!h&&a(D),children:o.jsxs(yn,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[o.jsxs(ka,{children:[o.jsxs(Oa,{className:"flex items-center gap-2 text-xl",children:[o.jsx(Rr,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Migration Required"]}),o.jsxs(Ra,{children:["Your application version (",r.appVersion,") requires a database schema update to function correctly."]})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs(Wi,{children:[o.jsx(Or,{className:"h-4 w-4"}),o.jsxs(el,{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(pa,{htmlFor:"project-id",children:"Supabase Project ID"}),o.jsx(Se,{id:"project-id",value:j,disabled:!0,readOnly:!0,className:"bg-muted"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(pa,{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(Ii,{className:"h-3 w-3"})]})]}),o.jsx(Se,{id:"access-token",type:"password",placeholder:"sbp_...",value:_,onChange:D=>S(D.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(pa,{htmlFor:"db-password",children:"Database Password"}),o.jsx(Se,{id:"db-password",type:"password",placeholder:"Your database password",value:g,onChange:D=>w(D.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Required if no access token is provided."})]}),o.jsx(Z,{onClick:O,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Hd,{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:[y.length===0?o.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):y.map((D,q)=>o.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:D},q)),o.jsx("div",{ref:E})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"1"}),"Prerequisites"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"You will need the following before proceeding:"}),o.jsxs("ul",{className:"list-inside list-disc space-y-1 text-sm",children:[o.jsx("li",{children:"Supabase CLI installed"}),o.jsxs("li",{children:["Project ID:"," ",o.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:j||"your-project-id"})]}),o.jsx("li",{children:"Database Password"})]})]})]}),o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"2"}),"Install Supabase CLI"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"MacOS (Brew)"}),o.jsx(Oo,{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(Oo,{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(Oo,{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(Oo,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Wi,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(Rr,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(el,{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(Er,{children:o.jsx(Z,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function C2(){const[s,a]=x.useState([]),{isExpanded:r,setIsExpanded:l}=cv(),[c,d]=x.useState({});x.useEffect(()=>{h();const g=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},w=>{const _=w.new;_.event_type==="error"&&d(S=>({...S,[_.id]:!0})),a(S=>{const E=[_,...S];return E.length>100?E.slice(0,100):E})}).subscribe();return()=>{ct.removeChannel(g)}},[]);const h=async()=>{const{data:g}=await ct.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);g&&a(g)},m=g=>{d(w=>({...w,[g]:!w[g]}))},y=g=>{if(g.details?.is_completion)return o.jsx(Hi,{className:"w-3 h-3 text-emerald-500"});switch(g.event_type){case"analysis":return o.jsx($i,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Uo,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(Rr,{className:"w-3 h-3 text-red-500"});default:return o.jsx(Or,{className:"w-3 h-3 text-blue-500"})}},p=g=>new Date(g).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return r?o.jsxs(At,{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(Ta,{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(Hd,{className:"w-4 h-4 text-primary"}),o.jsx(Aa,{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(bx,{className:"w-3 h-3"}),"LIVE"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:"Clear"}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:o.jsx(Sw,{className:"w-4 h-4"})})]})]}),o.jsxs(Ca,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[s.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:"Waiting for agent activity..."}),s.map((g,w)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[w!==s.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:Oe("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",g.event_type==="error"&&"border-red-500/50 bg-red-500/5",g.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",g.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5",g.details?.is_completion&&"border-emerald-500/50 bg-emerald-500/5"),children:y(g)}),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:Oe("font-bold uppercase tracking-tight text-[10px]",g.event_type==="info"&&"text-muted-foreground",g.event_type==="analysis"&&"text-purple-600 dark:text-purple-400",g.event_type==="action"&&"text-emerald-600 dark:text-emerald-400",g.event_type==="error"&&"text-red-600 dark:text-red-400"),children:g.agent_state}),o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:p(g.created_at)})]}),(g.details?.system_prompt||g.details?._raw_response||g.details?.raw_response)&&o.jsxs(Z,{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(g.id),children:[c[g.id]?o.jsx(Vx,{className:"w-3 h-3 mr-1"}):o.jsx(Ux,{className:"w-3 h-3 mr-1"}),"Details"]})]}),g.event_type==="analysis"&&g.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:Oe("px-1.5 py-0.5 rounded text-[9px] font-bold border",g.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:g.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:g.details.category})]}),o.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',g.details.summary,'"']}),g.details.suggested_actions&&g.details.suggested_actions.length>0&&o.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:g.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(Uo,{className:"w-2.5 h-2.5"}),_]},_))}),g.details.usage&&o.jsx("div",{className:"pt-1.5 flex items-center gap-3 text-[9px] text-muted-foreground/70 border-t border-purple-500/10 mt-1",children:o.jsxs("span",{children:["Tokens: ",g.details.usage.prompt_tokens," (in) + ",g.details.usage.completion_tokens," (out) = ",o.jsx("span",{className:"text-purple-500 font-bold",children:g.details.usage.total_tokens})]})})]}):g.event_type==="action"&&g.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:[g.details.action==="delete"&&"Moved to Trash",g.details.action==="archive"&&"Archived Email",g.details.action==="draft"&&"Drafted Reply",g.details.action==="read"&&"Marked as Read",g.details.action==="star"&&"Starred Email",!["delete","archive","draft","read","star"].includes(g.details.action)&&g.details.action]}),g.details.reason&&o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[o.jsx(Or,{className:"w-3 h-3"}),g.details.reason]})]}):g.event_type==="error"&&g.details?o.jsx("div",{className:"bg-red-500/5 border border-red-500/10 rounded-lg p-2.5 text-red-600 dark:text-red-400 font-medium",children:typeof g.details.error=="object"?g.details.error.message||JSON.stringify(g.details.error):g.details.error}):g.details?.is_completion?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 dark:text-emerald-400 font-bold uppercase text-[9px] tracking-[0.2em]",children:[o.jsx(Hi,{className:"w-3.5 h-3.5"}),"Batch Sync Finished"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-1",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Processed"}),o.jsx("p",{className:"text-sm font-bold",children:g.details.total_processed||0})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Actions"}),o.jsx("p",{className:"text-sm font-bold text-emerald-500",children:(g.details.deleted||0)+(g.details.drafted||0)})]})]}),g.details.errors>0&&o.jsxs("p",{className:"text-[10px] text-red-500 font-bold pt-1 border-t border-emerald-500/10",children:["⚠️ ",g.details.errors," items failed to process."]})]}):o.jsx("p",{className:"text-muted-foreground leading-relaxed",children:g.details?.message||JSON.stringify(g.details)}),c[g.id]&&o.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[g.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(Us,{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:g.details.system_prompt})})]}),g.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(Us,{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:g.details.content_preview})})]}),g.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(Us,{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(g.details._raw_response),null,2)})})]}),g.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(Us,{className:"w-3 h-3"})," Raw Response (from Error)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all whitespace-pre-wrap",children:typeof g.details.raw_response=="object"?JSON.stringify(g.details.raw_response,null,2):g.details.raw_response})})]})]})]})]},g.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(Z,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx(Hd,{className:"w-4 h-4 mr-2"}),"Live Activity",s.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 k2(){const{state:s,isSubscribed:a,actions:r}=Br(),[l,c]=x.useState(!1),[d,h]=x.useState("dashboard"),[m,y]=x.useState(!0),[p,g]=x.useState(!1);if(x.useEffect(()=>{const J=()=>{if(Ea.isEnabled()){const P=new(window.AudioContext||window.webkitAudioContext);P.state==="suspended"&&P.resume()}window.removeEventListener("click",J),window.removeEventListener("keydown",J)};return window.addEventListener("click",J),window.addEventListener("keydown",J),()=>{window.removeEventListener("click",J),window.removeEventListener("keydown",J)}},[]),x.useEffect(()=>{const P=new URLSearchParams(window.location.search).get("code");P&&!p&&(async()=>{g(!0);try{const ce=await ze.connectGmail(P);if(ce.data?.success)te.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),r.fetchAccounts());else{const Je=typeof ce.error=="string"?ce.error:ce.error?.message;te.error(Je||"Failed to connect Gmail")}}catch{te.error("Connection failed")}finally{g(!1)}})()},[]),p)return o.jsx(qi,{text:"Connecting account..."});const[w,_]=x.useState(null),[S,E]=x.useState(!1),[j,O]=x.useState(!1),[D,q]=x.useState(!1);x.useEffect(()=>{(async()=>{const P=Lr();if(!P){c(!0),y(!1);return}if((await av(P.url,P.anonKey)).valid)s.isInitialized&&s.isAuthenticated&&(r.fetchAccounts(),r.fetchRules(),r.fetchSettings(),r.fetchProfile(),j2(ct).then(ce=>{_(ce),ce.needsMigration&&!N2()&&E(!0)}));else{c(!0),y(!1);return}y(!1)})()},[s.isInitialized,s.isAuthenticated]);const B=()=>{O(!0),E(!1)},G={migrationStatus:w,showMigrationBanner:S,showMigrationModal:j,openMigrationModal:B,suppressMigrationBanner:D,setSuppressMigrationBanner:q};if(m)return o.jsx(qi,{text:"Checking configuration..."});if(l)return o.jsx(Vv,{onComplete:()=>{c(!1),window.location.reload()}});if(!s.isInitialized)return o.jsx(qi,{text:"Initializing..."});if(!s.isAuthenticated)return o.jsx(x2,{onConfigure:()=>c(!0)});const W=async()=>{await ct.auth.signOut(),te.success("Logged out successfully")};return o.jsx(eN,{value:G,children:o.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[o.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{onClick:()=>h("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(vf,{className:"w-8 h-8"}),o.jsx("span",{className:"hidden sm:inline",children:"Email Automator"}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),o.jsxs("div",{className:Oe("flex items-center gap-1.5 px-2 h-6 rounded-full text-[10px] font-bold border transition-colors",a?"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 dark:text-emerald-400":"bg-yellow-500/10 text-yellow-600 border-yellow-500/20 dark:text-yellow-400"),children:[o.jsxs("div",{className:"relative flex items-center justify-center",children:[a&&o.jsx("span",{className:"absolute inline-flex h-3 w-3 rounded-full bg-emerald-500/40 animate-ping"}),o.jsx("div",{className:Oe("relative w-2 h-2 rounded-full",a?"bg-emerald-500":"bg-yellow-500")})]}),o.jsx("span",{className:"hidden xs:inline leading-none",children:a?"LIVE":"OFFLINE"})]})]}),o.jsxs("div",{className:"flex gap-4 items-center",children:[o.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[o.jsxs(Z,{variant:d==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>h("dashboard"),className:"gap-2",children:[o.jsx(pw,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),o.jsxs(Z,{variant:d==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>h("analytics"),className:"gap-2",children:[o.jsx(yy,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),o.jsxs(Z,{variant:d==="config"?"secondary":"ghost",size:"sm",onClick:()=>h("config"),className:"gap-2",children:[o.jsx(qd,{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(By,{}),o.jsx(Z,{variant:d==="account"?"secondary":"ghost",size:"sm",onClick:()=>h("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:"Account Settings",children:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(Yx,{className:"w-5 h-5"})}),o.jsx(Z,{variant:"ghost",size:"sm",onClick:W,className:"text-muted-foreground hover:text-foreground w-8 px-0",title:"Sign out",children:o.jsx(xw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4 mb-12",children:[d==="dashboard"&&o.jsx(l2,{}),d==="config"&&o.jsx(d2,{}),d==="analytics"&&o.jsx(R2,{}),d==="account"&&o.jsx(p2,{})]}),o.jsx("footer",{className:"max-w-7xl mx-auto px-4 sm:px-8 pb-8 text-center sm:text-left",children:o.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/40 uppercase tracking-[0.2em]",children:["Email Automator ",o.jsx("span",{className:"mx-1",children:"•"})," v","2.8.4"]})}),s.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:s.error})})}),w&&S&&!D&&o.jsx(T2,{status:w,onDismiss:()=>E(!1),onLearnMore:B}),w&&o.jsx(A2,{open:j,onOpenChange:O,status:w}),o.jsx(C2,{})]})})}function O2({runId:s,accountEmail:a,isOpen:r,onOpenChange:l}){const[c,d]=x.useState([]),[h,m]=x.useState(!1);x.useEffect(()=>{r&&s&&y()},[r,s]);const y=async()=>{if(s){m(!0);try{const g=await ze.getRunEvents(s);g.data&&d(g.data.events)}catch(g){console.error("Failed to fetch run trace:",g)}finally{m(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx($i,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Uo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Dr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Or,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(gn,{open:r,onOpenChange:l,children:o.jsxs(yn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(ka,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(of,{className:"w-5 h-5 text-primary"}),o.jsx(Oa,{children:"Sync Run Trace"})]}),o.jsx(Ra,{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(qi,{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((g,w)=>o.jsxs("div",{className:"relative pl-8",children:[w!==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:p(g.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:g.agent_state}),g.emails?.subject&&o.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",g.emails.subject]})]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(kr,{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-2",children:[o.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',g.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:g.details?.category}),g.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:_},_))]}),g.details?.usage&&o.jsxs("div",{className:"flex gap-3 pt-1.5 mt-1 border-t border-border/50 text-[9px] text-muted-foreground",children:[o.jsxs("span",{children:["In: ",o.jsx("b",{children:g.details.usage.prompt_tokens})]}),o.jsxs("span",{children:["Out: ",o.jsx("b",{children:g.details.usage.completion_tokens})]}),o.jsxs("span",{children:["Total: ",o.jsx("span",{className:"text-primary font-bold",children:g.details.usage.total_tokens})]})]})]}),g.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: ",g.details?.action]}),o.jsx(lf,{className:"w-4 h-4 text-emerald-500"})]}),g.event_type==="error"&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:g.details?.error})]})]})]},g.id))})]})})}function R2(){const{state:s,actions:a}=Br(),[r,l]=x.useState(null),[c,d]=x.useState(void 0),[h,m]=x.useState(!1);if(x.useEffect(()=>{a.fetchStats()},[]),!s.stats)return o.jsx(qi,{text:"Loading analytics..."});const y=(g,w)=>{l(g),d(w),m(!0)},{stats:p}=s;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(yy,{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(Ro,{title:"Total Emails",value:p.totalEmails,color:"primary"}),o.jsx(Ro,{title:"Spam Caught",value:p.categoryCounts.spam||0,color:"destructive"}),o.jsx(Ro,{title:"Actions Taken",value:Object.values(p.actionCounts).reduce((g,w)=>g+w,0)-(p.actionCounts.none||0),color:"emerald"}),o.jsx(Ro,{title:"Accounts",value:p.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(p.categoryCounts).map(([g,w])=>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:g}),o.jsx("span",{className:"text-muted-foreground",children:w})]}),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:`${w/p.totalEmails*100}%`}})})]})},g))})]}),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(p.actionCounts).map(([g,w])=>o.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[o.jsx("span",{className:"capitalize",children:g}),o.jsx("span",{className:"font-medium",children:w})]},g))})]})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Recent Sync Activity"}),p.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:p.recentSyncs.map(g=>{const w=g.completed_at?Math.round((new Date(g.completed_at).getTime()-new Date(g.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:()=>y(g.id,g.email_accounts?.email_address),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:Oe("w-2.5 h-2.5 rounded-full",g.status==="success"?"bg-emerald-500":g.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:g.email_accounts?.email_address||"System Sync"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(kr,{className:"w-3 h-3"}),new Date(g.started_at).toLocaleString(),w!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[w,"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:[g.emails_processed," emails"]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[g.emails_deleted," deleted, ",g.emails_drafted," drafted"]})]})})]},g.id)})})]}),o.jsx(O2,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function Ro({title:s,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:s}),o.jsx("p",{className:`text-3xl font-bold ${l[r]||""}`,children:a})]})}function D2(){return o.jsx(l_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(aN,{children:o.jsx(tN,{children:o.jsxs(Fj,{children:[o.jsx(k2,{}),o.jsx(Qj,{})]})})})})}fx.createRoot(document.getElementById("root")).render(o.jsx(my.StrictMode,{children:o.jsx(D2,{})}));
|