@realtimex/email-automator 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
function ax(s,a){for(var r=0;r<a.length;r++){const l=a[r];if(typeof l!="string"&&!Array.isArray(l)){for(const c in l)if(c!=="default"&&!(c in s)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(s,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();function af(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ud={exports:{}},Ri={};var cg;function sx(){if(cg)return Ri;cg=1;var s=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(l,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:s,type:l,key:h,ref:c!==void 0?c:null,props:d}}return Ri.Fragment=a,Ri.jsx=r,Ri.jsxs=r,Ri}var ug;function nx(){return ug||(ug=1,ud.exports=sx()),ud.exports}var o=nx(),dd={exports:{}},ve={};var dg;function rx(){if(dg)return ve;dg=1;var s=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),x=Symbol.iterator;function S(T){return T===null||typeof T!="object"?null:(T=x&&T[x]||T["@@iterator"],typeof T=="function"?T:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,O={};function R(T,V,Y){this.props=T,this.context=V,this.refs=O,this.updater=Y||A}R.prototype.isReactComponent={},R.prototype.setState=function(T,V){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,V,"setState")},R.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function q(){}q.prototype=R.prototype;function B(T,V,Y){this.props=T,this.context=V,this.refs=O,this.updater=Y||A}var G=B.prototype=new q;G.constructor=B,j(G,R.prototype),G.isPureReactComponent=!0;var ee=Array.isArray;function J(){}var P={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ue(T,V,Y){var W=Y.ref;return{$$typeof:s,type:T,key:V,ref:W!==void 0?W:null,props:Y}}function Je(T,V){return ue(T.type,V,T.props)}function be(T){return typeof T=="object"&&T!==null&&T.$$typeof===s}function ge(T){var V={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(Y){return V[Y]})}var Ze=/\/+/g;function st(T,V){return typeof T=="object"&&T!==null&&T.key!=null?ge(""+T.key):V.toString(36)}function F(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(J,J):(T.status="pending",T.then(function(V){T.status==="pending"&&(T.status="fulfilled",T.value=V)},function(V){T.status==="pending"&&(T.status="rejected",T.reason=V)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function U(T,V,Y,W,fe){var ye=typeof T;(ye==="undefined"||ye==="boolean")&&(T=null);var de=!1;if(T===null)de=!0;else switch(ye){case"bigint":case"string":case"number":de=!0;break;case"object":switch(T.$$typeof){case s:case a:de=!0;break;case v:return de=T._init,U(de(T._payload),V,Y,W,fe)}}if(de)return fe=fe(T),de=W===""?"."+st(T,0):W,ee(fe)?(Y="",de!=null&&(Y=de.replace(Ze,"$&/")+"/"),U(fe,V,Y,"",function(Ct){return Ct})):fe!=null&&(be(fe)&&(fe=Je(fe,Y+(fe.key==null||T&&T.key===fe.key?"":(""+fe.key).replace(Ze,"$&/")+"/")+de)),V.push(fe)),1;de=0;var Ge=W===""?".":W+":";if(ee(T))for(var Ue=0;Ue<T.length;Ue++)W=T[Ue],ye=Ge+st(W,Ue),de+=U(W,V,Y,ye,fe);else if(Ue=S(T),typeof Ue=="function")for(T=Ue.call(T),Ue=0;!(W=T.next()).done;)W=W.value,ye=Ge+st(W,Ue++),de+=U(W,V,Y,ye,fe);else if(ye==="object"){if(typeof T.then=="function")return U(F(T),V,Y,W,fe);throw V=String(T),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return de}function Q(T,V,Y){if(T==null)return T;var W=[],fe=0;return U(T,W,"","",function(ye){return V.call(Y,ye,fe++)}),W}function K(T){if(T._status===-1){var V=T._result;V=V(),V.then(function(Y){(T._status===0||T._status===-1)&&(T._status=1,T._result=Y)},function(Y){(T._status===0||T._status===-1)&&(T._status=2,T._result=Y)}),T._status===-1&&(T._status=0,T._result=V)}if(T._status===1)return T._result.default;throw T._result}var je=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},Re={map:Q,forEach:function(T,V,Y){Q(T,function(){V.apply(this,arguments)},Y)},count:function(T){var V=0;return Q(T,function(){V++}),V},toArray:function(T){return Q(T,function(V){return V})||[]},only:function(T){if(!be(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return ve.Activity=_,ve.Children=Re,ve.Component=R,ve.Fragment=r,ve.Profiler=c,ve.PureComponent=B,ve.StrictMode=l,ve.Suspense=p,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,ve.__COMPILER_RUNTIME={__proto__:null,c:function(T){return P.H.useMemoCache(T)}},ve.cache=function(T){return function(){return T.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(T,V,Y){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var W=j({},T.props),fe=T.key;if(V!=null)for(ye in V.key!==void 0&&(fe=""+V.key),V)!X.call(V,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&V.ref===void 0||(W[ye]=V[ye]);var ye=arguments.length-2;if(ye===1)W.children=Y;else if(1<ye){for(var de=Array(ye),Ge=0;Ge<ye;Ge++)de[Ge]=arguments[Ge+2];W.children=de}return ue(T.type,fe,W)},ve.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:d,_context:T},T},ve.createElement=function(T,V,Y){var W,fe={},ye=null;if(V!=null)for(W in V.key!==void 0&&(ye=""+V.key),V)X.call(V,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(fe[W]=V[W]);var de=arguments.length-2;if(de===1)fe.children=Y;else if(1<de){for(var Ge=Array(de),Ue=0;Ue<de;Ue++)Ge[Ue]=arguments[Ue+2];fe.children=Ge}if(T&&T.defaultProps)for(W in de=T.defaultProps,de)fe[W]===void 0&&(fe[W]=de[W]);return ue(T,ye,fe)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(T){return{$$typeof:m,render:T}},ve.isValidElement=be,ve.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:K}},ve.memo=function(T,V){return{$$typeof:g,type:T,compare:V===void 0?null:V}},ve.startTransition=function(T){var V=P.T,Y={};P.T=Y;try{var W=T(),fe=P.S;fe!==null&&fe(Y,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(J,je)}catch(ye){je(ye)}finally{V!==null&&Y.types!==null&&(V.types=Y.types),P.T=V}},ve.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},ve.use=function(T){return P.H.use(T)},ve.useActionState=function(T,V,Y){return P.H.useActionState(T,V,Y)},ve.useCallback=function(T,V){return P.H.useCallback(T,V)},ve.useContext=function(T){return P.H.useContext(T)},ve.useDebugValue=function(){},ve.useDeferredValue=function(T,V){return P.H.useDeferredValue(T,V)},ve.useEffect=function(T,V){return P.H.useEffect(T,V)},ve.useEffectEvent=function(T){return P.H.useEffectEvent(T)},ve.useId=function(){return P.H.useId()},ve.useImperativeHandle=function(T,V,Y){return P.H.useImperativeHandle(T,V,Y)},ve.useInsertionEffect=function(T,V){return P.H.useInsertionEffect(T,V)},ve.useLayoutEffect=function(T,V){return P.H.useLayoutEffect(T,V)},ve.useMemo=function(T,V){return P.H.useMemo(T,V)},ve.useOptimistic=function(T,V){return P.H.useOptimistic(T,V)},ve.useReducer=function(T,V,Y){return P.H.useReducer(T,V,Y)},ve.useRef=function(T){return P.H.useRef(T)},ve.useState=function(T){return P.H.useState(T)},ve.useSyncExternalStore=function(T,V,Y){return P.H.useSyncExternalStore(T,V,Y)},ve.useTransition=function(){return P.H.useTransition()},ve.version="19.2.3",ve}var fg;function sf(){return fg||(fg=1,dd.exports=rx()),dd.exports}var w=sf();const my=af(w),nf=ax({__proto__:null,default:my},[w]);var fd={exports:{}},Di={},hd={exports:{}},md={};var hg;function ix(){return hg||(hg=1,(function(s){function a(U,Q){var K=U.length;U.push(Q);e:for(;0<K;){var je=K-1>>>1,Re=U[je];if(0<c(Re,Q))U[je]=Q,U[K]=Re,K=je;else break e}}function r(U){return U.length===0?null:U[0]}function l(U){if(U.length===0)return null;var Q=U[0],K=U.pop();if(K!==Q){U[0]=K;e:for(var je=0,Re=U.length,T=Re>>>1;je<T;){var V=2*(je+1)-1,Y=U[V],W=V+1,fe=U[W];if(0>c(Y,K))W<Re&&0>c(fe,Y)?(U[je]=fe,U[W]=K,je=W):(U[je]=Y,U[V]=K,je=V);else if(W<Re&&0>c(fe,K))U[je]=fe,U[W]=K,je=W;else break e}}return Q}function c(U,Q){var K=U.sortIndex-Q.sortIndex;return K!==0?K:U.id-Q.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;s.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();s.unstable_now=function(){return h.now()-m}}var p=[],g=[],v=1,_=null,x=3,S=!1,A=!1,j=!1,O=!1,R=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function G(U){for(var Q=r(g);Q!==null;){if(Q.callback===null)l(g);else if(Q.startTime<=U)l(g),Q.sortIndex=Q.expirationTime,a(p,Q);else break;Q=r(g)}}function ee(U){if(j=!1,G(U),!A)if(r(p)!==null)A=!0,J||(J=!0,ge());else{var Q=r(g);Q!==null&&F(ee,Q.startTime-U)}}var J=!1,P=-1,X=5,ue=-1;function Je(){return O?!0:!(s.unstable_now()-ue<X)}function be(){if(O=!1,J){var U=s.unstable_now();ue=U;var Q=!0;try{e:{A=!1,j&&(j=!1,q(P),P=-1),S=!0;var K=x;try{t:{for(G(U),_=r(p);_!==null&&!(_.expirationTime>U&&Je());){var je=_.callback;if(typeof je=="function"){_.callback=null,x=_.priorityLevel;var Re=je(_.expirationTime<=U);if(U=s.unstable_now(),typeof Re=="function"){_.callback=Re,G(U),Q=!0;break t}_===r(p)&&l(p),G(U)}else l(p);_=r(p)}if(_!==null)Q=!0;else{var T=r(g);T!==null&&F(ee,T.startTime-U),Q=!1}}break e}finally{_=null,x=K,S=!1}Q=void 0}}finally{Q?ge():J=!1}}}var ge;if(typeof B=="function")ge=function(){B(be)};else if(typeof MessageChannel<"u"){var Ze=new MessageChannel,st=Ze.port2;Ze.port1.onmessage=be,ge=function(){st.postMessage(null)}}else ge=function(){R(be,0)};function F(U,Q){P=R(function(){U(s.unstable_now())},Q)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(U){U.callback=null},s.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<U?Math.floor(1e3/U):5},s.unstable_getCurrentPriorityLevel=function(){return x},s.unstable_next=function(U){switch(x){case 1:case 2:case 3:var Q=3;break;default:Q=x}var K=x;x=Q;try{return U()}finally{x=K}},s.unstable_requestPaint=function(){O=!0},s.unstable_runWithPriority=function(U,Q){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var K=x;x=U;try{return Q()}finally{x=K}},s.unstable_scheduleCallback=function(U,Q,K){var je=s.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?je+K:je):K=je,U){case 1:var Re=-1;break;case 2:Re=250;break;case 5:Re=1073741823;break;case 4:Re=1e4;break;default:Re=5e3}return Re=K+Re,U={id:v++,callback:Q,priorityLevel:U,startTime:K,expirationTime:Re,sortIndex:-1},K>je?(U.sortIndex=K,a(g,U),r(p)===null&&U===r(g)&&(j?(q(P),P=-1):j=!0,F(ee,K-je))):(U.sortIndex=Re,a(p,U),A||S||(A=!0,J||(J=!0,ge()))),U},s.unstable_shouldYield=Je,s.unstable_wrapCallback=function(U){var Q=x;return function(){var K=x;x=Q;try{return U.apply(this,arguments)}finally{x=K}}}})(md)),md}var mg;function lx(){return mg||(mg=1,hd.exports=ix()),hd.exports}var pd={exports:{}},kt={};var pg;function ox(){if(pg)return kt;pg=1;var s=sf();function a(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)g+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(a(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(p,g,v){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:_==null?null:""+_,children:p,containerInfo:g,implementation:v}}var h=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,kt.createPortal=function(p,g){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(a(299));return d(p,g,null,v)},kt.flushSync=function(p){var g=h.T,v=l.p;try{if(h.T=null,l.p=2,p)return p()}finally{h.T=g,l.p=v,l.d.f()}},kt.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,l.d.C(p,g))},kt.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},kt.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var v=g.as,_=m(v,g.crossOrigin),x=typeof g.integrity=="string"?g.integrity:void 0,S=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;v==="style"?l.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:_,integrity:x,fetchPriority:S}):v==="script"&&l.d.X(p,{crossOrigin:_,integrity:x,fetchPriority:S,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},kt.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var v=m(g.as,g.crossOrigin);l.d.M(p,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&l.d.M(p)},kt.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var v=g.as,_=m(v,g.crossOrigin);l.d.L(p,v,{crossOrigin:_,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},kt.preloadModule=function(p,g){if(typeof p=="string")if(g){var v=m(g.as,g.crossOrigin);l.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else l.d.m(p)},kt.requestFormReset=function(p){l.d.r(p)},kt.unstable_batchedUpdates=function(p,g){return p(g)},kt.useFormState=function(p,g,v){return h.H.useFormState(p,g,v)},kt.useFormStatus=function(){return h.H.useHostTransitionStatus()},kt.version="19.2.3",kt}var gg;function py(){if(gg)return pd.exports;gg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),pd.exports=ox(),pd.exports}var yg;function cx(){if(yg)return Di;yg=1;var s=lx(),a=sf(),r=py();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(d(e)!==e)throw Error(l(188))}function g(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var n=e,i=t;;){var u=n.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){n=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===n)return p(u),e;if(f===i)return p(u),t;f=f.sibling}throw Error(l(188))}if(n.return!==i.return)n=u,i=f;else{for(var y=!1,b=u.child;b;){if(b===n){y=!0,n=u,i=f;break}if(b===i){y=!0,i=u,n=f;break}b=b.sibling}if(!y){for(b=f.child;b;){if(b===n){y=!0,n=f,i=u;break}if(b===i){y=!0,i=f,n=u;break}b=b.sibling}if(!y)throw Error(l(189))}}if(n.alternate!==i)throw Error(l(190))}if(n.tag!==3)throw Error(l(188));return n.stateNode.current===n?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var _=Object.assign,x=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),B=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ue=Symbol.for("react.activity"),Je=Symbol.for("react.memo_cache_sentinel"),be=Symbol.iterator;function ge(e){return e===null||typeof e!="object"?null:(e=be&&e[be]||e["@@iterator"],typeof e=="function"?e:null)}var Ze=Symbol.for("react.client.reference");function st(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ze?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case R:return"Profiler";case O:return"StrictMode";case ee:return"Suspense";case J:return"SuspenseList";case ue:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case B:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return t=e.displayName||null,t!==null?t:st(e.type)||"Memo";case X:t=e._payload,e=e._init;try{return st(e(t))}catch{}}return null}var F=Array.isArray,U=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},je=[],Re=-1;function T(e){return{current:e}}function V(e){0>Re||(e.current=je[Re],je[Re]=null,Re--)}function Y(e,t){Re++,je[Re]=e.current,e.current=t}var W=T(null),fe=T(null),ye=T(null),de=T(null);function Ge(e,t){switch(Y(ye,t),Y(fe,e),Y(W,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Rp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Rp(t),e=Dp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(W),Y(W,e)}function Ue(){V(W),V(fe),V(ye)}function Ct(e){e.memoizedState!==null&&Y(de,e);var t=W.current,n=Dp(t,e.type);t!==n&&(Y(fe,e),Y(W,n))}function pt(e){fe.current===e&&(V(W),V(fe)),de.current===e&&(V(de),Ai._currentValue=K)}var xt,ss;function la(e){if(xt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);xt=t&&t[1]||"",ss=-1<n.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+xt+e+ss}var ns=!1;function vn(e,t){if(!e||ns)return"";ns=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(L){var z=L}Reflect.construct(e,[],I)}else{try{I.call()}catch(L){z=L}e.call(I.prototype)}}else{try{throw Error()}catch(L){z=L}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(L){if(L&&z&&typeof L.stack=="string")return[L.stack,z.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=i.DetermineComponentFrameRoot(),y=f[0],b=f[1];if(y&&b){var N=y.split(`
|
|
4
|
-
`),M=b.split(`
|
|
5
|
-
`);for(u=i=0;i<N.length&&!N[i].includes("DetermineComponentFrameRoot");)i++;for(;u<M.length&&!M[u].includes("DetermineComponentFrameRoot");)u++;if(i===N.length||u===M.length)for(i=N.length-1,u=M.length-1;1<=i&&0<=u&&N[i]!==M[u];)u--;for(;1<=i&&0<=u;i--,u--)if(N[i]!==M[u]){if(i!==1||u!==1)do if(i--,u--,0>u||N[i]!==M[u]){var $=`
|
|
6
|
-
`+N[i].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=i&&0<=u);break}}}finally{ns=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?la(n):""}function bn(e,t){switch(e.tag){case 26:case 27:case 5:return la(e.type);case 16:return la("Lazy");case 13:return e.child!==t&&t!==null?la("Suspense Fallback"):la("Suspense");case 19:return la("SuspenseList");case 0:case 15:return vn(e.type,!1);case 11:return vn(e.type.render,!1);case 1:return vn(e.type,!0);case 31:return la("Activity");default:return""}}function qr(e){try{var t="",n=null;do t+=bn(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
|
|
7
|
-
Error generating stack: `+i.message+`
|
|
8
|
-
`+i.stack}}var rs=Object.prototype.hasOwnProperty,xn=s.unstable_scheduleCallback,is=s.unstable_cancelCallback,al=s.unstable_shouldYield,Ls=s.unstable_requestPaint,gt=s.unstable_now,sl=s.unstable_getCurrentPriorityLevel,$r=s.unstable_ImmediatePriority,Hr=s.unstable_UserBlockingPriority,Ra=s.unstable_NormalPriority,wn=s.unstable_LowPriority,ga=s.unstable_IdlePriority,_n=s.log,Xo=s.unstable_setDisableYieldValue,Bs=null,wt=null;function ya(e){if(typeof _n=="function"&&Xo(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(Bs,e)}catch{}}var Ot=Math.clz32?Math.clz32:Fo,Qo=Math.log,Zo=Math.LN2;function Fo(e){return e>>>=0,e===0?32:31-(Qo(e)/Zo|0)|0}var Sn=256,jn=262144,Nn=4194304;function Da(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function En(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~f,i!==0?u=Da(i):(y&=b,y!==0?u=Da(y):n||(n=b&~e,n!==0&&(u=Da(n))))):(b=i&~f,b!==0?u=Da(b):y!==0?u=Da(y):n||(n=i&~e,n!==0&&(u=Da(n)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,n=t&-t,f>=n||f===32&&(n&4194048)!==0)?t:u}function ls(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Wo(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 nl(){var e=Nn;return Nn<<=1,(Nn&62914560)===0&&(Nn=4194304),e}function Vr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qs(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ec(e,t,n,i,u,f){var y=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var b=e.entanglements,N=e.expirationTimes,M=e.hiddenUpdates;for(n=y&~n;0<n;){var $=31-Ot(n),I=1<<$;b[$]=0,N[$]=-1;var z=M[$];if(z!==null)for(M[$]=null,$=0;$<z.length;$++){var L=z[$];L!==null&&(L.lane&=-536870913)}n&=~I}i!==0&&k(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function k(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ot(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function te(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Ot(n),u=1<<i;u&t|e[i]&t&&(e[i]|=t),n&=~u}}function Ce(e,t){var n=t&-t;return n=(n&42)!==0?1:yt(n),(n&(e.suspendedLanes|t))!==0?0:n}function yt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $s(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Hs(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:ag(e.type))}function Vs(e,t){var n=Q.p;try{return Q.p=e,t()}finally{Q.p=n}}var va=Math.random().toString(36).slice(2),ut="__reactFiber$"+va,Dt="__reactProps$"+va,Tn="__reactContainer$"+va,tc="__reactEvents$"+va,Pv="__reactListeners$"+va,Kv="__reactHandles$"+va,bf="__reactResources$"+va,Ir="__reactMarker$"+va;function ac(e){delete e[ut],delete e[Dt],delete e[tc],delete e[Pv],delete e[Kv]}function An(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Tn]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=$p(e);e!==null;){if(n=e[ut])return n;e=$p(e)}return t}e=n,n=e.parentNode}return null}function Cn(e){if(e=e[ut]||e[Tn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function kn(e){var t=e[bf];return t||(t=e[bf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function vt(e){e[Ir]=!0}var xf=new Set,wf={};function Is(e,t){On(e,t),On(e+"Capture",t)}function On(e,t){for(wf[e]=t,e=0;e<t.length;e++)xf.add(t[e])}var Yv=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),_f={},Sf={};function Jv(e){return rs.call(Sf,e)?!0:rs.call(_f,e)?!1:Yv.test(e)?Sf[e]=!0:(_f[e]=!0,!1)}function rl(e,t,n){if(Jv(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function il(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Ma(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+i)}}function Zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xv(e,t,n){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(y){n=""+y,f.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(y){n=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function sc(e){if(!e._valueTracker){var t=jf(e)?"checked":"value";e._valueTracker=Xv(e,t,""+e[t])}}function Nf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=jf(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function ll(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Qv=/[\n"\\]/g;function Ft(e){return e.replace(Qv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function nc(e,t,n,i,u,f,y,b){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?rc(e,y,Zt(t)):n!=null?rc(e,y,Zt(n)):i!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Zt(b):e.removeAttribute("name")}function Ef(e,t,n,i,u,f,y,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||n!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){sc(e);return}n=n!=null?""+Zt(n):"",t=t!=null?""+Zt(t):n,b||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=b?e.checked:!!i,e.defaultChecked=!!i,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),sc(e)}function rc(e,t,n){t==="number"&&ll(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Rn(e,t,n,i){if(e=e.options,t){t={};for(var u=0;u<n.length;u++)t["$"+n[u]]=!0;for(n=0;n<e.length;n++)u=t.hasOwnProperty("$"+e[n].value),e[n].selected!==u&&(e[n].selected=u),u&&i&&(e[n].defaultSelected=!0)}else{for(n=""+Zt(n),t=null,u=0;u<e.length;u++){if(e[u].value===n){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Tf(e,t,n){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Zt(n):""}function Af(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(l(92));if(F(i)){if(1<i.length)throw Error(l(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=Zt(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),sc(e)}function Dn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Zv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Cf(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!="number"||n===0||Zv.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function kf(e,t,n){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&n[u]!==i&&Cf(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&Cf(e,f,t[f])}function ic(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Fv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Wv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ol(e){return Wv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function za(){}var lc=null;function oc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mn=null,zn=null;function Of(e){var t=Cn(e);if(t&&(e=t.stateNode)){var n=e[Dt]||null;e:switch(e=t.stateNode,t.type){case"input":if(nc(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ft(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var u=i[Dt]||null;if(!u)throw Error(l(90));nc(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&Nf(i)}break e;case"textarea":Tf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Rn(e,!!n.multiple,t,!1)}}}var cc=!1;function Rf(e,t,n){if(cc)return e(t,n);cc=!0;try{var i=e(t);return i}finally{if(cc=!1,(Mn!==null||zn!==null)&&(Xl(),Mn&&(t=Mn,e=zn,zn=Mn=null,Of(t),e)))for(t=0;t<e.length;t++)Of(e[t])}}function Pr(e,t){var n=e.stateNode;if(n===null)return null;var i=n[Dt]||null;if(i===null)return null;n=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(l(231,t,typeof n));return n}var Ua=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uc=!1;if(Ua)try{var Kr={};Object.defineProperty(Kr,"passive",{get:function(){uc=!0}}),window.addEventListener("test",Kr,Kr),window.removeEventListener("test",Kr,Kr)}catch{uc=!1}var os=null,dc=null,cl=null;function Df(){if(cl)return cl;var e,t=dc,n=t.length,i,u="value"in os?os.value:os.textContent,f=u.length;for(e=0;e<n&&t[e]===u[e];e++);var y=n-e;for(i=1;i<=y&&t[n-i]===u[f-i];i++);return cl=u.slice(e,1<i?1-i:void 0)}function ul(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 dl(){return!0}function Mf(){return!1}function Mt(e){function t(n,i,u,f,y){this._reactName=n,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(n=e[b],this[b]=n?n(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?dl:Mf,this.isPropagationStopped=Mf,this}return _(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=dl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=dl)},persist:function(){},isPersistent:dl}),t}var Gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fl=Mt(Gs),Yr=_({},Gs,{view:0,detail:0}),e0=Mt(Yr),fc,hc,Jr,hl=_({},Yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Jr&&(Jr&&e.type==="mousemove"?(fc=e.screenX-Jr.screenX,hc=e.screenY-Jr.screenY):hc=fc=0,Jr=e),fc)},movementY:function(e){return"movementY"in e?e.movementY:hc}}),zf=Mt(hl),t0=_({},hl,{dataTransfer:0}),a0=Mt(t0),s0=_({},Yr,{relatedTarget:0}),mc=Mt(s0),n0=_({},Gs,{animationName:0,elapsedTime:0,pseudoElement:0}),r0=Mt(n0),i0=_({},Gs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),l0=Mt(i0),o0=_({},Gs,{data:0}),Uf=Mt(o0),c0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},u0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},d0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function f0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=d0[e])?!!t[e]:!1}function pc(){return f0}var h0=_({},Yr,{key:function(e){if(e.key){var t=c0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ul(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?u0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pc,charCode:function(e){return e.type==="keypress"?ul(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ul(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),m0=Mt(h0),p0=_({},hl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lf=Mt(p0),g0=_({},Yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pc}),y0=Mt(g0),v0=_({},Gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),b0=Mt(v0),x0=_({},hl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),w0=Mt(x0),_0=_({},Gs,{newState:0,oldState:0}),S0=Mt(_0),j0=[9,13,27,32],gc=Ua&&"CompositionEvent"in window,Xr=null;Ua&&"documentMode"in document&&(Xr=document.documentMode);var N0=Ua&&"TextEvent"in window&&!Xr,Bf=Ua&&(!gc||Xr&&8<Xr&&11>=Xr),qf=" ",$f=!1;function Hf(e,t){switch(e){case"keyup":return j0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Un=!1;function E0(e,t){switch(e){case"compositionend":return Vf(t);case"keypress":return t.which!==32?null:($f=!0,qf);case"textInput":return e=t.data,e===qf&&$f?null:e;default:return null}}function T0(e,t){if(Un)return e==="compositionend"||!gc&&Hf(e,t)?(e=Df(),cl=dc=os=null,Un=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Bf&&t.locale!=="ko"?null:t.data;default:return null}}var A0={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function If(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!A0[e.type]:t==="textarea"}function Gf(e,t,n,i){Mn?zn?zn.push(i):zn=[i]:Mn=i,t=ao(t,"onChange"),0<t.length&&(n=new fl("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var Qr=null,Zr=null;function C0(e){Ep(e,0)}function ml(e){var t=Gr(e);if(Nf(t))return e}function Pf(e,t){if(e==="change")return t}var Kf=!1;if(Ua){var yc;if(Ua){var vc="oninput"in document;if(!vc){var Yf=document.createElement("div");Yf.setAttribute("oninput","return;"),vc=typeof Yf.oninput=="function"}yc=vc}else yc=!1;Kf=yc&&(!document.documentMode||9<document.documentMode)}function Jf(){Qr&&(Qr.detachEvent("onpropertychange",Xf),Zr=Qr=null)}function Xf(e){if(e.propertyName==="value"&&ml(Zr)){var t=[];Gf(t,Zr,e,oc(e)),Rf(C0,t)}}function k0(e,t,n){e==="focusin"?(Jf(),Qr=t,Zr=n,Qr.attachEvent("onpropertychange",Xf)):e==="focusout"&&Jf()}function O0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ml(Zr)}function R0(e,t){if(e==="click")return ml(t)}function D0(e,t){if(e==="input"||e==="change")return ml(t)}function M0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ht=typeof Object.is=="function"?Object.is:M0;function Fr(e,t){if(Ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var u=n[i];if(!rs.call(t,u)||!Ht(e[u],t[u]))return!1}return!0}function Qf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zf(e,t){var n=Qf(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Qf(n)}}function Ff(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ff(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ll(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ll(e.document)}return t}function bc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var z0=Ua&&"documentMode"in document&&11>=document.documentMode,Ln=null,xc=null,Wr=null,wc=!1;function eh(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wc||Ln==null||Ln!==ll(i)||(i=Ln,"selectionStart"in i&&bc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Wr&&Fr(Wr,i)||(Wr=i,i=ao(xc,"onSelect"),0<i.length&&(t=new fl("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=Ln)))}function Ps(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Bn={animationend:Ps("Animation","AnimationEnd"),animationiteration:Ps("Animation","AnimationIteration"),animationstart:Ps("Animation","AnimationStart"),transitionrun:Ps("Transition","TransitionRun"),transitionstart:Ps("Transition","TransitionStart"),transitioncancel:Ps("Transition","TransitionCancel"),transitionend:Ps("Transition","TransitionEnd")},_c={},th={};Ua&&(th=document.createElement("div").style,"AnimationEvent"in window||(delete Bn.animationend.animation,delete Bn.animationiteration.animation,delete Bn.animationstart.animation),"TransitionEvent"in window||delete Bn.transitionend.transition);function Ks(e){if(_c[e])return _c[e];if(!Bn[e])return e;var t=Bn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in th)return _c[e]=t[n];return e}var ah=Ks("animationend"),sh=Ks("animationiteration"),nh=Ks("animationstart"),U0=Ks("transitionrun"),L0=Ks("transitionstart"),B0=Ks("transitioncancel"),rh=Ks("transitionend"),ih=new Map,Sc="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(" ");Sc.push("scrollEnd");function oa(e,t){ih.set(e,t),Is(t,[e])}var pl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Wt=[],qn=0,jc=0;function gl(){for(var e=qn,t=jc=qn=0;t<e;){var n=Wt[t];Wt[t++]=null;var i=Wt[t];Wt[t++]=null;var u=Wt[t];Wt[t++]=null;var f=Wt[t];if(Wt[t++]=null,i!==null&&u!==null){var y=i.pending;y===null?u.next=u:(u.next=y.next,y.next=u),i.pending=u}f!==0&&lh(n,u,f)}}function yl(e,t,n,i){Wt[qn++]=e,Wt[qn++]=t,Wt[qn++]=n,Wt[qn++]=i,jc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Nc(e,t,n,i){return yl(e,t,n,i),vl(e)}function Ys(e,t){return yl(e,null,null,t),vl(e)}function lh(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var u=!1,f=e.return;f!==null;)f.childLanes|=n,i=f.alternate,i!==null&&(i.childLanes|=n),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-Ot(n),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=n|536870912),f):null}function vl(e){if(50<wi)throw wi=0,Mu=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $n={};function q0(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,n,i){return new q0(e,t,n,i)}function Ec(e){return e=e.prototype,!(!e||!e.isReactComponent)}function La(e,t){var n=e.alternate;return n===null?(n=Vt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function oh(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function bl(e,t,n,i,u,f){var y=0;if(i=e,typeof e=="function")Ec(e)&&(y=1);else if(typeof e=="string")y=Gb(e,n,W.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ue:return e=Vt(31,n,t,u),e.elementType=ue,e.lanes=f,e;case j:return Js(n.children,u,f,t);case O:y=8,u|=24;break;case R:return e=Vt(12,n,t,u|2),e.elementType=R,e.lanes=f,e;case ee:return e=Vt(13,n,t,u),e.elementType=ee,e.lanes=f,e;case J:return e=Vt(19,n,t,u),e.elementType=J,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:y=10;break e;case q:y=9;break e;case G:y=11;break e;case P:y=14;break e;case X:y=16,i=null;break e}y=29,n=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=Vt(y,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Js(e,t,n,i){return e=Vt(7,e,i,t),e.lanes=n,e}function Tc(e,t,n){return e=Vt(6,e,null,t),e.lanes=n,e}function ch(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Ac(e,t,n){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var uh=new WeakMap;function ea(e,t){if(typeof e=="object"&&e!==null){var n=uh.get(e);return n!==void 0?n:(t={value:e,source:t,stack:qr(t)},uh.set(e,t),t)}return{value:e,source:t,stack:qr(t)}}var Hn=[],Vn=0,xl=null,ei=0,ta=[],aa=0,cs=null,ba=1,xa="";function Ba(e,t){Hn[Vn++]=ei,Hn[Vn++]=xl,xl=e,ei=t}function dh(e,t,n){ta[aa++]=ba,ta[aa++]=xa,ta[aa++]=cs,cs=e;var i=ba;e=xa;var u=32-Ot(i)-1;i&=~(1<<u),n+=1;var f=32-Ot(t)+u;if(30<f){var y=u-u%5;f=(i&(1<<y)-1).toString(32),i>>=y,u-=y,ba=1<<32-Ot(t)+u|n<<u|i,xa=f+e}else ba=1<<f|n<<u|i,xa=e}function Cc(e){e.return!==null&&(Ba(e,1),dh(e,1,0))}function kc(e){for(;e===xl;)xl=Hn[--Vn],Hn[Vn]=null,ei=Hn[--Vn],Hn[Vn]=null;for(;e===cs;)cs=ta[--aa],ta[aa]=null,xa=ta[--aa],ta[aa]=null,ba=ta[--aa],ta[aa]=null}function fh(e,t){ta[aa++]=ba,ta[aa++]=xa,ta[aa++]=cs,ba=t.id,xa=t.overflow,cs=e}var _t=null,Ke=null,ke=!1,us=null,sa=!1,Oc=Error(l(519));function ds(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ti(ea(t,e)),Oc}function hh(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[ut]=e,t[Dt]=i,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<Si.length;n++)Ee(Si[n],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),Ef(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),Af(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||kp(t.textContent,n)?(i.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),i.onScroll!=null&&Ee("scroll",t),i.onScrollEnd!=null&&Ee("scrollend",t),i.onClick!=null&&(t.onclick=za),t=!0):t=!1,t||ds(e,!0)}function mh(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:_t=_t.return}}function In(e){if(e!==_t)return!1;if(!ke)return mh(e),ke=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Xu(e.type,e.memoizedProps)),n=!n),n&&Ke&&ds(e),mh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=qp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=qp(e)}else t===27?(t=Ke,Ns(e.type)?(e=ed,ed=null,Ke=e):Ke=t):Ke=_t?ra(e.stateNode.nextSibling):null;return!0}function Xs(){Ke=_t=null,ke=!1}function Rc(){var e=us;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),us=null),e}function ti(e){us===null?us=[e]:us.push(e)}var Dc=T(null),Qs=null,qa=null;function fs(e,t,n){Y(Dc,t._currentValue),t._currentValue=n}function $a(e){e._currentValue=Dc.current,V(Dc)}function Mc(e,t,n){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function zc(e,t,n,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var b=f;f=u;for(var N=0;N<t.length;N++)if(b.context===t[N]){f.lanes|=n,b=f.alternate,b!==null&&(b.lanes|=n),Mc(f.return,n,e),i||(y=null);break e}f=b.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(l(341));y.lanes|=n,f=y.alternate,f!==null&&(f.lanes|=n),Mc(y,n,e),y=null}else y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===e){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function Gn(e,t,n,i){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(l(387));if(y=y.memoizedProps,y!==null){var b=u.type;Ht(u.pendingProps.value,y.value)||(e!==null?e.push(b):e=[b])}}else if(u===de.current){if(y=u.alternate,y===null)throw Error(l(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Ai):e=[Ai])}u=u.return}e!==null&&zc(t,e,n,i),t.flags|=262144}function wl(e){for(e=e.firstContext;e!==null;){if(!Ht(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Zs(e){Qs=e,qa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ph(Qs,e)}function _l(e,t){return Qs===null&&Zs(e),ph(e,t)}function ph(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qa===null){if(e===null)throw Error(l(308));qa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qa=qa.next=t;return n}var $0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},H0=s.unstable_scheduleCallback,V0=s.unstable_NormalPriority,nt={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uc(){return{controller:new $0,data:new Map,refCount:0}}function ai(e){e.refCount--,e.refCount===0&&H0(V0,function(){e.controller.abort()})}var si=null,Lc=0,Pn=0,Kn=null;function I0(e,t){if(si===null){var n=si=[];Lc=0,Pn=$u(),Kn={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Lc++,t.then(gh,gh),t}function gh(){if(--Lc===0&&si!==null){Kn!==null&&(Kn.status="fulfilled");var e=si;si=null,Pn=0,Kn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function G0(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(u){n.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<n.length;u++)(0,n[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<n.length;u++)(0,n[u])(void 0)}),i}var yh=U.S;U.S=function(e,t){ep=gt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&I0(e,t),yh!==null&&yh(e,t)};var Fs=T(null);function Bc(){var e=Fs.current;return e!==null?e:Ie.pooledCache}function Sl(e,t){t===null?Y(Fs,Fs.current):Y(Fs,t.pool)}function vh(){var e=Bc();return e===null?null:{parent:nt._currentValue,pool:e}}var Yn=Error(l(460)),qc=Error(l(474)),jl=Error(l(542)),Nl={then:function(){}};function bh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xh(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(za,za),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_h(e),e;default:if(typeof t.status=="string")t.then(za,za);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_h(e),e}throw en=t,Yn}}function Ws(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(en=n,Yn):n}}var en=null;function wh(){if(en===null)throw Error(l(459));var e=en;return en=null,e}function _h(e){if(e===Yn||e===jl)throw Error(l(483))}var Jn=null,ni=0;function El(e){var t=ni;return ni+=1,Jn===null&&(Jn=[]),xh(Jn,e,t)}function ri(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Tl(e,t){throw t.$$typeof===x?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Sh(e){function t(C,E){if(e){var D=C.deletions;D===null?(C.deletions=[E],C.flags|=16):D.push(E)}}function n(C,E){if(!e)return null;for(;E!==null;)t(C,E),E=E.sibling;return null}function i(C){for(var E=new Map;C!==null;)C.key!==null?E.set(C.key,C):E.set(C.index,C),C=C.sibling;return E}function u(C,E){return C=La(C,E),C.index=0,C.sibling=null,C}function f(C,E,D){return C.index=D,e?(D=C.alternate,D!==null?(D=D.index,D<E?(C.flags|=67108866,E):D):(C.flags|=67108866,E)):(C.flags|=1048576,E)}function y(C){return e&&C.alternate===null&&(C.flags|=67108866),C}function b(C,E,D,H){return E===null||E.tag!==6?(E=Tc(D,C.mode,H),E.return=C,E):(E=u(E,D),E.return=C,E)}function N(C,E,D,H){var ce=D.type;return ce===j?$(C,E,D.props.children,H,D.key):E!==null&&(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===X&&Ws(ce)===E.type)?(E=u(E,D.props),ri(E,D),E.return=C,E):(E=bl(D.type,D.key,D.props,null,C.mode,H),ri(E,D),E.return=C,E)}function M(C,E,D,H){return E===null||E.tag!==4||E.stateNode.containerInfo!==D.containerInfo||E.stateNode.implementation!==D.implementation?(E=Ac(D,C.mode,H),E.return=C,E):(E=u(E,D.children||[]),E.return=C,E)}function $(C,E,D,H,ce){return E===null||E.tag!==7?(E=Js(D,C.mode,H,ce),E.return=C,E):(E=u(E,D),E.return=C,E)}function I(C,E,D){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=Tc(""+E,C.mode,D),E.return=C,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case S:return D=bl(E.type,E.key,E.props,null,C.mode,D),ri(D,E),D.return=C,D;case A:return E=Ac(E,C.mode,D),E.return=C,E;case X:return E=Ws(E),I(C,E,D)}if(F(E)||ge(E))return E=Js(E,C.mode,D,null),E.return=C,E;if(typeof E.then=="function")return I(C,El(E),D);if(E.$$typeof===B)return I(C,_l(C,E),D);Tl(C,E)}return null}function z(C,E,D,H){var ce=E!==null?E.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return ce!==null?null:b(C,E,""+D,H);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case S:return D.key===ce?N(C,E,D,H):null;case A:return D.key===ce?M(C,E,D,H):null;case X:return D=Ws(D),z(C,E,D,H)}if(F(D)||ge(D))return ce!==null?null:$(C,E,D,H,null);if(typeof D.then=="function")return z(C,E,El(D),H);if(D.$$typeof===B)return z(C,E,_l(C,D),H);Tl(C,D)}return null}function L(C,E,D,H,ce){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return C=C.get(D)||null,b(E,C,""+H,ce);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return C=C.get(H.key===null?D:H.key)||null,N(E,C,H,ce);case A:return C=C.get(H.key===null?D:H.key)||null,M(E,C,H,ce);case X:return H=Ws(H),L(C,E,D,H,ce)}if(F(H)||ge(H))return C=C.get(D)||null,$(E,C,H,ce,null);if(typeof H.then=="function")return L(C,E,D,El(H),ce);if(H.$$typeof===B)return L(C,E,D,_l(E,H),ce);Tl(E,H)}return null}function ae(C,E,D,H){for(var ce=null,De=null,le=E,we=E=0,Ae=null;le!==null&&we<D.length;we++){le.index>we?(Ae=le,le=null):Ae=le.sibling;var Me=z(C,le,D[we],H);if(Me===null){le===null&&(le=Ae);break}e&&le&&Me.alternate===null&&t(C,le),E=f(Me,E,we),De===null?ce=Me:De.sibling=Me,De=Me,le=Ae}if(we===D.length)return n(C,le),ke&&Ba(C,we),ce;if(le===null){for(;we<D.length;we++)le=I(C,D[we],H),le!==null&&(E=f(le,E,we),De===null?ce=le:De.sibling=le,De=le);return ke&&Ba(C,we),ce}for(le=i(le);we<D.length;we++)Ae=L(le,C,we,D[we],H),Ae!==null&&(e&&Ae.alternate!==null&&le.delete(Ae.key===null?we:Ae.key),E=f(Ae,E,we),De===null?ce=Ae:De.sibling=Ae,De=Ae);return e&&le.forEach(function(ks){return t(C,ks)}),ke&&Ba(C,we),ce}function he(C,E,D,H){if(D==null)throw Error(l(151));for(var ce=null,De=null,le=E,we=E=0,Ae=null,Me=D.next();le!==null&&!Me.done;we++,Me=D.next()){le.index>we?(Ae=le,le=null):Ae=le.sibling;var ks=z(C,le,Me.value,H);if(ks===null){le===null&&(le=Ae);break}e&&le&&ks.alternate===null&&t(C,le),E=f(ks,E,we),De===null?ce=ks:De.sibling=ks,De=ks,le=Ae}if(Me.done)return n(C,le),ke&&Ba(C,we),ce;if(le===null){for(;!Me.done;we++,Me=D.next())Me=I(C,Me.value,H),Me!==null&&(E=f(Me,E,we),De===null?ce=Me:De.sibling=Me,De=Me);return ke&&Ba(C,we),ce}for(le=i(le);!Me.done;we++,Me=D.next())Me=L(le,C,we,Me.value,H),Me!==null&&(e&&Me.alternate!==null&&le.delete(Me.key===null?we:Me.key),E=f(Me,E,we),De===null?ce=Me:De.sibling=Me,De=Me);return e&&le.forEach(function(tx){return t(C,tx)}),ke&&Ba(C,we),ce}function Ve(C,E,D,H){if(typeof D=="object"&&D!==null&&D.type===j&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case S:e:{for(var ce=D.key;E!==null;){if(E.key===ce){if(ce=D.type,ce===j){if(E.tag===7){n(C,E.sibling),H=u(E,D.props.children),H.return=C,C=H;break e}}else if(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===X&&Ws(ce)===E.type){n(C,E.sibling),H=u(E,D.props),ri(H,D),H.return=C,C=H;break e}n(C,E);break}else t(C,E);E=E.sibling}D.type===j?(H=Js(D.props.children,C.mode,H,D.key),H.return=C,C=H):(H=bl(D.type,D.key,D.props,null,C.mode,H),ri(H,D),H.return=C,C=H)}return y(C);case A:e:{for(ce=D.key;E!==null;){if(E.key===ce)if(E.tag===4&&E.stateNode.containerInfo===D.containerInfo&&E.stateNode.implementation===D.implementation){n(C,E.sibling),H=u(E,D.children||[]),H.return=C,C=H;break e}else{n(C,E);break}else t(C,E);E=E.sibling}H=Ac(D,C.mode,H),H.return=C,C=H}return y(C);case X:return D=Ws(D),Ve(C,E,D,H)}if(F(D))return ae(C,E,D,H);if(ge(D)){if(ce=ge(D),typeof ce!="function")throw Error(l(150));return D=ce.call(D),he(C,E,D,H)}if(typeof D.then=="function")return Ve(C,E,El(D),H);if(D.$$typeof===B)return Ve(C,E,_l(C,D),H);Tl(C,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,E!==null&&E.tag===6?(n(C,E.sibling),H=u(E,D),H.return=C,C=H):(n(C,E),H=Tc(D,C.mode,H),H.return=C,C=H),y(C)):n(C,E)}return function(C,E,D,H){try{ni=0;var ce=Ve(C,E,D,H);return Jn=null,ce}catch(le){if(le===Yn||le===jl)throw le;var De=Vt(29,le,null,C.mode);return De.lanes=H,De.return=C,De}}}var tn=Sh(!0),jh=Sh(!1),hs=!1;function $c(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ms(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ps(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(ze&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=vl(e),lh(e,null,n),t}return yl(e,i,t,n),vl(e)}function ii(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,te(e,n)}}function Vc(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var u=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var y={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,n=n.next}while(n!==null);f===null?u=f=t:f=f.next=t}else u=f=t;n={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ic=!1;function li(){if(Ic){var e=Kn;if(e!==null)throw e}}function oi(e,t,n,i){Ic=!1;var u=e.updateQueue;hs=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var N=b,M=N.next;N.next=null,y===null?f=M:y.next=M,y=N;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==y&&(b===null?$.firstBaseUpdate=M:b.next=M,$.lastBaseUpdate=N))}if(f!==null){var I=u.baseState;y=0,$=M=N=null,b=f;do{var z=b.lane&-536870913,L=z!==b.lane;if(L?(Te&z)===z:(i&z)===z){z!==0&&z===Pn&&(Ic=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ae=e,he=b;z=t;var Ve=n;switch(he.tag){case 1:if(ae=he.payload,typeof ae=="function"){I=ae.call(Ve,I,z);break e}I=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=he.payload,z=typeof ae=="function"?ae.call(Ve,I,z):ae,z==null)break e;I=_({},I,z);break e;case 2:hs=!0}}z=b.callback,z!==null&&(e.flags|=64,L&&(e.flags|=8192),L=u.callbacks,L===null?u.callbacks=[z]:L.push(z))}else L={lane:z,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(M=$=L,N=I):$=$.next=L,y|=z;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;L=b,b=L.next,L.next=null,u.lastBaseUpdate=L,u.shared.pending=null}}while(!0);$===null&&(N=I),u.baseState=N,u.firstBaseUpdate=M,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),xs|=y,e.lanes=y,e.memoizedState=I}}function Nh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Eh(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Nh(n[e],t)}var Xn=T(null),Al=T(0);function Th(e,t){e=Xa,Y(Al,e),Y(Xn,t),Xa=e|t.baseLanes}function Gc(){Y(Al,Xa),Y(Xn,Xn.current)}function Pc(){Xa=Al.current,V(Xn),V(Al)}var It=T(null),na=null;function gs(e){var t=e.alternate;Y(tt,tt.current&1),Y(It,e),na===null&&(t===null||Xn.current!==null||t.memoizedState!==null)&&(na=e)}function Kc(e){Y(tt,tt.current),Y(It,e),na===null&&(na=e)}function Ah(e){e.tag===22?(Y(tt,tt.current),Y(It,e),na===null&&(na=e)):ys()}function ys(){Y(tt,tt.current),Y(It,It.current)}function Gt(e){V(It),na===e&&(na=null),V(tt)}var tt=T(0);function Cl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Fu(n)||Wu(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ha=0,xe=null,$e=null,rt=null,kl=!1,Qn=!1,an=!1,Ol=0,ci=0,Zn=null,P0=0;function Fe(){throw Error(l(321))}function Yc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ht(e[n],t[n]))return!1;return!0}function Jc(e,t,n,i,u,f){return Ha=f,xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,U.H=e===null||e.memoizedState===null?dm:cu,an=!1,f=n(i,u),an=!1,Qn&&(f=kh(t,n,i,u)),Ch(e),f}function Ch(e){U.H=fi;var t=$e!==null&&$e.next!==null;if(Ha=0,rt=$e=xe=null,kl=!1,ci=0,Zn=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&wl(e)&&(it=!0))}function kh(e,t,n,i){xe=e;var u=0;do{if(Qn&&(Zn=null),ci=0,Qn=!1,25<=u)throw Error(l(301));if(u+=1,rt=$e=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}U.H=fm,f=t(n,i)}while(Qn);return f}function K0(){var e=U.H,t=e.useState()[0];return t=typeof t.then=="function"?ui(t):t,e=e.useState()[0],($e!==null?$e.memoizedState:null)!==e&&(xe.flags|=1024),t}function Xc(){var e=Ol!==0;return Ol=0,e}function Qc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Zc(e){if(kl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}kl=!1}Ha=0,rt=$e=xe=null,Qn=!1,ci=Ol=0,Zn=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?xe.memoizedState=rt=e:rt=rt.next=e,rt}function at(){if($e===null){var e=xe.alternate;e=e!==null?e.memoizedState:null}else e=$e.next;var t=rt===null?xe.memoizedState:rt.next;if(t!==null)rt=t,$e=e;else{if(e===null)throw xe.alternate===null?Error(l(467)):Error(l(310));$e=e,e={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},rt===null?xe.memoizedState=rt=e:rt=rt.next=e}return rt}function Rl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ui(e){var t=ci;return ci+=1,Zn===null&&(Zn=[]),e=xh(Zn,e,t),t=xe,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,U.H=t===null||t.memoizedState===null?dm:cu),e}function Dl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ui(e);if(e.$$typeof===B)return St(e)}throw Error(l(438,String(e)))}function Fc(e){var t=null,n=xe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=xe.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Rl(),xe.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=Je;return t.index++,n}function Va(e,t){return typeof t=="function"?t(e):t}function Ml(e){var t=at();return Wc(t,$e,e)}function Wc(e,t,n){var i=e.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=n;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var b=y=null,N=null,M=t,$=!1;do{var I=M.lane&-536870913;if(I!==M.lane?(Te&I)===I:(Ha&I)===I){var z=M.revertLane;if(z===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null}),I===Pn&&($=!0);else if((Ha&z)===z){M=M.next,z===Pn&&($=!0);continue}else I={lane:0,revertLane:M.revertLane,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},N===null?(b=N=I,y=f):N=N.next=I,xe.lanes|=z,xs|=z;I=M.action,an&&n(f,I),f=M.hasEagerState?M.eagerState:n(f,I)}else z={lane:I,revertLane:M.revertLane,gesture:M.gesture,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},N===null?(b=N=z,y=f):N=N.next=z,xe.lanes|=I,xs|=I;M=M.next}while(M!==null&&M!==t);if(N===null?y=f:N.next=b,!Ht(f,e.memoizedState)&&(it=!0,$&&(n=Kn,n!==null)))throw n;e.memoizedState=f,e.baseState=y,e.baseQueue=N,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function eu(e){var t=at(),n=t.queue;if(n===null)throw Error(l(311));n.lastRenderedReducer=e;var i=n.dispatch,u=n.pending,f=t.memoizedState;if(u!==null){n.pending=null;var y=u=u.next;do f=e(f,y.action),y=y.next;while(y!==u);Ht(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,i]}function Oh(e,t,n){var i=xe,u=at(),f=ke;if(f){if(n===void 0)throw Error(l(407));n=n()}else n=t();var y=!Ht(($e||u).memoizedState,n);if(y&&(u.memoizedState=n,it=!0),u=u.queue,su(Mh.bind(null,i,u,e),[e]),u.getSnapshot!==t||y||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,Fn(9,{destroy:void 0},Dh.bind(null,i,u,n,t),null),Ie===null)throw Error(l(349));f||(Ha&127)!==0||Rh(i,t,n)}return n}function Rh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=xe.updateQueue,t===null?(t=Rl(),xe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Dh(e,t,n,i){t.value=n,t.getSnapshot=i,zh(t)&&Uh(e)}function Mh(e,t,n){return n(function(){zh(t)&&Uh(e)})}function zh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ht(e,n)}catch{return!0}}function Uh(e){var t=Ys(e,2);t!==null&&qt(t,e,2)}function tu(e){var t=Rt();if(typeof e=="function"){var n=e;if(e=n(),an){ya(!0);try{n()}finally{ya(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:e},t}function Lh(e,t,n,i){return e.baseState=n,Wc(e,$e,typeof i=="function"?i:Va)}function Y0(e,t,n,i,u){if(Ll(e))throw Error(l(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};U.T!==null?n(!0):f.isTransition=!1,i(f),n=t.pending,n===null?(f.next=t.pending=f,Bh(t,f)):(f.next=n.next,t.pending=n.next=f)}}function Bh(e,t){var n=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=U.T,y={};U.T=y;try{var b=n(u,i),N=U.S;N!==null&&N(y,b),qh(e,t,b)}catch(M){au(e,t,M)}finally{f!==null&&y.types!==null&&(f.types=y.types),U.T=f}}else try{f=n(u,i),qh(e,t,f)}catch(M){au(e,t,M)}}function qh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){$h(e,t,i)},function(i){return au(e,t,i)}):$h(e,t,n)}function $h(e,t,n){t.status="fulfilled",t.value=n,Hh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Bh(e,n)))}function au(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,Hh(t),t=t.next;while(t!==i)}e.action=null}function Hh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Vh(e,t){return t}function Ih(e,t){if(ke){var n=Ie.formState;if(n!==null){e:{var i=xe;if(ke){if(Ke){t:{for(var u=Ke,f=sa;u.nodeType!==8;){if(!f){u=null;break t}if(u=ra(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ke=ra(u.nextSibling),i=u.data==="F!";break e}}ds(i)}i=!1}i&&(t=n[0])}}return n=Rt(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vh,lastRenderedState:t},n.queue=i,n=om.bind(null,xe,i),i.dispatch=n,i=tu(!1),f=ou.bind(null,xe,!1,i.queue),i=Rt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=Y0.bind(null,xe,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function Gh(e){var t=at();return Ph(t,$e,e)}function Ph(e,t,n){if(t=Wc(e,t,Vh)[0],e=Ml(Va)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=ui(t)}catch(y){throw y===Yn?jl:y}else i=t;t=at();var u=t.queue,f=u.dispatch;return n!==t.memoizedState&&(xe.flags|=2048,Fn(9,{destroy:void 0},J0.bind(null,u,n),null)),[i,f,e]}function J0(e,t){e.action=t}function Kh(e){var t=at(),n=$e;if(n!==null)return Ph(t,n,e);at(),t=t.memoizedState,n=at();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function Fn(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=xe.updateQueue,t===null&&(t=Rl(),xe.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Yh(){return at().memoizedState}function zl(e,t,n,i){var u=Rt();xe.flags|=e,u.memoizedState=Fn(1|t,{destroy:void 0},n,i===void 0?null:i)}function Ul(e,t,n,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;$e!==null&&i!==null&&Yc(i,$e.memoizedState.deps)?u.memoizedState=Fn(t,f,n,i):(xe.flags|=e,u.memoizedState=Fn(1|t,f,n,i))}function Jh(e,t){zl(8390656,8,e,t)}function su(e,t){Ul(2048,8,e,t)}function X0(e){xe.flags|=4;var t=xe.updateQueue;if(t===null)t=Rl(),xe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Xh(e){var t=at().memoizedState;return X0({ref:t,nextImpl:e}),function(){if((ze&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Qh(e,t){return Ul(4,2,e,t)}function Zh(e,t){return Ul(4,4,e,t)}function Fh(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Wh(e,t,n){n=n!=null?n.concat([e]):null,Ul(4,4,Fh.bind(null,t,e),n)}function nu(){}function em(e,t){var n=at();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&Yc(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function tm(e,t){var n=at();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Yc(t,i[1]))return i[0];if(i=e(),an){ya(!0);try{e()}finally{ya(!1)}}return n.memoizedState=[i,t],i}function ru(e,t,n){return n===void 0||(Ha&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=ap(),xe.lanes|=e,xs|=e,n)}function am(e,t,n,i){return Ht(n,t)?n:Xn.current!==null?(e=ru(e,n,i),Ht(e,t)||(it=!0),e):(Ha&42)===0||(Ha&1073741824)!==0&&(Te&261930)===0?(it=!0,e.memoizedState=n):(e=ap(),xe.lanes|=e,xs|=e,t)}function sm(e,t,n,i,u){var f=Q.p;Q.p=f!==0&&8>f?f:8;var y=U.T,b={};U.T=b,ou(e,!1,t,n);try{var N=u(),M=U.S;if(M!==null&&M(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var $=G0(N,i);di(e,t,$,Yt(e))}else di(e,t,i,Yt(e))}catch(I){di(e,t,{then:function(){},status:"rejected",reason:I},Yt())}finally{Q.p=f,y!==null&&b.types!==null&&(y.types=b.types),U.T=y}}function Q0(){}function iu(e,t,n,i){if(e.tag!==5)throw Error(l(476));var u=nm(e).queue;sm(e,u,t,K,n===null?Q0:function(){return rm(e),n(i)})}function nm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:K},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function rm(e){var t=nm(e);t.next===null&&(t=e.alternate.memoizedState),di(e,t.next.queue,{},Yt())}function lu(){return St(Ai)}function im(){return at().memoizedState}function lm(){return at().memoizedState}function Z0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Yt();e=ms(n);var i=ps(t,e,n);i!==null&&(qt(i,t,n),ii(i,t,n)),t={cache:Uc()},e.payload=t;return}t=t.return}}function F0(e,t,n){var i=Yt();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ll(e)?cm(t,n):(n=Nc(e,t,n,i),n!==null&&(qt(n,e,i),um(n,t,i)))}function om(e,t,n){var i=Yt();di(e,t,n,i)}function di(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ll(e))cm(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var y=t.lastRenderedState,b=f(y,n);if(u.hasEagerState=!0,u.eagerState=b,Ht(b,y))return yl(e,t,u,0),Ie===null&&gl(),!1}catch{}if(n=Nc(e,t,u,i),n!==null)return qt(n,e,i),um(n,t,i),!0}return!1}function ou(e,t,n,i){if(i={lane:2,revertLane:$u(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ll(e)){if(t)throw Error(l(479))}else t=Nc(e,n,i,2),t!==null&&qt(t,e,2)}function Ll(e){var t=e.alternate;return e===xe||t!==null&&t===xe}function cm(e,t){Qn=kl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function um(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,te(e,n)}}var fi={readContext:St,use:Dl,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};fi.useEffectEvent=Fe;var dm={readContext:St,use:Dl,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Jh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,zl(4194308,4,Fh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return zl(4194308,4,e,t)},useInsertionEffect:function(e,t){zl(4,2,e,t)},useMemo:function(e,t){var n=Rt();t=t===void 0?null:t;var i=e();if(an){ya(!0);try{e()}finally{ya(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=Rt();if(n!==void 0){var u=n(t);if(an){ya(!0);try{n(t)}finally{ya(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=F0.bind(null,xe,e),[i.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=tu(e);var t=e.queue,n=om.bind(null,xe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:nu,useDeferredValue:function(e,t){var n=Rt();return ru(n,e,t)},useTransition:function(){var e=tu(!1);return e=sm.bind(null,xe,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=xe,u=Rt();if(ke){if(n===void 0)throw Error(l(407));n=n()}else{if(n=t(),Ie===null)throw Error(l(349));(Te&127)!==0||Rh(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,Jh(Mh.bind(null,i,f,e),[e]),i.flags|=2048,Fn(9,{destroy:void 0},Dh.bind(null,i,f,n,t),null),n},useId:function(){var e=Rt(),t=Ie.identifierPrefix;if(ke){var n=xa,i=ba;n=(i&~(1<<32-Ot(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Ol++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=P0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:lu,useFormState:Ih,useActionState:Ih,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ou.bind(null,xe,!0,n),n.dispatch=t,[e,t]},useMemoCache:Fc,useCacheRefresh:function(){return Rt().memoizedState=Z0.bind(null,xe)},useEffectEvent:function(e){var t=Rt(),n={impl:e};return t.memoizedState=n,function(){if((ze&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}},cu={readContext:St,use:Dl,useCallback:em,useContext:St,useEffect:su,useImperativeHandle:Wh,useInsertionEffect:Qh,useLayoutEffect:Zh,useMemo:tm,useReducer:Ml,useRef:Yh,useState:function(){return Ml(Va)},useDebugValue:nu,useDeferredValue:function(e,t){var n=at();return am(n,$e.memoizedState,e,t)},useTransition:function(){var e=Ml(Va)[0],t=at().memoizedState;return[typeof e=="boolean"?e:ui(e),t]},useSyncExternalStore:Oh,useId:im,useHostTransitionStatus:lu,useFormState:Gh,useActionState:Gh,useOptimistic:function(e,t){var n=at();return Lh(n,$e,e,t)},useMemoCache:Fc,useCacheRefresh:lm};cu.useEffectEvent=Xh;var fm={readContext:St,use:Dl,useCallback:em,useContext:St,useEffect:su,useImperativeHandle:Wh,useInsertionEffect:Qh,useLayoutEffect:Zh,useMemo:tm,useReducer:eu,useRef:Yh,useState:function(){return eu(Va)},useDebugValue:nu,useDeferredValue:function(e,t){var n=at();return $e===null?ru(n,e,t):am(n,$e.memoizedState,e,t)},useTransition:function(){var e=eu(Va)[0],t=at().memoizedState;return[typeof e=="boolean"?e:ui(e),t]},useSyncExternalStore:Oh,useId:im,useHostTransitionStatus:lu,useFormState:Kh,useActionState:Kh,useOptimistic:function(e,t){var n=at();return $e!==null?Lh(n,$e,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Fc,useCacheRefresh:lm};fm.useEffectEvent=Xh;function uu(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:_({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var du={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=ms(i);u.payload=t,n!=null&&(u.callback=n),t=ps(e,u,i),t!==null&&(qt(t,e,i),ii(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=ms(i);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=ps(e,u,i),t!==null&&(qt(t,e,i),ii(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Yt(),i=ms(n);i.tag=2,t!=null&&(i.callback=t),t=ps(e,i,n),t!==null&&(qt(t,e,n),ii(t,e,n))}};function hm(e,t,n,i,u,f,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,y):t.prototype&&t.prototype.isPureReactComponent?!Fr(n,i)||!Fr(u,f):!0}function mm(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&du.enqueueReplaceState(t,t.state,null)}function sn(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=_({},n));for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n}function pm(e){pl(e)}function gm(e){console.error(e)}function ym(e){pl(e)}function Bl(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function vm(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function fu(e,t,n){return n=ms(n),n.tag=3,n.payload={element:null},n.callback=function(){Bl(e,t)},n}function bm(e){return e=ms(e),e.tag=3,e}function xm(e,t,n,i){var u=n.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){vm(t,n,i)}}var y=n.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){vm(t,n,i),typeof u!="function"&&(ws===null?ws=new Set([this]):ws.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function W0(e,t,n,i,u){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&Gn(t,n,u,!0),n=It.current,n!==null){switch(n.tag){case 31:case 13:return na===null?Ql():n.alternate===null&&We===0&&(We=3),n.flags&=-257,n.flags|=65536,n.lanes=u,i===Nl?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),Lu(e,i,u)),!1;case 22:return n.flags|=65536,i===Nl?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),Lu(e,i,u)),!1}throw Error(l(435,n.tag))}return Lu(e,i,u),Ql(),!1}if(ke)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Oc&&(e=Error(l(422),{cause:i}),ti(ea(e,n)))):(i!==Oc&&(t=Error(l(423),{cause:i}),ti(ea(t,n))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=ea(i,n),u=fu(e.stateNode,i,u),Vc(e,u),We!==4&&(We=2)),!1;var f=Error(l(520),{cause:i});if(f=ea(f,n),xi===null?xi=[f]:xi.push(f),We!==4&&(We=2),t===null)return!0;i=ea(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=u&-u,n.lanes|=e,e=fu(n.stateNode,i,e),Vc(n,e),!1;case 1:if(t=n.type,f=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(ws===null||!ws.has(f))))return n.flags|=65536,u&=-u,n.lanes|=u,u=bm(u),xm(u,e,n,i),Vc(n,u),!1}n=n.return}while(n!==null);return!1}var hu=Error(l(461)),it=!1;function jt(e,t,n,i){t.child=e===null?jh(t,null,n,i):tn(t,e.child,n,i)}function wm(e,t,n,i,u){n=n.render;var f=t.ref;if("ref"in i){var y={};for(var b in i)b!=="ref"&&(y[b]=i[b])}else y=i;return Zs(t),i=Jc(e,t,n,y,f,u),b=Xc(),e!==null&&!it?(Qc(e,t,u),Ia(e,t,u)):(ke&&b&&Cc(t),t.flags|=1,jt(e,t,i,u),t.child)}function _m(e,t,n,i,u){if(e===null){var f=n.type;return typeof f=="function"&&!Ec(f)&&f.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=f,Sm(e,t,f,i,u)):(e=bl(n.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!wu(e,u)){var y=f.memoizedProps;if(n=n.compare,n=n!==null?n:Fr,n(y,i)&&e.ref===t.ref)return Ia(e,t,u)}return t.flags|=1,e=La(f,i),e.ref=t.ref,e.return=t,t.child=e}function Sm(e,t,n,i,u){if(e!==null){var f=e.memoizedProps;if(Fr(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,wu(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Ia(e,t,u)}return mu(e,t,n,i,u)}function jm(e,t,n,i){var u=i.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|n:n,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~f}else i=0,t.child=null;return Nm(e,t,f,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Sl(t,f!==null?f.cachePool:null),f!==null?Th(t,f):Gc(),Ah(t);else return i=t.lanes=536870912,Nm(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(Sl(t,f.cachePool),Th(t,f),ys(),t.memoizedState=null):(e!==null&&Sl(t,null),Gc(),ys());return jt(e,t,u,n),t.child}function hi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Nm(e,t,n,i,u){var f=Bc();return f=f===null?null:{parent:nt._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&Sl(t,null),Gc(),Ah(t),e!==null&&Gn(e,t,i,!0),t.childLanes=u,null}function ql(e,t){return t=Hl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Em(e,t,n){return tn(t,e.child,null,n),e=ql(t,t.pendingProps),e.flags|=2,Gt(t),t.memoizedState=null,e}function eb(e,t,n){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(i.mode==="hidden")return e=ql(t,i),t.lanes=536870912,hi(null,e);if(Kc(t),(e=Ke)?(e=Bp(e,sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:cs!==null?{id:ba,overflow:xa}:null,retryLane:536870912,hydrationErrors:null},n=ch(e),n.return=t,t.child=n,_t=t,Ke=null)):e=null,e===null)throw ds(t);return t.lanes=536870912,null}return ql(t,i)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Kc(t),u)if(t.flags&256)t.flags&=-257,t=Em(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(it||Gn(e,t,n,!1),u=(n&e.childLanes)!==0,it||u){if(i=Ie,i!==null&&(y=Ce(i,n),y!==0&&y!==f.retryLane))throw f.retryLane=y,Ys(e,y),qt(i,e,y),hu;Ql(),t=Em(e,t,n)}else e=f.treeContext,Ke=ra(y.nextSibling),_t=t,ke=!0,us=null,sa=!1,e!==null&&fh(t,e),t=ql(t,i),t.flags|=4096;return t}return e=La(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function $l(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(l(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function mu(e,t,n,i,u){return Zs(t),n=Jc(e,t,n,i,void 0,u),i=Xc(),e!==null&&!it?(Qc(e,t,u),Ia(e,t,u)):(ke&&i&&Cc(t),t.flags|=1,jt(e,t,n,u),t.child)}function Tm(e,t,n,i,u,f){return Zs(t),t.updateQueue=null,n=kh(t,i,n,u),Ch(e),i=Xc(),e!==null&&!it?(Qc(e,t,f),Ia(e,t,f)):(ke&&i&&Cc(t),t.flags|=1,jt(e,t,n,f),t.child)}function Am(e,t,n,i,u){if(Zs(t),t.stateNode===null){var f=$n,y=n.contextType;typeof y=="object"&&y!==null&&(f=St(y)),f=new n(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=du,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},$c(t),y=n.contextType,f.context=typeof y=="object"&&y!==null?St(y):$n,f.state=t.memoizedState,y=n.getDerivedStateFromProps,typeof y=="function"&&(uu(t,n,y,i),f.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&du.enqueueReplaceState(f,f.state,null),oi(t,i,f,u),li(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var b=t.memoizedProps,N=sn(n,b);f.props=N;var M=f.context,$=n.contextType;y=$n,typeof $=="object"&&$!==null&&(y=St($));var I=n.getDerivedStateFromProps;$=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||M!==y)&&mm(t,f,i,y),hs=!1;var z=t.memoizedState;f.state=z,oi(t,i,f,u),li(),M=t.memoizedState,b||z!==M||hs?(typeof I=="function"&&(uu(t,n,I,i),M=t.memoizedState),(N=hs||hm(t,n,N,i,z,M,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=M),f.props=i,f.state=M,f.context=y,i=N):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Hc(e,t),y=t.memoizedProps,$=sn(n,y),f.props=$,I=t.pendingProps,z=f.context,M=n.contextType,N=$n,typeof M=="object"&&M!==null&&(N=St(M)),b=n.getDerivedStateFromProps,(M=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==I||z!==N)&&mm(t,f,i,N),hs=!1,z=t.memoizedState,f.state=z,oi(t,i,f,u),li();var L=t.memoizedState;y!==I||z!==L||hs||e!==null&&e.dependencies!==null&&wl(e.dependencies)?(typeof b=="function"&&(uu(t,n,b,i),L=t.memoizedState),($=hs||hm(t,n,$,i,z,L,N)||e!==null&&e.dependencies!==null&&wl(e.dependencies))?(M||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,L,N),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,L,N)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=L),f.props=i,f.state=L,f.context=N,i=$):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,$l(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=tn(t,e.child,null,u),t.child=tn(t,null,n,u)):jt(e,t,n,u),t.memoizedState=f.state,e=t.child):e=Ia(e,t,u),e}function Cm(e,t,n,i){return Xs(),t.flags|=256,jt(e,t,n,i),t.child}var pu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gu(e){return{baseLanes:e,cachePool:vh()}}function yu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Kt),e}function km(e,t,n){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,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?gs(t):ys(),(e=Ke)?(e=Bp(e,sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:cs!==null?{id:ba,overflow:xa}:null,retryLane:536870912,hydrationErrors:null},n=ch(e),n.return=t,t.child=n,_t=t,Ke=null)):e=null,e===null)throw ds(t);return Wu(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(ys(),u=t.mode,b=Hl({mode:"hidden",children:b},u),i=Js(i,u,n,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=gu(n),i.childLanes=yu(e,y,n),t.memoizedState=pu,hi(null,i)):(gs(t),vu(t,b))}var N=e.memoizedState;if(N!==null&&(b=N.dehydrated,b!==null)){if(f)t.flags&256?(gs(t),t.flags&=-257,t=bu(e,t,n)):t.memoizedState!==null?(ys(),t.child=e.child,t.flags|=128,t=null):(ys(),b=i.fallback,u=t.mode,i=Hl({mode:"visible",children:i.children},u),b=Js(b,u,n,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,tn(t,e.child,null,n),i=t.child,i.memoizedState=gu(n),i.childLanes=yu(e,y,n),t.memoizedState=pu,t=hi(null,i));else if(gs(t),Wu(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var M=y.dgst;y=M,i=Error(l(419)),i.stack="",i.digest=y,ti({value:i,source:null,stack:null}),t=bu(e,t,n)}else if(it||Gn(e,t,n,!1),y=(n&e.childLanes)!==0,it||y){if(y=Ie,y!==null&&(i=Ce(y,n),i!==0&&i!==N.retryLane))throw N.retryLane=i,Ys(e,i),qt(y,e,i),hu;Fu(b)||Ql(),t=bu(e,t,n)}else Fu(b)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Ke=ra(b.nextSibling),_t=t,ke=!0,us=null,sa=!1,e!==null&&fh(t,e),t=vu(t,i.children),t.flags|=4096);return t}return u?(ys(),b=i.fallback,u=t.mode,N=e.child,M=N.sibling,i=La(N,{mode:"hidden",children:i.children}),i.subtreeFlags=N.subtreeFlags&65011712,M!==null?b=La(M,b):(b=Js(b,u,n,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,hi(null,i),i=t.child,b=e.child.memoizedState,b===null?b=gu(n):(u=b.cachePool,u!==null?(N=nt._currentValue,u=u.parent!==N?{parent:N,pool:N}:u):u=vh(),b={baseLanes:b.baseLanes|n,cachePool:u}),i.memoizedState=b,i.childLanes=yu(e,y,n),t.memoizedState=pu,hi(e.child,i)):(gs(t),n=e.child,e=n.sibling,n=La(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=n,t.memoizedState=null,n)}function vu(e,t){return t=Hl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Hl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function bu(e,t,n){return tn(t,e.child,null,n),e=vu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Om(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Mc(e.return,t,n)}function xu(e,t,n,i,u,f){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:u,treeForkCount:f}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=i,y.tail=n,y.tailMode=u,y.treeForkCount=f)}function Rm(e,t,n){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var y=tt.current,b=(y&2)!==0;if(b?(y=y&1|2,t.flags|=128):y&=1,Y(tt,y),jt(e,t,i,n),i=ke?ei:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Om(e,n,t);else if(e.tag===19)Om(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(n=t.child,u=null;n!==null;)e=n.alternate,e!==null&&Cl(e)===null&&(u=n),n=n.sibling;n=u,n===null?(u=t.child,t.child=null):(u=n.sibling,n.sibling=null),xu(t,!1,u,n,f,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Cl(e)===null){t.child=u;break}e=u.sibling,u.sibling=n,n=u,u=e}xu(t,!0,n,null,f,i);break;case"together":xu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Ia(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),xs|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Gn(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,n=La(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=La(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function wu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&wl(e)))}function tb(e,t,n){switch(t.tag){case 3:Ge(t,t.stateNode.containerInfo),fs(t,nt,e.memoizedState.cache),Xs();break;case 27:case 5:Ct(t);break;case 4:Ge(t,t.stateNode.containerInfo);break;case 10:fs(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Kc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(gs(t),t.flags|=128,null):(n&t.child.childLanes)!==0?km(e,t,n):(gs(t),e=Ia(e,t,n),e!==null?e.sibling:null);gs(t);break;case 19:var u=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(Gn(e,t,n,!1),i=(n&t.childLanes)!==0),u){if(i)return Rm(e,t,n);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Y(tt,tt.current),i)break;return null;case 22:return t.lanes=0,jm(e,t,n,t.pendingProps);case 24:fs(t,nt,e.memoizedState.cache)}return Ia(e,t,n)}function Dm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!wu(e,n)&&(t.flags&128)===0)return it=!1,tb(e,t,n);it=(e.flags&131072)!==0}else it=!1,ke&&(t.flags&1048576)!==0&&dh(t,ei,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Ws(t.elementType),t.type=e,typeof e=="function")Ec(e)?(i=sn(e,i),t.tag=1,t=Am(null,t,e,i,n)):(t.tag=0,t=mu(null,t,e,i,n));else{if(e!=null){var u=e.$$typeof;if(u===G){t.tag=11,t=wm(null,t,e,i,n);break e}else if(u===P){t.tag=14,t=_m(null,t,e,i,n);break e}}throw t=st(e)||e,Error(l(306,t,""))}}return t;case 0:return mu(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,u=sn(i,t.pendingProps),Am(e,t,i,u,n);case 3:e:{if(Ge(t,t.stateNode.containerInfo),e===null)throw Error(l(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,Hc(e,t),oi(t,i,null,n);var y=t.memoizedState;if(i=y.cache,fs(t,nt,i),i!==f.cache&&zc(t,[nt],n,!0),li(),i=y.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Cm(e,t,i,n);break e}else if(i!==u){u=ea(Error(l(424)),t),ti(u),t=Cm(e,t,i,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ke=ra(e.firstChild),_t=t,ke=!0,us=null,sa=!0,n=jh(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Xs(),i===u){t=Ia(e,t,n);break e}jt(e,t,i,n)}t=t.child}return t;case 26:return $l(e,t),e===null?(n=Gp(t.type,null,t.pendingProps,null))?t.memoizedState=n:ke||(n=t.type,e=t.pendingProps,i=so(ye.current).createElement(n),i[ut]=t,i[Dt]=e,Nt(i,n,e),vt(i),t.stateNode=i):t.memoizedState=Gp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ct(t),e===null&&ke&&(i=t.stateNode=Hp(t.type,t.pendingProps,ye.current),_t=t,sa=!0,u=Ke,Ns(t.type)?(ed=u,Ke=ra(i.firstChild)):Ke=u),jt(e,t,t.pendingProps.children,n),$l(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ke&&((u=i=Ke)&&(i=Ob(i,t.type,t.pendingProps,sa),i!==null?(t.stateNode=i,_t=t,Ke=ra(i.firstChild),sa=!1,u=!0):u=!1),u||ds(t)),Ct(t),u=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,i=f.children,Xu(u,f)?i=null:y!==null&&Xu(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=Jc(e,t,K0,null,null,n),Ai._currentValue=u),$l(e,t),jt(e,t,i,n),t.child;case 6:return e===null&&ke&&((e=n=Ke)&&(n=Rb(n,t.pendingProps,sa),n!==null?(t.stateNode=n,_t=t,Ke=null,e=!0):e=!1),e||ds(t)),null;case 13:return km(e,t,n);case 4:return Ge(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=tn(t,null,i,n):jt(e,t,i,n),t.child;case 11:return wm(e,t,t.type,t.pendingProps,n);case 7:return jt(e,t,t.pendingProps,n),t.child;case 8:return jt(e,t,t.pendingProps.children,n),t.child;case 12:return jt(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,fs(t,t.type,i.value),jt(e,t,i.children,n),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Zs(t),u=St(u),i=i(u),t.flags|=1,jt(e,t,i,n),t.child;case 14:return _m(e,t,t.type,t.pendingProps,n);case 15:return Sm(e,t,t.type,t.pendingProps,n);case 19:return Rm(e,t,n);case 31:return eb(e,t,n);case 22:return jm(e,t,n,t.pendingProps);case 24:return Zs(t),i=St(nt),e===null?(u=Bc(),u===null&&(u=Ie,f=Uc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},$c(t),fs(t,nt,u)):((e.lanes&n)!==0&&(Hc(e,t),oi(t,null,null,n),li()),u=e.memoizedState,f=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),fs(t,nt,i)):(i=f.cache,fs(t,nt,i),i!==u.cache&&zc(t,[nt],n,!0))),jt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Ga(e){e.flags|=4}function _u(e,t,n,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(ip())e.flags|=8192;else throw en=Nl,qc}else e.flags&=-16777217}function Mm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xp(t))if(ip())e.flags|=8192;else throw en=Nl,qc}function Vl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?nl():536870912,e.lanes|=t,ar|=t)}function mi(e,t){if(!ke)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var u=e.child;u!==null;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function ab(e,t,n){var i=t.pendingProps;switch(kc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return Ye(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),$a(nt),Ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(In(t)?Ga(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Rc())),Ye(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Ga(t),f!==null?(Ye(t),Mm(t,f)):(Ye(t),_u(t,u,null,i,n))):f?f!==e.memoizedState?(Ga(t),Ye(t),Mm(t,f)):(Ye(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ga(t),Ye(t),_u(t,u,e,i,n)),null;case 27:if(pt(t),n=ye.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}e=W.current,In(t)?hh(t):(e=Hp(u,i,n),t.stateNode=e,Ga(t))}return Ye(t),null;case 5:if(pt(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}if(f=W.current,In(t))hh(t);else{var y=so(ye.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?y.createElement("select",{is:i.is}):y.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?y.createElement(u,{is:i.is}):y.createElement(u)}}f[ut]=t,f[Dt]=i;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=f;e:switch(Nt(f,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Ga(t)}}return Ye(t),_u(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(l(166));if(e=ye.current,In(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=_t,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||kp(e.nodeValue,n)),e||ds(t,!0)}else e=so(e).createTextNode(i),e[ut]=t,t.stateNode=e}return Ye(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=In(t),n!==null){if(e===null){if(!i)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[ut]=t}else Xs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),e=!1}else n=Rc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Gt(t),t):(Gt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ye(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=In(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(l(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(l(317));u[ut]=t}else Xs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),u=!1}else u=Rc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Gt(t),t):(Gt(t),null)}return Gt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==u&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Vl(t,t.updateQueue),Ye(t),null);case 4:return Ue(),e===null&&Gu(t.stateNode.containerInfo),Ye(t),null;case 10:return $a(t.type),Ye(t),null;case 19:if(V(tt),i=t.memoizedState,i===null)return Ye(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)mi(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=Cl(e),f!==null){for(t.flags|=128,mi(i,!1),e=f.updateQueue,t.updateQueue=e,Vl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oh(n,e),n=n.sibling;return Y(tt,tt.current&1|2),ke&&Ba(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&>()>Yl&&(t.flags|=128,u=!0,mi(i,!1),t.lanes=4194304)}else{if(!u)if(e=Cl(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Vl(t,e),mi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!ke)return Ye(t),null}else 2*gt()-i.renderingStartTime>Yl&&n!==536870912&&(t.flags|=128,u=!0,mi(i,!1),t.lanes=4194304);i.isBackwards?(f.sibling=t.child,t.child=f):(e=i.last,e!==null?e.sibling=f:t.child=f,i.last=f)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=gt(),e.sibling=null,n=tt.current,Y(tt,u?n&1|2:n&1),ke&&Ba(t,i.treeForkCount),e):(Ye(t),null);case 22:case 23:return Gt(t),Pc(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),n=t.updateQueue,n!==null&&Vl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&V(Fs),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),$a(nt),Ye(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function sb(e,t){switch(kc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $a(nt),Ue(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(Gt(t),t.alternate===null)throw Error(l(340));Xs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Gt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Xs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(tt),null;case 4:return Ue(),null;case 10:return $a(t.type),null;case 22:case 23:return Gt(t),Pc(),e!==null&&V(Fs),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return $a(nt),null;case 25:return null;default:return null}}function zm(e,t){switch(kc(t),t.tag){case 3:$a(nt),Ue();break;case 26:case 27:case 5:pt(t);break;case 4:Ue();break;case 31:t.memoizedState!==null&&Gt(t);break;case 13:Gt(t);break;case 19:V(tt);break;case 10:$a(t.type);break;case 22:case 23:Gt(t),Pc(),e!==null&&V(Fs);break;case 24:$a(nt)}}function pi(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var u=i.next;n=u;do{if((n.tag&e)===e){i=void 0;var f=n.create,y=n.inst;i=f(),y.destroy=i}n=n.next}while(n!==u)}}catch(b){Be(t,t.return,b)}}function vs(e,t,n){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var f=u.next;i=f;do{if((i.tag&e)===e){var y=i.inst,b=y.destroy;if(b!==void 0){y.destroy=void 0,u=t;var N=n,M=b;try{M()}catch($){Be(u,N,$)}}}i=i.next}while(i!==f)}}catch($){Be(t,t.return,$)}}function Um(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Eh(t,n)}catch(i){Be(e,e.return,i)}}}function Lm(e,t,n){n.props=sn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){Be(e,t,i)}}function gi(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof n=="function"?e.refCleanup=n(i):n.current=i}}catch(u){Be(e,t,u)}}function wa(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(u){Be(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(u){Be(e,t,u)}else n.current=null}function Bm(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(u){Be(e,e.return,u)}}function Su(e,t,n){try{var i=e.stateNode;Nb(i,e.type,n,t),i[Dt]=t}catch(u){Be(e,e.return,u)}}function qm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ns(e.type)||e.tag===4}function ju(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ns(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Nu(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=za));else if(i!==4&&(i===27&&Ns(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Nu(e,t,n),e=e.sibling;e!==null;)Nu(e,t,n),e=e.sibling}function Il(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&Ns(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Il(e,t,n),e=e.sibling;e!==null;)Il(e,t,n),e=e.sibling}function $m(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Nt(t,i,n),t[ut]=e,t[Dt]=n}catch(f){Be(e,e.return,f)}}var Pa=!1,lt=!1,Eu=!1,Hm=typeof WeakSet=="function"?WeakSet:Set,bt=null;function nb(e,t){if(e=e.containerInfo,Yu=uo,e=Wf(e),bc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var y=0,b=-1,N=-1,M=0,$=0,I=e,z=null;t:for(;;){for(var L;I!==n||u!==0&&I.nodeType!==3||(b=y+u),I!==f||i!==0&&I.nodeType!==3||(N=y+i),I.nodeType===3&&(y+=I.nodeValue.length),(L=I.firstChild)!==null;)z=I,I=L;for(;;){if(I===e)break t;if(z===n&&++M===u&&(b=y),z===f&&++$===i&&(N=y),(L=I.nextSibling)!==null)break;I=z,z=I.parentNode}I=L}n=b===-1||N===-1?null:{start:b,end:N}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ju={focusedElem:e,selectionRange:n},uo=!1,bt=t;bt!==null;)if(t=bt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bt=e;else for(;bt!==null;){switch(t=bt,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)u=e[n],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,n=t,u=f.memoizedProps,f=f.memoizedState,i=n.stateNode;try{var ae=sn(n.type,u);e=i.getSnapshotBeforeUpdate(ae,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(he){Be(n,n.return,he)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Zu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Zu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=t.sibling,e!==null){e.return=t.return,bt=e;break}bt=t.return}}function Vm(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Ya(e,n),i&4&&pi(5,n);break;case 1:if(Ya(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(y){Be(n,n.return,y)}else{var u=sn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Be(n,n.return,y)}}i&64&&Um(n),i&512&&gi(n,n.return);break;case 3:if(Ya(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Eh(e,t)}catch(y){Be(n,n.return,y)}}break;case 27:t===null&&i&4&&$m(n);case 26:case 5:Ya(e,n),t===null&&i&4&&Bm(n),i&512&&gi(n,n.return);break;case 12:Ya(e,n);break;case 31:Ya(e,n),i&4&&Pm(e,n);break;case 13:Ya(e,n),i&4&&Km(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hb.bind(null,n),Db(e,n))));break;case 22:if(i=n.memoizedState!==null||Pa,!i){t=t!==null&&t.memoizedState!==null||lt,u=Pa;var f=lt;Pa=i,(lt=t)&&!f?Ja(e,n,(n.subtreeFlags&8772)!==0):Ya(e,n),Pa=u,lt=f}break;case 30:break;default:Ya(e,n)}}function Im(e){var t=e.alternate;t!==null&&(e.alternate=null,Im(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ac(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Xe=null,zt=!1;function Ka(e,t,n){for(n=n.child;n!==null;)Gm(e,t,n),n=n.sibling}function Gm(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Bs,n)}catch{}switch(n.tag){case 26:lt||wa(n,t),Ka(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lt||wa(n,t);var i=Xe,u=zt;Ns(n.type)&&(Xe=n.stateNode,zt=!1),Ka(e,t,n),Ni(n.stateNode),Xe=i,zt=u;break;case 5:lt||wa(n,t);case 6:if(i=Xe,u=zt,Xe=null,Ka(e,t,n),Xe=i,zt=u,Xe!==null)if(zt)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(n.stateNode)}catch(f){Be(n,t,f)}else try{Xe.removeChild(n.stateNode)}catch(f){Be(n,t,f)}break;case 18:Xe!==null&&(zt?(e=Xe,Up(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),ur(e)):Up(Xe,n.stateNode));break;case 4:i=Xe,u=zt,Xe=n.stateNode.containerInfo,zt=!0,Ka(e,t,n),Xe=i,zt=u;break;case 0:case 11:case 14:case 15:vs(2,n,t),lt||vs(4,n,t),Ka(e,t,n);break;case 1:lt||(wa(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&Lm(n,t,i)),Ka(e,t,n);break;case 21:Ka(e,t,n);break;case 22:lt=(i=lt)||n.memoizedState!==null,Ka(e,t,n),lt=i;break;default:Ka(e,t,n)}}function Pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ur(e)}catch(n){Be(t,t.return,n)}}}function Km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ur(e)}catch(n){Be(t,t.return,n)}}function rb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Hm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Hm),t;default:throw Error(l(435,e.tag))}}function Gl(e,t){var n=rb(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=mb.bind(null,e,i);i.then(u,u)}})}function Ut(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var u=n[i],f=e,y=t,b=y;e:for(;b!==null;){switch(b.tag){case 27:if(Ns(b.type)){Xe=b.stateNode,zt=!1;break e}break;case 5:Xe=b.stateNode,zt=!1;break e;case 3:case 4:Xe=b.stateNode.containerInfo,zt=!0;break e}b=b.return}if(Xe===null)throw Error(l(160));Gm(f,y,u),Xe=null,zt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ym(t,e),t=t.sibling}var ca=null;function Ym(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Lt(e),i&4&&(vs(3,e,e.return),pi(3,e),vs(5,e,e.return));break;case 1:Ut(t,e),Lt(e),i&512&&(lt||n===null||wa(n,n.return)),i&64&&Pa&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var u=ca;if(Ut(t,e),Lt(e),i&512&&(lt||n===null||wa(n,n.return)),i&4){var f=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Ir]||f[ut]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),Nt(f,i,n),f[ut]=e,vt(f),i=f;break e;case"link":var y=Yp("link","href",u).get(i+(n.href||""));if(y){for(var b=0;b<y.length;b++)if(f=y[b],f.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&f.getAttribute("rel")===(n.rel==null?null:n.rel)&&f.getAttribute("title")===(n.title==null?null:n.title)&&f.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){y.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;case"meta":if(y=Yp("meta","content",u).get(i+(n.content||""))){for(b=0;b<y.length;b++)if(f=y[b],f.getAttribute("content")===(n.content==null?null:""+n.content)&&f.getAttribute("name")===(n.name==null?null:n.name)&&f.getAttribute("property")===(n.property==null?null:n.property)&&f.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&f.getAttribute("charset")===(n.charSet==null?null:n.charSet)){y.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[ut]=e,vt(f),i=f}e.stateNode=i}else Jp(u,e.type,e.stateNode);else e.stateNode=Kp(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?Jp(u,e.type,e.stateNode):Kp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Su(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ut(t,e),Lt(e),i&512&&(lt||n===null||wa(n,n.return)),n!==null&&i&4&&Su(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ut(t,e),Lt(e),i&512&&(lt||n===null||wa(n,n.return)),e.flags&32){u=e.stateNode;try{Dn(u,"")}catch(ae){Be(e,e.return,ae)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,Su(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Eu=!0);break;case 6:if(Ut(t,e),Lt(e),i&4){if(e.stateNode===null)throw Error(l(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(ae){Be(e,e.return,ae)}}break;case 3:if(io=null,u=ca,ca=no(t.containerInfo),Ut(t,e),ca=u,Lt(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{ur(t.containerInfo)}catch(ae){Be(e,e.return,ae)}Eu&&(Eu=!1,Jm(e));break;case 4:i=ca,ca=no(e.stateNode.containerInfo),Ut(t,e),Lt(e),ca=i;break;case 12:Ut(t,e),Lt(e);break;case 31:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Gl(e,i)));break;case 13:Ut(t,e),Lt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Kl=gt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Gl(e,i)));break;case 22:u=e.memoizedState!==null;var N=n!==null&&n.memoizedState!==null,M=Pa,$=lt;if(Pa=M||u,lt=$||N,Ut(t,e),lt=$,Pa=M,Lt(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||N||Pa||lt||nn(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){N=n=t;try{if(f=N.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=N.stateNode;var I=N.memoizedProps.style,z=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ae){Be(N,N.return,ae)}}}else if(t.tag===6){if(n===null){N=t;try{N.stateNode.nodeValue=u?"":N.memoizedProps}catch(ae){Be(N,N.return,ae)}}}else if(t.tag===18){if(n===null){N=t;try{var L=N.stateNode;u?Lp(L,!0):Lp(N.stateNode,!1)}catch(ae){Be(N,N.return,ae)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Gl(e,n))));break;case 19:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Gl(e,i)));break;case 30:break;case 21:break;default:Ut(t,e),Lt(e)}}function Lt(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(qm(i)){n=i;break}i=i.return}if(n==null)throw Error(l(160));switch(n.tag){case 27:var u=n.stateNode,f=ju(e);Il(e,f,u);break;case 5:var y=n.stateNode;n.flags&32&&(Dn(y,""),n.flags&=-33);var b=ju(e);Il(e,b,y);break;case 3:case 4:var N=n.stateNode.containerInfo,M=ju(e);Nu(e,M,N);break;default:throw Error(l(161))}}catch($){Be(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Jm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Jm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ya(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Vm(e,t.alternate,t),t=t.sibling}function nn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:vs(4,t,t.return),nn(t);break;case 1:wa(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Lm(t,t.return,n),nn(t);break;case 27:Ni(t.stateNode);case 26:case 5:wa(t,t.return),nn(t);break;case 22:t.memoizedState===null&&nn(t);break;case 30:nn(t);break;default:nn(t)}e=e.sibling}}function Ja(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,y=f.flags;switch(f.tag){case 0:case 11:case 15:Ja(u,f,n),pi(4,f);break;case 1:if(Ja(u,f,n),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(M){Be(i,i.return,M)}if(i=f,u=i.updateQueue,u!==null){var b=i.stateNode;try{var N=u.shared.hiddenCallbacks;if(N!==null)for(u.shared.hiddenCallbacks=null,u=0;u<N.length;u++)Nh(N[u],b)}catch(M){Be(i,i.return,M)}}n&&y&64&&Um(f),gi(f,f.return);break;case 27:$m(f);case 26:case 5:Ja(u,f,n),n&&i===null&&y&4&&Bm(f),gi(f,f.return);break;case 12:Ja(u,f,n);break;case 31:Ja(u,f,n),n&&y&4&&Pm(u,f);break;case 13:Ja(u,f,n),n&&y&4&&Km(u,f);break;case 22:f.memoizedState===null&&Ja(u,f,n),gi(f,f.return);break;case 30:break;default:Ja(u,f,n)}t=t.sibling}}function Tu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ai(n))}function Au(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ai(e))}function ua(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xm(e,t,n,i),t=t.sibling}function Xm(e,t,n,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ua(e,t,n,i),u&2048&&pi(9,t);break;case 1:ua(e,t,n,i);break;case 3:ua(e,t,n,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ai(e)));break;case 12:if(u&2048){ua(e,t,n,i),e=t.stateNode;try{var f=t.memoizedProps,y=f.id,b=f.onPostCommit;typeof b=="function"&&b(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Be(t,t.return,N)}}else ua(e,t,n,i);break;case 31:ua(e,t,n,i);break;case 13:ua(e,t,n,i);break;case 23:break;case 22:f=t.stateNode,y=t.alternate,t.memoizedState!==null?f._visibility&2?ua(e,t,n,i):yi(e,t):f._visibility&2?ua(e,t,n,i):(f._visibility|=2,Wn(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Tu(y,t);break;case 24:ua(e,t,n,i),u&2048&&Au(t.alternate,t);break;default:ua(e,t,n,i)}}function Wn(e,t,n,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,y=t,b=n,N=i,M=y.flags;switch(y.tag){case 0:case 11:case 15:Wn(f,y,b,N,u),pi(8,y);break;case 23:break;case 22:var $=y.stateNode;y.memoizedState!==null?$._visibility&2?Wn(f,y,b,N,u):yi(f,y):($._visibility|=2,Wn(f,y,b,N,u)),u&&M&2048&&Tu(y.alternate,y);break;case 24:Wn(f,y,b,N,u),u&&M&2048&&Au(y.alternate,y);break;default:Wn(f,y,b,N,u)}t=t.sibling}}function yi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,u=i.flags;switch(i.tag){case 22:yi(n,i),u&2048&&Tu(i.alternate,i);break;case 24:yi(n,i),u&2048&&Au(i.alternate,i);break;default:yi(n,i)}t=t.sibling}}var vi=8192;function er(e,t,n){if(e.subtreeFlags&vi)for(e=e.child;e!==null;)Qm(e,t,n),e=e.sibling}function Qm(e,t,n){switch(e.tag){case 26:er(e,t,n),e.flags&vi&&e.memoizedState!==null&&Pb(n,ca,e.memoizedState,e.memoizedProps);break;case 5:er(e,t,n);break;case 3:case 4:var i=ca;ca=no(e.stateNode.containerInfo),er(e,t,n),ca=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=vi,vi=16777216,er(e,t,n),vi=i):er(e,t,n));break;default:er(e,t,n)}}function Zm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function bi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,Wm(i,e)}Zm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:bi(e),e.flags&2048&&vs(9,e,e.return);break;case 3:bi(e);break;case 12:bi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):bi(e);break;default:bi(e)}}function Pl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,Wm(i,e)}Zm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:vs(8,t,t.return),Pl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Wm(e,t){for(;bt!==null;){var n=bt;switch(n.tag){case 0:case 11:case 15:vs(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:ai(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,bt=i;else e:for(n=e;bt!==null;){i=bt;var u=i.sibling,f=i.return;if(Im(i),i===n){bt=null;break e}if(u!==null){u.return=f,bt=u;break e}bt=f}}}var ib={getCacheForType:function(e){var t=St(nt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return St(nt).controller.signal}},lb=typeof WeakMap=="function"?WeakMap:Map,ze=0,Ie=null,Ne=null,Te=0,Le=0,Pt=null,bs=!1,tr=!1,Cu=!1,Xa=0,We=0,xs=0,rn=0,ku=0,Kt=0,ar=0,xi=null,Bt=null,Ou=!1,Kl=0,ep=0,Yl=1/0,Jl=null,ws=null,dt=0,_s=null,sr=null,Qa=0,Ru=0,Du=null,tp=null,wi=0,Mu=null;function Yt(){return(ze&2)!==0&&Te!==0?Te&-Te:U.T!==null?$u():Hs()}function ap(){if(Kt===0)if((Te&536870912)===0||ke){var e=jn;jn<<=1,(jn&3932160)===0&&(jn=262144),Kt=e}else Kt=536870912;return e=It.current,e!==null&&(e.flags|=32),Kt}function qt(e,t,n){(e===Ie&&(Le===2||Le===9)||e.cancelPendingCommit!==null)&&(nr(e,0),Ss(e,Te,Kt,!1)),qs(e,n),((ze&2)===0||e!==Ie)&&(e===Ie&&((ze&2)===0&&(rn|=n),We===4&&Ss(e,Te,Kt,!1)),_a(e))}function sp(e,t,n){if((ze&6)!==0)throw Error(l(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||ls(e,t),u=i?ub(e,t):Uu(e,t,!0),f=i;do{if(u===0){tr&&!i&&Ss(e,t,0,!1);break}else{if(n=e.current.alternate,f&&!ob(n)){u=Uu(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var b=e;u=xi;var N=b.current.memoizedState.isDehydrated;if(N&&(nr(b,y).flags|=256),y=Uu(b,y,!1),y!==2){if(Cu&&!N){b.errorRecoveryDisabledLanes|=f,rn|=f,u=4;break e}f=Bt,Bt=u,f!==null&&(Bt===null?Bt=f:Bt.push.apply(Bt,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){nr(e,0),Ss(e,t,0,!0);break}e:{switch(i=e,f=u,f){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:Ss(i,t,Kt,!bs);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Kl+300-gt(),10<u)){if(Ss(i,t,Kt,!bs),En(i,0,!0)!==0)break e;Qa=t,i.timeoutHandle=Mp(np.bind(null,i,n,Bt,Jl,Ou,t,Kt,rn,ar,bs,f,"Throttled",-0,0),u);break e}np(i,n,Bt,Jl,Ou,t,Kt,rn,ar,bs,f,null,-0,0)}}break}while(!0);_a(e)}function np(e,t,n,i,u,f,y,b,N,M,$,I,z,L){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:za},Qm(t,f,I);var ae=(f&62914560)===f?Kl-gt():(f&4194048)===f?ep-gt():0;if(ae=Kb(I,ae),ae!==null){Qa=f,e.cancelPendingCommit=ae(fp.bind(null,e,t,f,n,i,u,y,b,N,$,I,null,z,L)),Ss(e,f,y,!M);return}}fp(e,t,f,n,i,u,y,b,N)}function ob(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var u=n[i],f=u.getSnapshot;u=u.value;try{if(!Ht(f(),u))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ss(e,t,n,i){t&=~ku,t&=~rn,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Ot(u),y=1<<f;i[f]=-1,u&=~y}n!==0&&k(e,n,t)}function Xl(){return(ze&6)===0?(_i(0),!1):!0}function zu(){if(Ne!==null){if(Le===0)var e=Ne.return;else e=Ne,qa=Qs=null,Zc(e),Jn=null,ni=0,e=Ne;for(;e!==null;)zm(e.alternate,e),e=e.return;Ne=null}}function nr(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Ab(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Qa=0,zu(),Ie=e,Ne=n=La(e.current,null),Te=t,Le=0,Pt=null,bs=!1,tr=ls(e,t),Cu=!1,ar=Kt=ku=rn=xs=We=0,Bt=xi=null,Ou=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-Ot(i),f=1<<u;t|=e[u],i&=~f}return Xa=t,gl(),n}function rp(e,t){xe=null,U.H=fi,t===Yn||t===jl?(t=wh(),Le=3):t===qc?(t=wh(),Le=4):Le=t===hu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pt=t,Ne===null&&(We=1,Bl(e,ea(t,e.current)))}function ip(){var e=It.current;return e===null?!0:(Te&4194048)===Te?na===null:(Te&62914560)===Te||(Te&536870912)!==0?e===na:!1}function lp(){var e=U.H;return U.H=fi,e===null?fi:e}function op(){var e=U.A;return U.A=ib,e}function Ql(){We=4,bs||(Te&4194048)!==Te&&It.current!==null||(tr=!0),(xs&134217727)===0&&(rn&134217727)===0||Ie===null||Ss(Ie,Te,Kt,!1)}function Uu(e,t,n){var i=ze;ze|=2;var u=lp(),f=op();(Ie!==e||Te!==t)&&(Jl=null,nr(e,t)),t=!1;var y=We;e:do try{if(Le!==0&&Ne!==null){var b=Ne,N=Pt;switch(Le){case 8:zu(),y=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var M=Le;if(Le=0,Pt=null,rr(e,b,N,M),n&&tr){y=0;break e}break;default:M=Le,Le=0,Pt=null,rr(e,b,N,M)}}cb(),y=We;break}catch($){rp(e,$)}while(!0);return t&&e.shellSuspendCounter++,qa=Qs=null,ze=i,U.H=u,U.A=f,Ne===null&&(Ie=null,Te=0,gl()),y}function cb(){for(;Ne!==null;)cp(Ne)}function ub(e,t){var n=ze;ze|=2;var i=lp(),u=op();Ie!==e||Te!==t?(Jl=null,Yl=gt()+500,nr(e,t)):tr=ls(e,t);e:do try{if(Le!==0&&Ne!==null){t=Ne;var f=Pt;t:switch(Le){case 1:Le=0,Pt=null,rr(e,t,f,1);break;case 2:case 9:if(bh(f)){Le=0,Pt=null,up(t);break}t=function(){Le!==2&&Le!==9||Ie!==e||(Le=7),_a(e)},f.then(t,t);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:bh(f)?(Le=0,Pt=null,up(t)):(Le=0,Pt=null,rr(e,t,f,7));break;case 5:var y=null;switch(Ne.tag){case 26:y=Ne.memoizedState;case 5:case 27:var b=Ne;if(y?Xp(y):b.stateNode.complete){Le=0,Pt=null;var N=b.sibling;if(N!==null)Ne=N;else{var M=b.return;M!==null?(Ne=M,Zl(M)):Ne=null}break t}}Le=0,Pt=null,rr(e,t,f,5);break;case 6:Le=0,Pt=null,rr(e,t,f,6);break;case 8:zu(),We=6;break e;default:throw Error(l(462))}}db();break}catch($){rp(e,$)}while(!0);return qa=Qs=null,U.H=i,U.A=u,ze=n,Ne!==null?0:(Ie=null,Te=0,gl(),We)}function db(){for(;Ne!==null&&!al();)cp(Ne)}function cp(e){var t=Dm(e.alternate,e,Xa);e.memoizedProps=e.pendingProps,t===null?Zl(e):Ne=t}function up(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Tm(n,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Tm(n,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:Zc(t);default:zm(n,t),t=Ne=oh(t,Xa),t=Dm(n,t,Xa)}e.memoizedProps=e.pendingProps,t===null?Zl(e):Ne=t}function rr(e,t,n,i){qa=Qs=null,Zc(t),Jn=null,ni=0;var u=t.return;try{if(W0(e,u,t,n,Te)){We=1,Bl(e,ea(n,e.current)),Ne=null;return}}catch(f){if(u!==null)throw Ne=u,f;We=1,Bl(e,ea(n,e.current)),Ne=null;return}t.flags&32768?(ke||i===1?e=!0:tr||(Te&536870912)!==0?e=!1:(bs=e=!0,(i===2||i===9||i===3||i===6)&&(i=It.current,i!==null&&i.tag===13&&(i.flags|=16384))),dp(t,e)):Zl(t)}function Zl(e){var t=e;do{if((t.flags&32768)!==0){dp(t,bs);return}e=t.return;var n=ab(t.alternate,t,Xa);if(n!==null){Ne=n;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);We===0&&(We=5)}function dp(e,t){do{var n=sb(e.alternate,e);if(n!==null){n.flags&=32767,Ne=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=n}while(e!==null);We=6,Ne=null}function fp(e,t,n,i,u,f,y,b,N){e.cancelPendingCommit=null;do Fl();while(dt!==0);if((ze&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=jc,ec(e,n,f,y,b,N),e===Ie&&(Ne=Ie=null,Te=0),sr=t,_s=e,Qa=n,Ru=f,Du=u,tp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,pb(Ra,function(){return yp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=U.T,U.T=null,u=Q.p,Q.p=2,y=ze,ze|=4;try{nb(e,t,n)}finally{ze=y,Q.p=u,U.T=i}}dt=1,hp(),mp(),pp()}}function hp(){if(dt===1){dt=0;var e=_s,t=sr,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=U.T,U.T=null;var i=Q.p;Q.p=2;var u=ze;ze|=4;try{Ym(t,e);var f=Ju,y=Wf(e.containerInfo),b=f.focusedElem,N=f.selectionRange;if(y!==b&&b&&b.ownerDocument&&Ff(b.ownerDocument.documentElement,b)){if(N!==null&&bc(b)){var M=N.start,$=N.end;if($===void 0&&($=M),"selectionStart"in b)b.selectionStart=M,b.selectionEnd=Math.min($,b.value.length);else{var I=b.ownerDocument||document,z=I&&I.defaultView||window;if(z.getSelection){var L=z.getSelection(),ae=b.textContent.length,he=Math.min(N.start,ae),Ve=N.end===void 0?he:Math.min(N.end,ae);!L.extend&&he>Ve&&(y=Ve,Ve=he,he=y);var C=Zf(b,he),E=Zf(b,Ve);if(C&&E&&(L.rangeCount!==1||L.anchorNode!==C.node||L.anchorOffset!==C.offset||L.focusNode!==E.node||L.focusOffset!==E.offset)){var D=I.createRange();D.setStart(C.node,C.offset),L.removeAllRanges(),he>Ve?(L.addRange(D),L.extend(E.node,E.offset)):(D.setEnd(E.node,E.offset),L.addRange(D))}}}}for(I=[],L=b;L=L.parentNode;)L.nodeType===1&&I.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var H=I[b];H.element.scrollLeft=H.left,H.element.scrollTop=H.top}}uo=!!Yu,Ju=Yu=null}finally{ze=u,Q.p=i,U.T=n}}e.current=t,dt=2}}function mp(){if(dt===2){dt=0;var e=_s,t=sr,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=U.T,U.T=null;var i=Q.p;Q.p=2;var u=ze;ze|=4;try{Vm(e,t.alternate,t)}finally{ze=u,Q.p=i,U.T=n}}dt=3}}function pp(){if(dt===4||dt===3){dt=0,Ls();var e=_s,t=sr,n=Qa,i=tp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,sr=_s=null,gp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(ws=null),$s(n),t=t.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(Bs,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=U.T,u=Q.p,Q.p=2,U.T=null;try{for(var f=e.onRecoverableError,y=0;y<i.length;y++){var b=i[y];f(b.value,{componentStack:b.stack})}}finally{U.T=t,Q.p=u}}(Qa&3)!==0&&Fl(),_a(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===Mu?wi++:(wi=0,Mu=e):wi=0,_i(0)}}function gp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ai(t)))}function Fl(){return hp(),mp(),pp(),yp()}function yp(){if(dt!==5)return!1;var e=_s,t=Ru;Ru=0;var n=$s(Qa),i=U.T,u=Q.p;try{Q.p=32>n?32:n,U.T=null,n=Du,Du=null;var f=_s,y=Qa;if(dt=0,sr=_s=null,Qa=0,(ze&6)!==0)throw Error(l(331));var b=ze;if(ze|=4,Fm(f.current),Xm(f,f.current,y,n),ze=b,_i(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(Bs,f)}catch{}return!0}finally{Q.p=u,U.T=i,gp(e,t)}}function vp(e,t,n){t=ea(n,t),t=fu(e.stateNode,t,2),e=ps(e,t,2),e!==null&&(qs(e,2),_a(e))}function Be(e,t,n){if(e.tag===3)vp(e,e,n);else for(;t!==null;){if(t.tag===3){vp(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(ws===null||!ws.has(i))){e=ea(n,e),n=bm(2),i=ps(t,n,2),i!==null&&(xm(n,i,t,e),qs(i,2),_a(i));break}}t=t.return}}function Lu(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new lb;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(n)||(Cu=!0,u.add(n),e=fb.bind(null,e,t,n),t.then(e,e))}function fb(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ie===e&&(Te&n)===n&&(We===4||We===3&&(Te&62914560)===Te&&300>gt()-Kl?(ze&2)===0&&nr(e,0):ku|=n,ar===Te&&(ar=0)),_a(e)}function bp(e,t){t===0&&(t=nl()),e=Ys(e,t),e!==null&&(qs(e,t),_a(e))}function hb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bp(e,n)}function mb(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(n=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(l(314))}i!==null&&i.delete(t),bp(e,n)}function pb(e,t){return xn(e,t)}var Wl=null,ir=null,Bu=!1,eo=!1,qu=!1,js=0;function _a(e){e!==ir&&e.next===null&&(ir===null?Wl=ir=e:ir=ir.next=e),eo=!0,Bu||(Bu=!0,yb())}function _i(e,t){if(!qu&&eo){qu=!0;do for(var n=!1,i=Wl;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var y=i.suspendedLanes,b=i.pingedLanes;f=(1<<31-Ot(42|e)+1)-1,f&=u&~(y&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(n=!0,Sp(i,f))}else f=Te,f=En(i,i===Ie?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||ls(i,f)||(n=!0,Sp(i,f));i=i.next}while(n);qu=!1}}function gb(){xp()}function xp(){eo=Bu=!1;var e=0;js!==0&&Tb()&&(e=js);for(var t=gt(),n=null,i=Wl;i!==null;){var u=i.next,f=wp(i,t);f===0?(i.next=null,n===null?Wl=u:n.next=u,u===null&&(ir=n)):(n=i,(e!==0||(f&3)!==0)&&(eo=!0)),i=u}dt!==0&&dt!==5||_i(e),js!==0&&(js=0)}function wp(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-Ot(f),b=1<<y,N=u[y];N===-1?((b&n)===0||(b&i)!==0)&&(u[y]=Wo(b,t)):N<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ie,n=Te,n=En(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(Le===2||Le===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&is(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||ls(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&is(i),$s(n)){case 2:case 8:n=Hr;break;case 32:n=Ra;break;case 268435456:n=ga;break;default:n=Ra}return i=_p.bind(null,e),n=xn(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&is(i),e.callbackPriority=2,e.callbackNode=null,2}function _p(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Fl()&&e.callbackNode!==n)return null;var i=Te;return i=En(e,e===Ie?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(sp(e,i,t),wp(e,gt()),e.callbackNode!=null&&e.callbackNode===n?_p.bind(null,e):null)}function Sp(e,t){if(Fl())return null;sp(e,t,!0)}function yb(){Cb(function(){(ze&6)!==0?xn($r,gb):xp()})}function $u(){if(js===0){var e=Pn;e===0&&(e=Sn,Sn<<=1,(Sn&261888)===0&&(Sn=256)),js=e}return js}function jp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ol(""+e)}function Np(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function vb(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=jp((u[Dt]||null).action),y=i.submitter;y&&(t=(t=y[Dt]||null)?jp(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var b=new fl("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(js!==0){var N=y?Np(u,y):new FormData(u);iu(n,{pending:!0,data:N,method:u.method,action:f},null,N)}}else typeof f=="function"&&(b.preventDefault(),N=y?Np(u,y):new FormData(u),iu(n,{pending:!0,data:N,method:u.method,action:f},f,N))},currentTarget:u}]})}}for(var Hu=0;Hu<Sc.length;Hu++){var Vu=Sc[Hu],bb=Vu.toLowerCase(),xb=Vu[0].toUpperCase()+Vu.slice(1);oa(bb,"on"+xb)}oa(ah,"onAnimationEnd"),oa(sh,"onAnimationIteration"),oa(nh,"onAnimationStart"),oa("dblclick","onDoubleClick"),oa("focusin","onFocus"),oa("focusout","onBlur"),oa(U0,"onTransitionRun"),oa(L0,"onTransitionStart"),oa(B0,"onTransitionCancel"),oa(rh,"onTransitionEnd"),On("onMouseEnter",["mouseout","mouseover"]),On("onMouseLeave",["mouseout","mouseover"]),On("onPointerEnter",["pointerout","pointerover"]),On("onPointerLeave",["pointerout","pointerover"]),Is("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Is("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Is("onBeforeInput",["compositionend","keypress","textInput","paste"]),Is("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Is("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Is("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Si="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),wb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Si));function Ep(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var y=i.length-1;0<=y;y--){var b=i[y],N=b.instance,M=b.currentTarget;if(b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=M;try{f(u)}catch($){pl($)}u.currentTarget=null,f=N}else for(y=0;y<i.length;y++){if(b=i[y],N=b.instance,M=b.currentTarget,b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=M;try{f(u)}catch($){pl($)}u.currentTarget=null,f=N}}}}function Ee(e,t){var n=t[tc];n===void 0&&(n=t[tc]=new Set);var i=e+"__bubble";n.has(i)||(Tp(t,e,2,!1),n.add(i))}function Iu(e,t,n){var i=0;t&&(i|=4),Tp(n,e,i,t)}var to="_reactListening"+Math.random().toString(36).slice(2);function Gu(e){if(!e[to]){e[to]=!0,xf.forEach(function(n){n!=="selectionchange"&&(wb.has(n)||Iu(n,!1,e),Iu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[to]||(t[to]=!0,Iu("selectionchange",!1,t))}}function Tp(e,t,n,i){switch(ag(t)){case 2:var u=Xb;break;case 8:u=Qb;break;default:u=rd}n=u.bind(null,t,n,e),u=void 0,!uc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,n,{capture:!0,passive:u}):e.addEventListener(t,n,!0):u!==void 0?e.addEventListener(t,n,{passive:u}):e.addEventListener(t,n,!1)}function Pu(e,t,n,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var y=i.tag;if(y===3||y===4){var b=i.stateNode.containerInfo;if(b===u)break;if(y===4)for(y=i.return;y!==null;){var N=y.tag;if((N===3||N===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;b!==null;){if(y=An(b),y===null)return;if(N=y.tag,N===5||N===6||N===26||N===27){i=f=y;continue e}b=b.parentNode}}i=i.return}Rf(function(){var M=f,$=oc(n),I=[];e:{var z=ih.get(e);if(z!==void 0){var L=fl,ae=e;switch(e){case"keypress":if(ul(n)===0)break e;case"keydown":case"keyup":L=m0;break;case"focusin":ae="focus",L=mc;break;case"focusout":ae="blur",L=mc;break;case"beforeblur":case"afterblur":L=mc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=zf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=a0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=y0;break;case ah:case sh:case nh:L=r0;break;case rh:L=b0;break;case"scroll":case"scrollend":L=e0;break;case"wheel":L=w0;break;case"copy":case"cut":case"paste":L=l0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Lf;break;case"toggle":case"beforetoggle":L=S0}var he=(t&4)!==0,Ve=!he&&(e==="scroll"||e==="scrollend"),C=he?z!==null?z+"Capture":null:z;he=[];for(var E=M,D;E!==null;){var H=E;if(D=H.stateNode,H=H.tag,H!==5&&H!==26&&H!==27||D===null||C===null||(H=Pr(E,C),H!=null&&he.push(ji(E,H,D))),Ve)break;E=E.return}0<he.length&&(z=new L(z,ae,null,n,$),I.push({event:z,listeners:he}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",z&&n!==lc&&(ae=n.relatedTarget||n.fromElement)&&(An(ae)||ae[Tn]))break e;if((L||z)&&(z=$.window===$?$:(z=$.ownerDocument)?z.defaultView||z.parentWindow:window,L?(ae=n.relatedTarget||n.toElement,L=M,ae=ae?An(ae):null,ae!==null&&(Ve=d(ae),he=ae.tag,ae!==Ve||he!==5&&he!==27&&he!==6)&&(ae=null)):(L=null,ae=M),L!==ae)){if(he=zf,H="onMouseLeave",C="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(he=Lf,H="onPointerLeave",C="onPointerEnter",E="pointer"),Ve=L==null?z:Gr(L),D=ae==null?z:Gr(ae),z=new he(H,E+"leave",L,n,$),z.target=Ve,z.relatedTarget=D,H=null,An($)===M&&(he=new he(C,E+"enter",ae,n,$),he.target=D,he.relatedTarget=Ve,H=he),Ve=H,L&&ae)t:{for(he=_b,C=L,E=ae,D=0,H=C;H;H=he(H))D++;H=0;for(var ce=E;ce;ce=he(ce))H++;for(;0<D-H;)C=he(C),D--;for(;0<H-D;)E=he(E),H--;for(;D--;){if(C===E||E!==null&&C===E.alternate){he=C;break t}C=he(C),E=he(E)}he=null}else he=null;L!==null&&Ap(I,z,L,he,!1),ae!==null&&Ve!==null&&Ap(I,Ve,ae,he,!0)}}e:{if(z=M?Gr(M):window,L=z.nodeName&&z.nodeName.toLowerCase(),L==="select"||L==="input"&&z.type==="file")var De=Pf;else if(If(z))if(Kf)De=D0;else{De=O0;var le=k0}else L=z.nodeName,!L||L.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?M&&ic(M.elementType)&&(De=Pf):De=R0;if(De&&(De=De(e,M))){Gf(I,De,n,$);break e}le&&le(e,z,M),e==="focusout"&&M&&z.type==="number"&&M.memoizedProps.value!=null&&rc(z,"number",z.value)}switch(le=M?Gr(M):window,e){case"focusin":(If(le)||le.contentEditable==="true")&&(Ln=le,xc=M,Wr=null);break;case"focusout":Wr=xc=Ln=null;break;case"mousedown":wc=!0;break;case"contextmenu":case"mouseup":case"dragend":wc=!1,eh(I,n,$);break;case"selectionchange":if(z0)break;case"keydown":case"keyup":eh(I,n,$)}var we;if(gc)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 Un?Hf(e,n)&&(Ae="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ae="onCompositionStart");Ae&&(Bf&&n.locale!=="ko"&&(Un||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&Un&&(we=Df()):(os=$,dc="value"in os?os.value:os.textContent,Un=!0)),le=ao(M,Ae),0<le.length&&(Ae=new Uf(Ae,e,null,n,$),I.push({event:Ae,listeners:le}),we?Ae.data=we:(we=Vf(n),we!==null&&(Ae.data=we)))),(we=N0?E0(e,n):T0(e,n))&&(Ae=ao(M,"onBeforeInput"),0<Ae.length&&(le=new Uf("onBeforeInput","beforeinput",null,n,$),I.push({event:le,listeners:Ae}),le.data=we)),vb(I,e,M,n,$)}Ep(I,t)})}function ji(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ao(e,t){for(var n=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Pr(e,n),u!=null&&i.unshift(ji(e,u,f)),u=Pr(e,t),u!=null&&i.push(ji(e,u,f))),e.tag===3)return i;e=e.return}return[]}function _b(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ap(e,t,n,i,u){for(var f=t._reactName,y=[];n!==null&&n!==i;){var b=n,N=b.alternate,M=b.stateNode;if(b=b.tag,N!==null&&N===i)break;b!==5&&b!==26&&b!==27||M===null||(N=M,u?(M=Pr(n,f),M!=null&&y.unshift(ji(n,M,N))):u||(M=Pr(n,f),M!=null&&y.push(ji(n,M,N)))),n=n.return}y.length!==0&&e.push({event:t,listeners:y})}var Sb=/\r\n?/g,jb=/\u0000|\uFFFD/g;function Cp(e){return(typeof e=="string"?e:""+e).replace(Sb,`
|
|
9
|
-
`).replace(jb,"")}function kp(e,t){return t=Cp(t),Cp(e)===t}function He(e,t,n,i,u,f){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Dn(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Dn(e,""+i);break;case"className":il(e,"class",i);break;case"tabIndex":il(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":il(e,n,i);break;case"style":kf(e,i,f);break;case"data":if(t!=="object"){il(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=ol(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(n==="formAction"?(t!=="input"&&He(e,t,"name",u.name,u,null),He(e,t,"formEncType",u.formEncType,u,null),He(e,t,"formMethod",u.formMethod,u,null),He(e,t,"formTarget",u.formTarget,u,null)):(He(e,t,"encType",u.encType,u,null),He(e,t,"method",u.method,u,null),He(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=ol(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=za);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}n=ol(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,""+i):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),rl(e,"popover",i);break;case"xlinkActuate":Ma(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ma(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ma(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ma(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ma(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ma(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":rl(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Fv.get(n)||n,rl(e,n,i))}}function Ku(e,t,n,i,u,f){switch(n){case"style":kf(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}break;case"children":typeof i=="string"?Dn(e,i):(typeof i=="number"||typeof i=="bigint")&&Dn(e,""+i);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"onClick":i!=null&&(e.onclick=za);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wf.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(u=n.endsWith("Capture"),t=n.slice(2,u?n.length-7:void 0),f=e[Dt]||null,f=f!=null?f[n]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,u);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):rl(e,n,i)}}}function Nt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var i=!1,u=!1,f;for(f in n)if(n.hasOwnProperty(f)){var y=n[f];if(y!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,f,y,n,null)}}u&&He(e,t,"srcSet",n.srcSet,n,null),i&&He(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var b=f=y=u=null,N=null,M=null;for(i in n)if(n.hasOwnProperty(i)){var $=n[i];if($!=null)switch(i){case"name":u=$;break;case"type":y=$;break;case"checked":N=$;break;case"defaultChecked":M=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(l(137,t));break;default:He(e,t,i,$,n,null)}}Ef(e,f,b,N,M,y,u,!1);return;case"select":Ee("invalid",e),i=y=f=null;for(u in n)if(n.hasOwnProperty(u)&&(b=n[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":y=b;break;case"multiple":i=b;default:He(e,t,u,b,n,null)}t=f,n=y,e.multiple=!!i,t!=null?Rn(e,!!i,t,!1):n!=null&&Rn(e,!!i,n,!0);return;case"textarea":Ee("invalid",e),f=u=i=null;for(y in n)if(n.hasOwnProperty(y)&&(b=n[y],b!=null))switch(y){case"value":i=b;break;case"defaultValue":u=b;break;case"children":f=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(l(91));break;default:He(e,t,y,b,n,null)}Af(e,i,u,f);return;case"option":for(N in n)n.hasOwnProperty(N)&&(i=n[N],i!=null)&&(N==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":He(e,t,N,i,n,null));return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(i=0;i<Si.length;i++)Ee(Si[i],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(M in n)if(n.hasOwnProperty(M)&&(i=n[M],i!=null))switch(M){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,M,i,n,null)}return;default:if(ic(t)){for($ in n)n.hasOwnProperty($)&&(i=n[$],i!==void 0&&Ku(e,t,$,i,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(i=n[b],i!=null&&He(e,t,b,i,n,null))}function Nb(e,t,n,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,b=null,N=null,M=null,$=null;for(L in n){var I=n[L];if(n.hasOwnProperty(L)&&I!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":N=I;default:i.hasOwnProperty(L)||He(e,t,L,null,i,I)}}for(var z in i){var L=i[z];if(I=n[z],i.hasOwnProperty(z)&&(L!=null||I!=null))switch(z){case"type":f=L;break;case"name":u=L;break;case"checked":M=L;break;case"defaultChecked":$=L;break;case"value":y=L;break;case"defaultValue":b=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==I&&He(e,t,z,L,i,I)}}nc(e,y,b,N,M,$,f,u);return;case"select":L=y=b=z=null;for(f in n)if(N=n[f],n.hasOwnProperty(f)&&N!=null)switch(f){case"value":break;case"multiple":L=N;default:i.hasOwnProperty(f)||He(e,t,f,null,i,N)}for(u in i)if(f=i[u],N=n[u],i.hasOwnProperty(u)&&(f!=null||N!=null))switch(u){case"value":z=f;break;case"defaultValue":b=f;break;case"multiple":y=f;default:f!==N&&He(e,t,u,f,i,N)}t=b,n=y,i=L,z!=null?Rn(e,!!n,z,!1):!!i!=!!n&&(t!=null?Rn(e,!!n,t,!0):Rn(e,!!n,n?[]:"",!1));return;case"textarea":L=z=null;for(b in n)if(u=n[b],n.hasOwnProperty(b)&&u!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:He(e,t,b,null,i,u)}for(y in i)if(u=i[y],f=n[y],i.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":z=u;break;case"defaultValue":L=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&He(e,t,y,u,i,f)}Tf(e,z,L);return;case"option":for(var ae in n)z=n[ae],n.hasOwnProperty(ae)&&z!=null&&!i.hasOwnProperty(ae)&&(ae==="selected"?e.selected=!1:He(e,t,ae,null,i,z));for(N in i)z=i[N],L=n[N],i.hasOwnProperty(N)&&z!==L&&(z!=null||L!=null)&&(N==="selected"?e.selected=z&&typeof z!="function"&&typeof z!="symbol":He(e,t,N,z,i,L));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var he in n)z=n[he],n.hasOwnProperty(he)&&z!=null&&!i.hasOwnProperty(he)&&He(e,t,he,null,i,z);for(M in i)if(z=i[M],L=n[M],i.hasOwnProperty(M)&&z!==L&&(z!=null||L!=null))switch(M){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(l(137,t));break;default:He(e,t,M,z,i,L)}return;default:if(ic(t)){for(var Ve in n)z=n[Ve],n.hasOwnProperty(Ve)&&z!==void 0&&!i.hasOwnProperty(Ve)&&Ku(e,t,Ve,void 0,i,z);for($ in i)z=i[$],L=n[$],!i.hasOwnProperty($)||z===L||z===void 0&&L===void 0||Ku(e,t,$,z,i,L);return}}for(var C in n)z=n[C],n.hasOwnProperty(C)&&z!=null&&!i.hasOwnProperty(C)&&He(e,t,C,null,i,z);for(I in i)z=i[I],L=n[I],!i.hasOwnProperty(I)||z===L||z==null&&L==null||He(e,t,I,z,i,L)}function Op(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Eb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var u=n[i],f=u.transferSize,y=u.initiatorType,b=u.duration;if(f&&b&&Op(y)){for(y=0,b=u.responseEnd,i+=1;i<n.length;i++){var N=n[i],M=N.startTime;if(M>b)break;var $=N.transferSize,I=N.initiatorType;$&&Op(I)&&(N=N.responseEnd,y+=$*(N<b?1:(b-M)/(N-M)))}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 Yu=null,Ju=null;function so(e){return e.nodeType===9?e:e.ownerDocument}function Rp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Dp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Xu(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 Qu=null;function Tb(){var e=window.event;return e&&e.type==="popstate"?e===Qu?!1:(Qu=e,!0):(Qu=null,!1)}var Mp=typeof setTimeout=="function"?setTimeout:void 0,Ab=typeof clearTimeout=="function"?clearTimeout:void 0,zp=typeof Promise=="function"?Promise:void 0,Cb=typeof queueMicrotask=="function"?queueMicrotask:typeof zp<"u"?function(e){return zp.resolve(null).then(e).catch(kb)}:Mp;function kb(e){setTimeout(function(){throw e})}function Ns(e){return e==="head"}function Up(e,t){var n=t,i=0;do{var u=n.nextSibling;if(e.removeChild(n),u&&u.nodeType===8)if(n=u.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(u),ur(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Ni(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Ni(n);for(var f=n.firstChild;f;){var y=f.nextSibling,b=f.nodeName;f[Ir]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||n.removeChild(f),f=y}}else n==="body"&&Ni(e.ownerDocument.body);n=u}while(n);ur(t)}function Lp(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function Zu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Zu(n),ac(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Ob(e,t,n,i){for(;e.nodeType===1;){var u=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Ir])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=ra(e.nextSibling),e===null)break}return null}function Rb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ra(e.nextSibling),e===null))return null;return e}function Bp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ra(e.nextSibling),e===null))return null;return e}function Fu(e){return e.data==="$?"||e.data==="$~"}function Wu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Db(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function ra(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var ed=null;function qp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ra(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function $p(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Hp(e,t,n){switch(t=so(n),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function Ni(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ac(e)}var ia=new Map,Vp=new Set;function no(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Za=Q.d;Q.d={f:Mb,r:zb,D:Ub,C:Lb,L:Bb,m:qb,X:Hb,S:$b,M:Vb};function Mb(){var e=Za.f(),t=Xl();return e||t}function zb(e){var t=Cn(e);t!==null&&t.tag===5&&t.type==="form"?rm(t):Za.r(e)}var lr=typeof document>"u"?null:document;function Ip(e,t,n){var i=lr;if(i&&typeof t=="string"&&t){var u=Ft(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),Vp.has(u)||(Vp.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function Ub(e){Za.D(e),Ip("dns-prefetch",e,null)}function Lb(e,t){Za.C(e,t),Ip("preconnect",e,t)}function Bb(e,t,n){Za.L(e,t,n);var i=lr;if(i&&e&&t){var u='link[rel="preload"][as="'+Ft(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+Ft(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+Ft(n.imageSizes)+'"]')):u+='[href="'+Ft(e)+'"]';var f=u;switch(t){case"style":f=or(e);break;case"script":f=cr(e)}ia.has(f)||(e=_({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ia.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Ei(f))||t==="script"&&i.querySelector(Ti(f))||(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function qb(e,t){Za.m(e,t);var n=lr;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Ft(i)+'"][href="'+Ft(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=cr(e)}if(!ia.has(f)&&(e=_({rel:"modulepreload",href:e},t),ia.set(f,e),n.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ti(f)))return}i=n.createElement("link"),Nt(i,"link",e),vt(i),n.head.appendChild(i)}}}function $b(e,t,n){Za.S(e,t,n);var i=lr;if(i&&e){var u=kn(i).hoistableStyles,f=or(e);t=t||"default";var y=u.get(f);if(!y){var b={loading:0,preload:null};if(y=i.querySelector(Ei(f)))b.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ia.get(f))&&td(e,n);var N=y=i.createElement("link");vt(N),Nt(N,"link",e),N._p=new Promise(function(M,$){N.onload=M,N.onerror=$}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,ro(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},u.set(f,y)}}}function Hb(e,t){Za.X(e,t);var n=lr;if(n&&e){var i=kn(n).hoistableScripts,u=cr(e),f=i.get(u);f||(f=n.querySelector(Ti(u)),f||(e=_({src:e,async:!0},t),(t=ia.get(u))&&ad(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Vb(e,t){Za.M(e,t);var n=lr;if(n&&e){var i=kn(n).hoistableScripts,u=cr(e),f=i.get(u);f||(f=n.querySelector(Ti(u)),f||(e=_({src:e,async:!0,type:"module"},t),(t=ia.get(u))&&ad(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Gp(e,t,n,i){var u=(u=ye.current)?no(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=or(n.href),n=kn(u).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=or(n.href);var f=kn(u).hoistableStyles,y=f.get(e);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,y),(f=u.querySelector(Ei(e)))&&!f._p&&(y.instance=f,y.state.loading=5),ia.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ia.set(e,n),f||Ib(u,e,n,y.state))),t&&i===null)throw Error(l(528,""));return y}if(t&&i!==null)throw Error(l(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=cr(n),n=kn(u).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function or(e){return'href="'+Ft(e)+'"'}function Ei(e){return'link[rel="stylesheet"]['+e+"]"}function Pp(e){return _({},e,{"data-precedence":e.precedence,precedence:null})}function Ib(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Nt(t,"link",n),vt(t),e.head.appendChild(t))}function cr(e){return'[src="'+Ft(e)+'"]'}function Ti(e){return"script[async]"+e}function Kp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Ft(n.href)+'"]');if(i)return t.instance=i,vt(i),i;var u=_({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),vt(i),Nt(i,"style",u),ro(i,n.precedence,e),t.instance=i;case"stylesheet":u=or(n.href);var f=e.querySelector(Ei(u));if(f)return t.state.loading|=4,t.instance=f,vt(f),f;i=Pp(n),(u=ia.get(u))&&td(i,u),f=(e.ownerDocument||e).createElement("link"),vt(f);var y=f;return y._p=new Promise(function(b,N){y.onload=b,y.onerror=N}),Nt(f,"link",i),t.state.loading|=4,ro(f,n.precedence,e),t.instance=f;case"script":return f=cr(n.src),(u=e.querySelector(Ti(f)))?(t.instance=u,vt(u),u):(i=n,(u=ia.get(f))&&(i=_({},n),ad(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),vt(u),Nt(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,ro(i,n.precedence,e));return t.instance}function ro(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,y=0;y<i.length;y++){var b=i[y];if(b.dataset.precedence===t)f=b;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function td(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ad(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var io=null;function Yp(e,t,n){if(io===null){var i=new Map,u=io=new Map;u.set(n,i)}else u=io,i=u.get(n),i||(i=new Map,u.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),u=0;u<n.length;u++){var f=n[u];if(!(f[Ir]||f[ut]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(t)||"";y=e+y;var b=i.get(y);b?b.push(f):i.set(y,[f])}}return i}function Jp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Gb(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Xp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Pb(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var u=or(i.href),f=t.querySelector(Ei(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=lo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,vt(f);return}f=t.ownerDocument||t,i=Pp(i),(u=ia.get(u))&&td(i,u),f=f.createElement("link"),vt(f);var y=f;y._p=new Promise(function(b,N){y.onload=b,y.onerror=N}),Nt(f,"link",i),n.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=lo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var sd=0;function Kb(e,t){return e.stylesheets&&e.count===0&&co(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&co(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&sd===0&&(sd=62500*Eb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&co(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>sd?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function lo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)co(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var oo=null;function co(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oo=new Map,t.forEach(Yb,e),oo=null,lo.call(e))}function Yb(e,t){if(!(t.state.loading&4)){var n=oo.get(e);if(n)var i=n.get(null);else{n=new Map,oo.set(e,n);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(n.set(y.dataset.precedence,y),i=y)}i&&n.set(null,i)}u=t.instance,y=u.getAttribute("data-precedence"),f=n.get(y)||i,f===i&&n.set(null,u),n.set(y,u),this.count++,i=lo.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Ai={$$typeof:B,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Jb(e,t,n,i,u,f,y,b,N){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Vr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vr(0),this.hiddenUpdates=Vr(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Qp(e,t,n,i,u,f,y,b,N,M,$,I){return e=new Jb(e,t,n,y,N,M,$,I,b),t=1,f===!0&&(t|=24),f=Vt(3,null,null,t),e.current=f,f.stateNode=e,t=Uc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:n,cache:t},$c(f),e}function Zp(e){return e?(e=$n,e):$n}function Fp(e,t,n,i,u,f){u=Zp(u),i.context===null?i.context=u:i.pendingContext=u,i=ms(t),i.payload={element:n},f=f===void 0?null:f,f!==null&&(i.callback=f),n=ps(e,i,t),n!==null&&(qt(n,e,t),ii(n,e,t))}function Wp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function nd(e,t){Wp(e,t),(e=e.alternate)&&Wp(e,t)}function eg(e){if(e.tag===13||e.tag===31){var t=Ys(e,67108864);t!==null&&qt(t,e,67108864),nd(e,67108864)}}function tg(e){if(e.tag===13||e.tag===31){var t=Yt();t=yt(t);var n=Ys(e,t);n!==null&&qt(n,e,t),nd(e,t)}}var uo=!0;function Xb(e,t,n,i){var u=U.T;U.T=null;var f=Q.p;try{Q.p=2,rd(e,t,n,i)}finally{Q.p=f,U.T=u}}function Qb(e,t,n,i){var u=U.T;U.T=null;var f=Q.p;try{Q.p=8,rd(e,t,n,i)}finally{Q.p=f,U.T=u}}function rd(e,t,n,i){if(uo){var u=id(i);if(u===null)Pu(e,t,i,fo,n),sg(e,i);else if(Fb(u,e,t,n,i))i.stopPropagation();else if(sg(e,i),t&4&&-1<Zb.indexOf(e)){for(;u!==null;){var f=Cn(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=Da(f.pendingLanes);if(y!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;y;){var N=1<<31-Ot(y);b.entanglements[1]|=N,y&=~N}_a(f),(ze&6)===0&&(Yl=gt()+500,_i(0))}}break;case 31:case 13:b=Ys(f,2),b!==null&&qt(b,f,2),Xl(),nd(f,2)}if(f=id(i),f===null&&Pu(e,t,i,fo,n),f===u)break;u=f}u!==null&&i.stopPropagation()}else Pu(e,t,i,null,n)}}function id(e){return e=oc(e),ld(e)}var fo=null;function ld(e){if(fo=null,e=An(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fo=e,null}function ag(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(sl()){case $r:return 2;case Hr:return 8;case Ra:case wn:return 32;case ga:return 268435456;default:return 32}default:return 32}}var od=!1,Es=null,Ts=null,As=null,Ci=new Map,ki=new Map,Cs=[],Zb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function sg(e,t){switch(e){case"focusin":case"focusout":Es=null;break;case"dragenter":case"dragleave":Ts=null;break;case"mouseover":case"mouseout":As=null;break;case"pointerover":case"pointerout":Ci.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ki.delete(t.pointerId)}}function Oi(e,t,n,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=Cn(t),t!==null&&eg(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Fb(e,t,n,i,u){switch(t){case"focusin":return Es=Oi(Es,e,t,n,i,u),!0;case"dragenter":return Ts=Oi(Ts,e,t,n,i,u),!0;case"mouseover":return As=Oi(As,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return Ci.set(f,Oi(Ci.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,ki.set(f,Oi(ki.get(f)||null,e,t,n,i,u)),!0}return!1}function ng(e){var t=An(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,Vs(e.priority,function(){tg(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,Vs(e.priority,function(){tg(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ho(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=id(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);lc=i,n.target.dispatchEvent(i),lc=null}else return t=Cn(n),t!==null&&eg(t),e.blockedOn=n,!1;t.shift()}return!0}function rg(e,t,n){ho(e)&&n.delete(t)}function Wb(){od=!1,Es!==null&&ho(Es)&&(Es=null),Ts!==null&&ho(Ts)&&(Ts=null),As!==null&&ho(As)&&(As=null),Ci.forEach(rg),ki.forEach(rg)}function mo(e,t){e.blockedOn===t&&(e.blockedOn=null,od||(od=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Wb)))}var po=null;function ig(e){po!==e&&(po=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){po===e&&(po=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(ld(i||n)===null)continue;break}var f=Cn(n);f!==null&&(e.splice(t,3),t-=3,iu(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function ur(e){function t(N){return mo(N,e)}Es!==null&&mo(Es,e),Ts!==null&&mo(Ts,e),As!==null&&mo(As,e),Ci.forEach(t),ki.forEach(t);for(var n=0;n<Cs.length;n++){var i=Cs[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Cs.length&&(n=Cs[0],n.blockedOn===null);)ng(n),n.blockedOn===null&&Cs.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var u=n[i],f=n[i+1],y=u[Dt]||null;if(typeof f=="function")y||ig(n);else if(y){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[Dt]||null)b=y.formAction;else if(ld(u)!==null)continue}else b=y.action;typeof b=="function"?n[i+1]=b:(n.splice(i,3),i-=3),ig(n)}}}function lg(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function cd(e){this._internalRoot=e}go.prototype.render=cd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var n=t.current,i=Yt();Fp(n,i,e,t,null,null)},go.prototype.unmount=cd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fp(e.current,2,null,e,null,null),Xl(),t[Tn]=null}};function go(e){this._internalRoot=e}go.prototype.unstable_scheduleHydration=function(e){if(e){var t=Hs();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cs.length&&t!==0&&t<Cs[n].priority;n++);Cs.splice(n,0,e),n===0&&ng(e)}};var og=a.version;if(og!=="19.2.3")throw Error(l(527,og,"19.2.3"));Q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var ex={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yo.isDisabled&&yo.supportsFiber)try{Bs=yo.inject(ex),wt=yo}catch{}}return Di.createRoot=function(e,t){if(!c(e))throw Error(l(299));var n=!1,i="",u=pm,f=gm,y=ym;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Qp(e,1,!1,null,null,n,i,null,u,f,y,lg),e[Tn]=t.current,Gu(e),new cd(t)},Di.hydrateRoot=function(e,t,n){if(!c(e))throw Error(l(299));var i=!1,u="",f=pm,y=gm,b=ym,N=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(y=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError),n.formState!==void 0&&(N=n.formState)),t=Qp(e,1,!0,t,n??null,i,u,N,f,y,b,lg),t.context=Zp(null),n=t.current,i=Yt(),i=yt(i),u=ms(i),u.callback=null,ps(n,u,i),n=i,t.current.lanes=n,qs(t,n),_a(t),e[Tn]=t.current,Gu(e),new go(t)},Di.version="19.2.3",Di}var vg;function ux(){if(vg)return fd.exports;vg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),fd.exports=cx(),fd.exports}var dx=ux();const fx=af(dx);const hx=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mx=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),bg=s=>{const a=mx(s);return a.charAt(0).toUpperCase()+a.slice(1)},gy=(...s)=>s.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),px=s=>{for(const a in s)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var gx={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const yx=w.forwardRef(({color:s="currentColor",size:a=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},p)=>w.createElement("svg",{ref:p,...gx,width:a,height:a,stroke:s,strokeWidth:l?Number(r)*24/Number(a):r,className:gy("lucide",c),...!d&&!px(m)&&{"aria-hidden":"true"},...m},[...h.map(([g,v])=>w.createElement(g,v)),...Array.isArray(d)?d:[d]]));const ie=(s,a)=>{const r=w.forwardRef(({className:l,...c},d)=>w.createElement(yx,{ref:d,iconNode:a,className:gy(`lucide-${hx(bg(s))}`,`lucide-${s}`,l),...c}));return r.displayName=bg(s),r};const vx=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],bx=ie("activity",vx);const xx=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],wx=ie("archive",xx);const _x=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Sx=ie("arrow-down",_x);const jx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Nx=ie("arrow-left",jx);const Ex=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Tx=ie("arrow-up",Ex);const Ax=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],$i=ie("brain",Ax);const Cx=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],kx=ie("calendar",Cx);const Ox=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Rx=ie("camera",Ox);const Dx=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],yy=ie("chart-column",Dx);const Mx=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ja=ie("check",Mx);const zx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ux=ie("chevron-down",zx);const Lx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bx=ie("chevron-left",Lx);const qx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$x=ie("chevron-right",qx);const Hx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Vx=ie("chevron-up",Hx);const Ix=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Dr=ie("circle-alert",Ix);const Gx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],rf=ie("circle-check-big",Gx);const Px=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],lf=ie("circle-check",Px);const Kx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Yx=ie("circle-user",Kx);const Jx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Xx=ie("circle-x",Jx);const Qx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Cr=ie("clock",Qx);const Zx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],zs=ie("code",Zx);const Fx=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Wx=ie("copy",Fx);const ew=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],of=ie("cpu",ew);const tw=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Hi=ie("database",tw);const aw=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Vi=ie("external-link",aw);const sw=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],nw=ie("eye",sw);const rw=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],iw=ie("flag",rw);const lw=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ow=ie("hash",lw);const cw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],kr=ie("info",cw);const uw=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],dw=ie("key-round",uw);const fw=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],hw=ie("key",fw);const mw=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],pw=ie("layout-dashboard",mw);const gw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$t=ie("loader-circle",gw);const yw=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],vw=ie("log-in",yw);const bw=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],xw=ie("log-out",bw);const ww=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Ld=ie("mail",ww);const _w=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Sw=ie("minimize-2",_w);const jw=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Nw=ie("moon",jw);const Ew=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],xg=ie("paperclip",Ew);const Tw=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],gd=ie("pen",Tw);const Aw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Mi=ie("plus",Aw);const Cw=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],yd=ie("power",Cw);const kw=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Or=ie("refresh-cw",kw);const Ow=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],vy=ie("rotate-ccw",Ow);const Rw=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Dw=ie("save",Rw);const Mw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zw=ie("search",Mw);const Uw=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Lw=ie("send",Uw);const Bw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Bd=ie("settings",Bw);const qw=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],$w=ie("settings-2",qw);const Hw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],qd=ie("shield-check",Hw);const Vw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Iw=ie("shield",Vw);const Gw=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Pw=ie("sun",Gw);const Kw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],$d=ie("terminal",Kw);const Yw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Mo=ie("trash-2",Yw);const Jw=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Rr=ie("triangle-alert",Jw);const Xw=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Qw=ie("upload",Xw);const Zw=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Fw=ie("user-plus",Zw);const Ww=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],by=ie("user",Ww);const e_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],t_=ie("volume-2",e_);const a_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],s_=ie("volume-x",a_);const n_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],el=ie("x",n_);const r_=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],zo=ie("zap",r_),i_={theme:"system",setTheme:()=>null},xy=w.createContext(i_);function l_({children:s,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(xy.Provider,{value:d,children:s})}const o_=()=>{const s=w.useContext(xy);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s};function wg(s,a){if(typeof s=="function")return s(a);s!=null&&(s.current=a)}function Vo(...s){return a=>{let r=!1;const l=s.map(c=>{const d=wg(c,a);return!r&&typeof d=="function"&&(r=!0),d});if(r)return()=>{for(let c=0;c<l.length;c++){const d=l[c];typeof d=="function"?d():wg(s[c],null)}}}}function yn(...s){return w.useCallback(Vo(...s),s)}var c_=Symbol.for("react.lazy"),Uo=nf[" use ".trim().toString()];function u_(s){return typeof s=="object"&&s!==null&&"then"in s}function wy(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===c_&&"_payload"in s&&u_(s._payload)}function _y(s){const a=f_(s),r=w.forwardRef((l,c)=>{let{children:d,...h}=l;wy(d)&&typeof Uo=="function"&&(d=Uo(d._payload));const m=w.Children.toArray(d),p=m.find(m_);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}var d_=_y("Slot");function f_(s){const a=w.forwardRef((r,l)=>{let{children:c,...d}=r;if(wy(c)&&typeof Uo=="function"&&(c=Uo(c._payload)),w.isValidElement(c)){const h=g_(c),m=p_(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Vo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var h_=Symbol("radix.slottable");function m_(s){return w.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===h_}function p_(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function g_(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}function Sy(s){var a,r,l="";if(typeof s=="string"||typeof s=="number")l+=s;else if(typeof s=="object")if(Array.isArray(s)){var c=s.length;for(a=0;a<c;a++)s[a]&&(r=Sy(s[a]))&&(l&&(l+=" "),l+=r)}else for(r in s)s[r]&&(l&&(l+=" "),l+=r);return l}function jy(){for(var s,a,r=0,l="",c=arguments.length;r<c;r++)(s=arguments[r])&&(a=Sy(s))&&(l&&(l+=" "),l+=a);return l}const _g=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,Sg=jy,Ny=(s,a)=>r=>{var l;if(a?.variants==null)return Sg(s,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(g=>{const v=r?.[g],_=d?.[g];if(v===null)return null;const x=_g(v)||_g(_);return c[g][x]}),m=r&&Object.entries(r).reduce((g,v)=>{let[_,x]=v;return x===void 0||(g[_]=x),g},{}),p=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((g,v)=>{let{class:_,className:x,...S}=v;return Object.entries(S).every(A=>{let[j,O]=A;return Array.isArray(O)?O.includes({...d,...m}[j]):{...d,...m}[j]===O})?[...g,_,x]:g},[]);return Sg(s,h,p,r?.class,r?.className)},y_=(s,a)=>{const r=new Array(s.length+a.length);for(let l=0;l<s.length;l++)r[l]=s[l];for(let l=0;l<a.length;l++)r[s.length+l]=a[l];return r},v_=(s,a)=>({classGroupId:s,validator:a}),Ey=(s=new Map,a=null,r)=>({nextPart:s,validators:a,classGroupId:r}),Lo="-",jg=[],b_="arbitrary..",x_=s=>{const a=__(s),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=s;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return w_(h);const m=h.split(Lo),p=m[0]===""&&m.length>1?1:0;return Ty(m,p,a)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=l[h],g=r[h];return p?g?y_(g,p):p:g||jg}return r[h]||jg}}},Ty=(s,a,r)=>{if(s.length-a===0)return r.classGroupId;const c=s[a],d=r.nextPart.get(c);if(d){const g=Ty(s,a+1,d);if(g)return g}const h=r.validators;if(h===null)return;const m=a===0?s.join(Lo):s.slice(a).join(Lo),p=h.length;for(let g=0;g<p;g++){const v=h[g];if(v.validator(m))return v.classGroupId}},w_=s=>s.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=s.slice(1,-1),r=a.indexOf(":"),l=a.slice(0,r);return l?b_+l:void 0})(),__=s=>{const{theme:a,classGroups:r}=s;return S_(r,a)},S_=(s,a)=>{const r=Ey();for(const l in s){const c=s[l];cf(c,r,l,a)}return r},cf=(s,a,r,l)=>{const c=s.length;for(let d=0;d<c;d++){const h=s[d];j_(h,a,r,l)}},j_=(s,a,r,l)=>{if(typeof s=="string"){N_(s,a,r);return}if(typeof s=="function"){E_(s,a,r,l);return}T_(s,a,r,l)},N_=(s,a,r)=>{const l=s===""?a:Ay(a,s);l.classGroupId=r},E_=(s,a,r,l)=>{if(A_(s)){cf(s(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(v_(r,s))},T_=(s,a,r,l)=>{const c=Object.entries(s),d=c.length;for(let h=0;h<d;h++){const[m,p]=c[h];cf(p,Ay(a,m),r,l)}},Ay=(s,a)=>{let r=s;const l=a.split(Lo),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=Ey(),r.nextPart.set(h,m)),r=m}return r},A_=s=>"isThemeGetter"in s&&s.isThemeGetter===!0,C_=s=>{if(s<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),l=Object.create(null);const c=(d,h)=>{r[d]=h,a++,a>s&&(a=0,l=r,r=Object.create(null))};return{get(d){let h=r[d];if(h!==void 0)return h;if((h=l[d])!==void 0)return c(d,h),h},set(d,h){d in r?r[d]=h:c(d,h)}}},Hd="!",Ng=":",k_=[],Eg=(s,a,r,l,c)=>({modifiers:s,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),O_=s=>{const{prefix:a,experimentalParseClassName:r}=s;let l=c=>{const d=[];let h=0,m=0,p=0,g;const v=c.length;for(let j=0;j<v;j++){const O=c[j];if(h===0&&m===0){if(O===Ng){d.push(c.slice(p,j)),p=j+1;continue}if(O==="/"){g=j;continue}}O==="["?h++:O==="]"?h--:O==="("?m++:O===")"&&m--}const _=d.length===0?c:c.slice(p);let x=_,S=!1;_.endsWith(Hd)?(x=_.slice(0,-1),S=!0):_.startsWith(Hd)&&(x=_.slice(1),S=!0);const A=g&&g>p?g-p:void 0;return Eg(d,S,x,A)};if(a){const c=a+Ng,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):Eg(k_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},R_=s=>{const a=new Map;return s.orderSensitiveModifiers.forEach((r,l)=>{a.set(r,1e6+l)}),r=>{const l=[];let c=[];for(let d=0;d<r.length;d++){const h=r[d],m=h[0]==="[",p=a.has(h);m||p?(c.length>0&&(c.sort(),l.push(...c),c=[]),l.push(h)):c.push(h)}return c.length>0&&(c.sort(),l.push(...c)),l}},D_=s=>({cache:C_(s.cacheSize),parseClassName:O_(s),sortModifiers:R_(s),...x_(s)}),M_=/\s+/,z_=(s,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=s.trim().split(M_);let p="";for(let g=m.length-1;g>=0;g-=1){const v=m[g],{isExternal:_,modifiers:x,hasImportantModifier:S,baseClassName:A,maybePostfixModifierPosition:j}=r(v);if(_){p=v+(p.length>0?" "+p:p);continue}let O=!!j,R=l(O?A.substring(0,j):A);if(!R){if(!O){p=v+(p.length>0?" "+p:p);continue}if(R=l(A),!R){p=v+(p.length>0?" "+p:p);continue}O=!1}const q=x.length===0?"":x.length===1?x[0]:d(x).join(":"),B=S?q+Hd:q,G=B+R;if(h.indexOf(G)>-1)continue;h.push(G);const ee=c(R,O);for(let J=0;J<ee.length;++J){const P=ee[J];h.push(B+P)}p=v+(p.length>0?" "+p:p)}return p},U_=(...s)=>{let a=0,r,l,c="";for(;a<s.length;)(r=s[a++])&&(l=Cy(r))&&(c&&(c+=" "),c+=l);return c},Cy=s=>{if(typeof s=="string")return s;let a,r="";for(let l=0;l<s.length;l++)s[l]&&(a=Cy(s[l]))&&(r&&(r+=" "),r+=a);return r},L_=(s,...a)=>{let r,l,c,d;const h=p=>{const g=a.reduce((v,_)=>_(v),s());return r=D_(g),l=r.cache.get,c=r.cache.set,d=m,m(p)},m=p=>{const g=l(p);if(g)return g;const v=z_(p,r);return c(p,v),v};return d=h,(...p)=>d(U_(...p))},B_=[],ft=s=>{const a=r=>r[s]||B_;return a.isThemeGetter=!0,a},ky=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Oy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,q_=/^\d+\/\d+$/,$_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,V_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,I_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,dr=s=>q_.test(s),_e=s=>!!s&&!Number.isNaN(Number(s)),Os=s=>!!s&&Number.isInteger(Number(s)),vd=s=>s.endsWith("%")&&_e(s.slice(0,-1)),Fa=s=>$_.test(s),P_=()=>!0,K_=s=>H_.test(s)&&!V_.test(s),Ry=()=>!1,Y_=s=>I_.test(s),J_=s=>G_.test(s),X_=s=>!se(s)&&!ne(s),Q_=s=>Mr(s,zy,Ry),se=s=>ky.test(s),ln=s=>Mr(s,Uy,K_),bd=s=>Mr(s,t1,_e),Tg=s=>Mr(s,Dy,Ry),Z_=s=>Mr(s,My,J_),vo=s=>Mr(s,Ly,Y_),ne=s=>Oy.test(s),zi=s=>zr(s,Uy),F_=s=>zr(s,a1),Ag=s=>zr(s,Dy),W_=s=>zr(s,zy),e1=s=>zr(s,My),bo=s=>zr(s,Ly,!0),Mr=(s,a,r)=>{const l=ky.exec(s);return l?l[1]?a(l[1]):r(l[2]):!1},zr=(s,a,r=!1)=>{const l=Oy.exec(s);return l?l[1]?a(l[1]):r:!1},Dy=s=>s==="position"||s==="percentage",My=s=>s==="image"||s==="url",zy=s=>s==="length"||s==="size"||s==="bg-size",Uy=s=>s==="length",t1=s=>s==="number",a1=s=>s==="family-name",Ly=s=>s==="shadow",s1=()=>{const s=ft("color"),a=ft("font"),r=ft("text"),l=ft("font-weight"),c=ft("tracking"),d=ft("leading"),h=ft("breakpoint"),m=ft("container"),p=ft("spacing"),g=ft("radius"),v=ft("shadow"),_=ft("inset-shadow"),x=ft("text-shadow"),S=ft("drop-shadow"),A=ft("blur"),j=ft("perspective"),O=ft("aspect"),R=ft("ease"),q=ft("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ee=()=>[...G(),ne,se],J=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],X=()=>[ne,se,p],ue=()=>[dr,"full","auto",...X()],Je=()=>[Os,"none","subgrid",ne,se],be=()=>["auto",{span:["full",Os,ne,se]},Os,ne,se],ge=()=>[Os,"auto",ne,se],Ze=()=>["auto","min","max","fr",ne,se],st=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...X()],Q=()=>[dr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...X()],K=()=>[s,ne,se],je=()=>[...G(),Ag,Tg,{position:[ne,se]}],Re=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",W_,Q_,{size:[ne,se]}],V=()=>[vd,zi,ln],Y=()=>["","none","full",g,ne,se],W=()=>["",_e,zi,ln],fe=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[_e,vd,Ag,Tg],Ge=()=>["","none",A,ne,se],Ue=()=>["none",_e,ne,se],Ct=()=>["none",_e,ne,se],pt=()=>[_e,ne,se],xt=()=>[dr,"full",...X()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fa],breakpoint:[Fa],color:[P_],container:[Fa],"drop-shadow":[Fa],ease:["in","out","in-out"],font:[X_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fa],shadow:[Fa],spacing:["px",_e],text:[Fa],"text-shadow":[Fa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",dr,se,ne,O]}],container:["container"],columns:[{columns:[_e,se,ne,m]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:ee()}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ue()}],"inset-x":[{"inset-x":ue()}],"inset-y":[{"inset-y":ue()}],start:[{start:ue()}],end:[{end:ue()}],top:[{top:ue()}],right:[{right:ue()}],bottom:[{bottom:ue()}],left:[{left:ue()}],visibility:["visible","invisible","collapse"],z:[{z:[Os,"auto",ne,se]}],basis:[{basis:[dr,"full","auto",m,...X()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,dr,"auto","initial","none",se]}],grow:[{grow:["",_e,ne,se]}],shrink:[{shrink:["",_e,ne,se]}],order:[{order:[Os,"first","last","none",ne,se]}],"grid-cols":[{"grid-cols":Je()}],"col-start-end":[{col:be()}],"col-start":[{"col-start":ge()}],"col-end":[{"col-end":ge()}],"grid-rows":[{"grid-rows":Je()}],"row-start-end":[{row:be()}],"row-start":[{"row-start":ge()}],"row-end":[{"row-end":ge()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ze()}],"auto-rows":[{"auto-rows":Ze()}],gap:[{gap:X()}],"gap-x":[{"gap-x":X()}],"gap-y":[{"gap-y":X()}],"justify-content":[{justify:[...st(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...st()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":st()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:X()}],px:[{px:X()}],py:[{py:X()}],ps:[{ps:X()}],pe:[{pe:X()}],pt:[{pt:X()}],pr:[{pr:X()}],pb:[{pb:X()}],pl:[{pl:X()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":X()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":X()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[m,"screen",...Q()]}],"min-w":[{"min-w":[m,"screen","none",...Q()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",r,zi,ln]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,ne,bd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",vd,se]}],"font-family":[{font:[F_,se,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,ne,se]}],"line-clamp":[{"line-clamp":[_e,"none",ne,bd]}],leading:[{leading:[d,...X()]}],"list-image":[{"list-image":["none",ne,se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ne,se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",ne,ln]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[_e,"auto",ne,se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:X()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ne,se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ne,se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:je()}],"bg-repeat":[{bg:Re()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Os,ne,se],radial:["",ne,se],conic:[Os,ne,se]},e1,Z_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded: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:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"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:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,ne,se]}],"outline-w":[{outline:["",_e,zi,ln]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",v,bo,vo]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",_,bo,vo]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[_e,ln]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",x,bo,vo]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[_e,ne,se]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":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,se]}],"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":[_e]}],"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:je()}],"mask-repeat":[{mask:Re()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ne,se]}],filter:[{filter:["","none",ne,se]}],blur:[{blur:Ge()}],brightness:[{brightness:[_e,ne,se]}],contrast:[{contrast:[_e,ne,se]}],"drop-shadow":[{"drop-shadow":["","none",S,bo,vo]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",_e,ne,se]}],"hue-rotate":[{"hue-rotate":[_e,ne,se]}],invert:[{invert:["",_e,ne,se]}],saturate:[{saturate:[_e,ne,se]}],sepia:[{sepia:["",_e,ne,se]}],"backdrop-filter":[{"backdrop-filter":["","none",ne,se]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[_e,ne,se]}],"backdrop-contrast":[{"backdrop-contrast":[_e,ne,se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,ne,se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,ne,se]}],"backdrop-invert":[{"backdrop-invert":["",_e,ne,se]}],"backdrop-opacity":[{"backdrop-opacity":[_e,ne,se]}],"backdrop-saturate":[{"backdrop-saturate":[_e,ne,se]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,ne,se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":X()}],"border-spacing-x":[{"border-spacing-x":X()}],"border-spacing-y":[{"border-spacing-y":X()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ne,se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",ne,se]}],ease:[{ease:["linear","initial",R,ne,se]}],delay:[{delay:[_e,ne,se]}],animate:[{animate:["none",q,ne,se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,ne,se]}],"perspective-origin":[{"perspective-origin":ee()}],rotate:[{rotate:Ue()}],"rotate-x":[{"rotate-x":Ue()}],"rotate-y":[{"rotate-y":Ue()}],"rotate-z":[{"rotate-z":Ue()}],scale:[{scale:Ct()}],"scale-x":[{"scale-x":Ct()}],"scale-y":[{"scale-y":Ct()}],"scale-z":[{"scale-z":Ct()}],"scale-3d":["scale-3d"],skew:[{skew:pt()}],"skew-x":[{"skew-x":pt()}],"skew-y":[{"skew-y":pt()}],transform:[{transform:[ne,se,"","none","gpu","cpu"]}],"transform-origin":[{origin:ee()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xt()}],"translate-x":[{"translate-x":xt()}],"translate-y":[{"translate-y":xt()}],"translate-z":[{"translate-z":xt()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ne,se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":X()}],"scroll-mx":[{"scroll-mx":X()}],"scroll-my":[{"scroll-my":X()}],"scroll-ms":[{"scroll-ms":X()}],"scroll-me":[{"scroll-me":X()}],"scroll-mt":[{"scroll-mt":X()}],"scroll-mr":[{"scroll-mr":X()}],"scroll-mb":[{"scroll-mb":X()}],"scroll-ml":[{"scroll-ml":X()}],"scroll-p":[{"scroll-p":X()}],"scroll-px":[{"scroll-px":X()}],"scroll-py":[{"scroll-py":X()}],"scroll-ps":[{"scroll-ps":X()}],"scroll-pe":[{"scroll-pe":X()}],"scroll-pt":[{"scroll-pt":X()}],"scroll-pr":[{"scroll-pr":X()}],"scroll-pb":[{"scroll-pb":X()}],"scroll-pl":[{"scroll-pl":X()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ne,se]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[_e,zi,ln,bd]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},n1=L_(s1);function Oe(...s){return n1(jy(s))}const r1=Ny("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Z=w.forwardRef(({className:s,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?d_:"button";return o.jsx(h,{className:Oe(r1({variant:a,size:r,className:s})),ref:d,...c})});Z.displayName="Button";function By(){const{setTheme:s,theme:a}=o_();return o.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>s(a==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground w-8 px-0",title:`Switch to ${a==="dark"?"light":"dark"} mode`,children:[a==="dark"?o.jsx(Pw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(Nw,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var Na=function(){return Na=Object.assign||function(a){for(var r,l=1,c=arguments.length;l<c;l++){r=arguments[l];for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&(a[d]=r[d])}return a},Na.apply(this,arguments)};function Ur(s,a){var r={};for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&a.indexOf(l)<0&&(r[l]=s[l]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(s);c<l.length;c++)a.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(s,l[c])&&(r[l[c]]=s[l[c]]);return r}function i1(s,a,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(v){try{g(l.next(v))}catch(_){h(_)}}function p(v){try{g(l.throw(v))}catch(_){h(_)}}function g(v){v.done?d(v.value):c(v.value).then(m,p)}g((l=l.apply(s,a||[])).next())})}function l1(s,a,r){if(r||arguments.length===2)for(var l=0,c=a.length,d;l<c;l++)(d||!(l in a))&&(d||(d=Array.prototype.slice.call(a,0,l)),d[l]=a[l]);return s.concat(d||Array.prototype.slice.call(a))}const o1=s=>s?(...a)=>s(...a):(...a)=>fetch(...a);class uf extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class c1 extends uf{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class Cg extends uf{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class kg extends uf{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Vd;(function(s){s.Any="any",s.ApNortheast1="ap-northeast-1",s.ApNortheast2="ap-northeast-2",s.ApSouth1="ap-south-1",s.ApSoutheast1="ap-southeast-1",s.ApSoutheast2="ap-southeast-2",s.CaCentral1="ca-central-1",s.EuCentral1="eu-central-1",s.EuWest1="eu-west-1",s.EuWest2="eu-west-2",s.EuWest3="eu-west-3",s.SaEast1="sa-east-1",s.UsEast1="us-east-1",s.UsWest1="us-west-1",s.UsWest2="us-west-2"})(Vd||(Vd={}));class u1{constructor(a,{headers:r={},customFetch:l,region:c=Vd.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=o1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return i1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:p,body:g,signal:v,timeout:_}=l;let x={},{region:S}=l;S||(S=this.region);const A=new URL(`${this.url}/${r}`);S&&S!=="any"&&(x["x-region"]=S,A.searchParams.set("forceFunctionRegion",S));let j;g&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&g instanceof Blob||g instanceof ArrayBuffer?(x["Content-Type"]="application/octet-stream",j=g):typeof g=="string"?(x["Content-Type"]="text/plain",j=g):typeof FormData<"u"&&g instanceof FormData?j=g:(x["Content-Type"]="application/json",j=JSON.stringify(g)):g&&typeof g!="string"&&!(typeof Blob<"u"&&g instanceof Blob)&&!(g instanceof ArrayBuffer)&&!(typeof FormData<"u"&&g instanceof FormData)?j=JSON.stringify(g):j=g;let O=v;_&&(h=new AbortController,d=setTimeout(()=>h.abort(),_),v?(O=h.signal,v.addEventListener("abort",()=>h.abort())):O=h.signal);const R=yield this.fetch(A.toString(),{method:p||"POST",headers:Object.assign(Object.assign(Object.assign({},x),this.headers),m),body:j,signal:O}).catch(ee=>{throw new c1(ee)}),q=R.headers.get("x-relay-error");if(q&&q==="true")throw new Cg(R);if(!R.ok)throw new kg(R);let B=((c=R.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),G;return B==="application/json"?G=yield R.json():B==="application/octet-stream"||B==="application/pdf"?G=yield R.blob():B==="text/event-stream"?G=R:B==="multipart/form-data"?G=yield R.formData():G=yield R.text(),{data:G,error:null,response:R}}catch(m){return{data:null,error:m,response:m instanceof kg||m instanceof Cg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var d1=class extends Error{constructor(s){super(s.message),this.name="PostgrestError",this.details=s.details,this.hint=s.hint,this.code=s.code}},f1=class{constructor(s){var a,r;this.shouldThrowOnError=!1,this.method=s.method,this.url=s.url,this.headers=new Headers(s.headers),this.schema=s.schema,this.body=s.body,this.shouldThrowOnError=(a=s.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=s.signal,this.isMaybeSingle=(r=s.isMaybeSingle)!==null&&r!==void 0?r:!1,s.fetch?this.fetch=s.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(s,a){return this.headers=new Headers(this.headers),this.headers.set(s,a),this}then(s,a){var r=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const l=this.fetch;let c=l(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async d=>{let h=null,m=null,p=null,g=d.status,v=d.statusText;if(d.ok){var _,x;if(r.method!=="HEAD"){var S;const R=await d.text();R===""||(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=R:m=JSON.parse(R))}const j=(_=r.headers.get("Prefer"))===null||_===void 0?void 0:_.match(/count=(exact|planned|estimated)/),O=(x=d.headers.get("content-range"))===null||x===void 0?void 0:x.split("/");j&&O&&O.length>1&&(p=parseInt(O[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(m)&&(m.length>1?(h={code:"PGRST116",details:`Results contain ${m.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},m=null,p=null,g=406,v="Not Acceptable"):m.length===1?m=m[0]:m=null)}else{var A;const j=await d.text();try{h=JSON.parse(j),Array.isArray(h)&&d.status===404&&(m=[],h=null,g=200,v="OK")}catch{d.status===404&&j===""?(g=204,v="No Content"):h={message:j}}if(h&&r.isMaybeSingle&&(!(h==null||(A=h.details)===null||A===void 0)&&A.includes("0 rows"))&&(h=null,g=200,v="OK"),h&&r.shouldThrowOnError)throw new d1(h)}return{error:h,data:m,count:p,status:g,statusText:v}});return this.shouldThrowOnError||(c=c.catch(d=>{var h;let m="";const p=d?.cause;if(p){var g,v,_,x;const A=(g=p?.message)!==null&&g!==void 0?g:"",j=(v=p?.code)!==null&&v!==void 0?v:"";m=`${(_=d?.name)!==null&&_!==void 0?_:"FetchError"}: ${d?.message}`,m+=`
|
|
10
|
-
|
|
11
|
-
Caused by: ${(x=p?.name)!==null&&x!==void 0?x:"Error"}: ${A}`,j&&(m+=` (${j})`),p?.stack&&(m+=`
|
|
12
|
-
${p.stack}`)}else{var S;m=(S=d?.stack)!==null&&S!==void 0?S:""}return{error:{message:`${(h=d?.name)!==null&&h!==void 0?h:"FetchError"}: ${d?.message}`,details:m,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),c.then(s,a)}returns(){return this}overrideTypes(){return this}},h1=class extends f1{select(s){let a=!1;const r=(s??"*").split("").map(l=>/\s/.test(l)&&!a?"":(l==='"'&&(a=!a),l)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(s,{ascending:a=!0,nullsFirst:r,foreignTable:l,referencedTable:c=l}={}){const d=c?`${c}.order`:"order",h=this.url.searchParams.get(d);return this.url.searchParams.set(d,`${h?`${h},`:""}${s}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(s,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${s}`),this}range(s,a,{foreignTable:r,referencedTable:l=r}={}){const c=typeof l>"u"?"offset":`${l}.offset`,d=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(c,`${s}`),this.url.searchParams.set(d,`${a-s+1}`),this}abortSignal(s){return this.signal=s,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:s=!1,verbose:a=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[s?"analyze":null,a?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),p=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${p}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(s){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${s}`),this}};const Og=new RegExp("[,()]");var wr=class extends h1{eq(s,a){return this.url.searchParams.append(s,`eq.${a}`),this}neq(s,a){return this.url.searchParams.append(s,`neq.${a}`),this}gt(s,a){return this.url.searchParams.append(s,`gt.${a}`),this}gte(s,a){return this.url.searchParams.append(s,`gte.${a}`),this}lt(s,a){return this.url.searchParams.append(s,`lt.${a}`),this}lte(s,a){return this.url.searchParams.append(s,`lte.${a}`),this}like(s,a){return this.url.searchParams.append(s,`like.${a}`),this}likeAllOf(s,a){return this.url.searchParams.append(s,`like(all).{${a.join(",")}}`),this}likeAnyOf(s,a){return this.url.searchParams.append(s,`like(any).{${a.join(",")}}`),this}ilike(s,a){return this.url.searchParams.append(s,`ilike.${a}`),this}ilikeAllOf(s,a){return this.url.searchParams.append(s,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(s,a){return this.url.searchParams.append(s,`ilike(any).{${a.join(",")}}`),this}regexMatch(s,a){return this.url.searchParams.append(s,`match.${a}`),this}regexIMatch(s,a){return this.url.searchParams.append(s,`imatch.${a}`),this}is(s,a){return this.url.searchParams.append(s,`is.${a}`),this}isDistinct(s,a){return this.url.searchParams.append(s,`isdistinct.${a}`),this}in(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Og.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`in.(${r})`),this}notIn(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Og.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`not.in.(${r})`),this}contains(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cs.{${a.join(",")}}`):this.url.searchParams.append(s,`cs.${JSON.stringify(a)}`),this}containedBy(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cd.{${a.join(",")}}`):this.url.searchParams.append(s,`cd.${JSON.stringify(a)}`),this}rangeGt(s,a){return this.url.searchParams.append(s,`sr.${a}`),this}rangeGte(s,a){return this.url.searchParams.append(s,`nxl.${a}`),this}rangeLt(s,a){return this.url.searchParams.append(s,`sl.${a}`),this}rangeLte(s,a){return this.url.searchParams.append(s,`nxr.${a}`),this}rangeAdjacent(s,a){return this.url.searchParams.append(s,`adj.${a}`),this}overlaps(s,a){return typeof a=="string"?this.url.searchParams.append(s,`ov.${a}`):this.url.searchParams.append(s,`ov.{${a.join(",")}}`),this}textSearch(s,a,{config:r,type:l}={}){let c="";l==="plain"?c="pl":l==="phrase"?c="ph":l==="websearch"&&(c="w");const d=r===void 0?"":`(${r})`;return this.url.searchParams.append(s,`${c}fts${d}.${a}`),this}match(s){return Object.entries(s).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(s,a,r){return this.url.searchParams.append(s,`not.${a}.${r}`),this}or(s,{foreignTable:a,referencedTable:r=a}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${s})`),this}filter(s,a,r){return this.url.searchParams.append(s,`${a}.${r}`),this}},m1=class{constructor(s,{headers:a={},schema:r,fetch:l}){this.url=s,this.headers=new Headers(a),this.schema=r,this.fetch=l}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(s,a){const{head:r=!1,count:l}=a??{},c=r?"HEAD":"GET";let d=!1;const h=(s??"*").split("").map(g=>/\s/.test(g)&&!d?"":(g==='"'&&(d=!d),g)).join(""),{url:m,headers:p}=this.cloneRequestState();return m.searchParams.set("select",h),l&&p.append("Prefer",`count=${l}`),new wr({method:c,url:m,headers:p,schema:this.schema,fetch:this.fetch})}insert(s,{count:a,defaultToNull:r=!0}={}){var l;const c="POST",{url:d,headers:h}=this.cloneRequestState();if(a&&h.append("Prefer",`count=${a}`),r||h.append("Prefer","missing=default"),Array.isArray(s)){const m=s.reduce((p,g)=>p.concat(Object.keys(g)),[]);if(m.length>0){const p=[...new Set(m)].map(g=>`"${g}"`);d.searchParams.set("columns",p.join(","))}}return new wr({method:c,url:d,headers:h,schema:this.schema,body:s,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(s,{onConflict:a,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:p}=this.cloneRequestState();if(p.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),a!==void 0&&m.searchParams.set("on_conflict",a),l&&p.append("Prefer",`count=${l}`),c||p.append("Prefer","missing=default"),Array.isArray(s)){const g=s.reduce((v,_)=>v.concat(Object.keys(_)),[]);if(g.length>0){const v=[...new Set(g)].map(_=>`"${_}"`);m.searchParams.set("columns",v.join(","))}}return new wr({method:h,url:m,headers:p,schema:this.schema,body:s,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(s,{count:a}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return a&&d.append("Prefer",`count=${a}`),new wr({method:l,url:c,headers:d,schema:this.schema,body:s,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:s}={}){var a;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return s&&c.append("Prefer",`count=${s}`),new wr({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},p1=class qy{constructor(a,{headers:r={},schema:l,fetch:c}={}){this.url=a,this.headers=new Headers(r),this.schemaName=l,this.fetch=c}from(a){if(!a||typeof a!="string"||a.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new m1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new qy(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,r={},{head:l=!1,get:c=!1,count:d}={}){var h;let m;const p=new URL(`${this.url}/rpc/${a}`);let g;const v=S=>S!==null&&typeof S=="object"&&(!Array.isArray(S)||S.some(v)),_=l&&Object.values(r).some(v);_?(m="POST",g=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([S,A])=>A!==void 0).map(([S,A])=>[S,Array.isArray(A)?`{${A.join(",")}}`:`${A}`]).forEach(([S,A])=>{p.searchParams.append(S,A)})):(m="POST",g=r);const x=new Headers(this.headers);return _?x.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&x.set("Prefer",`count=${d}`),new wr({method:m,url:p,headers:x,schema:this.schemaName,body:g,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class g1{constructor(){}static detectEnvironment(){var a;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((a=navigator.userAgent)===null||a===void 0)&&a.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const r=globalThis.process;if(r){const l=r.versions;if(l&&l.node){const c=l.node,d=parseInt(c.replace(/^v/,"").split(".")[0]);return d>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${d} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${d} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
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 y1="2.90.1",v1=`realtime-js/${y1}`,$y="1.0.0",b1="2.0.0",Rg=$y,Id=1e4,x1=1e3,w1=100;var Ds;(function(s){s[s.connecting=0]="connecting",s[s.open=1]="open",s[s.closing=2]="closing",s[s.closed=3]="closed"})(Ds||(Ds={}));var ht;(function(s){s.closed="closed",s.errored="errored",s.joined="joined",s.joining="joining",s.leaving="leaving"})(ht||(ht={}));var ha;(function(s){s.close="phx_close",s.error="phx_error",s.join="phx_join",s.reply="phx_reply",s.leave="phx_leave",s.access_token="access_token"})(ha||(ha={}));var Gd;(function(s){s.websocket="websocket"})(Gd||(Gd={}));var dn;(function(s){s.Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed"})(dn||(dn={}));class _1{constructor(a){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=a??[]}encode(a,r){if(a.event===this.BROADCAST_EVENT&&!(a.payload instanceof ArrayBuffer)&&typeof a.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(a));let l=[a.join_ref,a.ref,a.topic,a.event,a.payload];return r(JSON.stringify(l))}_binaryEncodeUserBroadcastPush(a){var r;return this._isArrayBuffer((r=a.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(a):this._encodeJsonUserBroadcastPush(a)}_encodeBinaryUserBroadcastPush(a){var r,l;const c=(l=(r=a.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:new ArrayBuffer(0);return this._encodeUserBroadcastPush(a,this.BINARY_ENCODING,c)}_encodeJsonUserBroadcastPush(a){var r,l;const c=(l=(r=a.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:{},h=new TextEncoder().encode(JSON.stringify(c)).buffer;return this._encodeUserBroadcastPush(a,this.JSON_ENCODING,h)}_encodeUserBroadcastPush(a,r,l){var c,d;const h=a.topic,m=(c=a.ref)!==null&&c!==void 0?c:"",p=(d=a.join_ref)!==null&&d!==void 0?d:"",g=a.payload.event,v=this.allowedMetadataKeys?this._pick(a.payload,this.allowedMetadataKeys):{},_=Object.keys(v).length===0?"":JSON.stringify(v);if(p.length>255)throw new Error(`joinRef length ${p.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`ref length ${m.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`topic length ${h.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`userEvent length ${g.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const x=this.USER_BROADCAST_PUSH_META_LENGTH+p.length+m.length+h.length+g.length+_.length,S=new ArrayBuffer(this.HEADER_LENGTH+x);let A=new DataView(S),j=0;A.setUint8(j++,this.KINDS.userBroadcastPush),A.setUint8(j++,p.length),A.setUint8(j++,m.length),A.setUint8(j++,h.length),A.setUint8(j++,g.length),A.setUint8(j++,_.length),A.setUint8(j++,r),Array.from(p,R=>A.setUint8(j++,R.charCodeAt(0))),Array.from(m,R=>A.setUint8(j++,R.charCodeAt(0))),Array.from(h,R=>A.setUint8(j++,R.charCodeAt(0))),Array.from(g,R=>A.setUint8(j++,R.charCodeAt(0))),Array.from(_,R=>A.setUint8(j++,R.charCodeAt(0)));var O=new Uint8Array(S.byteLength+l.byteLength);return O.set(new Uint8Array(S),0),O.set(new Uint8Array(l),S.byteLength),O.buffer}decode(a,r){if(this._isArrayBuffer(a)){let l=this._binaryDecode(a);return r(l)}if(typeof a=="string"){const l=JSON.parse(a),[c,d,h,m,p]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:p})}return r({})}_binaryDecode(a){const r=new DataView(a),l=r.getUint8(0),c=new TextDecoder;if(l===this.KINDS.userBroadcast)return this._decodeUserBroadcast(a,r,c)}_decodeUserBroadcast(a,r,l){const c=r.getUint8(1),d=r.getUint8(2),h=r.getUint8(3),m=r.getUint8(4);let p=this.HEADER_LENGTH+4;const g=l.decode(a.slice(p,p+c));p=p+c;const v=l.decode(a.slice(p,p+d));p=p+d;const _=l.decode(a.slice(p,p+h));p=p+h;const x=a.slice(p,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(x)):x,A={type:this.BROADCAST_EVENT,event:v,payload:S};return h>0&&(A.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:g,event:this.BROADCAST_EVENT,payload:A}}_isArrayBuffer(a){var r;return a instanceof ArrayBuffer||((r=a?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(a,r){return!a||typeof a!="object"?{}:Object.fromEntries(Object.entries(a).filter(([l])=>r.includes(l)))}}class Hy{constructor(a,r){this.callback=a,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=a,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Pe;(function(s){s.abstime="abstime",s.bool="bool",s.date="date",s.daterange="daterange",s.float4="float4",s.float8="float8",s.int2="int2",s.int4="int4",s.int4range="int4range",s.int8="int8",s.int8range="int8range",s.json="json",s.jsonb="jsonb",s.money="money",s.numeric="numeric",s.oid="oid",s.reltime="reltime",s.text="text",s.time="time",s.timestamp="timestamp",s.timestamptz="timestamptz",s.timetz="timetz",s.tsrange="tsrange",s.tstzrange="tstzrange"})(Pe||(Pe={}));const Dg=(s,a,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return a?Object.keys(a).reduce((d,h)=>(d[h]=S1(h,s,a,c),d),{}):{}},S1=(s,a,r,l)=>{const c=a.find(m=>m.name===s),d=c?.type,h=r[s];return d&&!l.includes(d)?Vy(d,h):Pd(h)},Vy=(s,a)=>{if(s.charAt(0)==="_"){const r=s.slice(1,s.length);return T1(a,r)}switch(s){case Pe.bool:return j1(a);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return N1(a);case Pe.json:case Pe.jsonb:return E1(a);case Pe.timestamp:return A1(a);case Pe.abstime:case Pe.date:case Pe.daterange:case Pe.int4range:case Pe.int8range:case Pe.money:case Pe.reltime:case Pe.text:case Pe.time:case Pe.timestamptz:case Pe.timetz:case Pe.tsrange:case Pe.tstzrange:return Pd(a);default:return Pd(a)}},Pd=s=>s,j1=s=>{switch(s){case"t":return!0;case"f":return!1;default:return s}},N1=s=>{if(typeof s=="string"){const a=parseFloat(s);if(!Number.isNaN(a))return a}return s},E1=s=>{if(typeof s=="string")try{return JSON.parse(s)}catch{return s}return s},T1=(s,a)=>{if(typeof s!="string")return s;const r=s.length-1,l=s[r];if(s[0]==="{"&&l==="}"){let d;const h=s.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Vy(a,m))}return s},A1=s=>typeof s=="string"?s.replace(" ","T"):s,Iy=s=>{const a=new URL(s);return a.protocol=a.protocol.replace(/^ws/i,"http"),a.pathname=a.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),a.pathname===""||a.pathname==="/"?a.pathname="/api/broadcast":a.pathname=a.pathname+"/api/broadcast",a.href};class xd{constructor(a,r,l={},c=Id){this.channel=a,this.event=r,this.payload=l,this.timeout=c,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(a){this.timeout=a,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(a){this.payload=Object.assign(Object.assign({},this.payload),a)}receive(a,r){var l;return this._hasReceived(a)&&r((l=this.receivedResp)===null||l===void 0?void 0:l.response),this.recHooks.push({status:a,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const a=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},a),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(a,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:a,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:a,response:r}){this.recHooks.filter(l=>l.status===a).forEach(l=>l.callback(r))}_hasReceived(a){return this.receivedResp&&this.receivedResp.status===a}}var Mg;(function(s){s.SYNC="sync",s.JOIN="join",s.LEAVE="leave"})(Mg||(Mg={}));class Li{constructor(a,r){this.channel=a,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const l=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(l.state,{},c=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Li.syncState(this.state,c,d,h),this.pendingDiffs.forEach(p=>{this.state=Li.syncDiff(this.state,p,d,h)}),this.pendingDiffs=[],m()}),this.channel._on(l.diff,{},c=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(c):(this.state=Li.syncDiff(this.state,c,d,h),m())}),this.onJoin((c,d,h)=>{this.channel._trigger("presence",{event:"join",key:c,currentPresences:d,newPresences:h})}),this.onLeave((c,d,h)=>{this.channel._trigger("presence",{event:"leave",key:c,currentPresences:d,leftPresences:h})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(a,r,l,c){const d=this.cloneDeep(a),h=this.transformState(r),m={},p={};return this.map(d,(g,v)=>{h[g]||(p[g]=v)}),this.map(h,(g,v)=>{const _=d[g];if(_){const x=v.map(O=>O.presence_ref),S=_.map(O=>O.presence_ref),A=v.filter(O=>S.indexOf(O.presence_ref)<0),j=_.filter(O=>x.indexOf(O.presence_ref)<0);A.length>0&&(m[g]=A),j.length>0&&(p[g]=j)}else m[g]=v}),this.syncDiff(d,{joins:m,leaves:p},l,c)}static syncDiff(a,r,l,c){const{joins:d,leaves:h}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return l||(l=()=>{}),c||(c=()=>{}),this.map(d,(m,p)=>{var g;const v=(g=a[m])!==null&&g!==void 0?g:[];if(a[m]=this.cloneDeep(p),v.length>0){const _=a[m].map(S=>S.presence_ref),x=v.filter(S=>_.indexOf(S.presence_ref)<0);a[m].unshift(...x)}l(m,v,p)}),this.map(h,(m,p)=>{let g=a[m];if(!g)return;const v=p.map(_=>_.presence_ref);g=g.filter(_=>v.indexOf(_.presence_ref)<0),a[m]=g,c(m,g,p),g.length===0&&delete a[m]}),a}static map(a,r){return Object.getOwnPropertyNames(a).map(l=>r(l,a[l]))}static transformState(a){return a=this.cloneDeep(a),Object.getOwnPropertyNames(a).reduce((r,l)=>{const c=a[l];return"metas"in c?r[l]=c.metas.map(d=>(d.presence_ref=d.phx_ref,delete d.phx_ref,delete d.phx_ref_prev,d)):r[l]=c,r},{})}static cloneDeep(a){return JSON.parse(JSON.stringify(a))}onJoin(a){this.caller.onJoin=a}onLeave(a){this.caller.onLeave=a}onSync(a){this.caller.onSync=a}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var zg;(function(s){s.ALL="*",s.INSERT="INSERT",s.UPDATE="UPDATE",s.DELETE="DELETE"})(zg||(zg={}));var Bi;(function(s){s.BROADCAST="broadcast",s.PRESENCE="presence",s.POSTGRES_CHANGES="postgres_changes",s.SYSTEM="system"})(Bi||(Bi={}));var Wa;(function(s){s.SUBSCRIBED="SUBSCRIBED",s.TIMED_OUT="TIMED_OUT",s.CLOSED="CLOSED",s.CHANNEL_ERROR="CHANNEL_ERROR"})(Wa||(Wa={}));class Nr{constructor(a,r={config:{}},l){var c,d;if(this.topic=a,this.params=r,this.socket=l,this.bindings={},this.state=ht.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=a.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new xd(this,ha.join,this.params,this.timeout),this.rejoinTimer=new Hy(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ht.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(h=>h.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=ht.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ha.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new Li(this),this.broadcastEndpointURL=Iy(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((d=(c=this.params.config)===null||c===void 0?void 0:c.broadcast)===null||d===void 0)&&d.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(a,r=this.timeout){var l,c,d;if(this.socket.isConnected()||this.socket.connect(),this.state==ht.closed){const{config:{broadcast:h,presence:m,private:p}}=this.params,g=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(S=>S.filter))!==null&&c!==void 0?c:[],v=!!this.bindings[Bi.PRESENCE]&&this.bindings[Bi.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,_={},x={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:v}),postgres_changes:g,private:p};this.socket.accessTokenValue&&(_.access_token=this.socket.accessTokenValue),this._onError(S=>a?.(Wa.CHANNEL_ERROR,S)),this._onClose(()=>a?.(Wa.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?.(Wa.SUBSCRIBED);return}else{const j=this.bindings.postgres_changes,O=(A=j?.length)!==null&&A!==void 0?A:0,R=[];for(let q=0;q<O;q++){const B=j[q],{filter:{event:G,schema:ee,table:J,filter:P}}=B,X=S&&S[q];if(X&&X.event===G&&Nr.isFilterValueEqual(X.schema,ee)&&Nr.isFilterValueEqual(X.table,J)&&Nr.isFilterValueEqual(X.filter,P))R.push(Object.assign(Object.assign({},B),{id:X.id}));else{this.unsubscribe(),this.state=ht.errored,a?.(Wa.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=R,a&&a(Wa.SUBSCRIBED);return}}).receive("error",S=>{this.state=ht.errored,a?.(Wa.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{a?.(Wa.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(a,r={}){return await this.send({type:"presence",event:"track",payload:a},r.timeout||this.timeout)}async untrack(a={}){return await this.send({type:"presence",event:"untrack"},a)}on(a,r,l){return this.state===ht.joined&&a===Bi.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(a,r,l)}async httpSend(a,r,l={}){var c;if(r==null)return Promise.reject("Payload is required for httpSend()");const d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:r,private:this.private}]})},m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(c=l.timeout)!==null&&c!==void 0?c:this.timeout);if(m.status===202)return{success:!0};let p=m.statusText;try{const g=await m.json();p=g.error||g.message||p}catch{}return Promise.reject(new Error(p))}async send(a,r={}){var l,c;if(!this._canPush()&&a.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:d,payload:h}=a,m={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(m.Authorization=`Bearer ${this.socket.accessTokenValue}`);const p={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const g=await this._fetchWithTimeout(this.broadcastEndpointURL,p,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=g.body)===null||c===void 0?void 0:c.cancel()),g.ok?"ok":"error"}catch(g){return g.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,p;const g=this._push(a.type,a,r.timeout||this.timeout);a.type==="broadcast"&&!(!((p=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||p===void 0)&&p.ack)&&d("ok"),g.receive("ok",()=>d("ok")),g.receive("error",()=>d("error")),g.receive("timeout",()=>d("timed out"))})}updateJoinPayload(a){this.joinPush.updatePayload(a)}unsubscribe(a=this.timeout){this.state=ht.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ha.close,"leave",this._joinRef())};this.joinPush.destroy();let l=null;return new Promise(c=>{l=new xd(this,ha.leave,{},a),l.receive("ok",()=>{r(),c("ok")}).receive("timeout",()=>{r(),c("timed out")}).receive("error",()=>{c("error")}),l.send(),this._canPush()||l.trigger("ok",{})}).finally(()=>{l?.destroy()})}teardown(){this.pushBuffer.forEach(a=>a.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ht.closed,this.bindings={}}async _fetchWithTimeout(a,r,l){const c=new AbortController,d=setTimeout(()=>c.abort(),l),h=await this.socket.fetch(a,Object.assign(Object.assign({},r),{signal:c.signal}));return clearTimeout(d),h}_push(a,r,l=this.timeout){if(!this.joinedOnce)throw`tried to push '${a}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let c=new xd(this,a,r,l);return this._canPush()?c.send():this._addToPushBuffer(c),c}_addToPushBuffer(a){if(a.startTimeout(),this.pushBuffer.push(a),this.pushBuffer.length>w1){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(a,r,l){return r}_isMember(a){return this.topic===a}_joinRef(){return this.joinPush.ref}_trigger(a,r,l){var c,d;const h=a.toLocaleLowerCase(),{close:m,error:p,leave:g,join:v}=ha;if(l&&[m,p,g,v].indexOf(h)>=0&&l!==this._joinRef())return;let x=this._onMessage(h,r,l);if(r&&!x)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(h)?(c=this.bindings.postgres_changes)===null||c===void 0||c.filter(S=>{var A,j,O;return((A=S.filter)===null||A===void 0?void 0:A.event)==="*"||((O=(j=S.filter)===null||j===void 0?void 0:j.event)===null||O===void 0?void 0:O.toLocaleLowerCase())===h}).map(S=>S.callback(x,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var A,j,O,R,q,B,G,ee;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const J=S.id,P=(A=S.filter)===null||A===void 0?void 0:A.event;return J&&((j=r.ids)===null||j===void 0?void 0:j.includes(J))&&(P==="*"||P?.toLocaleLowerCase()===((O=r.data)===null||O===void 0?void 0:O.type.toLocaleLowerCase()))&&(!(!((R=S.filter)===null||R===void 0)&&R.table)||S.filter.table===((q=r.data)===null||q===void 0?void 0:q.table))}else{const J=(G=(B=S?.filter)===null||B===void 0?void 0:B.event)===null||G===void 0?void 0:G.toLocaleLowerCase();return J==="*"||J===((ee=r?.event)===null||ee===void 0?void 0:ee.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===h}).map(S=>{if(typeof x=="object"&&"ids"in x){const A=x.data,{schema:j,table:O,commit_timestamp:R,type:q,errors:B}=A;x=Object.assign(Object.assign({},{schema:j,table:O,commit_timestamp:R,eventType:q,new:{},old:{},errors:B}),this._getPayloadRecords(A))}S.callback(x,l)})}_isClosed(){return this.state===ht.closed}_isJoined(){return this.state===ht.joined}_isJoining(){return this.state===ht.joining}_isLeaving(){return this.state===ht.leaving}_replyEventName(a){return`chan_reply_${a}`}_on(a,r,l){const c=a.toLocaleLowerCase(),d={type:c,filter:r,callback:l};return this.bindings[c]?this.bindings[c].push(d):this.bindings[c]=[d],this}_off(a,r){const l=a.toLocaleLowerCase();return this.bindings[l]&&(this.bindings[l]=this.bindings[l].filter(c=>{var d;return!(((d=c.type)===null||d===void 0?void 0:d.toLocaleLowerCase())===l&&Nr.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(ha.close,{},a)}_onError(a){this._on(ha.error,{},r=>a(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(a=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ht.joining,this.joinPush.resend(a))}_getPayloadRecords(a){const r={new:{},old:{}};return(a.type==="INSERT"||a.type==="UPDATE")&&(r.new=Dg(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Dg(a.columns,a.old_record)),r}}const wd=()=>{},xo={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},C1=[1e3,2e3,5e3,1e4],k1=1e4,O1=`
|
|
17
|
-
addEventListener("message", (e) => {
|
|
18
|
-
if (e.data.event === "start") {
|
|
19
|
-
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
20
|
-
}
|
|
21
|
-
});`;class R1{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=Id,this.transport=null,this.heartbeatIntervalMs=xo.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=wd,this.ref=0,this.reconnectTimer=null,this.vsn=Rg,this.logger=wd,this.conn=null,this.sendBuffer=[],this.serializer=new _1,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}/${Gd.websocket}`,this.httpEndpoint=Iy(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=g1.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 Ds.connecting:return dn.Connecting;case Ds.open:return dn.Open;case Ds.closing:return dn.Closing;default:return dn.Closed}}isConnected(){return this.connectionState()===dn.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 Nr(`realtime:${a}`,r,this);return this.channels.push(d),d}}push(a){const{topic:r,event:l,payload:c,ref:d}=a,h=()=>{this.encode(a,m=>{var p;(p=this.conn)===null||p===void 0||p.send(m)})};this.log("push",`${r} ${l} (${d})`,c),this.isConnected()?h():this.sendBuffer.push(h)}async setAuth(a=null){this._authPromise=this._performAuth(a);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var a;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(a=this.conn)===null||a===void 0||a.close(x1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},xo.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(a){this.heartbeatCallback=a}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(a=>a()),this.sendBuffer=[])}_makeRef(){let a=this.ref+1;return a===this.ref?this.ref=0:this.ref=a,this.ref.toString()}_leaveOpenTopic(a){let r=this.channels.find(l=>l.topic===a&&(l._isJoined()||l._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${a}"`),r.unsubscribe())}_remove(a){this.channels=this.channels.filter(r=>r.topic!==a.topic)}_onConnMessage(a){this.decode(a.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply"&&r.ref&&r.ref===this.pendingHeartbeatRef){const g=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",g)}catch(v){this.log("error","error in heartbeat callback",v)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:l,event:c,payload:d,ref:h}=r,m=h?`(${h})`:"",p=d.status||"";this.log("receive",`${p} ${l} ${c} ${m}`.trim(),d),this.channels.filter(g=>g._isMember(l)).forEach(g=>g._trigger(c,d,h)),this._triggerStateCallbacks("message",r)})}_clearTimer(a){var r;a==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):a==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=a=>this._onConnError(a),this.conn.onmessage=a=>this._onConnMessage(a),this.conn.onclose=a=>this._onConnClose(a),this.conn.readyState===Ds.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Ds.open||this.conn.readyState===Ds.connecting)try{this.conn.close()}catch(a){this.log("error","Error closing connection",a)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(a=>a.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const a=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(a),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(a){var r;this._setConnectionState("disconnected"),this.log("transport","close",a),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",a)}_onConnError(a){this._setConnectionState("disconnected"),this.log("transport",`${a}`),this._triggerChanError(),this._triggerStateCallbacks("error",a)}_triggerChanError(){this.channels.forEach(a=>a._trigger(ha.error))}_appendParams(a,r){if(Object.keys(r).length===0)return a;const l=a.match(/\?/)?"&":"?",c=new URLSearchParams(r);return`${a}${l}${c}`}_workerObjectUrl(a){let r;if(a)r=a;else{const l=new Blob([O1],{type:"application/javascript"});r=URL.createObjectURL(l)}return r}_setConnectionState(a,r=!1){this._connectionState=a,a==="connecting"?this._wasManualDisconnect=!1:a==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(a=null){let r,l=!1;if(a)r=a,l=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(c){this.log("error","Error fetching access token from callback",c),r=this.accessTokenValue}else r=this.accessTokenValue;l?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(c=>{const d={access_token:r,version:v1};r&&c.updateJoinPayload(d),c.joinedOnce&&c._isJoined()&&c._push(ha.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(a="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${a}`,r)})}_triggerStateCallbacks(a,r){try{this.stateChangeCallbacks[a].forEach(l=>{try{l(r)}catch(c){this.log("error",`error in ${a} callback`,c)}})}catch(l){this.log("error",`error triggering ${a} callbacks`,l)}}_setupReconnectionTimer(){this.reconnectTimer=new Hy(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},xo.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(a){var r,l,c,d,h,m,p,g,v,_,x,S;switch(this.transport=(r=a?.transport)!==null&&r!==void 0?r:null,this.timeout=(l=a?.timeout)!==null&&l!==void 0?l:Id,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:xo.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:wd,this.vsn=(p=a?.vsn)!==null&&p!==void 0?p:Rg,a?.params&&(this.params=a.params),a?.logger&&(this.logger=a.logger),(a?.logLevel||a?.log_level)&&(this.logLevel=a.logLevel||a.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(g=a?.reconnectAfterMs)!==null&&g!==void 0?g:(A=>C1[A-1]||k1),this.vsn){case $y:this.encode=(v=a?.encode)!==null&&v!==void 0?v:((A,j)=>j(JSON.stringify(A))),this.decode=(_=a?.decode)!==null&&_!==void 0?_:((A,j)=>j(JSON.parse(A)));break;case b1:this.encode=(x=a?.encode)!==null&&x!==void 0?x:this.serializer.encode.bind(this.serializer),this.decode=(S=a?.decode)!==null&&S!==void 0?S:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=a?.workerUrl}}}var Ii=class extends Error{constructor(s,a){super(s),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown=a.icebergType==="CommitStateUnknownException"||[500,502,504].includes(a.status)&&a.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function D1(s,a,r){const l=new URL(a,s);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function M1(s){return!s||s.type==="none"?{}:s.type==="bearer"?{Authorization:`Bearer ${s.token}`}:s.type==="header"?{[s.name]:s.value}:s.type==="custom"?await s.getHeaders():{}}function z1(s){const a=s.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=D1(s.baseUrl,l,c),p=await M1(s.auth),g=await a(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...p,...h},body:d?JSON.stringify(d):void 0}),v=await g.text(),_=(g.headers.get("content-type")||"").includes("application/json"),x=_&&v?JSON.parse(v):v;if(!g.ok){const S=_?x:void 0,A=S?.error;throw new Ii(A?.message??`Request failed with status ${g.status}`,{status:g.status,icebergType:A?.type,icebergCode:A?.code,details:S})}return{status:g.status,headers:g.headers,data:x}}}}function wo(s){return s.join("")}var U1=class{constructor(s,a=""){this.client=s,this.prefix=a}async listNamespaces(s){const a=s?{parent:wo(s.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(s,a){const r={namespace:s.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(s){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${wo(s.namespace)}`})}async loadNamespaceMetadata(s){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${wo(s.namespace)}`})).data.properties}}async namespaceExists(s){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${wo(s.namespace)}`}),!0}catch(a){if(a instanceof Ii&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(s,a){try{return await this.createNamespace(s,a)}catch(r){if(r instanceof Ii&&r.status===409)return;throw r}}};function fr(s){return s.join("")}var L1=class{constructor(s,a="",r){this.client=s,this.prefix=a,this.accessDelegation=r}async listTables(s){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${fr(s.namespace)}/tables`})).data.identifiers}async createTable(s,a){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${fr(s.namespace)}/tables`,body:a,headers:r})).data.metadata}async updateTable(s,a){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${fr(s.namespace)}/tables/${s.name}`,body:a});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(s,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${fr(s.namespace)}/tables/${s.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(s){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${fr(s.namespace)}/tables/${s.name}`,headers:a})).data.metadata}async tableExists(s){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${fr(s.namespace)}/tables/${s.name}`,headers:a}),!0}catch(r){if(r instanceof Ii&&r.status===404)return!1;throw r}}async createTableIfNotExists(s,a){try{return await this.createTable(s,a)}catch(r){if(r instanceof Ii&&r.status===409)return await this.loadTable({namespace:s.namespace,name:a.name});throw r}}},B1=class{constructor(s){let a="v1";s.catalogName&&(a+=`/${s.catalogName}`);const r=s.baseUrl.endsWith("/")?s.baseUrl:`${s.baseUrl}/`;this.client=z1({baseUrl:r,auth:s.auth,fetchImpl:s.fetch}),this.accessDelegation=s.accessDelegation?.join(","),this.namespaceOps=new U1(this.client,a),this.tableOps=new L1(this.client,a,this.accessDelegation)}async listNamespaces(s){return this.namespaceOps.listNamespaces(s)}async createNamespace(s,a){return this.namespaceOps.createNamespace(s,a)}async dropNamespace(s){await this.namespaceOps.dropNamespace(s)}async loadNamespaceMetadata(s){return this.namespaceOps.loadNamespaceMetadata(s)}async listTables(s){return this.tableOps.listTables(s)}async createTable(s,a){return this.tableOps.createTable(s,a)}async updateTable(s,a){return this.tableOps.updateTable(s,a)}async dropTable(s,a){await this.tableOps.dropTable(s,a)}async loadTable(s){return this.tableOps.loadTable(s)}async namespaceExists(s){return this.namespaceOps.namespaceExists(s)}async tableExists(s){return this.tableOps.tableExists(s)}async createNamespaceIfNotExists(s,a){return this.namespaceOps.createNamespaceIfNotExists(s,a)}async createTableIfNotExists(s,a){return this.tableOps.createTableIfNotExists(s,a)}},Io=class extends Error{constructor(s){super(s),this.__isStorageError=!0,this.name="StorageError"}};function Qe(s){return typeof s=="object"&&s!==null&&"__isStorageError"in s}var q1=class extends Io{constructor(s,a,r){super(s),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Kd=class extends Io{constructor(s,a){super(s),this.name="StorageUnknownError",this.originalError=a}};const df=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),$1=()=>Response,Yd=s=>{if(Array.isArray(s))return s.map(r=>Yd(r));if(typeof s=="function"||s!==Object(s))return s;const a={};return Object.entries(s).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));a[c]=Yd(l)}),a},H1=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},V1=s=>!s||typeof s!="string"||s.length===0||s.length>100||s.trim()!==s||s.includes("/")||s.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(s);function Gi(s){"@babel/helpers - typeof";return Gi=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},Gi(s)}function I1(s,a){if(Gi(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Gi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function G1(s){var a=I1(s,"string");return Gi(a)=="symbol"?a:a+""}function P1(s,a,r){return(a=G1(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Ug(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function pe(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Ug(Object(r),!0).forEach(function(l){P1(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Ug(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const _d=s=>{var a;return s.msg||s.message||s.error_description||(typeof s.error=="string"?s.error:(a=s.error)===null||a===void 0?void 0:a.message)||JSON.stringify(s)},K1=async(s,a,r)=>{s instanceof await $1()&&!r?.noResolveJson?s.json().then(l=>{const c=s.status||500,d=l?.statusCode||c+"";a(new q1(_d(l),c,d))}).catch(l=>{a(new Kd(_d(l),l))}):a(new Kd(_d(s),s))},Y1=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="GET"||!l?c:(H1(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 tl(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,Y1(a,l,c,d)).then(p=>{if(!p.ok)throw p;return l?.noResolveJson?p:p.json()}).then(p=>h(p)).catch(p=>K1(p,m,l))})}async function Pi(s,a,r,l){return tl(s,"GET",a,r,l)}async function fa(s,a,r,l,c){return tl(s,"POST",a,l,c,r)}async function Jd(s,a,r,l,c){return tl(s,"PUT",a,l,c,r)}async function J1(s,a,r,l){return tl(s,"HEAD",a,pe(pe({},r),{},{noResolveJson:!0}),l)}async function ff(s,a,r,l,c){return tl(s,"DELETE",a,l,c,r)}var X1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a}then(s,a){return this.execute().then(s,a)}async execute(){var s=this;try{return{data:(await s.downloadFn()).body,error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};let Gy;Gy=Symbol.toStringTag;var Q1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a,this[Gy]="BlobDownloadBuilder",this.promise=null}asStream(){return new X1(this.downloadFn,this.shouldThrowOnError)}then(s,a){return this.getPromise().then(s,a)}catch(s){return this.getPromise().catch(s)}finally(s){return this.getPromise().finally(s)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var s=this;try{return{data:await(await s.downloadFn()).blob(),error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};const Z1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Lg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var F1=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1,this.url=s,this.headers=a,this.bucketId=r,this.fetch=df(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(s,a,r,l){var c=this;try{let d;const h=pe(pe({},Lg),l);let m=pe(pe({},c.headers),s==="POST"&&{"x-upsert":String(h.upsert)});const p=h.metadata;typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),p&&d.append("metadata",c.encodeMetadata(p)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),p&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(p))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,p&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(p))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!h.duplex&&(h.duplex="half")),l?.headers&&(m=pe(pe({},m),l.headers));const g=c._removeEmptyFolders(a),v=c._getFinalPath(g),_=await(s=="PUT"?Jd:fa)(c.fetch,`${c.url}/object/${v}`,d,pe({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:g,id:_.Id,fullPath:_.Key},error:null}}catch(d){if(c.shouldThrowOnError)throw d;if(Qe(d))return{data:null,error:d};throw d}}async upload(s,a,r){return this.uploadOrUpdate("POST",s,a,r)}async uploadToSignedUrl(s,a,r,l){var c=this;const d=c._removeEmptyFolders(s),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);m.searchParams.set("token",a);try{let p;const g=pe({upsert:Lg.upsert},l),v=pe(pe({},c.headers),{"x-upsert":String(g.upsert)});return typeof Blob<"u"&&r instanceof Blob?(p=new FormData,p.append("cacheControl",g.cacheControl),p.append("",r)):typeof FormData<"u"&&r instanceof FormData?(p=r,p.append("cacheControl",g.cacheControl)):(p=r,v["cache-control"]=`max-age=${g.cacheControl}`,v["content-type"]=g.contentType),{data:{path:d,fullPath:(await Jd(c.fetch,m.toString(),p,{headers:v})).Key},error:null}}catch(p){if(c.shouldThrowOnError)throw p;if(Qe(p))return{data:null,error:p};throw p}}async createSignedUploadUrl(s,a){var r=this;try{let l=r._getFinalPath(s);const c=pe({},r.headers);a?.upsert&&(c["x-upsert"]="true");const d=await fa(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 Io("No token returned by API");return{data:{signedUrl:h.toString(),path:s,token:m},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async update(s,a,r){return this.uploadOrUpdate("PUT",s,a,r)}async move(s,a,r){var l=this;try{return{data:await fa(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:s,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers}),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async copy(s,a,r){var l=this;try{return{data:{path:(await fa(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:s,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers})).Key},error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async createSignedUrl(s,a,r){var l=this;try{let c=l._getFinalPath(s),d=await fa(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(s,a,r){var l=this;try{const c=await fa(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:a,paths:s},{headers:l.headers}),d=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:c.map(h=>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(s,a){const r=typeof a?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(a?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(s),h=()=>Pi(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new Q1(h,this.shouldThrowOnError)}async info(s){var a=this;const r=a._getFinalPath(s);try{return{data:Yd(await Pi(a.fetch,`${a.url}/object/info/${r}`,{headers:a.headers})),error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async exists(s){var a=this;const r=a._getFinalPath(s);try{return await J1(a.fetch,`${a.url}/object/${r}`,{headers:a.headers}),{data:!0,error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Qe(l)&&l instanceof Kd){const c=l.originalError;if([400,404].includes(c?.status))return{data:!1,error:l}}throw l}}getPublicUrl(s,a){const r=this._getFinalPath(s),l=[],c=a?.download?`download=${a.download===!0?"":a.download}`:"";c!==""&&l.push(c);const d=typeof a?.transform<"u"?"render/image":"object",h=this.transformOptsToQueryString(a?.transform||{});h!==""&&l.push(h);let m=l.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${r}${m}`)}}}async remove(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/object/${a.bucketId}`,{prefixes:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async list(s,a,r){var l=this;try{const c=pe(pe(pe({},Z1),a),{},{prefix:s||""});return{data:await fa(l.fetch,`${l.url}/object/list/${l.bucketId}`,c,{headers:l.headers},r),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async listV2(s,a){var r=this;try{const l=pe({},s);return{data:await fa(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,l,{headers:r.headers},a),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}encodeMetadata(s){return JSON.stringify(s)}toBase64(s){return typeof Buffer<"u"?Buffer.from(s).toString("base64"):btoa(s)}_getFinalPath(s){return`${this.bucketId}/${s.replace(/^\/+/,"")}`}_removeEmptyFolders(s){return s.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(s){const a=[];return s.width&&a.push(`width=${s.width}`),s.height&&a.push(`height=${s.height}`),s.resize&&a.push(`resize=${s.resize}`),s.format&&a.push(`format=${s.format}`),s.quality&&a.push(`quality=${s.quality}`),a.join("&")}};const Py="2.90.1",Ky={"X-Client-Info":`storage-js/${Py}`};var W1=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1;const c=new URL(s);l?.useNewHostname&&/supabase\.(co|in|red)$/.test(c.hostname)&&!c.hostname.includes("storage.supabase.")&&(c.hostname=c.hostname.replace("supabase.","storage.supabase.")),this.url=c.href.replace(/\/$/,""),this.headers=pe(pe({},Ky),a),this.fetch=df(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(s){var a=this;try{const r=a.listBucketOptionsToQueryString(s);return{data:await Pi(a.fetch,`${a.url}/bucket${r}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async getBucket(s){var a=this;try{return{data:await Pi(a.fetch,`${a.url}/bucket/${s}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async createBucket(s,a={public:!1}){var r=this;try{return{data:await fa(r.fetch,`${r.url}/bucket`,{id:s,name:s,type:a.type,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async updateBucket(s,a){var r=this;try{return{data:await Jd(r.fetch,`${r.url}/bucket/${s}`,{id:s,name:s,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async emptyBucket(s){var a=this;try{return{data:await fa(a.fetch,`${a.url}/bucket/${s}/empty`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(s){const a={};return s&&("limit"in s&&(a.limit=String(s.limit)),"offset"in s&&(a.offset=String(s.offset)),s.search&&(a.search=s.search),s.sortColumn&&(a.sortColumn=s.sortColumn),s.sortOrder&&(a.sortOrder=s.sortOrder)),Object.keys(a).length>0?"?"+new URLSearchParams(a).toString():""}},eS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=pe(pe({},Ky),a),this.fetch=df(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await fa(a.fetch,`${a.url}/bucket`,{name:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async listBuckets(s){var a=this;try{const r=new URLSearchParams;s?.limit!==void 0&&r.set("limit",s.limit.toString()),s?.offset!==void 0&&r.set("offset",s.offset.toString()),s?.sortColumn&&r.set("sortColumn",s.sortColumn),s?.sortOrder&&r.set("sortOrder",s.sortOrder),s?.search&&r.set("search",s.search);const l=r.toString(),c=l?`${a.url}/bucket?${l}`:`${a.url}/bucket`;return{data:await Pi(a.fetch,c,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await ff(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}from(s){var a=this;if(!V1(s))throw new Io("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new B1({baseUrl:this.url,catalogName:s,auth:{type:"custom",getHeaders:async()=>a.headers},fetch:this.fetch}),l=this.shouldThrowOnError;return new Proxy(r,{get(c,d){const h=c[d];return typeof h!="function"?h:async(...m)=>{try{return{data:await h.apply(c,m),error:null}}catch(p){if(l)throw p;return{data:null,error:p}}}}})}};const hf={"X-Client-Info":`storage-js/${Py}`,"Content-Type":"application/json"};var Yy=class extends Error{constructor(s){super(s),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Xt(s){return typeof s=="object"&&s!==null&&"__isStorageVectorsError"in s}var Sd=class extends Yy{constructor(s,a,r){super(s),this.name="StorageVectorsApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},tS=class extends Yy{constructor(s,a){super(s),this.name="StorageVectorsUnknownError",this.originalError=a}};const mf=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),aS=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},Bg=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),sS=async(s,a,r)=>{if(s&&typeof s=="object"&&"status"in s&&"ok"in s&&typeof s.status=="number"&&!r?.noResolveJson){const l=s.status||500,c=s;if(typeof c.json=="function")c.json().then(d=>{const h=d?.statusCode||d?.code||l+"";a(new Sd(Bg(d),l,h))}).catch(()=>{const d=l+"";a(new Sd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new Sd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new tS(Bg(s),s))},nS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return l?(aS(l)?(c.headers=pe({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,pe(pe({},c),r)):c};async function rS(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,nS(a,l,c,d)).then(p=>{if(!p.ok)throw p;if(l?.noResolveJson)return p;const g=p.headers.get("content-type");return!g||!g.includes("application/json")?{}:p.json()}).then(p=>h(p)).catch(p=>sS(p,m,l))})}async function Qt(s,a,r,l,c){return rS(s,"POST",a,l,c,r)}var iS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=pe(pe({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateIndex`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:s,indexName:a},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}async listIndexes(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListIndexes`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:s,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}},lS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=pe(pe({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(s){var a=this;try{if(s.vectors.length<1||s.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Qt(a.fetch,`${a.url}/PutVectors`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listVectors(s){var a=this;try{if(s.segmentCount!==void 0){if(s.segmentCount<1||s.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(s.segmentIndex!==void 0&&(s.segmentIndex<0||s.segmentIndex>=s.segmentCount))throw new Error(`segmentIndex must be between 0 and ${s.segmentCount-1}`)}return{data:await Qt(a.fetch,`${a.url}/ListVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async queryVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/QueryVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteVectors(s){var a=this;try{if(s.keys.length<1||s.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Qt(a.fetch,`${a.url}/DeleteVectors`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},oS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=pe(pe({},hf),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listBuckets(s={}){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListVectorBuckets`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},cS=class extends oS{constructor(s,a={}){super(s,a.headers||{},a.fetch)}from(s){return new uS(this.url,this.headers,s,this.fetch)}async createBucket(s){var a=()=>super.createBucket,r=this;return a().call(r,s)}async getBucket(s){var a=()=>super.getBucket,r=this;return a().call(r,s)}async listBuckets(s={}){var a=()=>super.listBuckets,r=this;return a().call(r,s)}async deleteBucket(s){var a=()=>super.deleteBucket,r=this;return a().call(r,s)}},uS=class extends iS{constructor(s,a,r,l){super(s,a,l),this.vectorBucketName=r}async createIndex(s){var a=()=>super.createIndex,r=this;return a().call(r,pe(pe({},s),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(s={}){var a=()=>super.listIndexes,r=this;return a().call(r,pe(pe({},s),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(s){var a=()=>super.getIndex,r=this;return a().call(r,r.vectorBucketName,s)}async deleteIndex(s){var a=()=>super.deleteIndex,r=this;return a().call(r,r.vectorBucketName,s)}index(s){return new dS(this.url,this.headers,this.vectorBucketName,s,this.fetch)}},dS=class extends lS{constructor(s,a,r,l,c){super(s,a,c),this.vectorBucketName=r,this.indexName=l}async putVectors(s){var a=()=>super.putVectors,r=this;return a().call(r,pe(pe({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(s){var a=()=>super.getVectors,r=this;return a().call(r,pe(pe({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(s={}){var a=()=>super.listVectors,r=this;return a().call(r,pe(pe({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(s){var a=()=>super.queryVectors,r=this;return a().call(r,pe(pe({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(s){var a=()=>super.deleteVectors,r=this;return a().call(r,pe(pe({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},fS=class extends W1{constructor(s,a={},r,l){super(s,a,r,l)}from(s){return new F1(this.url,this.headers,s,this.fetch)}get vectors(){return new cS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new eS(this.url+"/iceberg",this.headers,this.fetch)}};const Jy="2.90.1",_r=30*1e3,Xd=3,jd=Xd*_r,hS="http://localhost:9999",mS="supabase.auth.token",pS={"X-Client-Info":`gotrue-js/${Jy}`},Qd="X-Supabase-Api-Version",Xy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},gS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,yS=600*1e3;class Ki extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function oe(s){return typeof s=="object"&&s!==null&&"__isAuthError"in s}class vS extends Ki{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function bS(s){return oe(s)&&s.name==="AuthApiError"}class fn extends Ki{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class ts extends Ki{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Jt extends ts{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function xS(s){return oe(s)&&s.name==="AuthSessionMissingError"}class hr extends ts{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class _o extends ts{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class So extends ts{constructor(a,r=null){super(a,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function wS(s){return oe(s)&&s.name==="AuthImplicitGrantRedirectError"}class qg extends ts{constructor(a,r=null){super(a,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class _S extends ts{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Zd extends ts{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function Nd(s){return oe(s)&&s.name==="AuthRetryableFetchError"}class $g extends ts{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Fd extends ts{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const Bo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Hg=`
|
|
35
|
-
\r=`.split(""),SS=(()=>{const s=new Array(128);for(let a=0;a<s.length;a+=1)s[a]=-1;for(let a=0;a<Hg.length;a+=1)s[Hg[a].charCodeAt(0)]=-2;for(let a=0;a<Bo.length;a+=1)s[Bo[a].charCodeAt(0)]=a;return s})();function Vg(s,a,r){if(s!==null)for(a.queue=a.queue<<8|s,a.queuedBits+=8;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(Bo[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(Bo[l]),a.queuedBits-=6}}function Qy(s,a,r){const l=SS[s];if(l>-1)for(a.queue=a.queue<<6|l,a.queuedBits+=6;a.queuedBits>=8;)r(a.queue>>a.queuedBits-8&255),a.queuedBits-=8;else{if(l===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(s)}"`)}}function Ig(s){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{ES(h,l,r)};for(let h=0;h<s.length;h+=1)Qy(s.charCodeAt(h),c,d);return a.join("")}function jS(s,a){if(s<=127){a(s);return}else if(s<=2047){a(192|s>>6),a(128|s&63);return}else if(s<=65535){a(224|s>>12),a(128|s>>6&63),a(128|s&63);return}else if(s<=1114111){a(240|s>>18),a(128|s>>12&63),a(128|s>>6&63),a(128|s&63);return}throw new Error(`Unrecognized Unicode codepoint: ${s.toString(16)}`)}function NS(s,a){for(let r=0;r<s.length;r+=1){let l=s.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(s.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}jS(l,a)}}function ES(s,a,r){if(a.utf8seq===0){if(s<=127){r(s);return}for(let l=1;l<6;l+=1)if((s>>7-l&1)===0){a.utf8seq=l;break}if(a.utf8seq===2)a.codepoint=s&31;else if(a.utf8seq===3)a.codepoint=s&15;else if(a.utf8seq===4)a.codepoint=s&7;else throw new Error("Invalid UTF-8 sequence");a.utf8seq-=1}else if(a.utf8seq>0){if(s<=127)throw new Error("Invalid UTF-8 sequence");a.codepoint=a.codepoint<<6|s&63,a.utf8seq-=1,a.utf8seq===0&&r(a.codepoint)}}function Er(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<s.length;c+=1)Qy(s.charCodeAt(c),r,l);return new Uint8Array(a)}function TS(s){const a=[];return NS(s,r=>a.push(r)),new Uint8Array(a)}function hn(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};return s.forEach(c=>Vg(c,r,l)),Vg(null,r,l),a.join("")}function AS(s){return Math.round(Date.now()/1e3)+s}function CS(){return Symbol("auth-callback")}const Tt=()=>typeof window<"u"&&typeof document<"u",on={tested:!1,writable:!1},Zy=()=>{if(!Tt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(on.tested)return on.writable;const s=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(s,s),globalThis.localStorage.removeItem(s),on.tested=!0,on.writable=!0}catch{on.tested=!0,on.writable=!1}return on.writable};function kS(s){const a={},r=new URL(s);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((c,d)=>{a[d]=c})}catch{}return r.searchParams.forEach((l,c)=>{a[c]=l}),a}const Fy=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),OS=s=>typeof s=="object"&&s!==null&&"status"in s&&"ok"in s&&"json"in s&&typeof s.json=="function",Sr=async(s,a,r)=>{await s.setItem(a,JSON.stringify(r))},cn=async(s,a)=>{const r=await s.getItem(a);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Et=async(s,a)=>{await s.removeItem(a)};class Go{constructor(){this.promise=new Go.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}Go.promiseConstructor=Promise;function Ed(s){const a=s.split(".");if(a.length!==3)throw new Fd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!gS.test(a[l]))throw new Fd("JWT not in base64url format");return{header:JSON.parse(Ig(a[0])),payload:JSON.parse(Ig(a[1])),signature:Er(a[2]),raw:{header:a[0],payload:a[1]}}}async function RS(s){return await new Promise(a=>{setTimeout(()=>a(null),s)})}function DS(s,a){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await s(d);if(!a(d,null,h)){l(h);return}}catch(h){if(!a(d,h)){c(h);return}}})()})}function MS(s){return("0"+s.toString(16)).substr(-2)}function zS(){const a=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",l=r.length;let c="";for(let d=0;d<56;d++)c+=r.charAt(Math.floor(Math.random()*l));return c}return crypto.getRandomValues(a),Array.from(a,MS).join("")}async function US(s){const r=new TextEncoder().encode(s),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function LS(s){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),s;const r=await US(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function mr(s,a,r=!1){const l=zS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await Sr(s,`${a}-code-verifier`,c);const d=await LS(l);return[d,l===d?"plain":"s256"]}const BS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function qS(s){const a=s.headers.get(Qd);if(!a||!a.match(BS))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function $S(s){if(!s)throw new Error("Missing exp claim");const a=Math.floor(Date.now()/1e3);if(s<=a)throw new Error("JWT has expired")}function HS(s){switch(s){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const VS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function pr(s){if(!VS.test(s))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Td(){const s={};return new Proxy(s,{get:(a,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const l=r.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(a,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(a,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function IS(s,a){return new Proxy(s,{get:(r,l,c)=>{if(l==="__isInsecureUserWarningProxy")return!0;if(typeof l=="symbol"){const d=l.toString();if(d==="Symbol(Symbol.toPrimitive)"||d==="Symbol(Symbol.toStringTag)"||d==="Symbol(util.inspect.custom)"||d==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,l,c)}return!a.value&&typeof l=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),a.value=!0),Reflect.get(r,l,c)}})}function Gg(s){return JSON.parse(JSON.stringify(s))}const un=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),GS=[502,503,504];async function Pg(s){var a;if(!OS(s))throw new Zd(un(s),0);if(GS.includes(s.status))throw new Zd(un(s),s.status);let r;try{r=await s.json()}catch(d){throw new fn(un(d),d)}let l;const c=qS(s);if(c&&c.getTime()>=Xy["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?l=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(l=r.error_code),l){if(l==="weak_password")throw new $g(un(r),s.status,((a=r.weak_password)===null||a===void 0?void 0:a.reasons)||[]);if(l==="session_not_found")throw new Jt}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((d,h)=>d&&typeof h=="string",!0))throw new $g(un(r),s.status,r.weak_password.reasons);throw new vS(un(r),s.status||500,l)}const PS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="GET"?c:(c.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},a?.headers),c.body=JSON.stringify(l),Object.assign(Object.assign({},c),r))};async function me(s,a,r,l){var c;const d=Object.assign({},l?.headers);d[Qd]||(d[Qd]=Xy["2024-01-01"].name),l?.jwt&&(d.Authorization=`Bearer ${l.jwt}`);const h=(c=l?.query)!==null&&c!==void 0?c:{};l?.redirectTo&&(h.redirect_to=l.redirectTo);const m=Object.keys(h).length?"?"+new URLSearchParams(h).toString():"",p=await KS(s,a,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(p):{data:Object.assign({},p),error:null}}async function KS(s,a,r,l,c,d){const h=PS(a,l,c,d);let m;try{m=await s(r,Object.assign({},h))}catch(p){throw console.error(p),new Zd(un(p),0)}if(m.ok||await Pg(m),l?.noResolveJson)return m;try{return await m.json()}catch(p){await Pg(p)}}function da(s){var a;let r=null;XS(s)&&(r=Object.assign({},s),s.expires_at||(r.expires_at=AS(s.expires_in)));const l=(a=s.user)!==null&&a!==void 0?a:s;return{data:{session:r,user:l},error:null}}function Kg(s){const a=da(s);return!a.error&&s.weak_password&&typeof s.weak_password=="object"&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.message&&typeof s.weak_password.message=="string"&&s.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(a.data.weak_password=s.weak_password),a}function Ms(s){var a;return{data:{user:(a=s.user)!==null&&a!==void 0?a:s},error:null}}function YS(s){return{data:s,error:null}}function JS(s){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=s,h=Ur(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),m={action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d},p=Object.assign({},h);return{data:{properties:m,user:p},error:null}}function Yg(s){return s}function XS(s){return s.access_token&&s.refresh_token&&s.expires_in}const Ad=["global","local","others"];class QS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Fy(l),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(a,r=Ad[0]){if(Ad.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ad.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:Ms})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Ur(a,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await me(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:JS,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:Ms})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async listUsers(a){var r,l,c,d,h,m,p;try{const g={nextPage:null,lastPage:0,total:0},v=await me(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=a?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=a?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:Yg});if(v.error)throw v.error;const _=await v.json(),x=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(p=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&p!==void 0?p:[];return S.length>0&&(S.forEach(A=>{const j=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),O=JSON.parse(A.split(";")[1].split("=")[1]);g[`${O}Page`]=j}),g.total=parseInt(x)),{data:Object.assign(Object.assign({},_),g),error:null}}catch(g){if(oe(g))return{data:{users:[]},error:g};throw g}}async getUserById(a){pr(a);try{return await me(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:Ms})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){pr(a);try{return await me(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:Ms})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){pr(a);try{return await me(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ms})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){pr(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){pr(a.userId),pr(a.id);try{return{data:await me(this.fetch,"DELETE",`${this.url}/admin/users/${a.userId}/factors/${a.id}`,{headers:this.headers}),error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _listOAuthClients(a){var r,l,c,d,h,m,p;try{const g={nextPage:null,lastPage:0,total:0},v=await me(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=a?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=a?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:Yg});if(v.error)throw v.error;const _=await v.json(),x=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(p=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&p!==void 0?p:[];return S.length>0&&(S.forEach(A=>{const j=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),O=JSON.parse(A.split(";")[1].split("=")[1]);g[`${O}Page`]=j}),g.total=parseInt(x)),{data:Object.assign(Object.assign({},_),g),error:null}}catch(g){if(oe(g))return{data:{clients:[]},error:g};throw g}}async _createOAuthClient(a){try{return await me(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:a,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _getOAuthClient(a){try{return await me(this.fetch,"GET",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _updateOAuthClient(a,r){try{return await me(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${a}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(oe(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(a){try{return await me(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(a){try{return await me(this.fetch,"POST",`${this.url}/admin/oauth/clients/${a}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}}function Jg(s={}){return{getItem:a=>s[a]||null,setItem:(a,r)=>{s[a]=r},removeItem:a=>{delete s[a]}}}const gr={debug:!!(globalThis&&Zy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Wy extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class ZS extends Wy{}async function FS(s,a,r){gr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",s,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),gr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",s)},a),await Promise.resolve().then(()=>globalThis.navigator.locks.request(s,a===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:l.signal},async c=>{if(c){gr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",s,c.name);try{return await r()}finally{gr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",s,c.name)}}else{if(a===0)throw gr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",s),new ZS(`Acquiring an exclusive Navigator LockManager lock "${s}" immediately failed`);if(gr.debug)try{const d=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(d,null," "))}catch(d){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",d)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}}))}function WS(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function ev(s){if(!/^0x[a-fA-F0-9]{40}$/.test(s))throw new Error(`@supabase/auth-js: Address "${s}" is invalid.`);return s.toLowerCase()}function ej(s){return parseInt(s,16)}function tj(s){const a=new TextEncoder().encode(s);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function aj(s){var a;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:p,resources:g,scheme:v,uri:_,version:x}=s;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!l)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(h&&h.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${h}`);if(!_)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(x!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${x}`);if(!((a=s.statement)===null||a===void 0)&&a.includes(`
|
|
36
|
-
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${s.statement}`)}const S=ev(s.address),A=v?`${v}://${l}`:l,j=s.statement?`${s.statement}
|
|
37
|
-
`:"",O=`${A} wants you to sign in with your Ethereum account:
|
|
38
|
-
${S}
|
|
39
|
-
|
|
40
|
-
${j}`;let R=`URI: ${_}
|
|
41
|
-
Version: ${x}
|
|
42
|
-
Chain ID: ${r}${h?`
|
|
43
|
-
Nonce: ${h}`:""}
|
|
44
|
-
Issued At: ${d.toISOString()}`;if(c&&(R+=`
|
|
45
|
-
Expiration Time: ${c.toISOString()}`),m&&(R+=`
|
|
46
|
-
Not Before: ${m.toISOString()}`),p&&(R+=`
|
|
47
|
-
Request ID: ${p}`),g){let q=`
|
|
48
|
-
Resources:`;for(const B of g){if(!B||typeof B!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${B}`);q+=`
|
|
49
|
-
- ${B}`}R+=q}return`${O}
|
|
50
|
-
${R}`}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 qo extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function sj({error:s,options:a}){var r,l,c;const{publicKey:d}=a;if(!d)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else if(s.name==="ConstraintError"){if(((r=d.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ot({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:s});if(a.mediation==="conditional"&&((l=d.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new ot({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:s});if(((c=d.authenticatorSelection)===null||c===void 0?void 0:c.userVerification)==="required")return new ot({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:s})}else{if(s.name==="InvalidStateError")return new ot({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:s});if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.name==="NotSupportedError")return d.pubKeyCredParams.filter(m=>m.type==="public-key").length===0?new ot({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:s}):new ot({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:s});if(s.name==="SecurityError"){const h=window.location.hostname;if(tv(h)){if(d.rp.id!==h)return new ot({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.name==="TypeError"){if(d.user.id.byteLength<1||d.user.id.byteLength>64)return new ot({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:s})}else if(s.name==="UnknownError")return new ot({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}function nj({error:s,options:a}){const{publicKey:r}=a;if(!r)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else{if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.name==="SecurityError"){const l=window.location.hostname;if(tv(l)){if(r.rpId!==l)return new ot({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.name==="UnknownError")return new ot({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}class rj{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const a=new AbortController;return this.controller=a,a.signal}cancelCeremony(){if(this.controller){const a=new Error("Manually cancelling existing WebAuthn API call");a.name="AbortError",this.controller.abort(a),this.controller=void 0}}}const ij=new rj;function lj(s){if(!s)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(s);const{challenge:a,user:r,excludeCredentials:l}=s,c=Ur(s,["challenge","user","excludeCredentials"]),d=Er(a).buffer,h=Object.assign(Object.assign({},r),{id:Er(r.id).buffer}),m=Object.assign(Object.assign({},c),{challenge:d,user:h});if(l&&l.length>0){m.excludeCredentials=new Array(l.length);for(let p=0;p<l.length;p++){const g=l[p];m.excludeCredentials[p]=Object.assign(Object.assign({},g),{id:Er(g.id).buffer,type:g.type||"public-key",transports:g.transports})}}return m}function oj(s){if(!s)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(s);const{challenge:a,allowCredentials:r}=s,l=Ur(s,["challenge","allowCredentials"]),c=Er(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:Er(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function cj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s;return{id:s.id,rawId:s.id,response:{attestationObject:hn(new Uint8Array(s.response.attestationObject)),clientDataJSON:hn(new Uint8Array(s.response.clientDataJSON))},type:"public-key",clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function uj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s,l=s.getClientExtensionResults(),c=s.response;return{id:s.id,rawId:s.id,response:{authenticatorData:hn(new Uint8Array(c.authenticatorData)),clientDataJSON:hn(new Uint8Array(c.clientDataJSON)),signature:hn(new Uint8Array(c.signature)),userHandle:c.userHandle?hn(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function tv(s){return s==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(s)}function Xg(){var s,a;return!!(Tt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((s=navigator?.credentials)===null||s===void 0?void 0:s.create)=="function"&&typeof((a=navigator?.credentials)===null||a===void 0?void 0:a.get)=="function")}async function dj(s){try{const a=await navigator.credentials.create(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new qo("Browser returned unexpected credential type",a)}:{data:null,error:new qo("Empty credential response",a)}}catch(a){return{data:null,error:sj({error:a,options:s})}}}async function fj(s){try{const a=await navigator.credentials.get(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new qo("Browser returned unexpected credential type",a)}:{data:null,error:new qo("Empty credential response",a)}}catch(a){return{data:null,error:nj({error:a,options:s})}}}const hj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},mj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function $o(...s){const a=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of s)if(c)for(const d in c){const h=c[d];if(h!==void 0)if(Array.isArray(h))l[d]=h;else if(r(h))l[d]=h;else if(a(h)){const m=l[d];a(m)?l[d]=$o(m,h):l[d]=$o(h)}else l[d]=h}return l}function pj(s,a){return $o(hj,s,a||{})}function gj(s,a){return $o(mj,s,a||{})}class yj{constructor(a){this.client=a,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(a){return this.client.mfa.enroll(Object.assign(Object.assign({},a),{factorType:"webauthn"}))}async _challenge({factorId:a,webauthn:r,friendlyName:l,signal:c},d){try{const{data:h,error:m}=await this.client.mfa.challenge({factorId:a,webauthn:r});if(!h)return{data:null,error:m};const p=c??ij.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:g}=h.webauthn.credential_options.publicKey;g.name||(g.name=`${g.id}:${l}`),g.displayName||(g.displayName=g.name)}switch(h.webauthn.type){case"create":{const g=pj(h.webauthn.credential_options.publicKey,d?.create),{data:v,error:_}=await dj({publicKey:g,signal:p});return v?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:_}}case"request":{const g=gj(h.webauthn.credential_options.publicKey,d?.request),{data:v,error:_}=await fj(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:g,signal:p}));return v?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:_}}}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new fn("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 Ki("rpId is required for WebAuthn authentication")};try{if(!Xg())return{data:null,error:new fn("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this.challenge({factorId:a,webauthn:{rpId:r,rpOrigins:l},signal:c},{request:d});if(!h)return{data:null,error:m};const{webauthn:p}=h;return this._verify({factorId:a,challengeId:h.challengeId,webauthn:{type:p.type,rpId:r,rpOrigins:l,credential_response:p.credential_response}})}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new fn("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 Ki("rpId is required for WebAuthn registration")};try{if(!Xg())return{data:null,error:new fn("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this._enroll({friendlyName:a});if(!h)return await this.client.mfa.listFactors().then(v=>{var _;return(_=v.data)===null||_===void 0?void 0:_.all.find(x=>x.factor_type==="webauthn"&&x.friendly_name===a&&x.status!=="unverified")}).then(v=>v?this.client.mfa.unenroll({factorId:v?.id}):void 0),{data:null,error:m};const{data:p,error:g}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return p?this._verify({factorId:h.id,challengeId:p.challengeId,webauthn:{rpId:r,rpOrigins:l,type:p.webauthn.type,credential_response:p.webauthn.credential_response}}):{data:null,error:g}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new fn("Unexpected error in register",h)}}}}WS();const vj={url:hS,storageKey:mS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:pS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Qg(s,a,r){return await r()}const yr={};class Yi{get jwks(){var a,r;return(r=(a=yr[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){yr[this.storageKey]=Object.assign(Object.assign({},yr[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=yr[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){yr[this.storageKey]=Object.assign(Object.assign({},yr[this.storageKey]),{cachedAt:a})}constructor(a){var r,l,c;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const d=Object.assign(Object.assign({},vj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Yi.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Yi.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Tt()){const h=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(h),this.logDebugMessages&&console.trace(h)}if(this.persistSession=d.persistSession,this.autoRefreshToken=d.autoRefreshToken,this.admin=new QS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Fy(d.fetch),this.lock=d.lock||Qg,this.detectSessionInUrl=d.detectSessionInUrl,this.flowType=d.flowType,this.hasCustomAuthorizationHeader=d.hasCustomAuthorizationHeader,this.throwOnError=d.throwOnError,this.lockAcquireTimeout=d.lockAcquireTimeout,d.lock?this.lock=d.lock:this.persistSession&&Tt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=FS:this.lock=Qg,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new yj(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(d.storage?this.storage=d.storage:Zy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Jg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Jg(this.memoryStorage)),Tt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(h){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",h)}(c=this.broadcastChannel)===null||c===void 0||c.addEventListener("message",async h=>{this._debug("received broadcast notification from other tab or client",h),await this._notifyAllSubscribers(h.data.event,h.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(a){if(this.throwOnError&&a&&a.error)throw a.error;return a}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Jy}) ${new Date().toISOString()}`}_debug(...a){return this.logDebugMessages&&this.logger(this._logPrefix(),...a),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var a;try{let r={},l="none";if(Tt()&&(r=kS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Tt()&&this.detectSessionInUrl&&l!=="none"){const{data:c,error:d}=await this._getSessionFromURL(r,l);if(d){if(this._debug("#_initialize()","error detecting session from URL",d),wS(d)){const p=(a=d.details)===null||a===void 0?void 0:a.code;if(p==="identity_already_exists"||p==="identity_not_found"||p==="single_identity_not_deletable")return{error:d}}return{error:d}}const{session:h,redirectType:m}=c;return this._debug("#_initialize()","detected session in URL",h,"redirect type",m),await this._saveSession(h),setTimeout(async()=>{m==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",h):await this._notifyAllSubscribers("SIGNED_IN",h)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return oe(r)?this._returnResult({error:r}):this._returnResult({error:new fn("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:da}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const p=h.session,g=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(d){if(oe(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signUp(a){var r,l,c;try{let d;if("email"in a){const{email:v,password:_,options:x}=a;let S=null,A=null;this.flowType==="pkce"&&([S,A]=await mr(this.storage,this.storageKey)),d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:x?.emailRedirectTo,body:{email:v,password:_,data:(r=x?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:x?.captchaToken},code_challenge:S,code_challenge_method:A},xform:da})}else if("phone"in a){const{phone:v,password:_,options:x}=a;d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:_,data:(l=x?.data)!==null&&l!==void 0?l:{},channel:(c=x?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:x?.captchaToken}},xform:da})}else throw new _o("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await Et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const p=h.session,g=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(d){if(await Et(this.storage,`${this.storageKey}-code-verifier`),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:Kg})}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:Kg})}else throw new _o("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 hr;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign({user:l.user,session:l.session},l.weak_password?{weakPassword:l.weak_password}:null),error:c})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(a){var r,l,c,d;return await this._handleProviderSignIn(a.provider,{redirectTo:(r=a.options)===null||r===void 0?void 0:r.redirectTo,scopes:(l=a.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=a.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:(d=a.options)===null||d===void 0?void 0:d.skipBrowserRedirect})}async exchangeCodeForSession(a){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(a))}async signInWithWeb3(a){const{chain:r}=a;switch(r){case"ethereum":return await this.signInWithEthereum(a);case"solana":return await this.signInWithSolana(a);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(a){var r,l,c,d,h,m,p,g,v,_,x;let S,A;if("message"in a)S=a.message,A=a.signature;else{const{chain:j,wallet:O,statement:R,options:q}=a;let B;if(Tt())if(typeof O=="object")B=O;else{const ue=window;if("ethereum"in ue&&typeof ue.ethereum=="object"&&"request"in ue.ethereum&&typeof ue.ethereum.request=="function")B=ue.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof O!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");B=O}const G=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),ee=await B.request({method:"eth_requestAccounts"}).then(ue=>ue).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!ee||ee.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const J=ev(ee[0]);let P=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!P){const ue=await B.request({method:"eth_chainId"});P=ej(ue)}const X={domain:G.host,address:J,statement:R,uri:G.href,version:"1",chainId:P,nonce:(c=q?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=q?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=q?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(p=q?.signInWithEthereum)===null||p===void 0?void 0:p.notBefore,requestId:(g=q?.signInWithEthereum)===null||g===void 0?void 0:g.requestId,resources:(v=q?.signInWithEthereum)===null||v===void 0?void 0:v.resources};S=aj(X),A=await B.request({method:"personal_sign",params:[tj(S),J]})}try{const{data:j,error:O}=await me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:A},!((_=a.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(x=a.options)===null||x===void 0?void 0:x.captchaToken}}:null),xform:da});if(O)throw O;if(!j||!j.session||!j.user){const R=new hr;return this._returnResult({data:{user:null,session:null},error:R})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:O})}catch(j){if(oe(j))return this._returnResult({data:{user:null,session:null},error:j});throw j}}async signInWithSolana(a){var r,l,c,d,h,m,p,g,v,_,x,S;let A,j;if("message"in a)A=a.message,j=a.signature;else{const{chain:O,wallet:R,statement:q,options:B}=a;let G;if(Tt())if(typeof R=="object")G=R;else{const J=window;if("solana"in J&&typeof J.solana=="object"&&("signIn"in J.solana&&typeof J.solana.signIn=="function"||"signMessage"in J.solana&&typeof J.solana.signMessage=="function"))G=J.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof R!="object"||!B?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");G=R}const ee=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in G&&G.signIn){const J=await G.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},B?.signInWithSolana),{version:"1",domain:ee.host,uri:ee.href}),q?{statement:q}:null));let P;if(Array.isArray(J)&&J[0]&&typeof J[0]=="object")P=J[0];else if(J&&typeof J=="object"&&"signedMessage"in J&&"signature"in J)P=J;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)A=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),j=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in G)||typeof G.signMessage!="function"||!("publicKey"in G)||typeof G!="object"||!G.publicKey||!("toBase58"in G.publicKey)||typeof G.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");A=[`${ee.host} wants you to sign in with your Solana account:`,G.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${ee.href}`,`Issued At: ${(c=(l=B?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=B?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${B.signInWithSolana.notBefore}`]:[],...!((h=B?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${B.signInWithSolana.expirationTime}`]:[],...!((m=B?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${B.signInWithSolana.chainId}`]:[],...!((p=B?.signInWithSolana)===null||p===void 0)&&p.nonce?[`Nonce: ${B.signInWithSolana.nonce}`]:[],...!((g=B?.signInWithSolana)===null||g===void 0)&&g.requestId?[`Request ID: ${B.signInWithSolana.requestId}`]:[],...!((_=(v=B?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||_===void 0)&&_.length?["Resources",...B.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
|
|
51
|
-
`);const J=await G.signMessage(new TextEncoder().encode(A),"utf8");if(!J||!(J instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=J}}try{const{data:O,error:R}=await me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:A,signature:hn(j)},!((x=a.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(S=a.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:da});if(R)throw R;if(!O||!O.session||!O.user){const q=new hr;return this._returnResult({data:{user:null,session:null},error:q})}return O.session&&(await this._saveSession(O.session),await this._notifyAllSubscribers("SIGNED_IN",O.session)),this._returnResult({data:Object.assign({},O),error:R})}catch(O){if(oe(O))return this._returnResult({data:{user:null,session:null},error:O});throw O}}async _exchangeCodeForSession(a){const r=await cn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new _S;const{data:d,error:h}=await me(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:l},xform:da});if(await Et(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new hr;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:da}),{data:p,error:g}=m;if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!p||!p.session||!p.user){const v=new hr;return this._returnResult({data:{user:null,session:null},error:v})}return p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("SIGNED_IN",p.session)),this._returnResult({data:p,error:g})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(a){var r,l,c,d,h;try{if("email"in a){const{email:m,options:p}=a;let g=null,v=null;this.flowType==="pkce"&&([g,v]=await mr(this.storage,this.storageKey));const{error:_}=await me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=p?.data)!==null&&r!==void 0?r:{},create_user:(l=p?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},code_challenge:g,code_challenge_method:v},redirectTo:p?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:_})}if("phone"in a){const{phone:m,options:p}=a,{data:g,error:v}=await me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=p?.data)!==null&&c!==void 0?c:{},create_user:(d=p?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},channel:(h=p?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:g?.message_id},error:v})}throw new _o("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:da});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const p=h.session,g=h.user;return p?.access_token&&(await this._saveSession(p),await this._notifyAllSubscribers(a.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(c){if(oe(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithSSO(a){var r,l,c,d,h;try{let m=null,p=null;this.flowType==="pkce"&&([m,p]=await mr(this.storage,this.storageKey));const g=await me(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in a?{provider_id:a.providerId}:null),"domain"in a?{domain:a.domain}:null),{redirect_to:(l=(r=a.options)===null||r===void 0?void 0:r.redirectTo)!==null&&l!==void 0?l:void 0}),!((c=a?.options)===null||c===void 0)&&c.captchaToken?{gotrue_meta_security:{captcha_token:a.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:m,code_challenge_method:p}),headers:this.headers,xform:YS});return!((d=g.data)===null||d===void 0)&&d.url&&Tt()&&!(!((h=a.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(g.data.url),this._returnResult(g)}catch(m){if(await Et(this.storage,`${this.storageKey}-code-verifier`),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 Jt;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 _o("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 cn(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()<jd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",a.expires_at),!l){if(this.userStorage){const h=await cn(this.userStorage,this.storageKey+"-user");h?.user?a.user=h.user:a.user=Td()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=IS(a.user,h),h.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:a},error:null}}const{data:c,error:d}=await this._callRefreshToken(a.refresh_token);return d?this._returnResult({data:{session:null},error:d}):this._returnResult({data:{session:c},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(a){if(a)return await this._getUser(a);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(a){try{return a?await me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:a,xform:Ms}):await this._useSession(async r=>{var l,c,d;const{data:h,error:m}=r;if(m)throw m;return!(!((l=h.session)===null||l===void 0)&&l.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Jt}:await 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:Ms})})}catch(r){if(oe(r))return xS(r)&&(await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(a,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(a,r))}async _updateUser(a,r={}){try{return await this._useSession(async l=>{const{data:c,error:d}=l;if(d)throw d;if(!c.session)throw new Jt;const h=c.session;let m=null,p=null;this.flowType==="pkce"&&a.email!=null&&([m,p]=await mr(this.storage,this.storageKey));const{data:g,error:v}=await me(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},a),{code_challenge:m,code_challenge_method:p}),jwt:h.access_token,xform:Ms});if(v)throw v;return h.user=g.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await Et(this.storage,`${this.storageKey}-code-verifier`),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 Jt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=Ed(a.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:p}=await this._callRefreshToken(a.refresh_token);if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:p}=await this._getUser(a.access_token);if(p)throw p;d={access_token:a.access_token,refresh_token:a.refresh_token,user:m.user,token_type:"bearer",expires_in:l-r,expires_at:l},await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)}return this._returnResult({data:{user:d.user,session:d},error:null})}catch(r){if(oe(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(a))}async _refreshSession(a){try{return await this._useSession(async r=>{var l;if(!a){const{data:h,error:m}=r;if(m)throw m;a=(l=h.session)!==null&&l!==void 0?l:void 0}if(!a?.refresh_token)throw new Jt;const{data:c,error:d}=await this._callRefreshToken(a.refresh_token);return d?this._returnResult({data:{user:null,session:null},error:d}):c?this._returnResult({data:{user:c.user,session:c},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(a,r){try{if(!Tt())throw new So("No browser detected.");if(a.error||a.error_description||a.error_code)throw new So(a.error_description||"Error in URL with unspecified error_description",{error:a.error||"unspecified_error",code:a.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new qg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new So("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!a.code)throw new qg("No code detected.");const{data:q,error:B}=await this._exchangeCodeForSession(a.code);if(B)throw B;const G=new URL(window.location.href);return G.searchParams.delete("code"),window.history.replaceState(window.history.state,"",G.toString()),{data:{session:q.session,redirectType:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:d,refresh_token:h,expires_in:m,expires_at:p,token_type:g}=a;if(!d||!m||!h||!g)throw new So("No session defined in URL");const v=Math.round(Date.now()/1e3),_=parseInt(m);let x=v+_;p&&(x=parseInt(p));const S=x-v;S*1e3<=_r&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${_}s`);const A=x-_;v-A>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",A,x,v):v-A<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",A,x,v);const{data:j,error:O}=await this._getUser(d);if(O)throw O;const R={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:_,expires_at:x,refresh_token:h,token_type:g,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:R,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 cn(this.storage,`${this.storageKey}-code-verifier`);return!!(a.code&&r)}async signOut(a={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(a))}async _signOut({scope:a}={scope:"global"}){return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({error:d});const h=(l=c.session)===null||l===void 0?void 0:l.access_token;if(h){const{error:m}=await this.admin.signOut(h,a);if(m&&!(bS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=CS(),l={id:r,callback:a,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,l),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:l}}}async _emitInitialSession(a){return await this._useSession(async r=>{var l,c;try{const{data:{session:d},error:h}=r;if(h)throw h;await((l=this.stateChangeEmitters.get(a))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",a,"session",d)}catch(d){await((c=this.stateChangeEmitters.get(a))===null||c===void 0?void 0:c.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",a,"error",d),console.error(d)}})}async resetPasswordForEmail(a,r={}){let l=null,c=null;this.flowType==="pkce"&&([l,c]=await mr(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,p,g,v;const{data:_,error:x}=d;if(x)throw x;const S=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,a.provider,{redirectTo:(h=a.options)===null||h===void 0?void 0:h.redirectTo,scopes:(m=a.options)===null||m===void 0?void 0:m.scopes,queryParams:(p=a.options)===null||p===void 0?void 0:p.queryParams,skipBrowserRedirect:!0});return await me(this.fetch,"GET",S,{headers:this.headers,jwt:(v=(g=_.session)===null||g===void 0?void 0:g.access_token)!==null&&v!==void 0?v:void 0})});if(c)throw c;return Tt()&&!(!((r=a.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(l?.url),this._returnResult({data:{provider:a.provider,url:l?.url},error:null})}catch(l){if(oe(l))return this._returnResult({data:{provider:a.provider,url:null},error:l});throw l}}async linkIdentityIdToken(a){return await this._useSession(async r=>{var l;try{const{error:c,data:{session:d}}=r;if(c)throw c;const{options:h,provider:m,token:p,access_token:g,nonce:v}=a,_=await me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(l=d?.access_token)!==null&&l!==void 0?l:void 0,body:{provider:m,id_token:p,access_token:g,nonce:v,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:da}),{data:x,error:S}=_;return S?this._returnResult({data:{user:null,session:null},error:S}):!x||!x.session||!x.user?this._returnResult({data:{user:null,session:null},error:new hr}):(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("USER_UPDATED",x.session)),this._returnResult({data:x,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 DS(async c=>(c>0&&await RS(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:da})),(c,d)=>{const h=200*Math.pow(2,c);return d&&Nd(d)&&Date.now()+h-l<_r})}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),Tt()&&!r.skipBrowserRedirect&&window.location.assign(l),{data:{provider:a,url:l},error:null}}async _recoverAndRefresh(){var a,r;const l="#_recoverAndRefresh()";this._debug(l,"begin");try{const c=await cn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await cn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Sr(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:Td()}else if(c&&!c.user&&!c.user){const h=await cn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await Et(this.storage,this.storageKey+"-user"),await Sr(this.storage,this.storageKey,c)):c.user=Td()}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()<jd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${jd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),Nd(h)||(this._debug(l,"refresh failed with a non-retryable error, removing the session",h),await this._removeSession()))}}else if(c.user&&c.user.__isUserNotAvailableProxy===!0)try{const{data:h,error:m}=await this._getUser(c.access_token);!m&&h?.user?(c.user=h.user,await this._saveSession(c),await this._notifyAllSubscribers("SIGNED_IN",c)):this._debug(l,"could not get user data, skipping SIGNED_IN notification")}catch(h){console.error("Error getting user data:",h),this._debug(l,"error getting user data, skipping SIGNED_IN notification",h)}else await this._notifyAllSubscribers("SIGNED_IN",c)}catch(c){this._debug(l,"error",c),console.error(c);return}finally{this._debug(l,"end")}}async _callRefreshToken(a){var r,l;if(!a)throw new Jt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const c=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(c,"begin");try{this.refreshingDeferred=new Go;const{data:d,error:h}=await this._refreshAccessToken(a);if(h)throw h;if(!d.session)throw new Jt;await this._saveSession(d.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",d.session);const m={data:d.session,error:null};return this.refreshingDeferred.resolve(m),m}catch(d){if(this._debug(c,"error",d),oe(d)){const h={data:null,error:d};return Nd(d)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(h),h}throw(l=this.refreshingDeferred)===null||l===void 0||l.reject(d),d}finally{this.refreshingDeferred=null,this._debug(c,"end")}}async _notifyAllSubscribers(a,r,l=!0){const c=`#_notifyAllSubscribers(${a})`;this._debug(c,"begin",r,`broadcast = ${l}`);try{this.broadcastChannel&&l&&this.broadcastChannel.postMessage({event:a,session:r});const d=[],h=Array.from(this.stateChangeEmitters.values()).map(async m=>{try{await m.callback(a,r)}catch(p){d.push(p)}});if(await Promise.all(h),d.length>0){for(let m=0;m<d.length;m+=1)console.error(d[m]);throw d[0]}}finally{this._debug(c,"end")}}async _saveSession(a){this._debug("#_saveSession()",a),this.suppressGetSessionWarning=!0,await Et(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},a),l=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!l&&r.user&&await Sr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Gg(c);await Sr(this.storage,this.storageKey,d)}else{const c=Gg(r);await Sr(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Et(this.storage,this.storageKey),await Et(this.storage,this.storageKey+"-code-verifier"),await Et(this.storage,this.storageKey+"-user"),this.userStorage&&await Et(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&Tt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",a)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const a=setInterval(()=>this._autoRefreshTokenTick(),_r);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)/_r);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${_r}ms, refresh threshold is ${Xd} ticks`),c<=Xd&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(a){if(a.isAcquireTimeout||a instanceof Wy)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Tt()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(a){console.error("_handleVisibilityChange",a)}}async _onVisibilityChanged(a){const r=`#_onVisibilityChanged(${a})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),a||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(a,r,l){const c=[`provider=${encodeURIComponent(r)}`];if(l?.redirectTo&&c.push(`redirect_to=${encodeURIComponent(l.redirectTo)}`),l?.scopes&&c.push(`scopes=${encodeURIComponent(l.scopes)}`),this.flowType==="pkce"){const[d,h]=await mr(this.storage,this.storageKey),m=new URLSearchParams({code_challenge:`${encodeURIComponent(d)}`,code_challenge_method:`${encodeURIComponent(h)}`});c.push(m.toString())}if(l?.queryParams){const d=new URLSearchParams(l.queryParams);c.push(d.toString())}return l?.skipBrowserRedirect&&c.push(`skip_http_redirect=${l.skipBrowserRedirect}`),`${a}?${c.join("&")}`}async _unenroll(a){try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;return d?this._returnResult({data:null,error:d}):await me(this.fetch,"DELETE",`${this.url}/factors/${a.factorId}`,{headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(a){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({friendly_name:a.friendlyName,factor_type:a.factorType},a.factorType==="phone"?{phone:a.phone}:a.factorType==="totp"?{issuer:a.issuer}:{}),{data:p,error:g}=await me(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(l=d?.session)===null||l===void 0?void 0:l.access_token});return g?this._returnResult({data:null,error:g}):(a.factorType==="totp"&&p.type==="totp"&&(!((c=p?.totp)===null||c===void 0)&&c.qr_code)&&(p.totp.qr_code=`data:image/svg+xml;utf-8,${p.totp.qr_code}`),this._returnResult({data:p,error:null}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _verify(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({data:null,error:d});const h=Object.assign({challenge_id:a.challengeId},"webauthn"in a?{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_response:a.webauthn.type==="create"?cj(a.webauthn.credential_response):uj(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:p}=await me(this.fetch,"POST",`${this.url}/factors/${a.factorId}/verify`,{body:h,headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+m.expires_in},m)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",m),this._returnResult({data:m,error:p}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({data:null,error:d});const h=await me(this.fetch,"POST",`${this.url}/factors/${a.factorId}/challenge`,{body:a,headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token});if(h.error)return h;const{data:m}=h;if(m.type!=="webauthn")return{data:m,error:null};switch(m.webauthn.type){case"create":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:lj(m.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:oj(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(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}=Ed(l.access_token);let h=null;d.aal&&(h=d.aal);let m=h;((r=(a=l.user.factors)===null||a===void 0?void 0:a.filter(v=>v.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const g=d.amr||[];return{data:{currentLevel:h,nextLevel:m,currentAuthenticationMethods:g},error:null}}async _getAuthorizationDetails(a){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?await me(this.fetch,"GET",`${this.url}/oauth/authorizations/${a}`,{headers:this.headers,jwt:l.access_token,xform:d=>({data:d,error:null})}):this._returnResult({data:null,error:new Jt})})}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 Jt});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&&Tt()&&!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 Jt});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&&Tt()&&!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 Jt})})}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 Jt})})}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+yS>c)return l;const{data:d,error:h}=await me(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(h)throw h;return!d.keys||d.keys.length===0||(this.jwks=d,this.jwks_cached_at=c,l=d.keys.find(m=>m.kid===a),!l)?null:l}async getClaims(a,r={}){try{let l=a;if(!l){const{data:S,error:A}=await this.getSession();if(A||!S.session)return this._returnResult({data:null,error:A});l=S.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:p}}=Ed(l);r?.allowExpired||$S(d.exp);const g=!c.alg||c.alg.startsWith("HS")||!c.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(c.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!g){const{error:S}=await this.getUser(l);if(S)throw S;return{data:{claims:d,header:c,signature:h},error:null}}const v=HS(c.alg),_=await crypto.subtle.importKey("jwk",g,v,!0,["verify"]);if(!await crypto.subtle.verify(v,_,h,TS(`${m}.${p}`)))throw new Fd("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}}}Yi.nextInstanceID={};const bj=Yi,xj="2.90.1";let Ui="";typeof Deno<"u"?Ui="deno":typeof document<"u"?Ui="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ui="react-native":Ui="node";const wj={"X-Client-Info":`supabase-js-${Ui}/${xj}`},_j={headers:wj},Sj={schema:"public"},jj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Nj={};function Ji(s){"@babel/helpers - typeof";return Ji=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},Ji(s)}function Ej(s,a){if(Ji(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Ji(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function Tj(s){var a=Ej(s,"string");return Ji(a)=="symbol"?a:a+""}function Aj(s,a,r){return(a=Tj(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Zg(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function et(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Zg(Object(r),!0).forEach(function(l){Aj(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Zg(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const Cj=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),kj=()=>Headers,Oj=(s,a,r)=>{const l=Cj(r),c=kj();return async(d,h)=>{var m;const p=(m=await a())!==null&&m!==void 0?m:s;let g=new c(h?.headers);return g.has("apikey")||g.set("apikey",s),g.has("Authorization")||g.set("Authorization",`Bearer ${p}`),l(d,et(et({},h),{},{headers:g}))}};function Rj(s){return s.endsWith("/")?s:s+"/"}function Dj(s,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=s,{db:p,auth:g,realtime:v,global:_}=a,x={db:et(et({},p),c),auth:et(et({},g),d),realtime:et(et({},v),h),storage:{},global:et(et(et({},_),m),{},{headers:et(et({},(r=_?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return s.accessToken?x.accessToken=s.accessToken:delete x.accessToken,x}function Mj(s){const a=s?.trim();if(!a)throw new Error("supabaseUrl is required.");if(!a.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Rj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var zj=class extends bj{constructor(s){super(s)}},Uj=class{constructor(s,a,r){var l,c;this.supabaseUrl=s,this.supabaseKey=a;const d=Mj(s);if(!a)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",d),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",d),this.storageUrl=new URL("storage/v1",d),this.functionsUrl=new URL("functions/v1",d);const h=`sb-${d.hostname.split(".")[0]}-auth-token`,m={db:Sj,realtime:Nj,auth:et(et({},jj),{},{storageKey:h}),global:_j},p=Dj(r??{},m);if(this.storageKey=(l=p.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=p.global.headers)!==null&&c!==void 0?c:{},p.accessToken)this.accessToken=p.accessToken,this.auth=new Proxy({},{get:(v,_)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(_)} is not possible`)}});else{var g;this.auth=this._initSupabaseAuthClient((g=p.auth)!==null&&g!==void 0?g:{},this.headers,p.global.fetch)}this.fetch=Oj(a,this._getAccessToken.bind(this),p.global.fetch),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this)},p.realtime)),this.accessToken&&this.accessToken().then(v=>this.realtime.setAuth(v)).catch(v=>console.warn("Failed to set initial Realtime auth token:",v)),this.rest=new p1(new URL("rest/v1",d).href,{headers:this.headers,schema:p.db.schema,fetch:this.fetch}),this.storage=new fS(this.storageUrl.href,this.headers,this.fetch,r?.storage),p.accessToken||this._listenForAuthEvents()}get functions(){return new u1(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(s){return this.rest.from(s)}schema(s){return this.rest.schema(s)}rpc(s,a={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(s,a,r)}channel(s,a={config:{}}){return this.realtime.channel(s,a)}getChannels(){return this.realtime.getChannels()}removeChannel(s){return this.realtime.removeChannel(s)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var s=this,a,r;if(s.accessToken)return await s.accessToken();const{data:l}=await s.auth.getSession();return(a=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:s.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:p,throwOnError:g},v,_){const x={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new zj({url:this.authUrl.href,headers:et(et({},x),v),storageKey:d,autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:p,throwOnError:g,fetch:_,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(s){return new R1(this.realtimeUrl.href,et(et({},s),{},{params:et(et({},{apikey:this.supabaseKey}),s?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((s,a)=>{this._handleTokenChanged(s,"CLIENT",a?.access_token)})}_handleTokenChanged(s,a,r){(s==="TOKEN_REFRESHED"||s==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):s==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Fg=(s,a,r)=>new Uj(s,a,r);function Lj(){if(typeof window<"u")return!1;const s=globalThis.process;if(!s)return!1;const a=s.version;if(a==null)return!1;const r=a.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Lj()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Po="email_automator_supabase_config";function Lr(){try{const s=localStorage.getItem(Po);if(s)return JSON.parse(s)}catch(s){console.error("Error reading Supabase config:",s)}return null}function Bj(s){try{localStorage.setItem(Po,JSON.stringify(s))}catch(a){console.error("Error saving Supabase config:",a)}}function qj(){try{localStorage.removeItem(Po)}catch(s){console.error("Error clearing Supabase config:",s)}}async function av(s,a){try{if(!s.startsWith("http://")&&!s.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const r=a.startsWith("eyJ"),l=a.startsWith("sb_publishable_");if(!r&&!l)return{valid:!1,error:"Invalid API key format (must be anon or publishable key)"};if(l)return{valid:!0};const c=await fetch(`${s}/rest/v1/`,{method:"GET",headers:{apikey:a,Authorization:`Bearer ${a}`}});return c.ok?{valid:!0}:c.status===401||c.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${c.statusText}`}}catch(r){return{valid:!1,error:r instanceof Error?r.message:"Connection failed"}}}function $j(){return localStorage.getItem(Po)?"ui":"none"}function Hj(){const s=Lr();return!s||!s.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Fg("https://placeholder.supabase.co","placeholder-key")):Fg(s.url,s.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=Hj();function Wg(){const s=Lr(),a=s?`${s.url}/functions/v1`:"",r=s?s.anonKey:"",l=window.location.port==="5173";let c="";return l?c="http://localhost:3004":c=window.location.origin,{edgeFunctionsUrl:a,expressApiUrl:c,anonKey:r}}class Vj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=Wg();this.edgeFunctionsUrl=a.edgeFunctionsUrl,this.expressApiUrl=a.expressApiUrl,this.anonKey=a.anonKey}setSupabaseClient(a){this.supabaseClient=a}setToken(a){console.debug(a?"[HybridApiClient] Token updated":"[HybridApiClient] Token cleared"),this.token=a}async request(a,r,l={}){const{auth:c=!0,...d}=l,h={"Content-Type":"application/json",...l.headers||{}};if(c&&!this.token&&this.supabaseClient){const{data:{session:m}}=await this.supabaseClient.auth.getSession();m?.access_token&&(this.token=m.access_token,console.debug("[HybridApiClient] Recovered token from session"))}if(c&&!this.token)return console.warn(`[HybridApiClient] Attempted protected request to ${r} without token`),{error:{code:"AUTH_REQUIRED",message:"You must be logged in to perform this action"}};c&&this.token&&(h.Authorization=`Bearer ${this.token}`);try{console.debug(`[HybridApiClient] ${l.method||"GET"} ${a}${r}`);const m=await fetch(`${a}${r}`,{...d,headers:h});if(!m.ok){const g=await m.json().catch(()=>({})),v=typeof g.error=="string"?g.error:g.error?.message||`Request failed: ${m.status}`;return{error:{code:g.error?.code||"API_ERROR",message:v}}}return{data:await m.json()}}catch(m){return{error:{code:"NETWORK_ERROR",message:m instanceof Error?m.message:"Network error"}}}}edgeRequest(a,r){const l={...r?.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,a,{...r,headers:l})}expressRequest(a,r){const l=Wg(),c={...r?.headers||{},"X-Supabase-Url":l.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":l.anonKey};return this.request(this.expressApiUrl,a,{...r,headers:c})}async getGmailAuthUrl(){return this.edgeRequest("/auth-gmail?action=url",{method:"GET"})}async connectGmail(a){return this.edgeRequest("/auth-gmail",{method:"POST",body:JSON.stringify({code:a})})}async startMicrosoftDeviceFlow(){return this.edgeRequest("/auth-microsoft?action=device-flow",{method:"POST"})}async pollMicrosoftDeviceCode(a){return this.edgeRequest("/auth-microsoft?action=poll",{method:"POST",body:JSON.stringify({deviceCode:a})})}async getAccounts(){return this.edgeRequest("/api-v1-accounts")}async disconnectAccount(a){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"DELETE"})}async updateAccount(a,r){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async getEmails(a={}){const r=new URLSearchParams;return a.limit&&r.set("limit",a.limit.toString()),a.offset&&r.set("offset",a.offset.toString()),a.category&&r.set("category",a.category),a.search&&r.set("search",a.search),a.sort_by&&r.set("sort_by",a.sort_by),a.sort_order&&r.set("sort_order",a.sort_order),this.edgeRequest(`/api-v1-emails?${r}`)}async getEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`)}async getEmailEvents(a){return this.edgeRequest(`/api-v1-emails/${a}/events`)}async deleteEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`,{method:"DELETE"})}async getCategorySummary(){return this.edgeRequest("/api-v1-emails/summary/categories")}async 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 qe=new Vj;async function sv(s){qe.setSupabaseClient(s);const{data:{session:a}}=await s.auth.getSession();a?.access_token&&qe.setToken(a.access_token),s.auth.onAuthStateChange((r,l)=>{qe.setToken(l?.access_token||null)})}const Ij=Object.freeze(Object.defineProperty({__proto__:null,api:qe,initializeApi:sv},Symbol.toStringTag,{value:"Module"}));function Gj({userId:s,onInsert:a,onUpdate:r,onDelete:l,enabled:c=!0}){const d=w.useRef(null);return w.useEffect(()=>{if(!c||!s)return;const h=ct.channel("emails-realtime").on("postgres_changes",{event:"INSERT",schema:"public",table:"emails"},m=>{a?.(m.new)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"emails"},m=>{r?.(m.new)}).on("postgres_changes",{event:"DELETE",schema:"public",table:"emails"},m=>{l?.(m.old.id)}).subscribe();return d.current=h,()=>{d.current&&ct.removeChannel(d.current)}},[s,c,a,r,l]),{isSubscribed:!!d.current}}class Pj{ctx=null;enabled=!1;constructor(){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 Tr=new Pj;let Xi=[],Wd=new Set;function nv(){Wd.forEach(s=>s())}const re={success:(s,a)=>jo("success",s,a),error:(s,a)=>jo("error",s,a),info:(s,a)=>jo("info",s,a),warning:(s,a)=>jo("warning",s,a)};function jo(s,a,r=5e3){const l=Math.random().toString(36).substr(2,9);Xi=[...Xi,{id:l,type:s,message:a,duration:r}],nv(),r>0&&setTimeout(()=>rv(l),r)}function rv(s){Xi=Xi.filter(a=>a.id!==s),nv()}function Kj(){const[,s]=w.useState(0);return w.useEffect(()=>{const a=()=>s(r=>r+1);return Wd.add(a),()=>{Wd.delete(a)}},[]),Xi}const Yj={success:rf,error:Dr,info:kr,warning:Rr},Jj={success:"bg-emerald-500/10 border-emerald-500/20 text-emerald-600 dark:text-emerald-400",error:"bg-destructive/10 border-destructive/20 text-destructive",info:"bg-blue-500/10 border-blue-500/20 text-blue-600 dark:text-blue-400",warning:"bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-400"};function Xj({toast:s}){const a=Yj[s.type];return o.jsxs("div",{className:Oe("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-right-full duration-300",Jj[s.type]),children:[o.jsx(a,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),o.jsx("p",{className:"text-sm flex-1",children:s.message}),o.jsx("button",{onClick:()=>rv(s.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(el,{className:"w-4 h-4"})})]})}function Qj(){const s=Kj();return s.length===0?null:o.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full",children:s.map(a=>o.jsx(Xj,{toast:a},a.id))})}function Sa(s,a){return s?typeof s=="string"?s:s.message||a:a}const iv={user:null,isAuthenticated:!1,profile:null,emails:[],accounts:[],rules:[],settings:null,stats:null,isLoading:!0,isInitialized:!1,error:null,selectedEmailId:null,emailsTotal:0,emailsOffset:0,sortBy:"date",sortOrder:"desc"};function Zj(s,a){switch(a.type){case"SET_USER":return{...s,user:a.payload,isAuthenticated:!!a.payload,isLoading:!1};case"SET_LOADING":return{...s,isLoading:a.payload};case"SET_INITIALIZED":return{...s,isInitialized:a.payload};case"SET_ERROR":return{...s,error:a.payload,isLoading:!1};case"SET_EMAILS":return{...s,emails:a.payload.emails,emailsTotal:a.payload.total,emailsOffset:a.payload.offset,sortBy:a.payload.sortBy||s.sortBy,sortOrder:a.payload.sortOrder||s.sortOrder};case"ADD_EMAIL":return{...s,emails:[a.payload,...s.emails],emailsTotal:s.emailsTotal+1};case"UPDATE_EMAIL":return{...s,emails:s.emails.map(r=>r.id===a.payload.id?a.payload:r)};case"SET_PROFILE":return{...s,profile:a.payload};case"UPDATE_PROFILE":return{...s,profile:a.payload};case"SET_ACCOUNTS":return{...s,accounts:a.payload};case"ADD_ACCOUNT":return{...s,accounts:[a.payload,...s.accounts]};case"REMOVE_ACCOUNT":return{...s,accounts:s.accounts.filter(r=>r.id!==a.payload)};case"SET_RULES":return{...s,rules:a.payload};case"ADD_RULE":return{...s,rules:[a.payload,...s.rules]};case"UPDATE_RULE":return{...s,rules:s.rules.map(r=>r.id===a.payload.id?a.payload:r)};case"REMOVE_RULE":return{...s,rules:s.rules.filter(r=>r.id!==a.payload)};case"SET_SETTINGS":return{...s,settings:a.payload};case"SET_STATS":return{...s,stats:a.payload};case"SET_SELECTED_EMAIL":return{...s,selectedEmailId:a.payload};case"CLEAR_DATA":return{...iv,isLoading:!1,isInitialized:!0};default:return s}}const lv=w.createContext(null);function Fj({children:s}){const[a,r]=w.useReducer(Zj,iv),l=w.useCallback(p=>{r({type:"ADD_EMAIL",payload:p}),p.ai_analysis?.priority==="High"?(Tr.playAlert(),re.success("High Priority Email Processed!")):(Tr.playNotify(),re.info("New email processed"))},[r]),c=w.useCallback(p=>{r({type:"UPDATE_EMAIL",payload:p})},[r]),d=w.useCallback(p=>{},[r]),{isSubscribed:h}=Gj({userId:a.user?.id,onInsert:l,onUpdate:c,onDelete:d,enabled:a.isAuthenticated});w.useEffect(()=>{async function p(){if(!Lr()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:v}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(v&&v.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await sv(ct);const{data:{session:_}}=await ct.auth.getSession();r({type:"SET_USER",payload:_?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:x}}=ct.auth.onAuthStateChange((S,A)=>{r({type:"SET_USER",payload:A?.user||null}),A||r({type:"CLEAR_DATA"})});return()=>x.unsubscribe()}catch(v){console.error("[AppContext] Init error:",v),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}p()},[]);const m={fetchEmails:async(p={})=>{const g=await qe.getEmails({limit:20,offset:p.offset||0,category:p.category,search:p.search,sort_by:p.sortBy||a.sortBy,sort_order:p.sortOrder||a.sortOrder});g.data&&r({type:"SET_EMAILS",payload:{emails:g.data.emails,total:g.data.total,offset:p.offset||0,sortBy:p.sortBy,sortOrder:p.sortOrder}})},fetchAccounts:async()=>{const p=await qe.getAccounts();p.data&&r({type:"SET_ACCOUNTS",payload:p.data.accounts})},fetchRules:async()=>{const p=await qe.getRules();p.data&&r({type:"SET_RULES",payload:p.data.rules})},fetchSettings:async()=>{const p=await qe.getSettings();p.data&&r({type:"SET_SETTINGS",payload:p.data.settings})},fetchProfile:async()=>{const p=await qe.getProfile();p.data&&r({type:"SET_PROFILE",payload:p.data})},fetchStats:async()=>{const p=await qe.getStats();p.data&&r({type:"SET_STATS",payload:p.data.stats})},executeAction:async(p,g,v)=>{const _=await qe.executeAction(p,g,v);if(_.data?.success){const x=a.emails.find(S=>S.id===p);return x&&r({type:"UPDATE_EMAIL",payload:{...x,action_taken:g}}),!0}return r({type:"SET_ERROR",payload:Sa(_.error,"Action failed")}),!1},triggerSync:async p=>{const g=p?await qe.triggerSync(p):await qe.syncAll();return await m.fetchAccounts(),g.error?(r({type:"SET_ERROR",payload:Sa(g.error,"Sync failed")}),!1):!0},disconnectAccount:async p=>{const g=await qe.disconnectAccount(p);return g.data?.success?(r({type:"REMOVE_ACCOUNT",payload:p}),!0):(r({type:"SET_ERROR",payload:Sa(g.error,"Failed to disconnect")}),!1)},updateSettings:async p=>{const g=await qe.updateSettings(p);return g.data?(r({type:"SET_SETTINGS",payload:g.data.settings}),!0):(r({type:"SET_ERROR",payload:Sa(g.error,"Failed to update settings")}),!1)},updateProfile:async p=>{const g=await qe.updateProfile(p);return g.data?(r({type:"UPDATE_PROFILE",payload:g.data}),!0):(r({type:"SET_ERROR",payload:Sa(g.error,"Failed to update profile")}),!1)},updateAccount:async(p,g)=>{const v=await qe.updateAccount(p,g);return v.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(_=>_.id===p?{..._,...g}:_)}),!0):(r({type:"SET_ERROR",payload:Sa(v.error,"Failed to update account")}),!1)},createRule:async p=>{const g=await qe.createRule(p);return g.data?(r({type:"ADD_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:Sa(g.error,"Failed to create rule")}),!1)},updateRule:async(p,g)=>{const v=await qe.updateRule(p,g);return v.data?(r({type:"UPDATE_RULE",payload:v.data.rule}),!0):(r({type:"SET_ERROR",payload:Sa(v.error,"Failed to update rule")}),!1)},deleteRule:async p=>{const g=await qe.deleteRule(p);return g.data?.success?(r({type:"REMOVE_RULE",payload:p}),!0):(r({type:"SET_ERROR",payload:Sa(g.error,"Failed to delete rule")}),!1)},toggleRule:async p=>{const g=await qe.toggleRule(p);return g.data?(r({type:"UPDATE_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:Sa(g.error,"Failed to toggle rule")}),!1)}};return o.jsx(lv.Provider,{value:{state:a,isSubscribed:h,dispatch:r,actions:m},children:s})}function Br(){const s=w.useContext(lv);if(!s)throw new Error("useApp must be used within AppProvider");return s}const Wj=w.createContext(void 0);function eN({children:s,value:a}){return o.jsx(Wj.Provider,{value:a,children:s})}const ov=w.createContext(null);function tN({children:s}){const[a,r]=w.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(ov.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:s})}function cv(){const s=w.useContext(ov);if(!s)throw new Error("useTerminal must be used within a TerminalProvider");return s}const At=w.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("rounded-xl border bg-card text-card-foreground shadow",s),...a}));At.displayName="Card";const Ea=w.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("flex flex-col space-y-1.5 p-6",s),...a}));Ea.displayName="CardHeader";const Ta=w.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("font-semibold leading-none tracking-tight",s),...a}));Ta.displayName="CardTitle";const es=w.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("text-sm text-muted-foreground",s),...a}));es.displayName="CardDescription";const Aa=w.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("p-6 pt-0",s),...a}));Aa.displayName="CardContent";const uv=w.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("flex items-center p-6 pt-0",s),...a}));uv.displayName="CardFooter";class aN extends 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(At,{className:"max-w-md w-full p-8 text-center",children:[o.jsx("div",{className:"w-16 h-16 bg-destructive/10 text-destructive rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(Rr,{className:"w-8 h-8"})}),o.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),o.jsx("p",{className:"text-muted-foreground mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&o.jsx("pre",{className:"text-xs text-left bg-secondary p-3 rounded-lg mb-6 overflow-auto max-h-32",children:this.state.error.message}),o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsxs(Z,{onClick:this.handleReset,variant:"outline",children:[o.jsx(Or,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(Z,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function mt({size:s="md",className:a,text:r}){const l={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};return o.jsxs("div",{className:Oe("flex flex-col items-center justify-center gap-3",a),children:[o.jsx($t,{className:Oe("animate-spin text-primary",l[s])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function qi({text:s="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(mt,{size:"lg",text:s})})}function sN(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(mt,{size:"md"})})}function Us(s,a,{checkForDefaultPrevented:r=!0}={}){return function(c){if(s?.(c),r===!1||!c.defaultPrevented)return a?.(c)}}function nN(s,a){const r=w.createContext(a),l=d=>{const{children:h,...m}=d,p=w.useMemo(()=>m,Object.values(m));return o.jsx(r.Provider,{value:p,children:h})};l.displayName=s+"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 \`${s}\``)}return[l,c]}function rN(s,a=[]){let r=[];function l(d,h){const m=w.createContext(h),p=r.length;r=[...r,h];const g=_=>{const{scope:x,children:S,...A}=_,j=x?.[s]?.[p]||m,O=w.useMemo(()=>A,Object.values(A));return o.jsx(j.Provider,{value:O,children:S})};g.displayName=d+"Provider";function v(_,x){const S=x?.[s]?.[p]||m,A=w.useContext(S);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${_}\` must be used within \`${d}\``)}return[g,v]}const c=()=>{const d=r.map(h=>w.createContext(h));return function(m){const p=m?.[s]||d;return w.useMemo(()=>({[`__scope${s}`]:{...m,[s]:p}}),[m,p])}};return c.scopeName=s,[l,iN(c,...a)]}function iN(...s){const a=s[0];if(s.length===1)return a;const r=()=>{const l=s.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const h=l.reduce((m,{useScope:p,scopeName:g})=>{const _=p(d)[`__scope${g}`];return{...m,..._}},{});return w.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var Qi=globalThis?.document?w.useLayoutEffect:()=>{},lN=nf[" useId ".trim().toString()]||(()=>{}),oN=0;function Cd(s){const[a,r]=w.useState(lN());return Qi(()=>{r(l=>l??String(oN++))},[s]),s||(a?`radix-${a}`:"")}var cN=nf[" useInsertionEffect ".trim().toString()]||Qi;function uN({prop:s,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=dN({defaultProp:a,onChange:r}),m=s!==void 0,p=m?s:c;{const v=w.useRef(s!==void 0);w.useEffect(()=>{const _=v.current;_!==m&&console.warn(`${l} is changing from ${_?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=m},[m,l])}const g=w.useCallback(v=>{if(m){const _=fN(v)?v(s):v;_!==s&&h.current?.(_)}else d(v)},[m,s,d,h]);return[p,g]}function dN({defaultProp:s,onChange:a}){const[r,l]=w.useState(s),c=w.useRef(r),d=w.useRef(a);return cN(()=>{d.current=a},[a]),w.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function fN(s){return typeof s=="function"}var dv=py();const hN=af(dv);function mN(s){const a=pN(s),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(yN);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function pN(s){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=bN(c),m=vN(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Vo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var gN=Symbol("radix.slottable");function yN(s){return w.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===gN}function vN(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function bN(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var xN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],as=xN.reduce((s,a)=>{const r=mN(`Primitive.${a}`),l=w.forwardRef((c,d)=>{const{asChild:h,...m}=c,p=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...s,[a]:l}},{});function wN(s,a){s&&dv.flushSync(()=>s.dispatchEvent(a))}function Zi(s){const a=w.useRef(s);return w.useEffect(()=>{a.current=s}),w.useMemo(()=>(...r)=>a.current?.(...r),[])}function _N(s,a=globalThis?.document){const r=Zi(s);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 SN="DismissableLayer",ef="dismissableLayer.update",jN="dismissableLayer.pointerDownOutside",NN="dismissableLayer.focusOutside",ey,fv=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hv=w.forwardRef((s,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...p}=s,g=w.useContext(fv),[v,_]=w.useState(null),x=v?.ownerDocument??globalThis?.document,[,S]=w.useState({}),A=yn(a,P=>_(P)),j=Array.from(g.layers),[O]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),R=j.indexOf(O),q=v?j.indexOf(v):-1,B=g.layersWithOutsidePointerEventsDisabled.size>0,G=q>=R,ee=AN(P=>{const X=P.target,ue=[...g.branches].some(Je=>Je.contains(X));!G||ue||(c?.(P),h?.(P),P.defaultPrevented||m?.())},x),J=CN(P=>{const X=P.target;[...g.branches].some(Je=>Je.contains(X))||(d?.(P),h?.(P),P.defaultPrevented||m?.())},x);return _N(P=>{q===g.layers.size-1&&(l?.(P),!P.defaultPrevented&&m&&(P.preventDefault(),m()))},x),w.useEffect(()=>{if(v)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(ey=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),ty(),()=>{r&&g.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=ey)}},[v,x,r,g]),w.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),ty())},[v,g]),w.useEffect(()=>{const P=()=>S({});return document.addEventListener(ef,P),()=>document.removeEventListener(ef,P)},[]),o.jsx(as.div,{...p,ref:A,style:{pointerEvents:B?G?"auto":"none":void 0,...s.style},onFocusCapture:Us(s.onFocusCapture,J.onFocusCapture),onBlurCapture:Us(s.onBlurCapture,J.onBlurCapture),onPointerDownCapture:Us(s.onPointerDownCapture,ee.onPointerDownCapture)})});hv.displayName=SN;var EN="DismissableLayerBranch",TN=w.forwardRef((s,a)=>{const r=w.useContext(fv),l=w.useRef(null),c=yn(a,l);return w.useEffect(()=>{const d=l.current;if(d)return r.branches.add(d),()=>{r.branches.delete(d)}},[r.branches]),o.jsx(as.div,{...s,ref:c})});TN.displayName=EN;function AN(s,a=globalThis?.document){const r=Zi(s),l=w.useRef(!1),c=w.useRef(()=>{});return w.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let p=function(){mv(jN,r,g,{discrete:!0})};const g={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=p,a.addEventListener("click",c.current,{once:!0})):p()}else a.removeEventListener("click",c.current);l.current=!1},h=window.setTimeout(()=>{a.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(h),a.removeEventListener("pointerdown",d),a.removeEventListener("click",c.current)}},[a,r]),{onPointerDownCapture:()=>l.current=!0}}function CN(s,a=globalThis?.document){const r=Zi(s),l=w.useRef(!1);return w.useEffect(()=>{const c=d=>{d.target&&!l.current&&mv(NN,r,{originalEvent:d},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,r]),{onFocusCapture:()=>l.current=!0,onBlurCapture:()=>l.current=!1}}function ty(){const s=new CustomEvent(ef);document.dispatchEvent(s)}function mv(s,a,r,{discrete:l}){const c=r.originalEvent.target,d=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:r});a&&c.addEventListener(s,a,{once:!0}),l?wN(c,d):c.dispatchEvent(d)}var kd="focusScope.autoFocusOnMount",Od="focusScope.autoFocusOnUnmount",ay={bubbles:!1,cancelable:!0},kN="FocusScope",pv=w.forwardRef((s,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=s,[m,p]=w.useState(null),g=Zi(c),v=Zi(d),_=w.useRef(null),x=yn(a,j=>p(j)),S=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(l){let j=function(B){if(S.paused||!m)return;const G=B.target;m.contains(G)?_.current=G:Rs(_.current,{select:!0})},O=function(B){if(S.paused||!m)return;const G=B.relatedTarget;G!==null&&(m.contains(G)||Rs(_.current,{select:!0}))},R=function(B){if(document.activeElement===document.body)for(const ee of B)ee.removedNodes.length>0&&Rs(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",O);const q=new MutationObserver(R);return m&&q.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",O),q.disconnect()}}},[l,m,S.paused]),w.useEffect(()=>{if(m){ny.add(S);const j=document.activeElement;if(!m.contains(j)){const R=new CustomEvent(kd,ay);m.addEventListener(kd,g),m.dispatchEvent(R),R.defaultPrevented||(ON(UN(gv(m)),{select:!0}),document.activeElement===j&&Rs(m))}return()=>{m.removeEventListener(kd,g),setTimeout(()=>{const R=new CustomEvent(Od,ay);m.addEventListener(Od,v),m.dispatchEvent(R),R.defaultPrevented||Rs(j??document.body,{select:!0}),m.removeEventListener(Od,v),ny.remove(S)},0)}}},[m,g,v,S]);const A=w.useCallback(j=>{if(!r&&!l||S.paused)return;const O=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,R=document.activeElement;if(O&&R){const q=j.currentTarget,[B,G]=RN(q);B&&G?!j.shiftKey&&R===G?(j.preventDefault(),r&&Rs(B,{select:!0})):j.shiftKey&&R===B&&(j.preventDefault(),r&&Rs(G,{select:!0})):R===q&&j.preventDefault()}},[r,l,S.paused]);return o.jsx(as.div,{tabIndex:-1,...h,ref:x,onKeyDown:A})});pv.displayName=kN;function ON(s,{select:a=!1}={}){const r=document.activeElement;for(const l of s)if(Rs(l,{select:a}),document.activeElement!==r)return}function RN(s){const a=gv(s),r=sy(a,s),l=sy(a.reverse(),s);return[r,l]}function gv(s){const a=[],r=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const c=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||c?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)a.push(r.currentNode);return a}function sy(s,a){for(const r of s)if(!DN(r,{upTo:a}))return r}function DN(s,{upTo:a}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(a!==void 0&&s===a)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function MN(s){return s instanceof HTMLInputElement&&"select"in s}function Rs(s,{select:a=!1}={}){if(s&&s.focus){const r=document.activeElement;s.focus({preventScroll:!0}),s!==r&&MN(s)&&a&&s.select()}}var ny=zN();function zN(){let s=[];return{add(a){const r=s[0];a!==r&&r?.pause(),s=ry(s,a),s.unshift(a)},remove(a){s=ry(s,a),s[0]?.resume()}}}function ry(s,a){const r=[...s],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function UN(s){return s.filter(a=>a.tagName!=="A")}var LN="Portal",yv=w.forwardRef((s,a)=>{const{container:r,...l}=s,[c,d]=w.useState(!1);Qi(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?hN.createPortal(o.jsx(as.div,{...l,ref:a}),h):null});yv.displayName=LN;function BN(s,a){return w.useReducer((r,l)=>a[r][l]??r,s)}var Ko=s=>{const{present:a,children:r}=s,l=qN(a),c=typeof r=="function"?r({present:l.isPresent}):w.Children.only(r),d=yn(l.ref,$N(c));return typeof r=="function"||l.isPresent?w.cloneElement(c,{ref:d}):null};Ko.displayName="Presence";function qN(s){const[a,r]=w.useState(),l=w.useRef(null),c=w.useRef(s),d=w.useRef("none"),h=s?"mounted":"unmounted",[m,p]=BN(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const g=No(l.current);d.current=m==="mounted"?g:"none"},[m]),Qi(()=>{const g=l.current,v=c.current;if(v!==s){const x=d.current,S=No(g);s?p("MOUNT"):S==="none"||g?.display==="none"?p("UNMOUNT"):p(v&&x!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,p]),Qi(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,_=S=>{const j=No(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&j&&(p("ANIMATION_END"),!c.current)){const O=a.style.animationFillMode;a.style.animationFillMode="forwards",g=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=O)})}},x=S=>{S.target===a&&(d.current=No(l.current))};return a.addEventListener("animationstart",x),a.addEventListener("animationcancel",_),a.addEventListener("animationend",_),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",x),a.removeEventListener("animationcancel",_),a.removeEventListener("animationend",_)}}else p("ANIMATION_END")},[a,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:w.useCallback(g=>{l.current=g?getComputedStyle(g):null,r(g)},[])}}function No(s){return s?.animationName||"none"}function $N(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Rd=0;function HN(){w.useEffect(()=>{const s=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",s[0]??iy()),document.body.insertAdjacentElement("beforeend",s[1]??iy()),Rd++,()=>{Rd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Rd--}},[])}function iy(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var Ro="right-scroll-bar-position",Do="width-before-scroll-bar",VN="with-scroll-bars-hidden",IN="--removed-body-scroll-bar-size";function Dd(s,a){return typeof s=="function"?s(a):s&&(s.current=a),s}function GN(s,a){var r=w.useState(function(){return{value:s,callback:a,facade:{get current(){return r.value},set current(l){var c=r.value;c!==l&&(r.value=l,r.callback(l,c))}}}})[0];return r.callback=a,r.facade}var PN=typeof window<"u"?w.useLayoutEffect:w.useEffect,ly=new WeakMap;function KN(s,a){var r=GN(null,function(l){return s.forEach(function(c){return Dd(c,l)})});return PN(function(){var l=ly.get(r);if(l){var c=new Set(l),d=new Set(s),h=r.current;c.forEach(function(m){d.has(m)||Dd(m,null)}),d.forEach(function(m){c.has(m)||Dd(m,h)})}ly.set(r,s)},[s]),r}function YN(s){return s}function JN(s,a){a===void 0&&(a=YN);var r=[],l=!1,c={read:function(){if(l)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:s},useMedium:function(d){var h=a(d,l);return r.push(h),function(){r=r.filter(function(m){return m!==h})}},assignSyncMedium:function(d){for(l=!0;r.length;){var h=r;r=[],h.forEach(d)}r={push:function(m){return d(m)},filter:function(){return r}}},assignMedium:function(d){l=!0;var h=[];if(r.length){var m=r;r=[],m.forEach(d),h=r}var p=function(){var v=h;h=[],v.forEach(d)},g=function(){return Promise.resolve().then(p)};g(),r={push:function(v){h.push(v),g()},filter:function(v){return h=h.filter(v),r}}}};return c}function XN(s){s===void 0&&(s={});var a=JN(null);return a.options=Na({async:!0,ssr:!1},s),a}var vv=function(s){var a=s.sideCar,r=Ur(s,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var l=a.read();if(!l)throw new Error("Sidecar medium not found");return w.createElement(l,Na({},r))};vv.isSideCarExport=!0;function QN(s,a){return s.useMedium(a),vv}var bv=XN(),Md=function(){},Yo=w.forwardRef(function(s,a){var r=w.useRef(null),l=w.useState({onScrollCapture:Md,onWheelCapture:Md,onTouchMoveCapture:Md}),c=l[0],d=l[1],h=s.forwardProps,m=s.children,p=s.className,g=s.removeScrollBar,v=s.enabled,_=s.shards,x=s.sideCar,S=s.noRelative,A=s.noIsolation,j=s.inert,O=s.allowPinchZoom,R=s.as,q=R===void 0?"div":R,B=s.gapMode,G=Ur(s,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),ee=x,J=KN([r,a]),P=Na(Na({},G),c);return w.createElement(w.Fragment,null,v&&w.createElement(ee,{sideCar:bv,removeScrollBar:g,shards:_,noRelative:S,noIsolation:A,inert:j,setCallbacks:d,allowPinchZoom:!!O,lockRef:r,gapMode:B}),h?w.cloneElement(w.Children.only(m),Na(Na({},P),{ref:J})):w.createElement(q,Na({},P,{className:p,ref:J}),m))});Yo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Yo.classNames={fullWidth:Do,zeroRight:Ro};var ZN=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function FN(){if(!document)return null;var s=document.createElement("style");s.type="text/css";var a=ZN();return a&&s.setAttribute("nonce",a),s}function WN(s,a){s.styleSheet?s.styleSheet.cssText=a:s.appendChild(document.createTextNode(a))}function e2(s){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(s)}var t2=function(){var s=0,a=null;return{add:function(r){s==0&&(a=FN())&&(WN(a,r),e2(a)),s++},remove:function(){s--,!s&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},a2=function(){var s=t2();return function(a,r){w.useEffect(function(){return s.add(a),function(){s.remove()}},[a&&r])}},xv=function(){var s=a2(),a=function(r){var l=r.styles,c=r.dynamic;return s(l,c),null};return a},s2={left:0,top:0,right:0,gap:0},zd=function(s){return parseInt(s||"",10)||0},n2=function(s){var a=window.getComputedStyle(document.body),r=a[s==="padding"?"paddingLeft":"marginLeft"],l=a[s==="padding"?"paddingTop":"marginTop"],c=a[s==="padding"?"paddingRight":"marginRight"];return[zd(r),zd(l),zd(c)]},r2=function(s){if(s===void 0&&(s="margin"),typeof window>"u")return s2;var a=n2(s),r=document.documentElement.clientWidth,l=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,l-r+a[2]-a[0])}},i2=xv(),Ar="data-scroll-locked",l2=function(s,a,r,l){var c=s.left,d=s.top,h=s.right,m=s.gap;return r===void 0&&(r="margin"),`
|
|
52
|
-
.`.concat(VN,` {
|
|
53
|
-
overflow: hidden `).concat(l,`;
|
|
54
|
-
padding-right: `).concat(m,"px ").concat(l,`;
|
|
55
|
-
}
|
|
56
|
-
body[`).concat(Ar,`] {
|
|
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(Ro,` {
|
|
70
|
-
right: `).concat(m,"px ").concat(l,`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.`).concat(Do,` {
|
|
74
|
-
margin-right: `).concat(m,"px ").concat(l,`;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.`).concat(Ro," .").concat(Ro,` {
|
|
78
|
-
right: 0 `).concat(l,`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.`).concat(Do," .").concat(Do,` {
|
|
82
|
-
margin-right: 0 `).concat(l,`;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
body[`).concat(Ar,`] {
|
|
86
|
-
`).concat(IN,": ").concat(m,`px;
|
|
87
|
-
}
|
|
88
|
-
`)},oy=function(){var s=parseInt(document.body.getAttribute(Ar)||"0",10);return isFinite(s)?s:0},o2=function(){w.useEffect(function(){return document.body.setAttribute(Ar,(oy()+1).toString()),function(){var s=oy()-1;s<=0?document.body.removeAttribute(Ar):document.body.setAttribute(Ar,s.toString())}},[])},c2=function(s){var a=s.noRelative,r=s.noImportant,l=s.gapMode,c=l===void 0?"margin":l;o2();var d=w.useMemo(function(){return r2(c)},[c]);return w.createElement(i2,{styles:l2(d,!a,c,r?"":"!important")})},tf=!1;if(typeof window<"u")try{var Eo=Object.defineProperty({},"passive",{get:function(){return tf=!0,!0}});window.addEventListener("test",Eo,Eo),window.removeEventListener("test",Eo,Eo)}catch{tf=!1}var vr=tf?{passive:!1}:!1,u2=function(s){return s.tagName==="TEXTAREA"},wv=function(s,a){if(!(s instanceof Element))return!1;var r=window.getComputedStyle(s);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!u2(s)&&r[a]==="visible")},d2=function(s){return wv(s,"overflowY")},f2=function(s){return wv(s,"overflowX")},cy=function(s,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=_v(s,l);if(c){var d=Sv(s,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},h2=function(s){var a=s.scrollTop,r=s.scrollHeight,l=s.clientHeight;return[a,r,l]},m2=function(s){var a=s.scrollLeft,r=s.scrollWidth,l=s.clientWidth;return[a,r,l]},_v=function(s,a){return s==="v"?d2(a):f2(a)},Sv=function(s,a){return s==="v"?h2(a):m2(a)},p2=function(s,a){return s==="h"&&a==="rtl"?-1:1},g2=function(s,a,r,l,c){var d=p2(s,window.getComputedStyle(a).direction),h=d*l,m=r.target,p=a.contains(m),g=!1,v=h>0,_=0,x=0;do{if(!m)break;var S=Sv(s,m),A=S[0],j=S[1],O=S[2],R=j-O-d*A;(A||R)&&_v(s,m)&&(_+=R,x+=A);var q=m.parentNode;m=q&&q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?q.host:q}while(!p&&m!==document.body||p&&(a.contains(m)||a===m));return(v&&Math.abs(_)<1||!v&&Math.abs(x)<1)&&(g=!0),g},To=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},uy=function(s){return[s.deltaX,s.deltaY]},dy=function(s){return s&&"current"in s?s.current:s},y2=function(s,a){return s[0]===a[0]&&s[1]===a[1]},v2=function(s){return`
|
|
89
|
-
.block-interactivity-`.concat(s,` {pointer-events: none;}
|
|
90
|
-
.allow-interactivity-`).concat(s,` {pointer-events: all;}
|
|
91
|
-
`)},b2=0,br=[];function x2(s){var a=w.useRef([]),r=w.useRef([0,0]),l=w.useRef(),c=w.useState(b2++)[0],d=w.useState(xv)[0],h=w.useRef(s);w.useEffect(function(){h.current=s},[s]),w.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(c));var j=l1([s.lockRef.current],(s.shards||[]).map(dy),!0).filter(Boolean);return j.forEach(function(O){return O.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(O){return O.classList.remove("allow-interactivity-".concat(c))})}}},[s.inert,s.lockRef.current,s.shards]);var m=w.useCallback(function(j,O){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!h.current.allowPinchZoom;var R=To(j),q=r.current,B="deltaX"in j?j.deltaX:q[0]-R[0],G="deltaY"in j?j.deltaY:q[1]-R[1],ee,J=j.target,P=Math.abs(B)>Math.abs(G)?"h":"v";if("touches"in j&&P==="h"&&J.type==="range")return!1;var X=window.getSelection(),ue=X&&X.anchorNode,Je=ue?ue===J||ue.contains(J):!1;if(Je)return!1;var be=cy(P,J);if(!be)return!0;if(be?ee=P:(ee=P==="v"?"h":"v",be=cy(P,J)),!be)return!1;if(!l.current&&"changedTouches"in j&&(B||G)&&(l.current=ee),!ee)return!0;var ge=l.current||ee;return g2(ge,O,j,ge==="h"?B:G)},[]),p=w.useCallback(function(j){var O=j;if(!(!br.length||br[br.length-1]!==d)){var R="deltaY"in O?uy(O):To(O),q=a.current.filter(function(ee){return ee.name===O.type&&(ee.target===O.target||O.target===ee.shadowParent)&&y2(ee.delta,R)})[0];if(q&&q.should){O.cancelable&&O.preventDefault();return}if(!q){var B=(h.current.shards||[]).map(dy).filter(Boolean).filter(function(ee){return ee.contains(O.target)}),G=B.length>0?m(O,B[0]):!h.current.noIsolation;G&&O.cancelable&&O.preventDefault()}}},[]),g=w.useCallback(function(j,O,R,q){var B={name:j,delta:O,target:R,should:q,shadowParent:w2(R)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(G){return G!==B})},1)},[]),v=w.useCallback(function(j){r.current=To(j),l.current=void 0},[]),_=w.useCallback(function(j){g(j.type,uy(j),j.target,m(j,s.lockRef.current))},[]),x=w.useCallback(function(j){g(j.type,To(j),j.target,m(j,s.lockRef.current))},[]);w.useEffect(function(){return br.push(d),s.setCallbacks({onScrollCapture:_,onWheelCapture:_,onTouchMoveCapture:x}),document.addEventListener("wheel",p,vr),document.addEventListener("touchmove",p,vr),document.addEventListener("touchstart",v,vr),function(){br=br.filter(function(j){return j!==d}),document.removeEventListener("wheel",p,vr),document.removeEventListener("touchmove",p,vr),document.removeEventListener("touchstart",v,vr)}},[]);var S=s.removeScrollBar,A=s.inert;return w.createElement(w.Fragment,null,A?w.createElement(d,{styles:v2(c)}):null,S?w.createElement(c2,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function w2(s){for(var a=null;s!==null;)s instanceof ShadowRoot&&(a=s.host,s=s.host),s=s.parentNode;return a}const _2=QN(bv,x2);var jv=w.forwardRef(function(s,a){return w.createElement(Yo,Na({},s,{ref:a,sideCar:_2}))});jv.classNames=Yo.classNames;var S2=function(s){if(typeof document>"u")return null;var a=Array.isArray(s)?s[0]:s;return a.ownerDocument.body},xr=new WeakMap,Ao=new WeakMap,Co={},Ud=0,Nv=function(s){return s&&(s.host||Nv(s.parentNode))},j2=function(s,a){return a.map(function(r){if(s.contains(r))return r;var l=Nv(r);return l&&s.contains(l)?l:(console.error("aria-hidden",r,"in not contained inside",s,". Doing nothing"),null)}).filter(function(r){return!!r})},N2=function(s,a,r,l){var c=j2(a,Array.isArray(s)?s:[s]);Co[r]||(Co[r]=new WeakMap);var d=Co[r],h=[],m=new Set,p=new Set(c),g=function(_){!_||m.has(_)||(m.add(_),g(_.parentNode))};c.forEach(g);var v=function(_){!_||p.has(_)||Array.prototype.forEach.call(_.children,function(x){if(m.has(x))v(x);else try{var S=x.getAttribute(l),A=S!==null&&S!=="false",j=(xr.get(x)||0)+1,O=(d.get(x)||0)+1;xr.set(x,j),d.set(x,O),h.push(x),j===1&&A&&Ao.set(x,!0),O===1&&x.setAttribute(r,"true"),A||x.setAttribute(l,"true")}catch(R){console.error("aria-hidden: cannot operate on ",x,R)}})};return v(a),m.clear(),Ud++,function(){h.forEach(function(_){var x=xr.get(_)-1,S=d.get(_)-1;xr.set(_,x),d.set(_,S),x||(Ao.has(_)||_.removeAttribute(l),Ao.delete(_)),S||_.removeAttribute(r)}),Ud--,Ud||(xr=new WeakMap,xr=new WeakMap,Ao=new WeakMap,Co={})}},E2=function(s,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(s)?s:[s]),c=S2(s);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),N2(l,c,r,"aria-hidden")):function(){return null}};function T2(s){const a=A2(s),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(k2);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function A2(s){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=R2(c),m=O2(d,c.props);return c.type!==w.Fragment&&(m.ref=l?Vo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var C2=Symbol("radix.slottable");function k2(s){return w.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===C2}function O2(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function R2(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Jo="Dialog",[Ev]=rN(Jo),[D2,pa]=Ev(Jo),Tv=s=>{const{__scopeDialog:a,children:r,open:l,defaultOpen:c,onOpenChange:d,modal:h=!0}=s,m=w.useRef(null),p=w.useRef(null),[g,v]=uN({prop:l,defaultProp:c??!1,onChange:d,caller:Jo});return o.jsx(D2,{scope:a,triggerRef:m,contentRef:p,contentId:Cd(),titleId:Cd(),descriptionId:Cd(),open:g,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(_=>!_),[v]),modal:h,children:r})};Tv.displayName=Jo;var Av="DialogTrigger",M2=w.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=pa(Av,r),d=yn(a,c.triggerRef);return o.jsx(as.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":yf(c.open),...l,ref:d,onClick:Us(s.onClick,c.onOpenToggle)})});M2.displayName=Av;var pf="DialogPortal",[z2,Cv]=Ev(pf,{forceMount:void 0}),kv=s=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=s,d=pa(pf,a);return o.jsx(z2,{scope:a,forceMount:r,children:w.Children.map(l,h=>o.jsx(Ko,{present:r||d.open,children:o.jsx(yv,{asChild:!0,container:c,children:h})}))})};kv.displayName=pf;var Ho="DialogOverlay",Ov=w.forwardRef((s,a)=>{const r=Cv(Ho,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=pa(Ho,s.__scopeDialog);return d.modal?o.jsx(Ko,{present:l||d.open,children:o.jsx(L2,{...c,ref:a})}):null});Ov.displayName=Ho;var U2=T2("DialogOverlay.RemoveScroll"),L2=w.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=pa(Ho,r);return o.jsx(jv,{as:U2,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(as.div,{"data-state":yf(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),gn="DialogContent",Rv=w.forwardRef((s,a)=>{const r=Cv(gn,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=pa(gn,s.__scopeDialog);return o.jsx(Ko,{present:l||d.open,children:d.modal?o.jsx(B2,{...c,ref:a}):o.jsx(q2,{...c,ref:a})})});Rv.displayName=gn;var B2=w.forwardRef((s,a)=>{const r=pa(gn,s.__scopeDialog),l=w.useRef(null),c=yn(a,r.contentRef,l);return w.useEffect(()=>{const d=l.current;if(d)return E2(d)},[]),o.jsx(Dv,{...s,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Us(s.onCloseAutoFocus,d=>{d.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Us(s.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:Us(s.onFocusOutside,d=>d.preventDefault())})}),q2=w.forwardRef((s,a)=>{const r=pa(gn,s.__scopeDialog),l=w.useRef(!1),c=w.useRef(!1);return o.jsx(Dv,{...s,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{s.onCloseAutoFocus?.(d),d.defaultPrevented||(l.current||r.triggerRef.current?.focus(),d.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:d=>{s.onInteractOutside?.(d),d.defaultPrevented||(l.current=!0,d.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const h=d.target;r.triggerRef.current?.contains(h)&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&c.current&&d.preventDefault()}})}),Dv=w.forwardRef((s,a)=>{const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,...h}=s,m=pa(gn,r),p=w.useRef(null),g=yn(a,p);return HN(),o.jsxs(o.Fragment,{children:[o.jsx(pv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(hv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":yf(m.open),...h,ref:g,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx($2,{titleId:m.titleId}),o.jsx(V2,{contentRef:p,descriptionId:m.descriptionId})]})]})}),gf="DialogTitle",Mv=w.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=pa(gf,r);return o.jsx(as.h2,{id:c.titleId,...l,ref:a})});Mv.displayName=gf;var zv="DialogDescription",Uv=w.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=pa(zv,r);return o.jsx(as.p,{id:c.descriptionId,...l,ref:a})});Uv.displayName=zv;var Lv="DialogClose",Bv=w.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=pa(Lv,r);return o.jsx(as.button,{type:"button",...l,ref:a,onClick:Us(s.onClick,()=>c.onOpenChange(!1))})});Bv.displayName=Lv;function yf(s){return s?"open":"closed"}var qv="DialogTitleWarning",[DE,$v]=nN(qv,{contentName:gn,titleName:gf,docsSlug:"dialog"}),$2=({titleId:s})=>{const a=$v(qv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
|
|
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(()=>{s&&(document.getElementById(s)||console.error(r))},[r,s]),null},H2="DialogDescriptionWarning",V2=({contentRef:s,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$v(H2).contentName}}.`;return w.useEffect(()=>{const c=s.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,s,a]),null},I2=Tv,G2=kv,P2=Ov,K2=Rv,Y2=Mv,J2=Uv,X2=Bv;function mn({...s}){return o.jsx(I2,{"data-slot":"dialog",...s})}function Q2({...s}){return o.jsx(G2,{"data-slot":"dialog-portal",...s})}function Z2({className:s,...a}){return o.jsx(P2,{"data-slot":"dialog-overlay",className:Oe("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",s),...a})}function pn({className:s,children:a,...r}){return o.jsxs(Q2,{"data-slot":"dialog-portal",children:[o.jsx(Z2,{}),o.jsxs(K2,{"data-slot":"dialog-content",className:Oe("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",s),...r,children:[a,o.jsxs(X2,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(el,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ca({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:Oe("flex flex-col gap-2 text-center sm:text-left",s),...a})}function jr({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:Oe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",s),...a})}function ka({className:s,...a}){return o.jsx(Y2,{"data-slot":"dialog-title",className:Oe("text-lg leading-none font-semibold",s),...a})}function Oa({className:s,...a}){return o.jsx(J2,{"data-slot":"dialog-description",className:Oe("text-muted-foreground text-sm",s),...a})}const Se=w.forwardRef(({className:s,type:a,...r},l)=>o.jsx("input",{type:a,className:Oe("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:l,...r}));Se.displayName="Input";var F2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],W2=F2.reduce((s,a)=>{const r=_y(`Primitive.${a}`),l=w.forwardRef((c,d)=>{const{asChild:h,...m}=c,p=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...s,[a]:l}},{}),eE="Label",Hv=w.forwardRef((s,a)=>o.jsx(W2.label,{...s,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(s.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Hv.displayName=eE;var tE=Hv;function ma({className:s,...a}){return o.jsx(tE,{"data-slot":"label",className:Oe("flex items-center gap-2 text-sm leading-none font-medium select-none text-muted-foreground group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",s),...a})}const aE=Ny("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Fi({className:s,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:Oe(aE({variant:a}),s),...r})}function Wi({className:s,...a}){return o.jsx("div",{"data-slot":"alert-description",className:Oe("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...a})}function vf({className:s}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Oe("w-9 h-9",s),children:[o.jsx("path",{d:"M112 112H400C426.51 112 448 133.49 448 160V352C448 378.51 426.51 400 400 400H112C85.4903 400 64 378.51 64 352V160C64 133.49 85.4903 112 112 112Z",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M64 160 L200 270",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M448 160 L312 270",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M256 128 C256 128 276 170 306 178 C276 186 256 228 256 228 C256 228 236 186 206 178 C236 170 256 128 256 128 Z",fill:"#9333ea",children:o.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0 0; 0 -10; 0 0",dur:"3s",repeatCount:"indefinite"})})]})}function fy(s){const a=s.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function sE(s){const a=s.trim();if(!a)return{valid:!1};if(a.startsWith("http://")||a.startsWith("https://"))try{return new URL(a).hostname.endsWith(".supabase.co")?{valid:!0,message:"Valid Supabase URL"}:{valid:!1,message:"URL must be a supabase.co domain"}}catch{return{valid:!1,message:"Invalid URL format"}}return/^[a-z0-9]+$/.test(a)?{valid:!0,message:"Project ID detected"}:{valid:!1,message:"Enter a URL or Project ID"}}function nE(s){const a=s.trim();return a?a.startsWith("sb_publishable_")?a.length>25?{valid:!0,message:"Valid Publishable Key"}:{valid:!1,message:"Incomplete Publishable Key"}:a.startsWith("eyJ")?a.length>50?{valid:!0,message:"Valid Anon Key"}:{valid:!1,message:"Incomplete Anon Key"}:{valid:!1,message:"Invalid API Key format"}:{valid:!1}}function Vv({onComplete:s,open:a=!0,canClose:r=!1}){const[l,c]=w.useState("welcome"),[d,h]=w.useState(""),[m,p]=w.useState(""),[g,v]=w.useState(null),[_,x]=w.useState(!1),[S,A]=w.useState(!1),j=async()=>{v(null),c("validating");const G=fy(d),ee=m.trim(),J=await av(G,ee);J.valid?(Bj({url:G,anonKey:ee}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(v(J.error||"Connection failed. Please check your credentials."),c("credentials"))},O=d?sE(d):{valid:!1},R=m?nE(m):{valid:!1},q=d?fy(d):"",B=d&&!d.startsWith("http")&&O.valid;return o.jsx(mn,{open:a,onOpenChange:G=>{!G&&r&&s()},children:o.jsxs(pn,{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(Ca,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(vf,{className:"w-9 h-9"}),o.jsx(ka,{children:"Welcome to Email Automator"})]}),o.jsx(Oa,{children:"This application requires a Supabase database to store your emails and automation rules."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx(Fi,{children:o.jsxs(Wi,{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(Vi,{className:"h-3 w-3"})]})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"You will need:"}),o.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground space-y-1",children:[o.jsx("li",{children:"Project URL"}),o.jsx("li",{children:"Anon Public Key"})]})]}),o.jsxs("div",{className:"flex gap-2",children:[r&&o.jsx(Z,{variant:"outline",onClick:s,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:()=>c("credentials"),className:"flex-1",children:"Continue Setup"})]})]})]}),l==="credentials"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ca,{children:[o.jsx(ka,{children:"Connect to Supabase"}),o.jsx(Oa,{children:"Enter your connection details below."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[g&&o.jsxs(Fi,{variant:"destructive",children:[o.jsx(Dr,{className:"h-4 w-4"}),o.jsx(Wi,{children:g})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"supabase-url",children:"Project URL or ID"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:G=>{h(G.target.value),x(!0)},onBlur:()=>x(!0),className:_&&d?O.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),_&&d&&O.valid&&o.jsx(ja,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),B&&o.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-green-600 dark:text-green-400",children:[o.jsx(ja,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),o.jsxs("span",{children:["Will use: ",q]})]}),_&&d&&O.message&&!O.valid&&o.jsx("p",{className:"text-xs text-destructive",children:O.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"anon-key",children:"Anon Public Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:G=>{p(G.target.value),A(!0)},onBlur:()=>A(!0),className:S&&m?R.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),S&&m&&R.valid&&o.jsx(ja,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),S&&m&&R.message&&o.jsx("p",{className:`text-xs ${R.valid?"text-green-600 dark:text-green-400":"text-destructive"}`,children:R.message})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Z,{variant:"outline",onClick:()=>c("welcome"),className:"flex-1",children:"Back"}),r&&o.jsx(Z,{variant:"outline",onClick:s,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:j,disabled:!O.valid||!R.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ca,{children:[o.jsx(ka,{children:"Validating Connection"}),o.jsx(Oa,{children:"Verifying your credentials with Supabase..."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx($t,{className:"h-12 w-12 animate-spin text-primary mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Please wait..."})]})]}),l==="success"&&o.jsxs(o.Fragment,{children:[o.jsxs(Ca,{children:[o.jsx(ka,{children:"Success!"}),o.jsx(Oa,{children:"Your database is connected."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(rf,{className:"h-12 w-12 text-green-500 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restarting application..."})]})]})]})})}function rE({email:s,isOpen:a,onOpenChange:r}){const[l,c]=w.useState([]),[d,h]=w.useState(!1);w.useEffect(()=>{a&&s&&m()},[a,s]);const m=async()=>{if(s){h(!0);try{const g=await qe.getEmailEvents(s.id);g.data&&c(g.data.events)}catch(g){console.error("Failed to fetch trace:",g)}finally{h(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx($i,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(zo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Dr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(kr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(mn,{open:a,onOpenChange:r,children:o.jsxs(pn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Ca,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(of,{className:"w-5 h-5 text-primary"}),o.jsx(ka,{children:"AI Processing Trace"})]}),o.jsx(Oa,{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(mt,{})}):l.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:"No granular trace events found for this email."}):l.map((g,v)=>o.jsxs("div",{className:"relative pl-8",children:[v!==l.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:p(g.event_type)}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground/70",children:g.agent_state}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Cr,{className:"w-3 h-3"}),new Date(g.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[g.event_type==="info"&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-foreground/90",children:g.details?.message}),g.details?.system_prompt&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(zs,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:g.details.system_prompt})]}),g.details?.content_preview&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(zs,{className:"w-3 h-3"})," Email Content (sent to LLM)"]}),o.jsx("pre",{className:"text-[10px] bg-blue-500/5 p-2 rounded border border-blue-500/10 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details.content_preview})]})]}),g.event_type==="analysis"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Category:"}),o.jsx("span",{className:"font-bold uppercase",children:g.details?.category||"Analyzing..."})]}),o.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Sentiment:"}),o.jsx("span",{className:"font-bold uppercase",children:g.details?.sentiment||"Analyzing..."})]})]}),g.details?.system_prompt&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(zs,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details?.system_prompt})]}),g.details?._raw_response&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(zs,{className:"w-3 h-3"})," Raw LLM Response"]}),o.jsx("pre",{className:"text-[10px] bg-emerald-500/5 p-2 rounded border border-emerald-500/10 overflow-x-auto font-mono",children:JSON.stringify(JSON.parse(g.details._raw_response),null,2)})]}),g.details?.usage&&o.jsxs("div",{className:"flex gap-4 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Prompt:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.prompt_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Completion:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.completion_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Total:"}),o.jsx("span",{className:"font-mono font-bold text-primary",children:g.details.usage.total_tokens})]})]})]}),g.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:["Executed: ",g.details?.action]}),o.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',g.details?.reason,'"']})]}),o.jsx(lf,{className:"w-5 h-5 text-emerald-500"})]}),g.event_type==="error"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:typeof g.details?.error=="object"?g.details.error.message||JSON.stringify(g.details.error):g.details?.error}),g.details?.raw_response&&o.jsx("pre",{className:"text-[10px] bg-red-500/5 p-2 rounded border border-red-500/10 overflow-x-auto whitespace-pre-wrap font-mono",children:typeof g.details.raw_response=="object"?JSON.stringify(g.details.raw_response,null,2):g.details.raw_response})]})]})]})]},g.id))})]})})}const iE={spam:"bg-destructive/10 text-destructive",newsletter:"bg-blue-500/10 text-blue-600 dark:text-blue-400",support:"bg-orange-500/10 text-orange-600 dark:text-orange-400",client:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",internal:"bg-purple-500/10 text-purple-600 dark:text-purple-400",personal:"bg-pink-500/10 text-pink-600 dark:text-pink-400",other:"bg-gray-500/10 text-gray-600 dark:text-gray-400"};function lE(){const{state:s,actions:a,dispatch:r}=Br(),{openTerminal:l}=cv(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState(""),[v,_]=w.useState(null),[x,S]=w.useState(null),[A,j]=w.useState({}),[O,R]=w.useState(null),[q,B]=w.useState(!1),[G,ee]=w.useState(null);w.useEffect(()=>{s.isAuthenticated?(J(),a.fetchStats()):d(!1)},[v,s.isAuthenticated]);const J=async(F=0)=>{d(!0),await a.fetchEmails({category:v||void 0,search:p||void 0,offset:F,sortBy:s.sortBy,sortOrder:s.sortOrder}),d(!1)},P=F=>{a.fetchEmails({category:v||void 0,search:p||void 0,offset:0,sortBy:F,sortOrder:s.sortOrder})},X=()=>{a.fetchEmails({category:v||void 0,search:p||void 0,offset:0,sortBy:s.sortBy,sortOrder:s.sortOrder==="asc"?"desc":"asc"})},ue=async()=>{if(s.accounts.length===0){re.warning("Please connect an email account first");return}l(),m(!0);const F=await a.triggerSync();m(!1),F?(Tr.playSuccess(),re.success("Sync completed! Check your emails.")):re.error("Sync failed. Check account status for details.")},Je=async(F,U)=>{if(U==="delete"&&O!==F.id){R(F.id);return}R(null),j(K=>({...K,[F.id]:U}));const Q=await a.executeAction(F.id,U);j(K=>{const je={...K};return delete je[F.id],je}),Q&&(re.success(`Email ${U==="delete"?"deleted":U==="archive"?"archived":"updated"}`),U==="delete"&&J(s.emailsOffset))},be=()=>{R(null)},ge=F=>{F.preventDefault(),J()},Ze=F=>{const U=F==="next"?s.emailsOffset+20:Math.max(0,s.emailsOffset-20);J(U)},st=F=>{ee(F),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(Ld,{className:"w-5 h-5 text-primary"}),"Recent Analysis"]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(Z,{onClick:ue,size:"sm",variant:"default",className:"h-9 shadow-md px-4",disabled:h,children:[o.jsx(Or,{className:Oe("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),h?"Syncing...":"Sync Now"]}),o.jsxs("span",{className:"h-9 text-xs font-medium text-muted-foreground bg-secondary px-3 py-1 rounded-md border border-border flex items-center",children:[s.emailsTotal," emails"]})]})]}),h&&o.jsxs("div",{className:"bg-primary/5 border border-primary/20 p-4 rounded-lg flex items-center justify-between animate-in fade-in slide-in-from-top-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o.jsx($t,{className:"w-5 h-5 text-primary animate-spin"})}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-sm",children:"Sync in progress..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Fetching and analyzing emails. New emails will appear below automatically."})]})]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:l,className:"h-8 text-xs",children:[o.jsx(of,{className:"w-3.5 h-3.5 mr-2"}),"View Logs"]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-center",children:[o.jsxs("form",{onSubmit:ge,className:"flex-1 flex gap-2 w-full",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(zw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Se,{placeholder:"Search emails...",value:p,onChange:F=>g(F.target.value),className:"pl-9 h-9"})]}),o.jsx(Z,{type:"submit",size:"sm",className:"h-9 px-4",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50 h-9",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-full",value:s.sortBy,onChange:F=>P(F.target.value),children:[o.jsx("option",{value:"date",children:"Received Time"}),o.jsx("option",{value:"created_at",children:"Processed Time"})]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-primary",onClick:X,title:s.sortOrder==="asc"?"Sorting: Oldest First":"Sorting: Newest First",children:s.sortOrder==="asc"?o.jsx(Tx,{className:"w-3.5 h-3.5"}):o.jsx(Sx,{className:"w-3.5 h-3.5"})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(Z,{size:"sm",variant:v===null?"secondary":"ghost",onClick:()=>_(null),children:"All"}),["spam","client","newsletter","support"].map(F=>o.jsx(Z,{size:"sm",variant:v===F?"secondary":"ghost",onClick:()=>_(F),className:"capitalize",children:F},F))]}),c?o.jsx(sN,{}):s.emails.length===0?o.jsxs(At,{className:"p-20 text-center shadow-sm",children:[o.jsx("div",{className:"w-16 h-16 bg-primary/10 text-primary rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(Ld,{className:"w-8 h-8"})}),o.jsx("h3",{className:"text-lg font-medium",children:"No emails found"}),o.jsx("p",{className:"text-muted-foreground mt-2 mb-6",children:s.accounts.length===0?"Connect your email account to get started.":"Try syncing or adjusting your filters."}),s.accounts.length>0&&o.jsxs(Z,{onClick:()=>{l(),ue()},disabled:h,children:[o.jsx(Or,{className:Oe("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[s.emails.map(F=>o.jsx(cE,{email:F,onAction:Je,onViewTrace:st,onSelect:()=>S(F),isSelected:x?.id===F.id,loadingAction:A[F.id],isDeletePending:O===F.id,onCancelDelete:be},F.id)),o.jsx(rE,{isOpen:q,onOpenChange:B,email:G}),s.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("prev"),disabled:s.emailsOffset===0,children:[o.jsx(Bx,{className:"w-4 h-4 mr-1"}),"Previous"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.emailsOffset+1," - ",Math.min(s.emailsOffset+20,s.emailsTotal)," of ",s.emailsTotal]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("next"),disabled:s.emailsOffset+20>=s.emailsTotal,children:["Next",o.jsx($x,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[x&&o.jsxs(At,{className:"p-6 border-primary/20 bg-primary/5 animate-in slide-in-from-right-5",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"font-semibold",children:"Email Details"}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>S(null),children:o.jsx(el,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"From:"}),o.jsx("p",{className:"font-medium truncate",children:x.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),o.jsx("p",{className:"font-medium",children:x.subject})]}),x.ai_analysis&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Summary:"}),o.jsx("p",{className:"text-xs mt-1",children:x.ai_analysis.summary})]}),x.ai_analysis.key_points&&o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Key Points:"}),o.jsx("ul",{className:"text-xs mt-1 list-disc list-inside",children:x.ai_analysis.key_points.map((F,U)=>o.jsx("li",{children:F},U))})]}),x.ai_analysis.draft_response&&o.jsxs("div",{className:"mt-4 p-3 bg-emerald-500/5 border border-emerald-500/20 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2 text-emerald-600 dark:text-emerald-400",children:[o.jsx(Lw,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"text-xs font-bold uppercase",children:"AI Draft Reply"})]}),o.jsx("p",{className:"text-xs leading-relaxed whitespace-pre-wrap italic text-foreground/80",children:x.ai_analysis.draft_response}),o.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:["* This draft is already saved in your ",x.email_accounts?.provider==="gmail"?"Gmail":"Outlook"," Drafts folder."]})]})]})]})]}),o.jsx(oE,{accounts:s.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:s.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(vy,{className:"w-4 h-4 text-primary"}),"Sync History"]}),o.jsx("div",{className:"space-y-4",children:!s.stats?.recentSyncs||s.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No sync history available."}):s.stats.recentSyncs.slice(0,5).map(F=>o.jsxs("div",{className:"flex justify-between items-start text-sm border-b last:border-0 pb-3 last:pb-0",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Oe("w-1.5 h-1.5 rounded-full",F.status==="success"?"bg-emerald-500":F.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(F.started_at).toLocaleDateString()," ",new Date(F.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:F.emails_processed})," • Actioned: ",o.jsx("span",{className:"font-medium text-foreground",children:F.emails_deleted+F.emails_drafted})]}),F.error_message&&o.jsx("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:F.error_message,children:F.error_message})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:F.status==="running"?"Running":F.completed_at?`${Math.round((new Date(F.completed_at).getTime()-new Date(F.started_at).getTime())/1e3)}s`:"..."})]},F.id))})]}),o.jsxs(At,{className:"p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Quick Stats"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Processed"}),o.jsx("span",{className:"font-medium",children:s.emailsTotal})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Connected Accounts"}),o.jsx("span",{className:"font-medium",children:s.accounts.length})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Rules"}),o.jsx("span",{className:"font-medium",children:s.rules.filter(F=>F.is_enabled).length})]})]})]})]})]})}function oE({accounts:s,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){const[h,m]=w.useState(null),[p,g]=w.useState(!1),v=x=>{if(!x)return"";const S=typeof x=="string"&&/^\d+$/.test(x)?parseInt(x):x,A=new Date(S);if(isNaN(A.getTime()))return"";const j=O=>O<10?"0"+O:O;return A.getFullYear()+"-"+j(A.getMonth()+1)+"-"+j(A.getDate())+"T"+j(A.getHours())+":"+j(A.getMinutes())},_=async(x,S)=>{m(x),await a(x,S),m(null)};return s.length===0?null:o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx($w,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsx("div",{className:"space-y-6",children:s.map(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($t,{className:"w-3 h-3 text-primary animate-spin"}):x.last_sync_status==="success"?o.jsx(lf,{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(Dr,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{d(),r(x.id)},disabled:x.last_sync_status==="syncing",children:o.jsx(Or,{className:Oe("w-3 h-3",x.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-orange-500",title:"Reset Checkpoint (Force Full Re-sync from Start Date)",onClick:()=>a(x.id,{last_sync_checkpoint:null}),disabled:x.last_sync_status==="syncing",children:o.jsx(vy,{className:"w-3 h-3"})})]})]}),o.jsxs("div",{className:"grid grid-cols-[1.5fr_1fr] gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(kx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Se,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:x.sync_start_date?v(x.sync_start_date):x.last_sync_checkpoint?v(x.last_sync_checkpoint):x.last_sync_at?v(x.last_sync_at):"",onChange:S=>_(x.id,{sync_start_date:S.target.value?new Date(S.target.value).toISOString():null}),disabled:h===x.id})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(ow,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Se,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:x.sync_max_emails_per_run||50,onChange:S=>_(x.id,{sync_max_emails_per_run:parseInt(S.target.value,10)||50}),disabled:h===x.id})]})]}),x.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Last sync: ",new Date(x.last_sync_at).toLocaleString()]}),x.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:x.last_sync_error,children:["Error: ",x.last_sync_error]})]},x.id))})]})}function cE({email:s,onAction:a,onViewTrace:r,onSelect:l,isSelected:c,loadingAction:d,isDeletePending:h,onCancelDelete:m}){if(!s)return null;const p=iE[s.category||"other"],g=!!d,v=()=>{if(!s.email_accounts)return"#";const{provider:_,email_address:x}=s.email_accounts;return _==="gmail"?`https://mail.google.com/mail/u/${x}/#all/${s.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(s.external_id)}`};return o.jsx(At,{className:Oe("hover:shadow-md transition-shadow group cursor-pointer",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:Oe("w-8 h-8 rounded-full flex items-center justify-center font-bold text-white text-xs",s.category==="spam"?"bg-destructive":"bg-primary"),children:s.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:s.subject||"No Subject"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:Oe("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",p),children:s.category||"unknown"}),o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.processing_status==="pending"&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(Cr,{className:"w-2.5 h-2.5"})," Queued"]}),s.processing_status==="processing"&&o.jsxs("span",{className:"text-[9px] text-blue-600 dark:text-blue-400 bg-blue-500/10 border border-blue-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($t,{className:"w-2.5 h-2.5 animate-spin"})," Analyzing"]}),s.processing_status==="completed"&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($i,{className:"w-2.5 h-2.5"})," Analyzed"]}),s.processing_status==="failed"&&o.jsxs("span",{className:"text-[9px] text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",title:s.processing_error||"Unknown error",children:[o.jsx(Dr,{className:"w-2.5 h-2.5"})," Failed"]}),!s.processing_status&&!s.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($t,{className:"w-2.5 h-2.5 animate-spin"})," Pending"]}),!s.processing_status&&s.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($i,{className:"w-2.5 h-2.5"})," Analyzed"]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-2 text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:s.date?new Date(s.date).toLocaleString():"",className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"REC:"})," ",s.date?new Date(s.date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsx("span",{className:"opacity-30",children:"•"}),o.jsxs("span",{title:new Date(s.created_at).toLocaleString(),className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"PROC:"})," ",new Date(s.created_at).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:s.body_snippet}),o.jsxs("div",{className:"bg-secondary/30 p-3 rounded-lg border border-border/50 flex justify-between items-center",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[o.jsx(qd,{className:"w-3.5 h-3.5 text-emerald-500"}),"Suggested:",s.suggested_actions&&s.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:s.suggested_actions.map(_=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:_},_))}):o.jsx("span",{className:"text-foreground",children:s.suggested_action||"none"}),s.actions_taken&&s.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:s.actions_taken.join(", "),children:["(Done: ",s.actions_taken.join(", "),")"]}):s.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(Done: ",s.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:_=>_.stopPropagation(),children: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(Z,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(s,"delete"),disabled:g,children:d==="delete"?o.jsx($t,{className:"w-3 h-3 animate-spin"}):"Yes"}),o.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:m,disabled:g,children:"No"})]}):o.jsxs(o.Fragment,{children:[o.jsx("a",{href:v(),target:"_blank",rel:"noreferrer",className:"inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-primary hover:bg-secondary/50 transition-colors",title:`Open in ${s.email_accounts?.provider==="gmail"?"Gmail":"Outlook"}`,children:o.jsx(Vi,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>r(s),title:"View AI Trace (Prompt/Response)",children:o.jsx(nw,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>a(s,"delete"),disabled:g,title:"Delete",children:d==="delete"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(Mo,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>a(s,"archive"),disabled:g,title:"Archive",children:d==="archive"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(wx,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>a(s,"flag"),disabled:g,title:"Flag",children:d==="flag"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(iw,{className:"w-3.5 h-3.5"})})]})})]})]})})}function uE(){const{state:s,actions:a}=Br(),[r,l]=w.useState(!1),[c,d]=w.useState(!1),[h,m]=w.useState(null),[p,g]=w.useState(!1),[v,_]=w.useState(!1),[x,S]=w.useState({}),[A,j]=w.useState(!1),[O,R]=w.useState("credentials"),[q,B]=w.useState(""),[G,ee]=w.useState(""),[J,P]=w.useState(""),[X,ue]=w.useState(""),[Je,be]=w.useState(!1),[ge,Ze]=w.useState(!1),[st,F]=w.useState(!1),[U,Q]=w.useState("credentials"),[K,je]=w.useState(""),[Re,T]=w.useState(""),[V,Y]=w.useState(!1),[W,fe]=w.useState(!1),[ye,de]=w.useState(""),[Ge,Ue]=w.useState("category"),[Ct,pt]=w.useState("newsletter"),[xt,ss]=w.useState(["archive"]),[la,ns]=w.useState(""),[vn,bn]=w.useState(""),[qr,rs]=w.useState(""),[xn,is]=w.useState(""),[al,Ls]=w.useState([]),[gt,sl]=w.useState(!1),[$r,Hr]=w.useState(!1),[Ra,wn]=w.useState(null),[ga,_n]=w.useState(null);w.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),w.useEffect(()=>{s.settings&&S(s.settings)},[s.settings]);const Xo=async()=>{const k=s.rules.find(te=>te.name==="Auto-Trash Spam");if(!k){re.error("System rule not found. Please sync your database.");return}wn("auto_trash_spam"),await a.toggleRule(k.id),wn(null)},Bs=async()=>{const k=s.rules.find(te=>te.name==="Smart Drafts");if(!k){re.error("System rule not found. Please sync your database.");return}wn("smart_drafts"),await a.toggleRule(k.id),wn(null)},wt=k=>{_n(k),de(k.name);const te=k.condition,yt=Object.keys(te).filter(Hs=>Hs!=="older_than_days")[0]||"category";Ue(yt),pt(te[yt]||""),ns(te.older_than_days?.toString()||"");const $s=k.actions&&k.actions.length>0?k.actions:k.action?[k.action]:["archive"];ss($s),bn(k.instructions||""),rs(k.description||""),is(k.intent||""),Ls(k.attachments||[]),fe(!0)},ya=w.useRef(null),Ot=()=>{R("credentials"),B(""),ee(""),P(""),ue(""),j(!0)},Qo=k=>{B(k);try{const te=JSON.parse(k),Ce=te.installed||te.web||te;Ce.client_id&&ee(Ce.client_id),Ce.client_secret&&P(Ce.client_secret),te.installed?re.success("Detected Desktop app credentials"):te.web&&re.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Zo=async()=>{if(!G||!J){re.error("Please provide both Client ID and Client Secret");return}be(!0);try{if(await a.updateSettings({...x,google_client_id:G,google_client_secret:J})){S(Ce=>({...Ce,google_client_id:G,google_client_secret:J}));const te=await qe.getGmailAuthUrl();if(te.data?.url)window.open(te.data.url,"_blank"),R("code"),re.success("Please authorize in the opened tab, then paste the code here");else{const Ce=typeof te.error=="string"?te.error:te.error?.message;re.error(Ce||"Failed to get OAuth URL")}}else re.error("Failed to save credentials")}catch{re.error("Failed to save credentials")}finally{be(!1)}},Fo=async()=>{if(!X.trim()){re.error("Please paste the authorization code");return}Ze(!0);try{const k=await qe.connectGmail(X.trim());if(k.data?.success)re.success("Gmail account connected successfully!"),j(!1),a.fetchAccounts();else{const te=typeof k.error=="string"?k.error:k.error?.message;re.error(te||"Failed to connect Gmail")}}catch{re.error("Failed to connect Gmail")}finally{Ze(!1)}},Sn=()=>{Q("credentials"),je(""),T(""),F(!0)},jn=async()=>{if(!K){re.error("Please provide the Client ID");return}Y(!0);try{if(await a.updateSettings({...x,microsoft_client_id:K,microsoft_tenant_id:Re||"common"})){S(Ce=>({...Ce,microsoft_client_id:K,microsoft_tenant_id:Re||"common"}));const te=await qe.startMicrosoftDeviceFlow();if(te.data)m(te.data),Q("device-code"),Nn(te.data.deviceCode,te.data.interval);else{const Ce=typeof te.error=="string"?te.error:te.error?.message;re.error(Ce||"Failed to start device flow")}}else re.error("Failed to save credentials")}catch{re.error("Failed to save credentials")}finally{Y(!1)}},Nn=async(k,te)=>{const Ce=setInterval(async()=>{try{const yt=await qe.pollMicrosoftDeviceCode(k);yt.data?.status==="completed"?(clearInterval(Ce),m(null),d(!1),F(!1),re.success("Outlook account connected"),a.fetchAccounts()):yt.error&&typeof yt.error=="object"&&yt.error.code}catch{}},te*1e3);setTimeout(()=>{clearInterval(Ce),c&&(m(null),d(!1),F(!1),re.error("Connection timed out. Please try again."))},900*1e3)},Da=async()=>{if(!ye){re.error("Please name your rule");return}if(xt.length===0){re.error("Please select at least one action");return}Hr(!0);try{const k={[Ge]:Ct};la&&(k.older_than_days=parseInt(la,10));const te=xt.includes("draft"),Ce={name:ye,description:qr||void 0,intent:xn||void 0,condition:k,actions:xt,instructions:te?vn:void 0,attachments:te?al:[],is_enabled:!0};let yt=!1;ga?yt=await a.updateRule(ga.id,Ce):yt=await a.createRule(Ce),yt?(re.success(ga?"Rule updated":"Rule created"),fe(!1),_n(null),de(""),ss(["archive"]),ns(""),bn(""),rs(""),is(""),Ls([]),a.fetchRules()):re.error(`Failed to ${ga?"update":"create"} rule`)}catch{re.error("An error occurred while saving the rule")}finally{Hr(!1)}},En=async k=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(k)&&re.success("Account disconnected")},ls=async()=>{g(!0);const k=await a.updateSettings(x);g(!1),k&&re.success("Settings saved")},Wo=async()=>{_(!0);try{const k=await qe.testLlm({llm_model:x.llm_model||null,llm_base_url:x.llm_base_url||null,llm_api_key:x.llm_api_key||null});k.data?.success?re.success(k.data.message):re.error(k.data?.message||"Connection test failed")}catch{re.error("Failed to test connection")}finally{_(!1)}},nl=async k=>{await a.toggleRule(k)},Vr=async k=>{const te=k.target.files;if(!te||te.length===0)return;sl(!0);const Ce=te[0],yt=Ce.name.split(".").pop(),$s=`${Math.random().toString(36).substring(2)}.${yt}`,Hs=`${s.user.id}/${$s}`;try{const{error:Vs}=await ct.storage.from("rule-attachments").upload(Hs,Ce);if(Vs)throw Vs;const va={name:Ce.name,path:Hs,type:Ce.type,size:Ce.size};Ls(ut=>[...ut,va]),re.success("File uploaded")}catch(Vs){console.error("Upload error:",Vs),re.error("Failed to upload file")}finally{sl(!1),k.target.value=""}},qs=k=>{Ls(te=>te.filter(Ce=>Ce.path!==k))},ec=k=>k==="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(mn,{open:A,onOpenChange:j,children:o.jsxs(pn,{className:"sm:max-w-lg",children:[o.jsxs(Ca,{children:[o.jsxs(ka,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold text-sm",children:"G"}),"Connect Gmail Account"]}),o.jsx(Oa,{children:O==="credentials"?"Enter your Google OAuth credentials to connect your Gmail account.":"Paste the authorization code from Google to complete the connection."})]}),O==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Qw,{className:"w-4 h-4"}),"Paste credentials.json"]}),o.jsx("textarea",{className:"w-full h-24 p-3 text-xs font-mono border rounded-lg bg-secondary/30 resize-none focus:outline-none focus:ring-2 focus:ring-primary",placeholder:'{"installed":{"client_id":"...","client_secret":"..."}}',value:q,onChange:k=>Qo(k.target.value)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Download from Google Cloud Console → APIs & Services → Credentials"})]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("span",{className:"w-full border-t"})}),o.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:o.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or enter manually"})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Se,{placeholder:"xxx.apps.googleusercontent.com",value:G,onChange:k=>ee(k.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Se,{type:"password",placeholder:"GOCSPX-...",value:J,onChange:k=>P(k.target.value)})]})]})]}),o.jsxs(jr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Zo,disabled:Je||!G||!J,children:[Je?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:o.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["1. A new tab opened with Google Sign-In",o.jsx("br",{}),"2. Sign in and authorize the app",o.jsx("br",{}),"3. Copy the authorization code shown",o.jsx("br",{}),"4. Paste it below"]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Authorization Code"}),o.jsx(Se,{placeholder:"4/0AQlEd8x...",value:X,onChange:k=>ue(k.target.value),className:"font-mono"})]})]}),o.jsxs(jr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>R("credentials"),children:"Back"}),o.jsxs(Z,{onClick:Fo,disabled:ge||!X.trim(),children:[ge?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Connect"]})]})]})]})}),o.jsx(mn,{open:st,onOpenChange:F,children:o.jsxs(pn,{className:"sm:max-w-lg",children:[o.jsxs(Ca,{children:[o.jsxs(ka,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold text-sm",children:"O"}),"Connect Outlook Account"]}),o.jsx(Oa,{children:U==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),U==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:o.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"Note: You need an Azure App Registration for this to work."})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID (Application ID)"}),o.jsx(Se,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:k=>je(k.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),o.jsx(Se,{placeholder:"common",value:Re,onChange:k=>T(k.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(jr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),o.jsxs(Z,{onClick:jn,disabled:V||!K,children:[V?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):o.jsxs(o.Fragment,{children:[h&&o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Action Required"}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:h.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:h.userCode})}),o.jsxs(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Vi,{className:"w-4 h-4 ml-2"})]})]})]}),o.jsx("div",{className:"flex justify-center",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(mt,{size:"sm"}),"Waiting for authorization..."]})})]}),o.jsx(jr,{children:o.jsx(Z,{variant:"outline",onClick:()=>F(!1),children:"Cancel"})})]})]})}),o.jsx(mn,{open:W,onOpenChange:k=>{fe(k),k||_n(null)},children:o.jsxs(pn,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[o.jsxs(Ca,{className:"p-6 border-b",children:[o.jsx(ka,{children:ga?"Edit Auto-Pilot Rule":"Create Auto-Pilot Rule"}),o.jsx(Oa,{children:"Define a condition based on AI analysis to trigger an action."})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Rule Name"}),o.jsx(Se,{placeholder:"e.g. Archive Newsletters",value:ye,onChange:k=>de(k.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Description"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:"e.g. Handle all marketing newsletters and promotional content from subscription services",value:qr,onChange:k=>rs(k.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Describe what this rule is for. The AI uses this to semantically match emails."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Intent"}),o.jsx(Se,{placeholder:"e.g. Politely decline all sales pitches",value:xn,onChange:k=>is(k.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"The goal of this rule. Used to generate appropriate draft replies."})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"If Condition Field"}),o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ge,onChange:k=>{Ue(k.target.value),k.target.value==="category"?pt("newsletter"):k.target.value==="sentiment"?pt("Positive"):k.target.value==="priority"?pt("High"):pt("")},children:[o.jsxs("optgroup",{label:"AI Analysis",children:[o.jsx("option",{value:"category",children:"Category"}),o.jsx("option",{value:"sentiment",children:"Sentiment"}),o.jsx("option",{value:"priority",children:"Priority"})]}),o.jsxs("optgroup",{label:"Metadata",children:[o.jsx("option",{value:"sender_email",children:"Specific Email (Exact)"}),o.jsx("option",{value:"sender_domain",children:"Email Domain (@...)"}),o.jsx("option",{value:"sender_contains",children:"Sender contains..."}),o.jsx("option",{value:"subject_contains",children:"Subject contains..."}),o.jsx("option",{value:"body_contains",children:"Body contains..."})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Equals Value"}),Ge==="category"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:k=>pt(k.target.value),children:[o.jsx("option",{value:"newsletter",children:"Newsletter"}),o.jsx("option",{value:"spam",children:"Spam"}),o.jsx("option",{value:"promotional",children:"Promotional"}),o.jsx("option",{value:"transactional",children:"Transactional"}),o.jsx("option",{value:"social",children:"Social"}),o.jsx("option",{value:"support",children:"Support"}),o.jsx("option",{value:"client",children:"Client"}),o.jsx("option",{value:"internal",children:"Internal"}),o.jsx("option",{value:"personal",children:"Personal"}),o.jsx("option",{value:"other",children:"Other"})]}):Ge==="sentiment"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:k=>pt(k.target.value),children:[o.jsx("option",{value:"Positive",children:"Positive"}),o.jsx("option",{value:"Neutral",children:"Neutral"}),o.jsx("option",{value:"Negative",children:"Negative"})]}):Ge==="priority"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:k=>pt(k.target.value),children:[o.jsx("option",{value:"High",children:"High"}),o.jsx("option",{value:"Medium",children:"Medium"}),o.jsx("option",{value:"Low",children:"Low"})]}):o.jsx(Se,{placeholder:Ge==="sender_domain"?"rta.vn":Ge==="sender_email"?"john@example.com":"Keywords...",value:Ct,onChange:k=>pt(k.target.value)})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Cr,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Se,{type:"number",min:"0",placeholder:"0",className:"w-24",value:la,onChange:k=>ns(k.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(k=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${xt.includes(k.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:xt.includes(k.value),onChange:te=>{te.target.checked?ss([...xt,k.value]):ss(xt.filter(Ce=>Ce!==k.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:k.label})]},k.value))})]}),xt.includes("draft")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsx("label",{className:"text-sm font-medium",children:"Draft Instructions (Context)"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[80px] text-sm",placeholder:"e.g. Tell them I'm busy until Friday, but interested in the proposal.",value:vn,onChange:k=>bn(k.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Specific context for the AI ghostwriter."})]}),o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(xg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[al.map(k=>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:k.name}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>qs(k.path),children:o.jsx(el,{className:"w-3 h-3"})})]},k.path)),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:Vr,disabled:gt}),o.jsxs(Z,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:gt,children:[gt?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{className:"w-3 h-3 mr-2"}),gt?"Uploading...":"Add Attachment"]})]})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Files will be attached to every draft generated by this rule."})]})]})]}),o.jsxs(jr,{className:"p-6 border-t bg-secondary/5",children:[o.jsx(Z,{variant:"outline",onClick:()=>fe(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Da,disabled:$r,children:[$r?o.jsx(mt,{size:"sm",className:"mr-2"}):ga?o.jsx(ja,{className:"w-4 h-4 mr-2"}):o.jsx(Mi,{className:"w-4 h-4 mr-2"}),ga?"Save Changes":"Create Rule"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx(Hi,{className:"w-5 h-5 text-primary"}),"Connected Accounts"]}),o.jsx(es,{children:"Manage your email providers"})]}),o.jsxs(Aa,{className:"space-y-4",children:[s.accounts.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No accounts connected yet"}):s.accounts.map(k=>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:[ec(k.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:k.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:k.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[k.is_active?o.jsx("span",{className:"text-xs text-emerald-600 bg-emerald-500/10 px-2 py-1 rounded-full",children:"Active"}):o.jsx("span",{className:"text-xs text-yellow-600 bg-yellow-500/10 px-2 py-1 rounded-full",children:"Inactive"}),o.jsx(Z,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>En(k.id),children:o.jsx(Mo,{className:"w-4 h-4"})})]})]},k.id)),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Ot,disabled:r||c,children:[r?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Sn,disabled:r||c,children:[c&&!h?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Mi,{className:"w-4 h-4 mr-2"}),"Connect Outlook Account"]})]}),h&&o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg animate-in slide-in-from-top-2",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Microsoft Sign-In Required"}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:h.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:h.userCode})}),o.jsxs(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Vi,{className:"w-4 h-4 ml-2"})]}),o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"Waiting for you to sign in..."})]})]})]})]}),o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx(qd,{className:"w-5 h-5 text-emerald-500"}),"Auto-Pilot Rules"]}),o.jsx(es,{children:"Configure AI automation behavior"})]}),o.jsxs(Aa,{className:"space-y-4",children:[o.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Auto-Trash Spam"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically delete emails categorized as spam"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const k=s.rules.find(te=>te.name==="Auto-Trash Spam");k&&wt(k)},title:"Edit Logic",children:o.jsx(gd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(k=>k.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Xo,disabled:Ra==="auto_trash_spam",children:[Ra==="auto_trash_spam"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(yd,{className:"w-4 h-4 mr-1"}),s.rules.find(k=>k.name==="Auto-Trash Spam")?.is_enabled?"On":"Off"]})]})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Smart Drafts"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate draft replies for important emails"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const k=s.rules.find(te=>te.name==="Smart Drafts");k&&wt(k)},title:"Edit Logic",children:o.jsx(gd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(k=>k.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:Bs,disabled:Ra==="smart_drafts",children:[Ra==="smart_drafts"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(yd,{className:"w-4 h-4 mr-1"}),s.rules.find(k=>k.name==="Smart Drafts")?.is_enabled?"On":"Off"]})]})]}),o.jsxs("div",{className:"pt-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"text-sm font-medium",children:"Custom Rules"}),o.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>{_n(null),de(""),rs(""),is(""),ss(["archive"]),ns(""),bn(""),Ls([]),fe(!0)},children:[o.jsx(Mi,{className:"w-4 h-4 mr-1"})," Add Rule"]})]}),s.rules.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2 border border-dashed rounded-lg",children:"No custom rules yet"}),s.rules.length>0&&s.rules.filter(k=>k.name!=="Auto-Trash Spam"&&k.name!=="Smart Drafts").map(k=>{const te=k.actions&&k.actions.length>0?k.actions:k.action?[k.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:k.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["→ ",te.join(" + ")]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>wt(k),title:"Edit Rule",children:o.jsx(gd,{className:"w-3.5 h-3.5 text-muted-foreground"})}),o.jsxs(Z,{variant:k.is_enabled?"default":"outline",size:"sm",onClick:()=>nl(k.id),className:"h-7 px-2",children:[o.jsx(yd,{className:"w-3.5 h-3.5 mr-1"}),k.is_enabled?"On":"Off"]}),o.jsx(Z,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>a.deleteRule(k.id),children:o.jsx(Mo,{className:"w-3 h-3"})})]})]}),k.instructions&&o.jsxs("p",{className:"text-[10px] text-muted-foreground italic border-t border-border/50 pt-1 mt-1 truncate",children:['"',k.instructions,'"']}),k.attachments&&k.attachments.length>0&&o.jsx("div",{className:"flex gap-1 mt-1",children:k.attachments.map(Ce=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] bg-blue-500/10 text-blue-400 px-1.5 py-0.5 rounded border border-blue-500/20",children:[o.jsx(xg,{className:"w-2.5 h-2.5"}),Ce.name]},Ce.path))})]},k.id)})]})]})]})]}),o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx(Or,{className:"w-5 h-5 text-indigo-500"}),"Model Configuration"]}),o.jsx(es,{children:"Configure Local LLM or API settings"})]}),o.jsxs(Aa,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Model Name"}),o.jsx(Se,{placeholder:"gpt-4o-mini",value:x.llm_model||"",onChange:k=>S(te=>({...te,llm_model:k.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Base URL"}),o.jsx(Se,{placeholder:"https://api.openai.com/v1",value:x.llm_base_url||"",onChange:k=>S(te=>({...te,llm_base_url:k.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Use http://localhost:11434/v1 for Ollama"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"API Key"}),o.jsx(Se,{type:"password",placeholder:"sk-...",value:x.llm_api_key||"",onChange:k=>S(te=>({...te,llm_api_key:k.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Hi,{className:"w-4 h-4"}),"Local Storage Path (.eml)"]}),o.jsx(Se,{placeholder:"./data/emails",value:x.storage_path||"",onChange:k=>S(te=>({...te,storage_path:k.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Absolute or relative path where raw emails will be saved before analysis. Default: ./data/emails"})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Cr,{className:"w-4 h-4"}),"Background Sync Interval (minutes)"]}),o.jsx(Se,{type:"number",min:1,max:1440,value:x.sync_interval_minutes||5,onChange:k=>S(te=>({...te,sync_interval_minutes:parseInt(k.target.value,10)||5}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"How often the system checks for new emails in the background."})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(Z,{variant:"outline",onClick:Wo,disabled:v,children:[v?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Or,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(Z,{onClick:ls,disabled:p,children:[p?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})]})]})]}),o.jsx("div",{ref:ya,children:o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx(qd,{className:"w-5 h-5 text-orange-500"}),"Provider Credentials (Advanced)"]}),o.jsx(es,{children:"Bring Your Own Keys (BYOK). Configure your own OAuth credentials here. Leave empty to use system defaults."})]}),o.jsxs(Aa,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-4 border-b pb-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Google / Gmail"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Se,{type:"password",placeholder:"...apps.googleusercontent.com",value:x.google_client_id||"",onChange:k=>S(te=>({...te,google_client_id:k.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Se,{type:"password",placeholder:"GOCSPX-...",value:x.google_client_secret||"",onChange:k=>S(te=>({...te,google_client_secret:k.target.value}))})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500"})," Microsoft / Outlook"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Se,{type:"password",value:x.microsoft_client_id||"",onChange:k=>S(te=>({...te,microsoft_client_id:k.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),o.jsx(Se,{type:"password",value:x.microsoft_client_secret||"",onChange:k=>S(te=>({...te,microsoft_client_secret:k.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),o.jsx(Se,{placeholder:"common",value:x.microsoft_tenant_id||"",onChange:k=>S(te=>({...te,microsoft_tenant_id:k.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(Z,{onClick:ls,disabled:p,variant:"secondary",children:[p?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(ja,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})})]})]})})]})}const dE="modulepreload",fE=function(s){return"/"+s},hy={},hE=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let g=function(v){return Promise.all(v.map(_=>Promise.resolve(_).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};var h=g;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=m?.nonce||m?.getAttribute("nonce");c=g(r.map(v=>{if(v=fE(v),v in hy)return;hy[v]=!0;const _=v.endsWith(".css"),x=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${x}`))return;const S=document.createElement("link");if(S.rel=_?"stylesheet":dE,_||(S.as="script"),S.crossOrigin="",S.href=v,p&&S.setAttribute("nonce",p),document.head.appendChild(S),_)return new Promise((A,j)=>{S.addEventListener("load",A),S.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${v}`)))})}))}function d(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return c.then(m=>{for(const p of m||[])p.status==="rejected"&&d(p.reason);return a().catch(d)})};function mE(){const[s,a]=w.useState("profile"),{state:r,actions:l}=Br();w.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:by},{id:"security",label:"Security",icon:Iw},{id:"database",label:"Supabase",icon:Hi}];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=s===d.id;return o.jsxs("button",{onClick:()=>a(d.id),className:`w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors ${m?"bg-primary text-primary-foreground":"hover:bg-secondary text-muted-foreground"}`,children:[o.jsx(h,{className:"w-4 h-4"}),d.label]},d.id)})}),o.jsxs("div",{className:"flex-1 space-y-6",children:[s==="profile"&&o.jsx(pE,{}),s==="security"&&o.jsx(gE,{}),s==="database"&&o.jsx(yE,{})]})]})]})}function pE(){const{state:s,actions:a}=Br(),[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(!1),[p,g]=w.useState(!1),[v,_]=w.useState(Tr.isEnabled());w.useEffect(()=>{s.profile&&(l(s.profile.first_name||""),d(s.profile.last_name||""))},[s.profile]);const x=()=>{const j=!v;Tr.setEnabled(j),_(j),j?(Tr.playSuccess(),re.success("Sound effects enabled")):re.info("Sound effects disabled")},S=async()=>{m(!0);const j=await a.updateProfile({first_name:r,last_name:c});m(!1),j&&re.success("Profile updated")},A=async j=>{const O=j.target.files?.[0];if(!(!O||!s.user)){g(!0);try{const R=O.name.split(".").pop(),q=`${s.user.id}/avatar.${R}`,{data:B,error:G}=await ct.storage.from("avatars").upload(q,O,{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(R){console.error("Avatar upload error:",R),re.error("Failed to upload avatar")}finally{g(!1)}}};return o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsx(Ta,{children:"Profile Information"}),o.jsx(es,{children:"Update your personal details and avatar."})]}),o.jsxs(Aa,{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col items-center sm:flex-row sm:items-start gap-6",children:[o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"w-24 h-24 rounded-full bg-secondary overflow-hidden border-2 border-border flex items-center justify-center",children:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(by,{className:"w-12 h-12 text-muted-foreground"})}),o.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-full opacity-0 group-hover:opacity-100 cursor-pointer transition-opacity",children:[o.jsx(Rx,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:A,disabled:p})]}),p&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(mt,{size:"sm"})})]}),o.jsxs("div",{className:"flex-1 space-y-4 w-full",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"first-name",children:"First Name"}),o.jsx(Se,{id:"first-name",value:r,onChange:j=>l(j.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Se,{id:"last-name",value:c,onChange:j=>d(j.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"email",children:"Email Address"}),o.jsx(Se,{id:"email",value:s.profile?.email||"",disabled:!0,className:"bg-secondary/50"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Email cannot be changed directly."})]})]})]}),o.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("label",{className:"text-sm font-medium",children:"Sound & Haptics"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Audio feedback when processing emails and completing tasks."})]}),o.jsxs(Z,{variant:v?"default":"outline",size:"sm",onClick:x,className:"gap-2",children:[v?o.jsx(t_,{className:"w-4 h-4"}):o.jsx(s_,{className:"w-4 h-4"}),v?"Enabled":"Disabled"]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(Z,{onClick:S,disabled:h,children:[h?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Dw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function gE(){const[s,a]=w.useState(""),[r,l]=w.useState(""),[c,d]=w.useState(!1),h=async()=>{if(!s){re.error("Please enter a new password");return}if(s!==r){re.error("Passwords do not match");return}if(s.length<6){re.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await hE(async()=>{const{api:g}=await Promise.resolve().then(()=>Ij);return{api:g}},void 0),p=await m.changePassword(s);p.success?(re.success("Password changed successfully"),a(""),l("")):re.error(p.error?.message||"Failed to change password")}catch{re.error("An error occurred")}finally{d(!1)}};return o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsx(Ta,{children:"Security"}),o.jsx(es,{children:"Manage your password and account security."})]}),o.jsxs(Aa,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"new-password",children:"New Password"}),o.jsx(Se,{id:"new-password",type:"password",value:s,onChange:m=>a(m.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"confirm-password",children:"Confirm New Password"}),o.jsx(Se,{id:"confirm-password",type:"password",value:r,onChange:m=>l(m.target.value),placeholder:"••••••••"})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(Z,{onClick:h,disabled:c,children:[c?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(hw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function yE(){const[s,a]=w.useState(!1),r=Lr(),l=$j(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(qj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(At,{children:[o.jsxs(Ea,{children:[o.jsxs(Ta,{className:"flex items-center gap-2",children:[o.jsx(Hi,{className:"w-5 h-5 text-primary"}),"Supabase Connection"]}),o.jsx(es,{children:"Manage your database configuration (BYOK - Bring Your Own Keys)."})]}),o.jsx(Aa,{className:"space-y-6",children:r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-xl bg-emerald-500/5 border-emerald-500/20",children:[o.jsx(rf,{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(Fi,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(Bd,{className:"h-4 w-4 text-amber-500"}),o.jsx(Wi,{className:"text-amber-700 dark:text-amber-400 text-xs",children:"Configuration is loaded from environment variables. Use the UI to override them."})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs(Z,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[o.jsx(Bd,{className:"w-4 h-4 mr-2"}),"Change Connection"]}),l==="ui"&&o.jsxs(Z,{variant:"outline",onClick:c,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(Mo,{className:"w-4 h-4 mr-2"}),"Clear Config"]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(ma,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Anon Public Key"}),o.jsxs("div",{className:"p-2 bg-secondary/50 rounded-lg font-mono text-xs break-all",children:[r.anonKey.substring(0,20),"...",r.anonKey.substring(r.anonKey.length-10)]})]})]}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center space-y-4",children:[o.jsx(Xx,{className:"w-12 h-12 text-destructive opacity-20"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"No Connection Detected"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure a Supabase project to get started."})]}),o.jsxs(Z,{onClick:()=>a(!0),children:[o.jsx(Hi,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx(Vv,{open:s,onComplete:()=>a(!1),canClose:!0})]})}function vE({length:s=6,value:a,onChange:r,onComplete:l,disabled:c=!1,error:d=!1}){const h=w.useRef([]),[m,p]=w.useState(null),g=(x,S)=>{const A=S.replace(/[^0-9]/g,"");if(A.length===0){const R=a.split("");R[x]=" ",a.split("");let q=a.split("");x<q.length&&q.splice(x,1);const B=q.join("");r(B),x>0&&h.current[x-1]?.focus();return}a.split("");const j=[...a];j[x]=A[0],r(j.join("")),x<s-1&&h.current[x+1]?.focus();const O=j.join("");O.length===s&&l&&l(O)},v=(x,S)=>{S.key==="Backspace"&&!a[x]&&x>0||S.key==="ArrowLeft"&&x>0?h.current[x-1]?.focus():S.key==="ArrowRight"&&x<s-1&&h.current[x+1]?.focus()},_=x=>{x.preventDefault();const A=x.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,s);r(A);const j=Math.min(A.length,s-1);h.current[j]?.focus(),A.length===s&&l&&l(A)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:s}).map((x,S)=>o.jsx(Se,{ref:A=>{h.current[S]=A},type:"text",inputMode:"numeric",maxLength:1,value:a[S]||"",onChange:A=>g(S,A.target.value),onKeyDown:A=>v(S,A),onPaste:_,onFocus:()=>p(S),onBlur:()=>p(null),disabled:c,className:Oe("w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-semibold px-0",d&&"border-destructive focus-visible:ring-destructive",m===S&&"ring-2 ring-ring"),"aria-label":`Digit ${S+1}`},S))})}function bE({onSuccess:s,onConfigure:a}){const[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(""),[p,g]=w.useState(""),[v,_]=w.useState(!1),[x,S]=w.useState(!0),[A,j]=w.useState(!1),[O,R]=w.useState(""),[q,B]=w.useState("password"),[G,ee]=w.useState("email"),[J,P]=w.useState("");w.useEffect(()=>{X()},[]);const X=async()=>{try{const{data:be,error:ge}=await ct.from("init_state").select("is_initialized");if(ge){console.warn("[Login] Init check failed, defaulting to initialized (Login):",ge),j(!0);return}const Ze=be?.[0]?.is_initialized>0;j(Ze)}catch(be){if(console.warn("[Login] Init check exception, defaulting to initialized:",be),be.message?.includes("Invalid API key")||be.status===401){console.warn("[Login] API Key invalid for REST check (likely Publishable Key). defaulting to Setup Mode (isInitialized=false)."),j(!1);return}j(!0)}finally{S(!1)}},ue=async be=>{be.preventDefault(),_(!0),R("");try{if(A){if(q==="password"){const{error:ge}=await ct.auth.signInWithPassword({email:r,password:c});if(ge)throw ge;re.success("Logged in successfully"),s?.()}else if(G==="email"){const{error:ge}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(ge)throw ge;ee("verify"),re.success("Validation code sent to your email")}}else{const{data:ge,error:Ze}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:p}});if(Ze||!ge){if(Ze?.message?.includes("First user already exists")){re.info("System already initialized. Please log in."),j(!0);return}throw new Error(Ze?.message||"Failed to create admin account")}re.success("Admin account created! Signing you in...");const{error:st}=await ct.auth.signInWithPassword({email:r,password:c});if(st)throw st;j(!0),s?.()}}catch(ge){R(ge?.message||"Authentication failed"),console.error("[Login] Error:",ge)}finally{_(!1)}},Je=async()=>{_(!0),R("");try{const{data:be,error:ge}=await ct.auth.verifyOtp({email:r,token:J,type:"magiclink"});if(ge)throw ge;if(!be.session)throw new Error("Failed to create session");re.success("Logged in successfully"),s?.()}catch(be){R(be?.message||"Invalid code")}finally{_(!1)}};return x?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx($t,{className:"w-8 h-8 animate-spin text-primary"})}):o.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-8 relative",children:[o.jsx("div",{className:"absolute top-4 right-4",children:o.jsx(By,{})}),o.jsxs(At,{className:"w-full max-w-md shadow-2xl",children:[o.jsxs(Ea,{className:"text-center",children:[o.jsx("div",{className:"mx-auto bg-primary/10 p-4 rounded-full w-fit mb-4",children:o.jsx(vf,{className:"w-12 h-12"})}),o.jsx(Ta,{className:"text-2xl",children:A?"Welcome Back":"Welcome to Email Automator"}),o.jsx(es,{children:A?q==="password"?"Sign in to access your email automation":G==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:ue,children:[o.jsxs(Aa,{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(Se,{value:h,onChange:be=>m(be.target.value),required:!A,placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Last Name"}),o.jsx(Se,{value:p,onChange:be=>g(be.target.value),required:!A,placeholder:"Doe"})]})]}),q==="password"||G==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Se,{type:"email",placeholder:"admin@example.com",value:r,onChange:be=>l(be.target.value),required:!0,autoComplete:"email",disabled:G==="verify"})]}):null,q==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Se,{type:"password",placeholder:"••••••••",value:c,onChange:be=>d(be.target.value),required:!0,minLength:6,autoComplete:A?"current-password":"new-password"})]}),q==="otp"&&G==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(vE,{value:J,onChange:P,length:6,onComplete:()=>{}})}),o.jsx(Z,{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:O}),O.includes("configuration")||O.includes("Invalid API key")||O.includes("API key")&&a&&o.jsx(Z,{type:"button",variant:"outline",className:"w-full border-destructive/50 hover:bg-destructive/20 text-destructive",onClick:a,children:"Update Connection Settings"})]})]}),o.jsxs(uv,{className:"flex flex-col gap-3",children:[q==="otp"&&G==="verify"?o.jsx(Z,{type:"button",onClick:Je,disabled:v||J.length!==6,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify Code"}):o.jsx(Z,{type:"submit",disabled:v||!r||q==="password"&&!c,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),A?q==="otp"?"Send Code":"Signing in...":"Creating Account..."]}):o.jsxs(o.Fragment,{children:[A?q==="otp"?o.jsx(Ld,{className:"w-4 h-4 mr-2"}):o.jsx(vw,{className:"w-4 h-4 mr-2"}):o.jsx(Fw,{className:"w-4 h-4 mr-2"}),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(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("otp"),ee("email"),R("")},children:[o.jsx(dw,{className:"w-4 h-4 mr-2"}),"Sign in with Code"]}):o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("password"),R("")},children:[o.jsx(Nx,{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 Iv=void 0,xE=void 0;function wE(s,a){const r=s.split(".").map(Number),l=a.split(".").map(Number);for(let c=0;c<Math.max(r.length,l.length);c++){const d=r[c]||0,h=l[c]||0;if(d>h)return 1;if(d<h)return-1}return 0}async function _E(s){try{const{data:a,error:r}=await s.rpc("get_latest_migration_timestamp");return r?(console.warn("Could not get latest migration timestamp:",r.message),{version:null,latestMigrationTimestamp:null}):{version:Iv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function SE(s){const a=Iv,r=xE,l=await _E(s);if(console.log("[Migration Check]",{appVersion:a,appMigrationTimestamp:r,dbVersion:l.version,dbMigrationTimestamp:l.latestMigrationTimestamp}),l.latestMigrationTimestamp&&l.latestMigrationTimestamp.trim()!==""){const c=r,d=l.latestMigrationTimestamp;return c>d?{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`New migrations available. Database is at ${d}, app has ${c}.`}:c<d?(console.warn("[Migration Check] DB is ahead of app - possible downgrade"),{needsMigration:!1,appVersion:a,dbVersion:l.version,message:`Database (${d}) is ahead of app (${c}).`}):(console.log("[Migration Check] Timestamps match - database is up-to-date"),{needsMigration:!1,appVersion:a,dbVersion:l.version,message:"Database schema is up-to-date."})}if(l.version){console.log("[Migration Check] Legacy DB detected (no timestamp). Falling back to SemVer.");const c=wE(a,l.version);return c>0?{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`Database schema (v${l.version}) is outdated. Migration to v${a} required.`}:c===0?(console.warn("[Migration Check] Legacy DB with matching version - forcing migration to add timestamp tracking"),{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`Database lacks timestamp tracking. Please run migration to upgrade to modern schema (v${a}).`}):{needsMigration:!1,appVersion:a,dbVersion:l.version,message:`Database version (v${l.version}) is ahead of app (v${a}).`}}return console.log("[Migration Check] No DB info found - assuming migration needed"),{needsMigration:!0,appVersion:a,dbVersion:null,message:`Database schema unknown. Migration required to v${a}.`}}const Gv="email_automator_migration_reminder_dismissed_at";function jE(s=24){try{const a=localStorage.getItem(Gv);if(!a)return!1;const r=new Date(a).getTime();return(Date.now()-r)/(1e3*60*60)<s}catch(a){return console.error("Error checking migration reminder:",a),!1}}function NE(){try{localStorage.setItem(Gv,new Date().toISOString())}catch(s){console.error("Error dismissing migration reminder:",s)}}function EE({status:s,onDismiss:a,onLearnMore:r}){const[l,c]=w.useState(!0);if(!l)return null;const d=()=>{NE(),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(Rr,{className:"h-5 w-5 flex-shrink-0 text-yellow-600 dark:text-yellow-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:"Database Update Required"}),o.jsxs(Z,{size:"icon",variant:"ghost",className:"h-5 w-5 -mr-1 -mt-1 text-yellow-900 hover:bg-yellow-100 dark:text-yellow-100 dark:hover:bg-yellow-900/30",onClick:d,children:[o.jsx(el,{className:"h-3 w-3"}),o.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),o.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-200",children:["Your app version (",s.appVersion,") requires a database schema update."]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Z,{size:"sm",variant:"default",className:"h-7 text-xs bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-500 dark:hover:bg-yellow-600",onClick:h,children:"Update Now"}),o.jsx(Z,{size:"sm",variant:"ghost",className:"h-7 text-xs text-yellow-900 hover:bg-yellow-100 dark:text-yellow-100 dark:hover:bg-yellow-900/30",onClick:d,children:"Remind Later"})]})]})]})})})}function ko({code:s,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(s),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:s})}),o.jsxs(Z,{type:"button",size:"icon",variant:"ghost",className:"absolute right-2 top-2 h-8 w-8",onClick:d,disabled:!c,children:[r?o.jsx(ja,{className:"h-4 w-4 text-green-600"}):o.jsx(Wx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function TE({open:s,onOpenChange:a,status:r}){const l=Lr(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState([]),[v,_]=w.useState(""),[x,S]=w.useState(""),A=w.useRef(null),j=w.useMemo(()=>{const R=l?.url;if(!R)return"";try{return new URL(R).hostname.split(".")[0]||""}catch{return""}},[l?.url]);w.useEffect(()=>{A.current&&A.current.scrollIntoView({behavior:"smooth"})},[p]);const O=async()=>{if(!j){re.error("Missing Project ID");return}m(!0),g(["Initializing migration..."]);try{const R=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:j,dbPassword:v,accessToken:x})});if(!R.ok)throw new Error(`Server returned ${R.status}: ${R.statusText}`);const q=R.body?.getReader();if(!q)throw new Error("No response stream received.");const B=new TextDecoder;for(;;){const{done:G,value:ee}=await q.read();if(G)break;const P=B.decode(ee).split(`
|
|
96
|
-
`).filter(Boolean);g(X=>[...X,...P])}}catch(R){console.error(R),g(q=>[...q,`Error: ${R instanceof Error?R.message:String(R)}`]),re.error("Migration failed. Check logs for details.")}finally{m(!1)}};return o.jsx(mn,{open:s,onOpenChange:R=>!h&&a(R),children:o.jsxs(pn,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[o.jsxs(Ca,{children:[o.jsxs(ka,{className:"flex items-center gap-2 text-xl",children:[o.jsx(Rr,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Migration Required"]}),o.jsxs(Oa,{children:["Your application version (",r.appVersion,") requires a database schema update to function correctly."]})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs(Fi,{children:[o.jsx(kr,{className:"h-4 w-4"}),o.jsxs(Wi,{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(ma,{htmlFor:"project-id",children:"Supabase Project ID"}),o.jsx(Se,{id:"project-id",value:j,disabled:!0,readOnly:!0,className:"bg-muted"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(ma,{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(Vi,{className:"h-3 w-3"})]})]}),o.jsx(Se,{id:"access-token",type:"password",placeholder:"sbp_...",value:x,onChange:R=>S(R.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(ma,{htmlFor:"db-password",children:"Database Password"}),o.jsx(Se,{id:"db-password",type:"password",placeholder:"Your database password",value:v,onChange:R=>_(R.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Required if no access token is provided."})]}),o.jsx(Z,{onClick:O,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrating..."]}):o.jsxs(o.Fragment,{children:[o.jsx($d,{className:"mr-2 h-4 w-4"}),"Start Migration"]})})]})]}),o.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[p.length===0?o.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):p.map((R,q)=>o.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:R},q)),o.jsx("div",{ref:A})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"1"}),"Prerequisites"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"You will need the following before proceeding:"}),o.jsxs("ul",{className:"list-inside list-disc space-y-1 text-sm",children:[o.jsx("li",{children:"Supabase CLI installed"}),o.jsxs("li",{children:["Project ID:"," ",o.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:j||"your-project-id"})]}),o.jsx("li",{children:"Database Password"})]})]})]}),o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"2"}),"Install Supabase CLI"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"MacOS (Brew)"}),o.jsx(ko,{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(ko,{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(ko,{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(ko,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Fi,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(Rr,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(Wi,{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(jr,{children:o.jsx(Z,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function AE(){const[s,a]=w.useState([]),{isExpanded:r,setIsExpanded:l}=cv(),[c,d]=w.useState({});w.useEffect(()=>{h();const v=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},_=>{const x=_.new;x.event_type==="error"&&d(S=>({...S,[x.id]:!0})),a(S=>{const A=[x,...S];return A.length>100?A.slice(0,100):A})}).subscribe();return()=>{ct.removeChannel(v)}},[]);const h=async()=>{const{data:v}=await ct.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);v&&a(v)},m=v=>{d(_=>({..._,[v]:!_[v]}))},p=v=>{switch(v){case"analysis":return o.jsx($i,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(zo,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(Rr,{className:"w-3 h-3 text-red-500"});default:return o.jsx(kr,{className:"w-3 h-3 text-blue-500"})}},g=v=>new Date(v).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return r?o.jsxs(At,{className:"fixed bottom-4 right-4 z-50 w-[550px] h-[650px] flex flex-col shadow-2xl border-border bg-background/95 text-foreground backdrop-blur-md animate-in slide-in-from-bottom-10",children:[o.jsxs(Ea,{className:"py-3 px-4 border-b border-border flex flex-row items-center justify-between sticky top-0 bg-background/95 z-20",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx($d,{className:"w-4 h-4 text-primary"}),o.jsx(Ta,{className:"text-sm font-mono font-bold",children:"Agent Terminal"}),o.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 bg-green-500/10 px-2 py-0.5 rounded-full border border-green-500/20 font-bold",children:[o.jsx(bx,{className:"w-3 h-3"}),"LIVE"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:"Clear"}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:o.jsx(Sw,{className:"w-4 h-4"})})]})]}),o.jsxs(Aa,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[s.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:"Waiting for agent activity..."}),s.map((v,_)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[_!==s.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:Oe("absolute left-0 top-0 w-7 h-7 rounded-full border border-border bg-card flex items-center justify-center z-10 shadow-sm",v.event_type==="error"&&"border-red-500/50 bg-red-500/5",v.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",v.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5"),children:p(v.event_type)}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between group",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Oe("font-bold uppercase tracking-tight text-[10px]",v.event_type==="info"&&"text-muted-foreground",v.event_type==="analysis"&&"text-purple-600 dark:text-purple-400",v.event_type==="action"&&"text-emerald-600 dark:text-emerald-400",v.event_type==="error"&&"text-red-600 dark:text-red-400"),children:v.agent_state}),o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:g(v.created_at)})]}),(v.details?.system_prompt||v.details?._raw_response||v.details?.raw_response)&&o.jsxs(Z,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[9px] text-muted-foreground hover:text-primary opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>m(v.id),children:[c[v.id]?o.jsx(Vx,{className:"w-3 h-3 mr-1"}):o.jsx(Ux,{className:"w-3 h-3 mr-1"}),"Details"]})]}),v.event_type==="analysis"&&v.details?o.jsxs("div",{className:"bg-purple-500/5 border border-purple-500/10 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:Oe("px-1.5 py-0.5 rounded text-[9px] font-bold border",v.details.is_useless?"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20":"bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20"),children:v.details.is_useless?"USELESS":"RELEVANT"}),o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold border bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 uppercase",children:v.details.category})]}),o.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',v.details.summary,'"']}),v.details.suggested_actions&&v.details.suggested_actions.length>0&&o.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:v.details.suggested_actions.map(x=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-emerald-600 dark:text-emerald-400 font-bold bg-emerald-500/10 px-1.5 py-0.5 rounded border border-emerald-500/20 uppercase",children:[o.jsx(zo,{className:"w-2.5 h-2.5"}),x]},x))}),v.details.usage&&o.jsx("div",{className:"pt-1.5 flex items-center gap-3 text-[9px] text-muted-foreground/70 border-t border-purple-500/10 mt-1",children:o.jsxs("span",{children:["Tokens: ",v.details.usage.prompt_tokens," (in) + ",v.details.usage.completion_tokens," (out) = ",o.jsx("span",{className:"text-purple-500 font-bold",children:v.details.usage.total_tokens})]})})]}):v.event_type==="action"&&v.details?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/10 rounded-lg p-3",children:[o.jsx("p",{className:"text-emerald-600 dark:text-emerald-400 font-bold mb-1 uppercase text-[9px] tracking-widest",children:"Execution Complete"}),o.jsxs("p",{className:"text-foreground font-medium",children:[v.details.action==="delete"&&"Moved to Trash",v.details.action==="archive"&&"Archived Email",v.details.action==="draft"&&"Drafted Reply",v.details.action==="read"&&"Marked as Read",v.details.action==="star"&&"Starred Email",!["delete","archive","draft","read","star"].includes(v.details.action)&&v.details.action]}),v.details.reason&&o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[o.jsx(kr,{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(zs,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"whitespace-pre-wrap break-words text-[10px] leading-normal text-muted-foreground select-all",children:v.details.system_prompt})})]}),v.details?.content_preview&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(zs,{className:"w-3 h-3"})," Input Content (Cleaned)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border",children:o.jsx("p",{className:"whitespace-pre-wrap break-words text-[10px] text-muted-foreground",children:v.details.content_preview})})]}),v.details?._raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(zs,{className:"w-3 h-3"})," Raw LLM JSON Output"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all",children:JSON.stringify(JSON.parse(v.details._raw_response),null,2)})})]}),v.details?.raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(zs,{className:"w-3 h-3"})," Raw Response (from Error)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all whitespace-pre-wrap",children:typeof v.details.raw_response=="object"?JSON.stringify(v.details.raw_response,null,2):v.details.raw_response})})]})]})]})]},v.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(Z,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx($d,{className:"w-4 h-4 mr-2"}),"Live Activity",s.length>0&&o.jsxs("span",{className:"ml-2 flex h-2 w-2 relative",children:[o.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),o.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]})]})})}function CE(){const{state:s,isSubscribed:a,actions:r}=Br(),[l,c]=w.useState(!1),[d,h]=w.useState("dashboard"),[m,p]=w.useState(!0),[g,v]=w.useState(!1);if(w.useEffect(()=>{const P=new URLSearchParams(window.location.search).get("code");P&&!g&&(async()=>{v(!0);try{const ue=await qe.connectGmail(P);if(ue.data?.success)re.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),r.fetchAccounts());else{const Je=typeof ue.error=="string"?ue.error:ue.error?.message;re.error(Je||"Failed to connect Gmail")}}catch{re.error("Connection failed")}finally{v(!1)}})()},[]),g)return o.jsx(qi,{text:"Connecting account..."});const[_,x]=w.useState(null),[S,A]=w.useState(!1),[j,O]=w.useState(!1),[R,q]=w.useState(!1);w.useEffect(()=>{(async()=>{const P=Lr();if(!P){c(!0),p(!1);return}if((await av(P.url,P.anonKey)).valid)s.isInitialized&&s.isAuthenticated&&(r.fetchAccounts(),r.fetchRules(),r.fetchSettings(),r.fetchProfile(),SE(ct).then(ue=>{x(ue),ue.needsMigration&&!jE()&&A(!0)}));else{c(!0),p(!1);return}p(!1)})()},[s.isInitialized,s.isAuthenticated]);const B=()=>{O(!0),A(!1)},G={migrationStatus:_,showMigrationBanner:S,showMigrationModal:j,openMigrationModal:B,suppressMigrationBanner:R,setSuppressMigrationBanner:q};if(m)return o.jsx(qi,{text:"Checking configuration..."});if(l)return o.jsx(Vv,{onComplete:()=>{c(!1),window.location.reload()}});if(!s.isInitialized)return o.jsx(qi,{text:"Initializing..."});if(!s.isAuthenticated)return o.jsx(bE,{onConfigure:()=>c(!0)});const ee=async()=>{await ct.auth.signOut(),re.success("Logged out successfully")};return o.jsx(eN,{value:G,children:o.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[o.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{onClick:()=>h("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(vf,{className:"w-8 h-8"}),o.jsx("span",{className:"hidden sm:inline",children:"Email Automator"}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),o.jsxs("div",{className:Oe("flex items-center gap-1.5 px-2 h-6 rounded-full text-[10px] font-bold border transition-colors",a?"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 dark:text-emerald-400":"bg-yellow-500/10 text-yellow-600 border-yellow-500/20 dark:text-yellow-400"),children:[o.jsxs("div",{className:"relative flex items-center justify-center",children:[a&&o.jsx("span",{className:"absolute inline-flex h-3 w-3 rounded-full bg-emerald-500/40 animate-ping"}),o.jsx("div",{className:Oe("relative w-2 h-2 rounded-full",a?"bg-emerald-500":"bg-yellow-500")})]}),o.jsx("span",{className:"hidden xs:inline leading-none",children:a?"LIVE":"OFFLINE"})]})]}),o.jsxs("div",{className:"flex gap-4 items-center",children:[o.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[o.jsxs(Z,{variant:d==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>h("dashboard"),className:"gap-2",children:[o.jsx(pw,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),o.jsxs(Z,{variant:d==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>h("analytics"),className:"gap-2",children:[o.jsx(yy,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),o.jsxs(Z,{variant:d==="config"?"secondary":"ghost",size:"sm",onClick:()=>h("config"),className:"gap-2",children:[o.jsx(Bd,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Configuration"})]})]}),o.jsx("div",{className:"h-6 w-px bg-border/50 mx-2 hidden sm:block"}),o.jsx(By,{}),o.jsx(Z,{variant:d==="account"?"secondary":"ghost",size:"sm",onClick:()=>h("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:"Account Settings",children:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(Yx,{className:"w-5 h-5"})}),o.jsx(Z,{variant:"ghost",size:"sm",onClick:ee,className:"text-muted-foreground hover:text-foreground w-8 px-0",title:"Sign out",children:o.jsx(xw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4",children:[d==="dashboard"&&o.jsx(lE,{}),d==="config"&&o.jsx(uE,{}),d==="analytics"&&o.jsx(OE,{}),d==="account"&&o.jsx(mE,{})]}),s.error&&o.jsx("div",{className:"fixed bottom-20 left-4 right-4 sm:left-auto sm:right-4 sm:max-w-sm z-50",children:o.jsx("div",{className:"bg-destructive/10 border border-destructive/20 text-destructive p-4 rounded-lg",children:o.jsx("p",{className:"text-sm",children:s.error})})}),_&&S&&!R&&o.jsx(EE,{status:_,onDismiss:()=>A(!1),onLearnMore:B}),_&&o.jsx(TE,{open:j,onOpenChange:O,status:_}),o.jsx(AE,{})]})})}function kE({runId:s,accountEmail:a,isOpen:r,onOpenChange:l}){const[c,d]=w.useState([]),[h,m]=w.useState(!1);w.useEffect(()=>{r&&s&&p()},[r,s]);const p=async()=>{if(s){m(!0);try{const v=await qe.getRunEvents(s);v.data&&d(v.data.events)}catch(v){console.error("Failed to fetch run trace:",v)}finally{m(!1)}}},g=v=>{switch(v){case"analysis":return o.jsx($i,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(zo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Dr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(kr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(mn,{open:r,onOpenChange:l,children:o.jsxs(pn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Ca,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(of,{className:"w-5 h-5 text-primary"}),o.jsx(ka,{children:"Sync Run Trace"})]}),o.jsx(Oa,{children:a?`Full log for account: ${a}`:"Historical log for this synchronization run."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:h?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(qi,{text:"Loading trace..."})}):c.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:"No granular trace events found for this run."}):c.map((v,_)=>o.jsxs("div",{className:"relative pl-8",children:[_!==c.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:g(v.event_type)}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-foreground/70",children:v.agent_state}),v.emails?.subject&&o.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",v.emails.subject]})]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Cr,{className:"w-3 h-3"}),new Date(v.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[v.event_type==="info"&&o.jsx("p",{className:"text-sm text-foreground/90",children:v.details?.message}),v.event_type==="analysis"&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',v.details?.summary,'"']}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:"text-[9px] bg-secondary px-1.5 py-0.5 rounded font-bold uppercase",children:v.details?.category}),v.details?.suggested_actions?.map(x=>o.jsx("span",{className:"text-[9px] bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 px-1.5 py-0.5 rounded border border-emerald-500/20 font-bold uppercase",children:x},x))]}),v.details?.usage&&o.jsxs("div",{className:"flex gap-3 pt-1.5 mt-1 border-t border-border/50 text-[9px] text-muted-foreground",children:[o.jsxs("span",{children:["In: ",o.jsx("b",{children:v.details.usage.prompt_tokens})]}),o.jsxs("span",{children:["Out: ",o.jsx("b",{children:v.details.usage.completion_tokens})]}),o.jsxs("span",{children:["Total: ",o.jsx("span",{className:"text-primary font-bold",children:v.details.usage.total_tokens})]})]})]}),v.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:["Executed: ",v.details?.action]}),o.jsx(lf,{className:"w-4 h-4 text-emerald-500"})]}),v.event_type==="error"&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:v.details?.error})]})]})]},v.id))})]})})}function OE(){const{state:s,actions:a}=Br(),[r,l]=w.useState(null),[c,d]=w.useState(void 0),[h,m]=w.useState(!1);if(w.useEffect(()=>{a.fetchStats()},[]),!s.stats)return o.jsx(qi,{text:"Loading analytics..."});const p=(v,_)=>{l(v),d(_),m(!0)},{stats:g}=s;return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[o.jsx(yy,{className:"w-6 h-6 text-primary"}),"Analytics Dashboard"]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[o.jsx(Oo,{title:"Total Emails",value:g.totalEmails,color:"primary"}),o.jsx(Oo,{title:"Spam Caught",value:g.categoryCounts.spam||0,color:"destructive"}),o.jsx(Oo,{title:"Actions Taken",value:Object.values(g.actionCounts).reduce((v,_)=>v+_,0)-(g.actionCounts.none||0),color:"emerald"}),o.jsx(Oo,{title:"Accounts",value:g.accountCount,color:"blue"})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Email Categories"}),o.jsx("div",{className:"space-y-3",children:Object.entries(g.categoryCounts).map(([v,_])=>o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[o.jsx("span",{className:"capitalize",children:v}),o.jsx("span",{className:"text-muted-foreground",children:_})]}),o.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${_/g.totalEmails*100}%`}})})]})},v))})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Actions Taken"}),o.jsx("div",{className:"space-y-3",children:Object.entries(g.actionCounts).map(([v,_])=>o.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[o.jsx("span",{className:"capitalize",children:v}),o.jsx("span",{className:"font-medium",children:_})]},v))})]})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Recent Sync Activity"}),g.recentSyncs.length===0?o.jsx("p",{className:"text-muted-foreground text-sm",children:"No sync activity yet"}):o.jsx("div",{className:"space-y-3",children:g.recentSyncs.map(v=>{const _=v.completed_at?Math.round((new Date(v.completed_at).getTime()-new Date(v.started_at).getTime())/1e3):null;return o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between p-3 border rounded-lg hover:bg-secondary/30 transition-colors gap-3 cursor-pointer group",onClick:()=>p(v.id,v.email_accounts?.email_address),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:Oe("w-2.5 h-2.5 rounded-full",v.status==="success"?"bg-emerald-500":v.status==="failed"?"bg-destructive":"bg-yellow-500 shadow-[0_0_8px_rgba(234,179,8,0.5)] animate-pulse")}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:v.email_accounts?.email_address||"System Sync"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Cr,{className:"w-3 h-3"}),new Date(v.started_at).toLocaleString(),_!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[_,"s"]})]})]})]}),o.jsx("div",{className:"flex items-center gap-4 text-xs",children:o.jsxs("div",{className:"flex flex-col items-end",children:[o.jsxs("span",{className:"font-bold text-primary",children:[v.emails_processed," emails"]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[v.emails_deleted," deleted, ",v.emails_drafted," drafted"]})]})})]},v.id)})})]}),o.jsx(kE,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function Oo({title:s,value:a,color:r}){const l={primary:"bg-primary/10 text-primary",destructive:"bg-destructive/10 text-destructive",emerald:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",blue:"bg-blue-500/10 text-blue-600 dark:text-blue-400"};return o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:s}),o.jsx("p",{className:`text-3xl font-bold ${l[r]||""}`,children:a})]})}function RE(){return o.jsx(l_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(aN,{children:o.jsx(tN,{children:o.jsxs(Fj,{children:[o.jsx(CE,{}),o.jsx(Qj,{})]})})})})}fx.createRoot(document.getElementById("root")).render(o.jsx(my.StrictMode,{children:o.jsx(RE,{})}));
|