@realtimex/email-automator 2.4.5 → 2.6.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,97 +0,0 @@
1
- function tx(n,a){for(var r=0;r<a.length;r++){const l=a[r];if(typeof l!="string"&&!Array.isArray(l)){for(const c in l)if(c!=="default"&&!(c in n)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(n,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();function Fd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ld={exports:{}},xi={};var og;function ax(){if(og)return xi;og=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(l,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:n,type:l,key:h,ref:c!==void 0?c:null,props:d}}return xi.Fragment=a,xi.jsx=r,xi.jsxs=r,xi}var cg;function nx(){return cg||(cg=1,ld.exports=ax()),ld.exports}var o=nx(),od={exports:{}},be={};var ug;function sx(){if(ug)return be;ug=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),_=Symbol.iterator;function S(N){return N===null||typeof N!="object"?null:(N=_&&N[_]||N["@@iterator"],typeof N=="function"?N:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,k={};function O(N,H,Y){this.props=N,this.context=H,this.refs=k,this.updater=Y||A}O.prototype.isReactComponent={},O.prototype.setState=function(N,H){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,H,"setState")},O.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function q(){}q.prototype=O.prototype;function B(N,H,Y){this.props=N,this.context=H,this.refs=k,this.updater=Y||A}var G=B.prototype=new q;G.constructor=B,E(G,O.prototype),G.isPureReactComponent=!0;var ee=Array.isArray;function Q(){}var P={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function he(N,H,Y){var F=Y.ref;return{$$typeof:n,type:N,key:H,ref:F!==void 0?F:null,props:Y}}function Ge(N,H){return he(N.type,H,N.props)}function xe(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function ye(N){var H={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(Y){return H[Y]})}var Ze=/\/+/g;function nt(N,H){return typeof N=="object"&&N!==null&&N.key!=null?ye(""+N.key):H.toString(36)}function Ve(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(Q,Q):(N.status="pending",N.then(function(H){N.status==="pending"&&(N.status="fulfilled",N.value=H)},function(H){N.status==="pending"&&(N.status="rejected",N.reason=H)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function L(N,H,Y,F,ue){var ve=typeof N;(ve==="undefined"||ve==="boolean")&&(N=null);var de=!1;if(N===null)de=!0;else switch(ve){case"bigint":case"string":case"number":de=!0;break;case"object":switch(N.$$typeof){case n:case a:de=!0;break;case v:return de=N._init,L(de(N._payload),H,Y,F,ue)}}if(de)return ue=ue(N),de=F===""?"."+nt(N,0):F,ee(ue)?(Y="",de!=null&&(Y=de.replace(Ze,"$&/")+"/"),L(ue,H,Y,"",function(Tt){return Tt})):ue!=null&&(xe(ue)&&(ue=Ge(ue,Y+(ue.key==null||N&&N.key===ue.key?"":(""+ue.key).replace(Ze,"$&/")+"/")+de)),H.push(ue)),1;de=0;var Pe=F===""?".":F+":";if(ee(N))for(var Le=0;Le<N.length;Le++)F=N[Le],ve=Pe+nt(F,Le),de+=L(F,H,Y,ve,ue);else if(Le=S(N),typeof Le=="function")for(N=Le.call(N),Le=0;!(F=N.next()).done;)F=F.value,ve=Pe+nt(F,Le++),de+=L(F,H,Y,ve,ue);else if(ve==="object"){if(typeof N.then=="function")return L(Ve(N),H,Y,F,ue);throw H=String(N),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return de}function Z(N,H,Y){if(N==null)return N;var F=[],ue=0;return L(N,F,"","",function(ve){return H.call(Y,ve,ue++)}),F}function K(N){if(N._status===-1){var H=N._result;H=H(),H.then(function(Y){(N._status===0||N._status===-1)&&(N._status=1,N._result=Y)},function(Y){(N._status===0||N._status===-1)&&(N._status=2,N._result=Y)}),N._status===-1&&(N._status=0,N._result=H)}if(N._status===1)return N._result.default;throw N._result}var X=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},ge={map:Z,forEach:function(N,H,Y){Z(N,function(){H.apply(this,arguments)},Y)},count:function(N){var H=0;return Z(N,function(){H++}),H},toArray:function(N){return Z(N,function(H){return H})||[]},only:function(N){if(!xe(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return be.Activity=x,be.Children=ge,be.Component=O,be.Fragment=r,be.Profiler=c,be.PureComponent=B,be.StrictMode=l,be.Suspense=g,be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,be.__COMPILER_RUNTIME={__proto__:null,c:function(N){return P.H.useMemoCache(N)}},be.cache=function(N){return function(){return N.apply(null,arguments)}},be.cacheSignal=function(){return null},be.cloneElement=function(N,H,Y){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var F=E({},N.props),ue=N.key;if(H!=null)for(ve in H.key!==void 0&&(ue=""+H.key),H)!J.call(H,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&H.ref===void 0||(F[ve]=H[ve]);var ve=arguments.length-2;if(ve===1)F.children=Y;else if(1<ve){for(var de=Array(ve),Pe=0;Pe<ve;Pe++)de[Pe]=arguments[Pe+2];F.children=de}return he(N.type,ue,F)},be.createContext=function(N){return N={$$typeof:h,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:d,_context:N},N},be.createElement=function(N,H,Y){var F,ue={},ve=null;if(H!=null)for(F in H.key!==void 0&&(ve=""+H.key),H)J.call(H,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(ue[F]=H[F]);var de=arguments.length-2;if(de===1)ue.children=Y;else if(1<de){for(var Pe=Array(de),Le=0;Le<de;Le++)Pe[Le]=arguments[Le+2];ue.children=Pe}if(N&&N.defaultProps)for(F in de=N.defaultProps,de)ue[F]===void 0&&(ue[F]=de[F]);return he(N,ve,ue)},be.createRef=function(){return{current:null}},be.forwardRef=function(N){return{$$typeof:m,render:N}},be.isValidElement=xe,be.lazy=function(N){return{$$typeof:v,_payload:{_status:-1,_result:N},_init:K}},be.memo=function(N,H){return{$$typeof:p,type:N,compare:H===void 0?null:H}},be.startTransition=function(N){var H=P.T,Y={};P.T=Y;try{var F=N(),ue=P.S;ue!==null&&ue(Y,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(Q,X)}catch(ve){X(ve)}finally{H!==null&&Y.types!==null&&(H.types=Y.types),P.T=H}},be.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},be.use=function(N){return P.H.use(N)},be.useActionState=function(N,H,Y){return P.H.useActionState(N,H,Y)},be.useCallback=function(N,H){return P.H.useCallback(N,H)},be.useContext=function(N){return P.H.useContext(N)},be.useDebugValue=function(){},be.useDeferredValue=function(N,H){return P.H.useDeferredValue(N,H)},be.useEffect=function(N,H){return P.H.useEffect(N,H)},be.useEffectEvent=function(N){return P.H.useEffectEvent(N)},be.useId=function(){return P.H.useId()},be.useImperativeHandle=function(N,H,Y){return P.H.useImperativeHandle(N,H,Y)},be.useInsertionEffect=function(N,H){return P.H.useInsertionEffect(N,H)},be.useLayoutEffect=function(N,H){return P.H.useLayoutEffect(N,H)},be.useMemo=function(N,H){return P.H.useMemo(N,H)},be.useOptimistic=function(N,H){return P.H.useOptimistic(N,H)},be.useReducer=function(N,H,Y){return P.H.useReducer(N,H,Y)},be.useRef=function(N){return P.H.useRef(N)},be.useState=function(N){return P.H.useState(N)},be.useSyncExternalStore=function(N,H,Y){return P.H.useSyncExternalStore(N,H,Y)},be.useTransition=function(){return P.H.useTransition()},be.version="19.2.3",be}var dg;function Wd(){return dg||(dg=1,od.exports=sx()),od.exports}var w=Wd();const hy=Fd(w),ef=tx({__proto__:null,default:hy},[w]);var cd={exports:{}},wi={},ud={exports:{}},dd={};var fg;function rx(){return fg||(fg=1,(function(n){function a(L,Z){var K=L.length;L.push(Z);e:for(;0<K;){var X=K-1>>>1,ge=L[X];if(0<c(ge,Z))L[X]=Z,L[K]=ge,K=X;else break e}}function r(L){return L.length===0?null:L[0]}function l(L){if(L.length===0)return null;var Z=L[0],K=L.pop();if(K!==Z){L[0]=K;e:for(var X=0,ge=L.length,N=ge>>>1;X<N;){var H=2*(X+1)-1,Y=L[H],F=H+1,ue=L[F];if(0>c(Y,K))F<ge&&0>c(ue,Y)?(L[X]=ue,L[F]=K,X=F):(L[X]=Y,L[H]=K,X=H);else if(F<ge&&0>c(ue,K))L[X]=ue,L[F]=K,X=F;else break e}}return Z}function c(L,Z){var K=L.sortIndex-Z.sortIndex;return K!==0?K:L.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var g=[],p=[],v=1,x=null,_=3,S=!1,A=!1,E=!1,k=!1,O=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function G(L){for(var Z=r(p);Z!==null;){if(Z.callback===null)l(p);else if(Z.startTime<=L)l(p),Z.sortIndex=Z.expirationTime,a(g,Z);else break;Z=r(p)}}function ee(L){if(E=!1,G(L),!A)if(r(g)!==null)A=!0,Q||(Q=!0,ye());else{var Z=r(p);Z!==null&&Ve(ee,Z.startTime-L)}}var Q=!1,P=-1,J=5,he=-1;function Ge(){return k?!0:!(n.unstable_now()-he<J)}function xe(){if(k=!1,Q){var L=n.unstable_now();he=L;var Z=!0;try{e:{A=!1,E&&(E=!1,q(P),P=-1),S=!0;var K=_;try{t:{for(G(L),x=r(g);x!==null&&!(x.expirationTime>L&&Ge());){var X=x.callback;if(typeof X=="function"){x.callback=null,_=x.priorityLevel;var ge=X(x.expirationTime<=L);if(L=n.unstable_now(),typeof ge=="function"){x.callback=ge,G(L),Z=!0;break t}x===r(g)&&l(g),G(L)}else l(g);x=r(g)}if(x!==null)Z=!0;else{var N=r(p);N!==null&&Ve(ee,N.startTime-L),Z=!1}}break e}finally{x=null,_=K,S=!1}Z=void 0}}finally{Z?ye():Q=!1}}}var ye;if(typeof B=="function")ye=function(){B(xe)};else if(typeof MessageChannel<"u"){var Ze=new MessageChannel,nt=Ze.port2;Ze.port1.onmessage=xe,ye=function(){nt.postMessage(null)}}else ye=function(){O(xe,0)};function Ve(L,Z){P=O(function(){L(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(L){L.callback=null},n.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<L?Math.floor(1e3/L):5},n.unstable_getCurrentPriorityLevel=function(){return _},n.unstable_next=function(L){switch(_){case 1:case 2:case 3:var Z=3;break;default:Z=_}var K=_;_=Z;try{return L()}finally{_=K}},n.unstable_requestPaint=function(){k=!0},n.unstable_runWithPriority=function(L,Z){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var K=_;_=L;try{return Z()}finally{_=K}},n.unstable_scheduleCallback=function(L,Z,K){var X=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?X+K:X):K=X,L){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=K+ge,L={id:v++,callback:Z,priorityLevel:L,startTime:K,expirationTime:ge,sortIndex:-1},K>X?(L.sortIndex=K,a(p,L),r(g)===null&&L===r(p)&&(E?(q(P),P=-1):E=!0,Ve(ee,K-X))):(L.sortIndex=ge,a(g,L),A||S||(A=!0,Q||(Q=!0,ye()))),L},n.unstable_shouldYield=Ge,n.unstable_wrapCallback=function(L){var Z=_;return function(){var K=_;_=Z;try{return L.apply(this,arguments)}finally{_=K}}}})(dd)),dd}var hg;function ix(){return hg||(hg=1,ud.exports=rx()),ud.exports}var fd={exports:{}},At={};var mg;function lx(){if(mg)return At;mg=1;var n=Wd();function a(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+g+"; 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(g,p,v){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:x==null?null:""+x,children:g,containerInfo:p,implementation:v}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return At.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,At.createPortal=function(g,p){var v=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(g,p,null,v)},At.flushSync=function(g){var p=h.T,v=l.p;try{if(h.T=null,l.p=2,g)return g()}finally{h.T=p,l.p=v,l.d.f()}},At.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(g,p))},At.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},At.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var v=p.as,x=m(v,p.crossOrigin),_=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?l.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:_,fetchPriority:S}):v==="script"&&l.d.X(g,{crossOrigin:x,integrity:_,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},At.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=m(p.as,p.crossOrigin);l.d.M(g,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(g)},At.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,x=m(v,p.crossOrigin);l.d.L(g,v,{crossOrigin:x,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})}},At.preloadModule=function(g,p){if(typeof g=="string")if(p){var v=m(p.as,p.crossOrigin);l.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(g)},At.requestFormReset=function(g){l.d.r(g)},At.unstable_batchedUpdates=function(g,p){return g(p)},At.useFormState=function(g,p,v){return h.H.useFormState(g,p,v)},At.useFormStatus=function(){return h.H.useHostTransitionStatus()},At.version="19.2.3",At}var pg;function my(){if(pg)return fd.exports;pg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),fd.exports=lx(),fd.exports}var gg;function ox(){if(gg)return wi;gg=1;var n=ix(),a=Wd(),r=my();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(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 s=e,i=t;;){var u=s.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){s=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===s)return g(u),e;if(f===i)return g(u),t;f=f.sibling}throw Error(l(188))}if(s.return!==i.return)s=u,i=f;else{for(var y=!1,b=u.child;b;){if(b===s){y=!0,s=u,i=f;break}if(b===i){y=!0,i=u,s=f;break}b=b.sibling}if(!y){for(b=f.child;b;){if(b===s){y=!0,s=f,i=u;break}if(b===i){y=!0,i=f,s=u;break}b=b.sibling}if(!y)throw Error(l(189))}}if(s.alternate!==i)throw Error(l(190))}if(s.tag!==3)throw Error(l(188));return s.stateNode.current===s?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),B=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),Ge=Symbol.for("react.memo_cache_sentinel"),xe=Symbol.iterator;function ye(e){return e===null||typeof e!="object"?null:(e=xe&&e[xe]||e["@@iterator"],typeof e=="function"?e:null)}var Ze=Symbol.for("react.client.reference");function nt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ze?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case O:return"Profiler";case k:return"StrictMode";case ee:return"Suspense";case Q:return"SuspenseList";case he:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case B:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return t=e.displayName||null,t!==null?t:nt(e.type)||"Memo";case J:t=e._payload,e=e._init;try{return nt(e(t))}catch{}}return null}var Ve=Array.isArray,L=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},X=[],ge=-1;function N(e){return{current:e}}function H(e){0>ge||(e.current=X[ge],X[ge]=null,ge--)}function Y(e,t){ge++,X[ge]=e.current,e.current=t}var F=N(null),ue=N(null),ve=N(null),de=N(null);function Pe(e,t){switch(Y(ve,t),Y(ue,e),Y(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Op(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Op(t),e=Rp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}H(F),Y(F,e)}function Le(){H(F),H(ue),H(ve)}function Tt(e){e.memoizedState!==null&&Y(de,e);var t=F.current,s=Rp(t,e.type);t!==s&&(Y(ue,e),Y(F,s))}function vt(e){ue.current===e&&(H(F),H(ue)),de.current===e&&(H(de),gi._currentValue=K)}var bt,os;function ia(e){if(bt===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);bt=t&&t[1]||"",os=-1<s.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+bt+e+os}var cs=!1;function us(e,t){if(!e||cs)return"";cs=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(U){var M=U}Reflect.construct(e,[],I)}else{try{I.call()}catch(U){M=U}e.call(I.prototype)}}else{try{throw Error()}catch(U){M=U}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(U){if(U&&M&&typeof U.stack=="string")return[U.stack,M.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=i.DetermineComponentFrameRoot(),y=f[0],b=f[1];if(y&&b){var j=y.split(`
4
- `),D=b.split(`
5
- `);for(u=i=0;i<j.length&&!j[i].includes("DetermineComponentFrameRoot");)i++;for(;u<D.length&&!D[u].includes("DetermineComponentFrameRoot");)u++;if(i===j.length||u===D.length)for(i=j.length-1,u=D.length-1;1<=i&&0<=u&&j[i]!==D[u];)u--;for(;1<=i&&0<=u;i--,u--)if(j[i]!==D[u]){if(i!==1||u!==1)do if(i--,u--,0>u||j[i]!==D[u]){var $=`
6
- `+j[i].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=i&&0<=u);break}}}finally{cs=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?ia(s):""}function Vi(e,t){switch(e.tag){case 26:case 27:case 5:return ia(e.type);case 16:return ia("Lazy");case 13:return e.child!==t&&t!==null?ia("Suspense Fallback"):ia("Suspense");case 19:return ia("SuspenseList");case 0:case 15:return us(e.type,!1);case 11:return us(e.type.render,!1);case 1:return us(e.type,!0);case 31:return ia("Activity");default:return""}}function Cr(e){try{var t="",s=null;do t+=Vi(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
7
- Error generating stack: `+i.message+`
8
- `+i.stack}}var Rn=Object.prototype.hasOwnProperty,en=n.unstable_scheduleCallback,ds=n.unstable_cancelCallback,Ii=n.unstable_shouldYield,Gi=n.unstable_requestPaint,mt=n.unstable_now,fs=n.unstable_getCurrentPriorityLevel,Pi=n.unstable_ImmediatePriority,Ki=n.unstable_UserBlockingPriority,hs=n.unstable_NormalPriority,Po=n.unstable_LowPriority,Yi=n.unstable_IdlePriority,Ko=n.log,Yo=n.unstable_setDisableYieldValue,Dn=null,Ct=null;function pa(e){if(typeof Ko=="function"&&Yo(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Dn,e)}catch{}}var kt=Math.clz32?Math.clz32:Xo,Jo=Math.log,Ji=Math.LN2;function Xo(e){return e>>>=0,e===0?32:31-(Jo(e)/Ji|0)|0}var ms=256,ps=262144,gs=4194304;function Aa(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function z(e,t,s){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~f,i!==0?u=Aa(i):(y&=b,y!==0?u=Aa(y):s||(s=b&~e,s!==0&&(u=Aa(s))))):(b=i&~f,b!==0?u=Aa(b):y!==0?u=Aa(y):s||(s=i&~e,s!==0&&(u=Aa(s)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,s=t&-t,f>=s||f===32&&(s&4194048)!==0)?t:u}function se(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function De(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ga(){var e=gs;return gs<<=1,(gs&62914560)===0&&(gs=4194304),e}function kr(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function tn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ys(e,t,s,i,u,f){var y=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var b=e.entanglements,j=e.expirationTimes,D=e.hiddenUpdates;for(s=y&~s;0<s;){var $=31-kt(s),I=1<<$;b[$]=0,j[$]=-1;var M=D[$];if(M!==null)for(D[$]=null,$=0;$<M.length;$++){var U=M[$];U!==null&&(U.lane&=-536870913)}s&=~I}i!==0&&Xi(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function Xi(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-kt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|s&261930}function Qi(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-kt(s),u=1<<i;u&t|e[i]&t&&(e[i]|=t),s&=~u}}function pf(e,t){var s=t&-t;return s=(s&42)!==0?1:Qo(s),(s&(e.suspendedLanes|t))!==0?0:s}function Qo(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Zo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function gf(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:tg(e.type))}function yf(e,t){var s=Z.p;try{return Z.p=e,t()}finally{Z.p=s}}var an=Math.random().toString(36).slice(2),xt="__reactFiber$"+an,Rt="__reactProps$"+an,vs="__reactContainer$"+an,Fo="__reactEvents$"+an,Gv="__reactListeners$"+an,Pv="__reactHandles$"+an,vf="__reactResources$"+an,Or="__reactMarker$"+an;function Wo(e){delete e[xt],delete e[Rt],delete e[Fo],delete e[Gv],delete e[Pv]}function bs(e){var t=e[xt];if(t)return t;for(var s=e.parentNode;s;){if(t=s[vs]||s[xt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=qp(e);e!==null;){if(s=e[xt])return s;e=qp(e)}return t}e=s,s=e.parentNode}return null}function xs(e){if(e=e[xt]||e[vs]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Rr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function ws(e){var t=e[vf];return t||(t=e[vf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pt(e){e[Or]=!0}var bf=new Set,xf={};function Mn(e,t){_s(e,t),_s(e+"Capture",t)}function _s(e,t){for(xf[e]=t,e=0;e<t.length;e++)bf.add(t[e])}var Kv=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),wf={},_f={};function Yv(e){return Rn.call(_f,e)?!0:Rn.call(wf,e)?!1:Kv.test(e)?_f[e]=!0:(wf[e]=!0,!1)}function Zi(e,t,s){if(Yv(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+s)}}function Fi(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+s)}}function Ca(e,t,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,""+i)}}function Qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Sf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Jv(e,t,s){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(y){s=""+y,f.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(y){s=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ec(e){if(!e._valueTracker){var t=Sf(e)?"checked":"value";e._valueTracker=Jv(e,t,""+e[t])}}function jf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=Sf(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}function Wi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Xv=/[\n"\\]/g;function Zt(e){return e.replace(Xv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function tc(e,t,s,i,u,f,y,b){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Qt(t)):e.value!==""+Qt(t)&&(e.value=""+Qt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?ac(e,y,Qt(t)):s!=null?ac(e,y,Qt(s)):i!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Qt(b):e.removeAttribute("name")}function Ef(e,t,s,i,u,f,y,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||s!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){ec(e);return}s=s!=null?""+Qt(s):"",t=t!=null?""+Qt(t):s,b||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=b?e.checked:!!i,e.defaultChecked=!!i,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),ec(e)}function ac(e,t,s){t==="number"&&Wi(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function Ss(e,t,s,i){if(e=e.options,t){t={};for(var u=0;u<s.length;u++)t["$"+s[u]]=!0;for(s=0;s<e.length;s++)u=t.hasOwnProperty("$"+e[s].value),e[s].selected!==u&&(e[s].selected=u),u&&i&&(e[s].defaultSelected=!0)}else{for(s=""+Qt(s),t=null,u=0;u<e.length;u++){if(e[u].value===s){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Nf(e,t,s){if(t!=null&&(t=""+Qt(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Qt(s):""}function Tf(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(l(92));if(Ve(i)){if(1<i.length)throw Error(l(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=Qt(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),ec(e)}function js(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Qv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Af(e,t,s){var i=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,s):typeof s!="number"||s===0||Qv.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Cf(e,t,s){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,s!=null){for(var i in s)!s.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&s[u]!==i&&Af(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&Af(e,f,t[f])}function nc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Zv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Fv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function el(e){return Fv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ka(){}var sc=null;function rc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Es=null,Ns=null;function kf(e){var t=xs(e);if(t&&(e=t.stateNode)){var s=e[Rt]||null;e:switch(e=t.stateNode,t.type){case"input":if(tc(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Zt(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var i=s[t];if(i!==e&&i.form===e.form){var u=i[Rt]||null;if(!u)throw Error(l(90));tc(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<s.length;t++)i=s[t],i.form===e.form&&jf(i)}break e;case"textarea":Nf(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&Ss(e,!!s.multiple,t,!1)}}}var ic=!1;function Of(e,t,s){if(ic)return e(t,s);ic=!0;try{var i=e(t);return i}finally{if(ic=!1,(Es!==null||Ns!==null)&&(Hl(),Es&&(t=Es,e=Ns,Ns=Es=null,kf(t),e)))for(t=0;t<e.length;t++)kf(e[t])}}function Dr(e,t){var s=e.stateNode;if(s===null)return null;var i=s[Rt]||null;if(i===null)return null;s=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(l(231,t,typeof s));return s}var Oa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lc=!1;if(Oa)try{var Mr={};Object.defineProperty(Mr,"passive",{get:function(){lc=!0}}),window.addEventListener("test",Mr,Mr),window.removeEventListener("test",Mr,Mr)}catch{lc=!1}var nn=null,oc=null,tl=null;function Rf(){if(tl)return tl;var e,t=oc,s=t.length,i,u="value"in nn?nn.value:nn.textContent,f=u.length;for(e=0;e<s&&t[e]===u[e];e++);var y=s-e;for(i=1;i<=y&&t[s-i]===u[f-i];i++);return tl=u.slice(e,1<i?1-i:void 0)}function al(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function nl(){return!0}function Df(){return!1}function Dt(e){function t(s,i,u,f,y){this._reactName=s,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(s=e[b],this[b]=s?s(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?nl:Df,this.isPropagationStopped=Df,this}return x(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=nl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=nl)},persist:function(){},isPersistent:nl}),t}var zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sl=Dt(zn),zr=x({},zn,{view:0,detail:0}),Wv=Dt(zr),cc,uc,Ur,rl=x({},zr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ur&&(Ur&&e.type==="mousemove"?(cc=e.screenX-Ur.screenX,uc=e.screenY-Ur.screenY):uc=cc=0,Ur=e),cc)},movementY:function(e){return"movementY"in e?e.movementY:uc}}),Mf=Dt(rl),e0=x({},rl,{dataTransfer:0}),t0=Dt(e0),a0=x({},zr,{relatedTarget:0}),dc=Dt(a0),n0=x({},zn,{animationName:0,elapsedTime:0,pseudoElement:0}),s0=Dt(n0),r0=x({},zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),i0=Dt(r0),l0=x({},zn,{data:0}),zf=Dt(l0),o0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},c0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},u0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function d0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=u0[e])?!!t[e]:!1}function fc(){return d0}var f0=x({},zr,{key:function(e){if(e.key){var t=o0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=al(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?c0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(e){return e.type==="keypress"?al(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?al(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),h0=Dt(f0),m0=x({},rl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Uf=Dt(m0),p0=x({},zr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),g0=Dt(p0),y0=x({},zn,{propertyName:0,elapsedTime:0,pseudoElement:0}),v0=Dt(y0),b0=x({},rl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),x0=Dt(b0),w0=x({},zn,{newState:0,oldState:0}),_0=Dt(w0),S0=[9,13,27,32],hc=Oa&&"CompositionEvent"in window,Lr=null;Oa&&"documentMode"in document&&(Lr=document.documentMode);var j0=Oa&&"TextEvent"in window&&!Lr,Lf=Oa&&(!hc||Lr&&8<Lr&&11>=Lr),Bf=" ",qf=!1;function $f(e,t){switch(e){case"keyup":return S0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ts=!1;function E0(e,t){switch(e){case"compositionend":return Hf(t);case"keypress":return t.which!==32?null:(qf=!0,Bf);case"textInput":return e=t.data,e===Bf&&qf?null:e;default:return null}}function N0(e,t){if(Ts)return e==="compositionend"||!hc&&$f(e,t)?(e=Rf(),tl=oc=nn=null,Ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Lf&&t.locale!=="ko"?null:t.data;default:return null}}var T0={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Vf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!T0[e.type]:t==="textarea"}function If(e,t,s,i){Es?Ns?Ns.push(i):Ns=[i]:Es=i,t=Jl(t,"onChange"),0<t.length&&(s=new sl("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var Br=null,qr=null;function A0(e){Ep(e,0)}function il(e){var t=Rr(e);if(jf(t))return e}function Gf(e,t){if(e==="change")return t}var Pf=!1;if(Oa){var mc;if(Oa){var pc="oninput"in document;if(!pc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),pc=typeof Kf.oninput=="function"}mc=pc}else mc=!1;Pf=mc&&(!document.documentMode||9<document.documentMode)}function Yf(){Br&&(Br.detachEvent("onpropertychange",Jf),qr=Br=null)}function Jf(e){if(e.propertyName==="value"&&il(qr)){var t=[];If(t,qr,e,rc(e)),Of(A0,t)}}function C0(e,t,s){e==="focusin"?(Yf(),Br=t,qr=s,Br.attachEvent("onpropertychange",Jf)):e==="focusout"&&Yf()}function k0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return il(qr)}function O0(e,t){if(e==="click")return il(t)}function R0(e,t){if(e==="input"||e==="change")return il(t)}function D0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $t=typeof Object.is=="function"?Object.is:D0;function $r(e,t){if($t(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(i=0;i<s.length;i++){var u=s[i];if(!Rn.call(t,u)||!$t(e[u],t[u]))return!1}return!0}function Xf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qf(e,t){var s=Xf(e);e=0;for(var i;s;){if(s.nodeType===3){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Xf(s)}}function Zf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ff(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Wi(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Wi(e.document)}return t}function gc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var M0=Oa&&"documentMode"in document&&11>=document.documentMode,As=null,yc=null,Hr=null,vc=!1;function Wf(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;vc||As==null||As!==Wi(i)||(i=As,"selectionStart"in i&&gc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Hr&&$r(Hr,i)||(Hr=i,i=Jl(yc,"onSelect"),0<i.length&&(t=new sl("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=As)))}function Un(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Cs={animationend:Un("Animation","AnimationEnd"),animationiteration:Un("Animation","AnimationIteration"),animationstart:Un("Animation","AnimationStart"),transitionrun:Un("Transition","TransitionRun"),transitionstart:Un("Transition","TransitionStart"),transitioncancel:Un("Transition","TransitionCancel"),transitionend:Un("Transition","TransitionEnd")},bc={},eh={};Oa&&(eh=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Ln(e){if(bc[e])return bc[e];if(!Cs[e])return e;var t=Cs[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in eh)return bc[e]=t[s];return e}var th=Ln("animationend"),ah=Ln("animationiteration"),nh=Ln("animationstart"),z0=Ln("transitionrun"),U0=Ln("transitionstart"),L0=Ln("transitioncancel"),sh=Ln("transitionend"),rh=new Map,xc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");xc.push("scrollEnd");function la(e,t){rh.set(e,t),Mn(t,[e])}var ll=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ft=[],ks=0,wc=0;function ol(){for(var e=ks,t=wc=ks=0;t<e;){var s=Ft[t];Ft[t++]=null;var i=Ft[t];Ft[t++]=null;var u=Ft[t];Ft[t++]=null;var f=Ft[t];if(Ft[t++]=null,i!==null&&u!==null){var y=i.pending;y===null?u.next=u:(u.next=y.next,y.next=u),i.pending=u}f!==0&&ih(s,u,f)}}function cl(e,t,s,i){Ft[ks++]=e,Ft[ks++]=t,Ft[ks++]=s,Ft[ks++]=i,wc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function _c(e,t,s,i){return cl(e,t,s,i),ul(e)}function Bn(e,t){return cl(e,null,null,t),ul(e)}function ih(e,t,s){e.lanes|=s;var i=e.alternate;i!==null&&(i.lanes|=s);for(var u=!1,f=e.return;f!==null;)f.childLanes|=s,i=f.alternate,i!==null&&(i.childLanes|=s),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-kt(s),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=s|536870912),f):null}function ul(e){if(50<ci)throw ci=0,Ou=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Os={};function B0(e,t,s,i){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ht(e,t,s,i){return new B0(e,t,s,i)}function Sc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ra(e,t){var s=e.alternate;return s===null?(s=Ht(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function lh(e,t){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function dl(e,t,s,i,u,f){var y=0;if(i=e,typeof e=="function")Sc(e)&&(y=1);else if(typeof e=="string")y=Ib(e,s,F.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case he:return e=Ht(31,s,t,u),e.elementType=he,e.lanes=f,e;case E:return qn(s.children,u,f,t);case k:y=8,u|=24;break;case O:return e=Ht(12,s,t,u|2),e.elementType=O,e.lanes=f,e;case ee:return e=Ht(13,s,t,u),e.elementType=ee,e.lanes=f,e;case Q:return e=Ht(19,s,t,u),e.elementType=Q,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:y=10;break e;case q:y=9;break e;case G:y=11;break e;case P:y=14;break e;case J:y=16,i=null;break e}y=29,s=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=Ht(y,s,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function qn(e,t,s,i){return e=Ht(7,e,i,t),e.lanes=s,e}function jc(e,t,s){return e=Ht(6,e,null,t),e.lanes=s,e}function oh(e){var t=Ht(18,null,null,0);return t.stateNode=e,t}function Ec(e,t,s){return t=Ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ch=new WeakMap;function Wt(e,t){if(typeof e=="object"&&e!==null){var s=ch.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Cr(t)},ch.set(e,t),t)}return{value:e,source:t,stack:Cr(t)}}var Rs=[],Ds=0,fl=null,Vr=0,ea=[],ta=0,sn=null,ya=1,va="";function Da(e,t){Rs[Ds++]=Vr,Rs[Ds++]=fl,fl=e,Vr=t}function uh(e,t,s){ea[ta++]=ya,ea[ta++]=va,ea[ta++]=sn,sn=e;var i=ya;e=va;var u=32-kt(i)-1;i&=~(1<<u),s+=1;var f=32-kt(t)+u;if(30<f){var y=u-u%5;f=(i&(1<<y)-1).toString(32),i>>=y,u-=y,ya=1<<32-kt(t)+u|s<<u|i,va=f+e}else ya=1<<f|s<<u|i,va=e}function Nc(e){e.return!==null&&(Da(e,1),uh(e,1,0))}function Tc(e){for(;e===fl;)fl=Rs[--Ds],Rs[Ds]=null,Vr=Rs[--Ds],Rs[Ds]=null;for(;e===sn;)sn=ea[--ta],ea[ta]=null,va=ea[--ta],ea[ta]=null,ya=ea[--ta],ea[ta]=null}function dh(e,t){ea[ta++]=ya,ea[ta++]=va,ea[ta++]=sn,ya=t.id,va=t.overflow,sn=e}var wt=null,Ye=null,ke=!1,rn=null,aa=!1,Ac=Error(l(519));function ln(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ir(Wt(t,e)),Ac}function fh(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[xt]=e,t[Rt]=i,s){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(s=0;s<di.length;s++)Ee(di[s],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),Tf(t,i.value,i.defaultValue,i.children)}s=i.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||i.suppressHydrationWarning===!0||Cp(t.textContent,s)?(i.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),i.onScroll!=null&&Ee("scroll",t),i.onScrollEnd!=null&&Ee("scrollend",t),i.onClick!=null&&(t.onclick=ka),t=!0):t=!1,t||ln(e,!0)}function hh(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:aa=!1;return;case 27:case 3:aa=!0;return;default:wt=wt.return}}function Ms(e){if(e!==wt)return!1;if(!ke)return hh(e),ke=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Ku(e.type,e.memoizedProps)),s=!s),s&&Ye&&ln(e),hh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ye=Bp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ye=Bp(e)}else t===27?(t=Ye,wn(e.type)?(e=Zu,Zu=null,Ye=e):Ye=t):Ye=wt?sa(e.stateNode.nextSibling):null;return!0}function $n(){Ye=wt=null,ke=!1}function Cc(){var e=rn;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),rn=null),e}function Ir(e){rn===null?rn=[e]:rn.push(e)}var kc=N(null),Hn=null,Ma=null;function on(e,t,s){Y(kc,t._currentValue),t._currentValue=s}function za(e){e._currentValue=kc.current,H(kc)}function Oc(e,t,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===s)break;e=e.return}}function Rc(e,t,s,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var b=f;f=u;for(var j=0;j<t.length;j++)if(b.context===t[j]){f.lanes|=s,b=f.alternate,b!==null&&(b.lanes|=s),Oc(f.return,s,e),i||(y=null);break e}f=b.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(l(341));y.lanes|=s,f=y.alternate,f!==null&&(f.lanes|=s),Oc(y,s,e),y=null}else y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===e){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function zs(e,t,s,i){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(l(387));if(y=y.memoizedProps,y!==null){var b=u.type;$t(u.pendingProps.value,y.value)||(e!==null?e.push(b):e=[b])}}else if(u===de.current){if(y=u.alternate,y===null)throw Error(l(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(gi):e=[gi])}u=u.return}e!==null&&Rc(t,e,s,i),t.flags|=262144}function hl(e){for(e=e.firstContext;e!==null;){if(!$t(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Vn(e){Hn=e,Ma=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function _t(e){return mh(Hn,e)}function ml(e,t){return Hn===null&&Vn(e),mh(e,t)}function mh(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},Ma===null){if(e===null)throw Error(l(308));Ma=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ma=Ma.next=t;return s}var q0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},$0=n.unstable_scheduleCallback,H0=n.unstable_NormalPriority,st={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dc(){return{controller:new q0,data:new Map,refCount:0}}function Gr(e){e.refCount--,e.refCount===0&&$0(H0,function(){e.controller.abort()})}var Pr=null,Mc=0,Us=0,Ls=null;function V0(e,t){if(Pr===null){var s=Pr=[];Mc=0,Us=Lu(),Ls={status:"pending",value:void 0,then:function(i){s.push(i)}}}return Mc++,t.then(ph,ph),t}function ph(){if(--Mc===0&&Pr!==null){Ls!==null&&(Ls.status="fulfilled");var e=Pr;Pr=null,Us=0,Ls=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function I0(e,t){var s=[],i={status:"pending",value:null,reason:null,then:function(u){s.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<s.length;u++)(0,s[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<s.length;u++)(0,s[u])(void 0)}),i}var gh=L.S;L.S=function(e,t){Wm=mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&V0(e,t),gh!==null&&gh(e,t)};var In=N(null);function zc(){var e=In.current;return e!==null?e:Ie.pooledCache}function pl(e,t){t===null?Y(In,In.current):Y(In,t.pool)}function yh(){var e=zc();return e===null?null:{parent:st._currentValue,pool:e}}var Bs=Error(l(460)),Uc=Error(l(474)),gl=Error(l(542)),yl={then:function(){}};function vh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function bh(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(ka,ka),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wh(e),e;default:if(typeof t.status=="string")t.then(ka,ka);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wh(e),e}throw Pn=t,Bs}}function Gn(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Pn=s,Bs):s}}var Pn=null;function xh(){if(Pn===null)throw Error(l(459));var e=Pn;return Pn=null,e}function wh(e){if(e===Bs||e===gl)throw Error(l(483))}var qs=null,Kr=0;function vl(e){var t=Kr;return Kr+=1,qs===null&&(qs=[]),bh(qs,e,t)}function Yr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function bl(e,t){throw t.$$typeof===_?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function _h(e){function t(C,T){if(e){var R=C.deletions;R===null?(C.deletions=[T],C.flags|=16):R.push(T)}}function s(C,T){if(!e)return null;for(;T!==null;)t(C,T),T=T.sibling;return null}function i(C){for(var T=new Map;C!==null;)C.key!==null?T.set(C.key,C):T.set(C.index,C),C=C.sibling;return T}function u(C,T){return C=Ra(C,T),C.index=0,C.sibling=null,C}function f(C,T,R){return C.index=R,e?(R=C.alternate,R!==null?(R=R.index,R<T?(C.flags|=67108866,T):R):(C.flags|=67108866,T)):(C.flags|=1048576,T)}function y(C){return e&&C.alternate===null&&(C.flags|=67108866),C}function b(C,T,R,V){return T===null||T.tag!==6?(T=jc(R,C.mode,V),T.return=C,T):(T=u(T,R),T.return=C,T)}function j(C,T,R,V){var ce=R.type;return ce===E?$(C,T,R.props.children,V,R.key):T!==null&&(T.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===J&&Gn(ce)===T.type)?(T=u(T,R.props),Yr(T,R),T.return=C,T):(T=dl(R.type,R.key,R.props,null,C.mode,V),Yr(T,R),T.return=C,T)}function D(C,T,R,V){return T===null||T.tag!==4||T.stateNode.containerInfo!==R.containerInfo||T.stateNode.implementation!==R.implementation?(T=Ec(R,C.mode,V),T.return=C,T):(T=u(T,R.children||[]),T.return=C,T)}function $(C,T,R,V,ce){return T===null||T.tag!==7?(T=qn(R,C.mode,V,ce),T.return=C,T):(T=u(T,R),T.return=C,T)}function I(C,T,R){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=jc(""+T,C.mode,R),T.return=C,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case S:return R=dl(T.type,T.key,T.props,null,C.mode,R),Yr(R,T),R.return=C,R;case A:return T=Ec(T,C.mode,R),T.return=C,T;case J:return T=Gn(T),I(C,T,R)}if(Ve(T)||ye(T))return T=qn(T,C.mode,R,null),T.return=C,T;if(typeof T.then=="function")return I(C,vl(T),R);if(T.$$typeof===B)return I(C,ml(C,T),R);bl(C,T)}return null}function M(C,T,R,V){var ce=T!==null?T.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return ce!==null?null:b(C,T,""+R,V);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return R.key===ce?j(C,T,R,V):null;case A:return R.key===ce?D(C,T,R,V):null;case J:return R=Gn(R),M(C,T,R,V)}if(Ve(R)||ye(R))return ce!==null?null:$(C,T,R,V,null);if(typeof R.then=="function")return M(C,T,vl(R),V);if(R.$$typeof===B)return M(C,T,ml(C,R),V);bl(C,R)}return null}function U(C,T,R,V,ce){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return C=C.get(R)||null,b(T,C,""+V,ce);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return C=C.get(V.key===null?R:V.key)||null,j(T,C,V,ce);case A:return C=C.get(V.key===null?R:V.key)||null,D(T,C,V,ce);case J:return V=Gn(V),U(C,T,R,V,ce)}if(Ve(V)||ye(V))return C=C.get(R)||null,$(T,C,V,ce,null);if(typeof V.then=="function")return U(C,T,R,vl(V),ce);if(V.$$typeof===B)return U(C,T,R,ml(T,V),ce);bl(T,V)}return null}function te(C,T,R,V){for(var ce=null,Oe=null,ie=T,_e=T=0,Ae=null;ie!==null&&_e<R.length;_e++){ie.index>_e?(Ae=ie,ie=null):Ae=ie.sibling;var Re=M(C,ie,R[_e],V);if(Re===null){ie===null&&(ie=Ae);break}e&&ie&&Re.alternate===null&&t(C,ie),T=f(Re,T,_e),Oe===null?ce=Re:Oe.sibling=Re,Oe=Re,ie=Ae}if(_e===R.length)return s(C,ie),ke&&Da(C,_e),ce;if(ie===null){for(;_e<R.length;_e++)ie=I(C,R[_e],V),ie!==null&&(T=f(ie,T,_e),Oe===null?ce=ie:Oe.sibling=ie,Oe=ie);return ke&&Da(C,_e),ce}for(ie=i(ie);_e<R.length;_e++)Ae=U(ie,C,_e,R[_e],V),Ae!==null&&(e&&Ae.alternate!==null&&ie.delete(Ae.key===null?_e:Ae.key),T=f(Ae,T,_e),Oe===null?ce=Ae:Oe.sibling=Ae,Oe=Ae);return e&&ie.forEach(function(Nn){return t(C,Nn)}),ke&&Da(C,_e),ce}function fe(C,T,R,V){if(R==null)throw Error(l(151));for(var ce=null,Oe=null,ie=T,_e=T=0,Ae=null,Re=R.next();ie!==null&&!Re.done;_e++,Re=R.next()){ie.index>_e?(Ae=ie,ie=null):Ae=ie.sibling;var Nn=M(C,ie,Re.value,V);if(Nn===null){ie===null&&(ie=Ae);break}e&&ie&&Nn.alternate===null&&t(C,ie),T=f(Nn,T,_e),Oe===null?ce=Nn:Oe.sibling=Nn,Oe=Nn,ie=Ae}if(Re.done)return s(C,ie),ke&&Da(C,_e),ce;if(ie===null){for(;!Re.done;_e++,Re=R.next())Re=I(C,Re.value,V),Re!==null&&(T=f(Re,T,_e),Oe===null?ce=Re:Oe.sibling=Re,Oe=Re);return ke&&Da(C,_e),ce}for(ie=i(ie);!Re.done;_e++,Re=R.next())Re=U(ie,C,_e,Re.value,V),Re!==null&&(e&&Re.alternate!==null&&ie.delete(Re.key===null?_e:Re.key),T=f(Re,T,_e),Oe===null?ce=Re:Oe.sibling=Re,Oe=Re);return e&&ie.forEach(function(ex){return t(C,ex)}),ke&&Da(C,_e),ce}function $e(C,T,R,V){if(typeof R=="object"&&R!==null&&R.type===E&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case S:e:{for(var ce=R.key;T!==null;){if(T.key===ce){if(ce=R.type,ce===E){if(T.tag===7){s(C,T.sibling),V=u(T,R.props.children),V.return=C,C=V;break e}}else if(T.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===J&&Gn(ce)===T.type){s(C,T.sibling),V=u(T,R.props),Yr(V,R),V.return=C,C=V;break e}s(C,T);break}else t(C,T);T=T.sibling}R.type===E?(V=qn(R.props.children,C.mode,V,R.key),V.return=C,C=V):(V=dl(R.type,R.key,R.props,null,C.mode,V),Yr(V,R),V.return=C,C=V)}return y(C);case A:e:{for(ce=R.key;T!==null;){if(T.key===ce)if(T.tag===4&&T.stateNode.containerInfo===R.containerInfo&&T.stateNode.implementation===R.implementation){s(C,T.sibling),V=u(T,R.children||[]),V.return=C,C=V;break e}else{s(C,T);break}else t(C,T);T=T.sibling}V=Ec(R,C.mode,V),V.return=C,C=V}return y(C);case J:return R=Gn(R),$e(C,T,R,V)}if(Ve(R))return te(C,T,R,V);if(ye(R)){if(ce=ye(R),typeof ce!="function")throw Error(l(150));return R=ce.call(R),fe(C,T,R,V)}if(typeof R.then=="function")return $e(C,T,vl(R),V);if(R.$$typeof===B)return $e(C,T,ml(C,R),V);bl(C,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,T!==null&&T.tag===6?(s(C,T.sibling),V=u(T,R),V.return=C,C=V):(s(C,T),V=jc(R,C.mode,V),V.return=C,C=V),y(C)):s(C,T)}return function(C,T,R,V){try{Kr=0;var ce=$e(C,T,R,V);return qs=null,ce}catch(ie){if(ie===Bs||ie===gl)throw ie;var Oe=Ht(29,ie,null,C.mode);return Oe.lanes=V,Oe.return=C,Oe}}}var Kn=_h(!0),Sh=_h(!1),cn=!1;function Lc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function un(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function dn(e,t,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Me&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=ul(e),ih(e,null,s),t}return cl(e,i,t,s),ul(e)}function Jr(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Qi(e,s)}}function qc(e,t){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var u=null,f=null;if(s=s.firstBaseUpdate,s!==null){do{var y={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,s=s.next}while(s!==null);f===null?u=f=t:f=f.next=t}else u=f=t;s={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var $c=!1;function Xr(){if($c){var e=Ls;if(e!==null)throw e}}function Qr(e,t,s,i){$c=!1;var u=e.updateQueue;cn=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var j=b,D=j.next;j.next=null,y===null?f=D:y.next=D,y=j;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==y&&(b===null?$.firstBaseUpdate=D:b.next=D,$.lastBaseUpdate=j))}if(f!==null){var I=u.baseState;y=0,$=D=j=null,b=f;do{var M=b.lane&-536870913,U=M!==b.lane;if(U?(Te&M)===M:(i&M)===M){M!==0&&M===Us&&($c=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var te=e,fe=b;M=t;var $e=s;switch(fe.tag){case 1:if(te=fe.payload,typeof te=="function"){I=te.call($e,I,M);break e}I=te;break e;case 3:te.flags=te.flags&-65537|128;case 0:if(te=fe.payload,M=typeof te=="function"?te.call($e,I,M):te,M==null)break e;I=x({},I,M);break e;case 2:cn=!0}}M=b.callback,M!==null&&(e.flags|=64,U&&(e.flags|=8192),U=u.callbacks,U===null?u.callbacks=[M]:U.push(M))}else U={lane:M,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(D=$=U,j=I):$=$.next=U,y|=M;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;U=b,b=U.next,U.next=null,u.lastBaseUpdate=U,u.shared.pending=null}}while(!0);$===null&&(j=I),u.baseState=j,u.firstBaseUpdate=D,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),gn|=y,e.lanes=y,e.memoizedState=I}}function jh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Eh(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)jh(s[e],t)}var $s=N(null),xl=N(0);function Nh(e,t){e=Ga,Y(xl,e),Y($s,t),Ga=e|t.baseLanes}function Hc(){Y(xl,Ga),Y($s,$s.current)}function Vc(){Ga=xl.current,H($s),H(xl)}var Vt=N(null),na=null;function fn(e){var t=e.alternate;Y(tt,tt.current&1),Y(Vt,e),na===null&&(t===null||$s.current!==null||t.memoizedState!==null)&&(na=e)}function Ic(e){Y(tt,tt.current),Y(Vt,e),na===null&&(na=e)}function Th(e){e.tag===22?(Y(tt,tt.current),Y(Vt,e),na===null&&(na=e)):hn()}function hn(){Y(tt,tt.current),Y(Vt,Vt.current)}function It(e){H(Vt),na===e&&(na=null),H(tt)}var tt=N(0);function wl(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Xu(s)||Qu(s)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ua=0,we=null,Be=null,rt=null,_l=!1,Hs=!1,Yn=!1,Sl=0,Zr=0,Vs=null,G0=0;function Fe(){throw Error(l(321))}function Gc(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!$t(e[s],t[s]))return!1;return!0}function Pc(e,t,s,i,u,f){return Ua=f,we=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,L.H=e===null||e.memoizedState===null?um:iu,Yn=!1,f=s(i,u),Yn=!1,Hs&&(f=Ch(t,s,i,u)),Ah(e),f}function Ah(e){L.H=ei;var t=Be!==null&&Be.next!==null;if(Ua=0,rt=Be=we=null,_l=!1,Zr=0,Vs=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&hl(e)&&(it=!0))}function Ch(e,t,s,i){we=e;var u=0;do{if(Hs&&(Vs=null),Zr=0,Hs=!1,25<=u)throw Error(l(301));if(u+=1,rt=Be=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}L.H=dm,f=t(s,i)}while(Hs);return f}function P0(){var e=L.H,t=e.useState()[0];return t=typeof t.then=="function"?Fr(t):t,e=e.useState()[0],(Be!==null?Be.memoizedState:null)!==e&&(we.flags|=1024),t}function Kc(){var e=Sl!==0;return Sl=0,e}function Yc(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Jc(e){if(_l){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}_l=!1}Ua=0,rt=Be=we=null,Hs=!1,Zr=Sl=0,Vs=null}function Ot(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?we.memoizedState=rt=e:rt=rt.next=e,rt}function at(){if(Be===null){var e=we.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=rt===null?we.memoizedState:rt.next;if(t!==null)rt=t,Be=e;else{if(e===null)throw we.alternate===null?Error(l(467)):Error(l(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},rt===null?we.memoizedState=rt=e:rt=rt.next=e}return rt}function jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fr(e){var t=Zr;return Zr+=1,Vs===null&&(Vs=[]),e=bh(Vs,e,t),t=we,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,L.H=t===null||t.memoizedState===null?um:iu),e}function El(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Fr(e);if(e.$$typeof===B)return _t(e)}throw Error(l(438,String(e)))}function Xc(e){var t=null,s=we.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=we.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=jl(),we.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),i=0;i<e;i++)s[i]=Ge;return t.index++,s}function La(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=at();return Qc(t,Be,e)}function Qc(e,t,s){var i=e.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=s;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var b=y=null,j=null,D=t,$=!1;do{var I=D.lane&-536870913;if(I!==D.lane?(Te&I)===I:(Ua&I)===I){var M=D.revertLane;if(M===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null}),I===Us&&($=!0);else if((Ua&M)===M){D=D.next,M===Us&&($=!0);continue}else I={lane:0,revertLane:D.revertLane,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},j===null?(b=j=I,y=f):j=j.next=I,we.lanes|=M,gn|=M;I=D.action,Yn&&s(f,I),f=D.hasEagerState?D.eagerState:s(f,I)}else M={lane:I,revertLane:D.revertLane,gesture:D.gesture,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},j===null?(b=j=M,y=f):j=j.next=M,we.lanes|=I,gn|=I;D=D.next}while(D!==null&&D!==t);if(j===null?y=f:j.next=b,!$t(f,e.memoizedState)&&(it=!0,$&&(s=Ls,s!==null)))throw s;e.memoizedState=f,e.baseState=y,e.baseQueue=j,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Zc(e){var t=at(),s=t.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=e;var i=s.dispatch,u=s.pending,f=t.memoizedState;if(u!==null){s.pending=null;var y=u=u.next;do f=e(f,y.action),y=y.next;while(y!==u);$t(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),s.lastRenderedState=f}return[f,i]}function kh(e,t,s){var i=we,u=at(),f=ke;if(f){if(s===void 0)throw Error(l(407));s=s()}else s=t();var y=!$t((Be||u).memoizedState,s);if(y&&(u.memoizedState=s,it=!0),u=u.queue,eu(Dh.bind(null,i,u,e),[e]),u.getSnapshot!==t||y||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,Is(9,{destroy:void 0},Rh.bind(null,i,u,s,t),null),Ie===null)throw Error(l(349));f||(Ua&127)!==0||Oh(i,t,s)}return s}function Oh(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=we.updateQueue,t===null?(t=jl(),we.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Rh(e,t,s,i){t.value=s,t.getSnapshot=i,Mh(t)&&zh(e)}function Dh(e,t,s){return s(function(){Mh(t)&&zh(e)})}function Mh(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!$t(e,s)}catch{return!0}}function zh(e){var t=Bn(e,2);t!==null&&Bt(t,e,2)}function Fc(e){var t=Ot();if(typeof e=="function"){var s=e;if(e=s(),Yn){pa(!0);try{s()}finally{pa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:e},t}function Uh(e,t,s,i){return e.baseState=s,Qc(e,Be,typeof i=="function"?i:La)}function K0(e,t,s,i,u){if(Cl(e))throw Error(l(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};L.T!==null?s(!0):f.isTransition=!1,i(f),s=t.pending,s===null?(f.next=t.pending=f,Lh(t,f)):(f.next=s.next,t.pending=s.next=f)}}function Lh(e,t){var s=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=L.T,y={};L.T=y;try{var b=s(u,i),j=L.S;j!==null&&j(y,b),Bh(e,t,b)}catch(D){Wc(e,t,D)}finally{f!==null&&y.types!==null&&(f.types=y.types),L.T=f}}else try{f=s(u,i),Bh(e,t,f)}catch(D){Wc(e,t,D)}}function Bh(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){qh(e,t,i)},function(i){return Wc(e,t,i)}):qh(e,t,s)}function qh(e,t,s){t.status="fulfilled",t.value=s,$h(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,Lh(e,s)))}function Wc(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,$h(t),t=t.next;while(t!==i)}e.action=null}function $h(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Hh(e,t){return t}function Vh(e,t){if(ke){var s=Ie.formState;if(s!==null){e:{var i=we;if(ke){if(Ye){t:{for(var u=Ye,f=aa;u.nodeType!==8;){if(!f){u=null;break t}if(u=sa(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ye=sa(u.nextSibling),i=u.data==="F!";break e}}ln(i)}i=!1}i&&(t=s[0])}}return s=Ot(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hh,lastRenderedState:t},s.queue=i,s=lm.bind(null,we,i),i.dispatch=s,i=Fc(!1),f=ru.bind(null,we,!1,i.queue),i=Ot(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,s=K0.bind(null,we,u,f,s),u.dispatch=s,i.memoizedState=e,[t,s,!1]}function Ih(e){var t=at();return Gh(t,Be,e)}function Gh(e,t,s){if(t=Qc(e,t,Hh)[0],e=Nl(La)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Fr(t)}catch(y){throw y===Bs?gl:y}else i=t;t=at();var u=t.queue,f=u.dispatch;return s!==t.memoizedState&&(we.flags|=2048,Is(9,{destroy:void 0},Y0.bind(null,u,s),null)),[i,f,e]}function Y0(e,t){e.action=t}function Ph(e){var t=at(),s=Be;if(s!==null)return Gh(t,s,e);at(),t=t.memoizedState,s=at();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function Is(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=we.updateQueue,t===null&&(t=jl(),we.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(i=s.next,s.next=e,e.next=i,t.lastEffect=e),e}function Kh(){return at().memoizedState}function Tl(e,t,s,i){var u=Ot();we.flags|=e,u.memoizedState=Is(1|t,{destroy:void 0},s,i===void 0?null:i)}function Al(e,t,s,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;Be!==null&&i!==null&&Gc(i,Be.memoizedState.deps)?u.memoizedState=Is(t,f,s,i):(we.flags|=e,u.memoizedState=Is(1|t,f,s,i))}function Yh(e,t){Tl(8390656,8,e,t)}function eu(e,t){Al(2048,8,e,t)}function J0(e){we.flags|=4;var t=we.updateQueue;if(t===null)t=jl(),we.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function Jh(e){var t=at().memoizedState;return J0({ref:t,nextImpl:e}),function(){if((Me&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Xh(e,t){return Al(4,2,e,t)}function Qh(e,t){return Al(4,4,e,t)}function Zh(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Fh(e,t,s){s=s!=null?s.concat([e]):null,Al(4,4,Zh.bind(null,t,e),s)}function tu(){}function Wh(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&Gc(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function em(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&Gc(t,i[1]))return i[0];if(i=e(),Yn){pa(!0);try{e()}finally{pa(!1)}}return s.memoizedState=[i,t],i}function au(e,t,s){return s===void 0||(Ua&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=tp(),we.lanes|=e,gn|=e,s)}function tm(e,t,s,i){return $t(s,t)?s:$s.current!==null?(e=au(e,s,i),$t(e,t)||(it=!0),e):(Ua&42)===0||(Ua&1073741824)!==0&&(Te&261930)===0?(it=!0,e.memoizedState=s):(e=tp(),we.lanes|=e,gn|=e,t)}function am(e,t,s,i,u){var f=Z.p;Z.p=f!==0&&8>f?f:8;var y=L.T,b={};L.T=b,ru(e,!1,t,s);try{var j=u(),D=L.S;if(D!==null&&D(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var $=I0(j,i);Wr(e,t,$,Kt(e))}else Wr(e,t,i,Kt(e))}catch(I){Wr(e,t,{then:function(){},status:"rejected",reason:I},Kt())}finally{Z.p=f,y!==null&&b.types!==null&&(y.types=b.types),L.T=y}}function X0(){}function nu(e,t,s,i){if(e.tag!==5)throw Error(l(476));var u=nm(e).queue;am(e,u,t,K,s===null?X0:function(){return sm(e),s(i)})}function nm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:K},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function sm(e){var t=nm(e);t.next===null&&(t=e.alternate.memoizedState),Wr(e,t.next.queue,{},Kt())}function su(){return _t(gi)}function rm(){return at().memoizedState}function im(){return at().memoizedState}function Q0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=Kt();e=un(s);var i=dn(t,e,s);i!==null&&(Bt(i,t,s),Jr(i,t,s)),t={cache:Dc()},e.payload=t;return}t=t.return}}function Z0(e,t,s){var i=Kt();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Cl(e)?om(t,s):(s=_c(e,t,s,i),s!==null&&(Bt(s,e,i),cm(s,t,i)))}function lm(e,t,s){var i=Kt();Wr(e,t,s,i)}function Wr(e,t,s,i){var u={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Cl(e))om(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var y=t.lastRenderedState,b=f(y,s);if(u.hasEagerState=!0,u.eagerState=b,$t(b,y))return cl(e,t,u,0),Ie===null&&ol(),!1}catch{}if(s=_c(e,t,u,i),s!==null)return Bt(s,e,i),cm(s,t,i),!0}return!1}function ru(e,t,s,i){if(i={lane:2,revertLane:Lu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Cl(e)){if(t)throw Error(l(479))}else t=_c(e,s,i,2),t!==null&&Bt(t,e,2)}function Cl(e){var t=e.alternate;return e===we||t!==null&&t===we}function om(e,t){Hs=_l=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function cm(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Qi(e,s)}}var ei={readContext:_t,use:El,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};ei.useEffectEvent=Fe;var um={readContext:_t,use:El,useCallback:function(e,t){return Ot().memoizedState=[e,t===void 0?null:t],e},useContext:_t,useEffect:Yh,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Tl(4194308,4,Zh.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Tl(4194308,4,e,t)},useInsertionEffect:function(e,t){Tl(4,2,e,t)},useMemo:function(e,t){var s=Ot();t=t===void 0?null:t;var i=e();if(Yn){pa(!0);try{e()}finally{pa(!1)}}return s.memoizedState=[i,t],i},useReducer:function(e,t,s){var i=Ot();if(s!==void 0){var u=s(t);if(Yn){pa(!0);try{s(t)}finally{pa(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=Z0.bind(null,we,e),[i.memoizedState,e]},useRef:function(e){var t=Ot();return e={current:e},t.memoizedState=e},useState:function(e){e=Fc(e);var t=e.queue,s=lm.bind(null,we,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:tu,useDeferredValue:function(e,t){var s=Ot();return au(s,e,t)},useTransition:function(){var e=Fc(!1);return e=am.bind(null,we,e.queue,!0,!1),Ot().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=we,u=Ot();if(ke){if(s===void 0)throw Error(l(407));s=s()}else{if(s=t(),Ie===null)throw Error(l(349));(Te&127)!==0||Oh(i,t,s)}u.memoizedState=s;var f={value:s,getSnapshot:t};return u.queue=f,Yh(Dh.bind(null,i,f,e),[e]),i.flags|=2048,Is(9,{destroy:void 0},Rh.bind(null,i,f,s,t),null),s},useId:function(){var e=Ot(),t=Ie.identifierPrefix;if(ke){var s=va,i=ya;s=(i&~(1<<32-kt(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Sl++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=G0++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:su,useFormState:Vh,useActionState:Vh,useOptimistic:function(e){var t=Ot();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=ru.bind(null,we,!0,s),s.dispatch=t,[e,t]},useMemoCache:Xc,useCacheRefresh:function(){return Ot().memoizedState=Q0.bind(null,we)},useEffectEvent:function(e){var t=Ot(),s={impl:e};return t.memoizedState=s,function(){if((Me&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},iu={readContext:_t,use:El,useCallback:Wh,useContext:_t,useEffect:eu,useImperativeHandle:Fh,useInsertionEffect:Xh,useLayoutEffect:Qh,useMemo:em,useReducer:Nl,useRef:Kh,useState:function(){return Nl(La)},useDebugValue:tu,useDeferredValue:function(e,t){var s=at();return tm(s,Be.memoizedState,e,t)},useTransition:function(){var e=Nl(La)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Fr(e),t]},useSyncExternalStore:kh,useId:rm,useHostTransitionStatus:su,useFormState:Ih,useActionState:Ih,useOptimistic:function(e,t){var s=at();return Uh(s,Be,e,t)},useMemoCache:Xc,useCacheRefresh:im};iu.useEffectEvent=Jh;var dm={readContext:_t,use:El,useCallback:Wh,useContext:_t,useEffect:eu,useImperativeHandle:Fh,useInsertionEffect:Xh,useLayoutEffect:Qh,useMemo:em,useReducer:Zc,useRef:Kh,useState:function(){return Zc(La)},useDebugValue:tu,useDeferredValue:function(e,t){var s=at();return Be===null?au(s,e,t):tm(s,Be.memoizedState,e,t)},useTransition:function(){var e=Zc(La)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Fr(e),t]},useSyncExternalStore:kh,useId:rm,useHostTransitionStatus:su,useFormState:Ph,useActionState:Ph,useOptimistic:function(e,t){var s=at();return Be!==null?Uh(s,Be,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Xc,useCacheRefresh:im};dm.useEffectEvent=Jh;function lu(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:x({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var ou={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=Kt(),u=un(i);u.payload=t,s!=null&&(u.callback=s),t=dn(e,u,i),t!==null&&(Bt(t,e,i),Jr(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=Kt(),u=un(i);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=dn(e,u,i),t!==null&&(Bt(t,e,i),Jr(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Kt(),i=un(s);i.tag=2,t!=null&&(i.callback=t),t=dn(e,i,s),t!==null&&(Bt(t,e,s),Jr(t,e,s))}};function fm(e,t,s,i,u,f,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,y):t.prototype&&t.prototype.isPureReactComponent?!$r(s,i)||!$r(u,f):!0}function hm(e,t,s,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,i),t.state!==e&&ou.enqueueReplaceState(t,t.state,null)}function Jn(e,t){var s=t;if("ref"in t){s={};for(var i in t)i!=="ref"&&(s[i]=t[i])}if(e=e.defaultProps){s===t&&(s=x({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function mm(e){ll(e)}function pm(e){console.error(e)}function gm(e){ll(e)}function kl(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function ym(e,t,s){try{var i=e.onCaughtError;i(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function cu(e,t,s){return s=un(s),s.tag=3,s.payload={element:null},s.callback=function(){kl(e,t)},s}function vm(e){return e=un(e),e.tag=3,e}function bm(e,t,s,i){var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){ym(t,s,i)}}var y=s.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){ym(t,s,i),typeof u!="function"&&(yn===null?yn=new Set([this]):yn.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function F0(e,t,s,i,u){if(s.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=s.alternate,t!==null&&zs(t,s,u,!0),s=Vt.current,s!==null){switch(s.tag){case 31:case 13:return na===null?Vl():s.alternate===null&&We===0&&(We=3),s.flags&=-257,s.flags|=65536,s.lanes=u,i===yl?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),Mu(e,i,u)),!1;case 22:return s.flags|=65536,i===yl?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([i]):s.add(i)),Mu(e,i,u)),!1}throw Error(l(435,s.tag))}return Mu(e,i,u),Vl(),!1}if(ke)return t=Vt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Ac&&(e=Error(l(422),{cause:i}),Ir(Wt(e,s)))):(i!==Ac&&(t=Error(l(423),{cause:i}),Ir(Wt(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=Wt(i,s),u=cu(e.stateNode,i,u),qc(e,u),We!==4&&(We=2)),!1;var f=Error(l(520),{cause:i});if(f=Wt(f,s),oi===null?oi=[f]:oi.push(f),We!==4&&(We=2),t===null)return!0;i=Wt(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=cu(s.stateNode,i,e),qc(s,e),!1;case 1:if(t=s.type,f=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(yn===null||!yn.has(f))))return s.flags|=65536,u&=-u,s.lanes|=u,u=vm(u),bm(u,e,s,i),qc(s,u),!1}s=s.return}while(s!==null);return!1}var uu=Error(l(461)),it=!1;function St(e,t,s,i){t.child=e===null?Sh(t,null,s,i):Kn(t,e.child,s,i)}function xm(e,t,s,i,u){s=s.render;var f=t.ref;if("ref"in i){var y={};for(var b in i)b!=="ref"&&(y[b]=i[b])}else y=i;return Vn(t),i=Pc(e,t,s,y,f,u),b=Kc(),e!==null&&!it?(Yc(e,t,u),Ba(e,t,u)):(ke&&b&&Nc(t),t.flags|=1,St(e,t,i,u),t.child)}function wm(e,t,s,i,u){if(e===null){var f=s.type;return typeof f=="function"&&!Sc(f)&&f.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=f,_m(e,t,f,i,u)):(e=dl(s.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!vu(e,u)){var y=f.memoizedProps;if(s=s.compare,s=s!==null?s:$r,s(y,i)&&e.ref===t.ref)return Ba(e,t,u)}return t.flags|=1,e=Ra(f,i),e.ref=t.ref,e.return=t,t.child=e}function _m(e,t,s,i,u){if(e!==null){var f=e.memoizedProps;if($r(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,vu(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Ba(e,t,u)}return du(e,t,s,i,u)}function Sm(e,t,s,i){var u=i.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|s:s,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~f}else i=0,t.child=null;return jm(e,t,f,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pl(t,f!==null?f.cachePool:null),f!==null?Nh(t,f):Hc(),Th(t);else return i=t.lanes=536870912,jm(e,t,f!==null?f.baseLanes|s:s,s,i)}else f!==null?(pl(t,f.cachePool),Nh(t,f),hn(),t.memoizedState=null):(e!==null&&pl(t,null),Hc(),hn());return St(e,t,u,s),t.child}function ti(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function jm(e,t,s,i,u){var f=zc();return f=f===null?null:{parent:st._currentValue,pool:f},t.memoizedState={baseLanes:s,cachePool:f},e!==null&&pl(t,null),Hc(),Th(t),e!==null&&zs(e,t,i,!0),t.childLanes=u,null}function Ol(e,t){return t=Dl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Em(e,t,s){return Kn(t,e.child,null,s),e=Ol(t,t.pendingProps),e.flags|=2,It(t),t.memoizedState=null,e}function W0(e,t,s){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(i.mode==="hidden")return e=Ol(t,i),t.lanes=536870912,ti(null,e);if(Ic(t),(e=Ye)?(e=Lp(e,aa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:sn!==null?{id:ya,overflow:va}:null,retryLane:536870912,hydrationErrors:null},s=oh(e),s.return=t,t.child=s,wt=t,Ye=null)):e=null,e===null)throw ln(t);return t.lanes=536870912,null}return Ol(t,i)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Ic(t),u)if(t.flags&256)t.flags&=-257,t=Em(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(it||zs(e,t,s,!1),u=(s&e.childLanes)!==0,it||u){if(i=Ie,i!==null&&(y=pf(i,s),y!==0&&y!==f.retryLane))throw f.retryLane=y,Bn(e,y),Bt(i,e,y),uu;Vl(),t=Em(e,t,s)}else e=f.treeContext,Ye=sa(y.nextSibling),wt=t,ke=!0,rn=null,aa=!1,e!==null&&dh(t,e),t=Ol(t,i),t.flags|=4096;return t}return e=Ra(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Rl(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(l(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function du(e,t,s,i,u){return Vn(t),s=Pc(e,t,s,i,void 0,u),i=Kc(),e!==null&&!it?(Yc(e,t,u),Ba(e,t,u)):(ke&&i&&Nc(t),t.flags|=1,St(e,t,s,u),t.child)}function Nm(e,t,s,i,u,f){return Vn(t),t.updateQueue=null,s=Ch(t,i,s,u),Ah(e),i=Kc(),e!==null&&!it?(Yc(e,t,f),Ba(e,t,f)):(ke&&i&&Nc(t),t.flags|=1,St(e,t,s,f),t.child)}function Tm(e,t,s,i,u){if(Vn(t),t.stateNode===null){var f=Os,y=s.contextType;typeof y=="object"&&y!==null&&(f=_t(y)),f=new s(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=ou,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Lc(t),y=s.contextType,f.context=typeof y=="object"&&y!==null?_t(y):Os,f.state=t.memoizedState,y=s.getDerivedStateFromProps,typeof y=="function"&&(lu(t,s,y,i),f.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&ou.enqueueReplaceState(f,f.state,null),Qr(t,i,f,u),Xr(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var b=t.memoizedProps,j=Jn(s,b);f.props=j;var D=f.context,$=s.contextType;y=Os,typeof $=="object"&&$!==null&&(y=_t($));var I=s.getDerivedStateFromProps;$=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||D!==y)&&hm(t,f,i,y),cn=!1;var M=t.memoizedState;f.state=M,Qr(t,i,f,u),Xr(),D=t.memoizedState,b||M!==D||cn?(typeof I=="function"&&(lu(t,s,I,i),D=t.memoizedState),(j=cn||fm(t,s,j,i,M,D,y))?($||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=D),f.props=i,f.state=D,f.context=y,i=j):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Bc(e,t),y=t.memoizedProps,$=Jn(s,y),f.props=$,I=t.pendingProps,M=f.context,D=s.contextType,j=Os,typeof D=="object"&&D!==null&&(j=_t(D)),b=s.getDerivedStateFromProps,(D=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==I||M!==j)&&hm(t,f,i,j),cn=!1,M=t.memoizedState,f.state=M,Qr(t,i,f,u),Xr();var U=t.memoizedState;y!==I||M!==U||cn||e!==null&&e.dependencies!==null&&hl(e.dependencies)?(typeof b=="function"&&(lu(t,s,b,i),U=t.memoizedState),($=cn||fm(t,s,$,i,M,U,j)||e!==null&&e.dependencies!==null&&hl(e.dependencies))?(D||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,U,j),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,U,j)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=U),f.props=i,f.state=U,f.context=j,i=$):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Rl(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,s=i&&typeof s.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=Kn(t,e.child,null,u),t.child=Kn(t,null,s,u)):St(e,t,s,u),t.memoizedState=f.state,e=t.child):e=Ba(e,t,u),e}function Am(e,t,s,i){return $n(),t.flags|=256,St(e,t,s,i),t.child}var fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hu(e){return{baseLanes:e,cachePool:yh()}}function mu(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=Pt),e}function Cm(e,t,s){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,y;if((y=f)||(y=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),y&&(u=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(ke){if(u?fn(t):hn(),(e=Ye)?(e=Lp(e,aa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:sn!==null?{id:ya,overflow:va}:null,retryLane:536870912,hydrationErrors:null},s=oh(e),s.return=t,t.child=s,wt=t,Ye=null)):e=null,e===null)throw ln(t);return Qu(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(hn(),u=t.mode,b=Dl({mode:"hidden",children:b},u),i=qn(i,u,s,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=hu(s),i.childLanes=mu(e,y,s),t.memoizedState=fu,ti(null,i)):(fn(t),pu(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(f)t.flags&256?(fn(t),t.flags&=-257,t=gu(e,t,s)):t.memoizedState!==null?(hn(),t.child=e.child,t.flags|=128,t=null):(hn(),b=i.fallback,u=t.mode,i=Dl({mode:"visible",children:i.children},u),b=qn(b,u,s,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,Kn(t,e.child,null,s),i=t.child,i.memoizedState=hu(s),i.childLanes=mu(e,y,s),t.memoizedState=fu,t=ti(null,i));else if(fn(t),Qu(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var D=y.dgst;y=D,i=Error(l(419)),i.stack="",i.digest=y,Ir({value:i,source:null,stack:null}),t=gu(e,t,s)}else if(it||zs(e,t,s,!1),y=(s&e.childLanes)!==0,it||y){if(y=Ie,y!==null&&(i=pf(y,s),i!==0&&i!==j.retryLane))throw j.retryLane=i,Bn(e,i),Bt(y,e,i),uu;Xu(b)||Vl(),t=gu(e,t,s)}else Xu(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,Ye=sa(b.nextSibling),wt=t,ke=!0,rn=null,aa=!1,e!==null&&dh(t,e),t=pu(t,i.children),t.flags|=4096);return t}return u?(hn(),b=i.fallback,u=t.mode,j=e.child,D=j.sibling,i=Ra(j,{mode:"hidden",children:i.children}),i.subtreeFlags=j.subtreeFlags&65011712,D!==null?b=Ra(D,b):(b=qn(b,u,s,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,ti(null,i),i=t.child,b=e.child.memoizedState,b===null?b=hu(s):(u=b.cachePool,u!==null?(j=st._currentValue,u=u.parent!==j?{parent:j,pool:j}:u):u=yh(),b={baseLanes:b.baseLanes|s,cachePool:u}),i.memoizedState=b,i.childLanes=mu(e,y,s),t.memoizedState=fu,ti(e.child,i)):(fn(t),s=e.child,e=s.sibling,s=Ra(s,{mode:"visible",children:i.children}),s.return=t,s.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=s,t.memoizedState=null,s)}function pu(e,t){return t=Dl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Dl(e,t){return e=Ht(22,e,null,t),e.lanes=0,e}function gu(e,t,s){return Kn(t,e.child,null,s),e=pu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function km(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Oc(e.return,t,s)}function yu(e,t,s,i,u,f){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:u,treeForkCount:f}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=i,y.tail=s,y.tailMode=u,y.treeForkCount=f)}function Om(e,t,s){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var y=tt.current,b=(y&2)!==0;if(b?(y=y&1|2,t.flags|=128):y&=1,Y(tt,y),St(e,t,i,s),i=ke?Vr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&km(e,s,t);else if(e.tag===19)km(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(s=t.child,u=null;s!==null;)e=s.alternate,e!==null&&wl(e)===null&&(u=s),s=s.sibling;s=u,s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),yu(t,!1,u,s,f,i);break;case"backwards":case"unstable_legacy-backwards":for(s=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&wl(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}yu(t,!0,s,null,f,i);break;case"together":yu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Ba(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),gn|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(zs(e,t,s,!1),(s&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,s=Ra(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Ra(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function vu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&hl(e)))}function eb(e,t,s){switch(t.tag){case 3:Pe(t,t.stateNode.containerInfo),on(t,st,e.memoizedState.cache),$n();break;case 27:case 5:Tt(t);break;case 4:Pe(t,t.stateNode.containerInfo);break;case 10:on(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ic(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(fn(t),t.flags|=128,null):(s&t.child.childLanes)!==0?Cm(e,t,s):(fn(t),e=Ba(e,t,s),e!==null?e.sibling:null);fn(t);break;case 19:var u=(e.flags&128)!==0;if(i=(s&t.childLanes)!==0,i||(zs(e,t,s,!1),i=(s&t.childLanes)!==0),u){if(i)return Om(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Y(tt,tt.current),i)break;return null;case 22:return t.lanes=0,Sm(e,t,s,t.pendingProps);case 24:on(t,st,e.memoizedState.cache)}return Ba(e,t,s)}function Rm(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!vu(e,s)&&(t.flags&128)===0)return it=!1,eb(e,t,s);it=(e.flags&131072)!==0}else it=!1,ke&&(t.flags&1048576)!==0&&uh(t,Vr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Gn(t.elementType),t.type=e,typeof e=="function")Sc(e)?(i=Jn(e,i),t.tag=1,t=Tm(null,t,e,i,s)):(t.tag=0,t=du(null,t,e,i,s));else{if(e!=null){var u=e.$$typeof;if(u===G){t.tag=11,t=xm(null,t,e,i,s);break e}else if(u===P){t.tag=14,t=wm(null,t,e,i,s);break e}}throw t=nt(e)||e,Error(l(306,t,""))}}return t;case 0:return du(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,u=Jn(i,t.pendingProps),Tm(e,t,i,u,s);case 3:e:{if(Pe(t,t.stateNode.containerInfo),e===null)throw Error(l(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,Bc(e,t),Qr(t,i,null,s);var y=t.memoizedState;if(i=y.cache,on(t,st,i),i!==f.cache&&Rc(t,[st],s,!0),Xr(),i=y.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Am(e,t,i,s);break e}else if(i!==u){u=Wt(Error(l(424)),t),Ir(u),t=Am(e,t,i,s);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ye=sa(e.firstChild),wt=t,ke=!0,rn=null,aa=!0,s=Sh(t,null,i,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if($n(),i===u){t=Ba(e,t,s);break e}St(e,t,i,s)}t=t.child}return t;case 26:return Rl(e,t),e===null?(s=Ip(t.type,null,t.pendingProps,null))?t.memoizedState=s:ke||(s=t.type,e=t.pendingProps,i=Xl(ve.current).createElement(s),i[xt]=t,i[Rt]=e,jt(i,s,e),pt(i),t.stateNode=i):t.memoizedState=Ip(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ke&&(i=t.stateNode=$p(t.type,t.pendingProps,ve.current),wt=t,aa=!0,u=Ye,wn(t.type)?(Zu=u,Ye=sa(i.firstChild)):Ye=u),St(e,t,t.pendingProps.children,s),Rl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ke&&((u=i=Ye)&&(i=kb(i,t.type,t.pendingProps,aa),i!==null?(t.stateNode=i,wt=t,Ye=sa(i.firstChild),aa=!1,u=!0):u=!1),u||ln(t)),Tt(t),u=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,i=f.children,Ku(u,f)?i=null:y!==null&&Ku(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=Pc(e,t,P0,null,null,s),gi._currentValue=u),Rl(e,t),St(e,t,i,s),t.child;case 6:return e===null&&ke&&((e=s=Ye)&&(s=Ob(s,t.pendingProps,aa),s!==null?(t.stateNode=s,wt=t,Ye=null,e=!0):e=!1),e||ln(t)),null;case 13:return Cm(e,t,s);case 4:return Pe(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Kn(t,null,i,s):St(e,t,i,s),t.child;case 11:return xm(e,t,t.type,t.pendingProps,s);case 7:return St(e,t,t.pendingProps,s),t.child;case 8:return St(e,t,t.pendingProps.children,s),t.child;case 12:return St(e,t,t.pendingProps.children,s),t.child;case 10:return i=t.pendingProps,on(t,t.type,i.value),St(e,t,i.children,s),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Vn(t),u=_t(u),i=i(u),t.flags|=1,St(e,t,i,s),t.child;case 14:return wm(e,t,t.type,t.pendingProps,s);case 15:return _m(e,t,t.type,t.pendingProps,s);case 19:return Om(e,t,s);case 31:return W0(e,t,s);case 22:return Sm(e,t,s,t.pendingProps);case 24:return Vn(t),i=_t(st),e===null?(u=zc(),u===null&&(u=Ie,f=Dc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=s),u=f),t.memoizedState={parent:i,cache:u},Lc(t),on(t,st,u)):((e.lanes&s)!==0&&(Bc(e,t),Qr(t,null,null,s),Xr()),u=e.memoizedState,f=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),on(t,st,i)):(i=f.cache,on(t,st,i),i!==u.cache&&Rc(t,[st],s,!0))),St(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function qa(e){e.flags|=4}function bu(e,t,s,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(rp())e.flags|=8192;else throw Pn=yl,Uc}else e.flags&=-16777217}function Dm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Jp(t))if(rp())e.flags|=8192;else throw Pn=yl,Uc}function Ml(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ga():536870912,e.lanes|=t,Ys|=t)}function ai(e,t){if(!ke)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Je(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,i=0;if(t)for(var u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=s,t}function tb(e,t,s){var i=t.pendingProps;switch(Tc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return Je(t),null;case 3:return s=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),za(st),Le(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Ms(t)?qa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Cc())),Je(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(qa(t),f!==null?(Je(t),Dm(t,f)):(Je(t),bu(t,u,null,i,s))):f?f!==e.memoizedState?(qa(t),Je(t),Dm(t,f)):(Je(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&qa(t),Je(t),bu(t,u,e,i,s)),null;case 27:if(vt(t),s=ve.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&qa(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Je(t),null}e=F.current,Ms(t)?fh(t):(e=$p(u,i,s),t.stateNode=e,qa(t))}return Je(t),null;case 5:if(vt(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&qa(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Je(t),null}if(f=F.current,Ms(t))fh(t);else{var y=Xl(ve.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[xt]=t,f[Rt]=i;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=f;e:switch(jt(f,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&qa(t)}}return Je(t),bu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&qa(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(l(166));if(e=ve.current,Ms(t)){if(e=t.stateNode,s=t.memoizedProps,i=null,u=wt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[xt]=t,e=!!(e.nodeValue===s||i!==null&&i.suppressHydrationWarning===!0||Cp(e.nodeValue,s)),e||ln(t,!0)}else e=Xl(e).createTextNode(i),e[xt]=t,t.stateNode=e}return Je(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=Ms(t),s!==null){if(e===null){if(!i)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[xt]=t}else $n(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),e=!1}else s=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(It(t),t):(It(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Je(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Ms(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(l(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(l(317));u[xt]=t}else $n(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),u=!1}else u=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(It(t),t):(It(t),null)}return It(t),(t.flags&128)!==0?(t.lanes=s,t):(s=i!==null,e=e!==null&&e.memoizedState!==null,s&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==u&&(i.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),Ml(t,t.updateQueue),Je(t),null);case 4:return Le(),e===null&&Hu(t.stateNode.containerInfo),Je(t),null;case 10:return za(t.type),Je(t),null;case 19:if(H(tt),i=t.memoizedState,i===null)return Je(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)ai(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=wl(e),f!==null){for(t.flags|=128,ai(i,!1),e=f.updateQueue,t.updateQueue=e,Ml(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)lh(s,e),s=s.sibling;return Y(tt,tt.current&1|2),ke&&Da(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&mt()>ql&&(t.flags|=128,u=!0,ai(i,!1),t.lanes=4194304)}else{if(!u)if(e=wl(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Ml(t,e),ai(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!ke)return Je(t),null}else 2*mt()-i.renderingStartTime>ql&&s!==536870912&&(t.flags|=128,u=!0,ai(i,!1),t.lanes=4194304);i.isBackwards?(f.sibling=t.child,t.child=f):(e=i.last,e!==null?e.sibling=f:t.child=f,i.last=f)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=mt(),e.sibling=null,s=tt.current,Y(tt,u?s&1|2:s&1),ke&&Da(t,i.treeForkCount),e):(Je(t),null);case 22:case 23:return It(t),Vc(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(s&536870912)!==0&&(t.flags&128)===0&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),s=t.updateQueue,s!==null&&Ml(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==s&&(t.flags|=2048),e!==null&&H(In),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),za(st),Je(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function ab(e,t){switch(Tc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return za(st),Le(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return vt(t),null;case 31:if(t.memoizedState!==null){if(It(t),t.alternate===null)throw Error(l(340));$n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(It(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));$n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return H(tt),null;case 4:return Le(),null;case 10:return za(t.type),null;case 22:case 23:return It(t),Vc(),e!==null&&H(In),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return za(st),null;case 25:return null;default:return null}}function Mm(e,t){switch(Tc(t),t.tag){case 3:za(st),Le();break;case 26:case 27:case 5:vt(t);break;case 4:Le();break;case 31:t.memoizedState!==null&&It(t);break;case 13:It(t);break;case 19:H(tt);break;case 10:za(t.type);break;case 22:case 23:It(t),Vc(),e!==null&&H(In);break;case 24:za(st)}}function ni(e,t){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var u=i.next;s=u;do{if((s.tag&e)===e){i=void 0;var f=s.create,y=s.inst;i=f(),y.destroy=i}s=s.next}while(s!==u)}}catch(b){Ue(t,t.return,b)}}function mn(e,t,s){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var f=u.next;i=f;do{if((i.tag&e)===e){var y=i.inst,b=y.destroy;if(b!==void 0){y.destroy=void 0,u=t;var j=s,D=b;try{D()}catch($){Ue(u,j,$)}}}i=i.next}while(i!==f)}}catch($){Ue(t,t.return,$)}}function zm(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Eh(t,s)}catch(i){Ue(e,e.return,i)}}}function Um(e,t,s){s.props=Jn(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){Ue(e,t,i)}}function si(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof s=="function"?e.refCleanup=s(i):s.current=i}}catch(u){Ue(e,t,u)}}function ba(e,t){var s=e.ref,i=e.refCleanup;if(s!==null)if(typeof i=="function")try{i()}catch(u){Ue(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(u){Ue(e,t,u)}else s.current=null}function Lm(e){var t=e.type,s=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&i.focus();break e;case"img":s.src?i.src=s.src:s.srcSet&&(i.srcset=s.srcSet)}}catch(u){Ue(e,e.return,u)}}function xu(e,t,s){try{var i=e.stateNode;jb(i,e.type,s,t),i[Rt]=t}catch(u){Ue(e,e.return,u)}}function Bm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wn(e.type)||e.tag===4}function wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Bm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&wn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _u(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(e),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=ka));else if(i!==4&&(i===27&&wn(e.type)&&(s=e.stateNode,t=null),e=e.child,e!==null))for(_u(e,t,s),e=e.sibling;e!==null;)_u(e,t,s),e=e.sibling}function zl(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(i!==4&&(i===27&&wn(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(zl(e,t,s),e=e.sibling;e!==null;)zl(e,t,s),e=e.sibling}function qm(e){var t=e.stateNode,s=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);jt(t,i,s),t[xt]=e,t[Rt]=s}catch(f){Ue(e,e.return,f)}}var $a=!1,lt=!1,Su=!1,$m=typeof WeakSet=="function"?WeakSet:Set,gt=null;function nb(e,t){if(e=e.containerInfo,Gu=ao,e=Ff(e),gc(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var i=s.getSelection&&s.getSelection();if(i&&i.rangeCount!==0){s=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{s.nodeType,f.nodeType}catch{s=null;break e}var y=0,b=-1,j=-1,D=0,$=0,I=e,M=null;t:for(;;){for(var U;I!==s||u!==0&&I.nodeType!==3||(b=y+u),I!==f||i!==0&&I.nodeType!==3||(j=y+i),I.nodeType===3&&(y+=I.nodeValue.length),(U=I.firstChild)!==null;)M=I,I=U;for(;;){if(I===e)break t;if(M===s&&++D===u&&(b=y),M===f&&++$===i&&(j=y),(U=I.nextSibling)!==null)break;I=M,M=I.parentNode}I=U}s=b===-1||j===-1?null:{start:b,end:j}}else s=null}s=s||{start:0,end:0}}else s=null;for(Pu={focusedElem:e,selectionRange:s},ao=!1,gt=t;gt!==null;)if(t=gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,gt=e;else for(;gt!==null;){switch(t=gt,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)u=e[s],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,s=t,u=f.memoizedProps,f=f.memoizedState,i=s.stateNode;try{var te=Jn(s.type,u);e=i.getSnapshotBeforeUpdate(te,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(fe){Ue(s,s.return,fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Ju(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ju(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=t.sibling,e!==null){e.return=t.return,gt=e;break}gt=t.return}}function Hm(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Va(e,s),i&4&&ni(5,s);break;case 1:if(Va(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(y){Ue(s,s.return,y)}else{var u=Jn(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Ue(s,s.return,y)}}i&64&&zm(s),i&512&&si(s,s.return);break;case 3:if(Va(e,s),i&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{Eh(e,t)}catch(y){Ue(s,s.return,y)}}break;case 27:t===null&&i&4&&qm(s);case 26:case 5:Va(e,s),t===null&&i&4&&Lm(s),i&512&&si(s,s.return);break;case 12:Va(e,s);break;case 31:Va(e,s),i&4&&Gm(e,s);break;case 13:Va(e,s),i&4&&Pm(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=fb.bind(null,s),Rb(e,s))));break;case 22:if(i=s.memoizedState!==null||$a,!i){t=t!==null&&t.memoizedState!==null||lt,u=$a;var f=lt;$a=i,(lt=t)&&!f?Ia(e,s,(s.subtreeFlags&8772)!==0):Va(e,s),$a=u,lt=f}break;case 30:break;default:Va(e,s)}}function Vm(e){var t=e.alternate;t!==null&&(e.alternate=null,Vm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Wo(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Xe=null,Mt=!1;function Ha(e,t,s){for(s=s.child;s!==null;)Im(e,t,s),s=s.sibling}function Im(e,t,s){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Dn,s)}catch{}switch(s.tag){case 26:lt||ba(s,t),Ha(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:lt||ba(s,t);var i=Xe,u=Mt;wn(s.type)&&(Xe=s.stateNode,Mt=!1),Ha(e,t,s),hi(s.stateNode),Xe=i,Mt=u;break;case 5:lt||ba(s,t);case 6:if(i=Xe,u=Mt,Xe=null,Ha(e,t,s),Xe=i,Mt=u,Xe!==null)if(Mt)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(s.stateNode)}catch(f){Ue(s,t,f)}else try{Xe.removeChild(s.stateNode)}catch(f){Ue(s,t,f)}break;case 18:Xe!==null&&(Mt?(e=Xe,zp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),tr(e)):zp(Xe,s.stateNode));break;case 4:i=Xe,u=Mt,Xe=s.stateNode.containerInfo,Mt=!0,Ha(e,t,s),Xe=i,Mt=u;break;case 0:case 11:case 14:case 15:mn(2,s,t),lt||mn(4,s,t),Ha(e,t,s);break;case 1:lt||(ba(s,t),i=s.stateNode,typeof i.componentWillUnmount=="function"&&Um(s,t,i)),Ha(e,t,s);break;case 21:Ha(e,t,s);break;case 22:lt=(i=lt)||s.memoizedState!==null,Ha(e,t,s),lt=i;break;default:Ha(e,t,s)}}function Gm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{tr(e)}catch(s){Ue(t,t.return,s)}}}function Pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{tr(e)}catch(s){Ue(t,t.return,s)}}function sb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $m),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $m),t;default:throw Error(l(435,e.tag))}}function Ul(e,t){var s=sb(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var u=hb.bind(null,e,i);i.then(u,u)}})}function zt(e,t){var s=t.deletions;if(s!==null)for(var i=0;i<s.length;i++){var u=s[i],f=e,y=t,b=y;e:for(;b!==null;){switch(b.tag){case 27:if(wn(b.type)){Xe=b.stateNode,Mt=!1;break e}break;case 5:Xe=b.stateNode,Mt=!1;break e;case 3:case 4:Xe=b.stateNode.containerInfo,Mt=!0;break e}b=b.return}if(Xe===null)throw Error(l(160));Im(f,y,u),Xe=null,Mt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Km(t,e),t=t.sibling}var oa=null;function Km(e,t){var s=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zt(t,e),Ut(e),i&4&&(mn(3,e,e.return),ni(3,e),mn(5,e,e.return));break;case 1:zt(t,e),Ut(e),i&512&&(lt||s===null||ba(s,s.return)),i&64&&$a&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?i:s.concat(i))));break;case 26:var u=oa;if(zt(t,e),Ut(e),i&512&&(lt||s===null||ba(s,s.return)),i&4){var f=s!==null?s.memoizedState:null;if(i=e.memoizedState,s===null)if(i===null)if(e.stateNode===null){e:{i=e.type,s=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Or]||f[xt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),jt(f,i,s),f[xt]=e,pt(f),i=f;break e;case"link":var y=Kp("link","href",u).get(i+(s.href||""));if(y){for(var b=0;b<y.length;b++)if(f=y[b],f.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&f.getAttribute("rel")===(s.rel==null?null:s.rel)&&f.getAttribute("title")===(s.title==null?null:s.title)&&f.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){y.splice(b,1);break t}}f=u.createElement(i),jt(f,i,s),u.head.appendChild(f);break;case"meta":if(y=Kp("meta","content",u).get(i+(s.content||""))){for(b=0;b<y.length;b++)if(f=y[b],f.getAttribute("content")===(s.content==null?null:""+s.content)&&f.getAttribute("name")===(s.name==null?null:s.name)&&f.getAttribute("property")===(s.property==null?null:s.property)&&f.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&f.getAttribute("charset")===(s.charSet==null?null:s.charSet)){y.splice(b,1);break t}}f=u.createElement(i),jt(f,i,s),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[xt]=e,pt(f),i=f}e.stateNode=i}else Yp(u,e.type,e.stateNode);else e.stateNode=Pp(u,i,e.memoizedProps);else f!==i?(f===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):f.count--,i===null?Yp(u,e.type,e.stateNode):Pp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&xu(e,e.memoizedProps,s.memoizedProps)}break;case 27:zt(t,e),Ut(e),i&512&&(lt||s===null||ba(s,s.return)),s!==null&&i&4&&xu(e,e.memoizedProps,s.memoizedProps);break;case 5:if(zt(t,e),Ut(e),i&512&&(lt||s===null||ba(s,s.return)),e.flags&32){u=e.stateNode;try{js(u,"")}catch(te){Ue(e,e.return,te)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,xu(e,u,s!==null?s.memoizedProps:u)),i&1024&&(Su=!0);break;case 6:if(zt(t,e),Ut(e),i&4){if(e.stateNode===null)throw Error(l(162));i=e.memoizedProps,s=e.stateNode;try{s.nodeValue=i}catch(te){Ue(e,e.return,te)}}break;case 3:if(Fl=null,u=oa,oa=Ql(t.containerInfo),zt(t,e),oa=u,Ut(e),i&4&&s!==null&&s.memoizedState.isDehydrated)try{tr(t.containerInfo)}catch(te){Ue(e,e.return,te)}Su&&(Su=!1,Ym(e));break;case 4:i=oa,oa=Ql(e.stateNode.containerInfo),zt(t,e),Ut(e),oa=i;break;case 12:zt(t,e),Ut(e);break;case 31:zt(t,e),Ut(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ul(e,i)));break;case 13:zt(t,e),Ut(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Bl=mt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ul(e,i)));break;case 22:u=e.memoizedState!==null;var j=s!==null&&s.memoizedState!==null,D=$a,$=lt;if($a=D||u,lt=$||j,zt(t,e),lt=$,$a=D,Ut(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(s===null||j||$a||lt||Xn(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){j=s=t;try{if(f=j.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=j.stateNode;var I=j.memoizedProps.style,M=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=M==null||typeof M=="boolean"?"":(""+M).trim()}}catch(te){Ue(j,j.return,te)}}}else if(t.tag===6){if(s===null){j=t;try{j.stateNode.nodeValue=u?"":j.memoizedProps}catch(te){Ue(j,j.return,te)}}}else if(t.tag===18){if(s===null){j=t;try{var U=j.stateNode;u?Up(U,!0):Up(j.stateNode,!1)}catch(te){Ue(j,j.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;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(s=i.retryQueue,s!==null&&(i.retryQueue=null,Ul(e,s))));break;case 19:zt(t,e),Ut(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Ul(e,i)));break;case 30:break;case 21:break;default:zt(t,e),Ut(e)}}function Ut(e){var t=e.flags;if(t&2){try{for(var s,i=e.return;i!==null;){if(Bm(i)){s=i;break}i=i.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var u=s.stateNode,f=wu(e);zl(e,f,u);break;case 5:var y=s.stateNode;s.flags&32&&(js(y,""),s.flags&=-33);var b=wu(e);zl(e,b,y);break;case 3:case 4:var j=s.stateNode.containerInfo,D=wu(e);_u(e,D,j);break;default:throw Error(l(161))}}catch($){Ue(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ym(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ym(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Va(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Hm(e,t.alternate,t),t=t.sibling}function Xn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:mn(4,t,t.return),Xn(t);break;case 1:ba(t,t.return);var s=t.stateNode;typeof s.componentWillUnmount=="function"&&Um(t,t.return,s),Xn(t);break;case 27:hi(t.stateNode);case 26:case 5:ba(t,t.return),Xn(t);break;case 22:t.memoizedState===null&&Xn(t);break;case 30:Xn(t);break;default:Xn(t)}e=e.sibling}}function Ia(e,t,s){for(s=s&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,y=f.flags;switch(f.tag){case 0:case 11:case 15:Ia(u,f,s),ni(4,f);break;case 1:if(Ia(u,f,s),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(D){Ue(i,i.return,D)}if(i=f,u=i.updateQueue,u!==null){var b=i.stateNode;try{var j=u.shared.hiddenCallbacks;if(j!==null)for(u.shared.hiddenCallbacks=null,u=0;u<j.length;u++)jh(j[u],b)}catch(D){Ue(i,i.return,D)}}s&&y&64&&zm(f),si(f,f.return);break;case 27:qm(f);case 26:case 5:Ia(u,f,s),s&&i===null&&y&4&&Lm(f),si(f,f.return);break;case 12:Ia(u,f,s);break;case 31:Ia(u,f,s),s&&y&4&&Gm(u,f);break;case 13:Ia(u,f,s),s&&y&4&&Pm(u,f);break;case 22:f.memoizedState===null&&Ia(u,f,s),si(f,f.return);break;case 30:break;default:Ia(u,f,s)}t=t.sibling}}function ju(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Gr(s))}function Eu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gr(e))}function ca(e,t,s,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Jm(e,t,s,i),t=t.sibling}function Jm(e,t,s,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ca(e,t,s,i),u&2048&&ni(9,t);break;case 1:ca(e,t,s,i);break;case 3:ca(e,t,s,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gr(e)));break;case 12:if(u&2048){ca(e,t,s,i),e=t.stateNode;try{var f=t.memoizedProps,y=f.id,b=f.onPostCommit;typeof b=="function"&&b(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(j){Ue(t,t.return,j)}}else ca(e,t,s,i);break;case 31:ca(e,t,s,i);break;case 13:ca(e,t,s,i);break;case 23:break;case 22:f=t.stateNode,y=t.alternate,t.memoizedState!==null?f._visibility&2?ca(e,t,s,i):ri(e,t):f._visibility&2?ca(e,t,s,i):(f._visibility|=2,Gs(e,t,s,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&ju(y,t);break;case 24:ca(e,t,s,i),u&2048&&Eu(t.alternate,t);break;default:ca(e,t,s,i)}}function Gs(e,t,s,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,y=t,b=s,j=i,D=y.flags;switch(y.tag){case 0:case 11:case 15:Gs(f,y,b,j,u),ni(8,y);break;case 23:break;case 22:var $=y.stateNode;y.memoizedState!==null?$._visibility&2?Gs(f,y,b,j,u):ri(f,y):($._visibility|=2,Gs(f,y,b,j,u)),u&&D&2048&&ju(y.alternate,y);break;case 24:Gs(f,y,b,j,u),u&&D&2048&&Eu(y.alternate,y);break;default:Gs(f,y,b,j,u)}t=t.sibling}}function ri(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,i=t,u=i.flags;switch(i.tag){case 22:ri(s,i),u&2048&&ju(i.alternate,i);break;case 24:ri(s,i),u&2048&&Eu(i.alternate,i);break;default:ri(s,i)}t=t.sibling}}var ii=8192;function Ps(e,t,s){if(e.subtreeFlags&ii)for(e=e.child;e!==null;)Xm(e,t,s),e=e.sibling}function Xm(e,t,s){switch(e.tag){case 26:Ps(e,t,s),e.flags&ii&&e.memoizedState!==null&&Gb(s,oa,e.memoizedState,e.memoizedProps);break;case 5:Ps(e,t,s);break;case 3:case 4:var i=oa;oa=Ql(e.stateNode.containerInfo),Ps(e,t,s),oa=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=ii,ii=16777216,Ps(e,t,s),ii=i):Ps(e,t,s));break;default:Ps(e,t,s)}}function Qm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function li(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];gt=i,Fm(i,e)}Qm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zm(e),e=e.sibling}function Zm(e){switch(e.tag){case 0:case 11:case 15:li(e),e.flags&2048&&mn(9,e,e.return);break;case 3:li(e);break;case 12:li(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ll(e)):li(e);break;default:li(e)}}function Ll(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];gt=i,Fm(i,e)}Qm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:mn(8,t,t.return),Ll(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,Ll(t));break;default:Ll(t)}e=e.sibling}}function Fm(e,t){for(;gt!==null;){var s=gt;switch(s.tag){case 0:case 11:case 15:mn(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var i=s.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Gr(s.memoizedState.cache)}if(i=s.child,i!==null)i.return=s,gt=i;else e:for(s=e;gt!==null;){i=gt;var u=i.sibling,f=i.return;if(Vm(i),i===s){gt=null;break e}if(u!==null){u.return=f,gt=u;break e}gt=f}}}var rb={getCacheForType:function(e){var t=_t(st),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return _t(st).controller.signal}},ib=typeof WeakMap=="function"?WeakMap:Map,Me=0,Ie=null,je=null,Te=0,ze=0,Gt=null,pn=!1,Ks=!1,Nu=!1,Ga=0,We=0,gn=0,Qn=0,Tu=0,Pt=0,Ys=0,oi=null,Lt=null,Au=!1,Bl=0,Wm=0,ql=1/0,$l=null,yn=null,ut=0,vn=null,Js=null,Pa=0,Cu=0,ku=null,ep=null,ci=0,Ou=null;function Kt(){return(Me&2)!==0&&Te!==0?Te&-Te:L.T!==null?Lu():gf()}function tp(){if(Pt===0)if((Te&536870912)===0||ke){var e=ps;ps<<=1,(ps&3932160)===0&&(ps=262144),Pt=e}else Pt=536870912;return e=Vt.current,e!==null&&(e.flags|=32),Pt}function Bt(e,t,s){(e===Ie&&(ze===2||ze===9)||e.cancelPendingCommit!==null)&&(Xs(e,0),bn(e,Te,Pt,!1)),tn(e,s),((Me&2)===0||e!==Ie)&&(e===Ie&&((Me&2)===0&&(Qn|=s),We===4&&bn(e,Te,Pt,!1)),xa(e))}function ap(e,t,s){if((Me&6)!==0)throw Error(l(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||se(e,t),u=i?cb(e,t):Du(e,t,!0),f=i;do{if(u===0){Ks&&!i&&bn(e,t,0,!1);break}else{if(s=e.current.alternate,f&&!lb(s)){u=Du(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var b=e;u=oi;var j=b.current.memoizedState.isDehydrated;if(j&&(Xs(b,y).flags|=256),y=Du(b,y,!1),y!==2){if(Nu&&!j){b.errorRecoveryDisabledLanes|=f,Qn|=f,u=4;break e}f=Lt,Lt=u,f!==null&&(Lt===null?Lt=f:Lt.push.apply(Lt,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){Xs(e,0),bn(e,t,0,!0);break}e:{switch(i=e,f=u,f){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:bn(i,t,Pt,!pn);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Bl+300-mt(),10<u)){if(bn(i,t,Pt,!pn),z(i,0,!0)!==0)break e;Pa=t,i.timeoutHandle=Dp(np.bind(null,i,s,Lt,$l,Au,t,Pt,Qn,Ys,pn,f,"Throttled",-0,0),u);break e}np(i,s,Lt,$l,Au,t,Pt,Qn,Ys,pn,f,null,-0,0)}}break}while(!0);xa(e)}function np(e,t,s,i,u,f,y,b,j,D,$,I,M,U){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ka},Xm(t,f,I);var te=(f&62914560)===f?Bl-mt():(f&4194048)===f?Wm-mt():0;if(te=Pb(I,te),te!==null){Pa=f,e.cancelPendingCommit=te(dp.bind(null,e,t,f,s,i,u,y,b,j,$,I,null,M,U)),bn(e,f,y,!D);return}}dp(e,t,f,s,i,u,y,b,j)}function lb(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var i=0;i<s.length;i++){var u=s[i],f=u.getSnapshot;u=u.value;try{if(!$t(f(),u))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bn(e,t,s,i){t&=~Tu,t&=~Qn,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-kt(u),y=1<<f;i[f]=-1,u&=~y}s!==0&&Xi(e,s,t)}function Hl(){return(Me&6)===0?(ui(0),!1):!0}function Ru(){if(je!==null){if(ze===0)var e=je.return;else e=je,Ma=Hn=null,Jc(e),qs=null,Kr=0,e=je;for(;e!==null;)Mm(e.alternate,e),e=e.return;je=null}}function Xs(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Tb(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Pa=0,Ru(),Ie=e,je=s=Ra(e.current,null),Te=t,ze=0,Gt=null,pn=!1,Ks=se(e,t),Nu=!1,Ys=Pt=Tu=Qn=gn=We=0,Lt=oi=null,Au=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-kt(i),f=1<<u;t|=e[u],i&=~f}return Ga=t,ol(),s}function sp(e,t){we=null,L.H=ei,t===Bs||t===gl?(t=xh(),ze=3):t===Uc?(t=xh(),ze=4):ze=t===uu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Gt=t,je===null&&(We=1,kl(e,Wt(t,e.current)))}function rp(){var e=Vt.current;return e===null?!0:(Te&4194048)===Te?na===null:(Te&62914560)===Te||(Te&536870912)!==0?e===na:!1}function ip(){var e=L.H;return L.H=ei,e===null?ei:e}function lp(){var e=L.A;return L.A=rb,e}function Vl(){We=4,pn||(Te&4194048)!==Te&&Vt.current!==null||(Ks=!0),(gn&134217727)===0&&(Qn&134217727)===0||Ie===null||bn(Ie,Te,Pt,!1)}function Du(e,t,s){var i=Me;Me|=2;var u=ip(),f=lp();(Ie!==e||Te!==t)&&($l=null,Xs(e,t)),t=!1;var y=We;e:do try{if(ze!==0&&je!==null){var b=je,j=Gt;switch(ze){case 8:Ru(),y=6;break e;case 3:case 2:case 9:case 6:Vt.current===null&&(t=!0);var D=ze;if(ze=0,Gt=null,Qs(e,b,j,D),s&&Ks){y=0;break e}break;default:D=ze,ze=0,Gt=null,Qs(e,b,j,D)}}ob(),y=We;break}catch($){sp(e,$)}while(!0);return t&&e.shellSuspendCounter++,Ma=Hn=null,Me=i,L.H=u,L.A=f,je===null&&(Ie=null,Te=0,ol()),y}function ob(){for(;je!==null;)op(je)}function cb(e,t){var s=Me;Me|=2;var i=ip(),u=lp();Ie!==e||Te!==t?($l=null,ql=mt()+500,Xs(e,t)):Ks=se(e,t);e:do try{if(ze!==0&&je!==null){t=je;var f=Gt;t:switch(ze){case 1:ze=0,Gt=null,Qs(e,t,f,1);break;case 2:case 9:if(vh(f)){ze=0,Gt=null,cp(t);break}t=function(){ze!==2&&ze!==9||Ie!==e||(ze=7),xa(e)},f.then(t,t);break e;case 3:ze=7;break e;case 4:ze=5;break e;case 7:vh(f)?(ze=0,Gt=null,cp(t)):(ze=0,Gt=null,Qs(e,t,f,7));break;case 5:var y=null;switch(je.tag){case 26:y=je.memoizedState;case 5:case 27:var b=je;if(y?Jp(y):b.stateNode.complete){ze=0,Gt=null;var j=b.sibling;if(j!==null)je=j;else{var D=b.return;D!==null?(je=D,Il(D)):je=null}break t}}ze=0,Gt=null,Qs(e,t,f,5);break;case 6:ze=0,Gt=null,Qs(e,t,f,6);break;case 8:Ru(),We=6;break e;default:throw Error(l(462))}}ub();break}catch($){sp(e,$)}while(!0);return Ma=Hn=null,L.H=i,L.A=u,Me=s,je!==null?0:(Ie=null,Te=0,ol(),We)}function ub(){for(;je!==null&&!Ii();)op(je)}function op(e){var t=Rm(e.alternate,e,Ga);e.memoizedProps=e.pendingProps,t===null?Il(e):je=t}function cp(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Nm(s,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Nm(s,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:Jc(t);default:Mm(s,t),t=je=lh(t,Ga),t=Rm(s,t,Ga)}e.memoizedProps=e.pendingProps,t===null?Il(e):je=t}function Qs(e,t,s,i){Ma=Hn=null,Jc(t),qs=null,Kr=0;var u=t.return;try{if(F0(e,u,t,s,Te)){We=1,kl(e,Wt(s,e.current)),je=null;return}}catch(f){if(u!==null)throw je=u,f;We=1,kl(e,Wt(s,e.current)),je=null;return}t.flags&32768?(ke||i===1?e=!0:Ks||(Te&536870912)!==0?e=!1:(pn=e=!0,(i===2||i===9||i===3||i===6)&&(i=Vt.current,i!==null&&i.tag===13&&(i.flags|=16384))),up(t,e)):Il(t)}function Il(e){var t=e;do{if((t.flags&32768)!==0){up(t,pn);return}e=t.return;var s=tb(t.alternate,t,Ga);if(s!==null){je=s;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);We===0&&(We=5)}function up(e,t){do{var s=ab(e.alternate,e);if(s!==null){s.flags&=32767,je=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=s}while(e!==null);We=6,je=null}function dp(e,t,s,i,u,f,y,b,j){e.cancelPendingCommit=null;do Gl();while(ut!==0);if((Me&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=wc,ys(e,s,f,y,b,j),e===Ie&&(je=Ie=null,Te=0),Js=t,vn=e,Pa=s,Cu=f,ku=u,ep=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,mb(hs,function(){return gp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=L.T,L.T=null,u=Z.p,Z.p=2,y=Me,Me|=4;try{nb(e,t,s)}finally{Me=y,Z.p=u,L.T=i}}ut=1,fp(),hp(),mp()}}function fp(){if(ut===1){ut=0;var e=vn,t=Js,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=L.T,L.T=null;var i=Z.p;Z.p=2;var u=Me;Me|=4;try{Km(t,e);var f=Pu,y=Ff(e.containerInfo),b=f.focusedElem,j=f.selectionRange;if(y!==b&&b&&b.ownerDocument&&Zf(b.ownerDocument.documentElement,b)){if(j!==null&&gc(b)){var D=j.start,$=j.end;if($===void 0&&($=D),"selectionStart"in b)b.selectionStart=D,b.selectionEnd=Math.min($,b.value.length);else{var I=b.ownerDocument||document,M=I&&I.defaultView||window;if(M.getSelection){var U=M.getSelection(),te=b.textContent.length,fe=Math.min(j.start,te),$e=j.end===void 0?fe:Math.min(j.end,te);!U.extend&&fe>$e&&(y=$e,$e=fe,fe=y);var C=Qf(b,fe),T=Qf(b,$e);if(C&&T&&(U.rangeCount!==1||U.anchorNode!==C.node||U.anchorOffset!==C.offset||U.focusNode!==T.node||U.focusOffset!==T.offset)){var R=I.createRange();R.setStart(C.node,C.offset),U.removeAllRanges(),fe>$e?(U.addRange(R),U.extend(T.node,T.offset)):(R.setEnd(T.node,T.offset),U.addRange(R))}}}}for(I=[],U=b;U=U.parentNode;)U.nodeType===1&&I.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var V=I[b];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}ao=!!Gu,Pu=Gu=null}finally{Me=u,Z.p=i,L.T=s}}e.current=t,ut=2}}function hp(){if(ut===2){ut=0;var e=vn,t=Js,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=L.T,L.T=null;var i=Z.p;Z.p=2;var u=Me;Me|=4;try{Hm(e,t.alternate,t)}finally{Me=u,Z.p=i,L.T=s}}ut=3}}function mp(){if(ut===4||ut===3){ut=0,Gi();var e=vn,t=Js,s=Pa,i=ep;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ut=5:(ut=0,Js=vn=null,pp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(yn=null),Zo(s),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Dn,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=L.T,u=Z.p,Z.p=2,L.T=null;try{for(var f=e.onRecoverableError,y=0;y<i.length;y++){var b=i[y];f(b.value,{componentStack:b.stack})}}finally{L.T=t,Z.p=u}}(Pa&3)!==0&&Gl(),xa(e),u=e.pendingLanes,(s&261930)!==0&&(u&42)!==0?e===Ou?ci++:(ci=0,Ou=e):ci=0,ui(0)}}function pp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Gr(t)))}function Gl(){return fp(),hp(),mp(),gp()}function gp(){if(ut!==5)return!1;var e=vn,t=Cu;Cu=0;var s=Zo(Pa),i=L.T,u=Z.p;try{Z.p=32>s?32:s,L.T=null,s=ku,ku=null;var f=vn,y=Pa;if(ut=0,Js=vn=null,Pa=0,(Me&6)!==0)throw Error(l(331));var b=Me;if(Me|=4,Zm(f.current),Jm(f,f.current,y,s),Me=b,ui(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Dn,f)}catch{}return!0}finally{Z.p=u,L.T=i,pp(e,t)}}function yp(e,t,s){t=Wt(s,t),t=cu(e.stateNode,t,2),e=dn(e,t,2),e!==null&&(tn(e,2),xa(e))}function Ue(e,t,s){if(e.tag===3)yp(e,e,s);else for(;t!==null;){if(t.tag===3){yp(t,e,s);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(yn===null||!yn.has(i))){e=Wt(s,e),s=vm(2),i=dn(t,s,2),i!==null&&(bm(s,i,t,e),tn(i,2),xa(i));break}}t=t.return}}function Mu(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new ib;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(s)||(Nu=!0,u.add(s),e=db.bind(null,e,t,s),t.then(e,e))}function db(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Ie===e&&(Te&s)===s&&(We===4||We===3&&(Te&62914560)===Te&&300>mt()-Bl?(Me&2)===0&&Xs(e,0):Tu|=s,Ys===Te&&(Ys=0)),xa(e)}function vp(e,t){t===0&&(t=ga()),e=Bn(e,t),e!==null&&(tn(e,t),xa(e))}function fb(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),vp(e,s)}function hb(e,t){var s=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(s=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(l(314))}i!==null&&i.delete(t),vp(e,s)}function mb(e,t){return en(e,t)}var Pl=null,Zs=null,zu=!1,Kl=!1,Uu=!1,xn=0;function xa(e){e!==Zs&&e.next===null&&(Zs===null?Pl=Zs=e:Zs=Zs.next=e),Kl=!0,zu||(zu=!0,gb())}function ui(e,t){if(!Uu&&Kl){Uu=!0;do for(var s=!1,i=Pl;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var y=i.suspendedLanes,b=i.pingedLanes;f=(1<<31-kt(42|e)+1)-1,f&=u&~(y&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(s=!0,_p(i,f))}else f=Te,f=z(i,i===Ie?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||se(i,f)||(s=!0,_p(i,f));i=i.next}while(s);Uu=!1}}function pb(){bp()}function bp(){Kl=zu=!1;var e=0;xn!==0&&Nb()&&(e=xn);for(var t=mt(),s=null,i=Pl;i!==null;){var u=i.next,f=xp(i,t);f===0?(i.next=null,s===null?Pl=u:s.next=u,u===null&&(Zs=s)):(s=i,(e!==0||(f&3)!==0)&&(Kl=!0)),i=u}ut!==0&&ut!==5||ui(e),xn!==0&&(xn=0)}function xp(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-kt(f),b=1<<y,j=u[y];j===-1?((b&s)===0||(b&i)!==0)&&(u[y]=De(b,t)):j<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ie,s=Te,s=z(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(ze===2||ze===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&ds(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||se(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&ds(i),Zo(s)){case 2:case 8:s=Ki;break;case 32:s=hs;break;case 268435456:s=Yi;break;default:s=hs}return i=wp.bind(null,e),s=en(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&ds(i),e.callbackPriority=2,e.callbackNode=null,2}function wp(e,t){if(ut!==0&&ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Gl()&&e.callbackNode!==s)return null;var i=Te;return i=z(e,e===Ie?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(ap(e,i,t),xp(e,mt()),e.callbackNode!=null&&e.callbackNode===s?wp.bind(null,e):null)}function _p(e,t){if(Gl())return null;ap(e,t,!0)}function gb(){Ab(function(){(Me&6)!==0?en(Pi,pb):bp()})}function Lu(){if(xn===0){var e=Us;e===0&&(e=ms,ms<<=1,(ms&261888)===0&&(ms=256)),xn=e}return xn}function Sp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:el(""+e)}function jp(e,t){var s=t.ownerDocument.createElement("input");return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}function yb(e,t,s,i,u){if(t==="submit"&&s&&s.stateNode===u){var f=Sp((u[Rt]||null).action),y=i.submitter;y&&(t=(t=y[Rt]||null)?Sp(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var b=new sl("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(xn!==0){var j=y?jp(u,y):new FormData(u);nu(s,{pending:!0,data:j,method:u.method,action:f},null,j)}}else typeof f=="function"&&(b.preventDefault(),j=y?jp(u,y):new FormData(u),nu(s,{pending:!0,data:j,method:u.method,action:f},f,j))},currentTarget:u}]})}}for(var Bu=0;Bu<xc.length;Bu++){var qu=xc[Bu],vb=qu.toLowerCase(),bb=qu[0].toUpperCase()+qu.slice(1);la(vb,"on"+bb)}la(th,"onAnimationEnd"),la(ah,"onAnimationIteration"),la(nh,"onAnimationStart"),la("dblclick","onDoubleClick"),la("focusin","onFocus"),la("focusout","onBlur"),la(z0,"onTransitionRun"),la(U0,"onTransitionStart"),la(L0,"onTransitionCancel"),la(sh,"onTransitionEnd"),_s("onMouseEnter",["mouseout","mouseover"]),_s("onMouseLeave",["mouseout","mouseover"]),_s("onPointerEnter",["pointerout","pointerover"]),_s("onPointerLeave",["pointerout","pointerover"]),Mn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Mn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Mn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Mn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Mn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Mn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var di="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),xb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(di));function Ep(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var i=e[s],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var y=i.length-1;0<=y;y--){var b=i[y],j=b.instance,D=b.currentTarget;if(b=b.listener,j!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=D;try{f(u)}catch($){ll($)}u.currentTarget=null,f=j}else for(y=0;y<i.length;y++){if(b=i[y],j=b.instance,D=b.currentTarget,b=b.listener,j!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=D;try{f(u)}catch($){ll($)}u.currentTarget=null,f=j}}}}function Ee(e,t){var s=t[Fo];s===void 0&&(s=t[Fo]=new Set);var i=e+"__bubble";s.has(i)||(Np(t,e,2,!1),s.add(i))}function $u(e,t,s){var i=0;t&&(i|=4),Np(s,e,i,t)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function Hu(e){if(!e[Yl]){e[Yl]=!0,bf.forEach(function(s){s!=="selectionchange"&&(xb.has(s)||$u(s,!1,e),$u(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yl]||(t[Yl]=!0,$u("selectionchange",!1,t))}}function Np(e,t,s,i){switch(tg(t)){case 2:var u=Jb;break;case 8:u=Xb;break;default:u=ad}s=u.bind(null,t,s,e),u=void 0,!lc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,s,{capture:!0,passive:u}):e.addEventListener(t,s,!0):u!==void 0?e.addEventListener(t,s,{passive:u}):e.addEventListener(t,s,!1)}function Vu(e,t,s,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var y=i.tag;if(y===3||y===4){var b=i.stateNode.containerInfo;if(b===u)break;if(y===4)for(y=i.return;y!==null;){var j=y.tag;if((j===3||j===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;b!==null;){if(y=bs(b),y===null)return;if(j=y.tag,j===5||j===6||j===26||j===27){i=f=y;continue e}b=b.parentNode}}i=i.return}Of(function(){var D=f,$=rc(s),I=[];e:{var M=rh.get(e);if(M!==void 0){var U=sl,te=e;switch(e){case"keypress":if(al(s)===0)break e;case"keydown":case"keyup":U=h0;break;case"focusin":te="focus",U=dc;break;case"focusout":te="blur",U=dc;break;case"beforeblur":case"afterblur":U=dc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":U=Mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=t0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=g0;break;case th:case ah:case nh:U=s0;break;case sh:U=v0;break;case"scroll":case"scrollend":U=Wv;break;case"wheel":U=x0;break;case"copy":case"cut":case"paste":U=i0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=Uf;break;case"toggle":case"beforetoggle":U=_0}var fe=(t&4)!==0,$e=!fe&&(e==="scroll"||e==="scrollend"),C=fe?M!==null?M+"Capture":null:M;fe=[];for(var T=D,R;T!==null;){var V=T;if(R=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||R===null||C===null||(V=Dr(T,C),V!=null&&fe.push(fi(T,V,R))),$e)break;T=T.return}0<fe.length&&(M=new U(M,te,null,s,$),I.push({event:M,listeners:fe}))}}if((t&7)===0){e:{if(M=e==="mouseover"||e==="pointerover",U=e==="mouseout"||e==="pointerout",M&&s!==sc&&(te=s.relatedTarget||s.fromElement)&&(bs(te)||te[vs]))break e;if((U||M)&&(M=$.window===$?$:(M=$.ownerDocument)?M.defaultView||M.parentWindow:window,U?(te=s.relatedTarget||s.toElement,U=D,te=te?bs(te):null,te!==null&&($e=d(te),fe=te.tag,te!==$e||fe!==5&&fe!==27&&fe!==6)&&(te=null)):(U=null,te=D),U!==te)){if(fe=Mf,V="onMouseLeave",C="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(fe=Uf,V="onPointerLeave",C="onPointerEnter",T="pointer"),$e=U==null?M:Rr(U),R=te==null?M:Rr(te),M=new fe(V,T+"leave",U,s,$),M.target=$e,M.relatedTarget=R,V=null,bs($)===D&&(fe=new fe(C,T+"enter",te,s,$),fe.target=R,fe.relatedTarget=$e,V=fe),$e=V,U&&te)t:{for(fe=wb,C=U,T=te,R=0,V=C;V;V=fe(V))R++;V=0;for(var ce=T;ce;ce=fe(ce))V++;for(;0<R-V;)C=fe(C),R--;for(;0<V-R;)T=fe(T),V--;for(;R--;){if(C===T||T!==null&&C===T.alternate){fe=C;break t}C=fe(C),T=fe(T)}fe=null}else fe=null;U!==null&&Tp(I,M,U,fe,!1),te!==null&&$e!==null&&Tp(I,$e,te,fe,!0)}}e:{if(M=D?Rr(D):window,U=M.nodeName&&M.nodeName.toLowerCase(),U==="select"||U==="input"&&M.type==="file")var Oe=Gf;else if(Vf(M))if(Pf)Oe=R0;else{Oe=k0;var ie=C0}else U=M.nodeName,!U||U.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?D&&nc(D.elementType)&&(Oe=Gf):Oe=O0;if(Oe&&(Oe=Oe(e,D))){If(I,Oe,s,$);break e}ie&&ie(e,M,D),e==="focusout"&&D&&M.type==="number"&&D.memoizedProps.value!=null&&ac(M,"number",M.value)}switch(ie=D?Rr(D):window,e){case"focusin":(Vf(ie)||ie.contentEditable==="true")&&(As=ie,yc=D,Hr=null);break;case"focusout":Hr=yc=As=null;break;case"mousedown":vc=!0;break;case"contextmenu":case"mouseup":case"dragend":vc=!1,Wf(I,s,$);break;case"selectionchange":if(M0)break;case"keydown":case"keyup":Wf(I,s,$)}var _e;if(hc)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else Ts?$f(e,s)&&(Ae="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Ae="onCompositionStart");Ae&&(Lf&&s.locale!=="ko"&&(Ts||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&Ts&&(_e=Rf()):(nn=$,oc="value"in nn?nn.value:nn.textContent,Ts=!0)),ie=Jl(D,Ae),0<ie.length&&(Ae=new zf(Ae,e,null,s,$),I.push({event:Ae,listeners:ie}),_e?Ae.data=_e:(_e=Hf(s),_e!==null&&(Ae.data=_e)))),(_e=j0?E0(e,s):N0(e,s))&&(Ae=Jl(D,"onBeforeInput"),0<Ae.length&&(ie=new zf("onBeforeInput","beforeinput",null,s,$),I.push({event:ie,listeners:Ae}),ie.data=_e)),yb(I,e,D,s,$)}Ep(I,t)})}function fi(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Jl(e,t){for(var s=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Dr(e,s),u!=null&&i.unshift(fi(e,u,f)),u=Dr(e,t),u!=null&&i.push(fi(e,u,f))),e.tag===3)return i;e=e.return}return[]}function wb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Tp(e,t,s,i,u){for(var f=t._reactName,y=[];s!==null&&s!==i;){var b=s,j=b.alternate,D=b.stateNode;if(b=b.tag,j!==null&&j===i)break;b!==5&&b!==26&&b!==27||D===null||(j=D,u?(D=Dr(s,f),D!=null&&y.unshift(fi(s,D,j))):u||(D=Dr(s,f),D!=null&&y.push(fi(s,D,j)))),s=s.return}y.length!==0&&e.push({event:t,listeners:y})}var _b=/\r\n?/g,Sb=/\u0000|\uFFFD/g;function Ap(e){return(typeof e=="string"?e:""+e).replace(_b,`
9
- `).replace(Sb,"")}function Cp(e,t){return t=Ap(t),Ap(e)===t}function qe(e,t,s,i,u,f){switch(s){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||js(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&js(e,""+i);break;case"className":Fi(e,"class",i);break;case"tabIndex":Fi(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Fi(e,s,i);break;case"style":Cf(e,i,f);break;case"data":if(t!=="object"){Fi(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=el(""+i),e.setAttribute(s,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(s==="formAction"?(t!=="input"&&qe(e,t,"name",u.name,u,null),qe(e,t,"formEncType",u.formEncType,u,null),qe(e,t,"formMethod",u.formMethod,u,null),qe(e,t,"formTarget",u.formTarget,u,null)):(qe(e,t,"encType",u.encType,u,null),qe(e,t,"method",u.method,u,null),qe(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=el(""+i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=ka);break;case"onScroll":i!=null&&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(s=i.__html,s!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}s=el(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""+i):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":i===!0?e.setAttribute(s,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(s,i):e.removeAttribute(s);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(s):e.setAttribute(s,i);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),Zi(e,"popover",i);break;case"xlinkActuate":Ca(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ca(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ca(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ca(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ca(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ca(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ca(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ca(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ca(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Zi(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=Zv.get(s)||s,Zi(e,s,i))}}function Iu(e,t,s,i,u,f){switch(s){case"style":Cf(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"children":typeof i=="string"?js(e,i):(typeof i=="number"||typeof i=="bigint")&&js(e,""+i);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"onClick":i!=null&&(e.onclick=ka);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xf.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(u=s.endsWith("Capture"),t=s.slice(2,u?s.length-7:void 0),f=e[Rt]||null,f=f!=null?f[s]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,i,u);break e}s in e?e[s]=i:i===!0?e.setAttribute(s,""):Zi(e,s,i)}}}function jt(e,t,s){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 s)if(s.hasOwnProperty(f)){var y=s[f];if(y!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:qe(e,t,f,y,s,null)}}u&&qe(e,t,"srcSet",s.srcSet,s,null),i&&qe(e,t,"src",s.src,s,null);return;case"input":Ee("invalid",e);var b=f=y=u=null,j=null,D=null;for(i in s)if(s.hasOwnProperty(i)){var $=s[i];if($!=null)switch(i){case"name":u=$;break;case"type":y=$;break;case"checked":j=$;break;case"defaultChecked":D=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(l(137,t));break;default:qe(e,t,i,$,s,null)}}Ef(e,f,b,j,D,y,u,!1);return;case"select":Ee("invalid",e),i=y=f=null;for(u in s)if(s.hasOwnProperty(u)&&(b=s[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":y=b;break;case"multiple":i=b;default:qe(e,t,u,b,s,null)}t=f,s=y,e.multiple=!!i,t!=null?Ss(e,!!i,t,!1):s!=null&&Ss(e,!!i,s,!0);return;case"textarea":Ee("invalid",e),f=u=i=null;for(y in s)if(s.hasOwnProperty(y)&&(b=s[y],b!=null))switch(y){case"value":i=b;break;case"defaultValue":u=b;break;case"children":f=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(l(91));break;default:qe(e,t,y,b,s,null)}Tf(e,i,u,f);return;case"option":for(j in s)s.hasOwnProperty(j)&&(i=s[j],i!=null)&&(j==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":qe(e,t,j,i,s,null));return;case"dialog":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<di.length;i++)Ee(di[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(D in s)if(s.hasOwnProperty(D)&&(i=s[D],i!=null))switch(D){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:qe(e,t,D,i,s,null)}return;default:if(nc(t)){for($ in s)s.hasOwnProperty($)&&(i=s[$],i!==void 0&&Iu(e,t,$,i,s,void 0));return}}for(b in s)s.hasOwnProperty(b)&&(i=s[b],i!=null&&qe(e,t,b,i,s,null))}function jb(e,t,s,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,b=null,j=null,D=null,$=null;for(U in s){var I=s[U];if(s.hasOwnProperty(U)&&I!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":j=I;default:i.hasOwnProperty(U)||qe(e,t,U,null,i,I)}}for(var M in i){var U=i[M];if(I=s[M],i.hasOwnProperty(M)&&(U!=null||I!=null))switch(M){case"type":f=U;break;case"name":u=U;break;case"checked":D=U;break;case"defaultChecked":$=U;break;case"value":y=U;break;case"defaultValue":b=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:U!==I&&qe(e,t,M,U,i,I)}}tc(e,y,b,j,D,$,f,u);return;case"select":U=y=b=M=null;for(f in s)if(j=s[f],s.hasOwnProperty(f)&&j!=null)switch(f){case"value":break;case"multiple":U=j;default:i.hasOwnProperty(f)||qe(e,t,f,null,i,j)}for(u in i)if(f=i[u],j=s[u],i.hasOwnProperty(u)&&(f!=null||j!=null))switch(u){case"value":M=f;break;case"defaultValue":b=f;break;case"multiple":y=f;default:f!==j&&qe(e,t,u,f,i,j)}t=b,s=y,i=U,M!=null?Ss(e,!!s,M,!1):!!i!=!!s&&(t!=null?Ss(e,!!s,t,!0):Ss(e,!!s,s?[]:"",!1));return;case"textarea":U=M=null;for(b in s)if(u=s[b],s.hasOwnProperty(b)&&u!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:qe(e,t,b,null,i,u)}for(y in i)if(u=i[y],f=s[y],i.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":M=u;break;case"defaultValue":U=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&qe(e,t,y,u,i,f)}Nf(e,M,U);return;case"option":for(var te in s)M=s[te],s.hasOwnProperty(te)&&M!=null&&!i.hasOwnProperty(te)&&(te==="selected"?e.selected=!1:qe(e,t,te,null,i,M));for(j in i)M=i[j],U=s[j],i.hasOwnProperty(j)&&M!==U&&(M!=null||U!=null)&&(j==="selected"?e.selected=M&&typeof M!="function"&&typeof M!="symbol":qe(e,t,j,M,i,U));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var fe in s)M=s[fe],s.hasOwnProperty(fe)&&M!=null&&!i.hasOwnProperty(fe)&&qe(e,t,fe,null,i,M);for(D in i)if(M=i[D],U=s[D],i.hasOwnProperty(D)&&M!==U&&(M!=null||U!=null))switch(D){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(l(137,t));break;default:qe(e,t,D,M,i,U)}return;default:if(nc(t)){for(var $e in s)M=s[$e],s.hasOwnProperty($e)&&M!==void 0&&!i.hasOwnProperty($e)&&Iu(e,t,$e,void 0,i,M);for($ in i)M=i[$],U=s[$],!i.hasOwnProperty($)||M===U||M===void 0&&U===void 0||Iu(e,t,$,M,i,U);return}}for(var C in s)M=s[C],s.hasOwnProperty(C)&&M!=null&&!i.hasOwnProperty(C)&&qe(e,t,C,null,i,M);for(I in i)M=i[I],U=s[I],!i.hasOwnProperty(I)||M===U||M==null&&U==null||qe(e,t,I,M,i,U)}function kp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Eb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),i=0;i<s.length;i++){var u=s[i],f=u.transferSize,y=u.initiatorType,b=u.duration;if(f&&b&&kp(y)){for(y=0,b=u.responseEnd,i+=1;i<s.length;i++){var j=s[i],D=j.startTime;if(D>b)break;var $=j.transferSize,I=j.initiatorType;$&&kp(I)&&(j=j.responseEnd,y+=$*(j<b?1:(b-D)/(j-D)))}if(--i,t+=8*(f+y)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Gu=null,Pu=null;function Xl(e){return e.nodeType===9?e:e.ownerDocument}function Op(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Rp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ku(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Yu=null;function Nb(){var e=window.event;return e&&e.type==="popstate"?e===Yu?!1:(Yu=e,!0):(Yu=null,!1)}var Dp=typeof setTimeout=="function"?setTimeout:void 0,Tb=typeof clearTimeout=="function"?clearTimeout:void 0,Mp=typeof Promise=="function"?Promise:void 0,Ab=typeof queueMicrotask=="function"?queueMicrotask:typeof Mp<"u"?function(e){return Mp.resolve(null).then(e).catch(Cb)}:Dp;function Cb(e){setTimeout(function(){throw e})}function wn(e){return e==="head"}function zp(e,t){var s=t,i=0;do{var u=s.nextSibling;if(e.removeChild(s),u&&u.nodeType===8)if(s=u.data,s==="/$"||s==="/&"){if(i===0){e.removeChild(u),tr(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")hi(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,hi(s);for(var f=s.firstChild;f;){var y=f.nextSibling,b=f.nodeName;f[Or]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||s.removeChild(f),f=y}}else s==="body"&&hi(e.ownerDocument.body);s=u}while(s);tr(t)}function Up(e,t){var s=e;e=0;do{var i=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),i&&i.nodeType===8)if(s=i.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=i}while(s)}function Ju(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Ju(s),Wo(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function kb(e,t,s,i){for(;e.nodeType===1;){var u=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Or])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=sa(e.nextSibling),e===null)break}return null}function Ob(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=sa(e.nextSibling),e===null))return null;return e}function Lp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sa(e.nextSibling),e===null))return null;return e}function Xu(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Rb(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var i=function(){t(),s.removeEventListener("DOMContentLoaded",i)};s.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function sa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Zu=null;function Bp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return sa(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function qp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function $p(e,t,s){switch(t=Xl(s),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function hi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Wo(e)}var ra=new Map,Hp=new Set;function Ql(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ka=Z.d;Z.d={f:Db,r:Mb,D:zb,C:Ub,L:Lb,m:Bb,X:$b,S:qb,M:Hb};function Db(){var e=Ka.f(),t=Hl();return e||t}function Mb(e){var t=xs(e);t!==null&&t.tag===5&&t.type==="form"?sm(t):Ka.r(e)}var Fs=typeof document>"u"?null:document;function Vp(e,t,s){var i=Fs;if(i&&typeof t=="string"&&t){var u=Zt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),Hp.has(u)||(Hp.add(u),e={rel:e,crossOrigin:s,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),jt(t,"link",e),pt(t),i.head.appendChild(t)))}}function zb(e){Ka.D(e),Vp("dns-prefetch",e,null)}function Ub(e,t){Ka.C(e,t),Vp("preconnect",e,t)}function Lb(e,t,s){Ka.L(e,t,s);var i=Fs;if(i&&e&&t){var u='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+Zt(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+Zt(s.imageSizes)+'"]')):u+='[href="'+Zt(e)+'"]';var f=u;switch(t){case"style":f=Ws(e);break;case"script":f=er(e)}ra.has(f)||(e=x({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),ra.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(mi(f))||t==="script"&&i.querySelector(pi(f))||(t=i.createElement("link"),jt(t,"link",e),pt(t),i.head.appendChild(t)))}}function Bb(e,t){Ka.m(e,t);var s=Fs;if(s&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Zt(i)+'"][href="'+Zt(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=er(e)}if(!ra.has(f)&&(e=x({rel:"modulepreload",href:e},t),ra.set(f,e),s.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(pi(f)))return}i=s.createElement("link"),jt(i,"link",e),pt(i),s.head.appendChild(i)}}}function qb(e,t,s){Ka.S(e,t,s);var i=Fs;if(i&&e){var u=ws(i).hoistableStyles,f=Ws(e);t=t||"default";var y=u.get(f);if(!y){var b={loading:0,preload:null};if(y=i.querySelector(mi(f)))b.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},s),(s=ra.get(f))&&Fu(e,s);var j=y=i.createElement("link");pt(j),jt(j,"link",e),j._p=new Promise(function(D,$){j.onload=D,j.onerror=$}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Zl(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},u.set(f,y)}}}function $b(e,t){Ka.X(e,t);var s=Fs;if(s&&e){var i=ws(s).hoistableScripts,u=er(e),f=i.get(u);f||(f=s.querySelector(pi(u)),f||(e=x({src:e,async:!0},t),(t=ra.get(u))&&Wu(e,t),f=s.createElement("script"),pt(f),jt(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Hb(e,t){Ka.M(e,t);var s=Fs;if(s&&e){var i=ws(s).hoistableScripts,u=er(e),f=i.get(u);f||(f=s.querySelector(pi(u)),f||(e=x({src:e,async:!0,type:"module"},t),(t=ra.get(u))&&Wu(e,t),f=s.createElement("script"),pt(f),jt(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Ip(e,t,s,i){var u=(u=ve.current)?Ql(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(t=Ws(s.href),s=ws(u).hoistableStyles,i=s.get(t),i||(i={type:"style",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Ws(s.href);var f=ws(u).hoistableStyles,y=f.get(e);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,y),(f=u.querySelector(mi(e)))&&!f._p&&(y.instance=f,y.state.loading=5),ra.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ra.set(e,s),f||Vb(u,e,s,y.state))),t&&i===null)throw Error(l(528,""));return y}if(t&&i!==null)throw Error(l(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=er(s),s=ws(u).hoistableScripts,i=s.get(t),i||(i={type:"script",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Ws(e){return'href="'+Zt(e)+'"'}function mi(e){return'link[rel="stylesheet"]['+e+"]"}function Gp(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function Vb(e,t,s,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),jt(t,"link",s),pt(t),e.head.appendChild(t))}function er(e){return'[src="'+Zt(e)+'"]'}function pi(e){return"script[async]"+e}function Pp(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Zt(s.href)+'"]');if(i)return t.instance=i,pt(i),i;var u=x({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),pt(i),jt(i,"style",u),Zl(i,s.precedence,e),t.instance=i;case"stylesheet":u=Ws(s.href);var f=e.querySelector(mi(u));if(f)return t.state.loading|=4,t.instance=f,pt(f),f;i=Gp(s),(u=ra.get(u))&&Fu(i,u),f=(e.ownerDocument||e).createElement("link"),pt(f);var y=f;return y._p=new Promise(function(b,j){y.onload=b,y.onerror=j}),jt(f,"link",i),t.state.loading|=4,Zl(f,s.precedence,e),t.instance=f;case"script":return f=er(s.src),(u=e.querySelector(pi(f)))?(t.instance=u,pt(u),u):(i=s,(u=ra.get(f))&&(i=x({},s),Wu(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),pt(u),jt(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Zl(i,s.precedence,e));return t.instance}function Zl(e,t,s){for(var i=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,y=0;y<i.length;y++){var b=i[y];if(b.dataset.precedence===t)f=b;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function Fu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Wu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Fl=null;function Kp(e,t,s){if(Fl===null){var i=new Map,u=Fl=new Map;u.set(s,i)}else u=Fl,i=u.get(s),i||(i=new Map,u.set(s,i));if(i.has(e))return i;for(i.set(e,null),s=s.getElementsByTagName(e),u=0;u<s.length;u++){var f=s[u];if(!(f[Or]||f[xt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(t)||"";y=e+y;var b=i.get(y);b?b.push(f):i.set(y,[f])}}return i}function Yp(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function Ib(e,t,s){if(s===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Jp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Gb(e,t,s,i){if(s.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var u=Ws(i.href),f=t.querySelector(mi(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wl.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=f,pt(f);return}f=t.ownerDocument||t,i=Gp(i),(u=ra.get(u))&&Fu(i,u),f=f.createElement("link"),pt(f);var y=f;y._p=new Promise(function(b,j){y.onload=b,y.onerror=j}),jt(f,"link",i),s.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=Wl.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var ed=0;function Pb(e,t){return e.stylesheets&&e.count===0&&to(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&to(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&ed===0&&(ed=62500*Eb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&to(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>ed?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)to(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var eo=null;function to(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,eo=new Map,t.forEach(Kb,e),eo=null,Wl.call(e))}function Kb(e,t){if(!(t.state.loading&4)){var s=eo.get(e);if(s)var i=s.get(null);else{s=new Map,eo.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(s.set(y.dataset.precedence,y),i=y)}i&&s.set(null,i)}u=t.instance,y=u.getAttribute("data-precedence"),f=s.get(y)||i,f===i&&s.set(null,u),s.set(y,u),this.count++,i=Wl.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var gi={$$typeof:B,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Yb(e,t,s,i,u,f,y,b,j){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=kr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kr(0),this.hiddenUpdates=kr(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function Xp(e,t,s,i,u,f,y,b,j,D,$,I){return e=new Yb(e,t,s,y,j,D,$,I,b),t=1,f===!0&&(t|=24),f=Ht(3,null,null,t),e.current=f,f.stateNode=e,t=Dc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:s,cache:t},Lc(f),e}function Qp(e){return e?(e=Os,e):Os}function Zp(e,t,s,i,u,f){u=Qp(u),i.context===null?i.context=u:i.pendingContext=u,i=un(t),i.payload={element:s},f=f===void 0?null:f,f!==null&&(i.callback=f),s=dn(e,i,t),s!==null&&(Bt(s,e,t),Jr(s,e,t))}function Fp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function td(e,t){Fp(e,t),(e=e.alternate)&&Fp(e,t)}function Wp(e){if(e.tag===13||e.tag===31){var t=Bn(e,67108864);t!==null&&Bt(t,e,67108864),td(e,67108864)}}function eg(e){if(e.tag===13||e.tag===31){var t=Kt();t=Qo(t);var s=Bn(e,t);s!==null&&Bt(s,e,t),td(e,t)}}var ao=!0;function Jb(e,t,s,i){var u=L.T;L.T=null;var f=Z.p;try{Z.p=2,ad(e,t,s,i)}finally{Z.p=f,L.T=u}}function Xb(e,t,s,i){var u=L.T;L.T=null;var f=Z.p;try{Z.p=8,ad(e,t,s,i)}finally{Z.p=f,L.T=u}}function ad(e,t,s,i){if(ao){var u=nd(i);if(u===null)Vu(e,t,i,no,s),ag(e,i);else if(Zb(u,e,t,s,i))i.stopPropagation();else if(ag(e,i),t&4&&-1<Qb.indexOf(e)){for(;u!==null;){var f=xs(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=Aa(f.pendingLanes);if(y!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;y;){var j=1<<31-kt(y);b.entanglements[1]|=j,y&=~j}xa(f),(Me&6)===0&&(ql=mt()+500,ui(0))}}break;case 31:case 13:b=Bn(f,2),b!==null&&Bt(b,f,2),Hl(),td(f,2)}if(f=nd(i),f===null&&Vu(e,t,i,no,s),f===u)break;u=f}u!==null&&i.stopPropagation()}else Vu(e,t,i,null,s)}}function nd(e){return e=rc(e),sd(e)}var no=null;function sd(e){if(no=null,e=bs(e),e!==null){var t=d(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=h(t),e!==null)return e;e=null}else if(s===31){if(e=m(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return no=e,null}function tg(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(fs()){case Pi:return 2;case Ki:return 8;case hs:case Po:return 32;case Yi:return 268435456;default:return 32}default:return 32}}var rd=!1,_n=null,Sn=null,jn=null,yi=new Map,vi=new Map,En=[],Qb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ag(e,t){switch(e){case"focusin":case"focusout":_n=null;break;case"dragenter":case"dragleave":Sn=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":yi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vi.delete(t.pointerId)}}function bi(e,t,s,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:s,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=xs(t),t!==null&&Wp(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Zb(e,t,s,i,u){switch(t){case"focusin":return _n=bi(_n,e,t,s,i,u),!0;case"dragenter":return Sn=bi(Sn,e,t,s,i,u),!0;case"mouseover":return jn=bi(jn,e,t,s,i,u),!0;case"pointerover":var f=u.pointerId;return yi.set(f,bi(yi.get(f)||null,e,t,s,i,u)),!0;case"gotpointercapture":return f=u.pointerId,vi.set(f,bi(vi.get(f)||null,e,t,s,i,u)),!0}return!1}function ng(e){var t=bs(e.target);if(t!==null){var s=d(t);if(s!==null){if(t=s.tag,t===13){if(t=h(s),t!==null){e.blockedOn=t,yf(e.priority,function(){eg(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,yf(e.priority,function(){eg(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function so(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=nd(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);sc=i,s.target.dispatchEvent(i),sc=null}else return t=xs(s),t!==null&&Wp(t),e.blockedOn=s,!1;t.shift()}return!0}function sg(e,t,s){so(e)&&s.delete(t)}function Fb(){rd=!1,_n!==null&&so(_n)&&(_n=null),Sn!==null&&so(Sn)&&(Sn=null),jn!==null&&so(jn)&&(jn=null),yi.forEach(sg),vi.forEach(sg)}function ro(e,t){e.blockedOn===t&&(e.blockedOn=null,rd||(rd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Fb)))}var io=null;function rg(e){io!==e&&(io=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){io===e&&(io=null);for(var t=0;t<e.length;t+=3){var s=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(sd(i||s)===null)continue;break}var f=xs(s);f!==null&&(e.splice(t,3),t-=3,nu(f,{pending:!0,data:u,method:s.method,action:i},i,u))}}))}function tr(e){function t(j){return ro(j,e)}_n!==null&&ro(_n,e),Sn!==null&&ro(Sn,e),jn!==null&&ro(jn,e),yi.forEach(t),vi.forEach(t);for(var s=0;s<En.length;s++){var i=En[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<En.length&&(s=En[0],s.blockedOn===null);)ng(s),s.blockedOn===null&&En.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(i=0;i<s.length;i+=3){var u=s[i],f=s[i+1],y=u[Rt]||null;if(typeof f=="function")y||rg(s);else if(y){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[Rt]||null)b=y.formAction;else if(sd(u)!==null)continue}else b=y.action;typeof b=="function"?s[i+1]=b:(s.splice(i,3),i-=3),rg(s)}}}function ig(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(s,20)}function s(){if(!i&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function id(e){this._internalRoot=e}lo.prototype.render=id.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var s=t.current,i=Kt();Zp(s,i,e,t,null,null)},lo.prototype.unmount=id.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zp(e.current,2,null,e,null,null),Hl(),t[vs]=null}};function lo(e){this._internalRoot=e}lo.prototype.unstable_scheduleHydration=function(e){if(e){var t=gf();e={blockedOn:null,target:e,priority:t};for(var s=0;s<En.length&&t!==0&&t<En[s].priority;s++);En.splice(s,0,e),s===0&&ng(e)}};var lg=a.version;if(lg!=="19.2.3")throw Error(l(527,lg,"19.2.3"));Z.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?v(e):null,e=e===null?null:e.stateNode,e};var Wb={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oo.isDisabled&&oo.supportsFiber)try{Dn=oo.inject(Wb),Ct=oo}catch{}}return wi.createRoot=function(e,t){if(!c(e))throw Error(l(299));var s=!1,i="",u=mm,f=pm,y=gm;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Xp(e,1,!1,null,null,s,i,null,u,f,y,ig),e[vs]=t.current,Hu(e),new id(t)},wi.hydrateRoot=function(e,t,s){if(!c(e))throw Error(l(299));var i=!1,u="",f=mm,y=pm,b=gm,j=null;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(y=s.onCaughtError),s.onRecoverableError!==void 0&&(b=s.onRecoverableError),s.formState!==void 0&&(j=s.formState)),t=Xp(e,1,!0,t,s??null,i,u,j,f,y,b,ig),t.context=Qp(null),s=t.current,i=Kt(),i=Qo(i),u=un(i),u.callback=null,dn(s,u,i),s=i,t.current.lanes=s,tn(t,s),xa(t),e[vs]=t.current,Hu(e),new lo(t)},wi.version="19.2.3",wi}var yg;function cx(){if(yg)return cd.exports;yg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),cd.exports=ox(),cd.exports}var ux=cx();const dx=Fd(ux);const fx=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hx=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),vg=n=>{const a=hx(n);return a.charAt(0).toUpperCase()+a.slice(1)},py=(...n)=>n.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),mx=n=>{for(const a in n)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var px={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const gx=w.forwardRef(({color:n="currentColor",size:a=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},g)=>w.createElement("svg",{ref:g,...px,width:a,height:a,stroke:n,strokeWidth:l?Number(r)*24/Number(a):r,className:py("lucide",c),...!d&&!mx(m)&&{"aria-hidden":"true"},...m},[...h.map(([p,v])=>w.createElement(p,v)),...Array.isArray(d)?d:[d]]));const le=(n,a)=>{const r=w.forwardRef(({className:l,...c},d)=>w.createElement(gx,{ref:d,iconNode:a,className:py(`lucide-${fx(vg(n))}`,`lucide-${n}`,l),...c}));return r.displayName=vg(n),r};const yx=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],vx=le("activity",yx);const bx=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],xx=le("archive",bx);const wx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],_x=le("arrow-left",wx);const Sx=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],jx=le("arrow-up-down",Sx);const Ex=[["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"}]],zo=le("brain",Ex);const Nx=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Tx=le("calendar",Nx);const Ax=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Cx=le("camera",Ax);const kx=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],gy=le("chart-column",kx);const Ox=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Qa=le("check",Ox);const Rx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Dx=le("chevron-down",Rx);const Mx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],zx=le("chevron-left",Mx);const Ux=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Lx=le("chevron-right",Ux);const Bx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],qx=le("chevron-up",Bx);const $x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],$i=le("circle-alert",$x);const Hx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],tf=le("circle-check-big",Hx);const Vx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],af=le("circle-check",Vx);const Ix=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Gx=le("circle-user",Ix);const Px=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Kx=le("circle-x",Px);const Yx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Uo=le("clock",Yx);const Jx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],gr=le("code",Jx);const Xx=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Qx=le("copy",Xx);const Zx=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],nf=le("cpu",Zx);const Fx=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],No=le("database",Fx);const Wx=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ai=le("external-link",Wx);const ew=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],tw=le("eye",ew);const aw=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],nw=le("flag",aw);const sw=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],rw=le("hash",sw);const iw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],wr=le("info",iw);const lw=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ow=le("key-round",lw);const cw=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],uw=le("key",cw);const dw=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],fw=le("layout-dashboard",dw);const hw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],qt=le("loader-circle",hw);const mw=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],pw=le("log-in",mw);const gw=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],yw=le("log-out",gw);const vw=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Dd=le("mail",vw);const bw=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],xw=le("minimize-2",bw);const ww=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_w=le("moon",ww);const Sw=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],bg=le("paperclip",Sw);const jw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],_i=le("plus",jw);const Ew=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],hd=le("power",Ew);const Nw=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_r=le("refresh-cw",Nw);const Tw=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],yy=le("rotate-ccw",Tw);const Aw=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Cw=le("save",Aw);const kw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ow=le("search",kw);const Rw=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Dw=le("send",Rw);const Mw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Md=le("settings",Mw);const zw=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Uw=le("settings-2",zw);const Lw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],zd=le("shield-check",Lw);const Bw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],qw=le("shield",Bw);const $w=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Hw=le("sun",$w);const Vw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ud=le("terminal",Vw);const Iw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],To=le("trash-2",Iw);const Gw=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Sr=le("triangle-alert",Gw);const Pw=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Kw=le("upload",Pw);const Yw=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Jw=le("user-plus",Yw);const Xw=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],vy=le("user",Xw);const Qw=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Zw=le("volume-2",Qw);const Fw=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Ww=le("volume-x",Fw);const e_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Lo=le("x",e_);const t_=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ao=le("zap",t_),a_={theme:"system",setTheme:()=>null},by=w.createContext(a_);function n_({children:n,defaultTheme:a="system",storageKey:r="vite-ui-theme"}){const[l,c]=w.useState(()=>localStorage.getItem(r)||a);w.useEffect(()=>{const h=window.document.documentElement;if(h.classList.remove("light","dark"),l==="system"){const m=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";h.classList.add(m);return}h.classList.add(l)},[l]);const d={theme:l,setTheme:h=>{localStorage.setItem(r,h),c(h)}};return o.jsx(by.Provider,{value:d,children:n})}const s_=()=>{const n=w.useContext(by);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n};function xg(n,a){if(typeof n=="function")return n(a);n!=null&&(n.current=a)}function Bo(...n){return a=>{let r=!1;const l=n.map(c=>{const d=xg(c,a);return!r&&typeof d=="function"&&(r=!0),d});if(r)return()=>{for(let c=0;c<l.length;c++){const d=l[c];typeof d=="function"?d():xg(n[c],null)}}}}function ls(...n){return w.useCallback(Bo(...n),n)}var r_=Symbol.for("react.lazy"),Co=ef[" use ".trim().toString()];function i_(n){return typeof n=="object"&&n!==null&&"then"in n}function xy(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===r_&&"_payload"in n&&i_(n._payload)}function wy(n){const a=o_(n),r=w.forwardRef((l,c)=>{let{children:d,...h}=l;xy(d)&&typeof Co=="function"&&(d=Co(d._payload));const m=w.Children.toArray(d),g=m.find(u_);if(g){const p=g.props.children,v=m.map(x=>x===g?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:x);return o.jsx(a,{...h,ref:c,children:w.isValidElement(p)?w.cloneElement(p,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}var l_=wy("Slot");function o_(n){const a=w.forwardRef((r,l)=>{let{children:c,...d}=r;if(xy(c)&&typeof Co=="function"&&(c=Co(c._payload)),w.isValidElement(c)){const h=f_(c),m=d_(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Bo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var c_=Symbol("radix.slottable");function u_(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===c_}function d_(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const g=d(...m);return c(...m),g}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function f_(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}function _y(n){var a,r,l="";if(typeof n=="string"||typeof n=="number")l+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(a=0;a<c;a++)n[a]&&(r=_y(n[a]))&&(l&&(l+=" "),l+=r)}else for(r in n)n[r]&&(l&&(l+=" "),l+=r);return l}function Sy(){for(var n,a,r=0,l="",c=arguments.length;r<c;r++)(n=arguments[r])&&(a=_y(n))&&(l&&(l+=" "),l+=a);return l}const wg=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,_g=Sy,jy=(n,a)=>r=>{var l;if(a?.variants==null)return _g(n,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(p=>{const v=r?.[p],x=d?.[p];if(v===null)return null;const _=wg(v)||wg(x);return c[p][_]}),m=r&&Object.entries(r).reduce((p,v)=>{let[x,_]=v;return _===void 0||(p[x]=_),p},{}),g=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((p,v)=>{let{class:x,className:_,...S}=v;return Object.entries(S).every(A=>{let[E,k]=A;return Array.isArray(k)?k.includes({...d,...m}[E]):{...d,...m}[E]===k})?[...p,x,_]:p},[]);return _g(n,h,g,r?.class,r?.className)},h_=(n,a)=>{const r=new Array(n.length+a.length);for(let l=0;l<n.length;l++)r[l]=n[l];for(let l=0;l<a.length;l++)r[n.length+l]=a[l];return r},m_=(n,a)=>({classGroupId:n,validator:a}),Ey=(n=new Map,a=null,r)=>({nextPart:n,validators:a,classGroupId:r}),ko="-",Sg=[],p_="arbitrary..",g_=n=>{const a=v_(n),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return y_(h);const m=h.split(ko),g=m[0]===""&&m.length>1?1:0;return Ny(m,g,a)},getConflictingClassGroupIds:(h,m)=>{if(m){const g=l[h],p=r[h];return g?p?h_(p,g):g:p||Sg}return r[h]||Sg}}},Ny=(n,a,r)=>{if(n.length-a===0)return r.classGroupId;const c=n[a],d=r.nextPart.get(c);if(d){const p=Ny(n,a+1,d);if(p)return p}const h=r.validators;if(h===null)return;const m=a===0?n.join(ko):n.slice(a).join(ko),g=h.length;for(let p=0;p<g;p++){const v=h[p];if(v.validator(m))return v.classGroupId}},y_=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=n.slice(1,-1),r=a.indexOf(":"),l=a.slice(0,r);return l?p_+l:void 0})(),v_=n=>{const{theme:a,classGroups:r}=n;return b_(r,a)},b_=(n,a)=>{const r=Ey();for(const l in n){const c=n[l];sf(c,r,l,a)}return r},sf=(n,a,r,l)=>{const c=n.length;for(let d=0;d<c;d++){const h=n[d];x_(h,a,r,l)}},x_=(n,a,r,l)=>{if(typeof n=="string"){w_(n,a,r);return}if(typeof n=="function"){__(n,a,r,l);return}S_(n,a,r,l)},w_=(n,a,r)=>{const l=n===""?a:Ty(a,n);l.classGroupId=r},__=(n,a,r,l)=>{if(j_(n)){sf(n(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(m_(r,n))},S_=(n,a,r,l)=>{const c=Object.entries(n),d=c.length;for(let h=0;h<d;h++){const[m,g]=c[h];sf(g,Ty(a,m),r,l)}},Ty=(n,a)=>{let r=n;const l=a.split(ko),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=Ey(),r.nextPart.set(h,m)),r=m}return r},j_=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,E_=n=>{if(n<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),l=Object.create(null);const c=(d,h)=>{r[d]=h,a++,a>n&&(a=0,l=r,r=Object.create(null))};return{get(d){let h=r[d];if(h!==void 0)return h;if((h=l[d])!==void 0)return c(d,h),h},set(d,h){d in r?r[d]=h:c(d,h)}}},Ld="!",jg=":",N_=[],Eg=(n,a,r,l,c)=>({modifiers:n,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),T_=n=>{const{prefix:a,experimentalParseClassName:r}=n;let l=c=>{const d=[];let h=0,m=0,g=0,p;const v=c.length;for(let E=0;E<v;E++){const k=c[E];if(h===0&&m===0){if(k===jg){d.push(c.slice(g,E)),g=E+1;continue}if(k==="/"){p=E;continue}}k==="["?h++:k==="]"?h--:k==="("?m++:k===")"&&m--}const x=d.length===0?c:c.slice(g);let _=x,S=!1;x.endsWith(Ld)?(_=x.slice(0,-1),S=!0):x.startsWith(Ld)&&(_=x.slice(1),S=!0);const A=p&&p>g?p-g:void 0;return Eg(d,S,_,A)};if(a){const c=a+jg,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):Eg(N_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},A_=n=>{const a=new Map;return n.orderSensitiveModifiers.forEach((r,l)=>{a.set(r,1e6+l)}),r=>{const l=[];let c=[];for(let d=0;d<r.length;d++){const h=r[d],m=h[0]==="[",g=a.has(h);m||g?(c.length>0&&(c.sort(),l.push(...c),c=[]),l.push(h)):c.push(h)}return c.length>0&&(c.sort(),l.push(...c)),l}},C_=n=>({cache:E_(n.cacheSize),parseClassName:T_(n),sortModifiers:A_(n),...g_(n)}),k_=/\s+/,O_=(n,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=n.trim().split(k_);let g="";for(let p=m.length-1;p>=0;p-=1){const v=m[p],{isExternal:x,modifiers:_,hasImportantModifier:S,baseClassName:A,maybePostfixModifierPosition:E}=r(v);if(x){g=v+(g.length>0?" "+g:g);continue}let k=!!E,O=l(k?A.substring(0,E):A);if(!O){if(!k){g=v+(g.length>0?" "+g:g);continue}if(O=l(A),!O){g=v+(g.length>0?" "+g:g);continue}k=!1}const q=_.length===0?"":_.length===1?_[0]:d(_).join(":"),B=S?q+Ld:q,G=B+O;if(h.indexOf(G)>-1)continue;h.push(G);const ee=c(O,k);for(let Q=0;Q<ee.length;++Q){const P=ee[Q];h.push(B+P)}g=v+(g.length>0?" "+g:g)}return g},R_=(...n)=>{let a=0,r,l,c="";for(;a<n.length;)(r=n[a++])&&(l=Ay(r))&&(c&&(c+=" "),c+=l);return c},Ay=n=>{if(typeof n=="string")return n;let a,r="";for(let l=0;l<n.length;l++)n[l]&&(a=Ay(n[l]))&&(r&&(r+=" "),r+=a);return r},D_=(n,...a)=>{let r,l,c,d;const h=g=>{const p=a.reduce((v,x)=>x(v),n());return r=C_(p),l=r.cache.get,c=r.cache.set,d=m,m(g)},m=g=>{const p=l(g);if(p)return p;const v=O_(g,r);return c(g,v),v};return d=h,(...g)=>d(R_(...g))},M_=[],dt=n=>{const a=r=>r[n]||M_;return a.isThemeGetter=!0,a},Cy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ky=/^\((?:(\w[\w-]*):)?(.+)\)$/i,z_=/^\d+\/\d+$/,U_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,L_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,B_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,q_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ar=n=>z_.test(n),Se=n=>!!n&&!Number.isNaN(Number(n)),Tn=n=>!!n&&Number.isInteger(Number(n)),md=n=>n.endsWith("%")&&Se(n.slice(0,-1)),Ya=n=>U_.test(n),H_=()=>!0,V_=n=>L_.test(n)&&!B_.test(n),Oy=()=>!1,I_=n=>q_.test(n),G_=n=>$_.test(n),P_=n=>!ae(n)&&!ne(n),K_=n=>jr(n,My,Oy),ae=n=>Cy.test(n),Zn=n=>jr(n,zy,V_),pd=n=>jr(n,Z_,Se),Ng=n=>jr(n,Ry,Oy),Y_=n=>jr(n,Dy,G_),co=n=>jr(n,Uy,I_),ne=n=>ky.test(n),Si=n=>Er(n,zy),J_=n=>Er(n,F_),Tg=n=>Er(n,Ry),X_=n=>Er(n,My),Q_=n=>Er(n,Dy),uo=n=>Er(n,Uy,!0),jr=(n,a,r)=>{const l=Cy.exec(n);return l?l[1]?a(l[1]):r(l[2]):!1},Er=(n,a,r=!1)=>{const l=ky.exec(n);return l?l[1]?a(l[1]):r:!1},Ry=n=>n==="position"||n==="percentage",Dy=n=>n==="image"||n==="url",My=n=>n==="length"||n==="size"||n==="bg-size",zy=n=>n==="length",Z_=n=>n==="number",F_=n=>n==="family-name",Uy=n=>n==="shadow",W_=()=>{const n=dt("color"),a=dt("font"),r=dt("text"),l=dt("font-weight"),c=dt("tracking"),d=dt("leading"),h=dt("breakpoint"),m=dt("container"),g=dt("spacing"),p=dt("radius"),v=dt("shadow"),x=dt("inset-shadow"),_=dt("text-shadow"),S=dt("drop-shadow"),A=dt("blur"),E=dt("perspective"),k=dt("aspect"),O=dt("ease"),q=dt("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ee=()=>[...G(),ne,ae],Q=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],J=()=>[ne,ae,g],he=()=>[ar,"full","auto",...J()],Ge=()=>[Tn,"none","subgrid",ne,ae],xe=()=>["auto",{span:["full",Tn,ne,ae]},Tn,ne,ae],ye=()=>[Tn,"auto",ne,ae],Ze=()=>["auto","min","max","fr",ne,ae],nt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ve=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...J()],Z=()=>[ar,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...J()],K=()=>[n,ne,ae],X=()=>[...G(),Tg,Ng,{position:[ne,ae]}],ge=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",X_,K_,{size:[ne,ae]}],H=()=>[md,Si,Zn],Y=()=>["","none","full",p,ne,ae],F=()=>["",Se,Si,Zn],ue=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Se,md,Tg,Ng],Pe=()=>["","none",A,ne,ae],Le=()=>["none",Se,ne,ae],Tt=()=>["none",Se,ne,ae],vt=()=>[Se,ne,ae],bt=()=>[ar,"full",...J()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ya],breakpoint:[Ya],color:[H_],container:[Ya],"drop-shadow":[Ya],ease:["in","out","in-out"],font:[P_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ya],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ya],shadow:[Ya],spacing:["px",Se],text:[Ya],"text-shadow":[Ya],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ar,ae,ne,k]}],container:["container"],columns:[{columns:[Se,ae,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:ee()}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:he()}],"inset-x":[{"inset-x":he()}],"inset-y":[{"inset-y":he()}],start:[{start:he()}],end:[{end:he()}],top:[{top:he()}],right:[{right:he()}],bottom:[{bottom:he()}],left:[{left:he()}],visibility:["visible","invisible","collapse"],z:[{z:[Tn,"auto",ne,ae]}],basis:[{basis:[ar,"full","auto",m,...J()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Se,ar,"auto","initial","none",ae]}],grow:[{grow:["",Se,ne,ae]}],shrink:[{shrink:["",Se,ne,ae]}],order:[{order:[Tn,"first","last","none",ne,ae]}],"grid-cols":[{"grid-cols":Ge()}],"col-start-end":[{col:xe()}],"col-start":[{"col-start":ye()}],"col-end":[{"col-end":ye()}],"grid-rows":[{"grid-rows":Ge()}],"row-start-end":[{row:xe()}],"row-start":[{"row-start":ye()}],"row-end":[{"row-end":ye()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ze()}],"auto-rows":[{"auto-rows":Ze()}],gap:[{gap:J()}],"gap-x":[{"gap-x":J()}],"gap-y":[{"gap-y":J()}],"justify-content":[{justify:[...nt(),"normal"]}],"justify-items":[{"justify-items":[...Ve(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ve()]}],"align-content":[{content:["normal",...nt()]}],"align-items":[{items:[...Ve(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ve(),{baseline:["","last"]}]}],"place-content":[{"place-content":nt()}],"place-items":[{"place-items":[...Ve(),"baseline"]}],"place-self":[{"place-self":["auto",...Ve()]}],p:[{p:J()}],px:[{px:J()}],py:[{py:J()}],ps:[{ps:J()}],pe:[{pe:J()}],pt:[{pt:J()}],pr:[{pr:J()}],pb:[{pb:J()}],pl:[{pl:J()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":J()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":J()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],w:[{w:[m,"screen",...Z()]}],"min-w":[{"min-w":[m,"screen","none",...Z()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,Si,Zn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,ne,pd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",md,ae]}],"font-family":[{font:[J_,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,ne,ae]}],"line-clamp":[{"line-clamp":[Se,"none",ne,pd]}],leading:[{leading:[d,...J()]}],"list-image":[{"list-image":["none",ne,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ne,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:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:[Se,"from-font","auto",ne,Zn]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[Se,"auto",ne,ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:J()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ne,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",ne,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:X()}],"bg-repeat":[{bg:ge()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Tn,ne,ae],radial:["",ne,ae],conic:[Tn,ne,ae]},Q_,Y_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ue(),"hidden","none"]}],"divide-style":[{divide:[...ue(),"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:[...ue(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Se,ne,ae]}],"outline-w":[{outline:["",Se,Si,Zn]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",v,uo,co]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",x,uo,co]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[Se,Zn]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",_,uo,co]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[Se,ne,ae]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"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":[Se]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"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":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"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":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"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":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"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":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"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":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"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":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[ne,ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"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":[Se]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"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:X()}],"mask-repeat":[{mask:ge()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ne,ae]}],filter:[{filter:["","none",ne,ae]}],blur:[{blur:Pe()}],brightness:[{brightness:[Se,ne,ae]}],contrast:[{contrast:[Se,ne,ae]}],"drop-shadow":[{"drop-shadow":["","none",S,uo,co]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",Se,ne,ae]}],"hue-rotate":[{"hue-rotate":[Se,ne,ae]}],invert:[{invert:["",Se,ne,ae]}],saturate:[{saturate:[Se,ne,ae]}],sepia:[{sepia:["",Se,ne,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",ne,ae]}],"backdrop-blur":[{"backdrop-blur":Pe()}],"backdrop-brightness":[{"backdrop-brightness":[Se,ne,ae]}],"backdrop-contrast":[{"backdrop-contrast":[Se,ne,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Se,ne,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Se,ne,ae]}],"backdrop-invert":[{"backdrop-invert":["",Se,ne,ae]}],"backdrop-opacity":[{"backdrop-opacity":[Se,ne,ae]}],"backdrop-saturate":[{"backdrop-saturate":[Se,ne,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",Se,ne,ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":J()}],"border-spacing-x":[{"border-spacing-x":J()}],"border-spacing-y":[{"border-spacing-y":J()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ne,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Se,"initial",ne,ae]}],ease:[{ease:["linear","initial",O,ne,ae]}],delay:[{delay:[Se,ne,ae]}],animate:[{animate:["none",q,ne,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[E,ne,ae]}],"perspective-origin":[{"perspective-origin":ee()}],rotate:[{rotate:Le()}],"rotate-x":[{"rotate-x":Le()}],"rotate-y":[{"rotate-y":Le()}],"rotate-z":[{"rotate-z":Le()}],scale:[{scale:Tt()}],"scale-x":[{"scale-x":Tt()}],"scale-y":[{"scale-y":Tt()}],"scale-z":[{"scale-z":Tt()}],"scale-3d":["scale-3d"],skew:[{skew:vt()}],"skew-x":[{"skew-x":vt()}],"skew-y":[{"skew-y":vt()}],transform:[{transform:[ne,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:ee()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:bt()}],"translate-x":[{"translate-x":bt()}],"translate-y":[{"translate-y":bt()}],"translate-z":[{"translate-z":bt()}],"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,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":J()}],"scroll-mx":[{"scroll-mx":J()}],"scroll-my":[{"scroll-my":J()}],"scroll-ms":[{"scroll-ms":J()}],"scroll-me":[{"scroll-me":J()}],"scroll-mt":[{"scroll-mt":J()}],"scroll-mr":[{"scroll-mr":J()}],"scroll-mb":[{"scroll-mb":J()}],"scroll-ml":[{"scroll-ml":J()}],"scroll-p":[{"scroll-p":J()}],"scroll-px":[{"scroll-px":J()}],"scroll-py":[{"scroll-py":J()}],"scroll-ps":[{"scroll-ps":J()}],"scroll-pe":[{"scroll-pe":J()}],"scroll-pt":[{"scroll-pt":J()}],"scroll-pr":[{"scroll-pr":J()}],"scroll-pb":[{"scroll-pb":J()}],"scroll-pl":[{"scroll-pl":J()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ne,ae]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[Se,Si,Zn,pd]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},e1=D_(W_);function Ne(...n){return e1(Sy(n))}const t1=jy("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),W=w.forwardRef(({className:n,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?l_:"button";return o.jsx(h,{className:Ne(t1({variant:a,size:r,className:n})),ref:d,...c})});W.displayName="Button";function Ly(){const{setTheme:n,theme:a}=s_();return o.jsxs(W,{variant:"ghost",size:"icon",onClick:()=>n(a==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",title:`Switch to ${a==="dark"?"light":"dark"} mode`,children:[a==="dark"?o.jsx(Hw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(_w,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var wa=function(){return wa=Object.assign||function(a){for(var r,l=1,c=arguments.length;l<c;l++){r=arguments[l];for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&(a[d]=r[d])}return a},wa.apply(this,arguments)};function Nr(n,a){var r={};for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&a.indexOf(l)<0&&(r[l]=n[l]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(n);c<l.length;c++)a.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(n,l[c])&&(r[l[c]]=n[l[c]]);return r}function a1(n,a,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(v){try{p(l.next(v))}catch(x){h(x)}}function g(v){try{p(l.throw(v))}catch(x){h(x)}}function p(v){v.done?d(v.value):c(v.value).then(m,g)}p((l=l.apply(n,a||[])).next())})}function n1(n,a,r){if(r||arguments.length===2)for(var l=0,c=a.length,d;l<c;l++)(d||!(l in a))&&(d||(d=Array.prototype.slice.call(a,0,l)),d[l]=a[l]);return n.concat(d||Array.prototype.slice.call(a))}const s1=n=>n?(...a)=>n(...a):(...a)=>fetch(...a);class rf extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class r1 extends rf{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class Ag extends rf{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class Cg extends rf{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Bd;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(Bd||(Bd={}));class i1{constructor(a,{headers:r={},customFetch:l,region:c=Bd.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=s1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return a1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:g,body:p,signal:v,timeout:x}=l;let _={},{region:S}=l;S||(S=this.region);const A=new URL(`${this.url}/${r}`);S&&S!=="any"&&(_["x-region"]=S,A.searchParams.set("forceFunctionRegion",S));let E;p&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",E=p):typeof p=="string"?(_["Content-Type"]="text/plain",E=p):typeof FormData<"u"&&p instanceof FormData?E=p:(_["Content-Type"]="application/json",E=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?E=JSON.stringify(p):E=p;let k=v;x&&(h=new AbortController,d=setTimeout(()=>h.abort(),x),v?(k=h.signal,v.addEventListener("abort",()=>h.abort())):k=h.signal);const O=yield this.fetch(A.toString(),{method:g||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),m),body:E,signal:k}).catch(ee=>{throw new r1(ee)}),q=O.headers.get("x-relay-error");if(q&&q==="true")throw new Ag(O);if(!O.ok)throw new Cg(O);let B=((c=O.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),G;return B==="application/json"?G=yield O.json():B==="application/octet-stream"||B==="application/pdf"?G=yield O.blob():B==="text/event-stream"?G=O:B==="multipart/form-data"?G=yield O.formData():G=yield O.text(),{data:G,error:null,response:O}}catch(m){return{data:null,error:m,response:m instanceof Cg||m instanceof Ag?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var l1=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}},o1=class{constructor(n){var a,r;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(a=n.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=n.signal,this.isMaybeSingle=(r=n.isMaybeSingle)!==null&&r!==void 0?r:!1,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,a){return this.headers=new Headers(this.headers),this.headers.set(n,a),this}then(n,a){var r=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const l=this.fetch;let c=l(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async d=>{let h=null,m=null,g=null,p=d.status,v=d.statusText;if(d.ok){var x,_;if(r.method!=="HEAD"){var S;const O=await d.text();O===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((S=r.headers.get("Accept"))===null||S===void 0)&&S.includes("application/vnd.pgrst.plan+text"))?m=O:m=JSON.parse(O))}const E=(x=r.headers.get("Prefer"))===null||x===void 0?void 0:x.match(/count=(exact|planned|estimated)/),k=(_=d.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");E&&k&&k.length>1&&(g=parseInt(k[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(m)&&(m.length>1?(h={code:"PGRST116",details:`Results contain ${m.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},m=null,g=null,p=406,v="Not Acceptable"):m.length===1?m=m[0]:m=null)}else{var A;const E=await d.text();try{h=JSON.parse(E),Array.isArray(h)&&d.status===404&&(m=[],h=null,p=200,v="OK")}catch{d.status===404&&E===""?(p=204,v="No Content"):h={message:E}}if(h&&r.isMaybeSingle&&(!(h==null||(A=h.details)===null||A===void 0)&&A.includes("0 rows"))&&(h=null,p=200,v="OK"),h&&r.shouldThrowOnError)throw new l1(h)}return{error:h,data:m,count:g,status:p,statusText:v}});return this.shouldThrowOnError||(c=c.catch(d=>{var h;let m="";const g=d?.cause;if(g){var p,v,x,_;const A=(p=g?.message)!==null&&p!==void 0?p:"",E=(v=g?.code)!==null&&v!==void 0?v:"";m=`${(x=d?.name)!==null&&x!==void 0?x:"FetchError"}: ${d?.message}`,m+=`
10
-
11
- Caused by: ${(_=g?.name)!==null&&_!==void 0?_:"Error"}: ${A}`,E&&(m+=` (${E})`),g?.stack&&(m+=`
12
- ${g.stack}`)}else{var S;m=(S=d?.stack)!==null&&S!==void 0?S:""}return{error:{message:`${(h=d?.name)!==null&&h!==void 0?h:"FetchError"}: ${d?.message}`,details:m,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),c.then(n,a)}returns(){return this}overrideTypes(){return this}},c1=class extends o1{select(n){let a=!1;const r=(n??"*").split("").map(l=>/\s/.test(l)&&!a?"":(l==='"'&&(a=!a),l)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:a=!0,nullsFirst:r,foreignTable:l,referencedTable:c=l}={}){const d=c?`${c}.order`:"order",h=this.url.searchParams.get(d);return this.url.searchParams.set(d,`${h?`${h},`:""}${n}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${n}`),this}range(n,a,{foreignTable:r,referencedTable:l=r}={}){const c=typeof l>"u"?"offset":`${l}.offset`,d=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(c,`${n}`),this.url.searchParams.set(d,`${a-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:n=!1,verbose:a=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[n?"analyze":null,a?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),g=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${g}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const kg=new RegExp("[,()]");var fr=class extends c1{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}regexMatch(n,a){return this.url.searchParams.append(n,`match.${a}`),this}regexIMatch(n,a){return this.url.searchParams.append(n,`imatch.${a}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}isDistinct(n,a){return this.url.searchParams.append(n,`isdistinct.${a}`),this}in(n,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&kg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(n,`in.(${r})`),this}notIn(n,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&kg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(n,`not.in.(${r})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{config:r,type:l}={}){let c="";l==="plain"?c="pl":l==="phrase"?c="ph":l==="websearch"&&(c="w");const d=r===void 0?"":`(${r})`;return this.url.searchParams.append(n,`${c}fts${d}.${a}`),this}match(n){return Object.entries(n).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(n,a,r){return this.url.searchParams.append(n,`not.${a}.${r}`),this}or(n,{foreignTable:a,referencedTable:r=a}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${n})`),this}filter(n,a,r){return this.url.searchParams.append(n,`${a}.${r}`),this}},u1=class{constructor(n,{headers:a={},schema:r,fetch:l}){this.url=n,this.headers=new Headers(a),this.schema=r,this.fetch=l}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(n,a){const{head:r=!1,count:l}=a??{},c=r?"HEAD":"GET";let d=!1;const h=(n??"*").split("").map(p=>/\s/.test(p)&&!d?"":(p==='"'&&(d=!d),p)).join(""),{url:m,headers:g}=this.cloneRequestState();return m.searchParams.set("select",h),l&&g.append("Prefer",`count=${l}`),new fr({method:c,url:m,headers:g,schema:this.schema,fetch:this.fetch})}insert(n,{count:a,defaultToNull:r=!0}={}){var l;const c="POST",{url:d,headers:h}=this.cloneRequestState();if(a&&h.append("Prefer",`count=${a}`),r||h.append("Prefer","missing=default"),Array.isArray(n)){const m=n.reduce((g,p)=>g.concat(Object.keys(p)),[]);if(m.length>0){const g=[...new Set(m)].map(p=>`"${p}"`);d.searchParams.set("columns",g.join(","))}}return new fr({method:c,url:d,headers:h,schema:this.schema,body:n,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(n,{onConflict:a,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:g}=this.cloneRequestState();if(g.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),a!==void 0&&m.searchParams.set("on_conflict",a),l&&g.append("Prefer",`count=${l}`),c||g.append("Prefer","missing=default"),Array.isArray(n)){const p=n.reduce((v,x)=>v.concat(Object.keys(x)),[]);if(p.length>0){const v=[...new Set(p)].map(x=>`"${x}"`);m.searchParams.set("columns",v.join(","))}}return new fr({method:h,url:m,headers:g,schema:this.schema,body:n,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(n,{count:a}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return a&&d.append("Prefer",`count=${a}`),new fr({method:l,url:c,headers:d,schema:this.schema,body:n,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:n}={}){var a;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return n&&c.append("Prefer",`count=${n}`),new fr({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},d1=class By{constructor(a,{headers:r={},schema:l,fetch:c}={}){this.url=a,this.headers=new Headers(r),this.schemaName=l,this.fetch=c}from(a){if(!a||typeof a!="string"||a.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new u1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new By(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,r={},{head:l=!1,get:c=!1,count:d}={}){var h;let m;const g=new URL(`${this.url}/rpc/${a}`);let p;const v=S=>S!==null&&typeof S=="object"&&(!Array.isArray(S)||S.some(v)),x=l&&Object.values(r).some(v);x?(m="POST",p=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([S,A])=>A!==void 0).map(([S,A])=>[S,Array.isArray(A)?`{${A.join(",")}}`:`${A}`]).forEach(([S,A])=>{g.searchParams.append(S,A)})):(m="POST",p=r);const _=new Headers(this.headers);return x?_.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&_.set("Prefer",`count=${d}`),new fr({method:m,url:g,headers:_,schema:this.schemaName,body:p,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class f1{constructor(){}static detectEnvironment(){var a;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((a=navigator.userAgent)===null||a===void 0)&&a.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const r=globalThis.process;if(r){const l=r.versions;if(l&&l.node){const c=l.node,d=parseInt(c.replace(/^v/,"").split(".")[0]);return d>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${d} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${d} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
13
- import ws from "ws"
14
- new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const a=this.detectEnvironment();if(a.constructor)return a.constructor;let r=a.error||"WebSocket not supported in this environment.";throw a.workaround&&(r+=`
15
-
16
- Suggested solution: ${a.workaround}`),new Error(r)}static createWebSocket(a,r){const l=this.getWebSocketConstructor();return new l(a,r)}static isWebSocketSupported(){try{const a=this.detectEnvironment();return a.type==="native"||a.type==="ws"}catch{return!1}}}const h1="2.90.1",m1=`realtime-js/${h1}`,qy="1.0.0",p1="2.0.0",Og=qy,qd=1e4,g1=1e3,y1=100;var Cn;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(Cn||(Cn={}));var ft;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(ft||(ft={}));var fa;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(fa||(fa={}));var $d;(function(n){n.websocket="websocket"})($d||($d={}));var ts;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(ts||(ts={}));class v1{constructor(a){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=a??[]}encode(a,r){if(a.event===this.BROADCAST_EVENT&&!(a.payload instanceof ArrayBuffer)&&typeof a.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(a));let l=[a.join_ref,a.ref,a.topic,a.event,a.payload];return r(JSON.stringify(l))}_binaryEncodeUserBroadcastPush(a){var r;return this._isArrayBuffer((r=a.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(a):this._encodeJsonUserBroadcastPush(a)}_encodeBinaryUserBroadcastPush(a){var r,l;const c=(l=(r=a.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:new ArrayBuffer(0);return this._encodeUserBroadcastPush(a,this.BINARY_ENCODING,c)}_encodeJsonUserBroadcastPush(a){var r,l;const c=(l=(r=a.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:{},h=new TextEncoder().encode(JSON.stringify(c)).buffer;return this._encodeUserBroadcastPush(a,this.JSON_ENCODING,h)}_encodeUserBroadcastPush(a,r,l){var c,d;const h=a.topic,m=(c=a.ref)!==null&&c!==void 0?c:"",g=(d=a.join_ref)!==null&&d!==void 0?d:"",p=a.payload.event,v=this.allowedMetadataKeys?this._pick(a.payload,this.allowedMetadataKeys):{},x=Object.keys(v).length===0?"":JSON.stringify(v);if(g.length>255)throw new Error(`joinRef length ${g.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(x.length>255)throw new Error(`metadata length ${x.length} exceeds maximum of 255`);const _=this.USER_BROADCAST_PUSH_META_LENGTH+g.length+m.length+h.length+p.length+x.length,S=new ArrayBuffer(this.HEADER_LENGTH+_);let A=new DataView(S),E=0;A.setUint8(E++,this.KINDS.userBroadcastPush),A.setUint8(E++,g.length),A.setUint8(E++,m.length),A.setUint8(E++,h.length),A.setUint8(E++,p.length),A.setUint8(E++,x.length),A.setUint8(E++,r),Array.from(g,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(m,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(h,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(p,O=>A.setUint8(E++,O.charCodeAt(0))),Array.from(x,O=>A.setUint8(E++,O.charCodeAt(0)));var k=new Uint8Array(S.byteLength+l.byteLength);return k.set(new Uint8Array(S),0),k.set(new Uint8Array(l),S.byteLength),k.buffer}decode(a,r){if(this._isArrayBuffer(a)){let l=this._binaryDecode(a);return r(l)}if(typeof a=="string"){const l=JSON.parse(a),[c,d,h,m,g]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:g})}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 g=this.HEADER_LENGTH+4;const p=l.decode(a.slice(g,g+c));g=g+c;const v=l.decode(a.slice(g,g+d));g=g+d;const x=l.decode(a.slice(g,g+h));g=g+h;const _=a.slice(g,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(_)):_,A={type:this.BROADCAST_EVENT,event:v,payload:S};return h>0&&(A.meta=JSON.parse(x)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:A}}_isArrayBuffer(a){var r;return a instanceof ArrayBuffer||((r=a?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(a,r){return!a||typeof a!="object"?{}:Object.fromEntries(Object.entries(a).filter(([l])=>r.includes(l)))}}class $y{constructor(a,r){this.callback=a,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=a,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Ke;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(Ke||(Ke={}));const Rg=(n,a,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return a?Object.keys(a).reduce((d,h)=>(d[h]=b1(h,n,a,c),d),{}):{}},b1=(n,a,r,l)=>{const c=a.find(m=>m.name===n),d=c?.type,h=r[n];return d&&!l.includes(d)?Hy(d,h):Hd(h)},Hy=(n,a)=>{if(n.charAt(0)==="_"){const r=n.slice(1,n.length);return S1(a,r)}switch(n){case Ke.bool:return x1(a);case Ke.float4:case Ke.float8:case Ke.int2:case Ke.int4:case Ke.int8:case Ke.numeric:case Ke.oid:return w1(a);case Ke.json:case Ke.jsonb:return _1(a);case Ke.timestamp:return j1(a);case Ke.abstime:case Ke.date:case Ke.daterange:case Ke.int4range:case Ke.int8range:case Ke.money:case Ke.reltime:case Ke.text:case Ke.time:case Ke.timestamptz:case Ke.timetz:case Ke.tsrange:case Ke.tstzrange:return Hd(a);default:return Hd(a)}},Hd=n=>n,x1=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},w1=n=>{if(typeof n=="string"){const a=parseFloat(n);if(!Number.isNaN(a))return a}return n},_1=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},S1=(n,a)=>{if(typeof n!="string")return n;const r=n.length-1,l=n[r];if(n[0]==="{"&&l==="}"){let d;const h=n.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Hy(a,m))}return n},j1=n=>typeof n=="string"?n.replace(" ","T"):n,Vy=n=>{const a=new URL(n);return a.protocol=a.protocol.replace(/^ws/i,"http"),a.pathname=a.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),a.pathname===""||a.pathname==="/"?a.pathname="/api/broadcast":a.pathname=a.pathname+"/api/broadcast",a.href};class gd{constructor(a,r,l={},c=qd){this.channel=a,this.event=r,this.payload=l,this.timeout=c,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(a){this.timeout=a,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(a){this.payload=Object.assign(Object.assign({},this.payload),a)}receive(a,r){var l;return this._hasReceived(a)&&r((l=this.receivedResp)===null||l===void 0?void 0:l.response),this.recHooks.push({status:a,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const a=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},a),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(a,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:a,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:a,response:r}){this.recHooks.filter(l=>l.status===a).forEach(l=>l.callback(r))}_hasReceived(a){return this.receivedResp&&this.receivedResp.status===a}}var Dg;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(Dg||(Dg={}));class Ei{constructor(a,r){this.channel=a,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const l=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(l.state,{},c=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Ei.syncState(this.state,c,d,h),this.pendingDiffs.forEach(g=>{this.state=Ei.syncDiff(this.state,g,d,h)}),this.pendingDiffs=[],m()}),this.channel._on(l.diff,{},c=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(c):(this.state=Ei.syncDiff(this.state,c,d,h),m())}),this.onJoin((c,d,h)=>{this.channel._trigger("presence",{event:"join",key:c,currentPresences:d,newPresences:h})}),this.onLeave((c,d,h)=>{this.channel._trigger("presence",{event:"leave",key:c,currentPresences:d,leftPresences:h})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(a,r,l,c){const d=this.cloneDeep(a),h=this.transformState(r),m={},g={};return this.map(d,(p,v)=>{h[p]||(g[p]=v)}),this.map(h,(p,v)=>{const x=d[p];if(x){const _=v.map(k=>k.presence_ref),S=x.map(k=>k.presence_ref),A=v.filter(k=>S.indexOf(k.presence_ref)<0),E=x.filter(k=>_.indexOf(k.presence_ref)<0);A.length>0&&(m[p]=A),E.length>0&&(g[p]=E)}else m[p]=v}),this.syncDiff(d,{joins:m,leaves:g},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,g)=>{var p;const v=(p=a[m])!==null&&p!==void 0?p:[];if(a[m]=this.cloneDeep(g),v.length>0){const x=a[m].map(S=>S.presence_ref),_=v.filter(S=>x.indexOf(S.presence_ref)<0);a[m].unshift(..._)}l(m,v,g)}),this.map(h,(m,g)=>{let p=a[m];if(!p)return;const v=g.map(x=>x.presence_ref);p=p.filter(x=>v.indexOf(x.presence_ref)<0),a[m]=p,c(m,p,g),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 Mg;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(Mg||(Mg={}));var Ni;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(Ni||(Ni={}));var Xa;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(Xa||(Xa={}));class yr{constructor(a,r={config:{}},l){var c,d;if(this.topic=a,this.params=r,this.socket=l,this.bindings={},this.state=ft.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=a.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new gd(this,fa.join,this.params,this.timeout),this.rejoinTimer=new $y(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ft.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(h=>h.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=ft.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this._on(fa.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new Ei(this),this.broadcastEndpointURL=Vy(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((d=(c=this.params.config)===null||c===void 0?void 0:c.broadcast)===null||d===void 0)&&d.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(a,r=this.timeout){var l,c,d;if(this.socket.isConnected()||this.socket.connect(),this.state==ft.closed){const{config:{broadcast:h,presence:m,private:g}}=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:[],v=!!this.bindings[Ni.PRESENCE]&&this.bindings[Ni.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,x={},_={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:v}),postgres_changes:p,private:g};this.socket.accessTokenValue&&(x.access_token=this.socket.accessTokenValue),this._onError(S=>a?.(Xa.CHANNEL_ERROR,S)),this._onClose(()=>a?.(Xa.CLOSED)),this.updateJoinPayload(Object.assign({config:_},x)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:S})=>{var A;if(this.socket._isManualToken()||this.socket.setAuth(),S===void 0){a?.(Xa.SUBSCRIBED);return}else{const E=this.bindings.postgres_changes,k=(A=E?.length)!==null&&A!==void 0?A:0,O=[];for(let q=0;q<k;q++){const B=E[q],{filter:{event:G,schema:ee,table:Q,filter:P}}=B,J=S&&S[q];if(J&&J.event===G&&yr.isFilterValueEqual(J.schema,ee)&&yr.isFilterValueEqual(J.table,Q)&&yr.isFilterValueEqual(J.filter,P))O.push(Object.assign(Object.assign({},B),{id:J.id}));else{this.unsubscribe(),this.state=ft.errored,a?.(Xa.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=O,a&&a(Xa.SUBSCRIBED);return}}).receive("error",S=>{this.state=ft.errored,a?.(Xa.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{a?.(Xa.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(a,r={}){return await this.send({type:"presence",event:"track",payload:a},r.timeout||this.timeout)}async untrack(a={}){return await this.send({type:"presence",event:"untrack"},a)}on(a,r,l){return this.state===ft.joined&&a===Ni.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(a,r,l)}async httpSend(a,r,l={}){var c;if(r==null)return Promise.reject("Payload is required for httpSend()");const d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:r,private:this.private}]})},m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(c=l.timeout)!==null&&c!==void 0?c:this.timeout);if(m.status===202)return{success:!0};let g=m.statusText;try{const p=await m.json();g=p.error||p.message||g}catch{}return Promise.reject(new Error(g))}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 g={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,g,(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,g;const p=this._push(a.type,a,r.timeout||this.timeout);a.type==="broadcast"&&!(!((g=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||g===void 0)&&g.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=ft.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(fa.close,"leave",this._joinRef())};this.joinPush.destroy();let l=null;return new Promise(c=>{l=new gd(this,fa.leave,{},a),l.receive("ok",()=>{r(),c("ok")}).receive("timeout",()=>{r(),c("timed out")}).receive("error",()=>{c("error")}),l.send(),this._canPush()||l.trigger("ok",{})}).finally(()=>{l?.destroy()})}teardown(){this.pushBuffer.forEach(a=>a.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ft.closed,this.bindings={}}async _fetchWithTimeout(a,r,l){const c=new AbortController,d=setTimeout(()=>c.abort(),l),h=await this.socket.fetch(a,Object.assign(Object.assign({},r),{signal:c.signal}));return clearTimeout(d),h}_push(a,r,l=this.timeout){if(!this.joinedOnce)throw`tried to push '${a}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let c=new gd(this,a,r,l);return this._canPush()?c.send():this._addToPushBuffer(c),c}_addToPushBuffer(a){if(a.startTimeout(),this.pushBuffer.push(a),this.pushBuffer.length>y1){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(a,r,l){return r}_isMember(a){return this.topic===a}_joinRef(){return this.joinPush.ref}_trigger(a,r,l){var c,d;const h=a.toLocaleLowerCase(),{close:m,error:g,leave:p,join:v}=fa;if(l&&[m,g,p,v].indexOf(h)>=0&&l!==this._joinRef())return;let _=this._onMessage(h,r,l);if(r&&!_)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(h)?(c=this.bindings.postgres_changes)===null||c===void 0||c.filter(S=>{var A,E,k;return((A=S.filter)===null||A===void 0?void 0:A.event)==="*"||((k=(E=S.filter)===null||E===void 0?void 0:E.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===h}).map(S=>S.callback(_,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var A,E,k,O,q,B,G,ee;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const Q=S.id,P=(A=S.filter)===null||A===void 0?void 0:A.event;return Q&&((E=r.ids)===null||E===void 0?void 0:E.includes(Q))&&(P==="*"||P?.toLocaleLowerCase()===((k=r.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))&&(!(!((O=S.filter)===null||O===void 0)&&O.table)||S.filter.table===((q=r.data)===null||q===void 0?void 0:q.table))}else{const Q=(G=(B=S?.filter)===null||B===void 0?void 0:B.event)===null||G===void 0?void 0:G.toLocaleLowerCase();return Q==="*"||Q===((ee=r?.event)===null||ee===void 0?void 0:ee.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===h}).map(S=>{if(typeof _=="object"&&"ids"in _){const A=_.data,{schema:E,table:k,commit_timestamp:O,type:q,errors:B}=A;_=Object.assign(Object.assign({},{schema:E,table:k,commit_timestamp:O,eventType:q,new:{},old:{},errors:B}),this._getPayloadRecords(A))}S.callback(_,l)})}_isClosed(){return this.state===ft.closed}_isJoined(){return this.state===ft.joined}_isJoining(){return this.state===ft.joining}_isLeaving(){return this.state===ft.leaving}_replyEventName(a){return`chan_reply_${a}`}_on(a,r,l){const c=a.toLocaleLowerCase(),d={type:c,filter:r,callback:l};return this.bindings[c]?this.bindings[c].push(d):this.bindings[c]=[d],this}_off(a,r){const l=a.toLocaleLowerCase();return this.bindings[l]&&(this.bindings[l]=this.bindings[l].filter(c=>{var d;return!(((d=c.type)===null||d===void 0?void 0:d.toLocaleLowerCase())===l&&yr.isEqual(c.filter,r))})),this}static isEqual(a,r){if(Object.keys(a).length!==Object.keys(r).length)return!1;for(const l in a)if(a[l]!==r[l])return!1;return!0}static isFilterValueEqual(a,r){return(a??void 0)===(r??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(a){this._on(fa.close,{},a)}_onError(a){this._on(fa.error,{},r=>a(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(a=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ft.joining,this.joinPush.resend(a))}_getPayloadRecords(a){const r={new:{},old:{}};return(a.type==="INSERT"||a.type==="UPDATE")&&(r.new=Rg(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Rg(a.columns,a.old_record)),r}}const yd=()=>{},fo={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},E1=[1e3,2e3,5e3,1e4],N1=1e4,T1=`
17
- addEventListener("message", (e) => {
18
- if (e.data.event === "start") {
19
- setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
20
- }
21
- });`;class A1{constructor(a,r){var l;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=qd,this.transport=null,this.heartbeatIntervalMs=fo.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=yd,this.ref=0,this.reconnectTimer=null,this.vsn=Og,this.logger=yd,this.conn=null,this.sendBuffer=[],this.serializer=new v1,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=c=>c?(...d)=>c(...d):(...d)=>fetch(...d),!(!((l=r?.params)===null||l===void 0)&&l.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${a}/${$d.websocket}`,this.httpEndpoint=Vy(a),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=f1.createWebSocket(this.endpointURL())}catch(a){this._setConnectionState("disconnected");const r=a.message;throw r.includes("Node.js")?new Error(`${r}
22
-
23
- To use Realtime in Node.js, you need to provide a WebSocket implementation:
24
-
25
- Option 1: Use Node.js 22+ which has native WebSocket support
26
- Option 2: Install and provide the "ws" package:
27
-
28
- npm install ws
29
-
30
- import ws from "ws"
31
- const client = new RealtimeClient(url, {
32
- ...options,
33
- transport: ws
34
- })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(a,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const l=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(l),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(a?this.conn.close(a,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(a){const r=await a.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const a=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),a}log(a,r,l){this.logger(a,r,l)}connectionState(){switch(this.conn&&this.conn.readyState){case Cn.connecting:return ts.Connecting;case Cn.open:return ts.Open;case Cn.closing:return ts.Closing;default:return ts.Closed}}isConnected(){return this.connectionState()===ts.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(a,r={config:{}}){const l=`realtime:${a}`,c=this.getChannels().find(d=>d.topic===l);if(c)return c;{const d=new yr(`realtime:${a}`,r,this);return this.channels.push(d),d}}push(a){const{topic:r,event:l,payload:c,ref:d}=a,h=()=>{this.encode(a,m=>{var g;(g=this.conn)===null||g===void 0||g.send(m)})};this.log("push",`${r} ${l} (${d})`,c),this.isConnected()?h():this.sendBuffer.push(h)}async setAuth(a=null){this._authPromise=this._performAuth(a);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var a;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(a=this.conn)===null||a===void 0||a.close(g1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},fo.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(a){this.heartbeatCallback=a}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(a=>a()),this.sendBuffer=[])}_makeRef(){let a=this.ref+1;return a===this.ref?this.ref=0:this.ref=a,this.ref.toString()}_leaveOpenTopic(a){let r=this.channels.find(l=>l.topic===a&&(l._isJoined()||l._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${a}"`),r.unsubscribe())}_remove(a){this.channels=this.channels.filter(r=>r.topic!==a.topic)}_onConnMessage(a){this.decode(a.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply"&&r.ref&&r.ref===this.pendingHeartbeatRef){const p=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",p)}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})`:"",g=d.status||"";this.log("receive",`${g} ${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===Cn.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Cn.open||this.conn.readyState===Cn.connecting)try{this.conn.close()}catch(a){this.log("error","Error closing connection",a)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(a=>a.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const a=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(a),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(a){var r;this._setConnectionState("disconnected"),this.log("transport","close",a),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",a)}_onConnError(a){this._setConnectionState("disconnected"),this.log("transport",`${a}`),this._triggerChanError(),this._triggerStateCallbacks("error",a)}_triggerChanError(){this.channels.forEach(a=>a._trigger(fa.error))}_appendParams(a,r){if(Object.keys(r).length===0)return a;const l=a.match(/\?/)?"&":"?",c=new URLSearchParams(r);return`${a}${l}${c}`}_workerObjectUrl(a){let r;if(a)r=a;else{const l=new Blob([T1],{type:"application/javascript"});r=URL.createObjectURL(l)}return r}_setConnectionState(a,r=!1){this._connectionState=a,a==="connecting"?this._wasManualDisconnect=!1:a==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(a=null){let r,l=!1;if(a)r=a,l=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(c){this.log("error","Error fetching access token from callback",c),r=this.accessTokenValue}else r=this.accessTokenValue;l?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(c=>{const d={access_token:r,version:m1};r&&c.updateJoinPayload(d),c.joinedOnce&&c._isJoined()&&c._push(fa.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(a="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${a}`,r)})}_triggerStateCallbacks(a,r){try{this.stateChangeCallbacks[a].forEach(l=>{try{l(r)}catch(c){this.log("error",`error in ${a} callback`,c)}})}catch(l){this.log("error",`error triggering ${a} callbacks`,l)}}_setupReconnectionTimer(){this.reconnectTimer=new $y(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},fo.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(a){var r,l,c,d,h,m,g,p,v,x,_,S;switch(this.transport=(r=a?.transport)!==null&&r!==void 0?r:null,this.timeout=(l=a?.timeout)!==null&&l!==void 0?l:qd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:fo.HEARTBEAT_INTERVAL,this.worker=(d=a?.worker)!==null&&d!==void 0?d:!1,this.accessToken=(h=a?.accessToken)!==null&&h!==void 0?h:null,this.heartbeatCallback=(m=a?.heartbeatCallback)!==null&&m!==void 0?m:yd,this.vsn=(g=a?.vsn)!==null&&g!==void 0?g:Og,a?.params&&(this.params=a.params),a?.logger&&(this.logger=a.logger),(a?.logLevel||a?.log_level)&&(this.logLevel=a.logLevel||a.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(p=a?.reconnectAfterMs)!==null&&p!==void 0?p:(A=>E1[A-1]||N1),this.vsn){case qy:this.encode=(v=a?.encode)!==null&&v!==void 0?v:((A,E)=>E(JSON.stringify(A))),this.decode=(x=a?.decode)!==null&&x!==void 0?x:((A,E)=>E(JSON.parse(A)));break;case p1:this.encode=(_=a?.encode)!==null&&_!==void 0?_:this.serializer.encode.bind(this.serializer),this.decode=(S=a?.decode)!==null&&S!==void 0?S:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=a?.workerUrl}}}var Ci=class extends Error{constructor(n,a){super(n),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown=a.icebergType==="CommitStateUnknownException"||[500,502,504].includes(a.status)&&a.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function C1(n,a,r){const l=new URL(a,n);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function k1(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function O1(n){const a=n.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=C1(n.baseUrl,l,c),g=await k1(n.auth),p=await a(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...g,...h},body:d?JSON.stringify(d):void 0}),v=await p.text(),x=(p.headers.get("content-type")||"").includes("application/json"),_=x&&v?JSON.parse(v):v;if(!p.ok){const S=x?_:void 0,A=S?.error;throw new Ci(A?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:A?.type,icebergCode:A?.code,details:S})}return{status:p.status,headers:p.headers,data:_}}}}function ho(n){return n.join("")}var R1=class{constructor(n,a=""){this.client=n,this.prefix=a}async listNamespaces(n){const a=n?{parent:ho(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(n,a){const r={namespace:n.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ho(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ho(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ho(n.namespace)}`}),!0}catch(a){if(a instanceof Ci&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(n,a){try{return await this.createNamespace(n,a)}catch(r){if(r instanceof Ci&&r.status===409)return;throw r}}};function nr(n){return n.join("")}var D1=class{constructor(n,a="",r){this.client=n,this.prefix=a,this.accessDelegation=r}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables`})).data.identifiers}async createTable(n,a){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables`,body:a,headers:r})).data.metadata}async updateTable(n,a){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables/${n.name}`,body:a});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(n,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(n){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables/${n.name}`,headers:a})).data.metadata}async tableExists(n){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${nr(n.namespace)}/tables/${n.name}`,headers:a}),!0}catch(r){if(r instanceof Ci&&r.status===404)return!1;throw r}}async createTableIfNotExists(n,a){try{return await this.createTable(n,a)}catch(r){if(r instanceof Ci&&r.status===409)return await this.loadTable({namespace:n.namespace,name:a.name});throw r}}},M1=class{constructor(n){let a="v1";n.catalogName&&(a+=`/${n.catalogName}`);const r=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=O1({baseUrl:r,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=n.accessDelegation?.join(","),this.namespaceOps=new R1(this.client,a),this.tableOps=new D1(this.client,a,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,a){return this.namespaceOps.createNamespace(n,a)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}async createTable(n,a){return this.tableOps.createTable(n,a)}async updateTable(n,a){return this.tableOps.updateTable(n,a)}async dropTable(n,a){await this.tableOps.dropTable(n,a)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,a){return this.namespaceOps.createNamespaceIfNotExists(n,a)}async createTableIfNotExists(n,a){return this.tableOps.createTableIfNotExists(n,a)}},qo=class extends Error{constructor(n){super(n),this.__isStorageError=!0,this.name="StorageError"}};function Qe(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var z1=class extends qo{constructor(n,a,r){super(n),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Vd=class extends qo{constructor(n,a){super(n),this.name="StorageUnknownError",this.originalError=a}};const lf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),U1=()=>Response,Id=n=>{if(Array.isArray(n))return n.map(r=>Id(r));if(typeof n=="function"||n!==Object(n))return n;const a={};return Object.entries(n).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));a[c]=Id(l)}),a},L1=n=>{if(typeof n!="object"||n===null)return!1;const a=Object.getPrototypeOf(n);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},B1=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function ki(n){"@babel/helpers - typeof";return ki=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},ki(n)}function q1(n,a){if(ki(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(ki(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function $1(n){var a=q1(n,"string");return ki(a)=="symbol"?a:a+""}function H1(n,a,r){return(a=$1(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function zg(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(n,c).enumerable})),r.push.apply(r,l)}return r}function pe(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?zg(Object(r),!0).forEach(function(l){H1(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):zg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const vd=n=>{var a;return n.msg||n.message||n.error_description||(typeof n.error=="string"?n.error:(a=n.error)===null||a===void 0?void 0:a.message)||JSON.stringify(n)},V1=async(n,a,r)=>{n instanceof await U1()&&!r?.noResolveJson?n.json().then(l=>{const c=n.status||500,d=l?.statusCode||c+"";a(new z1(vd(l),c,d))}).catch(l=>{a(new Vd(vd(l),l))}):a(new Vd(vd(n),n))},I1=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return n==="GET"||!l?c:(L1(l)?(c.headers=pe({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,a?.duplex&&(c.duplex=a.duplex),pe(pe({},c),r))};async function Hi(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,I1(a,l,c,d)).then(g=>{if(!g.ok)throw g;return l?.noResolveJson?g:g.json()}).then(g=>h(g)).catch(g=>V1(g,m,l))})}async function Oi(n,a,r,l){return Hi(n,"GET",a,r,l)}async function da(n,a,r,l,c){return Hi(n,"POST",a,l,c,r)}async function Gd(n,a,r,l,c){return Hi(n,"PUT",a,l,c,r)}async function G1(n,a,r,l){return Hi(n,"HEAD",a,pe(pe({},r),{},{noResolveJson:!0}),l)}async function of(n,a,r,l,c){return Hi(n,"DELETE",a,l,c,r)}var P1=class{constructor(n,a){this.downloadFn=n,this.shouldThrowOnError=a}then(n,a){return this.execute().then(n,a)}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};let Iy;Iy=Symbol.toStringTag;var K1=class{constructor(n,a){this.downloadFn=n,this.shouldThrowOnError=a,this[Iy]="BlobDownloadBuilder",this.promise=null}asStream(){return new P1(this.downloadFn,this.shouldThrowOnError)}then(n,a){return this.getPromise().then(n,a)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};const Y1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Ug={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J1=class{constructor(n,a={},r,l){this.shouldThrowOnError=!1,this.url=n,this.headers=a,this.bucketId=r,this.fetch=lf(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(n,a,r,l){var c=this;try{let d;const h=pe(pe({},Ug),l);let m=pe(pe({},c.headers),n==="POST"&&{"x-upsert":String(h.upsert)});const g=h.metadata;typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),g&&d.append("metadata",c.encodeMetadata(g)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),g&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(g))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,g&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(g))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!h.duplex&&(h.duplex="half")),l?.headers&&(m=pe(pe({},m),l.headers));const p=c._removeEmptyFolders(a),v=c._getFinalPath(p),x=await(n=="PUT"?Gd:da)(c.fetch,`${c.url}/object/${v}`,d,pe({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:p,id:x.Id,fullPath:x.Key},error:null}}catch(d){if(c.shouldThrowOnError)throw d;if(Qe(d))return{data:null,error:d};throw d}}async upload(n,a,r){return this.uploadOrUpdate("POST",n,a,r)}async uploadToSignedUrl(n,a,r,l){var c=this;const d=c._removeEmptyFolders(n),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);m.searchParams.set("token",a);try{let g;const p=pe({upsert:Ug.upsert},l),v=pe(pe({},c.headers),{"x-upsert":String(p.upsert)});return typeof Blob<"u"&&r instanceof Blob?(g=new FormData,g.append("cacheControl",p.cacheControl),g.append("",r)):typeof FormData<"u"&&r instanceof FormData?(g=r,g.append("cacheControl",p.cacheControl)):(g=r,v["cache-control"]=`max-age=${p.cacheControl}`,v["content-type"]=p.contentType),{data:{path:d,fullPath:(await Gd(c.fetch,m.toString(),g,{headers:v})).Key},error:null}}catch(g){if(c.shouldThrowOnError)throw g;if(Qe(g))return{data:null,error:g};throw g}}async createSignedUploadUrl(n,a){var r=this;try{let l=r._getFinalPath(n);const c=pe({},r.headers);a?.upsert&&(c["x-upsert"]="true");const d=await da(r.fetch,`${r.url}/object/upload/sign/${l}`,{},{headers:c}),h=new URL(r.url+d.url),m=h.searchParams.get("token");if(!m)throw new qo("No token returned by API");return{data:{signedUrl:h.toString(),path:n,token:m},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async update(n,a,r){return this.uploadOrUpdate("PUT",n,a,r)}async move(n,a,r){var l=this;try{return{data:await da(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:n,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers}),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async copy(n,a,r){var l=this;try{return{data:{path:(await da(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:n,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers})).Key},error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async createSignedUrl(n,a,r){var l=this;try{let c=l._getFinalPath(n),d=await da(l.fetch,`${l.url}/object/sign/${c}`,pe({expiresIn:a},r?.transform?{transform:r.transform}:{}),{headers:l.headers});const h=r?.download?`&download=${r.download===!0?"":r.download}`:"";return d={signedUrl:encodeURI(`${l.url}${d.signedURL}${h}`)},{data:d,error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async createSignedUrls(n,a,r){var l=this;try{const c=await da(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:a,paths:n},{headers:l.headers}),d=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:c.map(h=>pe(pe({},h),{},{signedUrl:h.signedURL?encodeURI(`${l.url}${h.signedURL}${d}`):null})),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}download(n,a){const r=typeof a?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(a?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(n),h=()=>Oi(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new K1(h,this.shouldThrowOnError)}async info(n){var a=this;const r=a._getFinalPath(n);try{return{data:Id(await Oi(a.fetch,`${a.url}/object/info/${r}`,{headers:a.headers})),error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async exists(n){var a=this;const r=a._getFinalPath(n);try{return await G1(a.fetch,`${a.url}/object/${r}`,{headers:a.headers}),{data:!0,error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Qe(l)&&l instanceof Vd){const c=l.originalError;if([400,404].includes(c?.status))return{data:!1,error:l}}throw l}}getPublicUrl(n,a){const r=this._getFinalPath(n),l=[],c=a?.download?`download=${a.download===!0?"":a.download}`:"";c!==""&&l.push(c);const d=typeof a?.transform<"u"?"render/image":"object",h=this.transformOptsToQueryString(a?.transform||{});h!==""&&l.push(h);let m=l.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${r}${m}`)}}}async remove(n){var a=this;try{return{data:await of(a.fetch,`${a.url}/object/${a.bucketId}`,{prefixes:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async list(n,a,r){var l=this;try{const c=pe(pe(pe({},Y1),a),{},{prefix:n||""});return{data:await da(l.fetch,`${l.url}/object/list/${l.bucketId}`,c,{headers:l.headers},r),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async listV2(n,a){var r=this;try{const l=pe({},n);return{data:await da(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,l,{headers:r.headers},a),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(n){const a=[];return n.width&&a.push(`width=${n.width}`),n.height&&a.push(`height=${n.height}`),n.resize&&a.push(`resize=${n.resize}`),n.format&&a.push(`format=${n.format}`),n.quality&&a.push(`quality=${n.quality}`),a.join("&")}};const Gy="2.90.1",Py={"X-Client-Info":`storage-js/${Gy}`};var X1=class{constructor(n,a={},r,l){this.shouldThrowOnError=!1;const c=new URL(n);l?.useNewHostname&&/supabase\.(co|in|red)$/.test(c.hostname)&&!c.hostname.includes("storage.supabase.")&&(c.hostname=c.hostname.replace("supabase.","storage.supabase.")),this.url=c.href.replace(/\/$/,""),this.headers=pe(pe({},Py),a),this.fetch=lf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(n){var a=this;try{const r=a.listBucketOptionsToQueryString(n);return{data:await Oi(a.fetch,`${a.url}/bucket${r}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async getBucket(n){var a=this;try{return{data:await Oi(a.fetch,`${a.url}/bucket/${n}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async createBucket(n,a={public:!1}){var r=this;try{return{data:await da(r.fetch,`${r.url}/bucket`,{id:n,name:n,type:a.type,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async updateBucket(n,a){var r=this;try{return{data:await Gd(r.fetch,`${r.url}/bucket/${n}`,{id:n,name:n,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async emptyBucket(n){var a=this;try{return{data:await da(a.fetch,`${a.url}/bucket/${n}/empty`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await of(a.fetch,`${a.url}/bucket/${n}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(n){const a={};return n&&("limit"in n&&(a.limit=String(n.limit)),"offset"in n&&(a.offset=String(n.offset)),n.search&&(a.search=n.search),n.sortColumn&&(a.sortColumn=n.sortColumn),n.sortOrder&&(a.sortOrder=n.sortOrder)),Object.keys(a).length>0?"?"+new URLSearchParams(a).toString():""}},Q1=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},Py),a),this.fetch=lf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var a=this;try{return{data:await da(a.fetch,`${a.url}/bucket`,{name:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async listBuckets(n){var a=this;try{const r=new URLSearchParams;n?.limit!==void 0&&r.set("limit",n.limit.toString()),n?.offset!==void 0&&r.set("offset",n.offset.toString()),n?.sortColumn&&r.set("sortColumn",n.sortColumn),n?.sortOrder&&r.set("sortOrder",n.sortOrder),n?.search&&r.set("search",n.search);const l=r.toString(),c=l?`${a.url}/bucket?${l}`:`${a.url}/bucket`;return{data:await Oi(a.fetch,c,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await of(a.fetch,`${a.url}/bucket/${n}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}from(n){var a=this;if(!B1(n))throw new qo("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new M1({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>a.headers},fetch:this.fetch}),l=this.shouldThrowOnError;return new Proxy(r,{get(c,d){const h=c[d];return typeof h!="function"?h:async(...m)=>{try{return{data:await h.apply(c,m),error:null}}catch(g){if(l)throw g;return{data:null,error:g}}}}})}};const cf={"X-Client-Info":`storage-js/${Gy}`,"Content-Type":"application/json"};var Ky=class extends Error{constructor(n){super(n),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Jt(n){return typeof n=="object"&&n!==null&&"__isStorageVectorsError"in n}var bd=class extends Ky{constructor(n,a,r){super(n),this.name="StorageVectorsApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Z1=class extends Ky{constructor(n,a){super(n),this.name="StorageVectorsUnknownError",this.originalError=a}};const uf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),F1=n=>{if(typeof n!="object"||n===null)return!1;const a=Object.getPrototypeOf(n);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Lg=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),W1=async(n,a,r)=>{if(n&&typeof n=="object"&&"status"in n&&"ok"in n&&typeof n.status=="number"&&!r?.noResolveJson){const l=n.status||500,c=n;if(typeof c.json=="function")c.json().then(d=>{const h=d?.statusCode||d?.code||l+"";a(new bd(Lg(d),l,h))}).catch(()=>{const d=l+"";a(new bd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new bd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new Z1(Lg(n),n))},eS=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return l?(F1(l)?(c.headers=pe({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,pe(pe({},c),r)):c};async function tS(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,eS(a,l,c,d)).then(g=>{if(!g.ok)throw g;if(l?.noResolveJson)return g;const p=g.headers.get("content-type");return!p||!p.includes("application/json")?{}:g.json()}).then(g=>h(g)).catch(g=>W1(g,m,l))})}async function Xt(n,a,r,l,c){return tS(n,"POST",a,l,c,r)}var aS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},cf),a),this.fetch=uf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/CreateIndex`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async getIndex(n,a){var r=this;try{return{data:await Xt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Jt(l))return{data:null,error:l};throw l}}async listIndexes(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/ListIndexes`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async deleteIndex(n,a){var r=this;try{return{data:await Xt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Jt(l))return{data:null,error:l};throw l}}},nS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},cf),a),this.fetch=uf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(n){var a=this;try{if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Xt(a.fetch,`${a.url}/PutVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async getVectors(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/GetVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async listVectors(n){var a=this;try{if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return{data:await Xt(a.fetch,`${a.url}/ListVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async queryVectors(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/QueryVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async deleteVectors(n){var a=this;try{if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Xt(a.fetch,`${a.url}/DeleteVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}},sS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},cf),a),this.fetch=uf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async getBucket(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async listBuckets(n={}){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/ListVectorBuckets`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await Xt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Jt(r))return{data:null,error:r};throw r}}},rS=class extends sS{constructor(n,a={}){super(n,a.headers||{},a.fetch)}from(n){return new iS(this.url,this.headers,n,this.fetch)}async createBucket(n){var a=()=>super.createBucket,r=this;return a().call(r,n)}async getBucket(n){var a=()=>super.getBucket,r=this;return a().call(r,n)}async listBuckets(n={}){var a=()=>super.listBuckets,r=this;return a().call(r,n)}async deleteBucket(n){var a=()=>super.deleteBucket,r=this;return a().call(r,n)}},iS=class extends aS{constructor(n,a,r,l){super(n,a,l),this.vectorBucketName=r}async createIndex(n){var a=()=>super.createIndex,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(n={}){var a=()=>super.listIndexes,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(n){var a=()=>super.getIndex,r=this;return a().call(r,r.vectorBucketName,n)}async deleteIndex(n){var a=()=>super.deleteIndex,r=this;return a().call(r,r.vectorBucketName,n)}index(n){return new lS(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},lS=class extends nS{constructor(n,a,r,l,c){super(n,a,c),this.vectorBucketName=r,this.indexName=l}async putVectors(n){var a=()=>super.putVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(n){var a=()=>super.getVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(n={}){var a=()=>super.listVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(n){var a=()=>super.queryVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(n){var a=()=>super.deleteVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},oS=class extends X1{constructor(n,a={},r,l){super(n,a,r,l)}from(n){return new J1(this.url,this.headers,n,this.fetch)}get vectors(){return new rS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Q1(this.url+"/iceberg",this.headers,this.fetch)}};const Yy="2.90.1",hr=30*1e3,Pd=3,xd=Pd*hr,cS="http://localhost:9999",uS="supabase.auth.token",dS={"X-Client-Info":`gotrue-js/${Yy}`},Kd="X-Supabase-Api-Version",Jy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},fS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,hS=600*1e3;class Ri extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function oe(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class mS extends Ri{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function pS(n){return oe(n)&&n.name==="AuthApiError"}class as extends Ri{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class Fa extends Ri{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Yt extends Fa{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function gS(n){return oe(n)&&n.name==="AuthSessionMissingError"}class sr extends Fa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class mo extends Fa{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class po extends Fa{constructor(a,r=null){super(a,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function yS(n){return oe(n)&&n.name==="AuthImplicitGrantRedirectError"}class Bg extends Fa{constructor(a,r=null){super(a,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class vS extends Fa{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Yd extends Fa{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function wd(n){return oe(n)&&n.name==="AuthRetryableFetchError"}class qg extends Fa{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Jd extends Fa{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const Oo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),$g=`
35
- \r=`.split(""),bS=(()=>{const n=new Array(128);for(let a=0;a<n.length;a+=1)n[a]=-1;for(let a=0;a<$g.length;a+=1)n[$g[a].charCodeAt(0)]=-2;for(let a=0;a<Oo.length;a+=1)n[Oo[a].charCodeAt(0)]=a;return n})();function Hg(n,a,r){if(n!==null)for(a.queue=a.queue<<8|n,a.queuedBits+=8;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(Oo[l]),a.queuedBits-=6}else if(a.queuedBits>0)for(a.queue=a.queue<<6-a.queuedBits,a.queuedBits=6;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(Oo[l]),a.queuedBits-=6}}function Xy(n,a,r){const l=bS[n];if(l>-1)for(a.queue=a.queue<<6|l,a.queuedBits+=6;a.queuedBits>=8;)r(a.queue>>a.queuedBits-8&255),a.queuedBits-=8;else{if(l===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function Vg(n){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{_S(h,l,r)};for(let h=0;h<n.length;h+=1)Xy(n.charCodeAt(h),c,d);return a.join("")}function xS(n,a){if(n<=127){a(n);return}else if(n<=2047){a(192|n>>6),a(128|n&63);return}else if(n<=65535){a(224|n>>12),a(128|n>>6&63),a(128|n&63);return}else if(n<=1114111){a(240|n>>18),a(128|n>>12&63),a(128|n>>6&63),a(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function wS(n,a){for(let r=0;r<n.length;r+=1){let l=n.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(n.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}xS(l,a)}}function _S(n,a,r){if(a.utf8seq===0){if(n<=127){r(n);return}for(let l=1;l<6;l+=1)if((n>>7-l&1)===0){a.utf8seq=l;break}if(a.utf8seq===2)a.codepoint=n&31;else if(a.utf8seq===3)a.codepoint=n&15;else if(a.utf8seq===4)a.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");a.utf8seq-=1}else if(a.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");a.codepoint=a.codepoint<<6|n&63,a.utf8seq-=1,a.utf8seq===0&&r(a.codepoint)}}function vr(n){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<n.length;c+=1)Xy(n.charCodeAt(c),r,l);return new Uint8Array(a)}function SS(n){const a=[];return wS(n,r=>a.push(r)),new Uint8Array(a)}function ns(n){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};return n.forEach(c=>Hg(c,r,l)),Hg(null,r,l),a.join("")}function jS(n){return Math.round(Date.now()/1e3)+n}function ES(){return Symbol("auth-callback")}const Nt=()=>typeof window<"u"&&typeof document<"u",Fn={tested:!1,writable:!1},Qy=()=>{if(!Nt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Fn.tested)return Fn.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),Fn.tested=!0,Fn.writable=!0}catch{Fn.tested=!0,Fn.writable=!1}return Fn.writable};function NS(n){const a={},r=new URL(n);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((c,d)=>{a[d]=c})}catch{}return r.searchParams.forEach((l,c)=>{a[c]=l}),a}const Zy=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),TS=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",mr=async(n,a,r)=>{await n.setItem(a,JSON.stringify(r))},Wn=async(n,a)=>{const r=await n.getItem(a);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Et=async(n,a)=>{await n.removeItem(a)};class $o{constructor(){this.promise=new $o.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}$o.promiseConstructor=Promise;function _d(n){const a=n.split(".");if(a.length!==3)throw new Jd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!fS.test(a[l]))throw new Jd("JWT not in base64url format");return{header:JSON.parse(Vg(a[0])),payload:JSON.parse(Vg(a[1])),signature:vr(a[2]),raw:{header:a[0],payload:a[1]}}}async function AS(n){return await new Promise(a=>{setTimeout(()=>a(null),n)})}function CS(n,a){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await n(d);if(!a(d,null,h)){l(h);return}}catch(h){if(!a(d,h)){c(h);return}}})()})}function kS(n){return("0"+n.toString(16)).substr(-2)}function OS(){const a=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",l=r.length;let c="";for(let d=0;d<56;d++)c+=r.charAt(Math.floor(Math.random()*l));return c}return crypto.getRandomValues(a),Array.from(a,kS).join("")}async function RS(n){const r=new TextEncoder().encode(n),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function DS(n){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),n;const r=await RS(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function rr(n,a,r=!1){const l=OS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await mr(n,`${a}-code-verifier`,c);const d=await DS(l);return[d,l===d?"plain":"s256"]}const MS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function zS(n){const a=n.headers.get(Kd);if(!a||!a.match(MS))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function US(n){if(!n)throw new Error("Missing exp claim");const a=Math.floor(Date.now()/1e3);if(n<=a)throw new Error("JWT has expired")}function LS(n){switch(n){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const BS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ir(n){if(!BS.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Sd(){const n={};return new Proxy(n,{get:(a,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const l=r.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(a,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(a,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function qS(n,a){return new Proxy(n,{get:(r,l,c)=>{if(l==="__isInsecureUserWarningProxy")return!0;if(typeof l=="symbol"){const d=l.toString();if(d==="Symbol(Symbol.toPrimitive)"||d==="Symbol(Symbol.toStringTag)"||d==="Symbol(util.inspect.custom)"||d==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,l,c)}return!a.value&&typeof l=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),a.value=!0),Reflect.get(r,l,c)}})}function Ig(n){return JSON.parse(JSON.stringify(n))}const es=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),$S=[502,503,504];async function Gg(n){var a;if(!TS(n))throw new Yd(es(n),0);if($S.includes(n.status))throw new Yd(es(n),n.status);let r;try{r=await n.json()}catch(d){throw new as(es(d),d)}let l;const c=zS(n);if(c&&c.getTime()>=Jy["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?l=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(l=r.error_code),l){if(l==="weak_password")throw new qg(es(r),n.status,((a=r.weak_password)===null||a===void 0?void 0:a.reasons)||[]);if(l==="session_not_found")throw new Yt}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((d,h)=>d&&typeof h=="string",!0))throw new qg(es(r),n.status,r.weak_password.reasons);throw new mS(es(r),n.status||500,l)}const HS=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return n==="GET"?c:(c.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},a?.headers),c.body=JSON.stringify(l),Object.assign(Object.assign({},c),r))};async function me(n,a,r,l){var c;const d=Object.assign({},l?.headers);d[Kd]||(d[Kd]=Jy["2024-01-01"].name),l?.jwt&&(d.Authorization=`Bearer ${l.jwt}`);const h=(c=l?.query)!==null&&c!==void 0?c:{};l?.redirectTo&&(h.redirect_to=l.redirectTo);const m=Object.keys(h).length?"?"+new URLSearchParams(h).toString():"",g=await VS(n,a,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(g):{data:Object.assign({},g),error:null}}async function VS(n,a,r,l,c,d){const h=HS(a,l,c,d);let m;try{m=await n(r,Object.assign({},h))}catch(g){throw console.error(g),new Yd(es(g),0)}if(m.ok||await Gg(m),l?.noResolveJson)return m;try{return await m.json()}catch(g){await Gg(g)}}function ua(n){var a;let r=null;PS(n)&&(r=Object.assign({},n),n.expires_at||(r.expires_at=jS(n.expires_in)));const l=(a=n.user)!==null&&a!==void 0?a:n;return{data:{session:r,user:l},error:null}}function Pg(n){const a=ua(n);return!a.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(a.data.weak_password=n.weak_password),a}function kn(n){var a;return{data:{user:(a=n.user)!==null&&a!==void 0?a:n},error:null}}function IS(n){return{data:n,error:null}}function GS(n){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=n,h=Nr(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),m={action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d},g=Object.assign({},h);return{data:{properties:m,user:g},error:null}}function Kg(n){return n}function PS(n){return n.access_token&&n.refresh_token&&n.expires_in}const jd=["global","local","others"];class KS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Zy(l),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(a,r=jd[0]){if(jd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${jd.join(", ")}`);try{return await me(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:a,noResolveJson:!0}),{data:null,error:null}}catch(l){if(oe(l))return{data:null,error:l};throw l}}async inviteUserByEmail(a,r={}){try{return await me(this.fetch,"POST",`${this.url}/invite`,{body:{email:a,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:kn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Nr(a,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await me(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:GS,redirectTo:r?.redirectTo})}catch(r){if(oe(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(a){try{return await me(this.fetch,"POST",`${this.url}/admin/users`,{body:a,headers:this.headers,xform:kn})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async listUsers(a){var r,l,c,d,h,m,g;try{const p={nextPage:null,lastPage:0,total:0},v=await me(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=a?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=a?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:Kg});if(v.error)throw v.error;const x=await v.json(),_=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(g=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return S.length>0&&(S.forEach(A=>{const E=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);p[`${k}Page`]=E}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},x),p),error:null}}catch(p){if(oe(p))return{data:{users:[]},error:p};throw p}}async getUserById(a){ir(a);try{return await me(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:kn})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){ir(a);try{return await me(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:kn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){ir(a);try{return await me(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:kn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){ir(a.userId);try{const{data:r,error:l}=await me(this.fetch,"GET",`${this.url}/admin/users/${a.userId}/factors`,{headers:this.headers,xform:c=>({data:{factors:c},error:null})});return{data:r,error:l}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _deleteFactor(a){ir(a.userId),ir(a.id);try{return{data:await me(this.fetch,"DELETE",`${this.url}/admin/users/${a.userId}/factors/${a.id}`,{headers:this.headers}),error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _listOAuthClients(a){var r,l,c,d,h,m,g;try{const p={nextPage:null,lastPage:0,total:0},v=await me(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=a?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=a?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:Kg});if(v.error)throw v.error;const x=await v.json(),_=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(g=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return S.length>0&&(S.forEach(A=>{const E=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);p[`${k}Page`]=E}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},x),p),error:null}}catch(p){if(oe(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(a){try{return await me(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:a,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _getOAuthClient(a){try{return await me(this.fetch,"GET",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _updateOAuthClient(a,r){try{return await me(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${a}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(oe(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(a){try{return await me(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(a){try{return await me(this.fetch,"POST",`${this.url}/admin/oauth/clients/${a}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}}function Yg(n={}){return{getItem:a=>n[a]||null,setItem:(a,r)=>{n[a]=r},removeItem:a=>{delete n[a]}}}const lr={debug:!!(globalThis&&Qy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Fy extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class YS extends Fy{}async function JS(n,a,r){lr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",n,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),lr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",n)},a),await Promise.resolve().then(()=>globalThis.navigator.locks.request(n,a===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:l.signal},async c=>{if(c){lr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",n,c.name);try{return await r()}finally{lr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",n,c.name)}}else{if(a===0)throw lr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",n),new YS(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(lr.debug)try{const d=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(d,null," "))}catch(d){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",d)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}}))}function XS(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Wy(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function QS(n){return parseInt(n,16)}function ZS(n){const a=new TextEncoder().encode(n);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function FS(n){var a;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:g,resources:p,scheme:v,uri:x,version:_}=n;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!l)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(h&&h.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${h}`);if(!x)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(_!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${_}`);if(!((a=n.statement)===null||a===void 0)&&a.includes(`
36
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const S=Wy(n.address),A=v?`${v}://${l}`:l,E=n.statement?`${n.statement}
37
- `:"",k=`${A} wants you to sign in with your Ethereum account:
38
- ${S}
39
-
40
- ${E}`;let O=`URI: ${x}
41
- Version: ${_}
42
- Chain ID: ${r}${h?`
43
- Nonce: ${h}`:""}
44
- Issued At: ${d.toISOString()}`;if(c&&(O+=`
45
- Expiration Time: ${c.toISOString()}`),m&&(O+=`
46
- Not Before: ${m.toISOString()}`),g&&(O+=`
47
- Request ID: ${g}`),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
- - ${B}`}O+=q}return`${k}
50
- ${O}`}class ot extends Error{constructor({message:a,code:r,cause:l,name:c}){var d;super(a,{cause:l}),this.__isWebAuthnError=!0,this.name=(d=c??(l instanceof Error?l.name:void 0))!==null&&d!==void 0?d:"Unknown Error",this.code=r}}class Ro extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function WS({error:n,options:a}){var r,l,c;const{publicKey:d}=a;if(!d)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((r=d.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ot({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(a.mediation==="conditional"&&((l=d.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new ot({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((c=d.authenticatorSelection)===null||c===void 0?void 0:c.userVerification)==="required")return new ot({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new ot({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new ot({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return d.pubKeyCredParams.filter(m=>m.type==="public-key").length===0?new ot({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new ot({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const h=window.location.hostname;if(ev(h)){if(d.rp.id!==h)return new ot({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(d.user.id.byteLength<1||d.user.id.byteLength>64)return new ot({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new ot({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function ej({error:n,options:a}){const{publicKey:r}=a;if(!r)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new ot({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const l=window.location.hostname;if(ev(l)){if(r.rpId!==l)return new ot({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new ot({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class tj{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const a=new AbortController;return this.controller=a,a.signal}cancelCeremony(){if(this.controller){const a=new Error("Manually cancelling existing WebAuthn API call");a.name="AbortError",this.controller.abort(a),this.controller=void 0}}}const aj=new tj;function nj(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:a,user:r,excludeCredentials:l}=n,c=Nr(n,["challenge","user","excludeCredentials"]),d=vr(a).buffer,h=Object.assign(Object.assign({},r),{id:vr(r.id).buffer}),m=Object.assign(Object.assign({},c),{challenge:d,user:h});if(l&&l.length>0){m.excludeCredentials=new Array(l.length);for(let g=0;g<l.length;g++){const p=l[g];m.excludeCredentials[g]=Object.assign(Object.assign({},p),{id:vr(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return m}function sj(n){if(!n)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(n);const{challenge:a,allowCredentials:r}=n,l=Nr(n,["challenge","allowCredentials"]),c=vr(a).buffer,d=Object.assign(Object.assign({},l),{challenge:c});if(r&&r.length>0){d.allowCredentials=new Array(r.length);for(let h=0;h<r.length;h++){const m=r[h];d.allowCredentials[h]=Object.assign(Object.assign({},m),{id:vr(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function rj(n){var a;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const r=n;return{id:n.id,rawId:n.id,response:{attestationObject:ns(new Uint8Array(n.response.attestationObject)),clientDataJSON:ns(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function ij(n){var a;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const r=n,l=n.getClientExtensionResults(),c=n.response;return{id:n.id,rawId:n.id,response:{authenticatorData:ns(new Uint8Array(c.authenticatorData)),clientDataJSON:ns(new Uint8Array(c.clientDataJSON)),signature:ns(new Uint8Array(c.signature)),userHandle:c.userHandle?ns(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function ev(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function Jg(){var n,a;return!!(Nt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.create)=="function"&&typeof((a=navigator?.credentials)===null||a===void 0?void 0:a.get)=="function")}async function lj(n){try{const a=await navigator.credentials.create(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Ro("Browser returned unexpected credential type",a)}:{data:null,error:new Ro("Empty credential response",a)}}catch(a){return{data:null,error:WS({error:a,options:n})}}}async function oj(n){try{const a=await navigator.credentials.get(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Ro("Browser returned unexpected credential type",a)}:{data:null,error:new Ro("Empty credential response",a)}}catch(a){return{data:null,error:ej({error:a,options:n})}}}const cj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},uj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Do(...n){const a=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of n)if(c)for(const d in c){const h=c[d];if(h!==void 0)if(Array.isArray(h))l[d]=h;else if(r(h))l[d]=h;else if(a(h)){const m=l[d];a(m)?l[d]=Do(m,h):l[d]=Do(h)}else l[d]=h}return l}function dj(n,a){return Do(cj,n,a||{})}function fj(n,a){return Do(uj,n,a||{})}class hj{constructor(a){this.client=a,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(a){return this.client.mfa.enroll(Object.assign(Object.assign({},a),{factorType:"webauthn"}))}async _challenge({factorId:a,webauthn:r,friendlyName:l,signal:c},d){try{const{data:h,error:m}=await this.client.mfa.challenge({factorId:a,webauthn:r});if(!h)return{data:null,error:m};const g=c??aj.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=dj(h.webauthn.credential_options.publicKey,d?.create),{data:v,error:x}=await lj({publicKey:p,signal:g});return v?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:x}}case"request":{const p=fj(h.webauthn.credential_options.publicKey,d?.request),{data:v,error:x}=await oj(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:p,signal:g}));return v?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:x}}}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new as("Unexpected error in challenge",h)}}}async _verify({challengeId:a,factorId:r,webauthn:l}){return this.client.mfa.verify({factorId:r,challengeId:a,webauthn:l})}async _authenticate({factorId:a,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new Ri("rpId is required for WebAuthn authentication")};try{if(!Jg())return{data:null,error:new as("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this.challenge({factorId:a,webauthn:{rpId:r,rpOrigins:l},signal:c},{request:d});if(!h)return{data:null,error:m};const{webauthn:g}=h;return this._verify({factorId:a,challengeId:h.challengeId,webauthn:{type:g.type,rpId:r,rpOrigins:l,credential_response:g.credential_response}})}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new as("Unexpected error in authenticate",h)}}}async _register({friendlyName:a,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new Ri("rpId is required for WebAuthn registration")};try{if(!Jg())return{data:null,error:new as("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this._enroll({friendlyName:a});if(!h)return await this.client.mfa.listFactors().then(v=>{var x;return(x=v.data)===null||x===void 0?void 0:x.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===a&&_.status!=="unverified")}).then(v=>v?this.client.mfa.unenroll({factorId:v?.id}):void 0),{data:null,error:m};const{data:g,error:p}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return g?this._verify({factorId:h.id,challengeId:g.challengeId,webauthn:{rpId:r,rpOrigins:l,type:g.webauthn.type,credential_response:g.webauthn.credential_response}}):{data:null,error:p}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new as("Unexpected error in register",h)}}}}XS();const mj={url:cS,storageKey:uS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:dS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Xg(n,a,r){return await r()}const or={};class Di{get jwks(){var a,r;return(r=(a=or[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){or[this.storageKey]=Object.assign(Object.assign({},or[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=or[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){or[this.storageKey]=Object.assign(Object.assign({},or[this.storageKey]),{cachedAt:a})}constructor(a){var r,l,c;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const d=Object.assign(Object.assign({},mj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Di.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Di.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Nt()){const h=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(h),this.logDebugMessages&&console.trace(h)}if(this.persistSession=d.persistSession,this.autoRefreshToken=d.autoRefreshToken,this.admin=new KS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Zy(d.fetch),this.lock=d.lock||Xg,this.detectSessionInUrl=d.detectSessionInUrl,this.flowType=d.flowType,this.hasCustomAuthorizationHeader=d.hasCustomAuthorizationHeader,this.throwOnError=d.throwOnError,this.lockAcquireTimeout=d.lockAcquireTimeout,d.lock?this.lock=d.lock:this.persistSession&&Nt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=JS:this.lock=Xg,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new hj(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(d.storage?this.storage=d.storage:Qy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Yg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Yg(this.memoryStorage)),Nt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(h){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",h)}(c=this.broadcastChannel)===null||c===void 0||c.addEventListener("message",async h=>{this._debug("received broadcast notification from other tab or client",h),await this._notifyAllSubscribers(h.data.event,h.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(a){if(this.throwOnError&&a&&a.error)throw a.error;return a}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Yy}) ${new Date().toISOString()}`}_debug(...a){return this.logDebugMessages&&this.logger(this._logPrefix(),...a),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var a;try{let r={},l="none";if(Nt()&&(r=NS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Nt()&&this.detectSessionInUrl&&l!=="none"){const{data:c,error:d}=await this._getSessionFromURL(r,l);if(d){if(this._debug("#_initialize()","error detecting session from URL",d),yS(d)){const g=(a=d.details)===null||a===void 0?void 0:a.code;if(g==="identity_already_exists"||g==="identity_not_found"||g==="single_identity_not_deletable")return{error:d}}return{error:d}}const{session:h,redirectType:m}=c;return this._debug("#_initialize()","detected session in URL",h,"redirect type",m),await this._saveSession(h),setTimeout(async()=>{m==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",h):await this._notifyAllSubscribers("SIGNED_IN",h)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return oe(r)?this._returnResult({error:r}):this._returnResult({error:new as("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(a){var r,l,c;try{const d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(l=(r=a?.options)===null||r===void 0?void 0:r.data)!==null&&l!==void 0?l:{},gotrue_meta_security:{captcha_token:(c=a?.options)===null||c===void 0?void 0:c.captchaToken}},xform:ua}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const g=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(d){if(oe(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signUp(a){var r,l,c;try{let d;if("email"in a){const{email:v,password:x,options:_}=a;let S=null,A=null;this.flowType==="pkce"&&([S,A]=await rr(this.storage,this.storageKey)),d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_?.emailRedirectTo,body:{email:v,password:x,data:(r=_?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:_?.captchaToken},code_challenge:S,code_challenge_method:A},xform:ua})}else if("phone"in a){const{phone:v,password:x,options:_}=a;d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:x,data:(l=_?.data)!==null&&l!==void 0?l:{},channel:(c=_?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:_?.captchaToken}},xform:ua})}else throw new mo("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await Et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const g=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(d){if(await Et(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signInWithPassword(a){try{let r;if("email"in a){const{email:d,password:h,options:m}=a;r=await me(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:Pg})}else if("phone"in a){const{phone:d,password:h,options:m}=a;r=await me(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:Pg})}else throw new mo("You must provide either an email or phone number and a password");const{data:l,error:c}=r;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const d=new sr;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign({user:l.user,session:l.session},l.weak_password?{weakPassword:l.weak_password}:null),error:c})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(a){var r,l,c,d;return await this._handleProviderSignIn(a.provider,{redirectTo:(r=a.options)===null||r===void 0?void 0:r.redirectTo,scopes:(l=a.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=a.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:(d=a.options)===null||d===void 0?void 0:d.skipBrowserRedirect})}async exchangeCodeForSession(a){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(a))}async signInWithWeb3(a){const{chain:r}=a;switch(r){case"ethereum":return await this.signInWithEthereum(a);case"solana":return await this.signInWithSolana(a);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(a){var r,l,c,d,h,m,g,p,v,x,_;let S,A;if("message"in a)S=a.message,A=a.signature;else{const{chain:E,wallet:k,statement:O,options:q}=a;let B;if(Nt())if(typeof k=="object")B=k;else{const he=window;if("ethereum"in he&&typeof he.ethereum=="object"&&"request"in he.ethereum&&typeof he.ethereum.request=="function")B=he.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");B=k}const G=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),ee=await B.request({method:"eth_requestAccounts"}).then(he=>he).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!ee||ee.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const Q=Wy(ee[0]);let P=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!P){const he=await B.request({method:"eth_chainId"});P=QS(he)}const J={domain:G.host,address:Q,statement:O,uri:G.href,version:"1",chainId:P,nonce:(c=q?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=q?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=q?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(g=q?.signInWithEthereum)===null||g===void 0?void 0:g.notBefore,requestId:(p=q?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(v=q?.signInWithEthereum)===null||v===void 0?void 0:v.resources};S=FS(J),A=await B.request({method:"personal_sign",params:[ZS(S),Q]})}try{const{data:E,error:k}=await me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:A},!((x=a.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(_=a.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:ua});if(k)throw k;if(!E||!E.session||!E.user){const O=new sr;return this._returnResult({data:{user:null,session:null},error:O})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:k})}catch(E){if(oe(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async signInWithSolana(a){var r,l,c,d,h,m,g,p,v,x,_,S;let A,E;if("message"in a)A=a.message,E=a.signature;else{const{chain:k,wallet:O,statement:q,options:B}=a;let G;if(Nt())if(typeof O=="object")G=O;else{const Q=window;if("solana"in Q&&typeof Q.solana=="object"&&("signIn"in Q.solana&&typeof Q.solana.signIn=="function"||"signMessage"in Q.solana&&typeof Q.solana.signMessage=="function"))G=Q.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof O!="object"||!B?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");G=O}const ee=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in G&&G.signIn){const Q=await G.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},B?.signInWithSolana),{version:"1",domain:ee.host,uri:ee.href}),q?{statement:q}:null));let P;if(Array.isArray(Q)&&Q[0]&&typeof Q[0]=="object")P=Q[0];else if(Q&&typeof Q=="object"&&"signedMessage"in Q&&"signature"in Q)P=Q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)A=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),E=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in G)||typeof G.signMessage!="function"||!("publicKey"in G)||typeof G!="object"||!G.publicKey||!("toBase58"in G.publicKey)||typeof G.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");A=[`${ee.host} wants you to sign in with your Solana account:`,G.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${ee.href}`,`Issued At: ${(c=(l=B?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=B?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${B.signInWithSolana.notBefore}`]:[],...!((h=B?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${B.signInWithSolana.expirationTime}`]:[],...!((m=B?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${B.signInWithSolana.chainId}`]:[],...!((g=B?.signInWithSolana)===null||g===void 0)&&g.nonce?[`Nonce: ${B.signInWithSolana.nonce}`]:[],...!((p=B?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${B.signInWithSolana.requestId}`]:[],...!((x=(v=B?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||x===void 0)&&x.length?["Resources",...B.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
51
- `);const Q=await G.signMessage(new TextEncoder().encode(A),"utf8");if(!Q||!(Q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");E=Q}}try{const{data:k,error:O}=await me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:A,signature:ns(E)},!((_=a.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(S=a.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:ua});if(O)throw O;if(!k||!k.session||!k.user){const q=new sr;return this._returnResult({data:{user:null,session:null},error:q})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:O})}catch(k){if(oe(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(a){const r=await Wn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new vS;const{data:d,error:h}=await me(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:l},xform:ua});if(await Et(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new sr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:m})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",d.session)),this._returnResult({data:Object.assign(Object.assign({},d),{redirectType:c??null}),error:h})}catch(d){if(await Et(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:{user:null,session:null,redirectType:null},error:d});throw d}}async signInWithIdToken(a){try{const{options:r,provider:l,token:c,access_token:d,nonce:h}=a,m=await me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:l,id_token:c,access_token:d,nonce:h,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:ua}),{data:g,error:p}=m;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!g||!g.session||!g.user){const v=new sr;return this._returnResult({data:{user:null,session:null},error:v})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:g,error:p})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(a){var r,l,c,d,h;try{if("email"in a){const{email:m,options:g}=a;let p=null,v=null;this.flowType==="pkce"&&([p,v]=await rr(this.storage,this.storageKey));const{error:x}=await me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=g?.data)!==null&&r!==void 0?r:{},create_user:(l=g?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:g?.captchaToken},code_challenge:p,code_challenge_method:v},redirectTo:g?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:x})}if("phone"in a){const{phone:m,options:g}=a,{data:p,error:v}=await me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=g?.data)!==null&&c!==void 0?c:{},create_user:(d=g?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:g?.captchaToken},channel:(h=g?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:v})}throw new mo("You must provide either an email or phone number.")}catch(m){if(await Et(this.storage,`${this.storageKey}-code-verifier`),oe(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async verifyOtp(a){var r,l;try{let c,d;"options"in a&&(c=(r=a.options)===null||r===void 0?void 0:r.redirectTo,d=(l=a.options)===null||l===void 0?void 0:l.captchaToken);const{data:h,error:m}=await me(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},a),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:ua});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const g=h.session,p=h.user;return g?.access_token&&(await this._saveSession(g),await this._notifyAllSubscribers(a.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(c){if(oe(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithSSO(a){var r,l,c,d,h;try{let m=null,g=null;this.flowType==="pkce"&&([m,g]=await rr(this.storage,this.storageKey));const p=await me(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in a?{provider_id:a.providerId}:null),"domain"in a?{domain:a.domain}:null),{redirect_to:(l=(r=a.options)===null||r===void 0?void 0:r.redirectTo)!==null&&l!==void 0?l:void 0}),!((c=a?.options)===null||c===void 0)&&c.captchaToken?{gotrue_meta_security:{captcha_token:a.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:m,code_challenge_method:g}),headers:this.headers,xform:IS});return!((d=p.data)===null||d===void 0)&&d.url&&Nt()&&!(!((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`),oe(m))return this._returnResult({data:null,error:m});throw m}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async a=>{const{data:{session:r},error:l}=a;if(l)throw l;if(!r)throw new Yt;const{error:c}=await me(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:c})})}catch(a){if(oe(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async resend(a){try{const r=`${this.url}/resend`;if("email"in a){const{email:l,type:c,options:d}=a,{error:h}=await me(this.fetch,"POST",r,{headers:this.headers,body:{email:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken}},redirectTo:d?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}else if("phone"in a){const{phone:l,type:c,options:d}=a,{data:h,error:m}=await me(this.fetch,"POST",r,{headers:this.headers,body:{phone:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:h?.message_id},error:m})}throw new mo("You must provide either an email or phone number and a type")}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(a,r){this._debug("#_acquireLock","begin",a);try{if(this.lockAcquired){const l=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),c=(async()=>(await l,await r()))();return this.pendingInLock.push((async()=>{try{await c}catch{}})()),c}return await this.lock(`lock:${this.storageKey}`,a,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const l=r();for(this.pendingInLock.push((async()=>{try{await l}catch{}})()),await l;this.pendingInLock.length;){const c=[...this.pendingInLock];await Promise.all(c),this.pendingInLock.splice(0,c.length)}return await l}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(a){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await a(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let a=null;const r=await Wn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?a=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!a)return{data:{session:null},error:null};const l=a.expires_at?a.expires_at*1e3-Date.now()<xd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",a.expires_at),!l){if(this.userStorage){const h=await Wn(this.userStorage,this.storageKey+"-user");h?.user?a.user=h.user:a.user=Sd()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=qS(a.user,h),h.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:a},error:null}}const{data:c,error:d}=await this._callRefreshToken(a.refresh_token);return d?this._returnResult({data:{session:null},error:d}):this._returnResult({data:{session:c},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(a){if(a)return await this._getUser(a);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(a){try{return a?await me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:a,xform:kn}):await this._useSession(async r=>{var l,c,d;const{data:h,error:m}=r;if(m)throw m;return!(!((l=h.session)===null||l===void 0)&&l.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Yt}:await me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(d=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&d!==void 0?d:void 0,xform:kn})})}catch(r){if(oe(r))return gS(r)&&(await this._removeSession(),await 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 Yt;const h=c.session;let m=null,g=null;this.flowType==="pkce"&&a.email!=null&&([m,g]=await rr(this.storage,this.storageKey));const{data:p,error:v}=await me(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},a),{code_challenge:m,code_challenge_method:g}),jwt:h.access_token,xform:kn});if(v)throw v;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`),oe(l))return this._returnResult({data:{user:null},error:l});throw l}}async setSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(a))}async _setSession(a){try{if(!a.access_token||!a.refresh_token)throw new Yt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=_d(a.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:g}=await this._callRefreshToken(a.refresh_token);if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:g}=await this._getUser(a.access_token);if(g)throw g;d={access_token:a.access_token,refresh_token:a.refresh_token,user:m.user,token_type:"bearer",expires_in:l-r,expires_at:l},await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)}return this._returnResult({data:{user:d.user,session:d},error:null})}catch(r){if(oe(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(a))}async _refreshSession(a){try{return await this._useSession(async r=>{var l;if(!a){const{data:h,error:m}=r;if(m)throw m;a=(l=h.session)!==null&&l!==void 0?l:void 0}if(!a?.refresh_token)throw new Yt;const{data:c,error:d}=await this._callRefreshToken(a.refresh_token);return d?this._returnResult({data:{user:null,session:null},error:d}):c?this._returnResult({data:{user:c.user,session:c},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(a,r){try{if(!Nt())throw new po("No browser detected.");if(a.error||a.error_description||a.error_code)throw new po(a.error_description||"Error in URL with unspecified error_description",{error:a.error||"unspecified_error",code:a.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Bg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new po("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!a.code)throw new Bg("No code detected.");const{data:q,error:B}=await this._exchangeCodeForSession(a.code);if(B)throw B;const G=new URL(window.location.href);return G.searchParams.delete("code"),window.history.replaceState(window.history.state,"",G.toString()),{data:{session:q.session,redirectType:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:d,refresh_token:h,expires_in:m,expires_at:g,token_type:p}=a;if(!d||!m||!h||!p)throw new po("No session defined in URL");const v=Math.round(Date.now()/1e3),x=parseInt(m);let _=v+x;g&&(_=parseInt(g));const S=_-v;S*1e3<=hr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${x}s`);const A=_-x;v-A>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",A,_,v):v-A<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",A,_,v);const{data:E,error:k}=await this._getUser(d);if(k)throw k;const O={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:x,expires_at:_,refresh_token:h,token_type:p,user:E.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:O,redirectType:a.type},error:null})}catch(l){if(oe(l))return this._returnResult({data:{session:null,redirectType:null},error:l});throw l}}_isImplicitGrantCallback(a){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),a):!!(a.access_token||a.error_description)}async _isPKCECallback(a){const r=await Wn(this.storage,`${this.storageKey}-code-verifier`);return!!(a.code&&r)}async signOut(a={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(a))}async _signOut({scope:a}={scope:"global"}){return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({error:d});const h=(l=c.session)===null||l===void 0?void 0:l.access_token;if(h){const{error:m}=await this.admin.signOut(h,a);if(m&&!(pS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=ES(),l={id:r,callback:a,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,l),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:l}}}async _emitInitialSession(a){return await this._useSession(async r=>{var l,c;try{const{data:{session:d},error:h}=r;if(h)throw h;await((l=this.stateChangeEmitters.get(a))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",a,"session",d)}catch(d){await((c=this.stateChangeEmitters.get(a))===null||c===void 0?void 0:c.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",a,"error",d),console.error(d)}})}async resetPasswordForEmail(a,r={}){let l=null,c=null;this.flowType==="pkce"&&([l,c]=await rr(this.storage,this.storageKey,!0));try{return await me(this.fetch,"POST",`${this.url}/recover`,{body:{email:a,code_challenge:l,code_challenge_method:c,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(d){if(await Et(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:null,error:d});throw d}}async getUserIdentities(){var a;try{const{data:r,error:l}=await this.getUser();if(l)throw l;return this._returnResult({data:{identities:(a=r.user.identities)!==null&&a!==void 0?a:[]},error:null})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(a){return"token"in a?this.linkIdentityIdToken(a):this.linkIdentityOAuth(a)}async linkIdentityOAuth(a){var r;try{const{data:l,error:c}=await this._useSession(async d=>{var h,m,g,p,v;const{data:x,error:_}=d;if(_)throw _;const S=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,a.provider,{redirectTo:(h=a.options)===null||h===void 0?void 0:h.redirectTo,scopes:(m=a.options)===null||m===void 0?void 0:m.scopes,queryParams:(g=a.options)===null||g===void 0?void 0:g.queryParams,skipBrowserRedirect:!0});return await me(this.fetch,"GET",S,{headers:this.headers,jwt:(v=(p=x.session)===null||p===void 0?void 0:p.access_token)!==null&&v!==void 0?v:void 0})});if(c)throw c;return Nt()&&!(!((r=a.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(l?.url),this._returnResult({data:{provider:a.provider,url:l?.url},error:null})}catch(l){if(oe(l))return this._returnResult({data:{provider:a.provider,url:null},error:l});throw l}}async linkIdentityIdToken(a){return await this._useSession(async r=>{var l;try{const{error:c,data:{session:d}}=r;if(c)throw c;const{options:h,provider:m,token:g,access_token:p,nonce:v}=a,x=await me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(l=d?.access_token)!==null&&l!==void 0?l:void 0,body:{provider:m,id_token:g,access_token:p,nonce:v,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:ua}),{data:_,error:S}=x;return S?this._returnResult({data:{user:null,session:null},error:S}):!_||!_.session||!_.user?this._returnResult({data:{user:null,session:null},error:new sr}):(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),this._returnResult({data:_,error:S}))}catch(c){if(await Et(this.storage,`${this.storageKey}-code-verifier`),oe(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}})}async unlinkIdentity(a){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)throw h;return await me(this.fetch,"DELETE",`${this.url}/user/identities/${a.identity_id}`,{headers:this.headers,jwt:(c=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(a){const r=`#_refreshAccessToken(${a.substring(0,5)}...)`;this._debug(r,"begin");try{const l=Date.now();return await CS(async c=>(c>0&&await AS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await me(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:a},headers:this.headers,xform:ua})),(c,d)=>{const h=200*Math.pow(2,c);return d&&wd(d)&&Date.now()+h-l<hr})}catch(l){if(this._debug(r,"error",l),oe(l))return this._returnResult({data:{session:null,user:null},error:l});throw l}finally{this._debug(r,"end")}}_isValidSession(a){return typeof a=="object"&&a!==null&&"access_token"in a&&"refresh_token"in a&&"expires_at"in a}async _handleProviderSignIn(a,r){const l=await this._getUrlForProvider(`${this.url}/authorize`,a,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",a,"options",r,"url",l),Nt()&&!r.skipBrowserRedirect&&window.location.assign(l),{data:{provider:a,url:l},error:null}}async _recoverAndRefresh(){var a,r;const l="#_recoverAndRefresh()";this._debug(l,"begin");try{const c=await Wn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await Wn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await mr(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:Sd()}else if(c&&!c.user&&!c.user){const h=await Wn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await Et(this.storage,this.storageKey+"-user"),await mr(this.storage,this.storageKey,c)):c.user=Sd()}if(this._debug(l,"session from storage",c),!this._isValidSession(c)){this._debug(l,"session is not valid"),c!==null&&await this._removeSession();return}const d=((r=c.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<xd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${xd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),wd(h)||(this._debug(l,"refresh failed with a non-retryable error, removing the session",h),await this._removeSession()))}}else if(c.user&&c.user.__isUserNotAvailableProxy===!0)try{const{data:h,error:m}=await this._getUser(c.access_token);!m&&h?.user?(c.user=h.user,await this._saveSession(c),await this._notifyAllSubscribers("SIGNED_IN",c)):this._debug(l,"could not get user data, skipping SIGNED_IN notification")}catch(h){console.error("Error getting user data:",h),this._debug(l,"error getting user data, skipping SIGNED_IN notification",h)}else await this._notifyAllSubscribers("SIGNED_IN",c)}catch(c){this._debug(l,"error",c),console.error(c);return}finally{this._debug(l,"end")}}async _callRefreshToken(a){var r,l;if(!a)throw new Yt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const c=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(c,"begin");try{this.refreshingDeferred=new $o;const{data:d,error:h}=await this._refreshAccessToken(a);if(h)throw h;if(!d.session)throw new Yt;await this._saveSession(d.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",d.session);const m={data:d.session,error:null};return this.refreshingDeferred.resolve(m),m}catch(d){if(this._debug(c,"error",d),oe(d)){const h={data:null,error:d};return wd(d)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(h),h}throw(l=this.refreshingDeferred)===null||l===void 0||l.reject(d),d}finally{this.refreshingDeferred=null,this._debug(c,"end")}}async _notifyAllSubscribers(a,r,l=!0){const c=`#_notifyAllSubscribers(${a})`;this._debug(c,"begin",r,`broadcast = ${l}`);try{this.broadcastChannel&&l&&this.broadcastChannel.postMessage({event:a,session:r});const d=[],h=Array.from(this.stateChangeEmitters.values()).map(async m=>{try{await m.callback(a,r)}catch(g){d.push(g)}});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 mr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Ig(c);await mr(this.storage,this.storageKey,d)}else{const c=Ig(r);await mr(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await 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&&Nt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",a)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const a=setInterval(()=>this._autoRefreshTokenTick(),hr);this.autoRefreshTicker=a,a&&typeof a=="object"&&typeof a.unref=="function"?a.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(a);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const a=this.autoRefreshTicker;this.autoRefreshTicker=null,a&&clearInterval(a);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const a=Date.now();try{return await this._useSession(async r=>{const{data:{session:l}}=r;if(!l||!l.refresh_token||!l.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const c=Math.floor((l.expires_at*1e3-a)/hr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${hr}ms, refresh threshold is ${Pd} ticks`),c<=Pd&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(a){if(a.isAcquireTimeout||a instanceof Fy)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Nt()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(a){console.error("_handleVisibilityChange",a)}}async _onVisibilityChanged(a){const r=`#_onVisibilityChanged(${a})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),a||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(a,r,l){const c=[`provider=${encodeURIComponent(r)}`];if(l?.redirectTo&&c.push(`redirect_to=${encodeURIComponent(l.redirectTo)}`),l?.scopes&&c.push(`scopes=${encodeURIComponent(l.scopes)}`),this.flowType==="pkce"){const[d,h]=await rr(this.storage,this.storageKey),m=new URLSearchParams({code_challenge:`${encodeURIComponent(d)}`,code_challenge_method:`${encodeURIComponent(h)}`});c.push(m.toString())}if(l?.queryParams){const d=new URLSearchParams(l.queryParams);c.push(d.toString())}return l?.skipBrowserRedirect&&c.push(`skip_http_redirect=${l.skipBrowserRedirect}`),`${a}?${c.join("&")}`}async _unenroll(a){try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;return d?this._returnResult({data:null,error:d}):await me(this.fetch,"DELETE",`${this.url}/factors/${a.factorId}`,{headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(a){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({friendly_name:a.friendlyName,factor_type:a.factorType},a.factorType==="phone"?{phone:a.phone}:a.factorType==="totp"?{issuer:a.issuer}:{}),{data:g,error:p}=await me(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(l=d?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(a.factorType==="totp"&&g.type==="totp"&&(!((c=g?.totp)===null||c===void 0)&&c.qr_code)&&(g.totp.qr_code=`data:image/svg+xml;utf-8,${g.totp.qr_code}`),this._returnResult({data:g,error:null}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _verify(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({data:null,error:d});const h=Object.assign({challenge_id:a.challengeId},"webauthn"in a?{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_response:a.webauthn.type==="create"?rj(a.webauthn.credential_response):ij(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:g}=await me(this.fetch,"POST",`${this.url}/factors/${a.factorId}/verify`,{body:h,headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token});return g?this._returnResult({data:null,error:g}):(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:g}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({data:null,error:d});const h=await me(this.fetch,"POST",`${this.url}/factors/${a.factorId}/challenge`,{body:a,headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token});if(h.error)return h;const{data:m}=h;if(m.type!=="webauthn")return{data:m,error:null};switch(m.webauthn.type){case"create":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:nj(m.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:sj(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(a){const{data:r,error:l}=await this._challenge({factorId:a.factorId});return l?this._returnResult({data:null,error:l}):await this._verify({factorId:a.factorId,challengeId:r.id,code:a.code})}async _listFactors(){var a;const{data:{user:r},error:l}=await this.getUser();if(l)return{data:null,error:l};const c={all:[],phone:[],totp:[],webauthn:[]};for(const d of(a=r?.factors)!==null&&a!==void 0?a:[])c.all.push(d),d.status==="verified"&&c[d.factor_type].push(d);return{data:c,error:null}}async _getAuthenticatorAssuranceLevel(){var a,r;const{data:{session:l},error:c}=await this.getSession();if(c)return this._returnResult({data:null,error:c});if(!l)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:d}=_d(l.access_token);let h=null;d.aal&&(h=d.aal);let m=h;((r=(a=l.user.factors)===null||a===void 0?void 0:a.filter(v=>v.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const 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 me(this.fetch,"GET",`${this.url}/oauth/authorizations/${a}`,{headers:this.headers,jwt:l.access_token,xform:d=>({data:d,error:null})}):this._returnResult({data:null,error:new Yt})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(a,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new Yt});const h=await me(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"approve"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Nt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(oe(l))return this._returnResult({data:null,error:l});throw l}}async _denyAuthorization(a,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new Yt});const h=await me(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"deny"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Nt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(oe(l))return this._returnResult({data:null,error:l});throw l}}async _listOAuthGrants(){try{return await this._useSession(async a=>{const{data:{session:r},error:l}=a;return l?this._returnResult({data:null,error:l}):r?await me(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:c=>({data:c,error:null})}):this._returnResult({data:null,error:new Yt})})}catch(a){if(oe(a))return this._returnResult({data:null,error:a});throw a}}async _revokeOAuthGrant(a){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?(await me(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:l.access_token,query:{client_id:a.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Yt})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(a,r={keys:[]}){let l=r.keys.find(m=>m.kid===a);if(l)return l;const c=Date.now();if(l=this.jwks.keys.find(m=>m.kid===a),l&&this.jwks_cached_at+hS>c)return l;const{data:d,error:h}=await me(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(h)throw h;return!d.keys||d.keys.length===0||(this.jwks=d,this.jwks_cached_at=c,l=d.keys.find(m=>m.kid===a),!l)?null:l}async getClaims(a,r={}){try{let l=a;if(!l){const{data:S,error:A}=await this.getSession();if(A||!S.session)return this._returnResult({data:null,error:A});l=S.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:g}}=_d(l);r?.allowExpired||US(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 v=LS(c.alg),x=await crypto.subtle.importKey("jwk",p,v,!0,["verify"]);if(!await crypto.subtle.verify(v,x,h,SS(`${m}.${g}`)))throw new Jd("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(oe(l))return this._returnResult({data:null,error:l});throw l}}}Di.nextInstanceID={};const pj=Di,gj="2.90.1";let ji="";typeof Deno<"u"?ji="deno":typeof document<"u"?ji="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ji="react-native":ji="node";const yj={"X-Client-Info":`supabase-js-${ji}/${gj}`},vj={headers:yj},bj={schema:"public"},xj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},wj={};function Mi(n){"@babel/helpers - typeof";return Mi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Mi(n)}function _j(n,a){if(Mi(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(Mi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function Sj(n){var a=_j(n,"string");return Mi(a)=="symbol"?a:a+""}function jj(n,a,r){return(a=Sj(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function Qg(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(n,c).enumerable})),r.push.apply(r,l)}return r}function et(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Qg(Object(r),!0).forEach(function(l){jj(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Qg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const Ej=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),Nj=()=>Headers,Tj=(n,a,r)=>{const l=Ej(r),c=Nj();return async(d,h)=>{var m;const g=(m=await a())!==null&&m!==void 0?m:n;let p=new c(h?.headers);return p.has("apikey")||p.set("apikey",n),p.has("Authorization")||p.set("Authorization",`Bearer ${g}`),l(d,et(et({},h),{},{headers:p}))}};function Aj(n){return n.endsWith("/")?n:n+"/"}function Cj(n,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=n,{db:g,auth:p,realtime:v,global:x}=a,_={db:et(et({},g),c),auth:et(et({},p),d),realtime:et(et({},v),h),storage:{},global:et(et(et({},x),m),{},{headers:et(et({},(r=x?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return n.accessToken?_.accessToken=n.accessToken:delete _.accessToken,_}function kj(n){const a=n?.trim();if(!a)throw new Error("supabaseUrl is required.");if(!a.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Aj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Oj=class extends pj{constructor(n){super(n)}},Rj=class{constructor(n,a,r){var l,c;this.supabaseUrl=n,this.supabaseKey=a;const d=kj(n);if(!a)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",d),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",d),this.storageUrl=new URL("storage/v1",d),this.functionsUrl=new URL("functions/v1",d);const h=`sb-${d.hostname.split(".")[0]}-auth-token`,m={db:bj,realtime:wj,auth:et(et({},xj),{},{storageKey:h}),global:vj},g=Cj(r??{},m);if(this.storageKey=(l=g.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=g.global.headers)!==null&&c!==void 0?c:{},g.accessToken)this.accessToken=g.accessToken,this.auth=new Proxy({},{get:(v,x)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(x)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=g.auth)!==null&&p!==void 0?p:{},this.headers,g.global.fetch)}this.fetch=Tj(a,this._getAccessToken.bind(this),g.global.fetch),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this)},g.realtime)),this.accessToken&&this.accessToken().then(v=>this.realtime.setAuth(v)).catch(v=>console.warn("Failed to set initial Realtime auth token:",v)),this.rest=new d1(new URL("rest/v1",d).href,{headers:this.headers,schema:g.db.schema,fetch:this.fetch}),this.storage=new oS(this.storageUrl.href,this.headers,this.fetch,r?.storage),g.accessToken||this._listenForAuthEvents()}get functions(){return new i1(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,a={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,a,r)}channel(n,a={config:{}}){return this.realtime.channel(n,a)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,a,r;if(n.accessToken)return await n.accessToken();const{data:l}=await n.auth.getSession();return(a=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:g,throwOnError:p},v,x){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Oj({url:this.authUrl.href,headers:et(et({},_),v),storageKey:d,autoRefreshToken:n,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:g,throwOnError:p,fetch:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new A1(this.realtimeUrl.href,et(et({},n),{},{params:et(et({},{apikey:this.supabaseKey}),n?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,a)=>{this._handleTokenChanged(n,"CLIENT",a?.access_token)})}_handleTokenChanged(n,a,r){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Zg=(n,a,r)=>new Rj(n,a,r);function Dj(){if(typeof window<"u")return!1;const n=globalThis.process;if(!n)return!1;const a=n.version;if(a==null)return!1;const r=a.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Dj()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Ho="email_automator_supabase_config";function Tr(){try{const n=localStorage.getItem(Ho);if(n)return JSON.parse(n)}catch(n){console.error("Error reading Supabase config:",n)}return null}function Mj(n){try{localStorage.setItem(Ho,JSON.stringify(n))}catch(a){console.error("Error saving Supabase config:",a)}}function zj(){try{localStorage.removeItem(Ho)}catch(n){console.error("Error clearing Supabase config:",n)}}async function tv(n,a){try{if(!n.startsWith("http://")&&!n.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const r=a.startsWith("eyJ"),l=a.startsWith("sb_publishable_");if(!r&&!l)return{valid:!1,error:"Invalid API key format (must be anon or publishable key)"};if(l)return{valid:!0};const c=await fetch(`${n}/rest/v1/`,{method:"GET",headers:{apikey:a,Authorization:`Bearer ${a}`}});return c.ok?{valid:!0}:c.status===401||c.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${c.statusText}`}}catch(r){return{valid:!1,error:r instanceof Error?r.message:"Connection failed"}}}function Uj(){return localStorage.getItem(Ho)?"ui":"none"}function Lj(){const n=Tr();return!n||!n.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Zg("https://placeholder.supabase.co","placeholder-key")):Zg(n.url,n.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=Lj();function Fg(){const n=Tr(),a=n?`${n.url}/functions/v1`:"",r=n?n.anonKey:"",l=window.location.port==="5173";let c="";return l?c="http://localhost:3004":c=window.location.origin,{edgeFunctionsUrl:a,expressApiUrl:c,anonKey:r}}class Bj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=Fg();this.edgeFunctionsUrl=a.edgeFunctionsUrl,this.expressApiUrl=a.expressApiUrl,this.anonKey=a.anonKey}setSupabaseClient(a){this.supabaseClient=a}setToken(a){console.debug(a?"[HybridApiClient] Token updated":"[HybridApiClient] Token cleared"),this.token=a}async request(a,r,l={}){const{auth:c=!0,...d}=l,h={"Content-Type":"application/json",...l.headers||{}};if(c&&!this.token&&this.supabaseClient){const{data:{session:m}}=await this.supabaseClient.auth.getSession();m?.access_token&&(this.token=m.access_token,console.debug("[HybridApiClient] Recovered token from session"))}if(c&&!this.token)return console.warn(`[HybridApiClient] Attempted protected request to ${r} without token`),{error:{code:"AUTH_REQUIRED",message:"You must be logged in to perform this action"}};c&&this.token&&(h.Authorization=`Bearer ${this.token}`);try{console.debug(`[HybridApiClient] ${l.method||"GET"} ${a}${r}`);const m=await fetch(`${a}${r}`,{...d,headers:h});if(!m.ok){const p=await m.json().catch(()=>({})),v=typeof p.error=="string"?p.error:p.error?.message||`Request failed: ${m.status}`;return{error:{code:p.error?.code||"API_ERROR",message:v}}}return{data:await m.json()}}catch(m){return{error:{code:"NETWORK_ERROR",message:m instanceof Error?m.message:"Network error"}}}}edgeRequest(a,r){const l={...r?.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,a,{...r,headers:l})}expressRequest(a,r){const l=Fg(),c={...r?.headers||{},"X-Supabase-Url":l.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":l.anonKey};return this.request(this.expressApiUrl,a,{...r,headers:c})}async getGmailAuthUrl(){return this.edgeRequest("/auth-gmail?action=url",{method:"GET"})}async connectGmail(a){return this.edgeRequest("/auth-gmail",{method:"POST",body:JSON.stringify({code:a})})}async startMicrosoftDeviceFlow(){return this.edgeRequest("/auth-microsoft?action=device-flow",{method:"POST"})}async pollMicrosoftDeviceCode(a){return this.edgeRequest("/auth-microsoft?action=poll",{method:"POST",body:JSON.stringify({deviceCode:a})})}async getAccounts(){return this.edgeRequest("/api-v1-accounts")}async disconnectAccount(a){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"DELETE"})}async updateAccount(a,r){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async getEmails(a={}){const r=new URLSearchParams;return a.limit&&r.set("limit",a.limit.toString()),a.offset&&r.set("offset",a.offset.toString()),a.category&&r.set("category",a.category),a.search&&r.set("search",a.search),a.sort_by&&r.set("sort_by",a.sort_by),a.sort_order&&r.set("sort_order",a.sort_order),this.edgeRequest(`/api-v1-emails?${r}`)}async getEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`)}async getEmailEvents(a){return this.edgeRequest(`/api-v1-emails/${a}/events`)}async deleteEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`,{method:"DELETE"})}async getCategorySummary(){return this.edgeRequest("/api-v1-emails/summary/categories")}async getRules(){return this.expressRequest("/api/rules")}async createRule(a){return this.expressRequest("/api/rules",{method:"POST",body:JSON.stringify(a)})}async updateRule(a,r){return this.expressRequest(`/api/rules/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async deleteRule(a){return this.expressRequest(`/api/rules/${a}`,{method:"DELETE"})}async toggleRule(a){return this.expressRequest(`/api/rules/${a}/toggle`,{method:"POST"})}async getSettings(){return this.edgeRequest("/api-v1-settings")}async getRunEvents(a){return this.edgeRequest(`/api-v1-settings/logs/${a}/events`)}async updateSettings(a){return this.edgeRequest("/api-v1-settings",{method:"PATCH",body:JSON.stringify(a)})}async getStats(){return this.edgeRequest("/api-v1-settings/stats")}async testLlm(a){return this.expressRequest("/api/settings/test-llm",{method:"POST",body:JSON.stringify(a)})}async triggerSync(a){return this.expressRequest("/api/sync",{method:"POST",body:JSON.stringify({accountId:a})})}async syncAll(){return this.expressRequest("/api/sync/all",{method:"POST"})}async getSyncLogs(a=10){return this.expressRequest(`/api/sync/logs?limit=${a}`)}async executeAction(a,r,l){return this.expressRequest("/api/actions/execute",{method:"POST",body:JSON.stringify({emailId:a,action:r,draftContent:l})})}async generateDraft(a,r){return this.expressRequest(`/api/actions/draft/${a}`,{method:"POST",body:JSON.stringify({instructions:r})})}async bulkAction(a,r){return this.expressRequest("/api/actions/bulk",{method:"POST",body:JSON.stringify({emailIds:a,action:r})})}async healthCheck(){return this.expressRequest("/api/health",{auth:!1})}async getProfile(){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:a}}=await this.supabaseClient.auth.getUser();if(!a)return{error:"Not authenticated"};const{data:r,error:l}=await this.supabaseClient.from("profiles").select("*").eq("id",a.id).single();return{data:r,error:l}}async updateProfile(a){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:r}}=await this.supabaseClient.auth.getUser();if(!r)return{error:"Not authenticated"};const{data:l,error:c}=await this.supabaseClient.from("profiles").update({...a,updated_at:new Date().toISOString()}).eq("id",r.id).select().single();return{data:l,error:c}}async changePassword(a){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{error:r}=await this.supabaseClient.auth.updateUser({password:a});return{success:!r,error:r}}}const He=new Bj;async function av(n){He.setSupabaseClient(n);const{data:{session:a}}=await n.auth.getSession();a?.access_token&&He.setToken(a.access_token),n.auth.onAuthStateChange((r,l)=>{He.setToken(l?.access_token||null)})}const qj=Object.freeze(Object.defineProperty({__proto__:null,api:He,initializeApi:av},Symbol.toStringTag,{value:"Module"}));function Ja(n,a){return n?typeof n=="string"?n:n.message||a:a}const nv={user:null,isAuthenticated:!1,profile:null,emails:[],accounts:[],rules:[],settings:null,stats:null,isLoading:!0,isInitialized:!1,error:null,selectedEmailId:null,emailsTotal:0,emailsOffset:0,sortBy:"date",sortOrder:"desc"};function $j(n,a){switch(a.type){case"SET_USER":return{...n,user:a.payload,isAuthenticated:!!a.payload,isLoading:!1};case"SET_LOADING":return{...n,isLoading:a.payload};case"SET_INITIALIZED":return{...n,isInitialized:a.payload};case"SET_ERROR":return{...n,error:a.payload,isLoading:!1};case"SET_EMAILS":return{...n,emails:a.payload.emails,emailsTotal:a.payload.total,emailsOffset:a.payload.offset,sortBy:a.payload.sortBy||n.sortBy,sortOrder:a.payload.sortOrder||n.sortOrder};case"ADD_EMAIL":return{...n,emails:[a.payload,...n.emails],emailsTotal:n.emailsTotal+1};case"UPDATE_EMAIL":return{...n,emails:n.emails.map(r=>r.id===a.payload.id?a.payload:r)};case"SET_PROFILE":return{...n,profile:a.payload};case"UPDATE_PROFILE":return{...n,profile:a.payload};case"SET_ACCOUNTS":return{...n,accounts:a.payload};case"ADD_ACCOUNT":return{...n,accounts:[a.payload,...n.accounts]};case"REMOVE_ACCOUNT":return{...n,accounts:n.accounts.filter(r=>r.id!==a.payload)};case"SET_RULES":return{...n,rules:a.payload};case"ADD_RULE":return{...n,rules:[a.payload,...n.rules]};case"UPDATE_RULE":return{...n,rules:n.rules.map(r=>r.id===a.payload.id?a.payload:r)};case"REMOVE_RULE":return{...n,rules:n.rules.filter(r=>r.id!==a.payload)};case"SET_SETTINGS":return{...n,settings:a.payload};case"SET_STATS":return{...n,stats:a.payload};case"SET_SELECTED_EMAIL":return{...n,selectedEmailId:a.payload};case"CLEAR_DATA":return{...nv,isLoading:!1,isInitialized:!0};default:return n}}const sv=w.createContext(null);function Hj({children:n}){const[a,r]=w.useReducer($j,nv);w.useEffect(()=>{async function c(){if(!Tr()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:h}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(h&&h.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await av(ct);const{data:{session:m}}=await ct.auth.getSession();r({type:"SET_USER",payload:m?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:g}}=ct.auth.onAuthStateChange((p,v)=>{r({type:"SET_USER",payload:v?.user||null}),v||r({type:"CLEAR_DATA"})});return()=>g.unsubscribe()}catch(h){console.error("[AppContext] Init error:",h),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}c()},[]);const l={fetchEmails:async(c={})=>{const d=await He.getEmails({limit:20,offset:c.offset||0,category:c.category,search:c.search,sort_by:c.sortBy||a.sortBy,sort_order:c.sortOrder||a.sortOrder});d.data&&r({type:"SET_EMAILS",payload:{emails:d.data.emails,total:d.data.total,offset:c.offset||0,sortBy:c.sortBy,sortOrder:c.sortOrder}})},fetchAccounts:async()=>{const c=await He.getAccounts();c.data&&r({type:"SET_ACCOUNTS",payload:c.data.accounts})},fetchRules:async()=>{const c=await He.getRules();c.data&&r({type:"SET_RULES",payload:c.data.rules})},fetchSettings:async()=>{const c=await He.getSettings();c.data&&r({type:"SET_SETTINGS",payload:c.data.settings})},fetchProfile:async()=>{const c=await He.getProfile();c.data&&r({type:"SET_PROFILE",payload:c.data})},fetchStats:async()=>{const c=await He.getStats();c.data&&r({type:"SET_STATS",payload:c.data.stats})},executeAction:async(c,d,h)=>{const m=await He.executeAction(c,d,h);if(m.data?.success){const g=a.emails.find(p=>p.id===c);return g&&r({type:"UPDATE_EMAIL",payload:{...g,action_taken:d}}),!0}return r({type:"SET_ERROR",payload:Ja(m.error,"Action failed")}),!1},triggerSync:async c=>{const d=c?await He.triggerSync(c):await He.syncAll();return await l.fetchAccounts(),d.error?(r({type:"SET_ERROR",payload:Ja(d.error,"Sync failed")}),!1):!0},disconnectAccount:async c=>{const d=await He.disconnectAccount(c);return d.data?.success?(r({type:"REMOVE_ACCOUNT",payload:c}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to disconnect")}),!1)},updateSettings:async c=>{const d=await He.updateSettings(c);return d.data?(r({type:"SET_SETTINGS",payload:d.data.settings}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to update settings")}),!1)},updateProfile:async c=>{const d=await He.updateProfile(c);return d.data?(r({type:"UPDATE_PROFILE",payload:d.data}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to update profile")}),!1)},updateAccount:async(c,d)=>{const h=await He.updateAccount(c,d);return h.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(m=>m.id===c?{...m,...d}:m)}),!0):(r({type:"SET_ERROR",payload:Ja(h.error,"Failed to update account")}),!1)},createRule:async c=>{const d=await He.createRule(c);return d.data?(r({type:"ADD_RULE",payload:d.data.rule}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to create rule")}),!1)},deleteRule:async c=>{const d=await He.deleteRule(c);return d.data?.success?(r({type:"REMOVE_RULE",payload:c}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to delete rule")}),!1)},toggleRule:async c=>{const d=await He.toggleRule(c);return d.data?(r({type:"UPDATE_RULE",payload:d.data.rule}),!0):(r({type:"SET_ERROR",payload:Ja(d.error,"Failed to toggle rule")}),!1)}};return o.jsx(sv.Provider,{value:{state:a,dispatch:r,actions:l},children:n})}function Ar(){const n=w.useContext(sv);if(!n)throw new Error("useApp must be used within AppProvider");return n}const Vj=w.createContext(void 0);function Ij({children:n,value:a}){return o.jsx(Vj.Provider,{value:a,children:n})}const rv=w.createContext(null);function Gj({children:n}){const[a,r]=w.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(rv.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:n})}function iv(){const n=w.useContext(rv);if(!n)throw new Error("useTerminal must be used within a TerminalProvider");return n}const yt=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ne("rounded-xl border bg-card text-card-foreground shadow",n),...a}));yt.displayName="Card";const _a=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ne("flex flex-col space-y-1.5 p-6",n),...a}));_a.displayName="CardHeader";const Sa=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ne("font-semibold leading-none tracking-tight",n),...a}));Sa.displayName="CardTitle";const Za=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ne("text-sm text-muted-foreground",n),...a}));Za.displayName="CardDescription";const ja=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ne("p-6 pt-0",n),...a}));ja.displayName="CardContent";const lv=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:Ne("flex items-center p-6 pt-0",n),...a}));lv.displayName="CardFooter";class Pj extends w.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,r){console.error("ErrorBoundary caught an error:",a,r)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:o.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:o.jsxs(yt,{className:"max-w-md w-full p-8 text-center",children:[o.jsx("div",{className:"w-16 h-16 bg-destructive/10 text-destructive rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(Sr,{className:"w-8 h-8"})}),o.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),o.jsx("p",{className:"text-muted-foreground mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&o.jsx("pre",{className:"text-xs text-left bg-secondary p-3 rounded-lg mb-6 overflow-auto max-h-32",children:this.state.error.message}),o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsxs(W,{onClick:this.handleReset,variant:"outline",children:[o.jsx(_r,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(W,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}let zi=[],Xd=new Set;function ov(){Xd.forEach(n=>n())}const re={success:(n,a)=>go("success",n,a),error:(n,a)=>go("error",n,a),info:(n,a)=>go("info",n,a),warning:(n,a)=>go("warning",n,a)};function go(n,a,r=5e3){const l=Math.random().toString(36).substr(2,9);zi=[...zi,{id:l,type:n,message:a,duration:r}],ov(),r>0&&setTimeout(()=>cv(l),r)}function cv(n){zi=zi.filter(a=>a.id!==n),ov()}function Kj(){const[,n]=w.useState(0);return w.useEffect(()=>{const a=()=>n(r=>r+1);return Xd.add(a),()=>{Xd.delete(a)}},[]),zi}const Yj={success:tf,error:$i,info:wr,warning:Sr},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:n}){const a=Yj[n.type];return o.jsxs("div",{className:Ne("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[n.type]),children:[o.jsx(a,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),o.jsx("p",{className:"text-sm flex-1",children:n.message}),o.jsx("button",{onClick:()=>cv(n.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(Lo,{className:"w-4 h-4"})})]})}function Qj(){const n=Kj();return n.length===0?null:o.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full",children:n.map(a=>o.jsx(Xj,{toast:a},a.id))})}function ht({size:n="md",className:a,text:r}){const l={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};return o.jsxs("div",{className:Ne("flex flex-col items-center justify-center gap-3",a),children:[o.jsx(qt,{className:Ne("animate-spin text-primary",l[n])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function Ti({text:n="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(ht,{size:"lg",text:n})})}function Zj(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(ht,{size:"md"})})}function On(n,a,{checkForDefaultPrevented:r=!0}={}){return function(c){if(n?.(c),r===!1||!c.defaultPrevented)return a?.(c)}}function Fj(n,a){const r=w.createContext(a),l=d=>{const{children:h,...m}=d,g=w.useMemo(()=>m,Object.values(m));return o.jsx(r.Provider,{value:g,children:h})};l.displayName=n+"Provider";function c(d){const h=w.useContext(r);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${n}\``)}return[l,c]}function Wj(n,a=[]){let r=[];function l(d,h){const m=w.createContext(h),g=r.length;r=[...r,h];const p=x=>{const{scope:_,children:S,...A}=x,E=_?.[n]?.[g]||m,k=w.useMemo(()=>A,Object.values(A));return o.jsx(E.Provider,{value:k,children:S})};p.displayName=d+"Provider";function v(x,_){const S=_?.[n]?.[g]||m,A=w.useContext(S);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${x}\` must be used within \`${d}\``)}return[p,v]}const c=()=>{const d=r.map(h=>w.createContext(h));return function(m){const g=m?.[n]||d;return w.useMemo(()=>({[`__scope${n}`]:{...m,[n]:g}}),[m,g])}};return c.scopeName=n,[l,eE(c,...a)]}function eE(...n){const a=n[0];if(n.length===1)return a;const r=()=>{const l=n.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const h=l.reduce((m,{useScope:g,scopeName:p})=>{const x=g(d)[`__scope${p}`];return{...m,...x}},{});return w.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var Ui=globalThis?.document?w.useLayoutEffect:()=>{},tE=ef[" useId ".trim().toString()]||(()=>{}),aE=0;function Ed(n){const[a,r]=w.useState(tE());return Ui(()=>{r(l=>l??String(aE++))},[n]),n||(a?`radix-${a}`:"")}var nE=ef[" useInsertionEffect ".trim().toString()]||Ui;function sE({prop:n,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=rE({defaultProp:a,onChange:r}),m=n!==void 0,g=m?n:c;{const v=w.useRef(n!==void 0);w.useEffect(()=>{const x=v.current;x!==m&&console.warn(`${l} is changing from ${x?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=m},[m,l])}const p=w.useCallback(v=>{if(m){const x=iE(v)?v(n):v;x!==n&&h.current?.(x)}else d(v)},[m,n,d,h]);return[g,p]}function rE({defaultProp:n,onChange:a}){const[r,l]=w.useState(n),c=w.useRef(r),d=w.useRef(a);return nE(()=>{d.current=a},[a]),w.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function iE(n){return typeof n=="function"}var uv=my();const lE=Fd(uv);function oE(n){const a=cE(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),g=m.find(dE);if(g){const p=g.props.children,v=m.map(x=>x===g?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:x);return o.jsx(a,{...h,ref:c,children:w.isValidElement(p)?w.cloneElement(p,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}function cE(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=hE(c),m=fE(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Bo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var uE=Symbol("radix.slottable");function dE(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===uE}function fE(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const g=d(...m);return c(...m),g}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function hE(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var mE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wa=mE.reduce((n,a)=>{const r=oE(`Primitive.${a}`),l=w.forwardRef((c,d)=>{const{asChild:h,...m}=c,g=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(g,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...n,[a]:l}},{});function pE(n,a){n&&uv.flushSync(()=>n.dispatchEvent(a))}function Li(n){const a=w.useRef(n);return w.useEffect(()=>{a.current=n}),w.useMemo(()=>(...r)=>a.current?.(...r),[])}function gE(n,a=globalThis?.document){const r=Li(n);w.useEffect(()=>{const l=c=>{c.key==="Escape"&&r(c)};return a.addEventListener("keydown",l,{capture:!0}),()=>a.removeEventListener("keydown",l,{capture:!0})},[r,a])}var yE="DismissableLayer",Qd="dismissableLayer.update",vE="dismissableLayer.pointerDownOutside",bE="dismissableLayer.focusOutside",Wg,dv=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fv=w.forwardRef((n,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...g}=n,p=w.useContext(dv),[v,x]=w.useState(null),_=v?.ownerDocument??globalThis?.document,[,S]=w.useState({}),A=ls(a,P=>x(P)),E=Array.from(p.layers),[k]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),O=E.indexOf(k),q=v?E.indexOf(v):-1,B=p.layersWithOutsidePointerEventsDisabled.size>0,G=q>=O,ee=_E(P=>{const J=P.target,he=[...p.branches].some(Ge=>Ge.contains(J));!G||he||(c?.(P),h?.(P),P.defaultPrevented||m?.())},_),Q=SE(P=>{const J=P.target;[...p.branches].some(Ge=>Ge.contains(J))||(d?.(P),h?.(P),P.defaultPrevented||m?.())},_);return gE(P=>{q===p.layers.size-1&&(l?.(P),!P.defaultPrevented&&m&&(P.preventDefault(),m()))},_),w.useEffect(()=>{if(v)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Wg=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),ey(),()=>{r&&p.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=Wg)}},[v,_,r,p]),w.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),ey())},[v,p]),w.useEffect(()=>{const P=()=>S({});return document.addEventListener(Qd,P),()=>document.removeEventListener(Qd,P)},[]),o.jsx(Wa.div,{...g,ref:A,style:{pointerEvents:B?G?"auto":"none":void 0,...n.style},onFocusCapture:On(n.onFocusCapture,Q.onFocusCapture),onBlurCapture:On(n.onBlurCapture,Q.onBlurCapture),onPointerDownCapture:On(n.onPointerDownCapture,ee.onPointerDownCapture)})});fv.displayName=yE;var xE="DismissableLayerBranch",wE=w.forwardRef((n,a)=>{const r=w.useContext(dv),l=w.useRef(null),c=ls(a,l);return w.useEffect(()=>{const d=l.current;if(d)return r.branches.add(d),()=>{r.branches.delete(d)}},[r.branches]),o.jsx(Wa.div,{...n,ref:c})});wE.displayName=xE;function _E(n,a=globalThis?.document){const r=Li(n),l=w.useRef(!1),c=w.useRef(()=>{});return w.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let g=function(){hv(vE,r,p,{discrete:!0})};const p={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=g,a.addEventListener("click",c.current,{once:!0})):g()}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 SE(n,a=globalThis?.document){const r=Li(n),l=w.useRef(!1);return w.useEffect(()=>{const c=d=>{d.target&&!l.current&&hv(bE,r,{originalEvent:d},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,r]),{onFocusCapture:()=>l.current=!0,onBlurCapture:()=>l.current=!1}}function ey(){const n=new CustomEvent(Qd);document.dispatchEvent(n)}function hv(n,a,r,{discrete:l}){const c=r.originalEvent.target,d=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:r});a&&c.addEventListener(n,a,{once:!0}),l?pE(c,d):c.dispatchEvent(d)}var Nd="focusScope.autoFocusOnMount",Td="focusScope.autoFocusOnUnmount",ty={bubbles:!1,cancelable:!0},jE="FocusScope",mv=w.forwardRef((n,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=n,[m,g]=w.useState(null),p=Li(c),v=Li(d),x=w.useRef(null),_=ls(a,E=>g(E)),S=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(l){let E=function(B){if(S.paused||!m)return;const G=B.target;m.contains(G)?x.current=G:An(x.current,{select:!0})},k=function(B){if(S.paused||!m)return;const G=B.relatedTarget;G!==null&&(m.contains(G)||An(x.current,{select:!0}))},O=function(B){if(document.activeElement===document.body)for(const ee of B)ee.removedNodes.length>0&&An(m)};document.addEventListener("focusin",E),document.addEventListener("focusout",k);const q=new MutationObserver(O);return m&&q.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",k),q.disconnect()}}},[l,m,S.paused]),w.useEffect(()=>{if(m){ny.add(S);const E=document.activeElement;if(!m.contains(E)){const O=new CustomEvent(Nd,ty);m.addEventListener(Nd,p),m.dispatchEvent(O),O.defaultPrevented||(EE(kE(pv(m)),{select:!0}),document.activeElement===E&&An(m))}return()=>{m.removeEventListener(Nd,p),setTimeout(()=>{const O=new CustomEvent(Td,ty);m.addEventListener(Td,v),m.dispatchEvent(O),O.defaultPrevented||An(E??document.body,{select:!0}),m.removeEventListener(Td,v),ny.remove(S)},0)}}},[m,p,v,S]);const A=w.useCallback(E=>{if(!r&&!l||S.paused)return;const k=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,O=document.activeElement;if(k&&O){const q=E.currentTarget,[B,G]=NE(q);B&&G?!E.shiftKey&&O===G?(E.preventDefault(),r&&An(B,{select:!0})):E.shiftKey&&O===B&&(E.preventDefault(),r&&An(G,{select:!0})):O===q&&E.preventDefault()}},[r,l,S.paused]);return o.jsx(Wa.div,{tabIndex:-1,...h,ref:_,onKeyDown:A})});mv.displayName=jE;function EE(n,{select:a=!1}={}){const r=document.activeElement;for(const l of n)if(An(l,{select:a}),document.activeElement!==r)return}function NE(n){const a=pv(n),r=ay(a,n),l=ay(a.reverse(),n);return[r,l]}function pv(n){const a=[],r=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const c=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||c?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)a.push(r.currentNode);return a}function ay(n,a){for(const r of n)if(!TE(r,{upTo:a}))return r}function TE(n,{upTo:a}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(a!==void 0&&n===a)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function AE(n){return n instanceof HTMLInputElement&&"select"in n}function An(n,{select:a=!1}={}){if(n&&n.focus){const r=document.activeElement;n.focus({preventScroll:!0}),n!==r&&AE(n)&&a&&n.select()}}var ny=CE();function CE(){let n=[];return{add(a){const r=n[0];a!==r&&r?.pause(),n=sy(n,a),n.unshift(a)},remove(a){n=sy(n,a),n[0]?.resume()}}}function sy(n,a){const r=[...n],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function kE(n){return n.filter(a=>a.tagName!=="A")}var OE="Portal",gv=w.forwardRef((n,a)=>{const{container:r,...l}=n,[c,d]=w.useState(!1);Ui(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?lE.createPortal(o.jsx(Wa.div,{...l,ref:a}),h):null});gv.displayName=OE;function RE(n,a){return w.useReducer((r,l)=>a[r][l]??r,n)}var Vo=n=>{const{present:a,children:r}=n,l=DE(a),c=typeof r=="function"?r({present:l.isPresent}):w.Children.only(r),d=ls(l.ref,ME(c));return typeof r=="function"||l.isPresent?w.cloneElement(c,{ref:d}):null};Vo.displayName="Presence";function DE(n){const[a,r]=w.useState(),l=w.useRef(null),c=w.useRef(n),d=w.useRef("none"),h=n?"mounted":"unmounted",[m,g]=RE(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const p=yo(l.current);d.current=m==="mounted"?p:"none"},[m]),Ui(()=>{const p=l.current,v=c.current;if(v!==n){const _=d.current,S=yo(p);n?g("MOUNT"):S==="none"||p?.display==="none"?g("UNMOUNT"):g(v&&_!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,g]),Ui(()=>{if(a){let p;const v=a.ownerDocument.defaultView??window,x=S=>{const E=yo(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&E&&(g("ANIMATION_END"),!c.current)){const k=a.style.animationFillMode;a.style.animationFillMode="forwards",p=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=k)})}},_=S=>{S.target===a&&(d.current=yo(l.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",x),a.addEventListener("animationend",x),()=>{v.clearTimeout(p),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",x),a.removeEventListener("animationend",x)}}else g("ANIMATION_END")},[a,g]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:w.useCallback(p=>{l.current=p?getComputedStyle(p):null,r(p)},[])}}function yo(n){return n?.animationName||"none"}function ME(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var Ad=0;function zE(){w.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??ry()),document.body.insertAdjacentElement("beforeend",n[1]??ry()),Ad++,()=>{Ad===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Ad--}},[])}function ry(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var jo="right-scroll-bar-position",Eo="width-before-scroll-bar",UE="with-scroll-bars-hidden",LE="--removed-body-scroll-bar-size";function Cd(n,a){return typeof n=="function"?n(a):n&&(n.current=a),n}function BE(n,a){var r=w.useState(function(){return{value:n,callback:a,facade:{get current(){return r.value},set current(l){var c=r.value;c!==l&&(r.value=l,r.callback(l,c))}}}})[0];return r.callback=a,r.facade}var qE=typeof window<"u"?w.useLayoutEffect:w.useEffect,iy=new WeakMap;function $E(n,a){var r=BE(null,function(l){return n.forEach(function(c){return Cd(c,l)})});return qE(function(){var l=iy.get(r);if(l){var c=new Set(l),d=new Set(n),h=r.current;c.forEach(function(m){d.has(m)||Cd(m,null)}),d.forEach(function(m){c.has(m)||Cd(m,h)})}iy.set(r,n)},[n]),r}function HE(n){return n}function VE(n,a){a===void 0&&(a=HE);var r=[],l=!1,c={read:function(){if(l)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:n},useMedium:function(d){var h=a(d,l);return r.push(h),function(){r=r.filter(function(m){return m!==h})}},assignSyncMedium:function(d){for(l=!0;r.length;){var h=r;r=[],h.forEach(d)}r={push:function(m){return d(m)},filter:function(){return r}}},assignMedium:function(d){l=!0;var h=[];if(r.length){var m=r;r=[],m.forEach(d),h=r}var g=function(){var v=h;h=[],v.forEach(d)},p=function(){return Promise.resolve().then(g)};p(),r={push:function(v){h.push(v),p()},filter:function(v){return h=h.filter(v),r}}}};return c}function IE(n){n===void 0&&(n={});var a=VE(null);return a.options=wa({async:!0,ssr:!1},n),a}var yv=function(n){var a=n.sideCar,r=Nr(n,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var l=a.read();if(!l)throw new Error("Sidecar medium not found");return w.createElement(l,wa({},r))};yv.isSideCarExport=!0;function GE(n,a){return n.useMedium(a),yv}var vv=IE(),kd=function(){},Io=w.forwardRef(function(n,a){var r=w.useRef(null),l=w.useState({onScrollCapture:kd,onWheelCapture:kd,onTouchMoveCapture:kd}),c=l[0],d=l[1],h=n.forwardProps,m=n.children,g=n.className,p=n.removeScrollBar,v=n.enabled,x=n.shards,_=n.sideCar,S=n.noRelative,A=n.noIsolation,E=n.inert,k=n.allowPinchZoom,O=n.as,q=O===void 0?"div":O,B=n.gapMode,G=Nr(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),ee=_,Q=$E([r,a]),P=wa(wa({},G),c);return w.createElement(w.Fragment,null,v&&w.createElement(ee,{sideCar:vv,removeScrollBar:p,shards:x,noRelative:S,noIsolation:A,inert:E,setCallbacks:d,allowPinchZoom:!!k,lockRef:r,gapMode:B}),h?w.cloneElement(w.Children.only(m),wa(wa({},P),{ref:Q})):w.createElement(q,wa({},P,{className:g,ref:Q}),m))});Io.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Io.classNames={fullWidth:Eo,zeroRight:jo};var PE=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function KE(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var a=PE();return a&&n.setAttribute("nonce",a),n}function YE(n,a){n.styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a))}function JE(n){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(n)}var XE=function(){var n=0,a=null;return{add:function(r){n==0&&(a=KE())&&(YE(a,r),JE(a)),n++},remove:function(){n--,!n&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},QE=function(){var n=XE();return function(a,r){w.useEffect(function(){return n.add(a),function(){n.remove()}},[a&&r])}},bv=function(){var n=QE(),a=function(r){var l=r.styles,c=r.dynamic;return n(l,c),null};return a},ZE={left:0,top:0,right:0,gap:0},Od=function(n){return parseInt(n||"",10)||0},FE=function(n){var a=window.getComputedStyle(document.body),r=a[n==="padding"?"paddingLeft":"marginLeft"],l=a[n==="padding"?"paddingTop":"marginTop"],c=a[n==="padding"?"paddingRight":"marginRight"];return[Od(r),Od(l),Od(c)]},WE=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return ZE;var a=FE(n),r=document.documentElement.clientWidth,l=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,l-r+a[2]-a[0])}},eN=bv(),br="data-scroll-locked",tN=function(n,a,r,l){var c=n.left,d=n.top,h=n.right,m=n.gap;return r===void 0&&(r="margin"),`
52
- .`.concat(UE,` {
53
- overflow: hidden `).concat(l,`;
54
- padding-right: `).concat(m,"px ").concat(l,`;
55
- }
56
- body[`).concat(br,`] {
57
- overflow: hidden `).concat(l,`;
58
- overscroll-behavior: contain;
59
- `).concat([a&&"position: relative ".concat(l,";"),r==="margin"&&`
60
- padding-left: `.concat(c,`px;
61
- padding-top: `).concat(d,`px;
62
- padding-right: `).concat(h,`px;
63
- margin-left:0;
64
- margin-top:0;
65
- margin-right: `).concat(m,"px ").concat(l,`;
66
- `),r==="padding"&&"padding-right: ".concat(m,"px ").concat(l,";")].filter(Boolean).join(""),`
67
- }
68
-
69
- .`).concat(jo,` {
70
- right: `).concat(m,"px ").concat(l,`;
71
- }
72
-
73
- .`).concat(Eo,` {
74
- margin-right: `).concat(m,"px ").concat(l,`;
75
- }
76
-
77
- .`).concat(jo," .").concat(jo,` {
78
- right: 0 `).concat(l,`;
79
- }
80
-
81
- .`).concat(Eo," .").concat(Eo,` {
82
- margin-right: 0 `).concat(l,`;
83
- }
84
-
85
- body[`).concat(br,`] {
86
- `).concat(LE,": ").concat(m,`px;
87
- }
88
- `)},ly=function(){var n=parseInt(document.body.getAttribute(br)||"0",10);return isFinite(n)?n:0},aN=function(){w.useEffect(function(){return document.body.setAttribute(br,(ly()+1).toString()),function(){var n=ly()-1;n<=0?document.body.removeAttribute(br):document.body.setAttribute(br,n.toString())}},[])},nN=function(n){var a=n.noRelative,r=n.noImportant,l=n.gapMode,c=l===void 0?"margin":l;aN();var d=w.useMemo(function(){return WE(c)},[c]);return w.createElement(eN,{styles:tN(d,!a,c,r?"":"!important")})},Zd=!1;if(typeof window<"u")try{var vo=Object.defineProperty({},"passive",{get:function(){return Zd=!0,!0}});window.addEventListener("test",vo,vo),window.removeEventListener("test",vo,vo)}catch{Zd=!1}var cr=Zd?{passive:!1}:!1,sN=function(n){return n.tagName==="TEXTAREA"},xv=function(n,a){if(!(n instanceof Element))return!1;var r=window.getComputedStyle(n);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!sN(n)&&r[a]==="visible")},rN=function(n){return xv(n,"overflowY")},iN=function(n){return xv(n,"overflowX")},oy=function(n,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=wv(n,l);if(c){var d=_v(n,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},lN=function(n){var a=n.scrollTop,r=n.scrollHeight,l=n.clientHeight;return[a,r,l]},oN=function(n){var a=n.scrollLeft,r=n.scrollWidth,l=n.clientWidth;return[a,r,l]},wv=function(n,a){return n==="v"?rN(a):iN(a)},_v=function(n,a){return n==="v"?lN(a):oN(a)},cN=function(n,a){return n==="h"&&a==="rtl"?-1:1},uN=function(n,a,r,l,c){var d=cN(n,window.getComputedStyle(a).direction),h=d*l,m=r.target,g=a.contains(m),p=!1,v=h>0,x=0,_=0;do{if(!m)break;var S=_v(n,m),A=S[0],E=S[1],k=S[2],O=E-k-d*A;(A||O)&&wv(n,m)&&(x+=O,_+=A);var q=m.parentNode;m=q&&q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?q.host:q}while(!g&&m!==document.body||g&&(a.contains(m)||a===m));return(v&&Math.abs(x)<1||!v&&Math.abs(_)<1)&&(p=!0),p},bo=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},cy=function(n){return[n.deltaX,n.deltaY]},uy=function(n){return n&&"current"in n?n.current:n},dN=function(n,a){return n[0]===a[0]&&n[1]===a[1]},fN=function(n){return`
89
- .block-interactivity-`.concat(n,` {pointer-events: none;}
90
- .allow-interactivity-`).concat(n,` {pointer-events: all;}
91
- `)},hN=0,ur=[];function mN(n){var a=w.useRef([]),r=w.useRef([0,0]),l=w.useRef(),c=w.useState(hN++)[0],d=w.useState(bv)[0],h=w.useRef(n);w.useEffect(function(){h.current=n},[n]),w.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(c));var E=n1([n.lockRef.current],(n.shards||[]).map(uy),!0).filter(Boolean);return E.forEach(function(k){return k.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),E.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var m=w.useCallback(function(E,k){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!h.current.allowPinchZoom;var O=bo(E),q=r.current,B="deltaX"in E?E.deltaX:q[0]-O[0],G="deltaY"in E?E.deltaY:q[1]-O[1],ee,Q=E.target,P=Math.abs(B)>Math.abs(G)?"h":"v";if("touches"in E&&P==="h"&&Q.type==="range")return!1;var J=window.getSelection(),he=J&&J.anchorNode,Ge=he?he===Q||he.contains(Q):!1;if(Ge)return!1;var xe=oy(P,Q);if(!xe)return!0;if(xe?ee=P:(ee=P==="v"?"h":"v",xe=oy(P,Q)),!xe)return!1;if(!l.current&&"changedTouches"in E&&(B||G)&&(l.current=ee),!ee)return!0;var ye=l.current||ee;return uN(ye,k,E,ye==="h"?B:G)},[]),g=w.useCallback(function(E){var k=E;if(!(!ur.length||ur[ur.length-1]!==d)){var O="deltaY"in k?cy(k):bo(k),q=a.current.filter(function(ee){return ee.name===k.type&&(ee.target===k.target||k.target===ee.shadowParent)&&dN(ee.delta,O)})[0];if(q&&q.should){k.cancelable&&k.preventDefault();return}if(!q){var B=(h.current.shards||[]).map(uy).filter(Boolean).filter(function(ee){return ee.contains(k.target)}),G=B.length>0?m(k,B[0]):!h.current.noIsolation;G&&k.cancelable&&k.preventDefault()}}},[]),p=w.useCallback(function(E,k,O,q){var B={name:E,delta:k,target:O,should:q,shadowParent:pN(O)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(G){return G!==B})},1)},[]),v=w.useCallback(function(E){r.current=bo(E),l.current=void 0},[]),x=w.useCallback(function(E){p(E.type,cy(E),E.target,m(E,n.lockRef.current))},[]),_=w.useCallback(function(E){p(E.type,bo(E),E.target,m(E,n.lockRef.current))},[]);w.useEffect(function(){return ur.push(d),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:_}),document.addEventListener("wheel",g,cr),document.addEventListener("touchmove",g,cr),document.addEventListener("touchstart",v,cr),function(){ur=ur.filter(function(E){return E!==d}),document.removeEventListener("wheel",g,cr),document.removeEventListener("touchmove",g,cr),document.removeEventListener("touchstart",v,cr)}},[]);var S=n.removeScrollBar,A=n.inert;return w.createElement(w.Fragment,null,A?w.createElement(d,{styles:fN(c)}):null,S?w.createElement(nN,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function pN(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const gN=GE(vv,mN);var Sv=w.forwardRef(function(n,a){return w.createElement(Io,wa({},n,{ref:a,sideCar:gN}))});Sv.classNames=Io.classNames;var yN=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},dr=new WeakMap,xo=new WeakMap,wo={},Rd=0,jv=function(n){return n&&(n.host||jv(n.parentNode))},vN=function(n,a){return a.map(function(r){if(n.contains(r))return r;var l=jv(r);return l&&n.contains(l)?l:(console.error("aria-hidden",r,"in not contained inside",n,". Doing nothing"),null)}).filter(function(r){return!!r})},bN=function(n,a,r,l){var c=vN(a,Array.isArray(n)?n:[n]);wo[r]||(wo[r]=new WeakMap);var d=wo[r],h=[],m=new Set,g=new Set(c),p=function(x){!x||m.has(x)||(m.add(x),p(x.parentNode))};c.forEach(p);var v=function(x){!x||g.has(x)||Array.prototype.forEach.call(x.children,function(_){if(m.has(_))v(_);else try{var S=_.getAttribute(l),A=S!==null&&S!=="false",E=(dr.get(_)||0)+1,k=(d.get(_)||0)+1;dr.set(_,E),d.set(_,k),h.push(_),E===1&&A&&xo.set(_,!0),k===1&&_.setAttribute(r,"true"),A||_.setAttribute(l,"true")}catch(O){console.error("aria-hidden: cannot operate on ",_,O)}})};return v(a),m.clear(),Rd++,function(){h.forEach(function(x){var _=dr.get(x)-1,S=d.get(x)-1;dr.set(x,_),d.set(x,S),_||(xo.has(x)||x.removeAttribute(l),xo.delete(x)),S||x.removeAttribute(r)}),Rd--,Rd||(dr=new WeakMap,dr=new WeakMap,xo=new WeakMap,wo={})}},xN=function(n,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(n)?n:[n]),c=yN(n);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),bN(l,c,r,"aria-hidden")):function(){return null}};function wN(n){const a=_N(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),g=m.find(jN);if(g){const p=g.props.children,v=m.map(x=>x===g?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:x);return o.jsx(a,{...h,ref:c,children:w.isValidElement(p)?w.cloneElement(p,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}function _N(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=NN(c),m=EN(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Bo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var SN=Symbol("radix.slottable");function jN(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===SN}function EN(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const g=d(...m);return c(...m),g}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function NN(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var Go="Dialog",[Ev]=Wj(Go),[TN,ma]=Ev(Go),Nv=n=>{const{__scopeDialog:a,children:r,open:l,defaultOpen:c,onOpenChange:d,modal:h=!0}=n,m=w.useRef(null),g=w.useRef(null),[p,v]=sE({prop:l,defaultProp:c??!1,onChange:d,caller:Go});return o.jsx(TN,{scope:a,triggerRef:m,contentRef:g,contentId:Ed(),titleId:Ed(),descriptionId:Ed(),open:p,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(x=>!x),[v]),modal:h,children:r})};Nv.displayName=Go;var Tv="DialogTrigger",AN=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Tv,r),d=ls(a,c.triggerRef);return o.jsx(Wa.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":hf(c.open),...l,ref:d,onClick:On(n.onClick,c.onOpenToggle)})});AN.displayName=Tv;var df="DialogPortal",[CN,Av]=Ev(df,{forceMount:void 0}),Cv=n=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=n,d=ma(df,a);return o.jsx(CN,{scope:a,forceMount:r,children:w.Children.map(l,h=>o.jsx(Vo,{present:r||d.open,children:o.jsx(gv,{asChild:!0,container:c,children:h})}))})};Cv.displayName=df;var Mo="DialogOverlay",kv=w.forwardRef((n,a)=>{const r=Av(Mo,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=ma(Mo,n.__scopeDialog);return d.modal?o.jsx(Vo,{present:l||d.open,children:o.jsx(ON,{...c,ref:a})}):null});kv.displayName=Mo;var kN=wN("DialogOverlay.RemoveScroll"),ON=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Mo,r);return o.jsx(Sv,{as:kN,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(Wa.div,{"data-state":hf(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),is="DialogContent",Ov=w.forwardRef((n,a)=>{const r=Av(is,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=ma(is,n.__scopeDialog);return o.jsx(Vo,{present:l||d.open,children:d.modal?o.jsx(RN,{...c,ref:a}):o.jsx(DN,{...c,ref:a})})});Ov.displayName=is;var RN=w.forwardRef((n,a)=>{const r=ma(is,n.__scopeDialog),l=w.useRef(null),c=ls(a,r.contentRef,l);return w.useEffect(()=>{const d=l.current;if(d)return xN(d)},[]),o.jsx(Rv,{...n,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:On(n.onCloseAutoFocus,d=>{d.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:On(n.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:On(n.onFocusOutside,d=>d.preventDefault())})}),DN=w.forwardRef((n,a)=>{const r=ma(is,n.__scopeDialog),l=w.useRef(!1),c=w.useRef(!1);return o.jsx(Rv,{...n,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{n.onCloseAutoFocus?.(d),d.defaultPrevented||(l.current||r.triggerRef.current?.focus(),d.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:d=>{n.onInteractOutside?.(d),d.defaultPrevented||(l.current=!0,d.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const h=d.target;r.triggerRef.current?.contains(h)&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&c.current&&d.preventDefault()}})}),Rv=w.forwardRef((n,a)=>{const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,...h}=n,m=ma(is,r),g=w.useRef(null),p=ls(a,g);return zE(),o.jsxs(o.Fragment,{children:[o.jsx(mv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(fv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":hf(m.open),...h,ref:p,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(MN,{titleId:m.titleId}),o.jsx(UN,{contentRef:g,descriptionId:m.descriptionId})]})]})}),ff="DialogTitle",Dv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(ff,r);return o.jsx(Wa.h2,{id:c.titleId,...l,ref:a})});Dv.displayName=ff;var Mv="DialogDescription",zv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Mv,r);return o.jsx(Wa.p,{id:c.descriptionId,...l,ref:a})});zv.displayName=Mv;var Uv="DialogClose",Lv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=ma(Uv,r);return o.jsx(Wa.button,{type:"button",...l,ref:a,onClick:On(n.onClick,()=>c.onOpenChange(!1))})});Lv.displayName=Uv;function hf(n){return n?"open":"closed"}var Bv="DialogTitleWarning",[C2,qv]=Fj(Bv,{contentName:is,titleName:ff,docsSlug:"dialog"}),MN=({titleId:n})=>{const a=qv(Bv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
92
-
93
- If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
94
-
95
- For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return w.useEffect(()=>{n&&(document.getElementById(n)||console.error(r))},[r,n]),null},zN="DialogDescriptionWarning",UN=({contentRef:n,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qv(zN).contentName}}.`;return w.useEffect(()=>{const c=n.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,n,a]),null},LN=Nv,BN=Cv,qN=kv,$N=Ov,HN=Dv,VN=zv,IN=Lv;function ss({...n}){return o.jsx(LN,{"data-slot":"dialog",...n})}function GN({...n}){return o.jsx(BN,{"data-slot":"dialog-portal",...n})}function PN({className:n,...a}){return o.jsx(qN,{"data-slot":"dialog-overlay",className:Ne("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),...a})}function rs({className:n,children:a,...r}){return o.jsxs(GN,{"data-slot":"dialog-portal",children:[o.jsx(PN,{}),o.jsxs($N,{"data-slot":"dialog-content",className:Ne("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",n),...r,children:[a,o.jsxs(IN,{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(Lo,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ea({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:Ne("flex flex-col gap-2 text-center sm:text-left",n),...a})}function pr({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:Ne("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...a})}function Na({className:n,...a}){return o.jsx(HN,{"data-slot":"dialog-title",className:Ne("text-lg leading-none font-semibold",n),...a})}function Ta({className:n,...a}){return o.jsx(VN,{"data-slot":"dialog-description",className:Ne("text-muted-foreground text-sm",n),...a})}const Ce=w.forwardRef(({className:n,type:a,...r},l)=>o.jsx("input",{type:a,className:Ne("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:l,...r}));Ce.displayName="Input";var KN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YN=KN.reduce((n,a)=>{const r=wy(`Primitive.${a}`),l=w.forwardRef((c,d)=>{const{asChild:h,...m}=c,g=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(g,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...n,[a]:l}},{}),JN="Label",$v=w.forwardRef((n,a)=>o.jsx(YN.label,{...n,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(n.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));$v.displayName=JN;var XN=$v;function ha({className:n,...a}){return o.jsx(XN,{"data-slot":"label",className:Ne("flex items-center gap-2 text-sm leading-none font-medium select-none text-muted-foreground group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...a})}const QN=jy("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Bi({className:n,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:Ne(QN({variant:a}),n),...r})}function qi({className:n,...a}){return o.jsx("div",{"data-slot":"alert-description",className:Ne("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",n),...a})}function mf({className:n}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Ne("w-9 h-9",n),children:[o.jsx("path",{d:"M112 112H400C426.51 112 448 133.49 448 160V352C448 378.51 426.51 400 400 400H112C85.4903 400 64 378.51 64 352V160C64 133.49 85.4903 112 112 112Z",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M64 160 L200 270",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M448 160 L312 270",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M256 128 C256 128 276 170 306 178 C276 186 256 228 256 228 C256 228 236 186 206 178 C236 170 256 128 256 128 Z",fill:"#9333ea",children:o.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0 0; 0 -10; 0 0",dur:"3s",repeatCount:"indefinite"})})]})}function dy(n){const a=n.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function ZN(n){const a=n.trim();if(!a)return{valid:!1};if(a.startsWith("http://")||a.startsWith("https://"))try{return new URL(a).hostname.endsWith(".supabase.co")?{valid:!0,message:"Valid Supabase URL"}:{valid:!1,message:"URL must be a supabase.co domain"}}catch{return{valid:!1,message:"Invalid URL format"}}return/^[a-z0-9]+$/.test(a)?{valid:!0,message:"Project ID detected"}:{valid:!1,message:"Enter a URL or Project ID"}}function FN(n){const a=n.trim();return a?a.startsWith("sb_publishable_")?a.length>25?{valid:!0,message:"Valid Publishable Key"}:{valid:!1,message:"Incomplete Publishable Key"}:a.startsWith("eyJ")?a.length>50?{valid:!0,message:"Valid Anon Key"}:{valid:!1,message:"Incomplete Anon Key"}:{valid:!1,message:"Invalid API Key format"}:{valid:!1}}function Hv({onComplete:n,open:a=!0,canClose:r=!1}){const[l,c]=w.useState("welcome"),[d,h]=w.useState(""),[m,g]=w.useState(""),[p,v]=w.useState(null),[x,_]=w.useState(!1),[S,A]=w.useState(!1),E=async()=>{v(null),c("validating");const G=dy(d),ee=m.trim(),Q=await tv(G,ee);Q.valid?(Mj({url:G,anonKey:ee}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(v(Q.error||"Connection failed. Please check your credentials."),c("credentials"))},k=d?ZN(d):{valid:!1},O=m?FN(m):{valid:!1},q=d?dy(d):"",B=d&&!d.startsWith("http")&&k.valid;return o.jsx(ss,{open:a,onOpenChange:G=>{!G&&r&&n()},children:o.jsxs(rs,{className:"sm:max-w-md",onPointerDownOutside:G=>{r||G.preventDefault()},onEscapeKeyDown:G=>{r||G.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(mf,{className:"w-9 h-9"}),o.jsx(Na,{children:"Welcome to Email Automator"})]}),o.jsx(Ta,{children:"This application requires a Supabase database to store your emails and automation rules."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx(Bi,{children:o.jsxs(qi,{children:[o.jsx("strong",{children:"No Supabase Setup Detected"}),o.jsx("br",{}),"You can create a free project at"," ",o.jsxs("a",{href:"https://supabase.com",target:"_blank",rel:"noopener noreferrer",className:"underline text-primary inline-flex items-center gap-1",children:["supabase.com",o.jsx(Ai,{className:"h-3 w-3"})]})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"You will need:"}),o.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground space-y-1",children:[o.jsx("li",{children:"Project URL"}),o.jsx("li",{children:"Anon Public Key"})]})]}),o.jsxs("div",{className:"flex gap-2",children:[r&&o.jsx(W,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(W,{onClick:()=>c("credentials"),className:"flex-1",children:"Continue Setup"})]})]})]}),l==="credentials"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{children:"Connect to Supabase"}),o.jsx(Ta,{children:"Enter your connection details below."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[p&&o.jsxs(Bi,{variant:"destructive",children:[o.jsx($i,{className:"h-4 w-4"}),o.jsx(qi,{children:p})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"supabase-url",children:"Project URL or ID"}),o.jsxs("div",{className:"relative",children:[o.jsx(Ce,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:G=>{h(G.target.value),_(!0)},onBlur:()=>_(!0),className:x&&d?k.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),x&&d&&k.valid&&o.jsx(Qa,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),B&&o.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-green-600 dark:text-green-400",children:[o.jsx(Qa,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),o.jsxs("span",{children:["Will use: ",q]})]}),x&&d&&k.message&&!k.valid&&o.jsx("p",{className:"text-xs text-destructive",children:k.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"anon-key",children:"Anon Public Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Ce,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:G=>{g(G.target.value),A(!0)},onBlur:()=>A(!0),className:S&&m?O.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),S&&m&&O.valid&&o.jsx(Qa,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),S&&m&&O.message&&o.jsx("p",{className:`text-xs ${O.valid?"text-green-600 dark:text-green-400":"text-destructive"}`,children:O.message})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(W,{variant:"outline",onClick:()=>c("welcome"),className:"flex-1",children:"Back"}),r&&o.jsx(W,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(W,{onClick:E,disabled:!k.valid||!O.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{children:"Validating Connection"}),o.jsx(Ta,{children:"Verifying your credentials with Supabase..."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(qt,{className:"h-12 w-12 animate-spin text-primary mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Please wait..."})]})]}),l==="success"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{children:"Success!"}),o.jsx(Ta,{children:"Your database is connected."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(tf,{className:"h-12 w-12 text-green-500 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restarting application..."})]})]})]})})}function WN({userId:n,onInsert:a,onUpdate:r,onDelete:l,enabled:c=!0}){const d=w.useRef(null);return w.useEffect(()=>{if(!c||!n)return;const h=ct.channel("emails-realtime").on("postgres_changes",{event:"INSERT",schema:"public",table:"emails"},m=>{a?.(m.new)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"emails"},m=>{r?.(m.new)}).on("postgres_changes",{event:"DELETE",schema:"public",table:"emails"},m=>{l?.(m.old.id)}).subscribe();return d.current=h,()=>{d.current&&ct.removeChannel(d.current)}},[n,c,a,r,l]),{isSubscribed:!!d.current}}class e2{ctx=null;enabled=!1;constructor(){this.enabled=localStorage.getItem("ea_sounds_enabled")==="true"}setEnabled(a){this.enabled=a,localStorage.setItem("ea_sounds_enabled",a?"true":"none")}isEnabled(){return this.enabled}initCtx(){return this.ctx||(this.ctx=new(window.AudioContext||window.webkitAudioContext)),this.ctx.state==="suspended"&&this.ctx.resume(),this.ctx}haptic(a=10){typeof navigator<"u"&&navigator.vibrate&&navigator.vibrate(a)}playNotify(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="sine",r.frequency.setValueAtTime(880,a.currentTime),r.frequency.exponentialRampToValueAtTime(440,a.currentTime+.1),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.1,a.currentTime+.01),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.3),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.3),this.haptic(10)}playAlert(){if(!this.enabled)return;const a=this.initCtx(),r=(l,c)=>{const d=a.createOscillator(),h=a.createGain();d.type="sine",d.frequency.setValueAtTime(l,a.currentTime+c),h.gain.setValueAtTime(0,a.currentTime+c),h.gain.linearRampToValueAtTime(.1,a.currentTime+c+.05),h.gain.exponentialRampToValueAtTime(.001,a.currentTime+c+.4),d.connect(h),h.connect(a.destination),d.start(a.currentTime+c),d.stop(a.currentTime+c+.4)};r(660,0),r(880,.1),this.haptic([20,50,20])}playSuccess(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="triangle",r.frequency.setValueAtTime(523.25,a.currentTime),r.frequency.exponentialRampToValueAtTime(1046.5,a.currentTime+.1),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.05,a.currentTime+.02),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.2),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.2),this.haptic(15)}}const xr=new e2;function t2({email:n,isOpen:a,onOpenChange:r}){const[l,c]=w.useState([]),[d,h]=w.useState(!1);w.useEffect(()=>{a&&n&&m()},[a,n]);const m=async()=>{if(n){h(!0);try{const p=await He.getEmailEvents(n.id);p.data&&c(p.data.events)}catch(p){console.error("Failed to fetch trace:",p)}finally{h(!1)}}},g=p=>{switch(p){case"analysis":return o.jsx(zo,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx($i,{className:"w-4 h-4 text-red-500"});default:return o.jsx(wr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(ss,{open:a,onOpenChange:r,children:o.jsxs(rs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Ea,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(nf,{className:"w-5 h-5 text-primary"}),o.jsx(Na,{children:"AI Processing Trace"})]}),o.jsx(Ta,{children:"Step-by-step log of how the AI analyzed and acted on this email."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:d?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(ht,{})}):l.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:"No granular trace events found for this email."}):l.map((p,v)=>o.jsxs("div",{className:"relative pl-8",children:[v!==l.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:g(p.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:p.agent_state}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Uo,{className:"w-3 h-3"}),new Date(p.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[p.event_type==="info"&&o.jsx("p",{className:"text-sm text-foreground/90",children:p.details?.message}),p.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:p.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:p.details?.sentiment||"Analyzing..."})]})]}),p.details?.system_prompt&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(gr,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:p.details?.system_prompt})]}),p.details?._raw_response&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(gr,{className:"w-3 h-3"})," Raw LLM Response"]}),o.jsx("pre",{className:"text-[10px] bg-emerald-500/5 p-2 rounded border border-emerald-500/10 overflow-x-auto font-mono",children:JSON.stringify(JSON.parse(p.details._raw_response),null,2)})]})]}),p.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: ",p.details?.action]}),o.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',p.details?.reason,'"']})]}),o.jsx(af,{className:"w-5 h-5 text-emerald-500"})]}),p.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 p.details?.error=="object"?p.details.error.message||JSON.stringify(p.details.error):p.details?.error}),p.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 p.details.raw_response=="object"?JSON.stringify(p.details.raw_response,null,2):p.details.raw_response})]})]})]})]},p.id))})]})})}const a2={spam:"bg-destructive/10 text-destructive",newsletter:"bg-blue-500/10 text-blue-600 dark:text-blue-400",support:"bg-orange-500/10 text-orange-600 dark:text-orange-400",client:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",internal:"bg-purple-500/10 text-purple-600 dark:text-purple-400",personal:"bg-pink-500/10 text-pink-600 dark:text-pink-400",other:"bg-gray-500/10 text-gray-600 dark:text-gray-400"};function n2(){const{state:n,actions:a,dispatch:r}=Ar(),{openTerminal:l}=iv(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[g,p]=w.useState(""),[v,x]=w.useState(null),[_,S]=w.useState(null),[A,E]=w.useState({}),[k,O]=w.useState(null),[q,B]=w.useState(!1),[G,ee]=w.useState(null),Q=w.useCallback(X=>{r({type:"ADD_EMAIL",payload:X}),X.ai_analysis?.priority==="High"?(xr.playAlert(),re.success("High Priority Email Processed!")):(xr.playNotify(),re.info("New email processed"))},[r]),P=w.useCallback(X=>{r({type:"UPDATE_EMAIL",payload:X})},[r]),J=w.useCallback(X=>{Ge(n.emailsOffset)},[n.emailsOffset]),{isSubscribed:he}=WN({userId:n.user?.id,onInsert:Q,onUpdate:P,onDelete:J,enabled:n.isAuthenticated});w.useEffect(()=>{n.isAuthenticated?(Ge(),a.fetchStats()):d(!1)},[v,n.isAuthenticated]);const Ge=async(X=0)=>{d(!0),await a.fetchEmails({category:v||void 0,search:g||void 0,offset:X,sortBy:n.sortBy,sortOrder:n.sortOrder}),d(!1)},xe=X=>{a.fetchEmails({category:v||void 0,search:g||void 0,offset:0,sortBy:X,sortOrder:n.sortOrder})},ye=()=>{a.fetchEmails({category:v||void 0,search:g||void 0,offset:0,sortBy:n.sortBy,sortOrder:n.sortOrder==="asc"?"desc":"asc"})},Ze=async()=>{if(n.accounts.length===0){re.warning("Please connect an email account first");return}l(),m(!0);const X=await a.triggerSync();m(!1),X?(xr.playSuccess(),re.success("Sync completed! Check your emails.")):re.error("Sync failed. Check account status for details.")},nt=async(X,ge)=>{if(ge==="delete"&&k!==X.id){O(X.id);return}O(null),E(H=>({...H,[X.id]:ge}));const N=await a.executeAction(X.id,ge);E(H=>{const Y={...H};return delete Y[X.id],Y}),N&&(re.success(`Email ${ge==="delete"?"deleted":ge==="archive"?"archived":"updated"}`),ge==="delete"&&Ge(n.emailsOffset))},Ve=()=>{O(null)},L=X=>{X.preventDefault(),Ge()},Z=X=>{const ge=X==="next"?n.emailsOffset+20:Math.max(0,n.emailsOffset-20);Ge(ge)},K=X=>{ee(X),B(!0)};return o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 animate-in fade-in duration-500",children:[o.jsxs("section",{className:"lg:col-span-2 space-y-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-4",children:[o.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[o.jsx(Dd,{className:"w-5 h-5 text-primary"}),"Recent Analysis"]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(W,{onClick:Ze,size:"sm",variant:"outline",className:"shadow-sm",disabled:h,children:[o.jsx(_r,{className:Ne("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),h?"Syncing...":"Sync Now"]}),o.jsxs("span",{className:"text-xs font-medium text-muted-foreground bg-secondary px-2 py-1 rounded-md border border-border flex items-center",children:[n.emailsTotal," emails"]})]})]}),h&&o.jsxs("div",{className:"bg-primary/5 border border-primary/20 p-4 rounded-lg flex items-center justify-between animate-in fade-in slide-in-from-top-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o.jsx(qt,{className:"w-5 h-5 text-primary animate-spin"})}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-sm",children:"Sync in progress..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Fetching and analyzing emails. New emails will appear below automatically."})]})]}),o.jsxs(W,{variant:"outline",size:"sm",onClick:l,className:"h-8 text-xs",children:[o.jsx(nf,{className:"w-3.5 h-3.5 mr-2"}),"View Logs"]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[o.jsxs("form",{onSubmit:L,className:"flex-1 flex gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Ow,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Ce,{placeholder:"Search emails...",value:g,onChange:X=>p(X.target.value),className:"pl-9"})]}),o.jsx(W,{type:"submit",size:"sm",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-7",value:n.sortBy,onChange:X=>xe(X.target.value),children:[o.jsx("option",{value:"date",children:"Received Time"}),o.jsx("option",{value:"created_at",children:"Processed Time"})]}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:ye,title:n.sortOrder==="asc"?"Oldest First":"Newest First",children:o.jsx(jx,{className:Ne("w-3.5 h-3.5",n.sortOrder==="asc"&&"rotate-180")})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(W,{size:"sm",variant:v===null?"secondary":"ghost",onClick:()=>x(null),children:"All"}),["spam","client","newsletter","support"].map(X=>o.jsx(W,{size:"sm",variant:v===X?"secondary":"ghost",onClick:()=>x(X),className:"capitalize",children:X},X))]}),c?o.jsx(Zj,{}):n.emails.length===0?o.jsxs(yt,{className:"p-20 text-center shadow-sm",children:[o.jsx("div",{className:"w-16 h-16 bg-primary/10 text-primary rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(Dd,{className:"w-8 h-8"})}),o.jsx("h3",{className:"text-lg font-medium",children:"No emails found"}),o.jsx("p",{className:"text-muted-foreground mt-2 mb-6",children:n.accounts.length===0?"Connect your email account to get started.":"Try syncing or adjusting your filters."}),n.accounts.length>0&&o.jsxs(W,{onClick:()=>{l(),Ze()},disabled:h,children:[o.jsx(_r,{className:Ne("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[n.emails.map(X=>o.jsx(r2,{email:X,onAction:nt,onViewTrace:K,onSelect:()=>S(X),isSelected:_?.id===X.id,loadingAction:A[X.id],isDeletePending:k===X.id,onCancelDelete:Ve},X.id)),o.jsx(t2,{isOpen:q,onOpenChange:B,email:G}),n.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(W,{variant:"outline",size:"sm",onClick:()=>Z("prev"),disabled:n.emailsOffset===0,children:[o.jsx(zx,{className:"w-4 h-4 mr-1"}),"Previous"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[n.emailsOffset+1," - ",Math.min(n.emailsOffset+20,n.emailsTotal)," of ",n.emailsTotal]}),o.jsxs(W,{variant:"outline",size:"sm",onClick:()=>Z("next"),disabled:n.emailsOffset+20>=n.emailsTotal,children:["Next",o.jsx(Lx,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[o.jsxs(yt,{className:Ne("p-6 border-primary/20",he?"bg-primary/5":"bg-muted/50"),children:[o.jsx("h3",{className:"font-semibold text-primary mb-1",children:"Realtime Sync"}),o.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:he?"Live updates enabled":"Waiting for connection..."}),o.jsxs("div",{className:Ne("flex items-center gap-2 text-[10px] font-mono w-fit px-2 py-1 rounded-full border",he?"text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border-emerald-500/20":"text-yellow-600 dark:text-yellow-400 bg-yellow-500/10 border-yellow-500/20"),children:[o.jsx("div",{className:Ne("w-1.5 h-1.5 rounded-full",he?"bg-emerald-500 animate-pulse":"bg-yellow-500")}),he?"CONNECTED":"DISCONNECTED"]})]}),o.jsx(s2,{accounts:n.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:n.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(yt,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(yy,{className:"w-4 h-4 text-primary"}),"Sync History"]}),o.jsx("div",{className:"space-y-4",children:!n.stats?.recentSyncs||n.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No sync history available."}):n.stats.recentSyncs.slice(0,5).map(X=>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:Ne("w-1.5 h-1.5 rounded-full",X.status==="success"?"bg-emerald-500":X.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(X.started_at).toLocaleDateString()," ",new Date(X.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:X.emails_processed})," • Actioned: ",o.jsx("span",{className:"font-medium text-foreground",children:X.emails_deleted+X.emails_drafted})]}),X.error_message&&o.jsx("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:X.error_message,children:X.error_message})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:X.status==="running"?"Running":X.completed_at?`${Math.round((new Date(X.completed_at).getTime()-new Date(X.started_at).getTime())/1e3)}s`:"..."})]},X.id))})]}),o.jsxs(yt,{className:"p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Quick Stats"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Processed"}),o.jsx("span",{className:"font-medium",children:n.emailsTotal})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Connected Accounts"}),o.jsx("span",{className:"font-medium",children:n.accounts.length})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Rules"}),o.jsx("span",{className:"font-medium",children:n.rules.filter(X=>X.is_enabled).length})]})]})]}),_&&o.jsxs(yt,{className:"p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Email Details"}),o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"From:"}),o.jsx("p",{className:"font-medium truncate",children:_.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),o.jsx("p",{className:"font-medium",children:_.subject})]}),_.ai_analysis&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Summary:"}),o.jsx("p",{className:"text-xs mt-1",children:_.ai_analysis.summary})]}),_.ai_analysis.key_points&&o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Key Points:"}),o.jsx("ul",{className:"text-xs mt-1 list-disc list-inside",children:_.ai_analysis.key_points.map((X,ge)=>o.jsx("li",{children:X},ge))})]}),_.ai_analysis.draft_response&&o.jsxs("div",{className:"mt-4 p-3 bg-emerald-500/5 border border-emerald-500/20 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2 text-emerald-600 dark:text-emerald-400",children:[o.jsx(Dw,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"text-xs font-bold uppercase",children:"AI Draft Reply"})]}),o.jsx("p",{className:"text-xs leading-relaxed whitespace-pre-wrap italic text-foreground/80",children:_.ai_analysis.draft_response}),o.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:["* This draft is already saved in your ",_.email_accounts?.provider==="gmail"?"Gmail":"Outlook"," Drafts folder."]})]})]})]})]})]})]})}function s2({accounts:n,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){const[h,m]=w.useState(null),[g,p]=w.useState(!1),v=async(x,_)=>{m(x),await a(x,_),m(null)};return n.length===0?null:o.jsxs(yt,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(Uw,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsxs("div",{className:"mb-6 p-3 bg-muted/30 rounded-lg space-y-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("label",{className:"text-[11px] font-medium flex items-center gap-1",children:"Sync Interval (min)"}),g&&o.jsx(qt,{className:"w-3 h-3 animate-spin text-primary"})]}),o.jsx(Ce,{type:"number",min:1,max:60,className:"h-8 text-xs",value:l?.sync_interval_minutes||5,onChange:async x=>{const _=parseInt(x.target.value,10)||5;p(!0),await c({sync_interval_minutes:_}),p(!1)}}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Background sync frequency for all accounts."})]}),o.jsx("div",{className:"space-y-6",children:n.map(x=>o.jsxs("div",{className:"space-y-3 pb-4 border-b last:border-0 last:pb-0",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-xs font-medium truncate max-w-[150px]",title:x.email_address,children:x.email_address}),o.jsxs("div",{className:"flex items-center gap-1",children:[x.last_sync_status==="syncing"?o.jsx(qt,{className:"w-3 h-3 text-primary animate-spin"}):x.last_sync_status==="success"?o.jsx(af,{className:"w-3 h-3 text-emerald-500"}):x.last_sync_status==="error"?o.jsx("span",{title:x.last_sync_error||"Error",children:o.jsx($i,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(W,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{d(),r(x.id)},disabled:x.last_sync_status==="syncing",children:o.jsx(_r,{className:Ne("w-3 h-3",x.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-orange-500",title:"Reset Checkpoint (Force Full Re-sync from Start Date)",onClick:()=>a(x.id,{last_sync_checkpoint:null}),disabled:x.last_sync_status==="syncing",children:o.jsx(yy,{className:"w-3 h-3"})})]})]}),o.jsxs("div",{className:"grid grid-cols-[1.5fr_1fr] gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Tx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Ce,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:(()=>{if(x.sync_start_date)return x.sync_start_date.substring(0,16);if(x.last_sync_checkpoint)if(x.provider==="gmail")try{const _=parseInt(x.last_sync_checkpoint);if(!isNaN(_))return new Date(_).toISOString().substring(0,16)}catch{}else return x.last_sync_checkpoint.substring(0,16);return x.last_sync_at?x.last_sync_at.substring(0,16):""})(),onChange:_=>v(x.id,{sync_start_date:_.target.value?new Date(_.target.value).toISOString():null}),disabled:h===x.id})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(rw,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Ce,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:x.sync_max_emails_per_run||50,onChange:_=>v(x.id,{sync_max_emails_per_run:parseInt(_.target.value,10)||50}),disabled:h===x.id})]})]}),x.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Last sync: ",new Date(x.last_sync_at).toLocaleString()]}),x.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:x.last_sync_error,children:["Error: ",x.last_sync_error]})]},x.id))})]})}function r2({email:n,onAction:a,onViewTrace:r,onSelect:l,isSelected:c,loadingAction:d,isDeletePending:h,onCancelDelete:m}){if(!n)return null;const g=a2[n.category||"other"],p=!!d,v=()=>{if(!n.email_accounts)return"#";const{provider:x,email_address:_}=n.email_accounts;return x==="gmail"?`https://mail.google.com/mail/u/${_}/#all/${n.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(n.external_id)}`};return o.jsx(yt,{className:Ne("hover:shadow-md transition-shadow group cursor-pointer",c&&"ring-2 ring-primary"),onClick:l,children:o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex justify-between items-start mb-3",children:[o.jsxs("div",{className:"flex gap-3",children:[o.jsx("div",{className:Ne("w-8 h-8 rounded-full flex items-center justify-center font-bold text-white text-xs",n.category==="spam"?"bg-destructive":"bg-primary"),children:n.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:n.subject||"No Subject"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:Ne("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",g),children:n.category||"unknown"}),o.jsx("div",{className:"flex items-center justify-end gap-1",children:n.ai_analysis?o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(zo,{className:"w-2.5 h-2.5"})," Analyzed"]}):o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(qt,{className:"w-2.5 h-2.5 animate-spin"})," Pending"]})}),o.jsxs("div",{className:"flex flex-col items-end text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:n.date?new Date(n.date).toLocaleString():"",children:[o.jsx("span",{className:"opacity-70",children:"Rec:"})," ",n.date?new Date(n.date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsxs("span",{title:new Date(n.created_at).toLocaleString(),children:[o.jsx("span",{className:"opacity-70",children:"Proc:"})," ",new Date(n.created_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:n.body_snippet}),o.jsxs("div",{className:"bg-secondary/30 p-3 rounded-lg border border-border/50 flex justify-between items-center",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[o.jsx(zd,{className:"w-3.5 h-3.5 text-emerald-500"}),"Suggested:",n.suggested_actions&&n.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:n.suggested_actions.map(x=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:x},x))}):o.jsx("span",{className:"text-foreground",children:n.suggested_action||"none"}),n.actions_taken&&n.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:n.actions_taken.join(", "),children:["(Done: ",n.actions_taken.join(", "),")"]}):n.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(Done: ",n.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:x=>x.stopPropagation(),children:h?o.jsxs("div",{className:"flex items-center gap-1 animate-in fade-in duration-200",children:[o.jsx("span",{className:"text-xs text-destructive mr-1",children:"Delete?"}),o.jsx(W,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(n,"delete"),disabled:p,children:d==="delete"?o.jsx(qt,{className:"w-3 h-3 animate-spin"}):"Yes"}),o.jsx(W,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:m,disabled:p,children:"No"})]}):o.jsxs(o.Fragment,{children:[o.jsx("a",{href:v(),target:"_blank",rel:"noreferrer",className:"inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-primary hover:bg-secondary/50 transition-colors",title:`Open in ${n.email_accounts?.provider==="gmail"?"Gmail":"Outlook"}`,children:o.jsx(Ai,{className:"w-3.5 h-3.5"})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>r(n),title:"View AI Trace (Prompt/Response)",children:o.jsx(tw,{className:"w-3.5 h-3.5"})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>a(n,"delete"),disabled:p,title:"Delete",children:d==="delete"?o.jsx(qt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(To,{className:"w-3.5 h-3.5"})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>a(n,"archive"),disabled:p,title:"Archive",children:d==="archive"?o.jsx(qt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(xx,{className:"w-3.5 h-3.5"})}),o.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>a(n,"flag"),disabled:p,title:"Flag",children:d==="flag"?o.jsx(qt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(nw,{className:"w-3.5 h-3.5"})})]})})]})]})})}function i2(){const{state:n,actions:a}=Ar(),[r,l]=w.useState(!1),[c,d]=w.useState(!1),[h,m]=w.useState(null),[g,p]=w.useState(!1),[v,x]=w.useState(!1),[_,S]=w.useState({}),[A,E]=w.useState(!1),[k,O]=w.useState("credentials"),[q,B]=w.useState(""),[G,ee]=w.useState(""),[Q,P]=w.useState(""),[J,he]=w.useState(""),[Ge,xe]=w.useState(!1),[ye,Ze]=w.useState(!1),[nt,Ve]=w.useState(!1),[L,Z]=w.useState("credentials"),[K,X]=w.useState(""),[ge,N]=w.useState(""),[H,Y]=w.useState(!1),[F,ue]=w.useState(!1),[ve,de]=w.useState(""),[Pe,Le]=w.useState("category"),[Tt,vt]=w.useState("newsletter"),[bt,os]=w.useState(["archive"]),[ia,cs]=w.useState(""),[us,Vi]=w.useState(""),[Cr,Rn]=w.useState([]),[en,ds]=w.useState(!1),[Ii,Gi]=w.useState(!1),[mt,fs]=w.useState(null);w.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),w.useEffect(()=>{n.settings&&S(n.settings)},[n.settings]);const Pi=async()=>{const z=n.rules.find(se=>se.name==="Auto-Trash Spam");if(!z){re.error("System rule not found. Please sync your database.");return}fs("auto_trash_spam"),await a.toggleRule(z.id),fs(null)},Ki=async()=>{const z=n.rules.find(se=>se.name==="Smart Drafts");if(!z){re.error("System rule not found. Please sync your database.");return}fs("smart_drafts"),await a.toggleRule(z.id),fs(null)},hs=w.useRef(null),Po=()=>{O("credentials"),B(""),ee(""),P(""),he(""),E(!0)},Yi=z=>{B(z);try{const se=JSON.parse(z),De=se.installed||se.web||se;De.client_id&&ee(De.client_id),De.client_secret&&P(De.client_secret),se.installed?re.success("Detected Desktop app credentials"):se.web&&re.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Ko=async()=>{if(!G||!Q){re.error("Please provide both Client ID and Client Secret");return}xe(!0);try{if(await a.updateSettings({..._,google_client_id:G,google_client_secret:Q})){S(De=>({...De,google_client_id:G,google_client_secret:Q}));const se=await He.getGmailAuthUrl();if(se.data?.url)window.open(se.data.url,"_blank"),O("code"),re.success("Please authorize in the opened tab, then paste the code here");else{const De=typeof se.error=="string"?se.error:se.error?.message;re.error(De||"Failed to get OAuth URL")}}else re.error("Failed to save credentials")}catch{re.error("Failed to save credentials")}finally{xe(!1)}},Yo=async()=>{if(!J.trim()){re.error("Please paste the authorization code");return}Ze(!0);try{const z=await He.connectGmail(J.trim());if(z.data?.success)re.success("Gmail account connected successfully!"),E(!1),a.fetchAccounts();else{const se=typeof z.error=="string"?z.error:z.error?.message;re.error(se||"Failed to connect Gmail")}}catch{re.error("Failed to connect Gmail")}finally{Ze(!1)}},Dn=()=>{Z("credentials"),X(""),N(""),Ve(!0)},Ct=async()=>{if(!K){re.error("Please provide the Client ID");return}Y(!0);try{if(await a.updateSettings({..._,microsoft_client_id:K,microsoft_tenant_id:ge||"common"})){S(De=>({...De,microsoft_client_id:K,microsoft_tenant_id:ge||"common"}));const se=await He.startMicrosoftDeviceFlow();if(se.data)m(se.data),Z("device-code"),pa(se.data.deviceCode,se.data.interval);else{const De=typeof se.error=="string"?se.error:se.error?.message;re.error(De||"Failed to start device flow")}}else re.error("Failed to save credentials")}catch{re.error("Failed to save credentials")}finally{Y(!1)}},pa=async(z,se)=>{const De=setInterval(async()=>{try{const ga=await He.pollMicrosoftDeviceCode(z);ga.data?.status==="completed"?(clearInterval(De),m(null),d(!1),Ve(!1),re.success("Outlook account connected"),a.fetchAccounts()):ga.error&&typeof ga.error=="object"&&ga.error.code}catch{}},se*1e3);setTimeout(()=>{clearInterval(De),c&&(m(null),d(!1),Ve(!1),re.error("Connection timed out. Please try again."))},900*1e3)},kt=async()=>{if(!ve){re.error("Please name your rule");return}if(bt.length===0){re.error("Please select at least one action");return}Gi(!0);try{const z={[Pe]:Tt};ia&&(z.older_than_days=parseInt(ia,10));const se=bt.includes("draft");await a.createRule({name:ve,condition:z,actions:bt,instructions:se?us:void 0,attachments:se?Cr:[],is_enabled:!0})?(re.success("Rule created"),ue(!1),de(""),os(["archive"]),cs(""),Vi(""),Rn([]),a.fetchRules()):re.error("Failed to create rule")}catch{re.error("Failed to create rule")}finally{Gi(!1)}},Jo=async z=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(z)&&re.success("Account disconnected")},Ji=async()=>{p(!0);const z=await a.updateSettings(_);p(!1),z&&re.success("Settings saved")},Xo=async()=>{x(!0);try{const z=await He.testLlm({llm_model:_.llm_model||null,llm_base_url:_.llm_base_url||null,llm_api_key:_.llm_api_key||null});z.data?.success?re.success(z.data.message):re.error(z.data?.message||"Connection test failed")}catch{re.error("Failed to test connection")}finally{x(!1)}},ms=async z=>{await a.toggleRule(z)},ps=async z=>{const se=z.target.files;if(!se||se.length===0)return;ds(!0);const De=se[0],ga=De.name.split(".").pop(),kr=`${Math.random().toString(36).substring(2)}.${ga}`,tn=`${n.user.id}/${kr}`;try{const{error:ys}=await ct.storage.from("rule-attachments").upload(tn,De);if(ys)throw ys;const Xi={name:De.name,path:tn,type:De.type,size:De.size};Rn(Qi=>[...Qi,Xi]),re.success("File uploaded")}catch(ys){console.error("Upload error:",ys),re.error("Failed to upload file")}finally{ds(!1),z.target.value=""}},gs=z=>{Rn(se=>se.filter(De=>De.path!==z))},Aa=z=>z==="gmail"?o.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold",children:"G"}):o.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold",children:"O"});return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsx(ss,{open:A,onOpenChange:E,children:o.jsxs(rs,{className:"sm:max-w-lg",children:[o.jsxs(Ea,{children:[o.jsxs(Na,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold text-sm",children:"G"}),"Connect Gmail Account"]}),o.jsx(Ta,{children:k==="credentials"?"Enter your Google OAuth credentials to connect your Gmail account.":"Paste the authorization code from Google to complete the connection."})]}),k==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Kw,{className:"w-4 h-4"}),"Paste credentials.json"]}),o.jsx("textarea",{className:"w-full h-24 p-3 text-xs font-mono border rounded-lg bg-secondary/30 resize-none focus:outline-none focus:ring-2 focus:ring-primary",placeholder:'{"installed":{"client_id":"...","client_secret":"..."}}',value:q,onChange:z=>Yi(z.target.value)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Download from Google Cloud Console → APIs & Services → Credentials"})]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("span",{className:"w-full border-t"})}),o.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:o.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or enter manually"})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Ce,{placeholder:"xxx.apps.googleusercontent.com",value:G,onChange:z=>ee(z.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Ce,{type:"password",placeholder:"GOCSPX-...",value:Q,onChange:z=>P(z.target.value)})]})]})]}),o.jsxs(pr,{children:[o.jsx(W,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),o.jsxs(W,{onClick:Ko,disabled:Ge||!G||!Q,children:[Ge?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:o.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["1. A new tab opened with Google Sign-In",o.jsx("br",{}),"2. Sign in and authorize the app",o.jsx("br",{}),"3. Copy the authorization code shown",o.jsx("br",{}),"4. Paste it below"]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Authorization Code"}),o.jsx(Ce,{placeholder:"4/0AQlEd8x...",value:J,onChange:z=>he(z.target.value),className:"font-mono"})]})]}),o.jsxs(pr,{children:[o.jsx(W,{variant:"outline",onClick:()=>O("credentials"),children:"Back"}),o.jsxs(W,{onClick:Yo,disabled:ye||!J.trim(),children:[ye?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Connect"]})]})]})]})}),o.jsx(ss,{open:nt,onOpenChange:Ve,children:o.jsxs(rs,{className:"sm:max-w-lg",children:[o.jsxs(Ea,{children:[o.jsxs(Na,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold text-sm",children:"O"}),"Connect Outlook Account"]}),o.jsx(Ta,{children:L==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),L==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:o.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"Note: You need an Azure App Registration for this to work."})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID (Application ID)"}),o.jsx(Ce,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:z=>X(z.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),o.jsx(Ce,{placeholder:"common",value:ge,onChange:z=>N(z.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:'Default is "common". Use your specific Tenant ID for organization accounts.'})]})]})]}),o.jsxs(pr,{children:[o.jsx(W,{variant:"outline",onClick:()=>Ve(!1),children:"Cancel"}),o.jsxs(W,{onClick:Ct,disabled:H||!K,children:[H?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):o.jsxs(o.Fragment,{children:[h&&o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Action Required"}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:h.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:h.userCode})}),o.jsxs(W,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ai,{className:"w-4 h-4 ml-2"})]})]})]}),o.jsx("div",{className:"flex justify-center",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(ht,{size:"sm"}),"Waiting for authorization..."]})})]}),o.jsx(pr,{children:o.jsx(W,{variant:"outline",onClick:()=>Ve(!1),children:"Cancel"})})]})]})}),o.jsx(ss,{open:F,onOpenChange:ue,children:o.jsxs(rs,{children:[o.jsxs(Ea,{children:[o.jsx(Na,{children:"Create Auto-Pilot Rule"}),o.jsx(Ta,{children:"Define a condition based on AI analysis to trigger an action."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Rule Name"}),o.jsx(Ce,{placeholder:"e.g. Archive Newsletters",value:ve,onChange:z=>de(z.target.value)})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"If Condition Field"}),o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Pe,onChange:z=>{Le(z.target.value),z.target.value==="category"?vt("newsletter"):z.target.value==="sentiment"?vt("Positive"):z.target.value==="priority"?vt("High"):vt("")},children:[o.jsxs("optgroup",{label:"AI Analysis",children:[o.jsx("option",{value:"category",children:"Category"}),o.jsx("option",{value:"sentiment",children:"Sentiment"}),o.jsx("option",{value:"priority",children:"Priority"})]}),o.jsxs("optgroup",{label:"Metadata",children:[o.jsx("option",{value:"sender_email",children:"Specific Email (Exact)"}),o.jsx("option",{value:"sender_domain",children:"Email Domain (@...)"}),o.jsx("option",{value:"sender_contains",children:"Sender contains..."}),o.jsx("option",{value:"subject_contains",children:"Subject contains..."}),o.jsx("option",{value:"body_contains",children:"Body contains..."})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Equals Value"}),Pe==="category"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:z=>vt(z.target.value),children:[o.jsx("option",{value:"newsletter",children:"Newsletter"}),o.jsx("option",{value:"spam",children:"Spam"}),o.jsx("option",{value:"promotional",children:"Promotional"}),o.jsx("option",{value:"transactional",children:"Transactional"}),o.jsx("option",{value:"social",children:"Social"}),o.jsx("option",{value:"support",children:"Support"}),o.jsx("option",{value:"client",children:"Client"}),o.jsx("option",{value:"internal",children:"Internal"}),o.jsx("option",{value:"personal",children:"Personal"}),o.jsx("option",{value:"other",children:"Other"})]}):Pe==="sentiment"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:z=>vt(z.target.value),children:[o.jsx("option",{value:"Positive",children:"Positive"}),o.jsx("option",{value:"Neutral",children:"Neutral"}),o.jsx("option",{value:"Negative",children:"Negative"})]}):Pe==="priority"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:z=>vt(z.target.value),children:[o.jsx("option",{value:"High",children:"High"}),o.jsx("option",{value:"Medium",children:"Medium"}),o.jsx("option",{value:"Low",children:"Low"})]}):o.jsx(Ce,{placeholder:Pe==="sender_domain"?"rta.vn":Pe==="sender_email"?"john@example.com":"Keywords...",value:Tt,onChange:z=>vt(z.target.value)})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Uo,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ce,{type:"number",min:"0",placeholder:"0",className:"w-24",value:ia,onChange:z=>cs(z.target.value)}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"days"})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Leave empty or 0 to apply rule immediately upon receipt."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Then Perform Action(s)"}),o.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Select one or more actions to execute when the rule matches"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"archive",label:"Archive Email"},{value:"delete",label:"Delete Email"},{value:"draft",label:"Draft Reply"},{value:"read",label:"Mark as Read"},{value:"star",label:"Star / Flag"}].map(z=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${bt.includes(z.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:bt.includes(z.value),onChange:se=>{se.target.checked?os([...bt,z.value]):os(bt.filter(De=>De!==z.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:z.label})]},z.value))})]}),bt.includes("draft")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsx("label",{className:"text-sm font-medium",children:"Draft Instructions (Context)"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[80px] text-sm",placeholder:"e.g. Tell them I'm busy until Friday, but interested in the proposal.",value:us,onChange:z=>Vi(z.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Specific context for the AI ghostwriter."})]}),o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(bg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[Cr.map(z=>o.jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary/50 rounded border text-xs",children:[o.jsx("span",{className:"truncate max-w-[200px]",children:z.name}),o.jsx(W,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>gs(z.path),children:o.jsx(Lo,{className:"w-3 h-3"})})]},z.path)),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:ps,disabled:en}),o.jsxs(W,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:en,children:[en?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_i,{className:"w-3 h-3 mr-2"}),en?"Uploading...":"Add Attachment"]})]})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Files will be attached to every draft generated by this rule."})]})]})]}),o.jsxs(pr,{children:[o.jsx(W,{variant:"outline",onClick:()=>ue(!1),children:"Cancel"}),o.jsxs(W,{onClick:kt,disabled:Ii,children:[Ii?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_i,{className:"w-4 h-4 mr-2"}),"Create Rule"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs(yt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(No,{className:"w-5 h-5 text-primary"}),"Connected Accounts"]}),o.jsx(Za,{children:"Manage your email providers"})]}),o.jsxs(ja,{className:"space-y-4",children:[n.accounts.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No accounts connected yet"}):n.accounts.map(z=>o.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-card",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[Aa(z.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:z.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:z.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[z.is_active?o.jsx("span",{className:"text-xs text-emerald-600 bg-emerald-500/10 px-2 py-1 rounded-full",children:"Active"}):o.jsx("span",{className:"text-xs text-yellow-600 bg-yellow-500/10 px-2 py-1 rounded-full",children:"Inactive"}),o.jsx(W,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>Jo(z.id),children:o.jsx(To,{className:"w-4 h-4"})})]})]},z.id)),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(W,{className:"w-full border-dashed",variant:"outline",onClick:Po,disabled:r||c,children:[r?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_i,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(W,{className:"w-full border-dashed",variant:"outline",onClick:Dn,disabled:r||c,children:[c&&!h?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_i,{className:"w-4 h-4 mr-2"}),"Connect Outlook Account"]})]}),h&&o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg animate-in slide-in-from-top-2",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Microsoft Sign-In Required"}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:h.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:h.userCode})}),o.jsxs(W,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Ai,{className:"w-4 h-4 ml-2"})]}),o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"Waiting for you to sign in..."})]})]})]})]}),o.jsxs(yt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(zd,{className:"w-5 h-5 text-emerald-500"}),"Auto-Pilot Rules"]}),o.jsx(Za,{children:"Configure AI automation behavior"})]}),o.jsxs(ja,{className:"space-y-4",children:[o.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Auto-Trash Spam"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically delete emails categorized as spam"})]}),o.jsxs(W,{variant:n.rules.find(z=>z.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Pi,disabled:mt==="auto_trash_spam",children:[mt==="auto_trash_spam"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(hd,{className:"w-4 h-4 mr-1"}),n.rules.find(z=>z.name==="Auto-Trash Spam")?.is_enabled?"On":"Off"]})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Smart Drafts"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate draft replies for important emails"})]}),o.jsxs(W,{variant:n.rules.find(z=>z.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:Ki,disabled:mt==="smart_drafts",children:[mt==="smart_drafts"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(hd,{className:"w-4 h-4 mr-1"}),n.rules.find(z=>z.name==="Smart Drafts")?.is_enabled?"On":"Off"]})]}),o.jsxs("div",{className:"pt-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"text-sm font-medium",children:"Custom Rules"}),o.jsxs(W,{variant:"ghost",size:"sm",onClick:()=>ue(!0),children:[o.jsx(_i,{className:"w-4 h-4 mr-1"})," Add Rule"]})]}),n.rules.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2 border border-dashed rounded-lg",children:"No custom rules yet"}),n.rules.length>0&&n.rules.filter(z=>z.name!=="Auto-Trash Spam"&&z.name!=="Smart Drafts").map(z=>{const se=z.actions&&z.actions.length>0?z.actions:z.action?[z.action]:[];return o.jsxs("div",{className:"p-3 bg-secondary/30 rounded-lg mb-2",children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-sm font-medium",children:z.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["→ ",se.join(" + ")]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(W,{variant:z.is_enabled?"default":"outline",size:"sm",onClick:()=>ms(z.id),className:"h-7 px-2",children:[o.jsx(hd,{className:"w-3.5 h-3.5 mr-1"}),z.is_enabled?"On":"Off"]}),o.jsx(W,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>a.deleteRule(z.id),children:o.jsx(To,{className:"w-3 h-3"})})]})]}),z.instructions&&o.jsxs("p",{className:"text-[10px] text-muted-foreground italic border-t border-border/50 pt-1 mt-1 truncate",children:['"',z.instructions,'"']}),z.attachments&&z.attachments.length>0&&o.jsx("div",{className:"flex gap-1 mt-1",children:z.attachments.map(De=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] bg-blue-500/10 text-blue-400 px-1.5 py-0.5 rounded border border-blue-500/20",children:[o.jsx(bg,{className:"w-2.5 h-2.5"}),De.name]},De.path))})]},z.id)})]})]})]})]}),o.jsxs(yt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(_r,{className:"w-5 h-5 text-indigo-500"}),"Model Configuration"]}),o.jsx(Za,{children:"Configure Local LLM or API settings"})]}),o.jsxs(ja,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Model Name"}),o.jsx(Ce,{placeholder:"gpt-4o-mini",value:_.llm_model||"",onChange:z=>S(se=>({...se,llm_model:z.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Base URL"}),o.jsx(Ce,{placeholder:"https://api.openai.com/v1",value:_.llm_base_url||"",onChange:z=>S(se=>({...se,llm_base_url:z.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Use http://localhost:11434/v1 for Ollama"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"API Key"}),o.jsx(Ce,{type:"password",placeholder:"sk-...",value:_.llm_api_key||"",onChange:z=>S(se=>({...se,llm_api_key:z.target.value}))})]})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(W,{variant:"outline",onClick:Xo,disabled:v,children:[v?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(_r,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(W,{onClick:Ji,disabled:g,children:[g?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})]})]})]}),o.jsx("div",{ref:hs,children:o.jsxs(yt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(zd,{className:"w-5 h-5 text-orange-500"}),"Provider Credentials (Advanced)"]}),o.jsx(Za,{children:"Bring Your Own Keys (BYOK). Configure your own OAuth credentials here. Leave empty to use system defaults."})]}),o.jsxs(ja,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-4 border-b pb-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Google / Gmail"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Ce,{type:"password",placeholder:"...apps.googleusercontent.com",value:_.google_client_id||"",onChange:z=>S(se=>({...se,google_client_id:z.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Ce,{type:"password",placeholder:"GOCSPX-...",value:_.google_client_secret||"",onChange:z=>S(se=>({...se,google_client_secret:z.target.value}))})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500"})," Microsoft / Outlook"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Ce,{type:"password",value:_.microsoft_client_id||"",onChange:z=>S(se=>({...se,microsoft_client_id:z.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),o.jsx(Ce,{type:"password",value:_.microsoft_client_secret||"",onChange:z=>S(se=>({...se,microsoft_client_secret:z.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),o.jsx(Ce,{placeholder:"common",value:_.microsoft_tenant_id||"",onChange:z=>S(se=>({...se,microsoft_tenant_id:z.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(W,{onClick:Ji,disabled:g,variant:"secondary",children:[g?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Qa,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})})]})]})})]})}const l2="modulepreload",o2=function(n){return"/"+n},fy={},c2=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let p=function(v){return Promise.all(v.map(x=>Promise.resolve(x).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};var h=p;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),g=m?.nonce||m?.getAttribute("nonce");c=p(r.map(v=>{if(v=o2(v),v in fy)return;fy[v]=!0;const x=v.endsWith(".css"),_=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${_}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":l2,x||(S.as="script"),S.crossOrigin="",S.href=v,g&&S.setAttribute("nonce",g),document.head.appendChild(S),x)return new Promise((A,E)=>{S.addEventListener("load",A),S.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${v}`)))})}))}function d(m){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=m,window.dispatchEvent(g),!g.defaultPrevented)throw m}return c.then(m=>{for(const g of m||[])g.status==="rejected"&&d(g.reason);return a().catch(d)})};function u2(){const[n,a]=w.useState("profile"),{state:r,actions:l}=Ar();w.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:vy},{id:"security",label:"Security",icon:qw},{id:"database",label:"Supabase",icon:No}];return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Account Settings"}),o.jsx("p",{className:"text-muted-foreground",children:"Manage your profile, security, and connection preferences."})]}),o.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[o.jsx("aside",{className:"w-full md:w-64 space-y-1",children:c.map(d=>{const h=d.icon,m=n===d.id;return o.jsxs("button",{onClick:()=>a(d.id),className:`w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors ${m?"bg-primary text-primary-foreground":"hover:bg-secondary text-muted-foreground"}`,children:[o.jsx(h,{className:"w-4 h-4"}),d.label]},d.id)})}),o.jsxs("div",{className:"flex-1 space-y-6",children:[n==="profile"&&o.jsx(d2,{}),n==="security"&&o.jsx(f2,{}),n==="database"&&o.jsx(h2,{})]})]})]})}function d2(){const{state:n,actions:a}=Ar(),[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(!1),[g,p]=w.useState(!1),[v,x]=w.useState(xr.isEnabled());w.useEffect(()=>{n.profile&&(l(n.profile.first_name||""),d(n.profile.last_name||""))},[n.profile]);const _=()=>{const E=!v;xr.setEnabled(E),x(E),E?(xr.playSuccess(),re.success("Sound effects enabled")):re.info("Sound effects disabled")},S=async()=>{m(!0);const E=await a.updateProfile({first_name:r,last_name:c});m(!1),E&&re.success("Profile updated")},A=async E=>{const k=E.target.files?.[0];if(!(!k||!n.user)){p(!0);try{const O=k.name.split(".").pop(),q=`${n.user.id}/avatar.${O}`,{data:B,error:G}=await ct.storage.from("avatars").upload(q,k,{upsert:!0});if(G)throw G;const{data:{publicUrl:ee}}=ct.storage.from("avatars").getPublicUrl(q);await a.updateProfile({avatar_url:ee}),re.success("Avatar updated")}catch(O){console.error("Avatar upload error:",O),re.error("Failed to upload avatar")}finally{p(!1)}}};return o.jsxs(yt,{children:[o.jsxs(_a,{children:[o.jsx(Sa,{children:"Profile Information"}),o.jsx(Za,{children:"Update your personal details and avatar."})]}),o.jsxs(ja,{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col items-center sm:flex-row sm:items-start gap-6",children:[o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"w-24 h-24 rounded-full bg-secondary overflow-hidden border-2 border-border flex items-center justify-center",children:n.profile?.avatar_url?o.jsx("img",{src:n.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(vy,{className:"w-12 h-12 text-muted-foreground"})}),o.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-full opacity-0 group-hover:opacity-100 cursor-pointer transition-opacity",children:[o.jsx(Cx,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:A,disabled:g})]}),g&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(ht,{size:"sm"})})]}),o.jsxs("div",{className:"flex-1 space-y-4 w-full",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"first-name",children:"First Name"}),o.jsx(Ce,{id:"first-name",value:r,onChange:E=>l(E.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Ce,{id:"last-name",value:c,onChange:E=>d(E.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"email",children:"Email Address"}),o.jsx(Ce,{id:"email",value:n.profile?.email||"",disabled:!0,className:"bg-secondary/50"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Email cannot be changed directly."})]})]})]}),o.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("label",{className:"text-sm font-medium",children:"Sound & Haptics"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Audio feedback when processing emails and completing tasks."})]}),o.jsxs(W,{variant:v?"default":"outline",size:"sm",onClick:_,className:"gap-2",children:[v?o.jsx(Zw,{className:"w-4 h-4"}):o.jsx(Ww,{className:"w-4 h-4"}),v?"Enabled":"Disabled"]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(W,{onClick:S,disabled:h,children:[h?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Cw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function f2(){const[n,a]=w.useState(""),[r,l]=w.useState(""),[c,d]=w.useState(!1),h=async()=>{if(!n){re.error("Please enter a new password");return}if(n!==r){re.error("Passwords do not match");return}if(n.length<6){re.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await c2(async()=>{const{api:p}=await Promise.resolve().then(()=>qj);return{api:p}},void 0),g=await m.changePassword(n);g.success?(re.success("Password changed successfully"),a(""),l("")):re.error(g.error?.message||"Failed to change password")}catch{re.error("An error occurred")}finally{d(!1)}};return o.jsxs(yt,{children:[o.jsxs(_a,{children:[o.jsx(Sa,{children:"Security"}),o.jsx(Za,{children:"Manage your password and account security."})]}),o.jsxs(ja,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"new-password",children:"New Password"}),o.jsx(Ce,{id:"new-password",type:"password",value:n,onChange:m=>a(m.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ha,{htmlFor:"confirm-password",children:"Confirm New Password"}),o.jsx(Ce,{id:"confirm-password",type:"password",value:r,onChange:m=>l(m.target.value),placeholder:"••••••••"})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(W,{onClick:h,disabled:c,children:[c?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(uw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function h2(){const[n,a]=w.useState(!1),r=Tr(),l=Uj(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(zj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(yt,{children:[o.jsxs(_a,{children:[o.jsxs(Sa,{className:"flex items-center gap-2",children:[o.jsx(No,{className:"w-5 h-5 text-primary"}),"Supabase Connection"]}),o.jsx(Za,{children:"Manage your database configuration (BYOK - Bring Your Own Keys)."})]}),o.jsx(ja,{className:"space-y-6",children:r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-xl bg-emerald-500/5 border-emerald-500/20",children:[o.jsx(tf,{className:"w-6 h-6 text-emerald-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx("p",{className:"font-semibold text-emerald-700 dark:text-emerald-400",children:"Connected"}),o.jsx("p",{className:"text-sm font-mono break-all opacity-80",children:r.url})]})]}),l==="env"&&o.jsxs(Bi,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(Md,{className:"h-4 w-4 text-amber-500"}),o.jsx(qi,{className:"text-amber-700 dark:text-amber-400 text-xs",children:"Configuration is loaded from environment variables. Use the UI to override them."})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs(W,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[o.jsx(Md,{className:"w-4 h-4 mr-2"}),"Change Connection"]}),l==="ui"&&o.jsxs(W,{variant:"outline",onClick:c,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(To,{className:"w-4 h-4 mr-2"}),"Clear Config"]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(ha,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Anon Public Key"}),o.jsxs("div",{className:"p-2 bg-secondary/50 rounded-lg font-mono text-xs break-all",children:[r.anonKey.substring(0,20),"...",r.anonKey.substring(r.anonKey.length-10)]})]})]}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center space-y-4",children:[o.jsx(Kx,{className:"w-12 h-12 text-destructive opacity-20"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"No Connection Detected"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure a Supabase project to get started."})]}),o.jsxs(W,{onClick:()=>a(!0),children:[o.jsx(No,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx(Hv,{open:n,onComplete:()=>a(!1),canClose:!0})]})}function m2({length:n=6,value:a,onChange:r,onComplete:l,disabled:c=!1,error:d=!1}){const h=w.useRef([]),[m,g]=w.useState(null),p=(_,S)=>{const A=S.replace(/[^0-9]/g,"");if(A.length===0){const O=a.split("");O[_]=" ",a.split("");let q=a.split("");_<q.length&&q.splice(_,1);const B=q.join("");r(B),_>0&&h.current[_-1]?.focus();return}a.split("");const E=[...a];E[_]=A[0],r(E.join("")),_<n-1&&h.current[_+1]?.focus();const k=E.join("");k.length===n&&l&&l(k)},v=(_,S)=>{S.key==="Backspace"&&!a[_]&&_>0||S.key==="ArrowLeft"&&_>0?h.current[_-1]?.focus():S.key==="ArrowRight"&&_<n-1&&h.current[_+1]?.focus()},x=_=>{_.preventDefault();const A=_.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,n);r(A);const E=Math.min(A.length,n-1);h.current[E]?.focus(),A.length===n&&l&&l(A)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:n}).map((_,S)=>o.jsx(Ce,{ref:A=>{h.current[S]=A},type:"text",inputMode:"numeric",maxLength:1,value:a[S]||"",onChange:A=>p(S,A.target.value),onKeyDown:A=>v(S,A),onPaste:x,onFocus:()=>g(S),onBlur:()=>g(null),disabled:c,className:Ne("w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-semibold px-0",d&&"border-destructive focus-visible:ring-destructive",m===S&&"ring-2 ring-ring"),"aria-label":`Digit ${S+1}`},S))})}function p2({onSuccess:n,onConfigure:a}){const[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(""),[g,p]=w.useState(""),[v,x]=w.useState(!1),[_,S]=w.useState(!0),[A,E]=w.useState(!1),[k,O]=w.useState(""),[q,B]=w.useState("password"),[G,ee]=w.useState("email"),[Q,P]=w.useState("");w.useEffect(()=>{J()},[]);const J=async()=>{try{const{data:xe,error:ye}=await ct.from("init_state").select("is_initialized");if(ye){console.warn("[Login] Init check failed, defaulting to initialized (Login):",ye),E(!0);return}const Ze=xe?.[0]?.is_initialized>0;E(Ze)}catch(xe){if(console.warn("[Login] Init check exception, defaulting to initialized:",xe),xe.message?.includes("Invalid API key")||xe.status===401){console.warn("[Login] API Key invalid for REST check (likely Publishable Key). defaulting to Setup Mode (isInitialized=false)."),E(!1);return}E(!0)}finally{S(!1)}},he=async xe=>{xe.preventDefault(),x(!0),O("");try{if(A){if(q==="password"){const{error:ye}=await ct.auth.signInWithPassword({email:r,password:c});if(ye)throw ye;re.success("Logged in successfully"),n?.()}else if(G==="email"){const{error:ye}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(ye)throw ye;ee("verify"),re.success("Validation code sent to your email")}}else{const{data:ye,error:Ze}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:g}});if(Ze||!ye){if(Ze?.message?.includes("First user already exists")){re.info("System already initialized. Please log in."),E(!0);return}throw new Error(Ze?.message||"Failed to create admin account")}re.success("Admin account created! Signing you in...");const{error:nt}=await ct.auth.signInWithPassword({email:r,password:c});if(nt)throw nt;E(!0),n?.()}}catch(ye){O(ye?.message||"Authentication failed"),console.error("[Login] Error:",ye)}finally{x(!1)}},Ge=async()=>{x(!0),O("");try{const{data:xe,error:ye}=await ct.auth.verifyOtp({email:r,token:Q,type:"magiclink"});if(ye)throw ye;if(!xe.session)throw new Error("Failed to create session");re.success("Logged in successfully"),n?.()}catch(xe){O(xe?.message||"Invalid code")}finally{x(!1)}};return _?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx(qt,{className:"w-8 h-8 animate-spin text-primary"})}):o.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-8 relative",children:[o.jsx("div",{className:"absolute top-4 right-4",children:o.jsx(Ly,{})}),o.jsxs(yt,{className:"w-full max-w-md shadow-2xl",children:[o.jsxs(_a,{className:"text-center",children:[o.jsx("div",{className:"mx-auto bg-primary/10 p-4 rounded-full w-fit mb-4",children:o.jsx(mf,{className:"w-12 h-12"})}),o.jsx(Sa,{className:"text-2xl",children:A?"Welcome Back":"Welcome to Email Automator"}),o.jsx(Za,{children:A?q==="password"?"Sign in to access your email automation":G==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:he,children:[o.jsxs(ja,{className:"space-y-4",children:[!A&&o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"First Name"}),o.jsx(Ce,{value:h,onChange:xe=>m(xe.target.value),required:!A,placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Last Name"}),o.jsx(Ce,{value:g,onChange:xe=>p(xe.target.value),required:!A,placeholder:"Doe"})]})]}),q==="password"||G==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Ce,{type:"email",placeholder:"admin@example.com",value:r,onChange:xe=>l(xe.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(Ce,{type:"password",placeholder:"••••••••",value:c,onChange:xe=>d(xe.target.value),required:!0,minLength:6,autoComplete:A?"current-password":"new-password"})]}),q==="otp"&&G==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(m2,{value:Q,onChange:P,length:6,onComplete:()=>{}})}),o.jsx(W,{type:"button",variant:"link",className:"w-full text-xs text-muted-foreground",onClick:()=>ee("email"),children:"Change email address"})]}),o.jsxs("div",{className:"bg-destructive/10 text-destructive text-sm p-3 rounded-md flex flex-col gap-2",children:[o.jsx("p",{children:k}),k.includes("configuration")||k.includes("Invalid API key")||k.includes("API key")&&a&&o.jsx(W,{type:"button",variant:"outline",className:"w-full border-destructive/50 hover:bg-destructive/20 text-destructive",onClick:a,children:"Update Connection Settings"})]})]}),o.jsxs(lv,{className:"flex flex-col gap-3",children:[q==="otp"&&G==="verify"?o.jsx(W,{type:"button",onClick:Ge,disabled:v||Q.length!==6,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx(qt,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify Code"}):o.jsx(W,{type:"submit",disabled:v||!r||q==="password"&&!c,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx(qt,{className:"w-4 h-4 mr-2 animate-spin"}),A?q==="otp"?"Send Code":"Signing in...":"Creating Account..."]}):o.jsxs(o.Fragment,{children:[A?q==="otp"?o.jsx(Dd,{className:"w-4 h-4 mr-2"}):o.jsx(pw,{className:"w-4 h-4 mr-2"}):o.jsx(Jw,{className:"w-4 h-4 mr-2"}),A?q==="otp"?"Send Login Code":"Sign In":"Create Admin Account"]})}),A&&o.jsx("div",{className:"flex flex-col gap-2 w-full",children:q==="password"?o.jsxs(W,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("otp"),ee("email"),O("")},children:[o.jsx(ow,{className:"w-4 h-4 mr-2"}),"Sign in with Code"]}):o.jsxs(W,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("password"),O("")},children:[o.jsx(_x,{className:"w-4 h-4 mr-2"}),"Sign in with Password"]})}),A&&o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"New users must be invited by an admin."})]})]})]})]})}const Vv=void 0,g2=void 0;function y2(n,a){const r=n.split(".").map(Number),l=a.split(".").map(Number);for(let c=0;c<Math.max(r.length,l.length);c++){const d=r[c]||0,h=l[c]||0;if(d>h)return 1;if(d<h)return-1}return 0}async function v2(n){try{const{data:a,error:r}=await n.rpc("get_latest_migration_timestamp");return r?(console.warn("Could not get latest migration timestamp:",r.message),{version:null,latestMigrationTimestamp:null}):{version:Vv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function b2(n){const a=Vv,r=g2,l=await v2(n);if(console.log("[Migration Check]",{appVersion:a,appMigrationTimestamp:r,dbVersion:l.version,dbMigrationTimestamp:l.latestMigrationTimestamp}),l.latestMigrationTimestamp&&l.latestMigrationTimestamp.trim()!==""){const c=r,d=l.latestMigrationTimestamp;return c>d?{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`New migrations available. Database is at ${d}, app has ${c}.`}:c<d?(console.warn("[Migration Check] DB is ahead of app - possible downgrade"),{needsMigration:!1,appVersion:a,dbVersion:l.version,message:`Database (${d}) is ahead of app (${c}).`}):(console.log("[Migration Check] Timestamps match - database is up-to-date"),{needsMigration:!1,appVersion:a,dbVersion:l.version,message:"Database schema is up-to-date."})}if(l.version){console.log("[Migration Check] Legacy DB detected (no timestamp). Falling back to SemVer.");const c=y2(a,l.version);return c>0?{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`Database schema (v${l.version}) is outdated. Migration to v${a} required.`}:c===0?(console.warn("[Migration Check] Legacy DB with matching version - forcing migration to add timestamp tracking"),{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`Database lacks timestamp tracking. Please run migration to upgrade to modern schema (v${a}).`}):{needsMigration:!1,appVersion:a,dbVersion:l.version,message:`Database version (v${l.version}) is ahead of app (v${a}).`}}return console.log("[Migration Check] No DB info found - assuming migration needed"),{needsMigration:!0,appVersion:a,dbVersion:null,message:`Database schema unknown. Migration required to v${a}.`}}const Iv="email_automator_migration_reminder_dismissed_at";function x2(n=24){try{const a=localStorage.getItem(Iv);if(!a)return!1;const r=new Date(a).getTime();return(Date.now()-r)/(1e3*60*60)<n}catch(a){return console.error("Error checking migration reminder:",a),!1}}function w2(){try{localStorage.setItem(Iv,new Date().toISOString())}catch(n){console.error("Error dismissing migration reminder:",n)}}function _2({status:n,onDismiss:a,onLearnMore:r}){const[l,c]=w.useState(!0);if(!l)return null;const d=()=>{w2(),c(!1),a?.()},h=()=>{r?r():(navigator.clipboard.writeText("npx email-automator migrate"),re.success("Command copied to clipboard"))};return o.jsx("div",{className:"fixed right-4 top-16 z-50 max-w-sm animate-in slide-in-from-top-5",children:o.jsx("div",{className:"rounded-lg border border-yellow-500 bg-yellow-50 p-4 shadow-lg dark:bg-yellow-950/90 dark:border-yellow-600",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Sr,{className:"h-5 w-5 flex-shrink-0 text-yellow-600 dark:text-yellow-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:"Database Update Required"}),o.jsxs(W,{size:"icon",variant:"ghost",className:"h-5 w-5 -mr-1 -mt-1 text-yellow-900 hover:bg-yellow-100 dark:text-yellow-100 dark:hover:bg-yellow-900/30",onClick:d,children:[o.jsx(Lo,{className:"h-3 w-3"}),o.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),o.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-200",children:["Your app version (",n.appVersion,") requires a database schema update."]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(W,{size:"sm",variant:"default",className:"h-7 text-xs bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-500 dark:hover:bg-yellow-600",onClick:h,children:"Update Now"}),o.jsx(W,{size:"sm",variant:"ghost",className:"h-7 text-xs text-yellow-900 hover:bg-yellow-100 dark:text-yellow-100 dark:hover:bg-yellow-900/30",onClick:d,children:"Remind Later"})]})]})]})})})}function _o({code:n,label:a}){const[r,l]=w.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){re.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(n),l(!0),window.setTimeout(()=>l(!1),2e3),re.success("Copied to clipboard")}catch(h){console.error("Failed to copy:",h),re.error("Failed to copy to clipboard")}};return o.jsxs("div",{className:"relative",children:[a&&o.jsx("div",{className:"mb-2 text-sm font-medium text-muted-foreground",children:a}),o.jsxs("div",{className:"group relative",children:[o.jsx("pre",{className:"overflow-hidden rounded-md bg-muted p-3 pr-12 text-sm",children:o.jsx("code",{className:"block whitespace-pre-wrap break-all",children:n})}),o.jsxs(W,{type:"button",size:"icon",variant:"ghost",className:"absolute right-2 top-2 h-8 w-8",onClick:d,disabled:!c,children:[r?o.jsx(Qa,{className:"h-4 w-4 text-green-600"}):o.jsx(Qx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function S2({open:n,onOpenChange:a,status:r}){const l=Tr(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[g,p]=w.useState([]),[v,x]=w.useState(""),[_,S]=w.useState(""),A=w.useRef(null),E=w.useMemo(()=>{const O=l?.url;if(!O)return"";try{return new URL(O).hostname.split(".")[0]||""}catch{return""}},[l?.url]);w.useEffect(()=>{A.current&&A.current.scrollIntoView({behavior:"smooth"})},[g]);const k=async()=>{if(!E){re.error("Missing Project ID");return}m(!0),p(["Initializing migration..."]);try{const O=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:E,dbPassword:v,accessToken:_})});if(!O.ok)throw new Error(`Server returned ${O.status}: ${O.statusText}`);const q=O.body?.getReader();if(!q)throw new Error("No response stream received.");const B=new TextDecoder;for(;;){const{done:G,value:ee}=await q.read();if(G)break;const P=B.decode(ee).split(`
96
- `).filter(Boolean);p(J=>[...J,...P])}}catch(O){console.error(O),p(q=>[...q,`Error: ${O instanceof Error?O.message:String(O)}`]),re.error("Migration failed. Check logs for details.")}finally{m(!1)}};return o.jsx(ss,{open:n,onOpenChange:O=>!h&&a(O),children:o.jsxs(rs,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[o.jsxs(Ea,{children:[o.jsxs(Na,{className:"flex items-center gap-2 text-xl",children:[o.jsx(Sr,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Migration Required"]}),o.jsxs(Ta,{children:["Your application version (",r.appVersion,") requires a database schema update to function correctly."]})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs(Bi,{children:[o.jsx(wr,{className:"h-4 w-4"}),o.jsxs(qi,{children:[o.jsx("strong",{children:"Why is this needed?"}),o.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[o.jsxs("li",{children:["Updates your database schema to match version ",r.appVersion]}),o.jsx("li",{children:"Enables new features and performance improvements"}),o.jsx("li",{children:"Your existing data will be preserved (safe migration)"})]})]})]}),o.jsxs("div",{className:"flex border-b",children:[o.jsx("button",{className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${c?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,onClick:()=>d(!0),children:"Automatic (Recommended)"}),o.jsx("button",{className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${c?"border-transparent text-muted-foreground hover:text-foreground":"border-primary text-primary"}`,onClick:()=>d(!1),children:"Manual CLI"})]}),c?o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm p-6",children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Automated Migration"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Run the migration directly from your browser. Requires your database password."}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ha,{htmlFor:"project-id",children:"Supabase Project ID"}),o.jsx(Ce,{id:"project-id",value:E,disabled:!0,readOnly:!0,className:"bg-muted"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(ha,{htmlFor:"access-token",children:"Access Token (Optional)"}),o.jsxs("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["Generate Token ",o.jsx(Ai,{className:"h-3 w-3"})]})]}),o.jsx(Ce,{id:"access-token",type:"password",placeholder:"sbp_...",value:_,onChange:O=>S(O.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Recommended for more reliable authentication."})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ha,{htmlFor:"db-password",children:"Database Password"}),o.jsx(Ce,{id:"db-password",type:"password",placeholder:"Your database password",value:v,onChange:O=>x(O.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Required if no access token is provided."})]}),o.jsx(W,{onClick:k,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx(qt,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Ud,{className:"mr-2 h-4 w-4"}),"Start Migration"]})})]})]}),o.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[g.length===0?o.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):g.map((O,q)=>o.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:O},q)),o.jsx("div",{ref:A})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"1"}),"Prerequisites"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"You will need the following before proceeding:"}),o.jsxs("ul",{className:"list-inside list-disc space-y-1 text-sm",children:[o.jsx("li",{children:"Supabase CLI installed"}),o.jsxs("li",{children:["Project ID:"," ",o.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:E||"your-project-id"})]}),o.jsx("li",{children:"Database Password"})]})]})]}),o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"2"}),"Install Supabase CLI"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"MacOS (Brew)"}),o.jsx(_o,{code:"brew install supabase/tap/supabase"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"Windows (Scoop)"}),o.jsx(_o,{code:`scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
97
- scoop install supabase`})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"NPM (Universal)"}),o.jsx(_o,{code:"npm install -g supabase"})]})]})]}),o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"3"}),"Run Migration"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Run the built-in migration tool:"}),o.jsx(_o,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Bi,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(Sr,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(qi,{children:[o.jsx("strong",{children:"Troubleshooting"}),o.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[o.jsxs("li",{children:["Try logging out: ",o.jsx("code",{children:"supabase logout"})]}),o.jsx("li",{children:"Verify your database password is correct"})]})]})]})]}),o.jsx(pr,{children:o.jsx(W,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function j2(){const[n,a]=w.useState([]),{isExpanded:r,setIsExpanded:l}=iv(),[c,d]=w.useState({});w.useEffect(()=>{h();const v=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},x=>{const _=x.new;_.event_type==="error"&&d(S=>({...S,[_.id]:!0})),a(S=>{const A=[_,...S];return A.length>100?A.slice(0,100):A})}).subscribe();return()=>{ct.removeChannel(v)}},[]);const h=async()=>{const{data:v}=await ct.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);v&&a(v)},m=v=>{d(x=>({...x,[v]:!x[v]}))},g=v=>{switch(v){case"analysis":return o.jsx(zo,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(Sr,{className:"w-3 h-3 text-red-500"});default:return o.jsx(wr,{className:"w-3 h-3 text-blue-500"})}},p=v=>new Date(v).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return r?o.jsxs(yt,{className:"fixed bottom-4 right-4 z-50 w-[550px] h-[650px] flex flex-col shadow-2xl border-border bg-background/95 text-foreground backdrop-blur-md animate-in slide-in-from-bottom-10",children:[o.jsxs(_a,{className:"py-3 px-4 border-b border-border flex flex-row items-center justify-between sticky top-0 bg-background/95 z-20",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ud,{className:"w-4 h-4 text-primary"}),o.jsx(Sa,{className:"text-sm font-mono font-bold",children:"Agent Terminal"}),o.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 bg-green-500/10 px-2 py-0.5 rounded-full border border-green-500/20 font-bold",children:[o.jsx(vx,{className:"w-3 h-3"}),"LIVE"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(W,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:"Clear"}),o.jsx(W,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:o.jsx(xw,{className:"w-4 h-4"})})]})]}),o.jsxs(ja,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[n.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:"Waiting for agent activity..."}),n.map((v,x)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[x!==n.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:Ne("absolute left-0 top-0 w-7 h-7 rounded-full border border-border bg-card flex items-center justify-center z-10 shadow-sm",v.event_type==="error"&&"border-red-500/50 bg-red-500/5",v.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",v.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5"),children:g(v.event_type)}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between group",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Ne("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:p(v.created_at)})]}),(v.details?.system_prompt||v.details?._raw_response||v.details?.raw_response)&&o.jsxs(W,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[9px] text-muted-foreground hover:text-primary opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>m(v.id),children:[c[v.id]?o.jsx(qx,{className:"w-3 h-3 mr-1"}):o.jsx(Dx,{className:"w-3 h-3 mr-1"}),"Details"]})]}),v.event_type==="analysis"&&v.details?o.jsxs("div",{className:"bg-purple-500/5 border border-purple-500/10 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:Ne("px-1.5 py-0.5 rounded text-[9px] font-bold border",v.details.is_useless?"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20":"bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20"),children:v.details.is_useless?"USELESS":"RELEVANT"}),o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold border bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 uppercase",children:v.details.category})]}),o.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',v.details.summary,'"']}),v.details.suggested_actions&&v.details.suggested_actions.length>0&&o.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:v.details.suggested_actions.map(_=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-emerald-600 dark:text-emerald-400 font-bold bg-emerald-500/10 px-1.5 py-0.5 rounded border border-emerald-500/20 uppercase",children:[o.jsx(Ao,{className:"w-2.5 h-2.5"}),_]},_))})]}):v.event_type==="action"&&v.details?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/10 rounded-lg p-3",children:[o.jsx("p",{className:"text-emerald-600 dark:text-emerald-400 font-bold mb-1 uppercase text-[9px] tracking-widest",children:"Execution Complete"}),o.jsxs("p",{className:"text-foreground font-medium",children:[v.details.action==="delete"&&"Moved to Trash",v.details.action==="archive"&&"Archived Email",v.details.action==="draft"&&"Drafted Reply",v.details.action==="read"&&"Marked as Read",v.details.action==="star"&&"Starred Email",!["delete","archive","draft","read","star"].includes(v.details.action)&&v.details.action]}),v.details.reason&&o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[o.jsx(wr,{className:"w-3 h-3"}),v.details.reason]})]}):v.event_type==="error"&&v.details?o.jsx("div",{className:"bg-red-500/5 border border-red-500/10 rounded-lg p-2.5 text-red-600 dark:text-red-400 font-medium",children:typeof v.details.error=="object"?v.details.error.message||JSON.stringify(v.details.error):v.details.error}):o.jsx("p",{className:"text-muted-foreground leading-relaxed",children:v.details?.message||JSON.stringify(v.details)}),c[v.id]&&o.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[v.details?.system_prompt&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(gr,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"whitespace-pre-wrap break-words text-[10px] leading-normal text-muted-foreground select-all",children:v.details.system_prompt})})]}),v.details?.content_preview&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(gr,{className:"w-3 h-3"})," Input Content (Cleaned)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border",children:o.jsx("p",{className:"whitespace-pre-wrap break-words text-[10px] text-muted-foreground",children:v.details.content_preview})})]}),v.details?._raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(gr,{className:"w-3 h-3"})," Raw LLM JSON Output"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all",children:JSON.stringify(JSON.parse(v.details._raw_response),null,2)})})]}),v.details?.raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(gr,{className:"w-3 h-3"})," Raw Response (from Error)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all whitespace-pre-wrap",children:typeof v.details.raw_response=="object"?JSON.stringify(v.details.raw_response,null,2):v.details.raw_response})})]})]})]})]},v.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(W,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx(Ud,{className:"w-4 h-4 mr-2"}),"Live Activity",n.length>0&&o.jsxs("span",{className:"ml-2 flex h-2 w-2 relative",children:[o.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),o.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]})]})})}function E2(){const{state:n,actions:a}=Ar(),[r,l]=w.useState(!1),[c,d]=w.useState("dashboard"),[h,m]=w.useState(!0),[g,p]=w.useState(!1);if(w.useEffect(()=>{const Q=new URLSearchParams(window.location.search).get("code");Q&&!g&&(async()=>{p(!0);try{const J=await He.connectGmail(Q);if(J.data?.success)re.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),a.fetchAccounts());else{const he=typeof J.error=="string"?J.error:J.error?.message;re.error(he||"Failed to connect Gmail")}}catch{re.error("Connection failed")}finally{p(!1)}})()},[]),g)return o.jsx(Ti,{text:"Connecting account..."});const[v,x]=w.useState(null),[_,S]=w.useState(!1),[A,E]=w.useState(!1),[k,O]=w.useState(!1);w.useEffect(()=>{(async()=>{const Q=Tr();if(!Q){l(!0),m(!1);return}if((await tv(Q.url,Q.anonKey)).valid)n.isInitialized&&n.isAuthenticated&&(a.fetchAccounts(),a.fetchRules(),a.fetchSettings(),a.fetchProfile(),b2(ct).then(J=>{x(J),J.needsMigration&&!x2()&&S(!0)}));else{l(!0),m(!1);return}m(!1)})()},[n.isInitialized,n.isAuthenticated]);const q=()=>{E(!0),S(!1)},B={migrationStatus:v,showMigrationBanner:_,showMigrationModal:A,openMigrationModal:q,suppressMigrationBanner:k,setSuppressMigrationBanner:O};if(h)return o.jsx(Ti,{text:"Checking configuration..."});if(r)return o.jsx(Hv,{onComplete:()=>{l(!1),window.location.reload()}});if(!n.isInitialized)return o.jsx(Ti,{text:"Initializing..."});if(!n.isAuthenticated)return o.jsx(p2,{onConfigure:()=>l(!0)});const G=async()=>{await ct.auth.signOut(),re.success("Logged out successfully")};return o.jsx(Ij,{value:B,children:o.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[o.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[o.jsx("div",{className:"flex items-center gap-4",children:o.jsxs("button",{onClick:()=>d("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(mf,{className:"w-9 h-9"}),o.jsx("span",{className:"hidden sm:inline",children:"Email Automator"}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]})}),o.jsxs("div",{className:"flex gap-4 items-center",children:[o.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[o.jsxs(W,{variant:c==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>d("dashboard"),className:"gap-2",children:[o.jsx(fw,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),o.jsxs(W,{variant:c==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>d("analytics"),className:"gap-2",children:[o.jsx(gy,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),o.jsxs(W,{variant:c==="config"?"secondary":"ghost",size:"sm",onClick:()=>d("config"),className:"gap-2",children:[o.jsx(Md,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Configuration"})]})]}),o.jsx("div",{className:"h-6 w-px bg-border/50 mx-2 hidden sm:block"}),o.jsx(Ly,{}),o.jsx(W,{variant:c==="account"?"secondary":"ghost",size:"sm",onClick:()=>d("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:"Account Settings",children:n.profile?.avatar_url?o.jsx("img",{src:n.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(Gx,{className:"w-5 h-5"})}),o.jsx(W,{variant:"ghost",size:"sm",onClick:G,className:"text-muted-foreground hover:text-foreground",title:"Sign out",children:o.jsx(yw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4",children:[c==="dashboard"&&o.jsx(n2,{}),c==="config"&&o.jsx(i2,{}),c==="analytics"&&o.jsx(T2,{}),c==="account"&&o.jsx(u2,{})]}),n.error&&o.jsx("div",{className:"fixed bottom-20 left-4 right-4 sm:left-auto sm:right-4 sm:max-w-sm z-50",children:o.jsx("div",{className:"bg-destructive/10 border border-destructive/20 text-destructive p-4 rounded-lg",children:o.jsx("p",{className:"text-sm",children:n.error})})}),v&&_&&!k&&o.jsx(_2,{status:v,onDismiss:()=>S(!1),onLearnMore:q}),v&&o.jsx(S2,{open:A,onOpenChange:E,status:v}),o.jsx(j2,{})]})})}function N2({runId:n,accountEmail:a,isOpen:r,onOpenChange:l}){const[c,d]=w.useState([]),[h,m]=w.useState(!1);w.useEffect(()=>{r&&n&&g()},[r,n]);const g=async()=>{if(n){m(!0);try{const v=await He.getRunEvents(n);v.data&&d(v.data.events)}catch(v){console.error("Failed to fetch run trace:",v)}finally{m(!1)}}},p=v=>{switch(v){case"analysis":return o.jsx(zo,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Ao,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx($i,{className:"w-4 h-4 text-red-500"});default:return o.jsx(wr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(ss,{open:r,onOpenChange:l,children:o.jsxs(rs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Ea,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(nf,{className:"w-5 h-5 text-primary"}),o.jsx(Na,{children:"Sync Run Trace"})]}),o.jsx(Ta,{children:a?`Full log for account: ${a}`:"Historical log for this synchronization run."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:h?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(Ti,{text:"Loading trace..."})}):c.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:"No granular trace events found for this run."}):c.map((v,x)=>o.jsxs("div",{className:"relative pl-8",children:[x!==c.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:p(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(Uo,{className:"w-3 h-3"}),new Date(v.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[v.event_type==="info"&&o.jsx("p",{className:"text-sm text-foreground/90",children:v.details?.message}),v.event_type==="analysis"&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',v.details?.summary,'"']}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:"text-[9px] bg-secondary px-1.5 py-0.5 rounded font-bold uppercase",children:v.details?.category}),v.details?.suggested_actions?.map(_=>o.jsx("span",{className:"text-[9px] bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 px-1.5 py-0.5 rounded border border-emerald-500/20 font-bold uppercase",children:_},_))]})]}),v.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:["Executed: ",v.details?.action]}),o.jsx(af,{className:"w-4 h-4 text-emerald-500"})]}),v.event_type==="error"&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:v.details?.error})]})]})]},v.id))})]})})}function T2(){const{state:n,actions:a}=Ar(),[r,l]=w.useState(null),[c,d]=w.useState(void 0),[h,m]=w.useState(!1);if(w.useEffect(()=>{a.fetchStats()},[]),!n.stats)return o.jsx(Ti,{text:"Loading analytics..."});const g=(v,x)=>{l(v),d(x),m(!0)},{stats:p}=n;return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[o.jsx(gy,{className:"w-6 h-6 text-primary"}),"Analytics Dashboard"]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[o.jsx(So,{title:"Total Emails",value:p.totalEmails,color:"primary"}),o.jsx(So,{title:"Spam Caught",value:p.categoryCounts.spam||0,color:"destructive"}),o.jsx(So,{title:"Actions Taken",value:Object.values(p.actionCounts).reduce((v,x)=>v+x,0)-(p.actionCounts.none||0),color:"emerald"}),o.jsx(So,{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(([v,x])=>o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[o.jsx("span",{className:"capitalize",children:v}),o.jsx("span",{className:"text-muted-foreground",children:x})]}),o.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${x/p.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(p.actionCounts).map(([v,x])=>o.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[o.jsx("span",{className:"capitalize",children:v}),o.jsx("span",{className:"font-medium",children:x})]},v))})]})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Recent Sync Activity"}),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(v=>{const x=v.completed_at?Math.round((new Date(v.completed_at).getTime()-new Date(v.started_at).getTime())/1e3):null;return o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between p-3 border rounded-lg hover:bg-secondary/30 transition-colors gap-3 cursor-pointer group",onClick:()=>g(v.id,v.email_accounts?.email_address),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:Ne("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(Uo,{className:"w-3 h-3"}),new Date(v.started_at).toLocaleString(),x!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[x,"s"]})]})]})]}),o.jsx("div",{className:"flex items-center gap-4 text-xs",children:o.jsxs("div",{className:"flex flex-col items-end",children:[o.jsxs("span",{className:"font-bold text-primary",children:[v.emails_processed," emails"]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[v.emails_deleted," deleted, ",v.emails_drafted," drafted"]})]})})]},v.id)})})]}),o.jsx(N2,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function So({title:n,value:a,color:r}){const l={primary:"bg-primary/10 text-primary",destructive:"bg-destructive/10 text-destructive",emerald:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",blue:"bg-blue-500/10 text-blue-600 dark:text-blue-400"};return o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:n}),o.jsx("p",{className:`text-3xl font-bold ${l[r]||""}`,children:a})]})}function A2(){return o.jsx(n_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(Pj,{children:o.jsx(Gj,{children:o.jsxs(Hj,{children:[o.jsx(E2,{}),o.jsx(Qj,{})]})})})})}dx.createRoot(document.getElementById("root")).render(o.jsx(hy.StrictMode,{children:o.jsx(A2,{})}));