@realtimex/email-automator 2.19.0 → 2.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,105 +0,0 @@
1
- function lE(n,e){for(var a=0;a<e.length;a++){const i=e[a];if(typeof i!="string"&&!Array.isArray(i)){for(const l in i)if(l!=="default"&&!(l in n)){const d=Object.getOwnPropertyDescriptor(i,l);d&&Object.defineProperty(n,l,d.get?d:{enumerable:!0,get:()=>i[l]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const d of l)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&i(h)}).observe(document,{childList:!0,subtree:!0});function a(l){const d={};return l.integrity&&(d.integrity=l.integrity),l.referrerPolicy&&(d.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?d.credentials="include":l.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(l){if(l.ep)return;l.ep=!0;const d=a(l);fetch(l.href,d)}})();function jm(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Kh={exports:{}},Eo={};var l0;function cE(){if(l0)return Eo;l0=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function a(i,l,d){var h=null;if(d!==void 0&&(h=""+d),l.key!==void 0&&(h=""+l.key),"key"in l){d={};for(var m in l)m!=="key"&&(d[m]=l[m])}else d=l;return l=d.ref,{$$typeof:n,type:i,key:h,ref:l!==void 0?l:null,props:d}}return Eo.Fragment=e,Eo.jsx=a,Eo.jsxs=a,Eo}var c0;function uE(){return c0||(c0=1,Kh.exports=cE()),Kh.exports}var c=uE(),Yh={exports:{}},Ee={};var u0;function dE(){if(u0)return Ee;u0=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=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"),y=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),w=Symbol.iterator;function j(O){return O===null||typeof O!="object"?null:(O=w&&O[w]||O["@@iterator"],typeof O=="function"?O:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,N={};function A(O,X,Q){this.props=O,this.context=X,this.refs=N,this.updater=Q||_}A.prototype.isReactComponent={},A.prototype.setState=function(O,X){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,X,"setState")},A.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function M(){}M.prototype=A.prototype;function k(O,X,Q){this.props=O,this.context=X,this.refs=N,this.updater=Q||_}var U=k.prototype=new M;U.constructor=k,T(U,A.prototype),U.isPureReactComponent=!0;var F=Array.isArray;function K(){}var P={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function Z(O,X,Q){var se=Q.ref;return{$$typeof:n,type:O,key:X,ref:se!==void 0?se:null,props:Q}}function ie(O,X){return Z(O.type,X,O.props)}function be(O){return typeof O=="object"&&O!==null&&O.$$typeof===n}function de(O){var X={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(Q){return X[Q]})}var qe=/\/+/g;function Be(O,X){return typeof O=="object"&&O!==null&&O.key!=null?de(""+O.key):X.toString(36)}function te(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(K,K):(O.status="pending",O.then(function(X){O.status==="pending"&&(O.status="fulfilled",O.value=X)},function(X){O.status==="pending"&&(O.status="rejected",O.reason=X)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function R(O,X,Q,se,we){var je=typeof O;(je==="undefined"||je==="boolean")&&(O=null);var ge=!1;if(O===null)ge=!0;else switch(je){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(O.$$typeof){case n:case e:ge=!0;break;case v:return ge=O._init,R(ge(O._payload),X,Q,se,we)}}if(ge)return we=we(O),ge=se===""?"."+Be(O,0):se,F(we)?(Q="",ge!=null&&(Q=ge.replace(qe,"$&/")+"/"),R(we,X,Q,"",function(un){return un})):we!=null&&(be(we)&&(we=ie(we,Q+(we.key==null||O&&O.key===we.key?"":(""+we.key).replace(qe,"$&/")+"/")+ge)),X.push(we)),1;ge=0;var ot=se===""?".":se+":";if(F(O))for(var Ue=0;Ue<O.length;Ue++)se=O[Ue],je=ot+Be(se,Ue),ge+=R(se,X,Q,je,we);else if(Ue=j(O),typeof Ue=="function")for(O=Ue.call(O),Ue=0;!(se=O.next()).done;)se=se.value,je=ot+Be(se,Ue++),ge+=R(se,X,Q,je,we);else if(je==="object"){if(typeof O.then=="function")return R(te(O),X,Q,se,we);throw X=String(O),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ge}function q(O,X,Q){if(O==null)return O;var se=[],we=0;return R(O,se,"","",function(je){return X.call(Q,je,we++)}),se}function I(O){if(O._status===-1){var X=O._result;X=X(),X.then(function(Q){(O._status===0||O._status===-1)&&(O._status=1,O._result=Q)},function(Q){(O._status===0||O._status===-1)&&(O._status=2,O._result=Q)}),O._status===-1&&(O._status=0,O._result=X)}if(O._status===1)return O._result.default;throw O._result}var he=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},_e={map:q,forEach:function(O,X,Q){q(O,function(){X.apply(this,arguments)},Q)},count:function(O){var X=0;return q(O,function(){X++}),X},toArray:function(O){return q(O,function(X){return X})||[]},only:function(O){if(!be(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Ee.Activity=x,Ee.Children=_e,Ee.Component=A,Ee.Fragment=a,Ee.Profiler=l,Ee.PureComponent=k,Ee.StrictMode=i,Ee.Suspense=p,Ee.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Ee.__COMPILER_RUNTIME={__proto__:null,c:function(O){return P.H.useMemoCache(O)}},Ee.cache=function(O){return function(){return O.apply(null,arguments)}},Ee.cacheSignal=function(){return null},Ee.cloneElement=function(O,X,Q){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var se=T({},O.props),we=O.key;if(X!=null)for(je in X.key!==void 0&&(we=""+X.key),X)!z.call(X,je)||je==="key"||je==="__self"||je==="__source"||je==="ref"&&X.ref===void 0||(se[je]=X[je]);var je=arguments.length-2;if(je===1)se.children=Q;else if(1<je){for(var ge=Array(je),ot=0;ot<je;ot++)ge[ot]=arguments[ot+2];se.children=ge}return Z(O.type,we,se)},Ee.createContext=function(O){return O={$$typeof:h,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:d,_context:O},O},Ee.createElement=function(O,X,Q){var se,we={},je=null;if(X!=null)for(se in X.key!==void 0&&(je=""+X.key),X)z.call(X,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(we[se]=X[se]);var ge=arguments.length-2;if(ge===1)we.children=Q;else if(1<ge){for(var ot=Array(ge),Ue=0;Ue<ge;Ue++)ot[Ue]=arguments[Ue+2];we.children=ot}if(O&&O.defaultProps)for(se in ge=O.defaultProps,ge)we[se]===void 0&&(we[se]=ge[se]);return Z(O,je,we)},Ee.createRef=function(){return{current:null}},Ee.forwardRef=function(O){return{$$typeof:m,render:O}},Ee.isValidElement=be,Ee.lazy=function(O){return{$$typeof:v,_payload:{_status:-1,_result:O},_init:I}},Ee.memo=function(O,X){return{$$typeof:y,type:O,compare:X===void 0?null:X}},Ee.startTransition=function(O){var X=P.T,Q={};P.T=Q;try{var se=O(),we=P.S;we!==null&&we(Q,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(K,he)}catch(je){he(je)}finally{X!==null&&Q.types!==null&&(X.types=Q.types),P.T=X}},Ee.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Ee.use=function(O){return P.H.use(O)},Ee.useActionState=function(O,X,Q){return P.H.useActionState(O,X,Q)},Ee.useCallback=function(O,X){return P.H.useCallback(O,X)},Ee.useContext=function(O){return P.H.useContext(O)},Ee.useDebugValue=function(){},Ee.useDeferredValue=function(O,X){return P.H.useDeferredValue(O,X)},Ee.useEffect=function(O,X){return P.H.useEffect(O,X)},Ee.useEffectEvent=function(O){return P.H.useEffectEvent(O)},Ee.useId=function(){return P.H.useId()},Ee.useImperativeHandle=function(O,X,Q){return P.H.useImperativeHandle(O,X,Q)},Ee.useInsertionEffect=function(O,X){return P.H.useInsertionEffect(O,X)},Ee.useLayoutEffect=function(O,X){return P.H.useLayoutEffect(O,X)},Ee.useMemo=function(O,X){return P.H.useMemo(O,X)},Ee.useOptimistic=function(O,X){return P.H.useOptimistic(O,X)},Ee.useReducer=function(O,X,Q){return P.H.useReducer(O,X,Q)},Ee.useRef=function(O){return P.H.useRef(O)},Ee.useState=function(O){return P.H.useState(O)},Ee.useSyncExternalStore=function(O,X,Q){return P.H.useSyncExternalStore(O,X,Q)},Ee.useTransition=function(){return P.H.useTransition()},Ee.version="19.2.3",Ee}var d0;function Em(){return d0||(d0=1,Yh.exports=dE()),Yh.exports}var S=Em();const kb=jm(S),Tm=lE({__proto__:null,default:kb},[S]);var Xh={exports:{}},To={},Wh={exports:{}},Jh={};var h0;function hE(){return h0||(h0=1,(function(n){function e(R,q){var I=R.length;R.push(q);e:for(;0<I;){var he=I-1>>>1,_e=R[he];if(0<l(_e,q))R[he]=q,R[I]=_e,I=he;else break e}}function a(R){return R.length===0?null:R[0]}function i(R){if(R.length===0)return null;var q=R[0],I=R.pop();if(I!==q){R[0]=I;e:for(var he=0,_e=R.length,O=_e>>>1;he<O;){var X=2*(he+1)-1,Q=R[X],se=X+1,we=R[se];if(0>l(Q,I))se<_e&&0>l(we,Q)?(R[he]=we,R[se]=I,he=se):(R[he]=Q,R[X]=I,he=X);else if(se<_e&&0>l(we,I))R[he]=we,R[se]=I,he=se;else break e}}return q}function l(R,q){var I=R.sortIndex-q.sortIndex;return I!==0?I:R.id-q.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var p=[],y=[],v=1,x=null,w=3,j=!1,_=!1,T=!1,N=!1,A=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function U(R){for(var q=a(y);q!==null;){if(q.callback===null)i(y);else if(q.startTime<=R)i(y),q.sortIndex=q.expirationTime,e(p,q);else break;q=a(y)}}function F(R){if(T=!1,U(R),!_)if(a(p)!==null)_=!0,K||(K=!0,de());else{var q=a(y);q!==null&&te(F,q.startTime-R)}}var K=!1,P=-1,z=5,Z=-1;function ie(){return N?!0:!(n.unstable_now()-Z<z)}function be(){if(N=!1,K){var R=n.unstable_now();Z=R;var q=!0;try{e:{_=!1,T&&(T=!1,M(P),P=-1),j=!0;var I=w;try{t:{for(U(R),x=a(p);x!==null&&!(x.expirationTime>R&&ie());){var he=x.callback;if(typeof he=="function"){x.callback=null,w=x.priorityLevel;var _e=he(x.expirationTime<=R);if(R=n.unstable_now(),typeof _e=="function"){x.callback=_e,U(R),q=!0;break t}x===a(p)&&i(p),U(R)}else i(p);x=a(p)}if(x!==null)q=!0;else{var O=a(y);O!==null&&te(F,O.startTime-R),q=!1}}break e}finally{x=null,w=I,j=!1}q=void 0}}finally{q?de():K=!1}}}var de;if(typeof k=="function")de=function(){k(be)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,Be=qe.port2;qe.port1.onmessage=be,de=function(){Be.postMessage(null)}}else de=function(){A(be,0)};function te(R,q){P=A(function(){R(n.unstable_now())},q)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(R){R.callback=null},n.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<R?Math.floor(1e3/R):5},n.unstable_getCurrentPriorityLevel=function(){return w},n.unstable_next=function(R){switch(w){case 1:case 2:case 3:var q=3;break;default:q=w}var I=w;w=q;try{return R()}finally{w=I}},n.unstable_requestPaint=function(){N=!0},n.unstable_runWithPriority=function(R,q){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var I=w;w=R;try{return q()}finally{w=I}},n.unstable_scheduleCallback=function(R,q,I){var he=n.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?he+I:he):I=he,R){case 1:var _e=-1;break;case 2:_e=250;break;case 5:_e=1073741823;break;case 4:_e=1e4;break;default:_e=5e3}return _e=I+_e,R={id:v++,callback:q,priorityLevel:R,startTime:I,expirationTime:_e,sortIndex:-1},I>he?(R.sortIndex=I,e(y,R),a(p)===null&&R===a(y)&&(T?(M(P),P=-1):T=!0,te(F,I-he))):(R.sortIndex=_e,e(p,R),_||j||(_=!0,K||(K=!0,de()))),R},n.unstable_shouldYield=ie,n.unstable_wrapCallback=function(R){var q=w;return function(){var I=w;w=q;try{return R.apply(this,arguments)}finally{w=I}}}})(Jh)),Jh}var f0;function fE(){return f0||(f0=1,Wh.exports=hE()),Wh.exports}var Zh={exports:{}},zt={};var m0;function mE(){if(m0)return zt;m0=1;var n=Em();function e(p){var y="https://react.dev/errors/"+p;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)y+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var i={d:{f:a,r:function(){throw Error(e(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},l=Symbol.for("react.portal");function d(p,y,v){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:x==null?null:""+x,children:p,containerInfo:y,implementation:v}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,y){if(p==="font")return"";if(typeof y=="string")return y==="use-credentials"?y:""}return zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,zt.createPortal=function(p,y){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(e(299));return d(p,y,null,v)},zt.flushSync=function(p){var y=h.T,v=i.p;try{if(h.T=null,i.p=2,p)return p()}finally{h.T=y,i.p=v,i.d.f()}},zt.preconnect=function(p,y){typeof p=="string"&&(y?(y=y.crossOrigin,y=typeof y=="string"?y==="use-credentials"?y:"":void 0):y=null,i.d.C(p,y))},zt.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},zt.preinit=function(p,y){if(typeof p=="string"&&y&&typeof y.as=="string"){var v=y.as,x=m(v,y.crossOrigin),w=typeof y.integrity=="string"?y.integrity:void 0,j=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;v==="style"?i.d.S(p,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:x,integrity:w,fetchPriority:j}):v==="script"&&i.d.X(p,{crossOrigin:x,integrity:w,fetchPriority:j,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},zt.preinitModule=function(p,y){if(typeof p=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var v=m(y.as,y.crossOrigin);i.d.M(p,{crossOrigin:v,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0})}}else y==null&&i.d.M(p)},zt.preload=function(p,y){if(typeof p=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var v=y.as,x=m(v,y.crossOrigin);i.d.L(p,v,{crossOrigin:x,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},zt.preloadModule=function(p,y){if(typeof p=="string")if(y){var v=m(y.as,y.crossOrigin);i.d.m(p,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:v,integrity:typeof y.integrity=="string"?y.integrity:void 0})}else i.d.m(p)},zt.requestFormReset=function(p){i.d.r(p)},zt.unstable_batchedUpdates=function(p,y){return p(y)},zt.useFormState=function(p,y,v){return h.H.useFormState(p,y,v)},zt.useFormStatus=function(){return h.H.useHostTransitionStatus()},zt.version="19.2.3",zt}var p0;function Cb(){if(p0)return Zh.exports;p0=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Zh.exports=mE(),Zh.exports}var g0;function pE(){if(g0)return To;g0=1;var n=fE(),e=Em(),a=Cb();function i(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function d(s){var r=s,o=s;if(s.alternate)for(;r.return;)r=r.return;else{s=r;do r=s,(r.flags&4098)!==0&&(o=r.return),s=r.return;while(s)}return r.tag===3?o:null}function h(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function m(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function p(s){if(d(s)!==s)throw Error(i(188))}function y(s){var r=s.alternate;if(!r){if(r=d(s),r===null)throw Error(i(188));return r!==s?null:s}for(var o=s,u=r;;){var f=o.return;if(f===null)break;var g=f.alternate;if(g===null){if(u=f.return,u!==null){o=u;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===o)return p(f),s;if(g===u)return p(f),r;g=g.sibling}throw Error(i(188))}if(o.return!==u.return)o=f,u=g;else{for(var b=!1,E=f.child;E;){if(E===o){b=!0,o=f,u=g;break}if(E===u){b=!0,u=f,o=g;break}E=E.sibling}if(!b){for(E=g.child;E;){if(E===o){b=!0,o=g,u=f;break}if(E===u){b=!0,u=g,o=f;break}E=E.sibling}if(!b)throw Error(i(189))}}if(o.alternate!==u)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?s:r}function v(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=v(s),r!==null)return r;s=s.sibling}return null}var x=Object.assign,w=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),k=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),be=Symbol.iterator;function de(s){return s===null||typeof s!="object"?null:(s=be&&s[be]||s["@@iterator"],typeof s=="function"?s:null)}var qe=Symbol.for("react.client.reference");function Be(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===qe?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case T:return"Fragment";case A:return"Profiler";case N:return"StrictMode";case F:return"Suspense";case K:return"SuspenseList";case Z:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case _:return"Portal";case k:return s.displayName||"Context";case M:return(s._context.displayName||"Context")+".Consumer";case U:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case P:return r=s.displayName||null,r!==null?r:Be(s.type)||"Memo";case z:r=s._payload,s=s._init;try{return Be(s(r))}catch{}}return null}var te=Array.isArray,R=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},he=[],_e=-1;function O(s){return{current:s}}function X(s){0>_e||(s.current=he[_e],he[_e]=null,_e--)}function Q(s,r){_e++,he[_e]=s.current,s.current=r}var se=O(null),we=O(null),je=O(null),ge=O(null);function ot(s,r){switch(Q(je,r),Q(we,s),Q(se,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?Rv(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=Rv(r),s=Ov(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}X(se),Q(se,s)}function Ue(){X(se),X(we),X(je)}function un(s){s.memoizedState!==null&&Q(ge,s);var r=se.current,o=Ov(r,s.type);r!==o&&(Q(we,s),Q(se,o))}function Gt(s){we.current===s&&(X(se),X(we)),ge.current===s&&(X(ge),wo._currentValue=I)}var Et,En;function Tn(s){if(Et===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);Et=r&&r[1]||"",En=-1<o.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Et+s+En}var la=!1;function ar(s,r){if(!s||la)return"";la=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(G){var H=G}Reflect.construct(s,[],J)}else{try{J.call()}catch(G){H=G}s.call(J.prototype)}}else{try{throw Error()}catch(G){H=G}(J=s())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(G){if(G&&H&&typeof G.stack=="string")return[G.stack,H.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=u.DetermineComponentFrameRoot(),b=g[0],E=g[1];if(b&&E){var C=b.split(`
4
- `),B=E.split(`
5
- `);for(f=u=0;u<C.length&&!C[u].includes("DetermineComponentFrameRoot");)u++;for(;f<B.length&&!B[f].includes("DetermineComponentFrameRoot");)f++;if(u===C.length||f===B.length)for(u=C.length-1,f=B.length-1;1<=u&&0<=f&&C[u]!==B[f];)f--;for(;1<=u&&0<=f;u--,f--)if(C[u]!==B[f]){if(u!==1||f!==1)do if(u--,f--,0>f||C[u]!==B[f]){var Y=`
6
- `+C[u].replace(" at new "," at ");return s.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",s.displayName)),Y}while(1<=u&&0<=f);break}}}finally{la=!1,Error.prepareStackTrace=o}return(o=s?s.displayName||s.name:"")?Tn(o):""}function ol(s,r){switch(s.tag){case 26:case 27:case 5:return Tn(s.type);case 16:return Tn("Lazy");case 13:return s.child!==r&&r!==null?Tn("Suspense Fallback"):Tn("Suspense");case 19:return Tn("SuspenseList");case 0:case 15:return ar(s.type,!1);case 11:return ar(s.type.render,!1);case 1:return ar(s.type,!0);case 31:return Tn("Activity");default:return""}}function Ai(s){try{var r="",o=null;do r+=ol(s,o),o=s,s=s.return;while(s);return r}catch(u){return`
7
- Error generating stack: `+u.message+`
8
- `+u.stack}}var rr=Object.prototype.hasOwnProperty,ir=n.unstable_scheduleCallback,or=n.unstable_cancelCallback,ll=n.unstable_shouldYield,cl=n.unstable_requestPaint,Tt=n.unstable_now,lr=n.unstable_getCurrentPriorityLevel,ki=n.unstable_ImmediatePriority,Ci=n.unstable_UserBlockingPriority,ca=n.unstable_NormalPriority,Kn=n.unstable_LowPriority,ul=n.unstable_IdlePriority,cr=n.log,dl=n.unstable_setDisableYieldValue,bs=null,Nt=null;function Yn(s){if(typeof cr=="function"&&dl(s),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(bs,s)}catch{}}var vt=Math.clz32?Math.clz32:Lu,hl=Math.log,zu=Math.LN2;function Lu(s){return s>>>=0,s===0?32:31-(hl(s)/zu|0)|0}var ur=256,Ri=262144,Oi=4194304;function Pt(s){var r=s&42;if(r!==0)return r;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ua(s,r,o){var u=s.pendingLanes;if(u===0)return 0;var f=0,g=s.suspendedLanes,b=s.pingedLanes;s=s.warmLanes;var E=u&134217727;return E!==0?(u=E&~g,u!==0?f=Pt(u):(b&=E,b!==0?f=Pt(b):o||(o=E&~s,o!==0&&(f=Pt(o))))):(E=u&~g,E!==0?f=Pt(E):b!==0?f=Pt(b):o||(o=u&~s,o!==0&&(f=Pt(o)))),f===0?0:r!==0&&r!==f&&(r&g)===0&&(g=f&-f,o=r&-r,g>=o||g===32&&(o&4194048)!==0)?r:f}function da(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Uu(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 fl(){var s=Oi;return Oi<<=1,(Oi&62914560)===0&&(Oi=4194304),s}function Di(s){for(var r=[],o=0;31>o;o++)r.push(s);return r}function ha(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Pu(s,r,o,u,f,g){var b=s.pendingLanes;s.pendingLanes=o,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=o,s.entangledLanes&=o,s.errorRecoveryDisabledLanes&=o,s.shellSuspendCounter=0;var E=s.entanglements,C=s.expirationTimes,B=s.hiddenUpdates;for(o=b&~o;0<o;){var Y=31-vt(o),J=1<<Y;E[Y]=0,C[Y]=-1;var H=B[Y];if(H!==null)for(B[Y]=null,Y=0;Y<H.length;Y++){var G=H[Y];G!==null&&(G.lane&=-536870913)}o&=~J}u!==0&&ml(s,u,0),g!==0&&f===0&&s.tag!==0&&(s.suspendedLanes|=g&~(b&~r))}function ml(s,r,o){s.pendingLanes|=r,s.suspendedLanes&=~r;var u=31-vt(r);s.entangledLanes|=r,s.entanglements[u]=s.entanglements[u]|1073741824|o&261930}function pl(s,r){var o=s.entangledLanes|=r;for(s=s.entanglements;o;){var u=31-vt(o),f=1<<u;f&r|s[u]&r&&(s[u]|=r),o&=~f}}function gl(s,r){var o=r&-r;return o=(o&42)!==0?1:Mi(o),(o&(s.suspendedLanes|r))!==0?0:o}function Mi(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function dr(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function yl(){var s=q.p;return s!==0?s:(s=window.event,s===void 0?32:t0(s.type))}function vl(s,r){var o=q.p;try{return q.p=s,r()}finally{q.p=o}}var Ln=Math.random().toString(36).slice(2),$="__reactFiber$"+Ln,ne="__reactProps$"+Ln,ke="__reactContainer$"+Ln,Vt="__reactEvents$"+Ln,Vu="__reactListeners$"+Ln,xl="__reactHandles$"+Ln,fa="__reactResources$"+Ln,ma="__reactMarker$"+Ln;function zi(s){delete s[$],delete s[ne],delete s[Vt],delete s[Vu],delete s[xl]}function hr(s){var r=s[$];if(r)return r;for(var o=s.parentNode;o;){if(r=o[ke]||o[$]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(s=Vv(s);s!==null;){if(o=s[$])return o;s=Vv(s)}return r}s=o,o=s.parentNode}return null}function fr(s){if(s=s[$]||s[ke]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function Li(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(i(33))}function mr(s){var r=s[fa];return r||(r=s[fa]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function _t(s){s[ma]=!0}var xp=new Set,bp={};function pa(s,r){pr(s,r),pr(s+"Capture",r)}function pr(s,r){for(bp[s]=r,s=0;s<r.length;s++)xp.add(r[s])}var QS=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]*$"),wp={},Sp={};function e_(s){return rr.call(Sp,s)?!0:rr.call(wp,s)?!1:QS.test(s)?Sp[s]=!0:(wp[s]=!0,!1)}function bl(s,r,o){if(e_(r))if(o===null)s.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,""+o)}}function wl(s,r,o){if(o===null)s.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,""+o)}}function Xn(s,r,o,u){if(u===null)s.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttributeNS(r,o,""+u)}}function dn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function _p(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function t_(s,r,o){var u=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var f=u.get,g=u.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return f.call(this)},set:function(b){o=""+b,g.call(this,b)}}),Object.defineProperty(s,r,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(b){o=""+b},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function Bu(s){if(!s._valueTracker){var r=_p(s)?"checked":"value";s._valueTracker=t_(s,r,""+s[r])}}function jp(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var o=r.getValue(),u="";return s&&(u=_p(s)?s.checked?"true":"false":s.value),s=u,s!==o?(r.setValue(s),!0):!1}function Sl(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var n_=/[\n"\\]/g;function hn(s){return s.replace(n_,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Iu(s,r,o,u,f,g,b,E){s.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?s.type=b:s.removeAttribute("type"),r!=null?b==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+dn(r)):s.value!==""+dn(r)&&(s.value=""+dn(r)):b!=="submit"&&b!=="reset"||s.removeAttribute("value"),r!=null?qu(s,b,dn(r)):o!=null?qu(s,b,dn(o)):u!=null&&s.removeAttribute("value"),f==null&&g!=null&&(s.defaultChecked=!!g),f!=null&&(s.checked=f&&typeof f!="function"&&typeof f!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?s.name=""+dn(E):s.removeAttribute("name")}function Ep(s,r,o,u,f,g,b,E){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),r!=null||o!=null){if(!(g!=="submit"&&g!=="reset"||r!=null)){Bu(s);return}o=o!=null?""+dn(o):"",r=r!=null?""+dn(r):o,E||r===s.value||(s.value=r),s.defaultValue=r}u=u??f,u=typeof u!="function"&&typeof u!="symbol"&&!!u,s.checked=E?s.checked:!!u,s.defaultChecked=!!u,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(s.name=b),Bu(s)}function qu(s,r,o){r==="number"&&Sl(s.ownerDocument)===s||s.defaultValue===""+o||(s.defaultValue=""+o)}function gr(s,r,o,u){if(s=s.options,r){r={};for(var f=0;f<o.length;f++)r["$"+o[f]]=!0;for(o=0;o<s.length;o++)f=r.hasOwnProperty("$"+s[o].value),s[o].selected!==f&&(s[o].selected=f),f&&u&&(s[o].defaultSelected=!0)}else{for(o=""+dn(o),r=null,f=0;f<s.length;f++){if(s[f].value===o){s[f].selected=!0,u&&(s[f].defaultSelected=!0);return}r!==null||s[f].disabled||(r=s[f])}r!==null&&(r.selected=!0)}}function Tp(s,r,o){if(r!=null&&(r=""+dn(r),r!==s.value&&(s.value=r),o==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=o!=null?""+dn(o):""}function Np(s,r,o,u){if(r==null){if(u!=null){if(o!=null)throw Error(i(92));if(te(u)){if(1<u.length)throw Error(i(93));u=u[0]}o=u}o==null&&(o=""),r=o}o=dn(r),s.defaultValue=o,u=s.textContent,u===o&&u!==""&&u!==null&&(s.value=u),Bu(s)}function yr(s,r){if(r){var o=s.firstChild;if(o&&o===s.lastChild&&o.nodeType===3){o.nodeValue=r;return}}s.textContent=r}var s_=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 Ap(s,r,o){var u=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":u?s.setProperty(r,o):typeof o!="number"||o===0||s_.has(r)?r==="float"?s.cssFloat=o:s[r]=(""+o).trim():s[r]=o+"px"}function kp(s,r,o){if(r!=null&&typeof r!="object")throw Error(i(62));if(s=s.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?s.setProperty(u,""):u==="float"?s.cssFloat="":s[u]="");for(var f in r)u=r[f],r.hasOwnProperty(f)&&o[f]!==u&&Ap(s,f,u)}else for(var g in r)r.hasOwnProperty(g)&&Ap(s,g,r[g])}function $u(s){if(s.indexOf("-")===-1)return!1;switch(s){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 a_=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"]]),r_=/^[\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 _l(s){return r_.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Wn(){}var Hu=null;function Gu(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var vr=null,xr=null;function Cp(s){var r=fr(s);if(r&&(s=r.stateNode)){var o=s[ne]||null;e:switch(s=r.stateNode,r.type){case"input":if(Iu(s,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=s;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+hn(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var u=o[r];if(u!==s&&u.form===s.form){var f=u[ne]||null;if(!f)throw Error(i(90));Iu(u,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<o.length;r++)u=o[r],u.form===s.form&&jp(u)}break e;case"textarea":Tp(s,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&gr(s,!!o.multiple,r,!1)}}}var Fu=!1;function Rp(s,r,o){if(Fu)return s(r,o);Fu=!0;try{var u=s(r);return u}finally{if(Fu=!1,(vr!==null||xr!==null)&&(uc(),vr&&(r=vr,s=xr,xr=vr=null,Cp(r),s)))for(r=0;r<s.length;r++)Cp(s[r])}}function Ui(s,r){var o=s.stateNode;if(o===null)return null;var u=o[ne]||null;if(u===null)return null;o=u[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(s=s.type,u=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!u;break e;default:s=!1}if(s)return null;if(o&&typeof o!="function")throw Error(i(231,r,typeof o));return o}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(Jn)try{var Pi={};Object.defineProperty(Pi,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",Pi,Pi),window.removeEventListener("test",Pi,Pi)}catch{Ku=!1}var ws=null,Yu=null,jl=null;function Op(){if(jl)return jl;var s,r=Yu,o=r.length,u,f="value"in ws?ws.value:ws.textContent,g=f.length;for(s=0;s<o&&r[s]===f[s];s++);var b=o-s;for(u=1;u<=b&&r[o-u]===f[g-u];u++);return jl=f.slice(s,1<u?1-u:void 0)}function El(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function Tl(){return!0}function Dp(){return!1}function Ft(s){function r(o,u,f,g,b){this._reactName=o,this._targetInst=f,this.type=u,this.nativeEvent=g,this.target=b,this.currentTarget=null;for(var E in s)s.hasOwnProperty(E)&&(o=s[E],this[E]=o?o(g):g[E]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Tl:Dp,this.isPropagationStopped=Dp,this}return x(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Tl)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Tl)},persist:function(){},isPersistent:Tl}),r}var ga={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nl=Ft(ga),Vi=x({},ga,{view:0,detail:0}),i_=Ft(Vi),Xu,Wu,Bi,Al=x({},Vi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zu,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Bi&&(Bi&&s.type==="mousemove"?(Xu=s.screenX-Bi.screenX,Wu=s.screenY-Bi.screenY):Wu=Xu=0,Bi=s),Xu)},movementY:function(s){return"movementY"in s?s.movementY:Wu}}),Mp=Ft(Al),o_=x({},Al,{dataTransfer:0}),l_=Ft(o_),c_=x({},Vi,{relatedTarget:0}),Ju=Ft(c_),u_=x({},ga,{animationName:0,elapsedTime:0,pseudoElement:0}),d_=Ft(u_),h_=x({},ga,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),f_=Ft(h_),m_=x({},ga,{data:0}),zp=Ft(m_),p_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g_={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"},y_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function v_(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=y_[s])?!!r[s]:!1}function Zu(){return v_}var x_=x({},Vi,{key:function(s){if(s.key){var r=p_[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=El(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?g_[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zu,charCode:function(s){return s.type==="keypress"?El(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?El(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),b_=Ft(x_),w_=x({},Al,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lp=Ft(w_),S_=x({},Vi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zu}),__=Ft(S_),j_=x({},ga,{propertyName:0,elapsedTime:0,pseudoElement:0}),E_=Ft(j_),T_=x({},Al,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),N_=Ft(T_),A_=x({},ga,{newState:0,oldState:0}),k_=Ft(A_),C_=[9,13,27,32],Qu=Jn&&"CompositionEvent"in window,Ii=null;Jn&&"documentMode"in document&&(Ii=document.documentMode);var R_=Jn&&"TextEvent"in window&&!Ii,Up=Jn&&(!Qu||Ii&&8<Ii&&11>=Ii),Pp=" ",Vp=!1;function Bp(s,r){switch(s){case"keyup":return C_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ip(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var br=!1;function O_(s,r){switch(s){case"compositionend":return Ip(r);case"keypress":return r.which!==32?null:(Vp=!0,Pp);case"textInput":return s=r.data,s===Pp&&Vp?null:s;default:return null}}function D_(s,r){if(br)return s==="compositionend"||!Qu&&Bp(s,r)?(s=Op(),jl=Yu=ws=null,br=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Up&&r.locale!=="ko"?null:r.data;default:return null}}var M_={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 qp(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!M_[s.type]:r==="textarea"}function $p(s,r,o,u){vr?xr?xr.push(u):xr=[u]:vr=u,r=yc(r,"onChange"),0<r.length&&(o=new Nl("onChange","change",null,o,u),s.push({event:o,listeners:r}))}var qi=null,$i=null;function z_(s){Ev(s,0)}function kl(s){var r=Li(s);if(jp(r))return s}function Hp(s,r){if(s==="change")return r}var Gp=!1;if(Jn){var ed;if(Jn){var td="oninput"in document;if(!td){var Fp=document.createElement("div");Fp.setAttribute("oninput","return;"),td=typeof Fp.oninput=="function"}ed=td}else ed=!1;Gp=ed&&(!document.documentMode||9<document.documentMode)}function Kp(){qi&&(qi.detachEvent("onpropertychange",Yp),$i=qi=null)}function Yp(s){if(s.propertyName==="value"&&kl($i)){var r=[];$p(r,$i,s,Gu(s)),Rp(z_,r)}}function L_(s,r,o){s==="focusin"?(Kp(),qi=r,$i=o,qi.attachEvent("onpropertychange",Yp)):s==="focusout"&&Kp()}function U_(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return kl($i)}function P_(s,r){if(s==="click")return kl(r)}function V_(s,r){if(s==="input"||s==="change")return kl(r)}function B_(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Qt=typeof Object.is=="function"?Object.is:B_;function Hi(s,r){if(Qt(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var o=Object.keys(s),u=Object.keys(r);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var f=o[u];if(!rr.call(r,f)||!Qt(s[f],r[f]))return!1}return!0}function Xp(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Wp(s,r){var o=Xp(s);s=0;for(var u;o;){if(o.nodeType===3){if(u=s+o.textContent.length,s<=r&&u>=r)return{node:o,offset:r-s};s=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Xp(o)}}function Jp(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?Jp(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Zp(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=Sl(s.document);r instanceof s.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)s=r.contentWindow;else break;r=Sl(s.document)}return r}function nd(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var I_=Jn&&"documentMode"in document&&11>=document.documentMode,wr=null,sd=null,Gi=null,ad=!1;function Qp(s,r,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;ad||wr==null||wr!==Sl(u)||(u=wr,"selectionStart"in u&&nd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Gi&&Hi(Gi,u)||(Gi=u,u=yc(sd,"onSelect"),0<u.length&&(r=new Nl("onSelect","select",null,r,o),s.push({event:r,listeners:u}),r.target=wr)))}function ya(s,r){var o={};return o[s.toLowerCase()]=r.toLowerCase(),o["Webkit"+s]="webkit"+r,o["Moz"+s]="moz"+r,o}var Sr={animationend:ya("Animation","AnimationEnd"),animationiteration:ya("Animation","AnimationIteration"),animationstart:ya("Animation","AnimationStart"),transitionrun:ya("Transition","TransitionRun"),transitionstart:ya("Transition","TransitionStart"),transitioncancel:ya("Transition","TransitionCancel"),transitionend:ya("Transition","TransitionEnd")},rd={},eg={};Jn&&(eg=document.createElement("div").style,"AnimationEvent"in window||(delete Sr.animationend.animation,delete Sr.animationiteration.animation,delete Sr.animationstart.animation),"TransitionEvent"in window||delete Sr.transitionend.transition);function va(s){if(rd[s])return rd[s];if(!Sr[s])return s;var r=Sr[s],o;for(o in r)if(r.hasOwnProperty(o)&&o in eg)return rd[s]=r[o];return s}var tg=va("animationend"),ng=va("animationiteration"),sg=va("animationstart"),q_=va("transitionrun"),$_=va("transitionstart"),H_=va("transitioncancel"),ag=va("transitionend"),rg=new Map,id="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(" ");id.push("scrollEnd");function Nn(s,r){rg.set(s,r),pa(r,[s])}var Cl=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},fn=[],_r=0,od=0;function Rl(){for(var s=_r,r=od=_r=0;r<s;){var o=fn[r];fn[r++]=null;var u=fn[r];fn[r++]=null;var f=fn[r];fn[r++]=null;var g=fn[r];if(fn[r++]=null,u!==null&&f!==null){var b=u.pending;b===null?f.next=f:(f.next=b.next,b.next=f),u.pending=f}g!==0&&ig(o,f,g)}}function Ol(s,r,o,u){fn[_r++]=s,fn[_r++]=r,fn[_r++]=o,fn[_r++]=u,od|=u,s.lanes|=u,s=s.alternate,s!==null&&(s.lanes|=u)}function ld(s,r,o,u){return Ol(s,r,o,u),Dl(s)}function xa(s,r){return Ol(s,null,null,r),Dl(s)}function ig(s,r,o){s.lanes|=o;var u=s.alternate;u!==null&&(u.lanes|=o);for(var f=!1,g=s.return;g!==null;)g.childLanes|=o,u=g.alternate,u!==null&&(u.childLanes|=o),g.tag===22&&(s=g.stateNode,s===null||s._visibility&1||(f=!0)),s=g,g=g.return;return s.tag===3?(g=s.stateNode,f&&r!==null&&(f=31-vt(o),s=g.hiddenUpdates,u=s[f],u===null?s[f]=[r]:u.push(r),r.lane=o|536870912),g):null}function Dl(s){if(50<mo)throw mo=0,yh=null,Error(i(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var jr={};function G_(s,r,o,u){this.tag=s,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(s,r,o,u){return new G_(s,r,o,u)}function cd(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Zn(s,r){var o=s.alternate;return o===null?(o=en(s.tag,r,s.key,s.mode),o.elementType=s.elementType,o.type=s.type,o.stateNode=s.stateNode,o.alternate=s,s.alternate=o):(o.pendingProps=r,o.type=s.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=s.flags&65011712,o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,r=s.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=s.sibling,o.index=s.index,o.ref=s.ref,o.refCleanup=s.refCleanup,o}function og(s,r){s.flags&=65011714;var o=s.alternate;return o===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,r=o.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Ml(s,r,o,u,f,g){var b=0;if(u=s,typeof s=="function")cd(s)&&(b=1);else if(typeof s=="string")b=Wj(s,o,se.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Z:return s=en(31,o,r,f),s.elementType=Z,s.lanes=g,s;case T:return ba(o.children,f,g,r);case N:b=8,f|=24;break;case A:return s=en(12,o,r,f|2),s.elementType=A,s.lanes=g,s;case F:return s=en(13,o,r,f),s.elementType=F,s.lanes=g,s;case K:return s=en(19,o,r,f),s.elementType=K,s.lanes=g,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case k:b=10;break e;case M:b=9;break e;case U:b=11;break e;case P:b=14;break e;case z:b=16,u=null;break e}b=29,o=Error(i(130,s===null?"null":typeof s,"")),u=null}return r=en(b,o,r,f),r.elementType=s,r.type=u,r.lanes=g,r}function ba(s,r,o,u){return s=en(7,s,u,r),s.lanes=o,s}function ud(s,r,o){return s=en(6,s,null,r),s.lanes=o,s}function lg(s){var r=en(18,null,null,0);return r.stateNode=s,r}function dd(s,r,o){return r=en(4,s.children!==null?s.children:[],s.key,r),r.lanes=o,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var cg=new WeakMap;function mn(s,r){if(typeof s=="object"&&s!==null){var o=cg.get(s);return o!==void 0?o:(r={value:s,source:r,stack:Ai(r)},cg.set(s,r),r)}return{value:s,source:r,stack:Ai(r)}}var Er=[],Tr=0,zl=null,Fi=0,pn=[],gn=0,Ss=null,Un=1,Pn="";function Qn(s,r){Er[Tr++]=Fi,Er[Tr++]=zl,zl=s,Fi=r}function ug(s,r,o){pn[gn++]=Un,pn[gn++]=Pn,pn[gn++]=Ss,Ss=s;var u=Un;s=Pn;var f=32-vt(u)-1;u&=~(1<<f),o+=1;var g=32-vt(r)+f;if(30<g){var b=f-f%5;g=(u&(1<<b)-1).toString(32),u>>=b,f-=b,Un=1<<32-vt(r)+f|o<<f|u,Pn=g+s}else Un=1<<g|o<<f|u,Pn=s}function hd(s){s.return!==null&&(Qn(s,1),ug(s,1,0))}function fd(s){for(;s===zl;)zl=Er[--Tr],Er[Tr]=null,Fi=Er[--Tr],Er[Tr]=null;for(;s===Ss;)Ss=pn[--gn],pn[gn]=null,Pn=pn[--gn],pn[gn]=null,Un=pn[--gn],pn[gn]=null}function dg(s,r){pn[gn++]=Un,pn[gn++]=Pn,pn[gn++]=Ss,Un=r.id,Pn=r.overflow,Ss=s}var At=null,We=null,Le=!1,_s=null,yn=!1,md=Error(i(519));function js(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ki(mn(r,s)),md}function hg(s){var r=s.stateNode,o=s.type,u=s.memoizedProps;switch(r[$]=s,r[ne]=u,o){case"dialog":Oe("cancel",r),Oe("close",r);break;case"iframe":case"object":case"embed":Oe("load",r);break;case"video":case"audio":for(o=0;o<go.length;o++)Oe(go[o],r);break;case"source":Oe("error",r);break;case"img":case"image":case"link":Oe("error",r),Oe("load",r);break;case"details":Oe("toggle",r);break;case"input":Oe("invalid",r),Ep(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Oe("invalid",r);break;case"textarea":Oe("invalid",r),Np(r,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||u.suppressHydrationWarning===!0||kv(r.textContent,o)?(u.popover!=null&&(Oe("beforetoggle",r),Oe("toggle",r)),u.onScroll!=null&&Oe("scroll",r),u.onScrollEnd!=null&&Oe("scrollend",r),u.onClick!=null&&(r.onclick=Wn),r=!0):r=!1,r||js(s,!0)}function fg(s){for(At=s.return;At;)switch(At.tag){case 5:case 31:case 13:yn=!1;return;case 27:case 3:yn=!0;return;default:At=At.return}}function Nr(s){if(s!==At)return!1;if(!Le)return fg(s),Le=!0,!1;var r=s.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=s.type,o=!(o!=="form"&&o!=="button")||Oh(s.type,s.memoizedProps)),o=!o),o&&We&&js(s),fg(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));We=Pv(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));We=Pv(s)}else r===27?(r=We,Ps(s.type)?(s=Uh,Uh=null,We=s):We=r):We=At?xn(s.stateNode.nextSibling):null;return!0}function wa(){We=At=null,Le=!1}function pd(){var s=_s;return s!==null&&(Wt===null?Wt=s:Wt.push.apply(Wt,s),_s=null),s}function Ki(s){_s===null?_s=[s]:_s.push(s)}var gd=O(null),Sa=null,es=null;function Es(s,r,o){Q(gd,r._currentValue),r._currentValue=o}function ts(s){s._currentValue=gd.current,X(gd)}function yd(s,r,o){for(;s!==null;){var u=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),s===o)break;s=s.return}}function vd(s,r,o,u){var f=s.child;for(f!==null&&(f.return=s);f!==null;){var g=f.dependencies;if(g!==null){var b=f.child;g=g.firstContext;e:for(;g!==null;){var E=g;g=f;for(var C=0;C<r.length;C++)if(E.context===r[C]){g.lanes|=o,E=g.alternate,E!==null&&(E.lanes|=o),yd(g.return,o,s),u||(b=null);break e}g=E.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(i(341));b.lanes|=o,g=b.alternate,g!==null&&(g.lanes|=o),yd(b,o,s),b=null}else b=f.child;if(b!==null)b.return=f;else for(b=f;b!==null;){if(b===s){b=null;break}if(f=b.sibling,f!==null){f.return=b.return,b=f;break}b=b.return}f=b}}function Ar(s,r,o,u){s=null;for(var f=r,g=!1;f!==null;){if(!g){if((f.flags&524288)!==0)g=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var b=f.alternate;if(b===null)throw Error(i(387));if(b=b.memoizedProps,b!==null){var E=f.type;Qt(f.pendingProps.value,b.value)||(s!==null?s.push(E):s=[E])}}else if(f===ge.current){if(b=f.alternate,b===null)throw Error(i(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(s!==null?s.push(wo):s=[wo])}f=f.return}s!==null&&vd(r,s,o,u),r.flags|=262144}function Ll(s){for(s=s.firstContext;s!==null;){if(!Qt(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function _a(s){Sa=s,es=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function kt(s){return mg(Sa,s)}function Ul(s,r){return Sa===null&&_a(s),mg(s,r)}function mg(s,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},es===null){if(s===null)throw Error(i(308));es=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else es=es.next=r;return o}var F_=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(o,u){s.push(u)}};this.abort=function(){r.aborted=!0,s.forEach(function(o){return o()})}},K_=n.unstable_scheduleCallback,Y_=n.unstable_NormalPriority,ut={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xd(){return{controller:new F_,data:new Map,refCount:0}}function Yi(s){s.refCount--,s.refCount===0&&K_(Y_,function(){s.controller.abort()})}var Xi=null,bd=0,kr=0,Cr=null;function X_(s,r){if(Xi===null){var o=Xi=[];bd=0,kr=_h(),Cr={status:"pending",value:void 0,then:function(u){o.push(u)}}}return bd++,r.then(pg,pg),r}function pg(){if(--bd===0&&Xi!==null){Cr!==null&&(Cr.status="fulfilled");var s=Xi;Xi=null,kr=0,Cr=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function W_(s,r){var o=[],u={status:"pending",value:null,reason:null,then:function(f){o.push(f)}};return s.then(function(){u.status="fulfilled",u.value=r;for(var f=0;f<o.length;f++)(0,o[f])(r)},function(f){for(u.status="rejected",u.reason=f,f=0;f<o.length;f++)(0,o[f])(void 0)}),u}var gg=R.S;R.S=function(s,r){Qy=Tt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&X_(s,r),gg!==null&&gg(s,r)};var ja=O(null);function wd(){var s=ja.current;return s!==null?s:Ye.pooledCache}function Pl(s,r){r===null?Q(ja,ja.current):Q(ja,r.pool)}function yg(){var s=wd();return s===null?null:{parent:ut._currentValue,pool:s}}var Rr=Error(i(460)),Sd=Error(i(474)),Vl=Error(i(542)),Bl={then:function(){}};function vg(s){return s=s.status,s==="fulfilled"||s==="rejected"}function xg(s,r,o){switch(o=s[o],o===void 0?s.push(r):o!==r&&(r.then(Wn,Wn),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,wg(s),s;default:if(typeof r.status=="string")r.then(Wn,Wn);else{if(s=Ye,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=r,s.status="pending",s.then(function(u){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=u}},function(u){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,wg(s),s}throw Ta=r,Rr}}function Ea(s){try{var r=s._init;return r(s._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Ta=o,Rr):o}}var Ta=null;function bg(){if(Ta===null)throw Error(i(459));var s=Ta;return Ta=null,s}function wg(s){if(s===Rr||s===Vl)throw Error(i(483))}var Or=null,Wi=0;function Il(s){var r=Wi;return Wi+=1,Or===null&&(Or=[]),xg(Or,s,r)}function Ji(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function ql(s,r){throw r.$$typeof===w?Error(i(525)):(s=Object.prototype.toString.call(r),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function Sg(s){function r(L,D){if(s){var V=L.deletions;V===null?(L.deletions=[D],L.flags|=16):V.push(D)}}function o(L,D){if(!s)return null;for(;D!==null;)r(L,D),D=D.sibling;return null}function u(L){for(var D=new Map;L!==null;)L.key!==null?D.set(L.key,L):D.set(L.index,L),L=L.sibling;return D}function f(L,D){return L=Zn(L,D),L.index=0,L.sibling=null,L}function g(L,D,V){return L.index=V,s?(V=L.alternate,V!==null?(V=V.index,V<D?(L.flags|=67108866,D):V):(L.flags|=67108866,D)):(L.flags|=1048576,D)}function b(L){return s&&L.alternate===null&&(L.flags|=67108866),L}function E(L,D,V,W){return D===null||D.tag!==6?(D=ud(V,L.mode,W),D.return=L,D):(D=f(D,V),D.return=L,D)}function C(L,D,V,W){var pe=V.type;return pe===T?Y(L,D,V.props.children,W,V.key):D!==null&&(D.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===z&&Ea(pe)===D.type)?(D=f(D,V.props),Ji(D,V),D.return=L,D):(D=Ml(V.type,V.key,V.props,null,L.mode,W),Ji(D,V),D.return=L,D)}function B(L,D,V,W){return D===null||D.tag!==4||D.stateNode.containerInfo!==V.containerInfo||D.stateNode.implementation!==V.implementation?(D=dd(V,L.mode,W),D.return=L,D):(D=f(D,V.children||[]),D.return=L,D)}function Y(L,D,V,W,pe){return D===null||D.tag!==7?(D=ba(V,L.mode,W,pe),D.return=L,D):(D=f(D,V),D.return=L,D)}function J(L,D,V){if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return D=ud(""+D,L.mode,V),D.return=L,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case j:return V=Ml(D.type,D.key,D.props,null,L.mode,V),Ji(V,D),V.return=L,V;case _:return D=dd(D,L.mode,V),D.return=L,D;case z:return D=Ea(D),J(L,D,V)}if(te(D)||de(D))return D=ba(D,L.mode,V,null),D.return=L,D;if(typeof D.then=="function")return J(L,Il(D),V);if(D.$$typeof===k)return J(L,Ul(L,D),V);ql(L,D)}return null}function H(L,D,V,W){var pe=D!==null?D.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return pe!==null?null:E(L,D,""+V,W);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case j:return V.key===pe?C(L,D,V,W):null;case _:return V.key===pe?B(L,D,V,W):null;case z:return V=Ea(V),H(L,D,V,W)}if(te(V)||de(V))return pe!==null?null:Y(L,D,V,W,null);if(typeof V.then=="function")return H(L,D,Il(V),W);if(V.$$typeof===k)return H(L,D,Ul(L,V),W);ql(L,V)}return null}function G(L,D,V,W,pe){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return L=L.get(V)||null,E(D,L,""+W,pe);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case j:return L=L.get(W.key===null?V:W.key)||null,C(D,L,W,pe);case _:return L=L.get(W.key===null?V:W.key)||null,B(D,L,W,pe);case z:return W=Ea(W),G(L,D,V,W,pe)}if(te(W)||de(W))return L=L.get(V)||null,Y(D,L,W,pe,null);if(typeof W.then=="function")return G(L,D,V,Il(W),pe);if(W.$$typeof===k)return G(L,D,V,Ul(D,W),pe);ql(D,W)}return null}function oe(L,D,V,W){for(var pe=null,Pe=null,fe=D,Ne=D=0,Me=null;fe!==null&&Ne<V.length;Ne++){fe.index>Ne?(Me=fe,fe=null):Me=fe.sibling;var Ve=H(L,fe,V[Ne],W);if(Ve===null){fe===null&&(fe=Me);break}s&&fe&&Ve.alternate===null&&r(L,fe),D=g(Ve,D,Ne),Pe===null?pe=Ve:Pe.sibling=Ve,Pe=Ve,fe=Me}if(Ne===V.length)return o(L,fe),Le&&Qn(L,Ne),pe;if(fe===null){for(;Ne<V.length;Ne++)fe=J(L,V[Ne],W),fe!==null&&(D=g(fe,D,Ne),Pe===null?pe=fe:Pe.sibling=fe,Pe=fe);return Le&&Qn(L,Ne),pe}for(fe=u(fe);Ne<V.length;Ne++)Me=G(fe,L,Ne,V[Ne],W),Me!==null&&(s&&Me.alternate!==null&&fe.delete(Me.key===null?Ne:Me.key),D=g(Me,D,Ne),Pe===null?pe=Me:Pe.sibling=Me,Pe=Me);return s&&fe.forEach(function($s){return r(L,$s)}),Le&&Qn(L,Ne),pe}function ye(L,D,V,W){if(V==null)throw Error(i(151));for(var pe=null,Pe=null,fe=D,Ne=D=0,Me=null,Ve=V.next();fe!==null&&!Ve.done;Ne++,Ve=V.next()){fe.index>Ne?(Me=fe,fe=null):Me=fe.sibling;var $s=H(L,fe,Ve.value,W);if($s===null){fe===null&&(fe=Me);break}s&&fe&&$s.alternate===null&&r(L,fe),D=g($s,D,Ne),Pe===null?pe=$s:Pe.sibling=$s,Pe=$s,fe=Me}if(Ve.done)return o(L,fe),Le&&Qn(L,Ne),pe;if(fe===null){for(;!Ve.done;Ne++,Ve=V.next())Ve=J(L,Ve.value,W),Ve!==null&&(D=g(Ve,D,Ne),Pe===null?pe=Ve:Pe.sibling=Ve,Pe=Ve);return Le&&Qn(L,Ne),pe}for(fe=u(fe);!Ve.done;Ne++,Ve=V.next())Ve=G(fe,L,Ne,Ve.value,W),Ve!==null&&(s&&Ve.alternate!==null&&fe.delete(Ve.key===null?Ne:Ve.key),D=g(Ve,D,Ne),Pe===null?pe=Ve:Pe.sibling=Ve,Pe=Ve);return s&&fe.forEach(function(oE){return r(L,oE)}),Le&&Qn(L,Ne),pe}function Ke(L,D,V,W){if(typeof V=="object"&&V!==null&&V.type===T&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case j:e:{for(var pe=V.key;D!==null;){if(D.key===pe){if(pe=V.type,pe===T){if(D.tag===7){o(L,D.sibling),W=f(D,V.props.children),W.return=L,L=W;break e}}else if(D.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===z&&Ea(pe)===D.type){o(L,D.sibling),W=f(D,V.props),Ji(W,V),W.return=L,L=W;break e}o(L,D);break}else r(L,D);D=D.sibling}V.type===T?(W=ba(V.props.children,L.mode,W,V.key),W.return=L,L=W):(W=Ml(V.type,V.key,V.props,null,L.mode,W),Ji(W,V),W.return=L,L=W)}return b(L);case _:e:{for(pe=V.key;D!==null;){if(D.key===pe)if(D.tag===4&&D.stateNode.containerInfo===V.containerInfo&&D.stateNode.implementation===V.implementation){o(L,D.sibling),W=f(D,V.children||[]),W.return=L,L=W;break e}else{o(L,D);break}else r(L,D);D=D.sibling}W=dd(V,L.mode,W),W.return=L,L=W}return b(L);case z:return V=Ea(V),Ke(L,D,V,W)}if(te(V))return oe(L,D,V,W);if(de(V)){if(pe=de(V),typeof pe!="function")throw Error(i(150));return V=pe.call(V),ye(L,D,V,W)}if(typeof V.then=="function")return Ke(L,D,Il(V),W);if(V.$$typeof===k)return Ke(L,D,Ul(L,V),W);ql(L,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,D!==null&&D.tag===6?(o(L,D.sibling),W=f(D,V),W.return=L,L=W):(o(L,D),W=ud(V,L.mode,W),W.return=L,L=W),b(L)):o(L,D)}return function(L,D,V,W){try{Wi=0;var pe=Ke(L,D,V,W);return Or=null,pe}catch(fe){if(fe===Rr||fe===Vl)throw fe;var Pe=en(29,fe,null,L.mode);return Pe.lanes=W,Pe.return=L,Pe}}}var Na=Sg(!0),_g=Sg(!1),Ts=!1;function _d(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jd(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Ns(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function As(s,r,o){var u=s.updateQueue;if(u===null)return null;if(u=u.shared,(Ie&2)!==0){var f=u.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),u.pending=r,r=Dl(s),ig(s,null,o),r}return Ol(s,u,r,o),Dl(s)}function Zi(s,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var u=r.lanes;u&=s.pendingLanes,o|=u,r.lanes=o,pl(s,o)}}function Ed(s,r){var o=s.updateQueue,u=s.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var f=null,g=null;if(o=o.firstBaseUpdate,o!==null){do{var b={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};g===null?f=g=b:g=g.next=b,o=o.next}while(o!==null);g===null?f=g=r:g=g.next=r}else f=g=r;o={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:u.shared,callbacks:u.callbacks},s.updateQueue=o;return}s=o.lastBaseUpdate,s===null?o.firstBaseUpdate=r:s.next=r,o.lastBaseUpdate=r}var Td=!1;function Qi(){if(Td){var s=Cr;if(s!==null)throw s}}function eo(s,r,o,u){Td=!1;var f=s.updateQueue;Ts=!1;var g=f.firstBaseUpdate,b=f.lastBaseUpdate,E=f.shared.pending;if(E!==null){f.shared.pending=null;var C=E,B=C.next;C.next=null,b===null?g=B:b.next=B,b=C;var Y=s.alternate;Y!==null&&(Y=Y.updateQueue,E=Y.lastBaseUpdate,E!==b&&(E===null?Y.firstBaseUpdate=B:E.next=B,Y.lastBaseUpdate=C))}if(g!==null){var J=f.baseState;b=0,Y=B=C=null,E=g;do{var H=E.lane&-536870913,G=H!==E.lane;if(G?(De&H)===H:(u&H)===H){H!==0&&H===kr&&(Td=!0),Y!==null&&(Y=Y.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var oe=s,ye=E;H=r;var Ke=o;switch(ye.tag){case 1:if(oe=ye.payload,typeof oe=="function"){J=oe.call(Ke,J,H);break e}J=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=ye.payload,H=typeof oe=="function"?oe.call(Ke,J,H):oe,H==null)break e;J=x({},J,H);break e;case 2:Ts=!0}}H=E.callback,H!==null&&(s.flags|=64,G&&(s.flags|=8192),G=f.callbacks,G===null?f.callbacks=[H]:G.push(H))}else G={lane:H,tag:E.tag,payload:E.payload,callback:E.callback,next:null},Y===null?(B=Y=G,C=J):Y=Y.next=G,b|=H;if(E=E.next,E===null){if(E=f.shared.pending,E===null)break;G=E,E=G.next,G.next=null,f.lastBaseUpdate=G,f.shared.pending=null}}while(!0);Y===null&&(C=J),f.baseState=C,f.firstBaseUpdate=B,f.lastBaseUpdate=Y,g===null&&(f.shared.lanes=0),Ds|=b,s.lanes=b,s.memoizedState=J}}function jg(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function Eg(s,r){var o=s.callbacks;if(o!==null)for(s.callbacks=null,s=0;s<o.length;s++)jg(o[s],r)}var Dr=O(null),$l=O(0);function Tg(s,r){s=us,Q($l,s),Q(Dr,r),us=s|r.baseLanes}function Nd(){Q($l,us),Q(Dr,Dr.current)}function Ad(){us=$l.current,X(Dr),X($l)}var tn=O(null),vn=null;function ks(s){var r=s.alternate;Q(lt,lt.current&1),Q(tn,s),vn===null&&(r===null||Dr.current!==null||r.memoizedState!==null)&&(vn=s)}function kd(s){Q(lt,lt.current),Q(tn,s),vn===null&&(vn=s)}function Ng(s){s.tag===22?(Q(lt,lt.current),Q(tn,s),vn===null&&(vn=s)):Cs()}function Cs(){Q(lt,lt.current),Q(tn,tn.current)}function nn(s){X(tn),vn===s&&(vn=null),X(lt)}var lt=O(0);function Hl(s){for(var r=s;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||zh(o)||Lh(o)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var ns=0,Te=null,Ge=null,dt=null,Gl=!1,Mr=!1,Aa=!1,Fl=0,to=0,zr=null,J_=0;function st(){throw Error(i(321))}function Cd(s,r){if(r===null)return!1;for(var o=0;o<r.length&&o<s.length;o++)if(!Qt(s[o],r[o]))return!1;return!0}function Rd(s,r,o,u,f,g){return ns=g,Te=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,R.H=s===null||s.memoizedState===null?uy:Fd,Aa=!1,g=o(u,f),Aa=!1,Mr&&(g=kg(r,o,u,f)),Ag(s),g}function Ag(s){R.H=ao;var r=Ge!==null&&Ge.next!==null;if(ns=0,dt=Ge=Te=null,Gl=!1,to=0,zr=null,r)throw Error(i(300));s===null||ht||(s=s.dependencies,s!==null&&Ll(s)&&(ht=!0))}function kg(s,r,o,u){Te=s;var f=0;do{if(Mr&&(zr=null),to=0,Mr=!1,25<=f)throw Error(i(301));if(f+=1,dt=Ge=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}R.H=dy,g=r(o,u)}while(Mr);return g}function Z_(){var s=R.H,r=s.useState()[0];return r=typeof r.then=="function"?no(r):r,s=s.useState()[0],(Ge!==null?Ge.memoizedState:null)!==s&&(Te.flags|=1024),r}function Od(){var s=Fl!==0;return Fl=0,s}function Dd(s,r,o){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~o}function Md(s){if(Gl){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Gl=!1}ns=0,dt=Ge=Te=null,Mr=!1,to=Fl=0,zr=null}function Bt(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Te.memoizedState=dt=s:dt=dt.next=s,dt}function ct(){if(Ge===null){var s=Te.alternate;s=s!==null?s.memoizedState:null}else s=Ge.next;var r=dt===null?Te.memoizedState:dt.next;if(r!==null)dt=r,Ge=s;else{if(s===null)throw Te.alternate===null?Error(i(467)):Error(i(310));Ge=s,s={memoizedState:Ge.memoizedState,baseState:Ge.baseState,baseQueue:Ge.baseQueue,queue:Ge.queue,next:null},dt===null?Te.memoizedState=dt=s:dt=dt.next=s}return dt}function Kl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function no(s){var r=to;return to+=1,zr===null&&(zr=[]),s=xg(zr,s,r),r=Te,(dt===null?r.memoizedState:dt.next)===null&&(r=r.alternate,R.H=r===null||r.memoizedState===null?uy:Fd),s}function Yl(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return no(s);if(s.$$typeof===k)return kt(s)}throw Error(i(438,String(s)))}function zd(s){var r=null,o=Te.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var u=Te.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=Kl(),Te.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(s),u=0;u<s;u++)o[u]=ie;return r.index++,o}function ss(s,r){return typeof r=="function"?r(s):r}function Xl(s){var r=ct();return Ld(r,Ge,s)}function Ld(s,r,o){var u=s.queue;if(u===null)throw Error(i(311));u.lastRenderedReducer=o;var f=s.baseQueue,g=u.pending;if(g!==null){if(f!==null){var b=f.next;f.next=g.next,g.next=b}r.baseQueue=f=g,u.pending=null}if(g=s.baseState,f===null)s.memoizedState=g;else{r=f.next;var E=b=null,C=null,B=r,Y=!1;do{var J=B.lane&-536870913;if(J!==B.lane?(De&J)===J:(ns&J)===J){var H=B.revertLane;if(H===0)C!==null&&(C=C.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),J===kr&&(Y=!0);else if((ns&H)===H){B=B.next,H===kr&&(Y=!0);continue}else J={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},C===null?(E=C=J,b=g):C=C.next=J,Te.lanes|=H,Ds|=H;J=B.action,Aa&&o(g,J),g=B.hasEagerState?B.eagerState:o(g,J)}else H={lane:J,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},C===null?(E=C=H,b=g):C=C.next=H,Te.lanes|=J,Ds|=J;B=B.next}while(B!==null&&B!==r);if(C===null?b=g:C.next=E,!Qt(g,s.memoizedState)&&(ht=!0,Y&&(o=Cr,o!==null)))throw o;s.memoizedState=g,s.baseState=b,s.baseQueue=C,u.lastRenderedState=g}return f===null&&(u.lanes=0),[s.memoizedState,u.dispatch]}function Ud(s){var r=ct(),o=r.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=s;var u=o.dispatch,f=o.pending,g=r.memoizedState;if(f!==null){o.pending=null;var b=f=f.next;do g=s(g,b.action),b=b.next;while(b!==f);Qt(g,r.memoizedState)||(ht=!0),r.memoizedState=g,r.baseQueue===null&&(r.baseState=g),o.lastRenderedState=g}return[g,u]}function Cg(s,r,o){var u=Te,f=ct(),g=Le;if(g){if(o===void 0)throw Error(i(407));o=o()}else o=r();var b=!Qt((Ge||f).memoizedState,o);if(b&&(f.memoizedState=o,ht=!0),f=f.queue,Bd(Dg.bind(null,u,f,s),[s]),f.getSnapshot!==r||b||dt!==null&&dt.memoizedState.tag&1){if(u.flags|=2048,Lr(9,{destroy:void 0},Og.bind(null,u,f,o,r),null),Ye===null)throw Error(i(349));g||(ns&127)!==0||Rg(u,r,o)}return o}function Rg(s,r,o){s.flags|=16384,s={getSnapshot:r,value:o},r=Te.updateQueue,r===null?(r=Kl(),Te.updateQueue=r,r.stores=[s]):(o=r.stores,o===null?r.stores=[s]:o.push(s))}function Og(s,r,o,u){r.value=o,r.getSnapshot=u,Mg(r)&&zg(s)}function Dg(s,r,o){return o(function(){Mg(r)&&zg(s)})}function Mg(s){var r=s.getSnapshot;s=s.value;try{var o=r();return!Qt(s,o)}catch{return!0}}function zg(s){var r=xa(s,2);r!==null&&Jt(r,s,2)}function Pd(s){var r=Bt();if(typeof s=="function"){var o=s;if(s=o(),Aa){Yn(!0);try{o()}finally{Yn(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:s},r}function Lg(s,r,o,u){return s.baseState=o,Ld(s,Ge,typeof u=="function"?u:ss)}function Q_(s,r,o,u,f){if(Zl(s))throw Error(i(485));if(s=r.action,s!==null){var g={payload:f,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){g.listeners.push(b)}};R.T!==null?o(!0):g.isTransition=!1,u(g),o=r.pending,o===null?(g.next=r.pending=g,Ug(r,g)):(g.next=o.next,r.pending=o.next=g)}}function Ug(s,r){var o=r.action,u=r.payload,f=s.state;if(r.isTransition){var g=R.T,b={};R.T=b;try{var E=o(f,u),C=R.S;C!==null&&C(b,E),Pg(s,r,E)}catch(B){Vd(s,r,B)}finally{g!==null&&b.types!==null&&(g.types=b.types),R.T=g}}else try{g=o(f,u),Pg(s,r,g)}catch(B){Vd(s,r,B)}}function Pg(s,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){Vg(s,r,u)},function(u){return Vd(s,r,u)}):Vg(s,r,o)}function Vg(s,r,o){r.status="fulfilled",r.value=o,Bg(r),s.state=o,r=s.pending,r!==null&&(o=r.next,o===r?s.pending=null:(o=o.next,r.next=o,Ug(s,o)))}function Vd(s,r,o){var u=s.pending;if(s.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=o,Bg(r),r=r.next;while(r!==u)}s.action=null}function Bg(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function Ig(s,r){return r}function qg(s,r){if(Le){var o=Ye.formState;if(o!==null){e:{var u=Te;if(Le){if(We){t:{for(var f=We,g=yn;f.nodeType!==8;){if(!g){f=null;break t}if(f=xn(f.nextSibling),f===null){f=null;break t}}g=f.data,f=g==="F!"||g==="F"?f:null}if(f){We=xn(f.nextSibling),u=f.data==="F!";break e}}js(u)}u=!1}u&&(r=o[0])}}return o=Bt(),o.memoizedState=o.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ig,lastRenderedState:r},o.queue=u,o=oy.bind(null,Te,u),u.dispatch=o,u=Pd(!1),g=Gd.bind(null,Te,!1,u.queue),u=Bt(),f={state:r,dispatch:null,action:s,pending:null},u.queue=f,o=Q_.bind(null,Te,f,g,o),f.dispatch=o,u.memoizedState=s,[r,o,!1]}function $g(s){var r=ct();return Hg(r,Ge,s)}function Hg(s,r,o){if(r=Ld(s,r,Ig)[0],s=Xl(ss)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=no(r)}catch(b){throw b===Rr?Vl:b}else u=r;r=ct();var f=r.queue,g=f.dispatch;return o!==r.memoizedState&&(Te.flags|=2048,Lr(9,{destroy:void 0},ej.bind(null,f,o),null)),[u,g,s]}function ej(s,r){s.action=r}function Gg(s){var r=ct(),o=Ge;if(o!==null)return Hg(r,o,s);ct(),r=r.memoizedState,o=ct();var u=o.queue.dispatch;return o.memoizedState=s,[r,u,!1]}function Lr(s,r,o,u){return s={tag:s,create:o,deps:u,inst:r,next:null},r=Te.updateQueue,r===null&&(r=Kl(),Te.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=s.next=s:(u=o.next,o.next=s,s.next=u,r.lastEffect=s),s}function Fg(){return ct().memoizedState}function Wl(s,r,o,u){var f=Bt();Te.flags|=s,f.memoizedState=Lr(1|r,{destroy:void 0},o,u===void 0?null:u)}function Jl(s,r,o,u){var f=ct();u=u===void 0?null:u;var g=f.memoizedState.inst;Ge!==null&&u!==null&&Cd(u,Ge.memoizedState.deps)?f.memoizedState=Lr(r,g,o,u):(Te.flags|=s,f.memoizedState=Lr(1|r,g,o,u))}function Kg(s,r){Wl(8390656,8,s,r)}function Bd(s,r){Jl(2048,8,s,r)}function tj(s){Te.flags|=4;var r=Te.updateQueue;if(r===null)r=Kl(),Te.updateQueue=r,r.events=[s];else{var o=r.events;o===null?r.events=[s]:o.push(s)}}function Yg(s){var r=ct().memoizedState;return tj({ref:r,nextImpl:s}),function(){if((Ie&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function Xg(s,r){return Jl(4,2,s,r)}function Wg(s,r){return Jl(4,4,s,r)}function Jg(s,r){if(typeof r=="function"){s=s();var o=r(s);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function Zg(s,r,o){o=o!=null?o.concat([s]):null,Jl(4,4,Jg.bind(null,r,s),o)}function Id(){}function Qg(s,r){var o=ct();r=r===void 0?null:r;var u=o.memoizedState;return r!==null&&Cd(r,u[1])?u[0]:(o.memoizedState=[s,r],s)}function ey(s,r){var o=ct();r=r===void 0?null:r;var u=o.memoizedState;if(r!==null&&Cd(r,u[1]))return u[0];if(u=s(),Aa){Yn(!0);try{s()}finally{Yn(!1)}}return o.memoizedState=[u,r],u}function qd(s,r,o){return o===void 0||(ns&1073741824)!==0&&(De&261930)===0?s.memoizedState=r:(s.memoizedState=o,s=tv(),Te.lanes|=s,Ds|=s,o)}function ty(s,r,o,u){return Qt(o,r)?o:Dr.current!==null?(s=qd(s,o,u),Qt(s,r)||(ht=!0),s):(ns&42)===0||(ns&1073741824)!==0&&(De&261930)===0?(ht=!0,s.memoizedState=o):(s=tv(),Te.lanes|=s,Ds|=s,r)}function ny(s,r,o,u,f){var g=q.p;q.p=g!==0&&8>g?g:8;var b=R.T,E={};R.T=E,Gd(s,!1,r,o);try{var C=f(),B=R.S;if(B!==null&&B(E,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var Y=W_(C,u);so(s,r,Y,rn(s))}else so(s,r,u,rn(s))}catch(J){so(s,r,{then:function(){},status:"rejected",reason:J},rn())}finally{q.p=g,b!==null&&E.types!==null&&(b.types=E.types),R.T=b}}function nj(){}function $d(s,r,o,u){if(s.tag!==5)throw Error(i(476));var f=sy(s).queue;ny(s,f,r,I,o===null?nj:function(){return ay(s),o(u)})}function sy(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:I},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:o},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function ay(s){var r=sy(s);r.next===null&&(r=s.alternate.memoizedState),so(s,r.next.queue,{},rn())}function Hd(){return kt(wo)}function ry(){return ct().memoizedState}function iy(){return ct().memoizedState}function sj(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var o=rn();s=Ns(o);var u=As(r,s,o);u!==null&&(Jt(u,r,o),Zi(u,r,o)),r={cache:xd()},s.payload=r;return}r=r.return}}function aj(s,r,o){var u=rn();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Zl(s)?ly(r,o):(o=ld(s,r,o,u),o!==null&&(Jt(o,s,u),cy(o,r,u)))}function oy(s,r,o){var u=rn();so(s,r,o,u)}function so(s,r,o,u){var f={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Zl(s))ly(r,f);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=r.lastRenderedReducer,g!==null))try{var b=r.lastRenderedState,E=g(b,o);if(f.hasEagerState=!0,f.eagerState=E,Qt(E,b))return Ol(s,r,f,0),Ye===null&&Rl(),!1}catch{}if(o=ld(s,r,f,u),o!==null)return Jt(o,s,u),cy(o,r,u),!0}return!1}function Gd(s,r,o,u){if(u={lane:2,revertLane:_h(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Zl(s)){if(r)throw Error(i(479))}else r=ld(s,o,u,2),r!==null&&Jt(r,s,2)}function Zl(s){var r=s.alternate;return s===Te||r!==null&&r===Te}function ly(s,r){Mr=Gl=!0;var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}function cy(s,r,o){if((o&4194048)!==0){var u=r.lanes;u&=s.pendingLanes,o|=u,r.lanes=o,pl(s,o)}}var ao={readContext:kt,use:Yl,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useLayoutEffect:st,useInsertionEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useSyncExternalStore:st,useId:st,useHostTransitionStatus:st,useFormState:st,useActionState:st,useOptimistic:st,useMemoCache:st,useCacheRefresh:st};ao.useEffectEvent=st;var uy={readContext:kt,use:Yl,useCallback:function(s,r){return Bt().memoizedState=[s,r===void 0?null:r],s},useContext:kt,useEffect:Kg,useImperativeHandle:function(s,r,o){o=o!=null?o.concat([s]):null,Wl(4194308,4,Jg.bind(null,r,s),o)},useLayoutEffect:function(s,r){return Wl(4194308,4,s,r)},useInsertionEffect:function(s,r){Wl(4,2,s,r)},useMemo:function(s,r){var o=Bt();r=r===void 0?null:r;var u=s();if(Aa){Yn(!0);try{s()}finally{Yn(!1)}}return o.memoizedState=[u,r],u},useReducer:function(s,r,o){var u=Bt();if(o!==void 0){var f=o(r);if(Aa){Yn(!0);try{o(r)}finally{Yn(!1)}}}else f=r;return u.memoizedState=u.baseState=f,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:f},u.queue=s,s=s.dispatch=aj.bind(null,Te,s),[u.memoizedState,s]},useRef:function(s){var r=Bt();return s={current:s},r.memoizedState=s},useState:function(s){s=Pd(s);var r=s.queue,o=oy.bind(null,Te,r);return r.dispatch=o,[s.memoizedState,o]},useDebugValue:Id,useDeferredValue:function(s,r){var o=Bt();return qd(o,s,r)},useTransition:function(){var s=Pd(!1);return s=ny.bind(null,Te,s.queue,!0,!1),Bt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,o){var u=Te,f=Bt();if(Le){if(o===void 0)throw Error(i(407));o=o()}else{if(o=r(),Ye===null)throw Error(i(349));(De&127)!==0||Rg(u,r,o)}f.memoizedState=o;var g={value:o,getSnapshot:r};return f.queue=g,Kg(Dg.bind(null,u,g,s),[s]),u.flags|=2048,Lr(9,{destroy:void 0},Og.bind(null,u,g,o,r),null),o},useId:function(){var s=Bt(),r=Ye.identifierPrefix;if(Le){var o=Pn,u=Un;o=(u&~(1<<32-vt(u)-1)).toString(32)+o,r="_"+r+"R_"+o,o=Fl++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=J_++,r="_"+r+"r_"+o.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Hd,useFormState:qg,useActionState:qg,useOptimistic:function(s){var r=Bt();r.memoizedState=r.baseState=s;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=Gd.bind(null,Te,!0,o),o.dispatch=r,[s,r]},useMemoCache:zd,useCacheRefresh:function(){return Bt().memoizedState=sj.bind(null,Te)},useEffectEvent:function(s){var r=Bt(),o={impl:s};return r.memoizedState=o,function(){if((Ie&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},Fd={readContext:kt,use:Yl,useCallback:Qg,useContext:kt,useEffect:Bd,useImperativeHandle:Zg,useInsertionEffect:Xg,useLayoutEffect:Wg,useMemo:ey,useReducer:Xl,useRef:Fg,useState:function(){return Xl(ss)},useDebugValue:Id,useDeferredValue:function(s,r){var o=ct();return ty(o,Ge.memoizedState,s,r)},useTransition:function(){var s=Xl(ss)[0],r=ct().memoizedState;return[typeof s=="boolean"?s:no(s),r]},useSyncExternalStore:Cg,useId:ry,useHostTransitionStatus:Hd,useFormState:$g,useActionState:$g,useOptimistic:function(s,r){var o=ct();return Lg(o,Ge,s,r)},useMemoCache:zd,useCacheRefresh:iy};Fd.useEffectEvent=Yg;var dy={readContext:kt,use:Yl,useCallback:Qg,useContext:kt,useEffect:Bd,useImperativeHandle:Zg,useInsertionEffect:Xg,useLayoutEffect:Wg,useMemo:ey,useReducer:Ud,useRef:Fg,useState:function(){return Ud(ss)},useDebugValue:Id,useDeferredValue:function(s,r){var o=ct();return Ge===null?qd(o,s,r):ty(o,Ge.memoizedState,s,r)},useTransition:function(){var s=Ud(ss)[0],r=ct().memoizedState;return[typeof s=="boolean"?s:no(s),r]},useSyncExternalStore:Cg,useId:ry,useHostTransitionStatus:Hd,useFormState:Gg,useActionState:Gg,useOptimistic:function(s,r){var o=ct();return Ge!==null?Lg(o,Ge,s,r):(o.baseState=s,[s,o.queue.dispatch])},useMemoCache:zd,useCacheRefresh:iy};dy.useEffectEvent=Yg;function Kd(s,r,o,u){r=s.memoizedState,o=o(u,r),o=o==null?r:x({},r,o),s.memoizedState=o,s.lanes===0&&(s.updateQueue.baseState=o)}var Yd={enqueueSetState:function(s,r,o){s=s._reactInternals;var u=rn(),f=Ns(u);f.payload=r,o!=null&&(f.callback=o),r=As(s,f,u),r!==null&&(Jt(r,s,u),Zi(r,s,u))},enqueueReplaceState:function(s,r,o){s=s._reactInternals;var u=rn(),f=Ns(u);f.tag=1,f.payload=r,o!=null&&(f.callback=o),r=As(s,f,u),r!==null&&(Jt(r,s,u),Zi(r,s,u))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var o=rn(),u=Ns(o);u.tag=2,r!=null&&(u.callback=r),r=As(s,u,o),r!==null&&(Jt(r,s,o),Zi(r,s,o))}};function hy(s,r,o,u,f,g,b){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(u,g,b):r.prototype&&r.prototype.isPureReactComponent?!Hi(o,u)||!Hi(f,g):!0}function fy(s,r,o,u){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,u),r.state!==s&&Yd.enqueueReplaceState(r,r.state,null)}function ka(s,r){var o=r;if("ref"in r){o={};for(var u in r)u!=="ref"&&(o[u]=r[u])}if(s=s.defaultProps){o===r&&(o=x({},o));for(var f in s)o[f]===void 0&&(o[f]=s[f])}return o}function my(s){Cl(s)}function py(s){console.error(s)}function gy(s){Cl(s)}function Ql(s,r){try{var o=s.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function yy(s,r,o){try{var u=s.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Xd(s,r,o){return o=Ns(o),o.tag=3,o.payload={element:null},o.callback=function(){Ql(s,r)},o}function vy(s){return s=Ns(s),s.tag=3,s}function xy(s,r,o,u){var f=o.type.getDerivedStateFromError;if(typeof f=="function"){var g=u.value;s.payload=function(){return f(g)},s.callback=function(){yy(r,o,u)}}var b=o.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(s.callback=function(){yy(r,o,u),typeof f!="function"&&(Ms===null?Ms=new Set([this]):Ms.add(this));var E=u.stack;this.componentDidCatch(u.value,{componentStack:E!==null?E:""})})}function rj(s,r,o,u,f){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=o.alternate,r!==null&&Ar(r,o,f,!0),o=tn.current,o!==null){switch(o.tag){case 31:case 13:return vn===null?dc():o.alternate===null&&at===0&&(at=3),o.flags&=-257,o.flags|=65536,o.lanes=f,u===Bl?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([u]):r.add(u),bh(s,u,f)),!1;case 22:return o.flags|=65536,u===Bl?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([u]):o.add(u)),bh(s,u,f)),!1}throw Error(i(435,o.tag))}return bh(s,u,f),dc(),!1}if(Le)return r=tn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,u!==md&&(s=Error(i(422),{cause:u}),Ki(mn(s,o)))):(u!==md&&(r=Error(i(423),{cause:u}),Ki(mn(r,o))),s=s.current.alternate,s.flags|=65536,f&=-f,s.lanes|=f,u=mn(u,o),f=Xd(s.stateNode,u,f),Ed(s,f),at!==4&&(at=2)),!1;var g=Error(i(520),{cause:u});if(g=mn(g,o),fo===null?fo=[g]:fo.push(g),at!==4&&(at=2),r===null)return!0;u=mn(u,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,s=f&-f,o.lanes|=s,s=Xd(o.stateNode,u,s),Ed(o,s),!1;case 1:if(r=o.type,g=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Ms===null||!Ms.has(g))))return o.flags|=65536,f&=-f,o.lanes|=f,f=vy(f),xy(f,s,o,u),Ed(o,f),!1}o=o.return}while(o!==null);return!1}var Wd=Error(i(461)),ht=!1;function Ct(s,r,o,u){r.child=s===null?_g(r,null,o,u):Na(r,s.child,o,u)}function by(s,r,o,u,f){o=o.render;var g=r.ref;if("ref"in u){var b={};for(var E in u)E!=="ref"&&(b[E]=u[E])}else b=u;return _a(r),u=Rd(s,r,o,b,g,f),E=Od(),s!==null&&!ht?(Dd(s,r,f),as(s,r,f)):(Le&&E&&hd(r),r.flags|=1,Ct(s,r,u,f),r.child)}function wy(s,r,o,u,f){if(s===null){var g=o.type;return typeof g=="function"&&!cd(g)&&g.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=g,Sy(s,r,g,u,f)):(s=Ml(o.type,null,u,r,r.mode,f),s.ref=r.ref,s.return=r,r.child=s)}if(g=s.child,!ah(s,f)){var b=g.memoizedProps;if(o=o.compare,o=o!==null?o:Hi,o(b,u)&&s.ref===r.ref)return as(s,r,f)}return r.flags|=1,s=Zn(g,u),s.ref=r.ref,s.return=r,r.child=s}function Sy(s,r,o,u,f){if(s!==null){var g=s.memoizedProps;if(Hi(g,u)&&s.ref===r.ref)if(ht=!1,r.pendingProps=u=g,ah(s,f))(s.flags&131072)!==0&&(ht=!0);else return r.lanes=s.lanes,as(s,r,f)}return Jd(s,r,o,u,f)}function _y(s,r,o,u){var f=u.children,g=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(g=g!==null?g.baseLanes|o:o,s!==null){for(u=r.child=s.child,f=0;u!==null;)f=f|u.lanes|u.childLanes,u=u.sibling;u=f&~g}else u=0,r.child=null;return jy(s,r,g,o,u)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&Pl(r,g!==null?g.cachePool:null),g!==null?Tg(r,g):Nd(),Ng(r);else return u=r.lanes=536870912,jy(s,r,g!==null?g.baseLanes|o:o,o,u)}else g!==null?(Pl(r,g.cachePool),Tg(r,g),Cs(),r.memoizedState=null):(s!==null&&Pl(r,null),Nd(),Cs());return Ct(s,r,f,o),r.child}function ro(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function jy(s,r,o,u,f){var g=wd();return g=g===null?null:{parent:ut._currentValue,pool:g},r.memoizedState={baseLanes:o,cachePool:g},s!==null&&Pl(r,null),Nd(),Ng(r),s!==null&&Ar(s,r,u,!0),r.childLanes=f,null}function ec(s,r){return r=nc({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function Ey(s,r,o){return Na(r,s.child,null,o),s=ec(r,r.pendingProps),s.flags|=2,nn(r),r.memoizedState=null,s}function ij(s,r,o){var u=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(Le){if(u.mode==="hidden")return s=ec(r,u),r.lanes=536870912,ro(null,s);if(kd(r),(s=We)?(s=Uv(s,yn),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Ss!==null?{id:Un,overflow:Pn}:null,retryLane:536870912,hydrationErrors:null},o=lg(s),o.return=r,r.child=o,At=r,We=null)):s=null,s===null)throw js(r);return r.lanes=536870912,null}return ec(r,u)}var g=s.memoizedState;if(g!==null){var b=g.dehydrated;if(kd(r),f)if(r.flags&256)r.flags&=-257,r=Ey(s,r,o);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(i(558));else if(ht||Ar(s,r,o,!1),f=(o&s.childLanes)!==0,ht||f){if(u=Ye,u!==null&&(b=gl(u,o),b!==0&&b!==g.retryLane))throw g.retryLane=b,xa(s,b),Jt(u,s,b),Wd;dc(),r=Ey(s,r,o)}else s=g.treeContext,We=xn(b.nextSibling),At=r,Le=!0,_s=null,yn=!1,s!==null&&dg(r,s),r=ec(r,u),r.flags|=4096;return r}return s=Zn(s.child,{mode:u.mode,children:u.children}),s.ref=r.ref,r.child=s,s.return=r,s}function tc(s,r){var o=r.ref;if(o===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(s===null||s.ref!==o)&&(r.flags|=4194816)}}function Jd(s,r,o,u,f){return _a(r),o=Rd(s,r,o,u,void 0,f),u=Od(),s!==null&&!ht?(Dd(s,r,f),as(s,r,f)):(Le&&u&&hd(r),r.flags|=1,Ct(s,r,o,f),r.child)}function Ty(s,r,o,u,f,g){return _a(r),r.updateQueue=null,o=kg(r,u,o,f),Ag(s),u=Od(),s!==null&&!ht?(Dd(s,r,g),as(s,r,g)):(Le&&u&&hd(r),r.flags|=1,Ct(s,r,o,g),r.child)}function Ny(s,r,o,u,f){if(_a(r),r.stateNode===null){var g=jr,b=o.contextType;typeof b=="object"&&b!==null&&(g=kt(b)),g=new o(u,g),r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Yd,r.stateNode=g,g._reactInternals=r,g=r.stateNode,g.props=u,g.state=r.memoizedState,g.refs={},_d(r),b=o.contextType,g.context=typeof b=="object"&&b!==null?kt(b):jr,g.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(Kd(r,o,b,u),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(b=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),b!==g.state&&Yd.enqueueReplaceState(g,g.state,null),eo(r,u,g,f),Qi(),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(s===null){g=r.stateNode;var E=r.memoizedProps,C=ka(o,E);g.props=C;var B=g.context,Y=o.contextType;b=jr,typeof Y=="object"&&Y!==null&&(b=kt(Y));var J=o.getDerivedStateFromProps;Y=typeof J=="function"||typeof g.getSnapshotBeforeUpdate=="function",E=r.pendingProps!==E,Y||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(E||B!==b)&&fy(r,g,u,b),Ts=!1;var H=r.memoizedState;g.state=H,eo(r,u,g,f),Qi(),B=r.memoizedState,E||H!==B||Ts?(typeof J=="function"&&(Kd(r,o,J,u),B=r.memoizedState),(C=Ts||hy(r,o,C,u,H,B,b))?(Y||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(r.flags|=4194308)):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=B),g.props=u,g.state=B,g.context=b,u=C):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{g=r.stateNode,jd(s,r),b=r.memoizedProps,Y=ka(o,b),g.props=Y,J=r.pendingProps,H=g.context,B=o.contextType,C=jr,typeof B=="object"&&B!==null&&(C=kt(B)),E=o.getDerivedStateFromProps,(B=typeof E=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(b!==J||H!==C)&&fy(r,g,u,C),Ts=!1,H=r.memoizedState,g.state=H,eo(r,u,g,f),Qi();var G=r.memoizedState;b!==J||H!==G||Ts||s!==null&&s.dependencies!==null&&Ll(s.dependencies)?(typeof E=="function"&&(Kd(r,o,E,u),G=r.memoizedState),(Y=Ts||hy(r,o,Y,u,H,G,C)||s!==null&&s.dependencies!==null&&Ll(s.dependencies))?(B||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(u,G,C),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(u,G,C)),typeof g.componentDidUpdate=="function"&&(r.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof g.componentDidUpdate!="function"||b===s.memoizedProps&&H===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||b===s.memoizedProps&&H===s.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=G),g.props=u,g.state=G,g.context=C,u=Y):(typeof g.componentDidUpdate!="function"||b===s.memoizedProps&&H===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||b===s.memoizedProps&&H===s.memoizedState||(r.flags|=1024),u=!1)}return g=u,tc(s,r),u=(r.flags&128)!==0,g||u?(g=r.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:g.render(),r.flags|=1,s!==null&&u?(r.child=Na(r,s.child,null,f),r.child=Na(r,null,o,f)):Ct(s,r,o,f),r.memoizedState=g.state,s=r.child):s=as(s,r,f),s}function Ay(s,r,o,u){return wa(),r.flags|=256,Ct(s,r,o,u),r.child}var Zd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qd(s){return{baseLanes:s,cachePool:yg()}}function eh(s,r,o){return s=s!==null?s.childLanes&~o:0,r&&(s|=an),s}function ky(s,r,o){var u=r.pendingProps,f=!1,g=(r.flags&128)!==0,b;if((b=g)||(b=s!==null&&s.memoizedState===null?!1:(lt.current&2)!==0),b&&(f=!0,r.flags&=-129),b=(r.flags&32)!==0,r.flags&=-33,s===null){if(Le){if(f?ks(r):Cs(),(s=We)?(s=Uv(s,yn),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Ss!==null?{id:Un,overflow:Pn}:null,retryLane:536870912,hydrationErrors:null},o=lg(s),o.return=r,r.child=o,At=r,We=null)):s=null,s===null)throw js(r);return Lh(s)?r.lanes=32:r.lanes=536870912,null}var E=u.children;return u=u.fallback,f?(Cs(),f=r.mode,E=nc({mode:"hidden",children:E},f),u=ba(u,f,o,null),E.return=r,u.return=r,E.sibling=u,r.child=E,u=r.child,u.memoizedState=Qd(o),u.childLanes=eh(s,b,o),r.memoizedState=Zd,ro(null,u)):(ks(r),th(r,E))}var C=s.memoizedState;if(C!==null&&(E=C.dehydrated,E!==null)){if(g)r.flags&256?(ks(r),r.flags&=-257,r=nh(s,r,o)):r.memoizedState!==null?(Cs(),r.child=s.child,r.flags|=128,r=null):(Cs(),E=u.fallback,f=r.mode,u=nc({mode:"visible",children:u.children},f),E=ba(E,f,o,null),E.flags|=2,u.return=r,E.return=r,u.sibling=E,r.child=u,Na(r,s.child,null,o),u=r.child,u.memoizedState=Qd(o),u.childLanes=eh(s,b,o),r.memoizedState=Zd,r=ro(null,u));else if(ks(r),Lh(E)){if(b=E.nextSibling&&E.nextSibling.dataset,b)var B=b.dgst;b=B,u=Error(i(419)),u.stack="",u.digest=b,Ki({value:u,source:null,stack:null}),r=nh(s,r,o)}else if(ht||Ar(s,r,o,!1),b=(o&s.childLanes)!==0,ht||b){if(b=Ye,b!==null&&(u=gl(b,o),u!==0&&u!==C.retryLane))throw C.retryLane=u,xa(s,u),Jt(b,s,u),Wd;zh(E)||dc(),r=nh(s,r,o)}else zh(E)?(r.flags|=192,r.child=s.child,r=null):(s=C.treeContext,We=xn(E.nextSibling),At=r,Le=!0,_s=null,yn=!1,s!==null&&dg(r,s),r=th(r,u.children),r.flags|=4096);return r}return f?(Cs(),E=u.fallback,f=r.mode,C=s.child,B=C.sibling,u=Zn(C,{mode:"hidden",children:u.children}),u.subtreeFlags=C.subtreeFlags&65011712,B!==null?E=Zn(B,E):(E=ba(E,f,o,null),E.flags|=2),E.return=r,u.return=r,u.sibling=E,r.child=u,ro(null,u),u=r.child,E=s.child.memoizedState,E===null?E=Qd(o):(f=E.cachePool,f!==null?(C=ut._currentValue,f=f.parent!==C?{parent:C,pool:C}:f):f=yg(),E={baseLanes:E.baseLanes|o,cachePool:f}),u.memoizedState=E,u.childLanes=eh(s,b,o),r.memoizedState=Zd,ro(s.child,u)):(ks(r),o=s.child,s=o.sibling,o=Zn(o,{mode:"visible",children:u.children}),o.return=r,o.sibling=null,s!==null&&(b=r.deletions,b===null?(r.deletions=[s],r.flags|=16):b.push(s)),r.child=o,r.memoizedState=null,o)}function th(s,r){return r=nc({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function nc(s,r){return s=en(22,s,null,r),s.lanes=0,s}function nh(s,r,o){return Na(r,s.child,null,o),s=th(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function Cy(s,r,o){s.lanes|=r;var u=s.alternate;u!==null&&(u.lanes|=r),yd(s.return,r,o)}function sh(s,r,o,u,f,g){var b=s.memoizedState;b===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:f,treeForkCount:g}:(b.isBackwards=r,b.rendering=null,b.renderingStartTime=0,b.last=u,b.tail=o,b.tailMode=f,b.treeForkCount=g)}function Ry(s,r,o){var u=r.pendingProps,f=u.revealOrder,g=u.tail;u=u.children;var b=lt.current,E=(b&2)!==0;if(E?(b=b&1|2,r.flags|=128):b&=1,Q(lt,b),Ct(s,r,u,o),u=Le?Fi:0,!E&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Cy(s,o,r);else if(s.tag===19)Cy(s,o,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(f){case"forwards":for(o=r.child,f=null;o!==null;)s=o.alternate,s!==null&&Hl(s)===null&&(f=o),o=o.sibling;o=f,o===null?(f=r.child,r.child=null):(f=o.sibling,o.sibling=null),sh(r,!1,f,o,g,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,f=r.child,r.child=null;f!==null;){if(s=f.alternate,s!==null&&Hl(s)===null){r.child=f;break}s=f.sibling,f.sibling=o,o=f,f=s}sh(r,!0,o,null,g,u);break;case"together":sh(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function as(s,r,o){if(s!==null&&(r.dependencies=s.dependencies),Ds|=r.lanes,(o&r.childLanes)===0)if(s!==null){if(Ar(s,r,o,!1),(o&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(i(153));if(r.child!==null){for(s=r.child,o=Zn(s,s.pendingProps),r.child=o,o.return=r;s.sibling!==null;)s=s.sibling,o=o.sibling=Zn(s,s.pendingProps),o.return=r;o.sibling=null}return r.child}function ah(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&Ll(s)))}function oj(s,r,o){switch(r.tag){case 3:ot(r,r.stateNode.containerInfo),Es(r,ut,s.memoizedState.cache),wa();break;case 27:case 5:un(r);break;case 4:ot(r,r.stateNode.containerInfo);break;case 10:Es(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,kd(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(ks(r),r.flags|=128,null):(o&r.child.childLanes)!==0?ky(s,r,o):(ks(r),s=as(s,r,o),s!==null?s.sibling:null);ks(r);break;case 19:var f=(s.flags&128)!==0;if(u=(o&r.childLanes)!==0,u||(Ar(s,r,o,!1),u=(o&r.childLanes)!==0),f){if(u)return Ry(s,r,o);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Q(lt,lt.current),u)break;return null;case 22:return r.lanes=0,_y(s,r,o,r.pendingProps);case 24:Es(r,ut,s.memoizedState.cache)}return as(s,r,o)}function Oy(s,r,o){if(s!==null)if(s.memoizedProps!==r.pendingProps)ht=!0;else{if(!ah(s,o)&&(r.flags&128)===0)return ht=!1,oj(s,r,o);ht=(s.flags&131072)!==0}else ht=!1,Le&&(r.flags&1048576)!==0&&ug(r,Fi,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(s=Ea(r.elementType),r.type=s,typeof s=="function")cd(s)?(u=ka(s,u),r.tag=1,r=Ny(null,r,s,u,o)):(r.tag=0,r=Jd(null,r,s,u,o));else{if(s!=null){var f=s.$$typeof;if(f===U){r.tag=11,r=by(null,r,s,u,o);break e}else if(f===P){r.tag=14,r=wy(null,r,s,u,o);break e}}throw r=Be(s)||s,Error(i(306,r,""))}}return r;case 0:return Jd(s,r,r.type,r.pendingProps,o);case 1:return u=r.type,f=ka(u,r.pendingProps),Ny(s,r,u,f,o);case 3:e:{if(ot(r,r.stateNode.containerInfo),s===null)throw Error(i(387));u=r.pendingProps;var g=r.memoizedState;f=g.element,jd(s,r),eo(r,u,null,o);var b=r.memoizedState;if(u=b.cache,Es(r,ut,u),u!==g.cache&&vd(r,[ut],o,!0),Qi(),u=b.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:b.cache},r.updateQueue.baseState=g,r.memoizedState=g,r.flags&256){r=Ay(s,r,u,o);break e}else if(u!==f){f=mn(Error(i(424)),r),Ki(f),r=Ay(s,r,u,o);break e}else for(s=r.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,We=xn(s.firstChild),At=r,Le=!0,_s=null,yn=!0,o=_g(r,null,u,o),r.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(wa(),u===f){r=as(s,r,o);break e}Ct(s,r,u,o)}r=r.child}return r;case 26:return tc(s,r),s===null?(o=$v(r.type,null,r.pendingProps,null))?r.memoizedState=o:Le||(o=r.type,s=r.pendingProps,u=vc(je.current).createElement(o),u[$]=r,u[ne]=s,Rt(u,o,s),_t(u),r.stateNode=u):r.memoizedState=$v(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return un(r),s===null&&Le&&(u=r.stateNode=Bv(r.type,r.pendingProps,je.current),At=r,yn=!0,f=We,Ps(r.type)?(Uh=f,We=xn(u.firstChild)):We=f),Ct(s,r,r.pendingProps.children,o),tc(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&Le&&((f=u=We)&&(u=Uj(u,r.type,r.pendingProps,yn),u!==null?(r.stateNode=u,At=r,We=xn(u.firstChild),yn=!1,f=!0):f=!1),f||js(r)),un(r),f=r.type,g=r.pendingProps,b=s!==null?s.memoizedProps:null,u=g.children,Oh(f,g)?u=null:b!==null&&Oh(f,b)&&(r.flags|=32),r.memoizedState!==null&&(f=Rd(s,r,Z_,null,null,o),wo._currentValue=f),tc(s,r),Ct(s,r,u,o),r.child;case 6:return s===null&&Le&&((s=o=We)&&(o=Pj(o,r.pendingProps,yn),o!==null?(r.stateNode=o,At=r,We=null,s=!0):s=!1),s||js(r)),null;case 13:return ky(s,r,o);case 4:return ot(r,r.stateNode.containerInfo),u=r.pendingProps,s===null?r.child=Na(r,null,u,o):Ct(s,r,u,o),r.child;case 11:return by(s,r,r.type,r.pendingProps,o);case 7:return Ct(s,r,r.pendingProps,o),r.child;case 8:return Ct(s,r,r.pendingProps.children,o),r.child;case 12:return Ct(s,r,r.pendingProps.children,o),r.child;case 10:return u=r.pendingProps,Es(r,r.type,u.value),Ct(s,r,u.children,o),r.child;case 9:return f=r.type._context,u=r.pendingProps.children,_a(r),f=kt(f),u=u(f),r.flags|=1,Ct(s,r,u,o),r.child;case 14:return wy(s,r,r.type,r.pendingProps,o);case 15:return Sy(s,r,r.type,r.pendingProps,o);case 19:return Ry(s,r,o);case 31:return ij(s,r,o);case 22:return _y(s,r,o,r.pendingProps);case 24:return _a(r),u=kt(ut),s===null?(f=wd(),f===null&&(f=Ye,g=xd(),f.pooledCache=g,g.refCount++,g!==null&&(f.pooledCacheLanes|=o),f=g),r.memoizedState={parent:u,cache:f},_d(r),Es(r,ut,f)):((s.lanes&o)!==0&&(jd(s,r),eo(r,null,null,o),Qi()),f=s.memoizedState,g=r.memoizedState,f.parent!==u?(f={parent:u,cache:u},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Es(r,ut,u)):(u=g.cache,Es(r,ut,u),u!==f.cache&&vd(r,[ut],o,!0))),Ct(s,r,r.pendingProps.children,o),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function rs(s){s.flags|=4}function rh(s,r,o,u,f){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(f&335544128)===f)if(s.stateNode.complete)s.flags|=8192;else if(rv())s.flags|=8192;else throw Ta=Bl,Sd}else s.flags&=-16777217}function Dy(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Yv(r))if(rv())s.flags|=8192;else throw Ta=Bl,Sd}function sc(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?fl():536870912,s.lanes|=r,Br|=r)}function io(s,r){if(!Le)switch(s.tailMode){case"hidden":r=s.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?s.tail=null:o.sibling=null;break;case"collapsed":o=s.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:u.sibling=null}}function Je(s){var r=s.alternate!==null&&s.alternate.child===s.child,o=0,u=0;if(r)for(var f=s.child;f!==null;)o|=f.lanes|f.childLanes,u|=f.subtreeFlags&65011712,u|=f.flags&65011712,f.return=s,f=f.sibling;else for(f=s.child;f!==null;)o|=f.lanes|f.childLanes,u|=f.subtreeFlags,u|=f.flags,f.return=s,f=f.sibling;return s.subtreeFlags|=u,s.childLanes=o,r}function lj(s,r,o){var u=r.pendingProps;switch(fd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(r),null;case 1:return Je(r),null;case 3:return o=r.stateNode,u=null,s!==null&&(u=s.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),ts(ut),Ue(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(s===null||s.child===null)&&(Nr(r)?rs(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,pd())),Je(r),null;case 26:var f=r.type,g=r.memoizedState;return s===null?(rs(r),g!==null?(Je(r),Dy(r,g)):(Je(r),rh(r,f,null,u,o))):g?g!==s.memoizedState?(rs(r),Je(r),Dy(r,g)):(Je(r),r.flags&=-16777217):(s=s.memoizedProps,s!==u&&rs(r),Je(r),rh(r,f,s,u,o)),null;case 27:if(Gt(r),o=je.current,f=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==u&&rs(r);else{if(!u){if(r.stateNode===null)throw Error(i(166));return Je(r),null}s=se.current,Nr(r)?hg(r):(s=Bv(f,u,o),r.stateNode=s,rs(r))}return Je(r),null;case 5:if(Gt(r),f=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==u&&rs(r);else{if(!u){if(r.stateNode===null)throw Error(i(166));return Je(r),null}if(g=se.current,Nr(r))hg(r);else{var b=vc(je.current);switch(g){case 1:g=b.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:g=b.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":g=b.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":g=b.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":g=b.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof u.is=="string"?b.createElement("select",{is:u.is}):b.createElement("select"),u.multiple?g.multiple=!0:u.size&&(g.size=u.size);break;default:g=typeof u.is=="string"?b.createElement(f,{is:u.is}):b.createElement(f)}}g[$]=r,g[ne]=u;e:for(b=r.child;b!==null;){if(b.tag===5||b.tag===6)g.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===r)break e;for(;b.sibling===null;){if(b.return===null||b.return===r)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}r.stateNode=g;e:switch(Rt(g,f,u),f){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&rs(r)}}return Je(r),rh(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,o),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==u&&rs(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(i(166));if(s=je.current,Nr(r)){if(s=r.stateNode,o=r.memoizedProps,u=null,f=At,f!==null)switch(f.tag){case 27:case 5:u=f.memoizedProps}s[$]=r,s=!!(s.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||kv(s.nodeValue,o)),s||js(r,!0)}else s=vc(s).createTextNode(u),s[$]=r,r.stateNode=s}return Je(r),null;case 31:if(o=r.memoizedState,s===null||s.memoizedState!==null){if(u=Nr(r),o!==null){if(s===null){if(!u)throw Error(i(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[$]=r}else wa(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Je(r),s=!1}else o=pd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),s=!0;if(!s)return r.flags&256?(nn(r),r):(nn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return Je(r),null;case 13:if(u=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(f=Nr(r),u!==null&&u.dehydrated!==null){if(s===null){if(!f)throw Error(i(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[$]=r}else wa(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Je(r),f=!1}else f=pd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(nn(r),r):(nn(r),null)}return nn(r),(r.flags&128)!==0?(r.lanes=o,r):(o=u!==null,s=s!==null&&s.memoizedState!==null,o&&(u=r.child,f=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(f=u.alternate.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048)),o!==s&&o&&(r.child.flags|=8192),sc(r,r.updateQueue),Je(r),null);case 4:return Ue(),s===null&&Nh(r.stateNode.containerInfo),Je(r),null;case 10:return ts(r.type),Je(r),null;case 19:if(X(lt),u=r.memoizedState,u===null)return Je(r),null;if(f=(r.flags&128)!==0,g=u.rendering,g===null)if(f)io(u,!1);else{if(at!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(g=Hl(s),g!==null){for(r.flags|=128,io(u,!1),s=g.updateQueue,r.updateQueue=s,sc(r,s),r.subtreeFlags=0,s=o,o=r.child;o!==null;)og(o,s),o=o.sibling;return Q(lt,lt.current&1|2),Le&&Qn(r,u.treeForkCount),r.child}s=s.sibling}u.tail!==null&&Tt()>lc&&(r.flags|=128,f=!0,io(u,!1),r.lanes=4194304)}else{if(!f)if(s=Hl(g),s!==null){if(r.flags|=128,f=!0,s=s.updateQueue,r.updateQueue=s,sc(r,s),io(u,!0),u.tail===null&&u.tailMode==="hidden"&&!g.alternate&&!Le)return Je(r),null}else 2*Tt()-u.renderingStartTime>lc&&o!==536870912&&(r.flags|=128,f=!0,io(u,!1),r.lanes=4194304);u.isBackwards?(g.sibling=r.child,r.child=g):(s=u.last,s!==null?s.sibling=g:r.child=g,u.last=g)}return u.tail!==null?(s=u.tail,u.rendering=s,u.tail=s.sibling,u.renderingStartTime=Tt(),s.sibling=null,o=lt.current,Q(lt,f?o&1|2:o&1),Le&&Qn(r,u.treeForkCount),s):(Je(r),null);case 22:case 23:return nn(r),Ad(),u=r.memoizedState!==null,s!==null?s.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(o&536870912)!==0&&(r.flags&128)===0&&(Je(r),r.subtreeFlags&6&&(r.flags|=8192)):Je(r),o=r.updateQueue,o!==null&&sc(r,o.retryQueue),o=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==o&&(r.flags|=2048),s!==null&&X(ja),null;case 24:return o=null,s!==null&&(o=s.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),ts(ut),Je(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function cj(s,r){switch(fd(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return ts(ut),Ue(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return Gt(r),null;case 31:if(r.memoizedState!==null){if(nn(r),r.alternate===null)throw Error(i(340));wa()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(nn(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(i(340));wa()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return X(lt),null;case 4:return Ue(),null;case 10:return ts(r.type),null;case 22:case 23:return nn(r),Ad(),s!==null&&X(ja),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return ts(ut),null;case 25:return null;default:return null}}function My(s,r){switch(fd(r),r.tag){case 3:ts(ut),Ue();break;case 26:case 27:case 5:Gt(r);break;case 4:Ue();break;case 31:r.memoizedState!==null&&nn(r);break;case 13:nn(r);break;case 19:X(lt);break;case 10:ts(r.type);break;case 22:case 23:nn(r),Ad(),s!==null&&X(ja);break;case 24:ts(ut)}}function oo(s,r){try{var o=r.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var f=u.next;o=f;do{if((o.tag&s)===s){u=void 0;var g=o.create,b=o.inst;u=g(),b.destroy=u}o=o.next}while(o!==f)}}catch(E){He(r,r.return,E)}}function Rs(s,r,o){try{var u=r.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var g=f.next;u=g;do{if((u.tag&s)===s){var b=u.inst,E=b.destroy;if(E!==void 0){b.destroy=void 0,f=r;var C=o,B=E;try{B()}catch(Y){He(f,C,Y)}}}u=u.next}while(u!==g)}}catch(Y){He(r,r.return,Y)}}function zy(s){var r=s.updateQueue;if(r!==null){var o=s.stateNode;try{Eg(r,o)}catch(u){He(s,s.return,u)}}}function Ly(s,r,o){o.props=ka(s.type,s.memoizedProps),o.state=s.memoizedState;try{o.componentWillUnmount()}catch(u){He(s,r,u)}}function lo(s,r){try{var o=s.ref;if(o!==null){switch(s.tag){case 26:case 27:case 5:var u=s.stateNode;break;case 30:u=s.stateNode;break;default:u=s.stateNode}typeof o=="function"?s.refCleanup=o(u):o.current=u}}catch(f){He(s,r,f)}}function Vn(s,r){var o=s.ref,u=s.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(f){He(s,r,f)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(f){He(s,r,f)}else o.current=null}function Uy(s){var r=s.type,o=s.memoizedProps,u=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(f){He(s,s.return,f)}}function ih(s,r,o){try{var u=s.stateNode;Rj(u,s.type,o,r),u[ne]=r}catch(f){He(s,s.return,f)}}function Py(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ps(s.type)||s.tag===4}function oh(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Py(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ps(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function lh(s,r,o){var u=s.tag;if(u===5||u===6)s=s.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(s,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(s),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=Wn));else if(u!==4&&(u===27&&Ps(s.type)&&(o=s.stateNode,r=null),s=s.child,s!==null))for(lh(s,r,o),s=s.sibling;s!==null;)lh(s,r,o),s=s.sibling}function ac(s,r,o){var u=s.tag;if(u===5||u===6)s=s.stateNode,r?o.insertBefore(s,r):o.appendChild(s);else if(u!==4&&(u===27&&Ps(s.type)&&(o=s.stateNode),s=s.child,s!==null))for(ac(s,r,o),s=s.sibling;s!==null;)ac(s,r,o),s=s.sibling}function Vy(s){var r=s.stateNode,o=s.memoizedProps;try{for(var u=s.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Rt(r,u,o),r[$]=s,r[ne]=o}catch(g){He(s,s.return,g)}}var is=!1,ft=!1,ch=!1,By=typeof WeakSet=="function"?WeakSet:Set,jt=null;function uj(s,r){if(s=s.containerInfo,Ch=Ec,s=Zp(s),nd(s)){if("selectionStart"in s)var o={start:s.selectionStart,end:s.selectionEnd};else e:{o=(o=s.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{o.nodeType,g.nodeType}catch{o=null;break e}var b=0,E=-1,C=-1,B=0,Y=0,J=s,H=null;t:for(;;){for(var G;J!==o||f!==0&&J.nodeType!==3||(E=b+f),J!==g||u!==0&&J.nodeType!==3||(C=b+u),J.nodeType===3&&(b+=J.nodeValue.length),(G=J.firstChild)!==null;)H=J,J=G;for(;;){if(J===s)break t;if(H===o&&++B===f&&(E=b),H===g&&++Y===u&&(C=b),(G=J.nextSibling)!==null)break;J=H,H=J.parentNode}J=G}o=E===-1||C===-1?null:{start:E,end:C}}else o=null}o=o||{start:0,end:0}}else o=null;for(Rh={focusedElem:s,selectionRange:o},Ec=!1,jt=r;jt!==null;)if(r=jt,s=r.child,(r.subtreeFlags&1028)!==0&&s!==null)s.return=r,jt=s;else for(;jt!==null;){switch(r=jt,g=r.alternate,s=r.flags,r.tag){case 0:if((s&4)!==0&&(s=r.updateQueue,s=s!==null?s.events:null,s!==null))for(o=0;o<s.length;o++)f=s[o],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&g!==null){s=void 0,o=r,f=g.memoizedProps,g=g.memoizedState,u=o.stateNode;try{var oe=ka(o.type,f);s=u.getSnapshotBeforeUpdate(oe,g),u.__reactInternalSnapshotBeforeUpdate=s}catch(ye){He(o,o.return,ye)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,o=s.nodeType,o===9)Mh(s);else if(o===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Mh(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=r.sibling,s!==null){s.return=r.return,jt=s;break}jt=r.return}}function Iy(s,r,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:ls(s,o),u&4&&oo(5,o);break;case 1:if(ls(s,o),u&4)if(s=o.stateNode,r===null)try{s.componentDidMount()}catch(b){He(o,o.return,b)}else{var f=ka(o.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(f,r,s.__reactInternalSnapshotBeforeUpdate)}catch(b){He(o,o.return,b)}}u&64&&zy(o),u&512&&lo(o,o.return);break;case 3:if(ls(s,o),u&64&&(s=o.updateQueue,s!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{Eg(s,r)}catch(b){He(o,o.return,b)}}break;case 27:r===null&&u&4&&Vy(o);case 26:case 5:ls(s,o),r===null&&u&4&&Uy(o),u&512&&lo(o,o.return);break;case 12:ls(s,o);break;case 31:ls(s,o),u&4&&Hy(s,o);break;case 13:ls(s,o),u&4&&Gy(s,o),u&64&&(s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(o=xj.bind(null,o),Vj(s,o))));break;case 22:if(u=o.memoizedState!==null||is,!u){r=r!==null&&r.memoizedState!==null||ft,f=is;var g=ft;is=u,(ft=r)&&!g?cs(s,o,(o.subtreeFlags&8772)!==0):ls(s,o),is=f,ft=g}break;case 30:break;default:ls(s,o)}}function qy(s){var r=s.alternate;r!==null&&(s.alternate=null,qy(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&zi(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var et=null,Kt=!1;function os(s,r,o){for(o=o.child;o!==null;)$y(s,r,o),o=o.sibling}function $y(s,r,o){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(bs,o)}catch{}switch(o.tag){case 26:ft||Vn(o,r),os(s,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:ft||Vn(o,r);var u=et,f=Kt;Ps(o.type)&&(et=o.stateNode,Kt=!1),os(s,r,o),vo(o.stateNode),et=u,Kt=f;break;case 5:ft||Vn(o,r);case 6:if(u=et,f=Kt,et=null,os(s,r,o),et=u,Kt=f,et!==null)if(Kt)try{(et.nodeType===9?et.body:et.nodeName==="HTML"?et.ownerDocument.body:et).removeChild(o.stateNode)}catch(g){He(o,r,g)}else try{et.removeChild(o.stateNode)}catch(g){He(o,r,g)}break;case 18:et!==null&&(Kt?(s=et,zv(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,o.stateNode),Yr(s)):zv(et,o.stateNode));break;case 4:u=et,f=Kt,et=o.stateNode.containerInfo,Kt=!0,os(s,r,o),et=u,Kt=f;break;case 0:case 11:case 14:case 15:Rs(2,o,r),ft||Rs(4,o,r),os(s,r,o);break;case 1:ft||(Vn(o,r),u=o.stateNode,typeof u.componentWillUnmount=="function"&&Ly(o,r,u)),os(s,r,o);break;case 21:os(s,r,o);break;case 22:ft=(u=ft)||o.memoizedState!==null,os(s,r,o),ft=u;break;default:os(s,r,o)}}function Hy(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Yr(s)}catch(o){He(r,r.return,o)}}}function Gy(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Yr(s)}catch(o){He(r,r.return,o)}}function dj(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new By),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new By),r;default:throw Error(i(435,s.tag))}}function rc(s,r){var o=dj(s);r.forEach(function(u){if(!o.has(u)){o.add(u);var f=bj.bind(null,s,u);u.then(f,f)}})}function Yt(s,r){var o=r.deletions;if(o!==null)for(var u=0;u<o.length;u++){var f=o[u],g=s,b=r,E=b;e:for(;E!==null;){switch(E.tag){case 27:if(Ps(E.type)){et=E.stateNode,Kt=!1;break e}break;case 5:et=E.stateNode,Kt=!1;break e;case 3:case 4:et=E.stateNode.containerInfo,Kt=!0;break e}E=E.return}if(et===null)throw Error(i(160));$y(g,b,f),et=null,Kt=!1,g=f.alternate,g!==null&&(g.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Fy(r,s),r=r.sibling}var An=null;function Fy(s,r){var o=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Yt(r,s),Xt(s),u&4&&(Rs(3,s,s.return),oo(3,s),Rs(5,s,s.return));break;case 1:Yt(r,s),Xt(s),u&512&&(ft||o===null||Vn(o,o.return)),u&64&&is&&(s=s.updateQueue,s!==null&&(u=s.callbacks,u!==null&&(o=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var f=An;if(Yt(r,s),Xt(s),u&512&&(ft||o===null||Vn(o,o.return)),u&4){var g=o!==null?o.memoizedState:null;if(u=s.memoizedState,o===null)if(u===null)if(s.stateNode===null){e:{u=s.type,o=s.memoizedProps,f=f.ownerDocument||f;t:switch(u){case"title":g=f.getElementsByTagName("title")[0],(!g||g[ma]||g[$]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=f.createElement(u),f.head.insertBefore(g,f.querySelector("head > title"))),Rt(g,u,o),g[$]=s,_t(g),u=g;break e;case"link":var b=Fv("link","href",f).get(u+(o.href||""));if(b){for(var E=0;E<b.length;E++)if(g=b[E],g.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&g.getAttribute("rel")===(o.rel==null?null:o.rel)&&g.getAttribute("title")===(o.title==null?null:o.title)&&g.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){b.splice(E,1);break t}}g=f.createElement(u),Rt(g,u,o),f.head.appendChild(g);break;case"meta":if(b=Fv("meta","content",f).get(u+(o.content||""))){for(E=0;E<b.length;E++)if(g=b[E],g.getAttribute("content")===(o.content==null?null:""+o.content)&&g.getAttribute("name")===(o.name==null?null:o.name)&&g.getAttribute("property")===(o.property==null?null:o.property)&&g.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&g.getAttribute("charset")===(o.charSet==null?null:o.charSet)){b.splice(E,1);break t}}g=f.createElement(u),Rt(g,u,o),f.head.appendChild(g);break;default:throw Error(i(468,u))}g[$]=s,_t(g),u=g}s.stateNode=u}else Kv(f,s.type,s.stateNode);else s.stateNode=Gv(f,u,s.memoizedProps);else g!==u?(g===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):g.count--,u===null?Kv(f,s.type,s.stateNode):Gv(f,u,s.memoizedProps)):u===null&&s.stateNode!==null&&ih(s,s.memoizedProps,o.memoizedProps)}break;case 27:Yt(r,s),Xt(s),u&512&&(ft||o===null||Vn(o,o.return)),o!==null&&u&4&&ih(s,s.memoizedProps,o.memoizedProps);break;case 5:if(Yt(r,s),Xt(s),u&512&&(ft||o===null||Vn(o,o.return)),s.flags&32){f=s.stateNode;try{yr(f,"")}catch(oe){He(s,s.return,oe)}}u&4&&s.stateNode!=null&&(f=s.memoizedProps,ih(s,f,o!==null?o.memoizedProps:f)),u&1024&&(ch=!0);break;case 6:if(Yt(r,s),Xt(s),u&4){if(s.stateNode===null)throw Error(i(162));u=s.memoizedProps,o=s.stateNode;try{o.nodeValue=u}catch(oe){He(s,s.return,oe)}}break;case 3:if(wc=null,f=An,An=xc(r.containerInfo),Yt(r,s),An=f,Xt(s),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Yr(r.containerInfo)}catch(oe){He(s,s.return,oe)}ch&&(ch=!1,Ky(s));break;case 4:u=An,An=xc(s.stateNode.containerInfo),Yt(r,s),Xt(s),An=u;break;case 12:Yt(r,s),Xt(s);break;case 31:Yt(r,s),Xt(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,rc(s,u)));break;case 13:Yt(r,s),Xt(s),s.child.flags&8192&&s.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(oc=Tt()),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,rc(s,u)));break;case 22:f=s.memoizedState!==null;var C=o!==null&&o.memoizedState!==null,B=is,Y=ft;if(is=B||f,ft=Y||C,Yt(r,s),ft=Y,is=B,Xt(s),u&8192)e:for(r=s.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(o===null||C||is||ft||Ca(s)),o=null,r=s;;){if(r.tag===5||r.tag===26){if(o===null){C=o=r;try{if(g=C.stateNode,f)b=g.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{E=C.stateNode;var J=C.memoizedProps.style,H=J!=null&&J.hasOwnProperty("display")?J.display:null;E.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(oe){He(C,C.return,oe)}}}else if(r.tag===6){if(o===null){C=r;try{C.stateNode.nodeValue=f?"":C.memoizedProps}catch(oe){He(C,C.return,oe)}}}else if(r.tag===18){if(o===null){C=r;try{var G=C.stateNode;f?Lv(G,!0):Lv(C.stateNode,!1)}catch(oe){He(C,C.return,oe)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===s)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;o===r&&(o=null),r=r.return}o===r&&(o=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=s.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,rc(s,o))));break;case 19:Yt(r,s),Xt(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,rc(s,u)));break;case 30:break;case 21:break;default:Yt(r,s),Xt(s)}}function Xt(s){var r=s.flags;if(r&2){try{for(var o,u=s.return;u!==null;){if(Py(u)){o=u;break}u=u.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var f=o.stateNode,g=oh(s);ac(s,g,f);break;case 5:var b=o.stateNode;o.flags&32&&(yr(b,""),o.flags&=-33);var E=oh(s);ac(s,E,b);break;case 3:case 4:var C=o.stateNode.containerInfo,B=oh(s);lh(s,B,C);break;default:throw Error(i(161))}}catch(Y){He(s,s.return,Y)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function Ky(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;Ky(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),s=s.sibling}}function ls(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Iy(s,r.alternate,r),r=r.sibling}function Ca(s){for(s=s.child;s!==null;){var r=s;switch(r.tag){case 0:case 11:case 14:case 15:Rs(4,r,r.return),Ca(r);break;case 1:Vn(r,r.return);var o=r.stateNode;typeof o.componentWillUnmount=="function"&&Ly(r,r.return,o),Ca(r);break;case 27:vo(r.stateNode);case 26:case 5:Vn(r,r.return),Ca(r);break;case 22:r.memoizedState===null&&Ca(r);break;case 30:Ca(r);break;default:Ca(r)}s=s.sibling}}function cs(s,r,o){for(o=o&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,f=s,g=r,b=g.flags;switch(g.tag){case 0:case 11:case 15:cs(f,g,o),oo(4,g);break;case 1:if(cs(f,g,o),u=g,f=u.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(B){He(u,u.return,B)}if(u=g,f=u.updateQueue,f!==null){var E=u.stateNode;try{var C=f.shared.hiddenCallbacks;if(C!==null)for(f.shared.hiddenCallbacks=null,f=0;f<C.length;f++)jg(C[f],E)}catch(B){He(u,u.return,B)}}o&&b&64&&zy(g),lo(g,g.return);break;case 27:Vy(g);case 26:case 5:cs(f,g,o),o&&u===null&&b&4&&Uy(g),lo(g,g.return);break;case 12:cs(f,g,o);break;case 31:cs(f,g,o),o&&b&4&&Hy(f,g);break;case 13:cs(f,g,o),o&&b&4&&Gy(f,g);break;case 22:g.memoizedState===null&&cs(f,g,o),lo(g,g.return);break;case 30:break;default:cs(f,g,o)}r=r.sibling}}function uh(s,r){var o=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==o&&(s!=null&&s.refCount++,o!=null&&Yi(o))}function dh(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Yi(s))}function kn(s,r,o,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Yy(s,r,o,u),r=r.sibling}function Yy(s,r,o,u){var f=r.flags;switch(r.tag){case 0:case 11:case 15:kn(s,r,o,u),f&2048&&oo(9,r);break;case 1:kn(s,r,o,u);break;case 3:kn(s,r,o,u),f&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Yi(s)));break;case 12:if(f&2048){kn(s,r,o,u),s=r.stateNode;try{var g=r.memoizedProps,b=g.id,E=g.onPostCommit;typeof E=="function"&&E(b,r.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(C){He(r,r.return,C)}}else kn(s,r,o,u);break;case 31:kn(s,r,o,u);break;case 13:kn(s,r,o,u);break;case 23:break;case 22:g=r.stateNode,b=r.alternate,r.memoizedState!==null?g._visibility&2?kn(s,r,o,u):co(s,r):g._visibility&2?kn(s,r,o,u):(g._visibility|=2,Ur(s,r,o,u,(r.subtreeFlags&10256)!==0||!1)),f&2048&&uh(b,r);break;case 24:kn(s,r,o,u),f&2048&&dh(r.alternate,r);break;default:kn(s,r,o,u)}}function Ur(s,r,o,u,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var g=s,b=r,E=o,C=u,B=b.flags;switch(b.tag){case 0:case 11:case 15:Ur(g,b,E,C,f),oo(8,b);break;case 23:break;case 22:var Y=b.stateNode;b.memoizedState!==null?Y._visibility&2?Ur(g,b,E,C,f):co(g,b):(Y._visibility|=2,Ur(g,b,E,C,f)),f&&B&2048&&uh(b.alternate,b);break;case 24:Ur(g,b,E,C,f),f&&B&2048&&dh(b.alternate,b);break;default:Ur(g,b,E,C,f)}r=r.sibling}}function co(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=s,u=r,f=u.flags;switch(u.tag){case 22:co(o,u),f&2048&&uh(u.alternate,u);break;case 24:co(o,u),f&2048&&dh(u.alternate,u);break;default:co(o,u)}r=r.sibling}}var uo=8192;function Pr(s,r,o){if(s.subtreeFlags&uo)for(s=s.child;s!==null;)Xy(s,r,o),s=s.sibling}function Xy(s,r,o){switch(s.tag){case 26:Pr(s,r,o),s.flags&uo&&s.memoizedState!==null&&Jj(o,An,s.memoizedState,s.memoizedProps);break;case 5:Pr(s,r,o);break;case 3:case 4:var u=An;An=xc(s.stateNode.containerInfo),Pr(s,r,o),An=u;break;case 22:s.memoizedState===null&&(u=s.alternate,u!==null&&u.memoizedState!==null?(u=uo,uo=16777216,Pr(s,r,o),uo=u):Pr(s,r,o));break;default:Pr(s,r,o)}}function Wy(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function ho(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var u=r[o];jt=u,Zy(u,s)}Wy(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Jy(s),s=s.sibling}function Jy(s){switch(s.tag){case 0:case 11:case 15:ho(s),s.flags&2048&&Rs(9,s,s.return);break;case 3:ho(s);break;case 12:ho(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,ic(s)):ho(s);break;default:ho(s)}}function ic(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var u=r[o];jt=u,Zy(u,s)}Wy(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Rs(8,r,r.return),ic(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,ic(r));break;default:ic(r)}s=s.sibling}}function Zy(s,r){for(;jt!==null;){var o=jt;switch(o.tag){case 0:case 11:case 15:Rs(8,o,r);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Yi(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,jt=u;else e:for(o=s;jt!==null;){u=jt;var f=u.sibling,g=u.return;if(qy(u),u===o){jt=null;break e}if(f!==null){f.return=g,jt=f;break e}jt=g}}}var hj={getCacheForType:function(s){var r=kt(ut),o=r.data.get(s);return o===void 0&&(o=s(),r.data.set(s,o)),o},cacheSignal:function(){return kt(ut).controller.signal}},fj=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ye=null,Re=null,De=0,$e=0,sn=null,Os=!1,Vr=!1,hh=!1,us=0,at=0,Ds=0,Ra=0,fh=0,an=0,Br=0,fo=null,Wt=null,mh=!1,oc=0,Qy=0,lc=1/0,cc=null,Ms=null,xt=0,zs=null,Ir=null,ds=0,ph=0,gh=null,ev=null,mo=0,yh=null;function rn(){return(Ie&2)!==0&&De!==0?De&-De:R.T!==null?_h():yl()}function tv(){if(an===0)if((De&536870912)===0||Le){var s=Ri;Ri<<=1,(Ri&3932160)===0&&(Ri=262144),an=s}else an=536870912;return s=tn.current,s!==null&&(s.flags|=32),an}function Jt(s,r,o){(s===Ye&&($e===2||$e===9)||s.cancelPendingCommit!==null)&&(qr(s,0),Ls(s,De,an,!1)),ha(s,o),((Ie&2)===0||s!==Ye)&&(s===Ye&&((Ie&2)===0&&(Ra|=o),at===4&&Ls(s,De,an,!1)),Bn(s))}function nv(s,r,o){if((Ie&6)!==0)throw Error(i(327));var u=!o&&(r&127)===0&&(r&s.expiredLanes)===0||da(s,r),f=u?gj(s,r):xh(s,r,!0),g=u;do{if(f===0){Vr&&!u&&Ls(s,r,0,!1);break}else{if(o=s.current.alternate,g&&!mj(o)){f=xh(s,r,!1),g=!1;continue}if(f===2){if(g=r,s.errorRecoveryDisabledLanes&g)var b=0;else b=s.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){r=b;e:{var E=s;f=fo;var C=E.current.memoizedState.isDehydrated;if(C&&(qr(E,b).flags|=256),b=xh(E,b,!1),b!==2){if(hh&&!C){E.errorRecoveryDisabledLanes|=g,Ra|=g,f=4;break e}g=Wt,Wt=f,g!==null&&(Wt===null?Wt=g:Wt.push.apply(Wt,g))}f=b}if(g=!1,f!==2)continue}}if(f===1){qr(s,0),Ls(s,r,0,!0);break}e:{switch(u=s,g=f,g){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:Ls(u,r,an,!Os);break e;case 2:Wt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(f=oc+300-Tt(),10<f)){if(Ls(u,r,an,!Os),ua(u,0,!0)!==0)break e;ds=r,u.timeoutHandle=Dv(sv.bind(null,u,o,Wt,cc,mh,r,an,Ra,Br,Os,g,"Throttled",-0,0),f);break e}sv(u,o,Wt,cc,mh,r,an,Ra,Br,Os,g,null,-0,0)}}break}while(!0);Bn(s)}function sv(s,r,o,u,f,g,b,E,C,B,Y,J,H,G){if(s.timeoutHandle=-1,J=r.subtreeFlags,J&8192||(J&16785408)===16785408){J={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wn},Xy(r,g,J);var oe=(g&62914560)===g?oc-Tt():(g&4194048)===g?Qy-Tt():0;if(oe=Zj(J,oe),oe!==null){ds=g,s.cancelPendingCommit=oe(dv.bind(null,s,r,g,o,u,f,b,E,C,Y,J,null,H,G)),Ls(s,g,b,!B);return}}dv(s,r,g,o,u,f,b,E,C)}function mj(s){for(var r=s;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var f=o[u],g=f.getSnapshot;f=f.value;try{if(!Qt(g(),f))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Ls(s,r,o,u){r&=~fh,r&=~Ra,s.suspendedLanes|=r,s.pingedLanes&=~r,u&&(s.warmLanes|=r),u=s.expirationTimes;for(var f=r;0<f;){var g=31-vt(f),b=1<<g;u[g]=-1,f&=~b}o!==0&&ml(s,o,r)}function uc(){return(Ie&6)===0?(po(0),!1):!0}function vh(){if(Re!==null){if($e===0)var s=Re.return;else s=Re,es=Sa=null,Md(s),Or=null,Wi=0,s=Re;for(;s!==null;)My(s.alternate,s),s=s.return;Re=null}}function qr(s,r){var o=s.timeoutHandle;o!==-1&&(s.timeoutHandle=-1,Mj(o)),o=s.cancelPendingCommit,o!==null&&(s.cancelPendingCommit=null,o()),ds=0,vh(),Ye=s,Re=o=Zn(s.current,null),De=r,$e=0,sn=null,Os=!1,Vr=da(s,r),hh=!1,Br=an=fh=Ra=Ds=at=0,Wt=fo=null,mh=!1,(r&8)!==0&&(r|=r&32);var u=s.entangledLanes;if(u!==0)for(s=s.entanglements,u&=r;0<u;){var f=31-vt(u),g=1<<f;r|=s[f],u&=~g}return us=r,Rl(),o}function av(s,r){Te=null,R.H=ao,r===Rr||r===Vl?(r=bg(),$e=3):r===Sd?(r=bg(),$e=4):$e=r===Wd?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,sn=r,Re===null&&(at=1,Ql(s,mn(r,s.current)))}function rv(){var s=tn.current;return s===null?!0:(De&4194048)===De?vn===null:(De&62914560)===De||(De&536870912)!==0?s===vn:!1}function iv(){var s=R.H;return R.H=ao,s===null?ao:s}function ov(){var s=R.A;return R.A=hj,s}function dc(){at=4,Os||(De&4194048)!==De&&tn.current!==null||(Vr=!0),(Ds&134217727)===0&&(Ra&134217727)===0||Ye===null||Ls(Ye,De,an,!1)}function xh(s,r,o){var u=Ie;Ie|=2;var f=iv(),g=ov();(Ye!==s||De!==r)&&(cc=null,qr(s,r)),r=!1;var b=at;e:do try{if($e!==0&&Re!==null){var E=Re,C=sn;switch($e){case 8:vh(),b=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(r=!0);var B=$e;if($e=0,sn=null,$r(s,E,C,B),o&&Vr){b=0;break e}break;default:B=$e,$e=0,sn=null,$r(s,E,C,B)}}pj(),b=at;break}catch(Y){av(s,Y)}while(!0);return r&&s.shellSuspendCounter++,es=Sa=null,Ie=u,R.H=f,R.A=g,Re===null&&(Ye=null,De=0,Rl()),b}function pj(){for(;Re!==null;)lv(Re)}function gj(s,r){var o=Ie;Ie|=2;var u=iv(),f=ov();Ye!==s||De!==r?(cc=null,lc=Tt()+500,qr(s,r)):Vr=da(s,r);e:do try{if($e!==0&&Re!==null){r=Re;var g=sn;t:switch($e){case 1:$e=0,sn=null,$r(s,r,g,1);break;case 2:case 9:if(vg(g)){$e=0,sn=null,cv(r);break}r=function(){$e!==2&&$e!==9||Ye!==s||($e=7),Bn(s)},g.then(r,r);break e;case 3:$e=7;break e;case 4:$e=5;break e;case 7:vg(g)?($e=0,sn=null,cv(r)):($e=0,sn=null,$r(s,r,g,7));break;case 5:var b=null;switch(Re.tag){case 26:b=Re.memoizedState;case 5:case 27:var E=Re;if(b?Yv(b):E.stateNode.complete){$e=0,sn=null;var C=E.sibling;if(C!==null)Re=C;else{var B=E.return;B!==null?(Re=B,hc(B)):Re=null}break t}}$e=0,sn=null,$r(s,r,g,5);break;case 6:$e=0,sn=null,$r(s,r,g,6);break;case 8:vh(),at=6;break e;default:throw Error(i(462))}}yj();break}catch(Y){av(s,Y)}while(!0);return es=Sa=null,R.H=u,R.A=f,Ie=o,Re!==null?0:(Ye=null,De=0,Rl(),at)}function yj(){for(;Re!==null&&!ll();)lv(Re)}function lv(s){var r=Oy(s.alternate,s,us);s.memoizedProps=s.pendingProps,r===null?hc(s):Re=r}function cv(s){var r=s,o=r.alternate;switch(r.tag){case 15:case 0:r=Ty(o,r,r.pendingProps,r.type,void 0,De);break;case 11:r=Ty(o,r,r.pendingProps,r.type.render,r.ref,De);break;case 5:Md(r);default:My(o,r),r=Re=og(r,us),r=Oy(o,r,us)}s.memoizedProps=s.pendingProps,r===null?hc(s):Re=r}function $r(s,r,o,u){es=Sa=null,Md(r),Or=null,Wi=0;var f=r.return;try{if(rj(s,f,r,o,De)){at=1,Ql(s,mn(o,s.current)),Re=null;return}}catch(g){if(f!==null)throw Re=f,g;at=1,Ql(s,mn(o,s.current)),Re=null;return}r.flags&32768?(Le||u===1?s=!0:Vr||(De&536870912)!==0?s=!1:(Os=s=!0,(u===2||u===9||u===3||u===6)&&(u=tn.current,u!==null&&u.tag===13&&(u.flags|=16384))),uv(r,s)):hc(r)}function hc(s){var r=s;do{if((r.flags&32768)!==0){uv(r,Os);return}s=r.return;var o=lj(r.alternate,r,us);if(o!==null){Re=o;return}if(r=r.sibling,r!==null){Re=r;return}Re=r=s}while(r!==null);at===0&&(at=5)}function uv(s,r){do{var o=cj(s.alternate,s);if(o!==null){o.flags&=32767,Re=o;return}if(o=s.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(s=s.sibling,s!==null)){Re=s;return}Re=s=o}while(s!==null);at=6,Re=null}function dv(s,r,o,u,f,g,b,E,C){s.cancelPendingCommit=null;do fc();while(xt!==0);if((Ie&6)!==0)throw Error(i(327));if(r!==null){if(r===s.current)throw Error(i(177));if(g=r.lanes|r.childLanes,g|=od,Pu(s,o,g,b,E,C),s===Ye&&(Re=Ye=null,De=0),Ir=r,zs=s,ds=o,ph=g,gh=f,ev=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,wj(ca,function(){return gv(),null})):(s.callbackNode=null,s.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=R.T,R.T=null,f=q.p,q.p=2,b=Ie,Ie|=4;try{uj(s,r,o)}finally{Ie=b,q.p=f,R.T=u}}xt=1,hv(),fv(),mv()}}function hv(){if(xt===1){xt=0;var s=zs,r=Ir,o=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||o){o=R.T,R.T=null;var u=q.p;q.p=2;var f=Ie;Ie|=4;try{Fy(r,s);var g=Rh,b=Zp(s.containerInfo),E=g.focusedElem,C=g.selectionRange;if(b!==E&&E&&E.ownerDocument&&Jp(E.ownerDocument.documentElement,E)){if(C!==null&&nd(E)){var B=C.start,Y=C.end;if(Y===void 0&&(Y=B),"selectionStart"in E)E.selectionStart=B,E.selectionEnd=Math.min(Y,E.value.length);else{var J=E.ownerDocument||document,H=J&&J.defaultView||window;if(H.getSelection){var G=H.getSelection(),oe=E.textContent.length,ye=Math.min(C.start,oe),Ke=C.end===void 0?ye:Math.min(C.end,oe);!G.extend&&ye>Ke&&(b=Ke,Ke=ye,ye=b);var L=Wp(E,ye),D=Wp(E,Ke);if(L&&D&&(G.rangeCount!==1||G.anchorNode!==L.node||G.anchorOffset!==L.offset||G.focusNode!==D.node||G.focusOffset!==D.offset)){var V=J.createRange();V.setStart(L.node,L.offset),G.removeAllRanges(),ye>Ke?(G.addRange(V),G.extend(D.node,D.offset)):(V.setEnd(D.node,D.offset),G.addRange(V))}}}}for(J=[],G=E;G=G.parentNode;)G.nodeType===1&&J.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<J.length;E++){var W=J[E];W.element.scrollLeft=W.left,W.element.scrollTop=W.top}}Ec=!!Ch,Rh=Ch=null}finally{Ie=f,q.p=u,R.T=o}}s.current=r,xt=2}}function fv(){if(xt===2){xt=0;var s=zs,r=Ir,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=R.T,R.T=null;var u=q.p;q.p=2;var f=Ie;Ie|=4;try{Iy(s,r.alternate,r)}finally{Ie=f,q.p=u,R.T=o}}xt=3}}function mv(){if(xt===4||xt===3){xt=0,cl();var s=zs,r=Ir,o=ds,u=ev;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?xt=5:(xt=0,Ir=zs=null,pv(s,s.pendingLanes));var f=s.pendingLanes;if(f===0&&(Ms=null),dr(o),r=r.stateNode,Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(bs,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=R.T,f=q.p,q.p=2,R.T=null;try{for(var g=s.onRecoverableError,b=0;b<u.length;b++){var E=u[b];g(E.value,{componentStack:E.stack})}}finally{R.T=r,q.p=f}}(ds&3)!==0&&fc(),Bn(s),f=s.pendingLanes,(o&261930)!==0&&(f&42)!==0?s===yh?mo++:(mo=0,yh=s):mo=0,po(0)}}function pv(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,Yi(r)))}function fc(){return hv(),fv(),mv(),gv()}function gv(){if(xt!==5)return!1;var s=zs,r=ph;ph=0;var o=dr(ds),u=R.T,f=q.p;try{q.p=32>o?32:o,R.T=null,o=gh,gh=null;var g=zs,b=ds;if(xt=0,Ir=zs=null,ds=0,(Ie&6)!==0)throw Error(i(331));var E=Ie;if(Ie|=4,Jy(g.current),Yy(g,g.current,b,o),Ie=E,po(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(bs,g)}catch{}return!0}finally{q.p=f,R.T=u,pv(s,r)}}function yv(s,r,o){r=mn(o,r),r=Xd(s.stateNode,r,2),s=As(s,r,2),s!==null&&(ha(s,2),Bn(s))}function He(s,r,o){if(s.tag===3)yv(s,s,o);else for(;r!==null;){if(r.tag===3){yv(r,s,o);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Ms===null||!Ms.has(u))){s=mn(o,s),o=vy(2),u=As(r,o,2),u!==null&&(xy(o,u,r,s),ha(u,2),Bn(u));break}}r=r.return}}function bh(s,r,o){var u=s.pingCache;if(u===null){u=s.pingCache=new fj;var f=new Set;u.set(r,f)}else f=u.get(r),f===void 0&&(f=new Set,u.set(r,f));f.has(o)||(hh=!0,f.add(o),s=vj.bind(null,s,r,o),r.then(s,s))}function vj(s,r,o){var u=s.pingCache;u!==null&&u.delete(r),s.pingedLanes|=s.suspendedLanes&o,s.warmLanes&=~o,Ye===s&&(De&o)===o&&(at===4||at===3&&(De&62914560)===De&&300>Tt()-oc?(Ie&2)===0&&qr(s,0):fh|=o,Br===De&&(Br=0)),Bn(s)}function vv(s,r){r===0&&(r=fl()),s=xa(s,r),s!==null&&(ha(s,r),Bn(s))}function xj(s){var r=s.memoizedState,o=0;r!==null&&(o=r.retryLane),vv(s,o)}function bj(s,r){var o=0;switch(s.tag){case 31:case 13:var u=s.stateNode,f=s.memoizedState;f!==null&&(o=f.retryLane);break;case 19:u=s.stateNode;break;case 22:u=s.stateNode._retryCache;break;default:throw Error(i(314))}u!==null&&u.delete(r),vv(s,o)}function wj(s,r){return ir(s,r)}var mc=null,Hr=null,wh=!1,pc=!1,Sh=!1,Us=0;function Bn(s){s!==Hr&&s.next===null&&(Hr===null?mc=Hr=s:Hr=Hr.next=s),pc=!0,wh||(wh=!0,_j())}function po(s,r){if(!Sh&&pc){Sh=!0;do for(var o=!1,u=mc;u!==null;){if(s!==0){var f=u.pendingLanes;if(f===0)var g=0;else{var b=u.suspendedLanes,E=u.pingedLanes;g=(1<<31-vt(42|s)+1)-1,g&=f&~(b&~E),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,Sv(u,g))}else g=De,g=ua(u,u===Ye?g:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(g&3)===0||da(u,g)||(o=!0,Sv(u,g));u=u.next}while(o);Sh=!1}}function Sj(){xv()}function xv(){pc=wh=!1;var s=0;Us!==0&&Dj()&&(s=Us);for(var r=Tt(),o=null,u=mc;u!==null;){var f=u.next,g=bv(u,r);g===0?(u.next=null,o===null?mc=f:o.next=f,f===null&&(Hr=o)):(o=u,(s!==0||(g&3)!==0)&&(pc=!0)),u=f}xt!==0&&xt!==5||po(s),Us!==0&&(Us=0)}function bv(s,r){for(var o=s.suspendedLanes,u=s.pingedLanes,f=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var b=31-vt(g),E=1<<b,C=f[b];C===-1?((E&o)===0||(E&u)!==0)&&(f[b]=Uu(E,r)):C<=r&&(s.expiredLanes|=E),g&=~E}if(r=Ye,o=De,o=ua(s,s===r?o:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u=s.callbackNode,o===0||s===r&&($e===2||$e===9)||s.cancelPendingCommit!==null)return u!==null&&u!==null&&or(u),s.callbackNode=null,s.callbackPriority=0;if((o&3)===0||da(s,o)){if(r=o&-o,r===s.callbackPriority)return r;switch(u!==null&&or(u),dr(o)){case 2:case 8:o=Ci;break;case 32:o=ca;break;case 268435456:o=ul;break;default:o=ca}return u=wv.bind(null,s),o=ir(o,u),s.callbackPriority=r,s.callbackNode=o,r}return u!==null&&u!==null&&or(u),s.callbackPriority=2,s.callbackNode=null,2}function wv(s,r){if(xt!==0&&xt!==5)return s.callbackNode=null,s.callbackPriority=0,null;var o=s.callbackNode;if(fc()&&s.callbackNode!==o)return null;var u=De;return u=ua(s,s===Ye?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u===0?null:(nv(s,u,r),bv(s,Tt()),s.callbackNode!=null&&s.callbackNode===o?wv.bind(null,s):null)}function Sv(s,r){if(fc())return null;nv(s,r,!0)}function _j(){zj(function(){(Ie&6)!==0?ir(ki,Sj):xv()})}function _h(){if(Us===0){var s=kr;s===0&&(s=ur,ur<<=1,(ur&261888)===0&&(ur=256)),Us=s}return Us}function _v(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:_l(""+s)}function jv(s,r){var o=r.ownerDocument.createElement("input");return o.name=r.name,o.value=r.value,s.id&&o.setAttribute("form",s.id),r.parentNode.insertBefore(o,r),s=new FormData(s),o.parentNode.removeChild(o),s}function jj(s,r,o,u,f){if(r==="submit"&&o&&o.stateNode===f){var g=_v((f[ne]||null).action),b=u.submitter;b&&(r=(r=b[ne]||null)?_v(r.formAction):b.getAttribute("formAction"),r!==null&&(g=r,b=null));var E=new Nl("action","action",null,u,f);s.push({event:E,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Us!==0){var C=b?jv(f,b):new FormData(f);$d(o,{pending:!0,data:C,method:f.method,action:g},null,C)}}else typeof g=="function"&&(E.preventDefault(),C=b?jv(f,b):new FormData(f),$d(o,{pending:!0,data:C,method:f.method,action:g},g,C))},currentTarget:f}]})}}for(var jh=0;jh<id.length;jh++){var Eh=id[jh],Ej=Eh.toLowerCase(),Tj=Eh[0].toUpperCase()+Eh.slice(1);Nn(Ej,"on"+Tj)}Nn(tg,"onAnimationEnd"),Nn(ng,"onAnimationIteration"),Nn(sg,"onAnimationStart"),Nn("dblclick","onDoubleClick"),Nn("focusin","onFocus"),Nn("focusout","onBlur"),Nn(q_,"onTransitionRun"),Nn($_,"onTransitionStart"),Nn(H_,"onTransitionCancel"),Nn(ag,"onTransitionEnd"),pr("onMouseEnter",["mouseout","mouseover"]),pr("onMouseLeave",["mouseout","mouseover"]),pr("onPointerEnter",["pointerout","pointerover"]),pr("onPointerLeave",["pointerout","pointerover"]),pa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pa("onBeforeInput",["compositionend","keypress","textInput","paste"]),pa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var go="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(" "),Nj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(go));function Ev(s,r){r=(r&4)!==0;for(var o=0;o<s.length;o++){var u=s[o],f=u.event;u=u.listeners;e:{var g=void 0;if(r)for(var b=u.length-1;0<=b;b--){var E=u[b],C=E.instance,B=E.currentTarget;if(E=E.listener,C!==g&&f.isPropagationStopped())break e;g=E,f.currentTarget=B;try{g(f)}catch(Y){Cl(Y)}f.currentTarget=null,g=C}else for(b=0;b<u.length;b++){if(E=u[b],C=E.instance,B=E.currentTarget,E=E.listener,C!==g&&f.isPropagationStopped())break e;g=E,f.currentTarget=B;try{g(f)}catch(Y){Cl(Y)}f.currentTarget=null,g=C}}}}function Oe(s,r){var o=r[Vt];o===void 0&&(o=r[Vt]=new Set);var u=s+"__bubble";o.has(u)||(Tv(r,s,2,!1),o.add(u))}function Th(s,r,o){var u=0;r&&(u|=4),Tv(o,s,u,r)}var gc="_reactListening"+Math.random().toString(36).slice(2);function Nh(s){if(!s[gc]){s[gc]=!0,xp.forEach(function(o){o!=="selectionchange"&&(Nj.has(o)||Th(o,!1,s),Th(o,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[gc]||(r[gc]=!0,Th("selectionchange",!1,r))}}function Tv(s,r,o,u){switch(t0(r)){case 2:var f=tE;break;case 8:f=nE;break;default:f=qh}o=f.bind(null,r,o,s),f=void 0,!Ku||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),u?f!==void 0?s.addEventListener(r,o,{capture:!0,passive:f}):s.addEventListener(r,o,!0):f!==void 0?s.addEventListener(r,o,{passive:f}):s.addEventListener(r,o,!1)}function Ah(s,r,o,u,f){var g=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var b=u.tag;if(b===3||b===4){var E=u.stateNode.containerInfo;if(E===f)break;if(b===4)for(b=u.return;b!==null;){var C=b.tag;if((C===3||C===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;E!==null;){if(b=hr(E),b===null)return;if(C=b.tag,C===5||C===6||C===26||C===27){u=g=b;continue e}E=E.parentNode}}u=u.return}Rp(function(){var B=g,Y=Gu(o),J=[];e:{var H=rg.get(s);if(H!==void 0){var G=Nl,oe=s;switch(s){case"keypress":if(El(o)===0)break e;case"keydown":case"keyup":G=b_;break;case"focusin":oe="focus",G=Ju;break;case"focusout":oe="blur",G=Ju;break;case"beforeblur":case"afterblur":G=Ju;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":G=Mp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=l_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=__;break;case tg:case ng:case sg:G=d_;break;case ag:G=E_;break;case"scroll":case"scrollend":G=i_;break;case"wheel":G=N_;break;case"copy":case"cut":case"paste":G=f_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=Lp;break;case"toggle":case"beforetoggle":G=k_}var ye=(r&4)!==0,Ke=!ye&&(s==="scroll"||s==="scrollend"),L=ye?H!==null?H+"Capture":null:H;ye=[];for(var D=B,V;D!==null;){var W=D;if(V=W.stateNode,W=W.tag,W!==5&&W!==26&&W!==27||V===null||L===null||(W=Ui(D,L),W!=null&&ye.push(yo(D,W,V))),Ke)break;D=D.return}0<ye.length&&(H=new G(H,oe,null,o,Y),J.push({event:H,listeners:ye}))}}if((r&7)===0){e:{if(H=s==="mouseover"||s==="pointerover",G=s==="mouseout"||s==="pointerout",H&&o!==Hu&&(oe=o.relatedTarget||o.fromElement)&&(hr(oe)||oe[ke]))break e;if((G||H)&&(H=Y.window===Y?Y:(H=Y.ownerDocument)?H.defaultView||H.parentWindow:window,G?(oe=o.relatedTarget||o.toElement,G=B,oe=oe?hr(oe):null,oe!==null&&(Ke=d(oe),ye=oe.tag,oe!==Ke||ye!==5&&ye!==27&&ye!==6)&&(oe=null)):(G=null,oe=B),G!==oe)){if(ye=Mp,W="onMouseLeave",L="onMouseEnter",D="mouse",(s==="pointerout"||s==="pointerover")&&(ye=Lp,W="onPointerLeave",L="onPointerEnter",D="pointer"),Ke=G==null?H:Li(G),V=oe==null?H:Li(oe),H=new ye(W,D+"leave",G,o,Y),H.target=Ke,H.relatedTarget=V,W=null,hr(Y)===B&&(ye=new ye(L,D+"enter",oe,o,Y),ye.target=V,ye.relatedTarget=Ke,W=ye),Ke=W,G&&oe)t:{for(ye=Aj,L=G,D=oe,V=0,W=L;W;W=ye(W))V++;W=0;for(var pe=D;pe;pe=ye(pe))W++;for(;0<V-W;)L=ye(L),V--;for(;0<W-V;)D=ye(D),W--;for(;V--;){if(L===D||D!==null&&L===D.alternate){ye=L;break t}L=ye(L),D=ye(D)}ye=null}else ye=null;G!==null&&Nv(J,H,G,ye,!1),oe!==null&&Ke!==null&&Nv(J,Ke,oe,ye,!0)}}e:{if(H=B?Li(B):window,G=H.nodeName&&H.nodeName.toLowerCase(),G==="select"||G==="input"&&H.type==="file")var Pe=Hp;else if(qp(H))if(Gp)Pe=V_;else{Pe=U_;var fe=L_}else G=H.nodeName,!G||G.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?B&&$u(B.elementType)&&(Pe=Hp):Pe=P_;if(Pe&&(Pe=Pe(s,B))){$p(J,Pe,o,Y);break e}fe&&fe(s,H,B),s==="focusout"&&B&&H.type==="number"&&B.memoizedProps.value!=null&&qu(H,"number",H.value)}switch(fe=B?Li(B):window,s){case"focusin":(qp(fe)||fe.contentEditable==="true")&&(wr=fe,sd=B,Gi=null);break;case"focusout":Gi=sd=wr=null;break;case"mousedown":ad=!0;break;case"contextmenu":case"mouseup":case"dragend":ad=!1,Qp(J,o,Y);break;case"selectionchange":if(I_)break;case"keydown":case"keyup":Qp(J,o,Y)}var Ne;if(Qu)e:{switch(s){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else br?Bp(s,o)&&(Me="onCompositionEnd"):s==="keydown"&&o.keyCode===229&&(Me="onCompositionStart");Me&&(Up&&o.locale!=="ko"&&(br||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&br&&(Ne=Op()):(ws=Y,Yu="value"in ws?ws.value:ws.textContent,br=!0)),fe=yc(B,Me),0<fe.length&&(Me=new zp(Me,s,null,o,Y),J.push({event:Me,listeners:fe}),Ne?Me.data=Ne:(Ne=Ip(o),Ne!==null&&(Me.data=Ne)))),(Ne=R_?O_(s,o):D_(s,o))&&(Me=yc(B,"onBeforeInput"),0<Me.length&&(fe=new zp("onBeforeInput","beforeinput",null,o,Y),J.push({event:fe,listeners:Me}),fe.data=Ne)),jj(J,s,B,o,Y)}Ev(J,r)})}function yo(s,r,o){return{instance:s,listener:r,currentTarget:o}}function yc(s,r){for(var o=r+"Capture",u=[];s!==null;){var f=s,g=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||g===null||(f=Ui(s,o),f!=null&&u.unshift(yo(s,f,g)),f=Ui(s,r),f!=null&&u.push(yo(s,f,g))),s.tag===3)return u;s=s.return}return[]}function Aj(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Nv(s,r,o,u,f){for(var g=r._reactName,b=[];o!==null&&o!==u;){var E=o,C=E.alternate,B=E.stateNode;if(E=E.tag,C!==null&&C===u)break;E!==5&&E!==26&&E!==27||B===null||(C=B,f?(B=Ui(o,g),B!=null&&b.unshift(yo(o,B,C))):f||(B=Ui(o,g),B!=null&&b.push(yo(o,B,C)))),o=o.return}b.length!==0&&s.push({event:r,listeners:b})}var kj=/\r\n?/g,Cj=/\u0000|\uFFFD/g;function Av(s){return(typeof s=="string"?s:""+s).replace(kj,`
9
- `).replace(Cj,"")}function kv(s,r){return r=Av(r),Av(s)===r}function Fe(s,r,o,u,f,g){switch(o){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||yr(s,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&yr(s,""+u);break;case"className":wl(s,"class",u);break;case"tabIndex":wl(s,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":wl(s,o,u);break;case"style":kp(s,u,g);break;case"data":if(r!=="object"){wl(s,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||o!=="href")){s.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(o);break}u=_l(""+u),s.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){s.setAttribute(o,"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 g=="function"&&(o==="formAction"?(r!=="input"&&Fe(s,r,"name",f.name,f,null),Fe(s,r,"formEncType",f.formEncType,f,null),Fe(s,r,"formMethod",f.formMethod,f,null),Fe(s,r,"formTarget",f.formTarget,f,null)):(Fe(s,r,"encType",f.encType,f,null),Fe(s,r,"method",f.method,f,null),Fe(s,r,"target",f.target,f,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(o);break}u=_l(""+u),s.setAttribute(o,u);break;case"onClick":u!=null&&(s.onclick=Wn);break;case"onScroll":u!=null&&Oe("scroll",s);break;case"onScrollEnd":u!=null&&Oe("scrollend",s);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(i(61));if(o=u.__html,o!=null){if(f.children!=null)throw Error(i(60));s.innerHTML=o}}break;case"multiple":s.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":s.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){s.removeAttribute("xlink:href");break}o=_l(""+u),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(o,""+u):s.removeAttribute(o);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":u&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(o,""):s.removeAttribute(o);break;case"capture":case"download":u===!0?s.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(o,u):s.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?s.setAttribute(o,u):s.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?s.removeAttribute(o):s.setAttribute(o,u);break;case"popover":Oe("beforetoggle",s),Oe("toggle",s),bl(s,"popover",u);break;case"xlinkActuate":Xn(s,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Xn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Xn(s,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Xn(s,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Xn(s,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Xn(s,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Xn(s,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Xn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Xn(s,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":bl(s,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=a_.get(o)||o,bl(s,o,u))}}function kh(s,r,o,u,f,g){switch(o){case"style":kp(s,u,g);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(i(61));if(o=u.__html,o!=null){if(f.children!=null)throw Error(i(60));s.innerHTML=o}}break;case"children":typeof u=="string"?yr(s,u):(typeof u=="number"||typeof u=="bigint")&&yr(s,""+u);break;case"onScroll":u!=null&&Oe("scroll",s);break;case"onScrollEnd":u!=null&&Oe("scrollend",s);break;case"onClick":u!=null&&(s.onclick=Wn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bp.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(f=o.endsWith("Capture"),r=o.slice(2,f?o.length-7:void 0),g=s[ne]||null,g=g!=null?g[o]:null,typeof g=="function"&&s.removeEventListener(r,g,f),typeof u=="function")){typeof g!="function"&&g!==null&&(o in s?s[o]=null:s.hasAttribute(o)&&s.removeAttribute(o)),s.addEventListener(r,u,f);break e}o in s?s[o]=u:u===!0?s.setAttribute(o,""):bl(s,o,u)}}}function Rt(s,r,o){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",s),Oe("load",s);var u=!1,f=!1,g;for(g in o)if(o.hasOwnProperty(g)){var b=o[g];if(b!=null)switch(g){case"src":u=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Fe(s,r,g,b,o,null)}}f&&Fe(s,r,"srcSet",o.srcSet,o,null),u&&Fe(s,r,"src",o.src,o,null);return;case"input":Oe("invalid",s);var E=g=b=f=null,C=null,B=null;for(u in o)if(o.hasOwnProperty(u)){var Y=o[u];if(Y!=null)switch(u){case"name":f=Y;break;case"type":b=Y;break;case"checked":C=Y;break;case"defaultChecked":B=Y;break;case"value":g=Y;break;case"defaultValue":E=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,r));break;default:Fe(s,r,u,Y,o,null)}}Ep(s,g,E,C,B,b,f,!1);return;case"select":Oe("invalid",s),u=b=g=null;for(f in o)if(o.hasOwnProperty(f)&&(E=o[f],E!=null))switch(f){case"value":g=E;break;case"defaultValue":b=E;break;case"multiple":u=E;default:Fe(s,r,f,E,o,null)}r=g,o=b,s.multiple=!!u,r!=null?gr(s,!!u,r,!1):o!=null&&gr(s,!!u,o,!0);return;case"textarea":Oe("invalid",s),g=f=u=null;for(b in o)if(o.hasOwnProperty(b)&&(E=o[b],E!=null))switch(b){case"value":u=E;break;case"defaultValue":f=E;break;case"children":g=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:Fe(s,r,b,E,o,null)}Np(s,u,f,g);return;case"option":for(C in o)o.hasOwnProperty(C)&&(u=o[C],u!=null)&&(C==="selected"?s.selected=u&&typeof u!="function"&&typeof u!="symbol":Fe(s,r,C,u,o,null));return;case"dialog":Oe("beforetoggle",s),Oe("toggle",s),Oe("cancel",s),Oe("close",s);break;case"iframe":case"object":Oe("load",s);break;case"video":case"audio":for(u=0;u<go.length;u++)Oe(go[u],s);break;case"image":Oe("error",s),Oe("load",s);break;case"details":Oe("toggle",s);break;case"embed":case"source":case"link":Oe("error",s),Oe("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in o)if(o.hasOwnProperty(B)&&(u=o[B],u!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Fe(s,r,B,u,o,null)}return;default:if($u(r)){for(Y in o)o.hasOwnProperty(Y)&&(u=o[Y],u!==void 0&&kh(s,r,Y,u,o,void 0));return}}for(E in o)o.hasOwnProperty(E)&&(u=o[E],u!=null&&Fe(s,r,E,u,o,null))}function Rj(s,r,o,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,g=null,b=null,E=null,C=null,B=null,Y=null;for(G in o){var J=o[G];if(o.hasOwnProperty(G)&&J!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":C=J;default:u.hasOwnProperty(G)||Fe(s,r,G,null,u,J)}}for(var H in u){var G=u[H];if(J=o[H],u.hasOwnProperty(H)&&(G!=null||J!=null))switch(H){case"type":g=G;break;case"name":f=G;break;case"checked":B=G;break;case"defaultChecked":Y=G;break;case"value":b=G;break;case"defaultValue":E=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(i(137,r));break;default:G!==J&&Fe(s,r,H,G,u,J)}}Iu(s,b,E,C,B,Y,g,f);return;case"select":G=b=E=H=null;for(g in o)if(C=o[g],o.hasOwnProperty(g)&&C!=null)switch(g){case"value":break;case"multiple":G=C;default:u.hasOwnProperty(g)||Fe(s,r,g,null,u,C)}for(f in u)if(g=u[f],C=o[f],u.hasOwnProperty(f)&&(g!=null||C!=null))switch(f){case"value":H=g;break;case"defaultValue":E=g;break;case"multiple":b=g;default:g!==C&&Fe(s,r,f,g,u,C)}r=E,o=b,u=G,H!=null?gr(s,!!o,H,!1):!!u!=!!o&&(r!=null?gr(s,!!o,r,!0):gr(s,!!o,o?[]:"",!1));return;case"textarea":G=H=null;for(E in o)if(f=o[E],o.hasOwnProperty(E)&&f!=null&&!u.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Fe(s,r,E,null,u,f)}for(b in u)if(f=u[b],g=o[b],u.hasOwnProperty(b)&&(f!=null||g!=null))switch(b){case"value":H=f;break;case"defaultValue":G=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==g&&Fe(s,r,b,f,u,g)}Tp(s,H,G);return;case"option":for(var oe in o)H=o[oe],o.hasOwnProperty(oe)&&H!=null&&!u.hasOwnProperty(oe)&&(oe==="selected"?s.selected=!1:Fe(s,r,oe,null,u,H));for(C in u)H=u[C],G=o[C],u.hasOwnProperty(C)&&H!==G&&(H!=null||G!=null)&&(C==="selected"?s.selected=H&&typeof H!="function"&&typeof H!="symbol":Fe(s,r,C,H,u,G));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 ye in o)H=o[ye],o.hasOwnProperty(ye)&&H!=null&&!u.hasOwnProperty(ye)&&Fe(s,r,ye,null,u,H);for(B in u)if(H=u[B],G=o[B],u.hasOwnProperty(B)&&H!==G&&(H!=null||G!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(i(137,r));break;default:Fe(s,r,B,H,u,G)}return;default:if($u(r)){for(var Ke in o)H=o[Ke],o.hasOwnProperty(Ke)&&H!==void 0&&!u.hasOwnProperty(Ke)&&kh(s,r,Ke,void 0,u,H);for(Y in u)H=u[Y],G=o[Y],!u.hasOwnProperty(Y)||H===G||H===void 0&&G===void 0||kh(s,r,Y,H,u,G);return}}for(var L in o)H=o[L],o.hasOwnProperty(L)&&H!=null&&!u.hasOwnProperty(L)&&Fe(s,r,L,null,u,H);for(J in u)H=u[J],G=o[J],!u.hasOwnProperty(J)||H===G||H==null&&G==null||Fe(s,r,J,H,u,G)}function Cv(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Oj(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var f=o[u],g=f.transferSize,b=f.initiatorType,E=f.duration;if(g&&E&&Cv(b)){for(b=0,E=f.responseEnd,u+=1;u<o.length;u++){var C=o[u],B=C.startTime;if(B>E)break;var Y=C.transferSize,J=C.initiatorType;Y&&Cv(J)&&(C=C.responseEnd,b+=Y*(C<E?1:(E-B)/(C-B)))}if(--u,r+=8*(g+b)/(f.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Ch=null,Rh=null;function vc(s){return s.nodeType===9?s:s.ownerDocument}function Rv(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ov(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function Oh(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Dh=null;function Dj(){var s=window.event;return s&&s.type==="popstate"?s===Dh?!1:(Dh=s,!0):(Dh=null,!1)}var Dv=typeof setTimeout=="function"?setTimeout:void 0,Mj=typeof clearTimeout=="function"?clearTimeout:void 0,Mv=typeof Promise=="function"?Promise:void 0,zj=typeof queueMicrotask=="function"?queueMicrotask:typeof Mv<"u"?function(s){return Mv.resolve(null).then(s).catch(Lj)}:Dv;function Lj(s){setTimeout(function(){throw s})}function Ps(s){return s==="head"}function zv(s,r){var o=r,u=0;do{var f=o.nextSibling;if(s.removeChild(o),f&&f.nodeType===8)if(o=f.data,o==="/$"||o==="/&"){if(u===0){s.removeChild(f),Yr(r);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")vo(s.ownerDocument.documentElement);else if(o==="head"){o=s.ownerDocument.head,vo(o);for(var g=o.firstChild;g;){var b=g.nextSibling,E=g.nodeName;g[ma]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&g.rel.toLowerCase()==="stylesheet"||o.removeChild(g),g=b}}else o==="body"&&vo(s.ownerDocument.body);o=f}while(o);Yr(r)}function Lv(s,r){var o=s;s=0;do{var u=o.nextSibling;if(o.nodeType===1?r?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(r?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(s===0)break;s--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||s++;o=u}while(o)}function Mh(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Mh(o),zi(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}s.removeChild(o)}}function Uj(s,r,o,u){for(;s.nodeType===1;){var f=o;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(u){if(!s[ma])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(g=s.getAttribute("rel"),g==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(g!==f.rel||s.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||s.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||s.getAttribute("title")!==(f.title==null?null:f.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(g=s.getAttribute("src"),(g!==(f.src==null?null:f.src)||s.getAttribute("type")!==(f.type==null?null:f.type)||s.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&g&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var g=f.name==null?null:""+f.name;if(f.type==="hidden"&&s.getAttribute("name")===g)return s}else return s;if(s=xn(s.nextSibling),s===null)break}return null}function Pj(s,r,o){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=xn(s.nextSibling),s===null))return null;return s}function Uv(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=xn(s.nextSibling),s===null))return null;return s}function zh(s){return s.data==="$?"||s.data==="$~"}function Lh(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function Vj(s,r){var o=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||o.readyState!=="loading")r();else{var u=function(){r(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),s._reactRetry=u}}function xn(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Uh=null;function Pv(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="/$"||o==="/&"){if(r===0)return xn(s.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}s=s.nextSibling}return null}function Vv(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(r===0)return s;r--}else o!=="/$"&&o!=="/&"||r++}s=s.previousSibling}return null}function Bv(s,r,o){switch(r=vc(o),s){case"html":if(s=r.documentElement,!s)throw Error(i(452));return s;case"head":if(s=r.head,!s)throw Error(i(453));return s;case"body":if(s=r.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function vo(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);zi(s)}var bn=new Map,Iv=new Set;function xc(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var hs=q.d;q.d={f:Bj,r:Ij,D:qj,C:$j,L:Hj,m:Gj,X:Kj,S:Fj,M:Yj};function Bj(){var s=hs.f(),r=uc();return s||r}function Ij(s){var r=fr(s);r!==null&&r.tag===5&&r.type==="form"?ay(r):hs.r(s)}var Gr=typeof document>"u"?null:document;function qv(s,r,o){var u=Gr;if(u&&typeof r=="string"&&r){var f=hn(r);f='link[rel="'+s+'"][href="'+f+'"]',typeof o=="string"&&(f+='[crossorigin="'+o+'"]'),Iv.has(f)||(Iv.add(f),s={rel:s,crossOrigin:o,href:r},u.querySelector(f)===null&&(r=u.createElement("link"),Rt(r,"link",s),_t(r),u.head.appendChild(r)))}}function qj(s){hs.D(s),qv("dns-prefetch",s,null)}function $j(s,r){hs.C(s,r),qv("preconnect",s,r)}function Hj(s,r,o){hs.L(s,r,o);var u=Gr;if(u&&s&&r){var f='link[rel="preload"][as="'+hn(r)+'"]';r==="image"&&o&&o.imageSrcSet?(f+='[imagesrcset="'+hn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(f+='[imagesizes="'+hn(o.imageSizes)+'"]')):f+='[href="'+hn(s)+'"]';var g=f;switch(r){case"style":g=Fr(s);break;case"script":g=Kr(s)}bn.has(g)||(s=x({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:s,as:r},o),bn.set(g,s),u.querySelector(f)!==null||r==="style"&&u.querySelector(xo(g))||r==="script"&&u.querySelector(bo(g))||(r=u.createElement("link"),Rt(r,"link",s),_t(r),u.head.appendChild(r)))}}function Gj(s,r){hs.m(s,r);var o=Gr;if(o&&s){var u=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+hn(u)+'"][href="'+hn(s)+'"]',g=f;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Kr(s)}if(!bn.has(g)&&(s=x({rel:"modulepreload",href:s},r),bn.set(g,s),o.querySelector(f)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(bo(g)))return}u=o.createElement("link"),Rt(u,"link",s),_t(u),o.head.appendChild(u)}}}function Fj(s,r,o){hs.S(s,r,o);var u=Gr;if(u&&s){var f=mr(u).hoistableStyles,g=Fr(s);r=r||"default";var b=f.get(g);if(!b){var E={loading:0,preload:null};if(b=u.querySelector(xo(g)))E.loading=5;else{s=x({rel:"stylesheet",href:s,"data-precedence":r},o),(o=bn.get(g))&&Ph(s,o);var C=b=u.createElement("link");_t(C),Rt(C,"link",s),C._p=new Promise(function(B,Y){C.onload=B,C.onerror=Y}),C.addEventListener("load",function(){E.loading|=1}),C.addEventListener("error",function(){E.loading|=2}),E.loading|=4,bc(b,r,u)}b={type:"stylesheet",instance:b,count:1,state:E},f.set(g,b)}}}function Kj(s,r){hs.X(s,r);var o=Gr;if(o&&s){var u=mr(o).hoistableScripts,f=Kr(s),g=u.get(f);g||(g=o.querySelector(bo(f)),g||(s=x({src:s,async:!0},r),(r=bn.get(f))&&Vh(s,r),g=o.createElement("script"),_t(g),Rt(g,"link",s),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(f,g))}}function Yj(s,r){hs.M(s,r);var o=Gr;if(o&&s){var u=mr(o).hoistableScripts,f=Kr(s),g=u.get(f);g||(g=o.querySelector(bo(f)),g||(s=x({src:s,async:!0,type:"module"},r),(r=bn.get(f))&&Vh(s,r),g=o.createElement("script"),_t(g),Rt(g,"link",s),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(f,g))}}function $v(s,r,o,u){var f=(f=je.current)?xc(f):null;if(!f)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(r=Fr(o.href),o=mr(f).hoistableStyles,u=o.get(r),u||(u={type:"style",instance:null,count:0,state:null},o.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){s=Fr(o.href);var g=mr(f).hoistableStyles,b=g.get(s);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,b),(g=f.querySelector(xo(s)))&&!g._p&&(b.instance=g,b.state.loading=5),bn.has(s)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},bn.set(s,o),g||Xj(f,s,o,b.state))),r&&u===null)throw Error(i(528,""));return b}if(r&&u!==null)throw Error(i(529,""));return null;case"script":return r=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Kr(o),o=mr(f).hoistableScripts,u=o.get(r),u||(u={type:"script",instance:null,count:0,state:null},o.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Fr(s){return'href="'+hn(s)+'"'}function xo(s){return'link[rel="stylesheet"]['+s+"]"}function Hv(s){return x({},s,{"data-precedence":s.precedence,precedence:null})}function Xj(s,r,o,u){s.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=s.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),Rt(r,"link",o),_t(r),s.head.appendChild(r))}function Kr(s){return'[src="'+hn(s)+'"]'}function bo(s){return"script[async]"+s}function Gv(s,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var u=s.querySelector('style[data-href~="'+hn(o.href)+'"]');if(u)return r.instance=u,_t(u),u;var f=x({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(s.ownerDocument||s).createElement("style"),_t(u),Rt(u,"style",f),bc(u,o.precedence,s),r.instance=u;case"stylesheet":f=Fr(o.href);var g=s.querySelector(xo(f));if(g)return r.state.loading|=4,r.instance=g,_t(g),g;u=Hv(o),(f=bn.get(f))&&Ph(u,f),g=(s.ownerDocument||s).createElement("link"),_t(g);var b=g;return b._p=new Promise(function(E,C){b.onload=E,b.onerror=C}),Rt(g,"link",u),r.state.loading|=4,bc(g,o.precedence,s),r.instance=g;case"script":return g=Kr(o.src),(f=s.querySelector(bo(g)))?(r.instance=f,_t(f),f):(u=o,(f=bn.get(g))&&(u=x({},o),Vh(u,f)),s=s.ownerDocument||s,f=s.createElement("script"),_t(f),Rt(f,"link",u),s.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,bc(u,o.precedence,s));return r.instance}function bc(s,r,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=u.length?u[u.length-1]:null,g=f,b=0;b<u.length;b++){var E=u[b];if(E.dataset.precedence===r)g=E;else if(g!==f)break}g?g.parentNode.insertBefore(s,g.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(s,r.firstChild))}function Ph(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Vh(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var wc=null;function Fv(s,r,o){if(wc===null){var u=new Map,f=wc=new Map;f.set(o,u)}else f=wc,u=f.get(o),u||(u=new Map,f.set(o,u));if(u.has(s))return u;for(u.set(s,null),o=o.getElementsByTagName(s),f=0;f<o.length;f++){var g=o[f];if(!(g[ma]||g[$]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var b=g.getAttribute(r)||"";b=s+b;var E=u.get(b);E?E.push(g):u.set(b,[g])}}return u}function Kv(s,r,o){s=s.ownerDocument||s,s.head.insertBefore(o,r==="title"?s.querySelector("head > title"):null)}function Wj(s,r,o){if(o===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(s=r.disabled,typeof r.precedence=="string"&&s==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Yv(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Jj(s,r,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var f=Fr(u.href),g=r.querySelector(xo(f));if(g){r=g._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=Sc.bind(s),r.then(s,s)),o.state.loading|=4,o.instance=g,_t(g);return}g=r.ownerDocument||r,u=Hv(u),(f=bn.get(f))&&Ph(u,f),g=g.createElement("link"),_t(g);var b=g;b._p=new Promise(function(E,C){b.onload=E,b.onerror=C}),Rt(g,"link",u),o.instance=g}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(o,r),(r=o.state.preload)&&(o.state.loading&3)===0&&(s.count++,o=Sc.bind(s),r.addEventListener("load",o),r.addEventListener("error",o))}}var Bh=0;function Zj(s,r){return s.stylesheets&&s.count===0&&jc(s,s.stylesheets),0<s.count||0<s.imgCount?function(o){var u=setTimeout(function(){if(s.stylesheets&&jc(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+r);0<s.imgBytes&&Bh===0&&(Bh=62500*Oj());var f=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&jc(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>Bh?50:800)+r);return s.unsuspend=o,function(){s.unsuspend=null,clearTimeout(u),clearTimeout(f)}}:null}function Sc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var _c=null;function jc(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,_c=new Map,r.forEach(Qj,s),_c=null,Sc.call(s))}function Qj(s,r){if(!(r.state.loading&4)){var o=_c.get(s);if(o)var u=o.get(null);else{o=new Map,_c.set(s,o);for(var f=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<f.length;g++){var b=f[g];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(o.set(b.dataset.precedence,b),u=b)}u&&o.set(null,u)}f=r.instance,b=f.getAttribute("data-precedence"),g=o.get(b)||u,g===u&&o.set(null,f),o.set(b,f),this.count++,u=Sc.bind(this),f.addEventListener("load",u),f.addEventListener("error",u),g?g.parentNode.insertBefore(f,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(f,s.firstChild)),r.state.loading|=4}}var wo={$$typeof:k,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function eE(s,r,o,u,f,g,b,E,C){this.tag=1,this.containerInfo=s,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=Di(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Di(0),this.hiddenUpdates=Di(null),this.identifierPrefix=u,this.onUncaughtError=f,this.onCaughtError=g,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.incompleteTransitions=new Map}function Xv(s,r,o,u,f,g,b,E,C,B,Y,J){return s=new eE(s,r,o,b,C,B,Y,J,E),r=1,g===!0&&(r|=24),g=en(3,null,null,r),s.current=g,g.stateNode=s,r=xd(),r.refCount++,s.pooledCache=r,r.refCount++,g.memoizedState={element:u,isDehydrated:o,cache:r},_d(g),s}function Wv(s){return s?(s=jr,s):jr}function Jv(s,r,o,u,f,g){f=Wv(f),u.context===null?u.context=f:u.pendingContext=f,u=Ns(r),u.payload={element:o},g=g===void 0?null:g,g!==null&&(u.callback=g),o=As(s,u,r),o!==null&&(Jt(o,s,r),Zi(o,s,r))}function Zv(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var o=s.retryLane;s.retryLane=o!==0&&o<r?o:r}}function Ih(s,r){Zv(s,r),(s=s.alternate)&&Zv(s,r)}function Qv(s){if(s.tag===13||s.tag===31){var r=xa(s,67108864);r!==null&&Jt(r,s,67108864),Ih(s,67108864)}}function e0(s){if(s.tag===13||s.tag===31){var r=rn();r=Mi(r);var o=xa(s,r);o!==null&&Jt(o,s,r),Ih(s,r)}}var Ec=!0;function tE(s,r,o,u){var f=R.T;R.T=null;var g=q.p;try{q.p=2,qh(s,r,o,u)}finally{q.p=g,R.T=f}}function nE(s,r,o,u){var f=R.T;R.T=null;var g=q.p;try{q.p=8,qh(s,r,o,u)}finally{q.p=g,R.T=f}}function qh(s,r,o,u){if(Ec){var f=$h(u);if(f===null)Ah(s,r,u,Tc,o),n0(s,u);else if(aE(f,s,r,o,u))u.stopPropagation();else if(n0(s,u),r&4&&-1<sE.indexOf(s)){for(;f!==null;){var g=fr(f);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var b=Pt(g.pendingLanes);if(b!==0){var E=g;for(E.pendingLanes|=2,E.entangledLanes|=2;b;){var C=1<<31-vt(b);E.entanglements[1]|=C,b&=~C}Bn(g),(Ie&6)===0&&(lc=Tt()+500,po(0))}}break;case 31:case 13:E=xa(g,2),E!==null&&Jt(E,g,2),uc(),Ih(g,2)}if(g=$h(u),g===null&&Ah(s,r,u,Tc,o),g===f)break;f=g}f!==null&&u.stopPropagation()}else Ah(s,r,u,null,o)}}function $h(s){return s=Gu(s),Hh(s)}var Tc=null;function Hh(s){if(Tc=null,s=hr(s),s!==null){var r=d(s);if(r===null)s=null;else{var o=r.tag;if(o===13){if(s=h(r),s!==null)return s;s=null}else if(o===31){if(s=m(r),s!==null)return s;s=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return Tc=s,null}function t0(s){switch(s){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(lr()){case ki:return 2;case Ci:return 8;case ca:case Kn:return 32;case ul:return 268435456;default:return 32}default:return 32}}var Gh=!1,Vs=null,Bs=null,Is=null,So=new Map,_o=new Map,qs=[],sE="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 n0(s,r){switch(s){case"focusin":case"focusout":Vs=null;break;case"dragenter":case"dragleave":Bs=null;break;case"mouseover":case"mouseout":Is=null;break;case"pointerover":case"pointerout":So.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":_o.delete(r.pointerId)}}function jo(s,r,o,u,f,g){return s===null||s.nativeEvent!==g?(s={blockedOn:r,domEventName:o,eventSystemFlags:u,nativeEvent:g,targetContainers:[f]},r!==null&&(r=fr(r),r!==null&&Qv(r)),s):(s.eventSystemFlags|=u,r=s.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),s)}function aE(s,r,o,u,f){switch(r){case"focusin":return Vs=jo(Vs,s,r,o,u,f),!0;case"dragenter":return Bs=jo(Bs,s,r,o,u,f),!0;case"mouseover":return Is=jo(Is,s,r,o,u,f),!0;case"pointerover":var g=f.pointerId;return So.set(g,jo(So.get(g)||null,s,r,o,u,f)),!0;case"gotpointercapture":return g=f.pointerId,_o.set(g,jo(_o.get(g)||null,s,r,o,u,f)),!0}return!1}function s0(s){var r=hr(s.target);if(r!==null){var o=d(r);if(o!==null){if(r=o.tag,r===13){if(r=h(o),r!==null){s.blockedOn=r,vl(s.priority,function(){e0(o)});return}}else if(r===31){if(r=m(o),r!==null){s.blockedOn=r,vl(s.priority,function(){e0(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){s.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Nc(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var o=$h(s.nativeEvent);if(o===null){o=s.nativeEvent;var u=new o.constructor(o.type,o);Hu=u,o.target.dispatchEvent(u),Hu=null}else return r=fr(o),r!==null&&Qv(r),s.blockedOn=o,!1;r.shift()}return!0}function a0(s,r,o){Nc(s)&&o.delete(r)}function rE(){Gh=!1,Vs!==null&&Nc(Vs)&&(Vs=null),Bs!==null&&Nc(Bs)&&(Bs=null),Is!==null&&Nc(Is)&&(Is=null),So.forEach(a0),_o.forEach(a0)}function Ac(s,r){s.blockedOn===r&&(s.blockedOn=null,Gh||(Gh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,rE)))}var kc=null;function r0(s){kc!==s&&(kc=s,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){kc===s&&(kc=null);for(var r=0;r<s.length;r+=3){var o=s[r],u=s[r+1],f=s[r+2];if(typeof u!="function"){if(Hh(u||o)===null)continue;break}var g=fr(o);g!==null&&(s.splice(r,3),r-=3,$d(g,{pending:!0,data:f,method:o.method,action:u},u,f))}}))}function Yr(s){function r(C){return Ac(C,s)}Vs!==null&&Ac(Vs,s),Bs!==null&&Ac(Bs,s),Is!==null&&Ac(Is,s),So.forEach(r),_o.forEach(r);for(var o=0;o<qs.length;o++){var u=qs[o];u.blockedOn===s&&(u.blockedOn=null)}for(;0<qs.length&&(o=qs[0],o.blockedOn===null);)s0(o),o.blockedOn===null&&qs.shift();if(o=(s.ownerDocument||s).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var f=o[u],g=o[u+1],b=f[ne]||null;if(typeof g=="function")b||r0(o);else if(b){var E=null;if(g&&g.hasAttribute("formAction")){if(f=g,b=g[ne]||null)E=b.formAction;else if(Hh(f)!==null)continue}else E=b.action;typeof E=="function"?o[u+1]=E:(o.splice(u,3),u-=3),r0(o)}}}function i0(){function s(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(b){return f=b})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,f=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Fh(s){this._internalRoot=s}Cc.prototype.render=Fh.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var o=r.current,u=rn();Jv(o,u,s,r,null,null)},Cc.prototype.unmount=Fh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;Jv(s.current,2,null,s,null,null),uc(),r[ke]=null}};function Cc(s){this._internalRoot=s}Cc.prototype.unstable_scheduleHydration=function(s){if(s){var r=yl();s={blockedOn:null,target:s,priority:r};for(var o=0;o<qs.length&&r!==0&&r<qs[o].priority;o++);qs.splice(o,0,s),o===0&&s0(s)}};var o0=e.version;if(o0!=="19.2.3")throw Error(i(527,o0,"19.2.3"));q.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=y(r),s=s!==null?v(s):null,s=s===null?null:s.stateNode,s};var iE={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rc.isDisabled&&Rc.supportsFiber)try{bs=Rc.inject(iE),Nt=Rc}catch{}}return To.createRoot=function(s,r){if(!l(s))throw Error(i(299));var o=!1,u="",f=my,g=py,b=gy;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(g=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError)),r=Xv(s,1,!1,null,null,o,u,null,f,g,b,i0),s[ke]=r.current,Nh(s),new Fh(r)},To.hydrateRoot=function(s,r,o){if(!l(s))throw Error(i(299));var u=!1,f="",g=my,b=py,E=gy,C=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(f=o.identifierPrefix),o.onUncaughtError!==void 0&&(g=o.onUncaughtError),o.onCaughtError!==void 0&&(b=o.onCaughtError),o.onRecoverableError!==void 0&&(E=o.onRecoverableError),o.formState!==void 0&&(C=o.formState)),r=Xv(s,1,!0,r,o??null,u,f,C,g,b,E,i0),r.context=Wv(null),o=r.current,u=rn(),u=Mi(u),f=Ns(u),f.callback=null,As(o,f,u),o=u,r.current.lanes=o,ha(r,o),Bn(r),s[ke]=r.current,Nh(s),new Cc(r)},To.version="19.2.3",To}var y0;function gE(){if(y0)return Xh.exports;y0=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Xh.exports=pE(),Xh.exports}var yE=gE();const vE=jm(yE);const xE=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bE=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,a,i)=>i?i.toUpperCase():a.toLowerCase()),v0=n=>{const e=bE(n);return e.charAt(0).toUpperCase()+e.slice(1)},Rb=(...n)=>n.filter((e,a,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===a).join(" ").trim(),wE=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var SE={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 _E=S.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:l="",children:d,iconNode:h,...m},p)=>S.createElement("svg",{ref:p,...SE,width:e,height:e,stroke:n,strokeWidth:i?Number(a)*24/Number(e):a,className:Rb("lucide",l),...!d&&!wE(m)&&{"aria-hidden":"true"},...m},[...h.map(([y,v])=>S.createElement(y,v)),...Array.isArray(d)?d:[d]]));const re=(n,e)=>{const a=S.forwardRef(({className:i,...l},d)=>S.createElement(_E,{ref:d,iconNode:e,className:Rb(`lucide-${xE(v0(n))}`,`lucide-${n}`,i),...l}));return a.displayName=v0(n),a};const jE=[["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"}]],EE=re("activity",jE);const TE=[["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"}]],NE=re("archive",TE);const AE=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],kE=re("arrow-down",AE);const CE=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Ob=re("arrow-left",CE);const RE=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],OE=re("arrow-up",RE);const DE=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],ME=re("boxes",DE);const zE=[["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"}]],Vo=re("brain",zE);const LE=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],UE=re("briefcase",LE);const PE=[["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"}]],VE=re("calendar",PE);const BE=[["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"}]],IE=re("camera",BE);const qE=[["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"}]],Db=re("chart-column",qE);const $E=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ks=re("check",$E);const HE=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mb=re("chevron-down",HE);const GE=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],FE=re("chevron-left",GE);const KE=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],au=re("chevron-right",KE);const YE=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],XE=re("chevron-up",YE);const WE=[["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"}]],Fn=re("circle-alert",WE);const JE=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ru=re("circle-check-big",JE);const ZE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Nm=re("circle-check",ZE);const QE=[["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"}]],eT=re("circle-user",QE);const tT=[["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"}]],nT=re("circle-x",tT);const sT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Qa=re("clock",sT);const aT=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],ps=re("code",aT);const rT=[["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"}]],Su=re("cpu",rT);const iT=[["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"}]],fi=re("database",iT);const oT=[["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"}]],Bo=re("external-link",oT);const lT=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],cT=re("eye-off",lT);const uT=[["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"}]],zb=re("eye",uT);const dT=[["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"}]],hT=re("flag",dT);const fT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],mT=re("globe",fT);const pT=[["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"}]],gT=re("hash",pT);const yT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],vi=re("info",yT);const vT=[["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"}]],x0=re("key-round",vT);const xT=[["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"}]],Am=re("key",xT);const bT=[["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"}]],wT=re("layout-dashboard",bT);const ST=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Lt=re("loader-circle",ST);const _T=[["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"}]],jT=re("log-in",_T);const ET=[["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"}]],TT=re("log-out",ET);const NT=[["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"}]],Io=re("mail",NT);const AT=[["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"}]],kT=re("minimize-2",AT);const CT=[["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"}]],RT=re("moon",CT);const OT=[["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"}]],Lb=re("paperclip",OT);const DT=[["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"}]],MT=re("pen",DT);const zT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],qa=re("plus",zT);const LT=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Ub=re("power",LT);const UT=[["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"}]],Zt=re("refresh-cw",UT);const PT=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],VT=re("rocket",PT);const BT=[["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"}]],Pb=re("rotate-ccw",BT);const IT=[["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"}]],qT=re("save",IT);const $T=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],HT=re("search",$T);const GT=[["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"}]],FT=re("send",GT);const KT=[["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"}]],qo=re("settings",KT);const YT=[["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"}]],XT=re("settings-2",YT);const WT=[["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"}]],Vb=re("shield-check",WT);const JT=[["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"}]],Bb=re("shield",JT);const ZT=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Jc=re("sparkles",ZT);const QT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],eN=re("square",QT);const tN=[["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"}]],nN=re("sun",tN);const sN=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],iu=re("terminal",sN);const aN=[["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"}]],_u=re("trash-2",aN);const rN=[["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"}]],xi=re("triangle-alert",rN);const iN=[["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"}]],oN=re("upload",iN);const lN=[["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"}]],cN=re("user-plus",lN);const uN=[["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"}]],Ib=re("user",uN);const dN=[["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"}]],hN=re("volume-2",dN);const fN=[["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"}]],mN=re("volume-x",fN);const pN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ra=re("x",pN);const gN=[["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"}]],ou=re("zap",gN),yN={theme:"system",setTheme:()=>null},qb=S.createContext(yN);function vN({children:n,defaultTheme:e="system",storageKey:a="vite-ui-theme"}){const[i,l]=S.useState(()=>localStorage.getItem(a)||e);S.useEffect(()=>{const h=window.document.documentElement;if(h.classList.remove("light","dark"),i==="system"){const m=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";h.classList.add(m);return}h.classList.add(i)},[i]);const d={theme:i,setTheme:h=>{localStorage.setItem(a,h),l(h)}};return c.jsx(qb.Provider,{value:d,children:n})}const xN=()=>{const n=S.useContext(qb);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n};function b0(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function ju(...n){return e=>{let a=!1;const i=n.map(l=>{const d=b0(l,e);return!a&&typeof d=="function"&&(a=!0),d});if(a)return()=>{for(let l=0;l<i.length;l++){const d=i[l];typeof d=="function"?d():b0(n[l],null)}}}}function sr(...n){return S.useCallback(ju(...n),n)}var bN=Symbol.for("react.lazy"),lu=Tm[" use ".trim().toString()];function wN(n){return typeof n=="object"&&n!==null&&"then"in n}function $b(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===bN&&"_payload"in n&&wN(n._payload)}function Hb(n){const e=_N(n),a=S.forwardRef((i,l)=>{let{children:d,...h}=i;$b(d)&&typeof lu=="function"&&(d=lu(d._payload));const m=S.Children.toArray(d),p=m.find(EN);if(p){const y=p.props.children,v=m.map(x=>x===p?S.Children.count(y)>1?S.Children.only(null):S.isValidElement(y)?y.props.children:null:x);return c.jsx(e,{...h,ref:l,children:S.isValidElement(y)?S.cloneElement(y,void 0,v):null})}return c.jsx(e,{...h,ref:l,children:d})});return a.displayName=`${n}.Slot`,a}var SN=Hb("Slot");function _N(n){const e=S.forwardRef((a,i)=>{let{children:l,...d}=a;if($b(l)&&typeof lu=="function"&&(l=lu(l._payload)),S.isValidElement(l)){const h=NN(l),m=TN(d,l.props);return l.type!==S.Fragment&&(m.ref=i?ju(i,h):h),S.cloneElement(l,m)}return S.Children.count(l)>1?S.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var jN=Symbol("radix.slottable");function EN(n){return S.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===jN}function TN(n,e){const a={...e};for(const i in e){const l=n[i],d=e[i];/^on[A-Z]/.test(i)?l&&d?a[i]=(...m)=>{const p=d(...m);return l(...m),p}:l&&(a[i]=l):i==="style"?a[i]={...l,...d}:i==="className"&&(a[i]=[l,d].filter(Boolean).join(" "))}return{...n,...a}}function NN(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,a=e&&"isReactWarning"in e&&e.isReactWarning;return a?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,a=e&&"isReactWarning"in e&&e.isReactWarning,a?n.props.ref:n.props.ref||n.ref)}function Gb(n){var e,a,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var l=n.length;for(e=0;e<l;e++)n[e]&&(a=Gb(n[e]))&&(i&&(i+=" "),i+=a)}else for(a in n)n[a]&&(i&&(i+=" "),i+=a);return i}function Fb(){for(var n,e,a=0,i="",l=arguments.length;a<l;a++)(n=arguments[a])&&(e=Gb(n))&&(i&&(i+=" "),i+=e);return i}const w0=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,S0=Fb,Kb=(n,e)=>a=>{var i;if(e?.variants==null)return S0(n,a?.class,a?.className);const{variants:l,defaultVariants:d}=e,h=Object.keys(l).map(y=>{const v=a?.[y],x=d?.[y];if(v===null)return null;const w=w0(v)||w0(x);return l[y][w]}),m=a&&Object.entries(a).reduce((y,v)=>{let[x,w]=v;return w===void 0||(y[x]=w),y},{}),p=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((y,v)=>{let{class:x,className:w,...j}=v;return Object.entries(j).every(_=>{let[T,N]=_;return Array.isArray(N)?N.includes({...d,...m}[T]):{...d,...m}[T]===N})?[...y,x,w]:y},[]);return S0(n,h,p,a?.class,a?.className)},AN=(n,e)=>{const a=new Array(n.length+e.length);for(let i=0;i<n.length;i++)a[i]=n[i];for(let i=0;i<e.length;i++)a[n.length+i]=e[i];return a},kN=(n,e)=>({classGroupId:n,validator:e}),Yb=(n=new Map,e=null,a)=>({nextPart:n,validators:e,classGroupId:a}),cu="-",_0=[],CN="arbitrary..",RN=n=>{const e=DN(n),{conflictingClassGroups:a,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return ON(h);const m=h.split(cu),p=m[0]===""&&m.length>1?1:0;return Xb(m,p,e)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=i[h],y=a[h];return p?y?AN(y,p):p:y||_0}return a[h]||_0}}},Xb=(n,e,a)=>{if(n.length-e===0)return a.classGroupId;const l=n[e],d=a.nextPart.get(l);if(d){const y=Xb(n,e+1,d);if(y)return y}const h=a.validators;if(h===null)return;const m=e===0?n.join(cu):n.slice(e).join(cu),p=h.length;for(let y=0;y<p;y++){const v=h[y];if(v.validator(m))return v.classGroupId}},ON=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),a=e.indexOf(":"),i=e.slice(0,a);return i?CN+i:void 0})(),DN=n=>{const{theme:e,classGroups:a}=n;return MN(a,e)},MN=(n,e)=>{const a=Yb();for(const i in n){const l=n[i];km(l,a,i,e)}return a},km=(n,e,a,i)=>{const l=n.length;for(let d=0;d<l;d++){const h=n[d];zN(h,e,a,i)}},zN=(n,e,a,i)=>{if(typeof n=="string"){LN(n,e,a);return}if(typeof n=="function"){UN(n,e,a,i);return}PN(n,e,a,i)},LN=(n,e,a)=>{const i=n===""?e:Wb(e,n);i.classGroupId=a},UN=(n,e,a,i)=>{if(VN(n)){km(n(i),e,a,i);return}e.validators===null&&(e.validators=[]),e.validators.push(kN(a,n))},PN=(n,e,a,i)=>{const l=Object.entries(n),d=l.length;for(let h=0;h<d;h++){const[m,p]=l[h];km(p,Wb(e,m),a,i)}},Wb=(n,e)=>{let a=n;const i=e.split(cu),l=i.length;for(let d=0;d<l;d++){const h=i[d];let m=a.nextPart.get(h);m||(m=Yb(),a.nextPart.set(h,m)),a=m}return a},VN=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,BN=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,a=Object.create(null),i=Object.create(null);const l=(d,h)=>{a[d]=h,e++,e>n&&(e=0,i=a,a=Object.create(null))};return{get(d){let h=a[d];if(h!==void 0)return h;if((h=i[d])!==void 0)return l(d,h),h},set(d,h){d in a?a[d]=h:l(d,h)}}},Uf="!",j0=":",IN=[],E0=(n,e,a,i,l)=>({modifiers:n,hasImportantModifier:e,baseClassName:a,maybePostfixModifierPosition:i,isExternal:l}),qN=n=>{const{prefix:e,experimentalParseClassName:a}=n;let i=l=>{const d=[];let h=0,m=0,p=0,y;const v=l.length;for(let T=0;T<v;T++){const N=l[T];if(h===0&&m===0){if(N===j0){d.push(l.slice(p,T)),p=T+1;continue}if(N==="/"){y=T;continue}}N==="["?h++:N==="]"?h--:N==="("?m++:N===")"&&m--}const x=d.length===0?l:l.slice(p);let w=x,j=!1;x.endsWith(Uf)?(w=x.slice(0,-1),j=!0):x.startsWith(Uf)&&(w=x.slice(1),j=!0);const _=y&&y>p?y-p:void 0;return E0(d,j,w,_)};if(e){const l=e+j0,d=i;i=h=>h.startsWith(l)?d(h.slice(l.length)):E0(IN,!1,h,void 0,!0)}if(a){const l=i;i=d=>a({className:d,parseClassName:l})}return i},$N=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((a,i)=>{e.set(a,1e6+i)}),a=>{const i=[];let l=[];for(let d=0;d<a.length;d++){const h=a[d],m=h[0]==="[",p=e.has(h);m||p?(l.length>0&&(l.sort(),i.push(...l),l=[]),i.push(h)):l.push(h)}return l.length>0&&(l.sort(),i.push(...l)),i}},HN=n=>({cache:BN(n.cacheSize),parseClassName:qN(n),sortModifiers:$N(n),...RN(n)}),GN=/\s+/,FN=(n,e)=>{const{parseClassName:a,getClassGroupId:i,getConflictingClassGroupIds:l,sortModifiers:d}=e,h=[],m=n.trim().split(GN);let p="";for(let y=m.length-1;y>=0;y-=1){const v=m[y],{isExternal:x,modifiers:w,hasImportantModifier:j,baseClassName:_,maybePostfixModifierPosition:T}=a(v);if(x){p=v+(p.length>0?" "+p:p);continue}let N=!!T,A=i(N?_.substring(0,T):_);if(!A){if(!N){p=v+(p.length>0?" "+p:p);continue}if(A=i(_),!A){p=v+(p.length>0?" "+p:p);continue}N=!1}const M=w.length===0?"":w.length===1?w[0]:d(w).join(":"),k=j?M+Uf:M,U=k+A;if(h.indexOf(U)>-1)continue;h.push(U);const F=l(A,N);for(let K=0;K<F.length;++K){const P=F[K];h.push(k+P)}p=v+(p.length>0?" "+p:p)}return p},KN=(...n)=>{let e=0,a,i,l="";for(;e<n.length;)(a=n[e++])&&(i=Jb(a))&&(l&&(l+=" "),l+=i);return l},Jb=n=>{if(typeof n=="string")return n;let e,a="";for(let i=0;i<n.length;i++)n[i]&&(e=Jb(n[i]))&&(a&&(a+=" "),a+=e);return a},YN=(n,...e)=>{let a,i,l,d;const h=p=>{const y=e.reduce((v,x)=>x(v),n());return a=HN(y),i=a.cache.get,l=a.cache.set,d=m,m(p)},m=p=>{const y=i(p);if(y)return y;const v=FN(p,a);return l(p,v),v};return d=h,(...p)=>d(KN(...p))},XN=[],bt=n=>{const e=a=>a[n]||XN;return e.isThemeGetter=!0,e},Zb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,WN=/^\d+\/\d+$/,JN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZN=/\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$/,QN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,e2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,t2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xr=n=>WN.test(n),Ce=n=>!!n&&!Number.isNaN(Number(n)),Hs=n=>!!n&&Number.isInteger(Number(n)),Qh=n=>n.endsWith("%")&&Ce(n.slice(0,-1)),fs=n=>JN.test(n),n2=()=>!0,s2=n=>ZN.test(n)&&!QN.test(n),ew=()=>!1,a2=n=>e2.test(n),r2=n=>t2.test(n),i2=n=>!le(n)&&!ce(n),o2=n=>wi(n,sw,ew),le=n=>Zb.test(n),Oa=n=>wi(n,aw,s2),ef=n=>wi(n,h2,Ce),T0=n=>wi(n,tw,ew),l2=n=>wi(n,nw,r2),Oc=n=>wi(n,rw,a2),ce=n=>Qb.test(n),No=n=>Si(n,aw),c2=n=>Si(n,f2),N0=n=>Si(n,tw),u2=n=>Si(n,sw),d2=n=>Si(n,nw),Dc=n=>Si(n,rw,!0),wi=(n,e,a)=>{const i=Zb.exec(n);return i?i[1]?e(i[1]):a(i[2]):!1},Si=(n,e,a=!1)=>{const i=Qb.exec(n);return i?i[1]?e(i[1]):a:!1},tw=n=>n==="position"||n==="percentage",nw=n=>n==="image"||n==="url",sw=n=>n==="length"||n==="size"||n==="bg-size",aw=n=>n==="length",h2=n=>n==="number",f2=n=>n==="family-name",rw=n=>n==="shadow",m2=()=>{const n=bt("color"),e=bt("font"),a=bt("text"),i=bt("font-weight"),l=bt("tracking"),d=bt("leading"),h=bt("breakpoint"),m=bt("container"),p=bt("spacing"),y=bt("radius"),v=bt("shadow"),x=bt("inset-shadow"),w=bt("text-shadow"),j=bt("drop-shadow"),_=bt("blur"),T=bt("perspective"),N=bt("aspect"),A=bt("ease"),M=bt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...U(),ce,le],K=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],z=()=>[ce,le,p],Z=()=>[Xr,"full","auto",...z()],ie=()=>[Hs,"none","subgrid",ce,le],be=()=>["auto",{span:["full",Hs,ce,le]},Hs,ce,le],de=()=>[Hs,"auto",ce,le],qe=()=>["auto","min","max","fr",ce,le],Be=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...z()],q=()=>[Xr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],I=()=>[n,ce,le],he=()=>[...U(),N0,T0,{position:[ce,le]}],_e=()=>["no-repeat",{repeat:["","x","y","space","round"]}],O=()=>["auto","cover","contain",u2,o2,{size:[ce,le]}],X=()=>[Qh,No,Oa],Q=()=>["","none","full",y,ce,le],se=()=>["",Ce,No,Oa],we=()=>["solid","dashed","dotted","double"],je=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ge=()=>[Ce,Qh,N0,T0],ot=()=>["","none",_,ce,le],Ue=()=>["none",Ce,ce,le],un=()=>["none",Ce,ce,le],Gt=()=>[Ce,ce,le],Et=()=>[Xr,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fs],breakpoint:[fs],color:[n2],container:[fs],"drop-shadow":[fs],ease:["in","out","in-out"],font:[i2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fs],shadow:[fs],spacing:["px",Ce],text:[fs],"text-shadow":[fs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xr,le,ce,N]}],container:["container"],columns:[{columns:[Ce,le,ce,m]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:F()}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Z()}],"inset-x":[{"inset-x":Z()}],"inset-y":[{"inset-y":Z()}],start:[{start:Z()}],end:[{end:Z()}],top:[{top:Z()}],right:[{right:Z()}],bottom:[{bottom:Z()}],left:[{left:Z()}],visibility:["visible","invisible","collapse"],z:[{z:[Hs,"auto",ce,le]}],basis:[{basis:[Xr,"full","auto",m,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ce,Xr,"auto","initial","none",le]}],grow:[{grow:["",Ce,ce,le]}],shrink:[{shrink:["",Ce,ce,le]}],order:[{order:[Hs,"first","last","none",ce,le]}],"grid-cols":[{"grid-cols":ie()}],"col-start-end":[{col:be()}],"col-start":[{"col-start":de()}],"col-end":[{"col-end":de()}],"grid-rows":[{"grid-rows":ie()}],"row-start-end":[{row:be()}],"row-start":[{"row-start":de()}],"row-end":[{"row-end":de()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":qe()}],"auto-rows":[{"auto-rows":qe()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...Be(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...Be()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":Be()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"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",a,No,Oa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ce,ef]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qh,le]}],"font-family":[{font:[c2,le,e]}],"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:[l,ce,le]}],"line-clamp":[{"line-clamp":[Ce,"none",ce,ef]}],leading:[{leading:[d,...z()]}],"list-image":[{"list-image":["none",ce,le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ce,"from-font","auto",ce,Oa]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Ce,"auto",ce,le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ce,le]}],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",ce,le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:he()}],"bg-repeat":[{bg:_e()}],"bg-size":[{bg:O()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hs,ce,le],radial:["",ce,le],conic:[Hs,ce,le]},d2,l2]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ce,ce,le]}],"outline-w":[{outline:["",Ce,No,Oa]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",v,Dc,Oc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",x,Dc,Oc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Ce,Oa]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",w,Dc,Oc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Ce,ce,le]}],"mix-blend":[{"mix-blend":[...je(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":je()}],"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":[Ce]}],"mask-image-linear-from-pos":[{"mask-linear-from":ge()}],"mask-image-linear-to-pos":[{"mask-linear-to":ge()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ge()}],"mask-image-t-to-pos":[{"mask-t-to":ge()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ge()}],"mask-image-r-to-pos":[{"mask-r-to":ge()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ge()}],"mask-image-b-to-pos":[{"mask-b-to":ge()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ge()}],"mask-image-l-to-pos":[{"mask-l-to":ge()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ge()}],"mask-image-x-to-pos":[{"mask-x-to":ge()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ge()}],"mask-image-y-to-pos":[{"mask-y-to":ge()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[ce,le]}],"mask-image-radial-from-pos":[{"mask-radial-from":ge()}],"mask-image-radial-to-pos":[{"mask-radial-to":ge()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":U()}],"mask-image-conic-pos":[{"mask-conic":[Ce]}],"mask-image-conic-from-pos":[{"mask-conic-from":ge()}],"mask-image-conic-to-pos":[{"mask-conic-to":ge()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:he()}],"mask-repeat":[{mask:_e()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,le]}],filter:[{filter:["","none",ce,le]}],blur:[{blur:ot()}],brightness:[{brightness:[Ce,ce,le]}],contrast:[{contrast:[Ce,ce,le]}],"drop-shadow":[{"drop-shadow":["","none",j,Dc,Oc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Ce,ce,le]}],"hue-rotate":[{"hue-rotate":[Ce,ce,le]}],invert:[{invert:["",Ce,ce,le]}],saturate:[{saturate:[Ce,ce,le]}],sepia:[{sepia:["",Ce,ce,le]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,le]}],"backdrop-blur":[{"backdrop-blur":ot()}],"backdrop-brightness":[{"backdrop-brightness":[Ce,ce,le]}],"backdrop-contrast":[{"backdrop-contrast":[Ce,ce,le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ce,ce,le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ce,ce,le]}],"backdrop-invert":[{"backdrop-invert":["",Ce,ce,le]}],"backdrop-opacity":[{"backdrop-opacity":[Ce,ce,le]}],"backdrop-saturate":[{"backdrop-saturate":[Ce,ce,le]}],"backdrop-sepia":[{"backdrop-sepia":["",Ce,ce,le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ce,le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ce,"initial",ce,le]}],ease:[{ease:["linear","initial",A,ce,le]}],delay:[{delay:[Ce,ce,le]}],animate:[{animate:["none",M,ce,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,ce,le]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:Ue()}],"rotate-x":[{"rotate-x":Ue()}],"rotate-y":[{"rotate-y":Ue()}],"rotate-z":[{"rotate-z":Ue()}],scale:[{scale:un()}],"scale-x":[{"scale-x":un()}],"scale-y":[{"scale-y":un()}],"scale-z":[{"scale-z":un()}],"scale-3d":["scale-3d"],skew:[{skew:Gt()}],"skew-x":[{"skew-x":Gt()}],"skew-y":[{"skew-y":Gt()}],transform:[{transform:[ce,le,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Et()}],"translate-x":[{"translate-x":Et()}],"translate-y":[{"translate-y":Et()}],"translate-z":[{"translate-z":Et()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",ce,le]}],"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":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",ce,le]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Ce,No,Oa,ef]}],stroke:[{stroke:["none",...I()]}],"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"]}},p2=YN(m2);function Se(...n){return p2(Fb(n))}const g2=Kb("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"}}),ee=S.forwardRef(({className:n,variant:e,size:a,asChild:i=!1,...l},d)=>{const h=i?SN:"button";return c.jsx(h,{className:Se(g2({variant:e,size:a,className:n})),ref:d,...l})});ee.displayName="Button";function iw(){const{setTheme:n,theme:e}=xN();return c.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground w-8 px-0",title:`Switch to ${e==="dark"?"light":"dark"} mode`,children:[e==="dark"?c.jsx(nN,{className:"h-[1.2rem] w-[1.2rem]"}):c.jsx(RT,{className:"h-[1.2rem] w-[1.2rem]"}),c.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var qn=function(){return qn=Object.assign||function(e){for(var a,i=1,l=arguments.length;i<l;i++){a=arguments[i];for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&(e[d]=a[d])}return e},qn.apply(this,arguments)};function _i(n,e){var a={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(a[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,i=Object.getOwnPropertySymbols(n);l<i.length;l++)e.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(n,i[l])&&(a[i[l]]=n[i[l]]);return a}function y2(n,e,a,i){function l(d){return d instanceof a?d:new a(function(h){h(d)})}return new(a||(a=Promise))(function(d,h){function m(v){try{y(i.next(v))}catch(x){h(x)}}function p(v){try{y(i.throw(v))}catch(x){h(x)}}function y(v){v.done?d(v.value):l(v.value).then(m,p)}y((i=i.apply(n,e||[])).next())})}function v2(n,e,a){if(a||arguments.length===2)for(var i=0,l=e.length,d;i<l;i++)(d||!(i in e))&&(d||(d=Array.prototype.slice.call(e,0,i)),d[i]=e[i]);return n.concat(d||Array.prototype.slice.call(e))}const x2=n=>n?(...e)=>n(...e):(...e)=>fetch(...e);class Cm extends Error{constructor(e,a="FunctionsError",i){super(e),this.name=a,this.context=i}}class b2 extends Cm{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class A0 extends Cm{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class k0 extends Cm{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Pf;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(Pf||(Pf={}));class w2{constructor(e,{headers:a={},customFetch:i,region:l=Pf.Any}={}){this.url=e,this.headers=a,this.region=l,this.fetch=x2(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return y2(this,arguments,void 0,function*(a,i={}){var l;let d,h;try{const{headers:m,method:p,body:y,signal:v,timeout:x}=i;let w={},{region:j}=i;j||(j=this.region);const _=new URL(`${this.url}/${a}`);j&&j!=="any"&&(w["x-region"]=j,_.searchParams.set("forceFunctionRegion",j));let T;y&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&y instanceof Blob||y instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",T=y):typeof y=="string"?(w["Content-Type"]="text/plain",T=y):typeof FormData<"u"&&y instanceof FormData?T=y:(w["Content-Type"]="application/json",T=JSON.stringify(y)):y&&typeof y!="string"&&!(typeof Blob<"u"&&y instanceof Blob)&&!(y instanceof ArrayBuffer)&&!(typeof FormData<"u"&&y instanceof FormData)?T=JSON.stringify(y):T=y;let N=v;x&&(h=new AbortController,d=setTimeout(()=>h.abort(),x),v?(N=h.signal,v.addEventListener("abort",()=>h.abort())):N=h.signal);const A=yield this.fetch(_.toString(),{method:p||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),m),body:T,signal:N}).catch(F=>{throw new b2(F)}),M=A.headers.get("x-relay-error");if(M&&M==="true")throw new A0(A);if(!A.ok)throw new k0(A);let k=((l=A.headers.get("Content-Type"))!==null&&l!==void 0?l:"text/plain").split(";")[0].trim(),U;return k==="application/json"?U=yield A.json():k==="application/octet-stream"||k==="application/pdf"?U=yield A.blob():k==="text/event-stream"?U=A:k==="multipart/form-data"?U=yield A.formData():U=yield A.text(),{data:U,error:null,response:A}}catch(m){return{data:null,error:m,response:m instanceof k0||m instanceof A0?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var S2=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}},_2=class{constructor(n){var e,a;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(e=n.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=n.signal,this.isMaybeSingle=(a=n.isMaybeSingle)!==null&&a!==void 0?a:!1,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,e){return this.headers=new Headers(this.headers),this.headers.set(n,e),this}then(n,e){var a=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 i=this.fetch;let l=i(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,y=d.status,v=d.statusText;if(d.ok){var x,w;if(a.method!=="HEAD"){var j;const A=await d.text();A===""||(a.headers.get("Accept")==="text/csv"||a.headers.get("Accept")&&(!((j=a.headers.get("Accept"))===null||j===void 0)&&j.includes("application/vnd.pgrst.plan+text"))?m=A:m=JSON.parse(A))}const T=(x=a.headers.get("Prefer"))===null||x===void 0?void 0:x.match(/count=(exact|planned|estimated)/),N=(w=d.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");T&&N&&N.length>1&&(p=parseInt(N[1])),a.isMaybeSingle&&a.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,y=406,v="Not Acceptable"):m.length===1?m=m[0]:m=null)}else{var _;const T=await d.text();try{h=JSON.parse(T),Array.isArray(h)&&d.status===404&&(m=[],h=null,y=200,v="OK")}catch{d.status===404&&T===""?(y=204,v="No Content"):h={message:T}}if(h&&a.isMaybeSingle&&(!(h==null||(_=h.details)===null||_===void 0)&&_.includes("0 rows"))&&(h=null,y=200,v="OK"),h&&a.shouldThrowOnError)throw new S2(h)}return{error:h,data:m,count:p,status:y,statusText:v}});return this.shouldThrowOnError||(l=l.catch(d=>{var h;let m="";const p=d?.cause;if(p){var y,v,x,w;const _=(y=p?.message)!==null&&y!==void 0?y:"",T=(v=p?.code)!==null&&v!==void 0?v:"";m=`${(x=d?.name)!==null&&x!==void 0?x:"FetchError"}: ${d?.message}`,m+=`
10
-
11
- Caused by: ${(w=p?.name)!==null&&w!==void 0?w:"Error"}: ${_}`,T&&(m+=` (${T})`),p?.stack&&(m+=`
12
- ${p.stack}`)}else{var j;m=(j=d?.stack)!==null&&j!==void 0?j:""}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:""}})),l.then(n,e)}returns(){return this}overrideTypes(){return this}},j2=class extends _2{select(n){let e=!1;const a=(n??"*").split("").map(i=>/\s/.test(i)&&!e?"":(i==='"'&&(e=!e),i)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:e=!0,nullsFirst:a,foreignTable:i,referencedTable:l=i}={}){const d=l?`${l}.order`:"order",h=this.url.searchParams.get(d);return this.url.searchParams.set(d,`${h?`${h},`:""}${n}.${e?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:e,referencedTable:a=e}={}){const i=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(i,`${n}`),this}range(n,e,{foreignTable:a,referencedTable:i=a}={}){const l=typeof i>"u"?"offset":`${i}.offset`,d=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(l,`${n}`),this.url.searchParams.set(d,`${e-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:n=!1,verbose:e=!1,settings:a=!1,buffers:i=!1,wal:l=!1,format:d="text"}={}){var h;const m=[n?"analyze":null,e?"verbose":null,a?"settings":null,i?"buffers":null,l?"wal":null].filter(Boolean).join("|"),p=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${p}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const C0=new RegExp("[,()]");var ri=class extends j2{eq(n,e){return this.url.searchParams.append(n,`eq.${e}`),this}neq(n,e){return this.url.searchParams.append(n,`neq.${e}`),this}gt(n,e){return this.url.searchParams.append(n,`gt.${e}`),this}gte(n,e){return this.url.searchParams.append(n,`gte.${e}`),this}lt(n,e){return this.url.searchParams.append(n,`lt.${e}`),this}lte(n,e){return this.url.searchParams.append(n,`lte.${e}`),this}like(n,e){return this.url.searchParams.append(n,`like.${e}`),this}likeAllOf(n,e){return this.url.searchParams.append(n,`like(all).{${e.join(",")}}`),this}likeAnyOf(n,e){return this.url.searchParams.append(n,`like(any).{${e.join(",")}}`),this}ilike(n,e){return this.url.searchParams.append(n,`ilike.${e}`),this}ilikeAllOf(n,e){return this.url.searchParams.append(n,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(n,e){return this.url.searchParams.append(n,`ilike(any).{${e.join(",")}}`),this}regexMatch(n,e){return this.url.searchParams.append(n,`match.${e}`),this}regexIMatch(n,e){return this.url.searchParams.append(n,`imatch.${e}`),this}is(n,e){return this.url.searchParams.append(n,`is.${e}`),this}isDistinct(n,e){return this.url.searchParams.append(n,`isdistinct.${e}`),this}in(n,e){const a=Array.from(new Set(e)).map(i=>typeof i=="string"&&C0.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(n,`in.(${a})`),this}notIn(n,e){const a=Array.from(new Set(e)).map(i=>typeof i=="string"&&C0.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(n,`not.in.(${a})`),this}contains(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cs.{${e.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(e)}`),this}containedBy(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cd.{${e.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(e)}`),this}rangeGt(n,e){return this.url.searchParams.append(n,`sr.${e}`),this}rangeGte(n,e){return this.url.searchParams.append(n,`nxl.${e}`),this}rangeLt(n,e){return this.url.searchParams.append(n,`sl.${e}`),this}rangeLte(n,e){return this.url.searchParams.append(n,`nxr.${e}`),this}rangeAdjacent(n,e){return this.url.searchParams.append(n,`adj.${e}`),this}overlaps(n,e){return typeof e=="string"?this.url.searchParams.append(n,`ov.${e}`):this.url.searchParams.append(n,`ov.{${e.join(",")}}`),this}textSearch(n,e,{config:a,type:i}={}){let l="";i==="plain"?l="pl":i==="phrase"?l="ph":i==="websearch"&&(l="w");const d=a===void 0?"":`(${a})`;return this.url.searchParams.append(n,`${l}fts${d}.${e}`),this}match(n){return Object.entries(n).forEach(([e,a])=>{this.url.searchParams.append(e,`eq.${a}`)}),this}not(n,e,a){return this.url.searchParams.append(n,`not.${e}.${a}`),this}or(n,{foreignTable:e,referencedTable:a=e}={}){const i=a?`${a}.or`:"or";return this.url.searchParams.append(i,`(${n})`),this}filter(n,e,a){return this.url.searchParams.append(n,`${e}.${a}`),this}},E2=class{constructor(n,{headers:e={},schema:a,fetch:i}){this.url=n,this.headers=new Headers(e),this.schema=a,this.fetch=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(n,e){const{head:a=!1,count:i}=e??{},l=a?"HEAD":"GET";let d=!1;const h=(n??"*").split("").map(y=>/\s/.test(y)&&!d?"":(y==='"'&&(d=!d),y)).join(""),{url:m,headers:p}=this.cloneRequestState();return m.searchParams.set("select",h),i&&p.append("Prefer",`count=${i}`),new ri({method:l,url:m,headers:p,schema:this.schema,fetch:this.fetch})}insert(n,{count:e,defaultToNull:a=!0}={}){var i;const l="POST",{url:d,headers:h}=this.cloneRequestState();if(e&&h.append("Prefer",`count=${e}`),a||h.append("Prefer","missing=default"),Array.isArray(n)){const m=n.reduce((p,y)=>p.concat(Object.keys(y)),[]);if(m.length>0){const p=[...new Set(m)].map(y=>`"${y}"`);d.searchParams.set("columns",p.join(","))}}return new ri({method:l,url:d,headers:h,schema:this.schema,body:n,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(n,{onConflict:e,ignoreDuplicates:a=!1,count:i,defaultToNull:l=!0}={}){var d;const h="POST",{url:m,headers:p}=this.cloneRequestState();if(p.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),e!==void 0&&m.searchParams.set("on_conflict",e),i&&p.append("Prefer",`count=${i}`),l||p.append("Prefer","missing=default"),Array.isArray(n)){const y=n.reduce((v,x)=>v.concat(Object.keys(x)),[]);if(y.length>0){const v=[...new Set(y)].map(x=>`"${x}"`);m.searchParams.set("columns",v.join(","))}}return new ri({method:h,url:m,headers:p,schema:this.schema,body:n,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(n,{count:e}={}){var a;const i="PATCH",{url:l,headers:d}=this.cloneRequestState();return e&&d.append("Prefer",`count=${e}`),new ri({method:i,url:l,headers:d,schema:this.schema,body:n,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:n}={}){var e;const a="DELETE",{url:i,headers:l}=this.cloneRequestState();return n&&l.append("Prefer",`count=${n}`),new ri({method:a,url:i,headers:l,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},T2=class ow{constructor(e,{headers:a={},schema:i,fetch:l}={}){this.url=e,this.headers=new Headers(a),this.schemaName=i,this.fetch=l}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new E2(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new ow(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,a={},{head:i=!1,get:l=!1,count:d}={}){var h;let m;const p=new URL(`${this.url}/rpc/${e}`);let y;const v=j=>j!==null&&typeof j=="object"&&(!Array.isArray(j)||j.some(v)),x=i&&Object.values(a).some(v);x?(m="POST",y=a):i||l?(m=i?"HEAD":"GET",Object.entries(a).filter(([j,_])=>_!==void 0).map(([j,_])=>[j,Array.isArray(_)?`{${_.join(",")}}`:`${_}`]).forEach(([j,_])=>{p.searchParams.append(j,_)})):(m="POST",y=a);const w=new Headers(this.headers);return x?w.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&w.set("Prefer",`count=${d}`),new ri({method:m,url:p,headers:w,schema:this.schemaName,body:y,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class N2{constructor(){}static detectEnvironment(){var e;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"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.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 a=globalThis.process;if(a){const i=a.versions;if(i&&i.node){const l=i.node,d=parseInt(l.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 e=this.detectEnvironment();if(e.constructor)return e.constructor;let a=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(a+=`
15
-
16
- Suggested solution: ${e.workaround}`),new Error(a)}static createWebSocket(e,a){const i=this.getWebSocketConstructor();return new i(e,a)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const A2="2.90.1",k2=`realtime-js/${A2}`,lw="1.0.0",C2="2.0.0",R0=lw,Vf=1e4,R2=1e3,O2=100;var Ys;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(Ys||(Ys={}));var wt;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(wt||(wt={}));var Mn;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(Mn||(Mn={}));var Bf;(function(n){n.websocket="websocket"})(Bf||(Bf={}));var Va;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(Va||(Va={}));class D2{constructor(e){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=e??[]}encode(e,a){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return a(this._binaryEncodeUserBroadcastPush(e));let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return a(JSON.stringify(i))}_binaryEncodeUserBroadcastPush(e){var a;return this._isArrayBuffer((a=e.payload)===null||a===void 0?void 0:a.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var a,i;const l=(i=(a=e.payload)===null||a===void 0?void 0:a.payload)!==null&&i!==void 0?i:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,l)}_encodeJsonUserBroadcastPush(e){var a,i;const l=(i=(a=e.payload)===null||a===void 0?void 0:a.payload)!==null&&i!==void 0?i:{},h=new TextEncoder().encode(JSON.stringify(l)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,h)}_encodeUserBroadcastPush(e,a,i){var l,d;const h=e.topic,m=(l=e.ref)!==null&&l!==void 0?l:"",p=(d=e.join_ref)!==null&&d!==void 0?d:"",y=e.payload.event,v=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},x=Object.keys(v).length===0?"":JSON.stringify(v);if(p.length>255)throw new Error(`joinRef length ${p.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`ref length ${m.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`topic length ${h.length} exceeds maximum of 255`);if(y.length>255)throw new Error(`userEvent length ${y.length} exceeds maximum of 255`);if(x.length>255)throw new Error(`metadata length ${x.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+p.length+m.length+h.length+y.length+x.length,j=new ArrayBuffer(this.HEADER_LENGTH+w);let _=new DataView(j),T=0;_.setUint8(T++,this.KINDS.userBroadcastPush),_.setUint8(T++,p.length),_.setUint8(T++,m.length),_.setUint8(T++,h.length),_.setUint8(T++,y.length),_.setUint8(T++,x.length),_.setUint8(T++,a),Array.from(p,A=>_.setUint8(T++,A.charCodeAt(0))),Array.from(m,A=>_.setUint8(T++,A.charCodeAt(0))),Array.from(h,A=>_.setUint8(T++,A.charCodeAt(0))),Array.from(y,A=>_.setUint8(T++,A.charCodeAt(0))),Array.from(x,A=>_.setUint8(T++,A.charCodeAt(0)));var N=new Uint8Array(j.byteLength+i.byteLength);return N.set(new Uint8Array(j),0),N.set(new Uint8Array(i),j.byteLength),N.buffer}decode(e,a){if(this._isArrayBuffer(e)){let i=this._binaryDecode(e);return a(i)}if(typeof e=="string"){const i=JSON.parse(e),[l,d,h,m,p]=i;return a({join_ref:l,ref:d,topic:h,event:m,payload:p})}return a({})}_binaryDecode(e){const a=new DataView(e),i=a.getUint8(0),l=new TextDecoder;if(i===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,a,l)}_decodeUserBroadcast(e,a,i){const l=a.getUint8(1),d=a.getUint8(2),h=a.getUint8(3),m=a.getUint8(4);let p=this.HEADER_LENGTH+4;const y=i.decode(e.slice(p,p+l));p=p+l;const v=i.decode(e.slice(p,p+d));p=p+d;const x=i.decode(e.slice(p,p+h));p=p+h;const w=e.slice(p,e.byteLength),j=m===this.JSON_ENCODING?JSON.parse(i.decode(w)):w,_={type:this.BROADCAST_EVENT,event:v,payload:j};return h>0&&(_.meta=JSON.parse(x)),{join_ref:null,ref:null,topic:y,event:this.BROADCAST_EVENT,payload:_}}_isArrayBuffer(e){var a;return e instanceof ArrayBuffer||((a=e?.constructor)===null||a===void 0?void 0:a.name)==="ArrayBuffer"}_pick(e,a){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([i])=>a.includes(i)))}}class cw{constructor(e,a){this.callback=e,this.timerCalc=a,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=a}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 Xe;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(Xe||(Xe={}));const O0=(n,e,a={})=>{var i;const l=(i=a.skipTypes)!==null&&i!==void 0?i:[];return e?Object.keys(e).reduce((d,h)=>(d[h]=M2(h,n,e,l),d),{}):{}},M2=(n,e,a,i)=>{const l=e.find(m=>m.name===n),d=l?.type,h=a[n];return d&&!i.includes(d)?uw(d,h):If(h)},uw=(n,e)=>{if(n.charAt(0)==="_"){const a=n.slice(1,n.length);return P2(e,a)}switch(n){case Xe.bool:return z2(e);case Xe.float4:case Xe.float8:case Xe.int2:case Xe.int4:case Xe.int8:case Xe.numeric:case Xe.oid:return L2(e);case Xe.json:case Xe.jsonb:return U2(e);case Xe.timestamp:return V2(e);case Xe.abstime:case Xe.date:case Xe.daterange:case Xe.int4range:case Xe.int8range:case Xe.money:case Xe.reltime:case Xe.text:case Xe.time:case Xe.timestamptz:case Xe.timetz:case Xe.tsrange:case Xe.tstzrange:return If(e);default:return If(e)}},If=n=>n,z2=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},L2=n=>{if(typeof n=="string"){const e=parseFloat(n);if(!Number.isNaN(e))return e}return n},U2=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},P2=(n,e)=>{if(typeof n!="string")return n;const a=n.length-1,i=n[a];if(n[0]==="{"&&i==="}"){let d;const h=n.slice(1,a);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>uw(e,m))}return n},V2=n=>typeof n=="string"?n.replace(" ","T"):n,dw=n=>{const e=new URL(n);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class tf{constructor(e,a,i={},l=Vf){this.channel=e,this.event=a,this.payload=i,this.timeout=l,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,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(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,a){var i;return this._hasReceived(e)&&a((i=this.receivedResp)===null||i===void 0?void 0:i.response),this.recHooks.push({status:e,callback:a}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=a=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=a,this._matchReceive(a)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,a){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:a})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:a}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(a))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var D0;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(D0||(D0={}));class Do{constructor(e,a){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const i=a?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(i.state,{},l=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Do.syncState(this.state,l,d,h),this.pendingDiffs.forEach(p=>{this.state=Do.syncDiff(this.state,p,d,h)}),this.pendingDiffs=[],m()}),this.channel._on(i.diff,{},l=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(l):(this.state=Do.syncDiff(this.state,l,d,h),m())}),this.onJoin((l,d,h)=>{this.channel._trigger("presence",{event:"join",key:l,currentPresences:d,newPresences:h})}),this.onLeave((l,d,h)=>{this.channel._trigger("presence",{event:"leave",key:l,currentPresences:d,leftPresences:h})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,a,i,l){const d=this.cloneDeep(e),h=this.transformState(a),m={},p={};return this.map(d,(y,v)=>{h[y]||(p[y]=v)}),this.map(h,(y,v)=>{const x=d[y];if(x){const w=v.map(N=>N.presence_ref),j=x.map(N=>N.presence_ref),_=v.filter(N=>j.indexOf(N.presence_ref)<0),T=x.filter(N=>w.indexOf(N.presence_ref)<0);_.length>0&&(m[y]=_),T.length>0&&(p[y]=T)}else m[y]=v}),this.syncDiff(d,{joins:m,leaves:p},i,l)}static syncDiff(e,a,i,l){const{joins:d,leaves:h}={joins:this.transformState(a.joins),leaves:this.transformState(a.leaves)};return i||(i=()=>{}),l||(l=()=>{}),this.map(d,(m,p)=>{var y;const v=(y=e[m])!==null&&y!==void 0?y:[];if(e[m]=this.cloneDeep(p),v.length>0){const x=e[m].map(j=>j.presence_ref),w=v.filter(j=>x.indexOf(j.presence_ref)<0);e[m].unshift(...w)}i(m,v,p)}),this.map(h,(m,p)=>{let y=e[m];if(!y)return;const v=p.map(x=>x.presence_ref);y=y.filter(x=>v.indexOf(x.presence_ref)<0),e[m]=y,l(m,y,p),y.length===0&&delete e[m]}),e}static map(e,a){return Object.getOwnPropertyNames(e).map(i=>a(i,e[i]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((a,i)=>{const l=e[i];return"metas"in l?a[i]=l.metas.map(d=>(d.presence_ref=d.phx_ref,delete d.phx_ref,delete d.phx_ref_prev,d)):a[i]=l,a},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var M0;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(M0||(M0={}));var Mo;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(Mo||(Mo={}));var ms;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(ms||(ms={}));class li{constructor(e,a={config:{}},i){var l,d;if(this.topic=e,this.params=a,this.socket=i,this.bindings={},this.state=wt.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},a.config),this.timeout=this.socket.timeout,this.joinPush=new tf(this,Mn.join,this.params,this.timeout),this.rejoinTimer=new cw(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=wt.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=wt.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=wt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=wt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=wt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Mn.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new Do(this),this.broadcastEndpointURL=dw(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((d=(l=this.params.config)===null||l===void 0?void 0:l.broadcast)===null||d===void 0)&&d.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,a=this.timeout){var i,l,d;if(this.socket.isConnected()||this.socket.connect(),this.state==wt.closed){const{config:{broadcast:h,presence:m,private:p}}=this.params,y=(l=(i=this.bindings.postgres_changes)===null||i===void 0?void 0:i.map(j=>j.filter))!==null&&l!==void 0?l:[],v=!!this.bindings[Mo.PRESENCE]&&this.bindings[Mo.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,x={},w={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:v}),postgres_changes:y,private:p};this.socket.accessTokenValue&&(x.access_token=this.socket.accessTokenValue),this._onError(j=>e?.(ms.CHANNEL_ERROR,j)),this._onClose(()=>e?.(ms.CLOSED)),this.updateJoinPayload(Object.assign({config:w},x)),this.joinedOnce=!0,this._rejoin(a),this.joinPush.receive("ok",async({postgres_changes:j})=>{var _;if(this.socket._isManualToken()||this.socket.setAuth(),j===void 0){e?.(ms.SUBSCRIBED);return}else{const T=this.bindings.postgres_changes,N=(_=T?.length)!==null&&_!==void 0?_:0,A=[];for(let M=0;M<N;M++){const k=T[M],{filter:{event:U,schema:F,table:K,filter:P}}=k,z=j&&j[M];if(z&&z.event===U&&li.isFilterValueEqual(z.schema,F)&&li.isFilterValueEqual(z.table,K)&&li.isFilterValueEqual(z.filter,P))A.push(Object.assign(Object.assign({},k),{id:z.id}));else{this.unsubscribe(),this.state=wt.errored,e?.(ms.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=A,e&&e(ms.SUBSCRIBED);return}}).receive("error",j=>{this.state=wt.errored,e?.(ms.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(j).join(", ")||"error")))}).receive("timeout",()=>{e?.(ms.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,a={}){return await this.send({type:"presence",event:"track",payload:e},a.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,a,i){return this.state===wt.joined&&e===Mo.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(e,a,i)}async httpSend(e,a,i={}){var l;if(a==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:e,payload:a,private:this.private}]})},m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(l=i.timeout)!==null&&l!==void 0?l:this.timeout);if(m.status===202)return{success:!0};let p=m.statusText;try{const y=await m.json();p=y.error||y.message||p}catch{}return Promise.reject(new Error(p))}async send(e,a={}){var i,l;if(!this._canPush()&&e.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}=e,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 y=await this._fetchWithTimeout(this.broadcastEndpointURL,p,(i=a.timeout)!==null&&i!==void 0?i:this.timeout);return await((l=y.body)===null||l===void 0?void 0:l.cancel()),y.ok?"ok":"error"}catch(y){return y.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,p;const y=this._push(e.type,e,a.timeout||this.timeout);e.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"),y.receive("ok",()=>d("ok")),y.receive("error",()=>d("error")),y.receive("timeout",()=>d("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=wt.leaving;const a=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Mn.close,"leave",this._joinRef())};this.joinPush.destroy();let i=null;return new Promise(l=>{i=new tf(this,Mn.leave,{},e),i.receive("ok",()=>{a(),l("ok")}).receive("timeout",()=>{a(),l("timed out")}).receive("error",()=>{l("error")}),i.send(),this._canPush()||i.trigger("ok",{})}).finally(()=>{i?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=wt.closed,this.bindings={}}async _fetchWithTimeout(e,a,i){const l=new AbortController,d=setTimeout(()=>l.abort(),i),h=await this.socket.fetch(e,Object.assign(Object.assign({},a),{signal:l.signal}));return clearTimeout(d),h}_push(e,a,i=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let l=new tf(this,e,a,i);return this._canPush()?l.send():this._addToPushBuffer(l),l}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>O2){const a=this.pushBuffer.shift();a&&(a.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${a.event}`,a.payload))}}_onMessage(e,a,i){return a}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,a,i){var l,d;const h=e.toLocaleLowerCase(),{close:m,error:p,leave:y,join:v}=Mn;if(i&&[m,p,y,v].indexOf(h)>=0&&i!==this._joinRef())return;let w=this._onMessage(h,a,i);if(a&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(h)?(l=this.bindings.postgres_changes)===null||l===void 0||l.filter(j=>{var _,T,N;return((_=j.filter)===null||_===void 0?void 0:_.event)==="*"||((N=(T=j.filter)===null||T===void 0?void 0:T.event)===null||N===void 0?void 0:N.toLocaleLowerCase())===h}).map(j=>j.callback(w,i)):(d=this.bindings[h])===null||d===void 0||d.filter(j=>{var _,T,N,A,M,k,U,F;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in j){const K=j.id,P=(_=j.filter)===null||_===void 0?void 0:_.event;return K&&((T=a.ids)===null||T===void 0?void 0:T.includes(K))&&(P==="*"||P?.toLocaleLowerCase()===((N=a.data)===null||N===void 0?void 0:N.type.toLocaleLowerCase()))&&(!(!((A=j.filter)===null||A===void 0)&&A.table)||j.filter.table===((M=a.data)===null||M===void 0?void 0:M.table))}else{const K=(U=(k=j?.filter)===null||k===void 0?void 0:k.event)===null||U===void 0?void 0:U.toLocaleLowerCase();return K==="*"||K===((F=a?.event)===null||F===void 0?void 0:F.toLocaleLowerCase())}else return j.type.toLocaleLowerCase()===h}).map(j=>{if(typeof w=="object"&&"ids"in w){const _=w.data,{schema:T,table:N,commit_timestamp:A,type:M,errors:k}=_;w=Object.assign(Object.assign({},{schema:T,table:N,commit_timestamp:A,eventType:M,new:{},old:{},errors:k}),this._getPayloadRecords(_))}j.callback(w,i)})}_isClosed(){return this.state===wt.closed}_isJoined(){return this.state===wt.joined}_isJoining(){return this.state===wt.joining}_isLeaving(){return this.state===wt.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,a,i){const l=e.toLocaleLowerCase(),d={type:l,filter:a,callback:i};return this.bindings[l]?this.bindings[l].push(d):this.bindings[l]=[d],this}_off(e,a){const i=e.toLocaleLowerCase();return this.bindings[i]&&(this.bindings[i]=this.bindings[i].filter(l=>{var d;return!(((d=l.type)===null||d===void 0?void 0:d.toLocaleLowerCase())===i&&li.isEqual(l.filter,a))})),this}static isEqual(e,a){if(Object.keys(e).length!==Object.keys(a).length)return!1;for(const i in e)if(e[i]!==a[i])return!1;return!0}static isFilterValueEqual(e,a){return(e??void 0)===(a??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Mn.close,{},e)}_onError(e){this._on(Mn.error,{},a=>e(a))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=wt.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const a={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(a.new=O0(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(a.old=O0(e.columns,e.old_record)),a}}const nf=()=>{},Mc={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},B2=[1e3,2e3,5e3,1e4],I2=1e4,q2=`
17
- addEventListener("message", (e) => {
18
- if (e.data.event === "start") {
19
- setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
20
- }
21
- });`;class $2{constructor(e,a){var i;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Vf,this.transport=null,this.heartbeatIntervalMs=Mc.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=nf,this.ref=0,this.reconnectTimer=null,this.vsn=R0,this.logger=nf,this.conn=null,this.sendBuffer=[],this.serializer=new D2,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=l=>l?(...d)=>l(...d):(...d)=>fetch(...d),!(!((i=a?.params)===null||i===void 0)&&i.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=a.params.apikey,this.endPoint=`${e}/${Bf.websocket}`,this.httpEndpoint=dw(e),this._initializeOptions(a),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(a?.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=N2.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const a=e.message;throw a.includes("Node.js")?new Error(`${a}
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: ${a}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,a){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const i=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(i),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,a??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const a=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),a}async removeAllChannels(){const e=await Promise.all(this.channels.map(a=>a.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,a,i){this.logger(e,a,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Ys.connecting:return Va.Connecting;case Ys.open:return Va.Open;case Ys.closing:return Va.Closing;default:return Va.Closed}}isConnected(){return this.connectionState()===Va.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,a={config:{}}){const i=`realtime:${e}`,l=this.getChannels().find(d=>d.topic===i);if(l)return l;{const d=new li(`realtime:${e}`,a,this);return this.channels.push(d),d}}push(e){const{topic:a,event:i,payload:l,ref:d}=e,h=()=>{this.encode(e,m=>{var p;(p=this.conn)===null||p===void 0||p.send(m)})};this.log("push",`${a} ${i} (${d})`,l),this.isConnected()?h():this.sendBuffer.push(h)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(a){this.log("error","error in heartbeat callback",a)}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(a){this.log("error","error in heartbeat callback",a)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(R2,"heartbeat timeout"),setTimeout(()=>{var a;this.isConnected()||(a=this.reconnectTimer)===null||a===void 0||a.scheduleTimeout()},Mc.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(a){this.log("error","error in heartbeat callback",a)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let a=this.channels.find(i=>i.topic===e&&(i._isJoined()||i._isJoining()));a&&(this.log("transport",`leaving duplicate topic "${e}"`),a.unsubscribe())}_remove(e){this.channels=this.channels.filter(a=>a.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,a=>{if(a.topic==="phoenix"&&a.event==="phx_reply"&&a.ref&&a.ref===this.pendingHeartbeatRef){const y=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(a.payload.status==="ok"?"ok":"error",y)}catch(v){this.log("error","error in heartbeat callback",v)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:i,event:l,payload:d,ref:h}=a,m=h?`(${h})`:"",p=d.status||"";this.log("receive",`${p} ${i} ${l} ${m}`.trim(),d),this.channels.filter(y=>y._isMember(i)).forEach(y=>y._trigger(l,d,h)),this._triggerStateCallbacks("message",a)})}_clearTimer(e){var a;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((a=this.reconnectTimer)===null||a===void 0||a.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=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Ys.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Ys.open||this.conn.readyState===Ys.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}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(e=>e.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(a=>{this.log("error","error waiting for auth on connect",a),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 e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=a=>{this.log("worker","worker error",a.message),this._terminateWorker()},this.workerRef.onmessage=a=>{a.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(e){var a;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(a=this.reconnectTimer)===null||a===void 0||a.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Mn.error))}_appendParams(e,a){if(Object.keys(a).length===0)return e;const i=e.match(/\?/)?"&":"?",l=new URLSearchParams(a);return`${e}${i}${l}`}_workerObjectUrl(e){let a;if(e)a=e;else{const i=new Blob([q2],{type:"application/javascript"});a=URL.createObjectURL(i)}return a}_setConnectionState(e,a=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=a)}async _performAuth(e=null){let a,i=!1;if(e)a=e,i=!0;else if(this.accessToken)try{a=await this.accessToken()}catch(l){this.log("error","Error fetching access token from callback",l),a=this.accessTokenValue}else a=this.accessTokenValue;i?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=a&&(this.accessTokenValue=a,this.channels.forEach(l=>{const d={access_token:a,version:k2};a&&l.updateJoinPayload(d),l.joinedOnce&&l._isJoined()&&l._push(Mn.access_token,{access_token:a})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(a=>{this.log("error",`Error setting auth in ${e}`,a)})}_triggerStateCallbacks(e,a){try{this.stateChangeCallbacks[e].forEach(i=>{try{i(a)}catch(l){this.log("error",`error in ${e} callback`,l)}})}catch(i){this.log("error",`error triggering ${e} callbacks`,i)}}_setupReconnectionTimer(){this.reconnectTimer=new cw(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Mc.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var a,i,l,d,h,m,p,y,v,x,w,j;switch(this.transport=(a=e?.transport)!==null&&a!==void 0?a:null,this.timeout=(i=e?.timeout)!==null&&i!==void 0?i:Vf,this.heartbeatIntervalMs=(l=e?.heartbeatIntervalMs)!==null&&l!==void 0?l:Mc.HEARTBEAT_INTERVAL,this.worker=(d=e?.worker)!==null&&d!==void 0?d:!1,this.accessToken=(h=e?.accessToken)!==null&&h!==void 0?h:null,this.heartbeatCallback=(m=e?.heartbeatCallback)!==null&&m!==void 0?m:nf,this.vsn=(p=e?.vsn)!==null&&p!==void 0?p:R0,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(y=e?.reconnectAfterMs)!==null&&y!==void 0?y:(_=>B2[_-1]||I2),this.vsn){case lw:this.encode=(v=e?.encode)!==null&&v!==void 0?v:((_,T)=>T(JSON.stringify(_))),this.decode=(x=e?.decode)!==null&&x!==void 0?x:((_,T)=>T(JSON.parse(_)));break;case C2:this.encode=(w=e?.encode)!==null&&w!==void 0?w:this.serializer.encode.bind(this.serializer),this.decode=(j=e?.decode)!==null&&j!==void 0?j: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=e?.workerUrl}}}var $o=class extends Error{constructor(n,e){super(n),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function H2(n,e,a){const i=new URL(e,n);if(a)for(const[l,d]of Object.entries(a))d!==void 0&&i.searchParams.set(l,d);return i.toString()}async function G2(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function F2(n){const e=n.fetchImpl??globalThis.fetch;return{async request({method:a,path:i,query:l,body:d,headers:h}){const m=H2(n.baseUrl,i,l),p=await G2(n.auth),y=await e(m,{method:a,headers:{...d?{"Content-Type":"application/json"}:{},...p,...h},body:d?JSON.stringify(d):void 0}),v=await y.text(),x=(y.headers.get("content-type")||"").includes("application/json"),w=x&&v?JSON.parse(v):v;if(!y.ok){const j=x?w:void 0,_=j?.error;throw new $o(_?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:_?.type,icebergCode:_?.code,details:j})}return{status:y.status,headers:y.headers,data:w}}}}function zc(n){return n.join("")}var K2=class{constructor(n,e=""){this.client=n,this.prefix=e}async listNamespaces(n){const e=n?{parent:zc(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(i=>({namespace:i}))}async createNamespace(n,e){const a={namespace:n.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:a})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${zc(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${zc(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${zc(n.namespace)}`}),!0}catch(e){if(e instanceof $o&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(n,e){try{return await this.createNamespace(n,e)}catch(a){if(a instanceof $o&&a.status===409)return;throw a}}};function Wr(n){return n.join("")}var Y2=class{constructor(n,e="",a){this.client=n,this.prefix=e,this.accessDelegation=a}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Wr(n.namespace)}/tables`})).data.identifiers}async createTable(n,e){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Wr(n.namespace)}/tables`,body:e,headers:a})).data.metadata}async updateTable(n,e){const a=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Wr(n.namespace)}/tables/${n.name}`,body:e});return{"metadata-location":a.data["metadata-location"],metadata:a.data.metadata}}async dropTable(n,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Wr(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(n){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Wr(n.namespace)}/tables/${n.name}`,headers:e})).data.metadata}async tableExists(n){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Wr(n.namespace)}/tables/${n.name}`,headers:e}),!0}catch(a){if(a instanceof $o&&a.status===404)return!1;throw a}}async createTableIfNotExists(n,e){try{return await this.createTable(n,e)}catch(a){if(a instanceof $o&&a.status===409)return await this.loadTable({namespace:n.namespace,name:e.name});throw a}}},X2=class{constructor(n){let e="v1";n.catalogName&&(e+=`/${n.catalogName}`);const a=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=F2({baseUrl:a,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=n.accessDelegation?.join(","),this.namespaceOps=new K2(this.client,e),this.tableOps=new Y2(this.client,e,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,e){return this.namespaceOps.createNamespace(n,e)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}async createTable(n,e){return this.tableOps.createTable(n,e)}async updateTable(n,e){return this.tableOps.updateTable(n,e)}async dropTable(n,e){await this.tableOps.dropTable(n,e)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,e){return this.namespaceOps.createNamespaceIfNotExists(n,e)}async createTableIfNotExists(n,e){return this.tableOps.createTableIfNotExists(n,e)}},Eu=class extends Error{constructor(n){super(n),this.__isStorageError=!0,this.name="StorageError"}};function tt(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var W2=class extends Eu{constructor(n,e,a){super(n),this.name="StorageApiError",this.status=e,this.statusCode=a}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},qf=class extends Eu{constructor(n,e){super(n),this.name="StorageUnknownError",this.originalError=e}};const Rm=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),J2=()=>Response,$f=n=>{if(Array.isArray(n))return n.map(a=>$f(a));if(typeof n=="function"||n!==Object(n))return n;const e={};return Object.entries(n).forEach(([a,i])=>{const l=a.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));e[l]=$f(i)}),e},Z2=n=>{if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Q2=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function Ho(n){"@babel/helpers - typeof";return Ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ho(n)}function eA(n,e){if(Ho(n)!="object"||!n)return n;var a=n[Symbol.toPrimitive];if(a!==void 0){var i=a.call(n,e);if(Ho(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function tA(n){var e=eA(n,"string");return Ho(e)=="symbol"?e:e+""}function nA(n,e,a){return(e=tA(e))in n?Object.defineProperty(n,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[e]=a,n}function z0(n,e){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),a.push.apply(a,i)}return a}function xe(n){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?z0(Object(a),!0).forEach(function(i){nA(n,i,a[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):z0(Object(a)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(a,i))})}return n}const sf=n=>{var e;return n.msg||n.message||n.error_description||(typeof n.error=="string"?n.error:(e=n.error)===null||e===void 0?void 0:e.message)||JSON.stringify(n)},sA=async(n,e,a)=>{n instanceof await J2()&&!a?.noResolveJson?n.json().then(i=>{const l=n.status||500,d=i?.statusCode||l+"";e(new W2(sf(i),l,d))}).catch(i=>{e(new qf(sf(i),i))}):e(new qf(sf(n),n))},aA=(n,e,a,i)=>{const l={method:n,headers:e?.headers||{}};return n==="GET"||!i?l:(Z2(i)?(l.headers=xe({"Content-Type":"application/json"},e?.headers),l.body=JSON.stringify(i)):l.body=i,e?.duplex&&(l.duplex=e.duplex),xe(xe({},l),a))};async function nl(n,e,a,i,l,d){return new Promise((h,m)=>{n(a,aA(e,i,l,d)).then(p=>{if(!p.ok)throw p;return i?.noResolveJson?p:p.json()}).then(p=>h(p)).catch(p=>sA(p,m,i))})}async function Go(n,e,a,i){return nl(n,"GET",e,a,i)}async function Dn(n,e,a,i,l){return nl(n,"POST",e,i,l,a)}async function Hf(n,e,a,i,l){return nl(n,"PUT",e,i,l,a)}async function rA(n,e,a,i){return nl(n,"HEAD",e,xe(xe({},a),{},{noResolveJson:!0}),i)}async function Om(n,e,a,i,l){return nl(n,"DELETE",e,i,l,a)}var iA=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e}then(n,e){return this.execute().then(n,e)}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(tt(e))return{data:null,error:e};throw e}}};let hw;hw=Symbol.toStringTag;var oA=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e,this[hw]="BlobDownloadBuilder",this.promise=null}asStream(){return new iA(this.downloadFn,this.shouldThrowOnError)}then(n,e){return this.getPromise().then(n,e)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(tt(e))return{data:null,error:e};throw e}}};const lA={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},L0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var cA=class{constructor(n,e={},a,i){this.shouldThrowOnError=!1,this.url=n,this.headers=e,this.bucketId=a,this.fetch=Rm(i)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(n,e,a,i){var l=this;try{let d;const h=xe(xe({},L0),i);let m=xe(xe({},l.headers),n==="POST"&&{"x-upsert":String(h.upsert)});const p=h.metadata;typeof Blob<"u"&&a instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),p&&d.append("metadata",l.encodeMetadata(p)),d.append("",a)):typeof FormData<"u"&&a instanceof FormData?(d=a,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),p&&!d.has("metadata")&&d.append("metadata",l.encodeMetadata(p))):(d=a,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,p&&(m["x-metadata"]=l.toBase64(l.encodeMetadata(p))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!h.duplex&&(h.duplex="half")),i?.headers&&(m=xe(xe({},m),i.headers));const y=l._removeEmptyFolders(e),v=l._getFinalPath(y),x=await(n=="PUT"?Hf:Dn)(l.fetch,`${l.url}/object/${v}`,d,xe({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:y,id:x.Id,fullPath:x.Key},error:null}}catch(d){if(l.shouldThrowOnError)throw d;if(tt(d))return{data:null,error:d};throw d}}async upload(n,e,a){return this.uploadOrUpdate("POST",n,e,a)}async uploadToSignedUrl(n,e,a,i){var l=this;const d=l._removeEmptyFolders(n),h=l._getFinalPath(d),m=new URL(l.url+`/object/upload/sign/${h}`);m.searchParams.set("token",e);try{let p;const y=xe({upsert:L0.upsert},i),v=xe(xe({},l.headers),{"x-upsert":String(y.upsert)});return typeof Blob<"u"&&a instanceof Blob?(p=new FormData,p.append("cacheControl",y.cacheControl),p.append("",a)):typeof FormData<"u"&&a instanceof FormData?(p=a,p.append("cacheControl",y.cacheControl)):(p=a,v["cache-control"]=`max-age=${y.cacheControl}`,v["content-type"]=y.contentType),{data:{path:d,fullPath:(await Hf(l.fetch,m.toString(),p,{headers:v})).Key},error:null}}catch(p){if(l.shouldThrowOnError)throw p;if(tt(p))return{data:null,error:p};throw p}}async createSignedUploadUrl(n,e){var a=this;try{let i=a._getFinalPath(n);const l=xe({},a.headers);e?.upsert&&(l["x-upsert"]="true");const d=await Dn(a.fetch,`${a.url}/object/upload/sign/${i}`,{},{headers:l}),h=new URL(a.url+d.url),m=h.searchParams.get("token");if(!m)throw new Eu("No token returned by API");return{data:{signedUrl:h.toString(),path:n,token:m},error:null}}catch(i){if(a.shouldThrowOnError)throw i;if(tt(i))return{data:null,error:i};throw i}}async update(n,e,a){return this.uploadOrUpdate("PUT",n,e,a)}async move(n,e,a){var i=this;try{return{data:await Dn(i.fetch,`${i.url}/object/move`,{bucketId:i.bucketId,sourceKey:n,destinationKey:e,destinationBucket:a?.destinationBucket},{headers:i.headers}),error:null}}catch(l){if(i.shouldThrowOnError)throw l;if(tt(l))return{data:null,error:l};throw l}}async copy(n,e,a){var i=this;try{return{data:{path:(await Dn(i.fetch,`${i.url}/object/copy`,{bucketId:i.bucketId,sourceKey:n,destinationKey:e,destinationBucket:a?.destinationBucket},{headers:i.headers})).Key},error:null}}catch(l){if(i.shouldThrowOnError)throw l;if(tt(l))return{data:null,error:l};throw l}}async createSignedUrl(n,e,a){var i=this;try{let l=i._getFinalPath(n),d=await Dn(i.fetch,`${i.url}/object/sign/${l}`,xe({expiresIn:e},a?.transform?{transform:a.transform}:{}),{headers:i.headers});const h=a?.download?`&download=${a.download===!0?"":a.download}`:"";return d={signedUrl:encodeURI(`${i.url}${d.signedURL}${h}`)},{data:d,error:null}}catch(l){if(i.shouldThrowOnError)throw l;if(tt(l))return{data:null,error:l};throw l}}async createSignedUrls(n,e,a){var i=this;try{const l=await Dn(i.fetch,`${i.url}/object/sign/${i.bucketId}`,{expiresIn:e,paths:n},{headers:i.headers}),d=a?.download?`&download=${a.download===!0?"":a.download}`:"";return{data:l.map(h=>xe(xe({},h),{},{signedUrl:h.signedURL?encodeURI(`${i.url}${h.signedURL}${d}`):null})),error:null}}catch(l){if(i.shouldThrowOnError)throw l;if(tt(l))return{data:null,error:l};throw l}}download(n,e){const a=typeof e?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(e?.transform||{}),l=i?`?${i}`:"",d=this._getFinalPath(n),h=()=>Go(this.fetch,`${this.url}/${a}/${d}${l}`,{headers:this.headers,noResolveJson:!0});return new oA(h,this.shouldThrowOnError)}async info(n){var e=this;const a=e._getFinalPath(n);try{return{data:$f(await Go(e.fetch,`${e.url}/object/info/${a}`,{headers:e.headers})),error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(tt(i))return{data:null,error:i};throw i}}async exists(n){var e=this;const a=e._getFinalPath(n);try{return await rA(e.fetch,`${e.url}/object/${a}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(tt(i)&&i instanceof qf){const l=i.originalError;if([400,404].includes(l?.status))return{data:!1,error:i}}throw i}}getPublicUrl(n,e){const a=this._getFinalPath(n),i=[],l=e?.download?`download=${e.download===!0?"":e.download}`:"";l!==""&&i.push(l);const d=typeof e?.transform<"u"?"render/image":"object",h=this.transformOptsToQueryString(e?.transform||{});h!==""&&i.push(h);let m=i.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${a}${m}`)}}}async remove(n){var e=this;try{return{data:await Om(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:n},{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(tt(a))return{data:null,error:a};throw a}}async list(n,e,a){var i=this;try{const l=xe(xe(xe({},lA),e),{},{prefix:n||""});return{data:await Dn(i.fetch,`${i.url}/object/list/${i.bucketId}`,l,{headers:i.headers},a),error:null}}catch(l){if(i.shouldThrowOnError)throw l;if(tt(l))return{data:null,error:l};throw l}}async listV2(n,e){var a=this;try{const i=xe({},n);return{data:await Dn(a.fetch,`${a.url}/object/list-v2/${a.bucketId}`,i,{headers:a.headers},e),error:null}}catch(i){if(a.shouldThrowOnError)throw i;if(tt(i))return{data:null,error:i};throw i}}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(n){const e=[];return n.width&&e.push(`width=${n.width}`),n.height&&e.push(`height=${n.height}`),n.resize&&e.push(`resize=${n.resize}`),n.format&&e.push(`format=${n.format}`),n.quality&&e.push(`quality=${n.quality}`),e.join("&")}};const fw="2.90.1",mw={"X-Client-Info":`storage-js/${fw}`};var uA=class{constructor(n,e={},a,i){this.shouldThrowOnError=!1;const l=new URL(n);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(l.hostname)&&!l.hostname.includes("storage.supabase.")&&(l.hostname=l.hostname.replace("supabase.","storage.supabase.")),this.url=l.href.replace(/\/$/,""),this.headers=xe(xe({},mw),e),this.fetch=Rm(a)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(n){var e=this;try{const a=e.listBucketOptionsToQueryString(n);return{data:await Go(e.fetch,`${e.url}/bucket${a}`,{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(tt(a))return{data:null,error:a};throw a}}async getBucket(n){var e=this;try{return{data:await Go(e.fetch,`${e.url}/bucket/${n}`,{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(tt(a))return{data:null,error:a};throw a}}async createBucket(n,e={public:!1}){var a=this;try{return{data:await Dn(a.fetch,`${a.url}/bucket`,{id:n,name:n,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:a.headers}),error:null}}catch(i){if(a.shouldThrowOnError)throw i;if(tt(i))return{data:null,error:i};throw i}}async updateBucket(n,e){var a=this;try{return{data:await Hf(a.fetch,`${a.url}/bucket/${n}`,{id:n,name:n,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:a.headers}),error:null}}catch(i){if(a.shouldThrowOnError)throw i;if(tt(i))return{data:null,error:i};throw i}}async emptyBucket(n){var e=this;try{return{data:await Dn(e.fetch,`${e.url}/bucket/${n}/empty`,{},{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(tt(a))return{data:null,error:a};throw a}}async deleteBucket(n){var e=this;try{return{data:await Om(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(tt(a))return{data:null,error:a};throw a}}listBucketOptionsToQueryString(n){const e={};return n&&("limit"in n&&(e.limit=String(n.limit)),"offset"in n&&(e.offset=String(n.offset)),n.search&&(e.search=n.search),n.sortColumn&&(e.sortColumn=n.sortColumn),n.sortOrder&&(e.sortOrder=n.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},dA=class{constructor(n,e={},a){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=xe(xe({},mw),e),this.fetch=Rm(a)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var e=this;try{return{data:await Dn(e.fetch,`${e.url}/bucket`,{name:n},{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(tt(a))return{data:null,error:a};throw a}}async listBuckets(n){var e=this;try{const a=new URLSearchParams;n?.limit!==void 0&&a.set("limit",n.limit.toString()),n?.offset!==void 0&&a.set("offset",n.offset.toString()),n?.sortColumn&&a.set("sortColumn",n.sortColumn),n?.sortOrder&&a.set("sortOrder",n.sortOrder),n?.search&&a.set("search",n.search);const i=a.toString(),l=i?`${e.url}/bucket?${i}`:`${e.url}/bucket`;return{data:await Go(e.fetch,l,{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(tt(a))return{data:null,error:a};throw a}}async deleteBucket(n){var e=this;try{return{data:await Om(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(tt(a))return{data:null,error:a};throw a}}from(n){var e=this;if(!Q2(n))throw new Eu("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 a=new X2({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),i=this.shouldThrowOnError;return new Proxy(a,{get(l,d){const h=l[d];return typeof h!="function"?h:async(...m)=>{try{return{data:await h.apply(l,m),error:null}}catch(p){if(i)throw p;return{data:null,error:p}}}}})}};const Dm={"X-Client-Info":`storage-js/${fw}`,"Content-Type":"application/json"};var pw=class extends Error{constructor(n){super(n),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function ln(n){return typeof n=="object"&&n!==null&&"__isStorageVectorsError"in n}var af=class extends pw{constructor(n,e,a){super(n),this.name="StorageVectorsApiError",this.status=e,this.statusCode=a}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},hA=class extends pw{constructor(n,e){super(n),this.name="StorageVectorsUnknownError",this.originalError=e}};const Mm=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),fA=n=>{if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},U0=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),mA=async(n,e,a)=>{if(n&&typeof n=="object"&&"status"in n&&"ok"in n&&typeof n.status=="number"&&!a?.noResolveJson){const i=n.status||500,l=n;if(typeof l.json=="function")l.json().then(d=>{const h=d?.statusCode||d?.code||i+"";e(new af(U0(d),i,h))}).catch(()=>{const d=i+"";e(new af(l.statusText||`HTTP ${i} error`,i,d))});else{const d=i+"";e(new af(l.statusText||`HTTP ${i} error`,i,d))}}else e(new hA(U0(n),n))},pA=(n,e,a,i)=>{const l={method:n,headers:e?.headers||{}};return i?(fA(i)?(l.headers=xe({"Content-Type":"application/json"},e?.headers),l.body=JSON.stringify(i)):l.body=i,xe(xe({},l),a)):l};async function gA(n,e,a,i,l,d){return new Promise((h,m)=>{n(a,pA(e,i,l,d)).then(p=>{if(!p.ok)throw p;if(i?.noResolveJson)return p;const y=p.headers.get("content-type");return!y||!y.includes("application/json")?{}:p.json()}).then(p=>h(p)).catch(p=>mA(p,m,i))})}async function cn(n,e,a,i,l){return gA(n,"POST",e,i,l,a)}var yA=class{constructor(n,e={},a){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=xe(xe({},Dm),e),this.fetch=Mm(a)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(n){var e=this;try{return{data:await cn(e.fetch,`${e.url}/CreateIndex`,n,{headers:e.headers})||{},error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async getIndex(n,e){var a=this;try{return{data:await cn(a.fetch,`${a.url}/GetIndex`,{vectorBucketName:n,indexName:e},{headers:a.headers}),error:null}}catch(i){if(a.shouldThrowOnError)throw i;if(ln(i))return{data:null,error:i};throw i}}async listIndexes(n){var e=this;try{return{data:await cn(e.fetch,`${e.url}/ListIndexes`,n,{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async deleteIndex(n,e){var a=this;try{return{data:await cn(a.fetch,`${a.url}/DeleteIndex`,{vectorBucketName:n,indexName:e},{headers:a.headers})||{},error:null}}catch(i){if(a.shouldThrowOnError)throw i;if(ln(i))return{data:null,error:i};throw i}}},vA=class{constructor(n,e={},a){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=xe(xe({},Dm),e),this.fetch=Mm(a)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(n){var e=this;try{if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await cn(e.fetch,`${e.url}/PutVectors`,n,{headers:e.headers})||{},error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async getVectors(n){var e=this;try{return{data:await cn(e.fetch,`${e.url}/GetVectors`,n,{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async listVectors(n){var e=this;try{if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return{data:await cn(e.fetch,`${e.url}/ListVectors`,n,{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async queryVectors(n){var e=this;try{return{data:await cn(e.fetch,`${e.url}/QueryVectors`,n,{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async deleteVectors(n){var e=this;try{if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await cn(e.fetch,`${e.url}/DeleteVectors`,n,{headers:e.headers})||{},error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}},xA=class{constructor(n,e={},a){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=xe(xe({},Dm),e),this.fetch=Mm(a)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var e=this;try{return{data:await cn(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{},error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async getBucket(n){var e=this;try{return{data:await cn(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:n},{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async listBuckets(n={}){var e=this;try{return{data:await cn(e.fetch,`${e.url}/ListVectorBuckets`,n,{headers:e.headers}),error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}async deleteBucket(n){var e=this;try{return{data:await cn(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{},error:null}}catch(a){if(e.shouldThrowOnError)throw a;if(ln(a))return{data:null,error:a};throw a}}},bA=class extends xA{constructor(n,e={}){super(n,e.headers||{},e.fetch)}from(n){return new wA(this.url,this.headers,n,this.fetch)}async createBucket(n){var e=()=>super.createBucket,a=this;return e().call(a,n)}async getBucket(n){var e=()=>super.getBucket,a=this;return e().call(a,n)}async listBuckets(n={}){var e=()=>super.listBuckets,a=this;return e().call(a,n)}async deleteBucket(n){var e=()=>super.deleteBucket,a=this;return e().call(a,n)}},wA=class extends yA{constructor(n,e,a,i){super(n,e,i),this.vectorBucketName=a}async createIndex(n){var e=()=>super.createIndex,a=this;return e().call(a,xe(xe({},n),{},{vectorBucketName:a.vectorBucketName}))}async listIndexes(n={}){var e=()=>super.listIndexes,a=this;return e().call(a,xe(xe({},n),{},{vectorBucketName:a.vectorBucketName}))}async getIndex(n){var e=()=>super.getIndex,a=this;return e().call(a,a.vectorBucketName,n)}async deleteIndex(n){var e=()=>super.deleteIndex,a=this;return e().call(a,a.vectorBucketName,n)}index(n){return new SA(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},SA=class extends vA{constructor(n,e,a,i,l){super(n,e,l),this.vectorBucketName=a,this.indexName=i}async putVectors(n){var e=()=>super.putVectors,a=this;return e().call(a,xe(xe({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}async getVectors(n){var e=()=>super.getVectors,a=this;return e().call(a,xe(xe({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}async listVectors(n={}){var e=()=>super.listVectors,a=this;return e().call(a,xe(xe({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}async queryVectors(n){var e=()=>super.queryVectors,a=this;return e().call(a,xe(xe({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}async deleteVectors(n){var e=()=>super.deleteVectors,a=this;return e().call(a,xe(xe({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}},_A=class extends uA{constructor(n,e={},a,i){super(n,e,a,i)}from(n){return new cA(this.url,this.headers,n,this.fetch)}get vectors(){return new bA(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new dA(this.url+"/iceberg",this.headers,this.fetch)}};const gw="2.90.1",ii=30*1e3,Gf=3,rf=Gf*ii,jA="http://localhost:9999",EA="supabase.auth.token",TA={"X-Client-Info":`gotrue-js/${gw}`},Ff="X-Supabase-Api-Version",yw={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},NA=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,AA=600*1e3;class Fo extends Error{constructor(e,a,i){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=a,this.code=i}}function me(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class kA extends Fo{constructor(e,a,i){super(e,a,i),this.name="AuthApiError",this.status=a,this.code=i}}function CA(n){return me(n)&&n.name==="AuthApiError"}class Ba extends Fo{constructor(e,a){super(e),this.name="AuthUnknownError",this.originalError=a}}class vs extends Fo{constructor(e,a,i,l){super(e,i,l),this.name=a,this.status=i}}class on extends vs{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function RA(n){return me(n)&&n.name==="AuthSessionMissingError"}class Jr extends vs{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Lc extends vs{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Uc extends vs{constructor(e,a=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=a}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function OA(n){return me(n)&&n.name==="AuthImplicitGrantRedirectError"}class P0 extends vs{constructor(e,a=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=a}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class DA extends vs{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 Kf extends vs{constructor(e,a){super(e,"AuthRetryableFetchError",a,void 0)}}function of(n){return me(n)&&n.name==="AuthRetryableFetchError"}class V0 extends vs{constructor(e,a,i){super(e,"AuthWeakPasswordError",a,"weak_password"),this.reasons=i}}class Yf extends vs{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const uu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),B0=`
35
- \r=`.split(""),MA=(()=>{const n=new Array(128);for(let e=0;e<n.length;e+=1)n[e]=-1;for(let e=0;e<B0.length;e+=1)n[B0[e].charCodeAt(0)]=-2;for(let e=0;e<uu.length;e+=1)n[uu[e].charCodeAt(0)]=e;return n})();function I0(n,e,a){if(n!==null)for(e.queue=e.queue<<8|n,e.queuedBits+=8;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;a(uu[i]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;a(uu[i]),e.queuedBits-=6}}function vw(n,e,a){const i=MA[n];if(i>-1)for(e.queue=e.queue<<6|i,e.queuedBits+=6;e.queuedBits>=8;)a(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(i===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function q0(n){const e=[],a=h=>{e.push(String.fromCodePoint(h))},i={utf8seq:0,codepoint:0},l={queue:0,queuedBits:0},d=h=>{UA(h,i,a)};for(let h=0;h<n.length;h+=1)vw(n.charCodeAt(h),l,d);return e.join("")}function zA(n,e){if(n<=127){e(n);return}else if(n<=2047){e(192|n>>6),e(128|n&63);return}else if(n<=65535){e(224|n>>12),e(128|n>>6&63),e(128|n&63);return}else if(n<=1114111){e(240|n>>18),e(128|n>>12&63),e(128|n>>6&63),e(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function LA(n,e){for(let a=0;a<n.length;a+=1){let i=n.charCodeAt(a);if(i>55295&&i<=56319){const l=(i-55296)*1024&65535;i=(n.charCodeAt(a+1)-56320&65535|l)+65536,a+=1}zA(i,e)}}function UA(n,e,a){if(e.utf8seq===0){if(n<=127){a(n);return}for(let i=1;i<6;i+=1)if((n>>7-i&1)===0){e.utf8seq=i;break}if(e.utf8seq===2)e.codepoint=n&31;else if(e.utf8seq===3)e.codepoint=n&15;else if(e.utf8seq===4)e.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|n&63,e.utf8seq-=1,e.utf8seq===0&&a(e.codepoint)}}function mi(n){const e=[],a={queue:0,queuedBits:0},i=l=>{e.push(l)};for(let l=0;l<n.length;l+=1)vw(n.charCodeAt(l),a,i);return new Uint8Array(e)}function PA(n){const e=[];return LA(n,a=>e.push(a)),new Uint8Array(e)}function $a(n){const e=[],a={queue:0,queuedBits:0},i=l=>{e.push(l)};return n.forEach(l=>I0(l,a,i)),I0(null,a,i),e.join("")}function VA(n){return Math.round(Date.now()/1e3)+n}function BA(){return Symbol("auth-callback")}const Dt=()=>typeof window<"u"&&typeof document<"u",Da={tested:!1,writable:!1},xw=()=>{if(!Dt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Da.tested)return Da.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),Da.tested=!0,Da.writable=!0}catch{Da.tested=!0,Da.writable=!1}return Da.writable};function IA(n){const e={},a=new URL(n);if(a.hash&&a.hash[0]==="#")try{new URLSearchParams(a.hash.substring(1)).forEach((l,d)=>{e[d]=l})}catch{}return a.searchParams.forEach((i,l)=>{e[l]=i}),e}const bw=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),qA=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",oi=async(n,e,a)=>{await n.setItem(e,JSON.stringify(a))},Ma=async(n,e)=>{const a=await n.getItem(e);if(!a)return null;try{return JSON.parse(a)}catch{return a}},Ot=async(n,e)=>{await n.removeItem(e)};class Tu{constructor(){this.promise=new Tu.promiseConstructor((e,a)=>{this.resolve=e,this.reject=a})}}Tu.promiseConstructor=Promise;function lf(n){const e=n.split(".");if(e.length!==3)throw new Yf("Invalid JWT structure");for(let i=0;i<e.length;i++)if(!NA.test(e[i]))throw new Yf("JWT not in base64url format");return{header:JSON.parse(q0(e[0])),payload:JSON.parse(q0(e[1])),signature:mi(e[2]),raw:{header:e[0],payload:e[1]}}}async function $A(n){return await new Promise(e=>{setTimeout(()=>e(null),n)})}function HA(n,e){return new Promise((i,l)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await n(d);if(!e(d,null,h)){i(h);return}}catch(h){if(!e(d,h)){l(h);return}}})()})}function GA(n){return("0"+n.toString(16)).substr(-2)}function FA(){const e=new Uint32Array(56);if(typeof crypto>"u"){const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=a.length;let l="";for(let d=0;d<56;d++)l+=a.charAt(Math.floor(Math.random()*i));return l}return crypto.getRandomValues(e),Array.from(e,GA).join("")}async function KA(n){const a=new TextEncoder().encode(n),i=await crypto.subtle.digest("SHA-256",a),l=new Uint8Array(i);return Array.from(l).map(d=>String.fromCharCode(d)).join("")}async function YA(n){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),n;const a=await KA(n);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Zr(n,e,a=!1){const i=FA();let l=i;a&&(l+="/PASSWORD_RECOVERY"),await oi(n,`${e}-code-verifier`,l);const d=await YA(i);return[d,i===d?"plain":"s256"]}const XA=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function WA(n){const e=n.headers.get(Ff);if(!e||!e.match(XA))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function JA(n){if(!n)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(n<=e)throw new Error("JWT has expired")}function ZA(n){switch(n){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const QA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Qr(n){if(!QA.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function cf(){const n={};return new Proxy(n,{get:(e,a)=>{if(a==="__isUserNotAvailableProxy")return!0;if(typeof a=="symbol"){const i=a.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="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 "${a}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,a)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${a}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,a)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${a}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function ek(n,e){return new Proxy(n,{get:(a,i,l)=>{if(i==="__isInsecureUserWarningProxy")return!0;if(typeof i=="symbol"){const d=i.toString();if(d==="Symbol(Symbol.toPrimitive)"||d==="Symbol(Symbol.toStringTag)"||d==="Symbol(util.inspect.custom)"||d==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(a,i,l)}return!e.value&&typeof i=="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."),e.value=!0),Reflect.get(a,i,l)}})}function $0(n){return JSON.parse(JSON.stringify(n))}const La=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),tk=[502,503,504];async function H0(n){var e;if(!qA(n))throw new Kf(La(n),0);if(tk.includes(n.status))throw new Kf(La(n),n.status);let a;try{a=await n.json()}catch(d){throw new Ba(La(d),d)}let i;const l=WA(n);if(l&&l.getTime()>=yw["2024-01-01"].timestamp&&typeof a=="object"&&a&&typeof a.code=="string"?i=a.code:typeof a=="object"&&a&&typeof a.error_code=="string"&&(i=a.error_code),i){if(i==="weak_password")throw new V0(La(a),n.status,((e=a.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(i==="session_not_found")throw new on}else if(typeof a=="object"&&a&&typeof a.weak_password=="object"&&a.weak_password&&Array.isArray(a.weak_password.reasons)&&a.weak_password.reasons.length&&a.weak_password.reasons.reduce((d,h)=>d&&typeof h=="string",!0))throw new V0(La(a),n.status,a.weak_password.reasons);throw new kA(La(a),n.status||500,i)}const nk=(n,e,a,i)=>{const l={method:n,headers:e?.headers||{}};return n==="GET"?l:(l.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),l.body=JSON.stringify(i),Object.assign(Object.assign({},l),a))};async function ve(n,e,a,i){var l;const d=Object.assign({},i?.headers);d[Ff]||(d[Ff]=yw["2024-01-01"].name),i?.jwt&&(d.Authorization=`Bearer ${i.jwt}`);const h=(l=i?.query)!==null&&l!==void 0?l:{};i?.redirectTo&&(h.redirect_to=i.redirectTo);const m=Object.keys(h).length?"?"+new URLSearchParams(h).toString():"",p=await sk(n,e,a+m,{headers:d,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(p):{data:Object.assign({},p),error:null}}async function sk(n,e,a,i,l,d){const h=nk(e,i,l,d);let m;try{m=await n(a,Object.assign({},h))}catch(p){throw console.error(p),new Kf(La(p),0)}if(m.ok||await H0(m),i?.noResolveJson)return m;try{return await m.json()}catch(p){await H0(p)}}function Rn(n){var e;let a=null;ik(n)&&(a=Object.assign({},n),n.expires_at||(a.expires_at=VA(n.expires_in)));const i=(e=n.user)!==null&&e!==void 0?e:n;return{data:{session:a,user:i},error:null}}function G0(n){const e=Rn(n);return!e.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((a,i)=>a&&typeof i=="string",!0)&&(e.data.weak_password=n.weak_password),e}function Ws(n){var e;return{data:{user:(e=n.user)!==null&&e!==void 0?e:n},error:null}}function ak(n){return{data:n,error:null}}function rk(n){const{action_link:e,email_otp:a,hashed_token:i,redirect_to:l,verification_type:d}=n,h=_i(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),m={action_link:e,email_otp:a,hashed_token:i,redirect_to:l,verification_type:d},p=Object.assign({},h);return{data:{properties:m,user:p},error:null}}function F0(n){return n}function ik(n){return n.access_token&&n.refresh_token&&n.expires_in}const uf=["global","local","others"];class ok{constructor({url:e="",headers:a={},fetch:i}){this.url=e,this.headers=a,this.fetch=bw(i),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(e,a=uf[0]){if(uf.indexOf(a)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${uf.join(", ")}`);try{return await ve(this.fetch,"POST",`${this.url}/logout?scope=${a}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(i){if(me(i))return{data:null,error:i};throw i}}async inviteUserByEmail(e,a={}){try{return await ve(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:a.data},headers:this.headers,redirectTo:a.redirectTo,xform:Ws})}catch(i){if(me(i))return{data:{user:null},error:i};throw i}}async generateLink(e){try{const{options:a}=e,i=_i(e,["options"]),l=Object.assign(Object.assign({},i),a);return"newEmail"in i&&(l.new_email=i?.newEmail,delete l.newEmail),await ve(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:l,headers:this.headers,xform:rk,redirectTo:a?.redirectTo})}catch(a){if(me(a))return{data:{properties:null,user:null},error:a};throw a}}async createUser(e){try{return await ve(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Ws})}catch(a){if(me(a))return{data:{user:null},error:a};throw a}}async listUsers(e){var a,i,l,d,h,m,p;try{const y={nextPage:null,lastPage:0,total:0},v=await ve(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(a=e?.page)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:"",per_page:(d=(l=e?.perPage)===null||l===void 0?void 0:l.toString())!==null&&d!==void 0?d:""},xform:F0});if(v.error)throw v.error;const x=await v.json(),w=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,j=(p=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&p!==void 0?p:[];return j.length>0&&(j.forEach(_=>{const T=parseInt(_.split(";")[0].split("=")[1].substring(0,1)),N=JSON.parse(_.split(";")[1].split("=")[1]);y[`${N}Page`]=T}),y.total=parseInt(w)),{data:Object.assign(Object.assign({},x),y),error:null}}catch(y){if(me(y))return{data:{users:[]},error:y};throw y}}async getUserById(e){Qr(e);try{return await ve(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Ws})}catch(a){if(me(a))return{data:{user:null},error:a};throw a}}async updateUserById(e,a){Qr(e);try{return await ve(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:a,headers:this.headers,xform:Ws})}catch(i){if(me(i))return{data:{user:null},error:i};throw i}}async deleteUser(e,a=!1){Qr(e);try{return await ve(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:a},xform:Ws})}catch(i){if(me(i))return{data:{user:null},error:i};throw i}}async _listFactors(e){Qr(e.userId);try{const{data:a,error:i}=await ve(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:l=>({data:{factors:l},error:null})});return{data:a,error:i}}catch(a){if(me(a))return{data:null,error:a};throw a}}async _deleteFactor(e){Qr(e.userId),Qr(e.id);try{return{data:await ve(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(a){if(me(a))return{data:null,error:a};throw a}}async _listOAuthClients(e){var a,i,l,d,h,m,p;try{const y={nextPage:null,lastPage:0,total:0},v=await ve(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(a=e?.page)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:"",per_page:(d=(l=e?.perPage)===null||l===void 0?void 0:l.toString())!==null&&d!==void 0?d:""},xform:F0});if(v.error)throw v.error;const x=await v.json(),w=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,j=(p=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&p!==void 0?p:[];return j.length>0&&(j.forEach(_=>{const T=parseInt(_.split(";")[0].split("=")[1].substring(0,1)),N=JSON.parse(_.split(";")[1].split("=")[1]);y[`${N}Page`]=T}),y.total=parseInt(w)),{data:Object.assign(Object.assign({},x),y),error:null}}catch(y){if(me(y))return{data:{clients:[]},error:y};throw y}}async _createOAuthClient(e){try{return await ve(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(me(a))return{data:null,error:a};throw a}}async _getOAuthClient(e){try{return await ve(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(me(a))return{data:null,error:a};throw a}}async _updateOAuthClient(e,a){try{return await ve(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:a,headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(me(i))return{data:null,error:i};throw i}}async _deleteOAuthClient(e){try{return await ve(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(a){if(me(a))return{data:null,error:a};throw a}}async _regenerateOAuthClientSecret(e){try{return await ve(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(me(a))return{data:null,error:a};throw a}}}function K0(n={}){return{getItem:e=>n[e]||null,setItem:(e,a)=>{n[e]=a},removeItem:e=>{delete n[e]}}}const ei={debug:!!(globalThis&&xw()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class ww extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class lk extends ww{}async function ck(n,e,a){ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",n,e);const i=new globalThis.AbortController;return e>0&&setTimeout(()=>{i.abort(),ei.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",n)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(n,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async l=>{if(l){ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",n,l.name);try{return await a()}finally{ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",n,l.name)}}else{if(e===0)throw ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",n),new lk(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(ei.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 a()}}))}function uk(){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 Sw(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function dk(n){return parseInt(n,16)}function hk(n){const e=new TextEncoder().encode(n);return"0x"+Array.from(e,i=>i.toString(16).padStart(2,"0")).join("")}function fk(n){var e;const{chainId:a,domain:i,expirationTime:l,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:p,resources:y,scheme:v,uri:x,version:w}=n;{if(!Number.isInteger(a))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${a}`);if(!i)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(h&&h.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${h}`);if(!x)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((e=n.statement)===null||e===void 0)&&e.includes(`
36
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const j=Sw(n.address),_=v?`${v}://${i}`:i,T=n.statement?`${n.statement}
37
- `:"",N=`${_} wants you to sign in with your Ethereum account:
38
- ${j}
39
-
40
- ${T}`;let A=`URI: ${x}
41
- Version: ${w}
42
- Chain ID: ${a}${h?`
43
- Nonce: ${h}`:""}
44
- Issued At: ${d.toISOString()}`;if(l&&(A+=`
45
- Expiration Time: ${l.toISOString()}`),m&&(A+=`
46
- Not Before: ${m.toISOString()}`),p&&(A+=`
47
- Request ID: ${p}`),y){let M=`
48
- Resources:`;for(const k of y){if(!k||typeof k!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${k}`);M+=`
49
- - ${k}`}A+=M}return`${N}
50
- ${A}`}class mt extends Error{constructor({message:e,code:a,cause:i,name:l}){var d;super(e,{cause:i}),this.__isWebAuthnError=!0,this.name=(d=l??(i instanceof Error?i.name:void 0))!==null&&d!==void 0?d:"Unknown Error",this.code=a}}class du extends mt{constructor(e,a){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:a,message:e}),this.name="WebAuthnUnknownError",this.originalError=a}}function mk({error:n,options:e}){var a,i,l;const{publicKey:d}=e;if(!d)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new mt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((a=d.authenticatorSelection)===null||a===void 0?void 0:a.requireResidentKey)===!0)return new mt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(e.mediation==="conditional"&&((i=d.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new mt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((l=d.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new mt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new mt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new mt({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return d.pubKeyCredParams.filter(m=>m.type==="public-key").length===0?new mt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new mt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const h=window.location.hostname;if(_w(h)){if(d.rp.id!==h)return new mt({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new mt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(d.user.id.byteLength<1||d.user.id.byteLength>64)return new mt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new mt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new mt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function pk({error:n,options:e}){const{publicKey:a}=e;if(!a)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new mt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new mt({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const i=window.location.hostname;if(_w(i)){if(a.rpId!==i)return new mt({message:`The RP ID "${a.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new mt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new mt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new mt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class gk{createNewAbortSignal(){if(this.controller){const a=new Error("Cancelling existing WebAuthn API call for new one");a.name="AbortError",this.controller.abort(a)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const yk=new gk;function vk(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:e,user:a,excludeCredentials:i}=n,l=_i(n,["challenge","user","excludeCredentials"]),d=mi(e).buffer,h=Object.assign(Object.assign({},a),{id:mi(a.id).buffer}),m=Object.assign(Object.assign({},l),{challenge:d,user:h});if(i&&i.length>0){m.excludeCredentials=new Array(i.length);for(let p=0;p<i.length;p++){const y=i[p];m.excludeCredentials[p]=Object.assign(Object.assign({},y),{id:mi(y.id).buffer,type:y.type||"public-key",transports:y.transports})}}return m}function xk(n){if(!n)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(n);const{challenge:e,allowCredentials:a}=n,i=_i(n,["challenge","allowCredentials"]),l=mi(e).buffer,d=Object.assign(Object.assign({},i),{challenge:l});if(a&&a.length>0){d.allowCredentials=new Array(a.length);for(let h=0;h<a.length;h++){const m=a[h];d.allowCredentials[h]=Object.assign(Object.assign({},m),{id:mi(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function bk(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const a=n;return{id:n.id,rawId:n.id,response:{attestationObject:$a(new Uint8Array(n.response.attestationObject)),clientDataJSON:$a(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:(e=a.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function wk(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const a=n,i=n.getClientExtensionResults(),l=n.response;return{id:n.id,rawId:n.id,response:{authenticatorData:$a(new Uint8Array(l.authenticatorData)),clientDataJSON:$a(new Uint8Array(l.clientDataJSON)),signature:$a(new Uint8Array(l.signature)),userHandle:l.userHandle?$a(new Uint8Array(l.userHandle)):void 0},type:"public-key",clientExtensionResults:i,authenticatorAttachment:(e=a.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function _w(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function Y0(){var n,e;return!!(Dt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Sk(n){try{const e=await navigator.credentials.create(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new du("Browser returned unexpected credential type",e)}:{data:null,error:new du("Empty credential response",e)}}catch(e){return{data:null,error:mk({error:e,options:n})}}}async function _k(n){try{const e=await navigator.credentials.get(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new du("Browser returned unexpected credential type",e)}:{data:null,error:new du("Empty credential response",e)}}catch(e){return{data:null,error:pk({error:e,options:n})}}}const jk={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Ek={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function hu(...n){const e=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),a=l=>l instanceof ArrayBuffer||ArrayBuffer.isView(l),i={};for(const l of n)if(l)for(const d in l){const h=l[d];if(h!==void 0)if(Array.isArray(h))i[d]=h;else if(a(h))i[d]=h;else if(e(h)){const m=i[d];e(m)?i[d]=hu(m,h):i[d]=hu(h)}else i[d]=h}return i}function Tk(n,e){return hu(jk,n,e||{})}function Nk(n,e){return hu(Ek,n,e||{})}class Ak{constructor(e){this.client=e,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(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:a,friendlyName:i,signal:l},d){try{const{data:h,error:m}=await this.client.mfa.challenge({factorId:e,webauthn:a});if(!h)return{data:null,error:m};const p=l??yk.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:y}=h.webauthn.credential_options.publicKey;y.name||(y.name=`${y.id}:${i}`),y.displayName||(y.displayName=y.name)}switch(h.webauthn.type){case"create":{const y=Tk(h.webauthn.credential_options.publicKey,d?.create),{data:v,error:x}=await Sk({publicKey:y,signal:p});return v?{data:{factorId:e,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:x}}case"request":{const y=Nk(h.webauthn.credential_options.publicKey,d?.request),{data:v,error:x}=await _k(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:y,signal:p}));return v?{data:{factorId:e,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:x}}}}catch(h){return me(h)?{data:null,error:h}:{data:null,error:new Ba("Unexpected error in challenge",h)}}}async _verify({challengeId:e,factorId:a,webauthn:i}){return this.client.mfa.verify({factorId:a,challengeId:e,webauthn:i})}async _authenticate({factorId:e,webauthn:{rpId:a=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},d){if(!a)return{data:null,error:new Fo("rpId is required for WebAuthn authentication")};try{if(!Y0())return{data:null,error:new Ba("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this.challenge({factorId:e,webauthn:{rpId:a,rpOrigins:i},signal:l},{request:d});if(!h)return{data:null,error:m};const{webauthn:p}=h;return this._verify({factorId:e,challengeId:h.challengeId,webauthn:{type:p.type,rpId:a,rpOrigins:i,credential_response:p.credential_response}})}catch(h){return me(h)?{data:null,error:h}:{data:null,error:new Ba("Unexpected error in authenticate",h)}}}async _register({friendlyName:e,webauthn:{rpId:a=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},d){if(!a)return{data:null,error:new Fo("rpId is required for WebAuthn registration")};try{if(!Y0())return{data:null,error:new Ba("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this._enroll({friendlyName:e});if(!h)return await this.client.mfa.listFactors().then(v=>{var x;return(x=v.data)===null||x===void 0?void 0:x.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(v=>v?this.client.mfa.unenroll({factorId:v?.id}):void 0),{data:null,error:m};const{data:p,error:y}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:a,rpOrigins:i},signal:l},{create:d});return p?this._verify({factorId:h.id,challengeId:p.challengeId,webauthn:{rpId:a,rpOrigins:i,type:p.webauthn.type,credential_response:p.webauthn.credential_response}}):{data:null,error:y}}catch(h){return me(h)?{data:null,error:h}:{data:null,error:new Ba("Unexpected error in register",h)}}}}uk();const kk={url:jA,storageKey:EA,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:TA,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function X0(n,e,a){return await a()}const ti={};class Ko{get jwks(){var e,a;return(a=(e=ti[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&a!==void 0?a:{keys:[]}}set jwks(e){ti[this.storageKey]=Object.assign(Object.assign({},ti[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,a;return(a=(e=ti[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&a!==void 0?a:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ti[this.storageKey]=Object.assign(Object.assign({},ti[this.storageKey]),{cachedAt:e})}constructor(e){var a,i,l;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({},kk),e);if(this.storageKey=d.storageKey,this.instanceID=(a=Ko.nextInstanceID[this.storageKey])!==null&&a!==void 0?a:0,Ko.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Dt()){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 ok({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=bw(d.fetch),this.lock=d.lock||X0,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&&Dt()&&(!((i=globalThis?.navigator)===null||i===void 0)&&i.locks)?this.lock=ck:this.lock=X0,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 Ak(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:xw()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=K0(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=K0(this.memoryStorage)),Dt()&&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)}(l=this.broadcastChannel)===null||l===void 0||l.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(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${gw}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),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 e;try{let a={},i="none";if(Dt()&&(a=IA(window.location.href),this._isImplicitGrantCallback(a)?i="implicit":await this._isPKCECallback(a)&&(i="pkce")),Dt()&&this.detectSessionInUrl&&i!=="none"){const{data:l,error:d}=await this._getSessionFromURL(a,i);if(d){if(this._debug("#_initialize()","error detecting session from URL",d),OA(d)){const p=(e=d.details)===null||e===void 0?void 0:e.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}=l;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(a){return me(a)?this._returnResult({error:a}):this._returnResult({error:new Ba("Unexpected error during initialization",a)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var a,i,l;try{const d=await ve(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(a=e?.options)===null||a===void 0?void 0:a.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(l=e?.options)===null||l===void 0?void 0:l.captchaToken}},xform:Rn}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const p=h.session,y=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:y,session:p},error:null})}catch(d){if(me(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signUp(e){var a,i,l;try{let d;if("email"in e){const{email:v,password:x,options:w}=e;let j=null,_=null;this.flowType==="pkce"&&([j,_]=await Zr(this.storage,this.storageKey)),d=await ve(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w?.emailRedirectTo,body:{email:v,password:x,data:(a=w?.data)!==null&&a!==void 0?a:{},gotrue_meta_security:{captcha_token:w?.captchaToken},code_challenge:j,code_challenge_method:_},xform:Rn})}else if("phone"in e){const{phone:v,password:x,options:w}=e;d=await ve(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:x,data:(i=w?.data)!==null&&i!==void 0?i:{},channel:(l=w?.channel)!==null&&l!==void 0?l:"sms",gotrue_meta_security:{captcha_token:w?.captchaToken}},xform:Rn})}else throw new Lc("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await Ot(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const p=h.session,y=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:y,session:p},error:null})}catch(d){if(await Ot(this.storage,`${this.storageKey}-code-verifier`),me(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signInWithPassword(e){try{let a;if("email"in e){const{email:d,password:h,options:m}=e;a=await ve(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:G0})}else if("phone"in e){const{phone:d,password:h,options:m}=e;a=await ve(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:G0})}else throw new Lc("You must provide either an email or phone number and a password");const{data:i,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!i||!i.session||!i.user){const d=new Jr;return this._returnResult({data:{user:null,session:null},error:d})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:l})}catch(a){if(me(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithOAuth(e){var a,i,l,d;return await this._handleProviderSignIn(e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:(d=e.options)===null||d===void 0?void 0:d.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:a}=e;switch(a){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${a}"`)}}async signInWithEthereum(e){var a,i,l,d,h,m,p,y,v,x,w;let j,_;if("message"in e)j=e.message,_=e.signature;else{const{chain:T,wallet:N,statement:A,options:M}=e;let k;if(Dt())if(typeof N=="object")k=N;else{const Z=window;if("ethereum"in Z&&typeof Z.ethereum=="object"&&"request"in Z.ethereum&&typeof Z.ethereum.request=="function")k=Z.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 N!="object"||!M?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=N}const U=new URL((a=M?.url)!==null&&a!==void 0?a:window.location.href),F=await k.request({method:"eth_requestAccounts"}).then(Z=>Z).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!F||F.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const K=Sw(F[0]);let P=(i=M?.signInWithEthereum)===null||i===void 0?void 0:i.chainId;if(!P){const Z=await k.request({method:"eth_chainId"});P=dk(Z)}const z={domain:U.host,address:K,statement:A,uri:U.href,version:"1",chainId:P,nonce:(l=M?.signInWithEthereum)===null||l===void 0?void 0:l.nonce,issuedAt:(h=(d=M?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=M?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(p=M?.signInWithEthereum)===null||p===void 0?void 0:p.notBefore,requestId:(y=M?.signInWithEthereum)===null||y===void 0?void 0:y.requestId,resources:(v=M?.signInWithEthereum)===null||v===void 0?void 0:v.resources};j=fk(z),_=await k.request({method:"personal_sign",params:[hk(j),K]})}try{const{data:T,error:N}=await ve(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:j,signature:_},!((x=e.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Rn});if(N)throw N;if(!T||!T.session||!T.user){const A=new Jr;return this._returnResult({data:{user:null,session:null},error:A})}return T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),this._returnResult({data:Object.assign({},T),error:N})}catch(T){if(me(T))return this._returnResult({data:{user:null,session:null},error:T});throw T}}async signInWithSolana(e){var a,i,l,d,h,m,p,y,v,x,w,j;let _,T;if("message"in e)_=e.message,T=e.signature;else{const{chain:N,wallet:A,statement:M,options:k}=e;let U;if(Dt())if(typeof A=="object")U=A;else{const K=window;if("solana"in K&&typeof K.solana=="object"&&("signIn"in K.solana&&typeof K.solana.signIn=="function"||"signMessage"in K.solana&&typeof K.solana.signMessage=="function"))U=K.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 A!="object"||!k?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");U=A}const F=new URL((a=k?.url)!==null&&a!==void 0?a:window.location.href);if("signIn"in U&&U.signIn){const K=await U.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},k?.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),M?{statement:M}:null));let P;if(Array.isArray(K)&&K[0]&&typeof K[0]=="object")P=K[0];else if(K&&typeof K=="object"&&"signedMessage"in K&&"signature"in K)P=K;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)_=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),T=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in U)||typeof U.signMessage!="function"||!("publicKey"in U)||typeof U!="object"||!U.publicKey||!("toBase58"in U.publicKey)||typeof U.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");_=[`${F.host} wants you to sign in with your Solana account:`,U.publicKey.toBase58(),...M?["",M,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(l=(i=k?.signInWithSolana)===null||i===void 0?void 0:i.issuedAt)!==null&&l!==void 0?l:new Date().toISOString()}`,...!((d=k?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${k.signInWithSolana.notBefore}`]:[],...!((h=k?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${k.signInWithSolana.expirationTime}`]:[],...!((m=k?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${k.signInWithSolana.chainId}`]:[],...!((p=k?.signInWithSolana)===null||p===void 0)&&p.nonce?[`Nonce: ${k.signInWithSolana.nonce}`]:[],...!((y=k?.signInWithSolana)===null||y===void 0)&&y.requestId?[`Request ID: ${k.signInWithSolana.requestId}`]:[],...!((x=(v=k?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||x===void 0)&&x.length?["Resources",...k.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
51
- `);const K=await U.signMessage(new TextEncoder().encode(_),"utf8");if(!K||!(K instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");T=K}}try{const{data:N,error:A}=await ve(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:_,signature:$a(T)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(j=e.options)===null||j===void 0?void 0:j.captchaToken}}:null),xform:Rn});if(A)throw A;if(!N||!N.session||!N.user){const M=new Jr;return this._returnResult({data:{user:null,session:null},error:M})}return N.session&&(await this._saveSession(N.session),await this._notifyAllSubscribers("SIGNED_IN",N.session)),this._returnResult({data:Object.assign({},N),error:A})}catch(N){if(me(N))return this._returnResult({data:{user:null,session:null},error:N});throw N}}async _exchangeCodeForSession(e){const a=await Ma(this.storage,`${this.storageKey}-code-verifier`),[i,l]=(a??"").split("/");try{if(!i&&this.flowType==="pkce")throw new DA;const{data:d,error:h}=await ve(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:Rn});if(await Ot(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new Jr;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:l??null}),error:h})}catch(d){if(await Ot(this.storage,`${this.storageKey}-code-verifier`),me(d))return this._returnResult({data:{user:null,session:null,redirectType:null},error:d});throw d}}async signInWithIdToken(e){try{const{options:a,provider:i,token:l,access_token:d,nonce:h}=e,m=await ve(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:l,access_token:d,nonce:h,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:Rn}),{data:p,error:y}=m;if(y)return this._returnResult({data:{user:null,session:null},error:y});if(!p||!p.session||!p.user){const v=new Jr;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:y})}catch(a){if(me(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithOtp(e){var a,i,l,d,h;try{if("email"in e){const{email:m,options:p}=e;let y=null,v=null;this.flowType==="pkce"&&([y,v]=await Zr(this.storage,this.storageKey));const{error:x}=await ve(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(a=p?.data)!==null&&a!==void 0?a:{},create_user:(i=p?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},code_challenge:y,code_challenge_method:v},redirectTo:p?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:x})}if("phone"in e){const{phone:m,options:p}=e,{data:y,error:v}=await ve(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(l=p?.data)!==null&&l!==void 0?l:{},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:y?.message_id},error:v})}throw new Lc("You must provide either an email or phone number.")}catch(m){if(await Ot(this.storage,`${this.storageKey}-code-verifier`),me(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async verifyOtp(e){var a,i;try{let l,d;"options"in e&&(l=(a=e.options)===null||a===void 0?void 0:a.redirectTo,d=(i=e.options)===null||i===void 0?void 0:i.captchaToken);const{data:h,error:m}=await ve(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:d}}),redirectTo:l,xform:Rn});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const p=h.session,y=h.user;return p?.access_token&&(await this._saveSession(p),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",p)),this._returnResult({data:{user:y,session:p},error:null})}catch(l){if(me(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithSSO(e){var a,i,l,d,h;try{let m=null,p=null;this.flowType==="pkce"&&([m,p]=await Zr(this.storage,this.storageKey));const y=await ve(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(a=e.options)===null||a===void 0?void 0:a.redirectTo)!==null&&i!==void 0?i:void 0}),!((l=e?.options)===null||l===void 0)&&l.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:m,code_challenge_method:p}),headers:this.headers,xform:ak});return!((d=y.data)===null||d===void 0)&&d.url&&Dt()&&!(!((h=e.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(y.data.url),this._returnResult(y)}catch(m){if(await Ot(this.storage,`${this.storageKey}-code-verifier`),me(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 e=>{const{data:{session:a},error:i}=e;if(i)throw i;if(!a)throw new on;const{error:l}=await ve(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:a.access_token});return this._returnResult({data:{user:null,session:null},error:l})})}catch(e){if(me(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const a=`${this.url}/resend`;if("email"in e){const{email:i,type:l,options:d}=e,{error:h}=await ve(this.fetch,"POST",a,{headers:this.headers,body:{email:i,type:l,gotrue_meta_security:{captcha_token:d?.captchaToken}},redirectTo:d?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}else if("phone"in e){const{phone:i,type:l,options:d}=e,{data:h,error:m}=await ve(this.fetch,"POST",a,{headers:this.headers,body:{phone:i,type:l,gotrue_meta_security:{captcha_token:d?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:h?.message_id},error:m})}throw new Lc("You must provide either an email or phone number and a type")}catch(a){if(me(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async a=>a))}async _acquireLock(e,a){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),l=(async()=>(await i,await a()))();return this.pendingInLock.push((async()=>{try{await l}catch{}})()),l}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const i=a();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){const l=[...this.pendingInLock];await Promise.all(l),this.pendingInLock.splice(0,l.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const a=await this.__loadSession();return await e(a)}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 e=null;const a=await Ma(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",a),a!==null&&(this._isValidSession(a)?e=a:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const i=e.expires_at?e.expires_at*1e3-Date.now()<rf:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.userStorage){const h=await Ma(this.userStorage,this.storageKey+"-user");h?.user?e.user=h.user:e.user=cf()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};e.user=ek(e.user,h),h.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:l,error:d}=await this._callRefreshToken(e.refresh_token);return d?this._returnResult({data:{session:null},error:d}):this._returnResult({data:{session:l},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const a=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return a.data.user&&(this.suppressGetSessionWarning=!0),a}async _getUser(e){try{return e?await ve(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Ws}):await this._useSession(async a=>{var i,l,d;const{data:h,error:m}=a;if(m)throw m;return!(!((i=h.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new on}:await ve(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(d=(l=h.session)===null||l===void 0?void 0:l.access_token)!==null&&d!==void 0?d:void 0,xform:Ws})})}catch(a){if(me(a))return RA(a)&&(await this._removeSession(),await Ot(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:a});throw a}}async updateUser(e,a={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,a))}async _updateUser(e,a={}){try{return await this._useSession(async i=>{const{data:l,error:d}=i;if(d)throw d;if(!l.session)throw new on;const h=l.session;let m=null,p=null;this.flowType==="pkce"&&e.email!=null&&([m,p]=await Zr(this.storage,this.storageKey));const{data:y,error:v}=await ve(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:a?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:m,code_challenge_method:p}),jwt:h.access_token,xform:Ws});if(v)throw v;return h.user=y.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(i){if(await Ot(this.storage,`${this.storageKey}-code-verifier`),me(i))return this._returnResult({data:{user:null},error:i});throw i}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new on;const a=Date.now()/1e3;let i=a,l=!0,d=null;const{payload:h}=lf(e.access_token);if(h.exp&&(i=h.exp,l=i<=a),l){const{data:m,error:p}=await this._callRefreshToken(e.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(e.access_token);if(p)throw p;d={access_token:e.access_token,refresh_token:e.refresh_token,user:m.user,token_type:"bearer",expires_in:i-a,expires_at:i},await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)}return this._returnResult({data:{user:d.user,session:d},error:null})}catch(a){if(me(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async a=>{var i;if(!e){const{data:h,error:m}=a;if(m)throw m;e=(i=h.session)!==null&&i!==void 0?i:void 0}if(!e?.refresh_token)throw new on;const{data:l,error:d}=await this._callRefreshToken(e.refresh_token);return d?this._returnResult({data:{user:null,session:null},error:d}):l?this._returnResult({data:{user:l.user,session:l},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(a){if(me(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async _getSessionFromURL(e,a){try{if(!Dt())throw new Uc("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Uc(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(a){case"implicit":if(this.flowType==="pkce")throw new P0("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Uc("Not a valid implicit grant flow url.");break;default:}if(a==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new P0("No code detected.");const{data:M,error:k}=await this._exchangeCodeForSession(e.code);if(k)throw k;const U=new URL(window.location.href);return U.searchParams.delete("code"),window.history.replaceState(window.history.state,"",U.toString()),{data:{session:M.session,redirectType:null},error:null}}const{provider_token:i,provider_refresh_token:l,access_token:d,refresh_token:h,expires_in:m,expires_at:p,token_type:y}=e;if(!d||!m||!h||!y)throw new Uc("No session defined in URL");const v=Math.round(Date.now()/1e3),x=parseInt(m);let w=v+x;p&&(w=parseInt(p));const j=w-v;j*1e3<=ii&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${j}s, should have been closer to ${x}s`);const _=w-x;v-_>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",_,w,v):v-_<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",_,w,v);const{data:T,error:N}=await this._getUser(d);if(N)throw N;const A={provider_token:i,provider_refresh_token:l,access_token:d,expires_in:x,expires_at:w,refresh_token:h,token_type:y,user:T.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:A,redirectType:e.type},error:null})}catch(i){if(me(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const a=await Ma(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&a)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async a=>{var i;const{data:l,error:d}=a;if(d)return this._returnResult({error:d});const h=(i=l.session)===null||i===void 0?void 0:i.access_token;if(h){const{error:m}=await this.admin.signOut(h,e);if(m&&!(CA(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return e!=="others"&&(await this._removeSession(),await Ot(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const a=BA(),i={id:a,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",a),this.stateChangeEmitters.delete(a)}};return this._debug("#onAuthStateChange()","registered callback with id",a),this.stateChangeEmitters.set(a,i),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(a)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async a=>{var i,l;try{const{data:{session:d},error:h}=a;if(h)throw h;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",e,"session",d)}catch(d){await((l=this.stateChangeEmitters.get(e))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",d),console.error(d)}})}async resetPasswordForEmail(e,a={}){let i=null,l=null;this.flowType==="pkce"&&([i,l]=await Zr(this.storage,this.storageKey,!0));try{return await ve(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:l,gotrue_meta_security:{captcha_token:a.captchaToken}},headers:this.headers,redirectTo:a.redirectTo})}catch(d){if(await Ot(this.storage,`${this.storageKey}-code-verifier`),me(d))return this._returnResult({data:null,error:d});throw d}}async getUserIdentities(){var e;try{const{data:a,error:i}=await this.getUser();if(i)throw i;return this._returnResult({data:{identities:(e=a.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(a){if(me(a))return this._returnResult({data:null,error:a});throw a}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var a;try{const{data:i,error:l}=await this._useSession(async d=>{var h,m,p,y,v;const{data:x,error:w}=d;if(w)throw w;const j=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(h=e.options)===null||h===void 0?void 0:h.redirectTo,scopes:(m=e.options)===null||m===void 0?void 0:m.scopes,queryParams:(p=e.options)===null||p===void 0?void 0:p.queryParams,skipBrowserRedirect:!0});return await ve(this.fetch,"GET",j,{headers:this.headers,jwt:(v=(y=x.session)===null||y===void 0?void 0:y.access_token)!==null&&v!==void 0?v:void 0})});if(l)throw l;return Dt()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(i?.url),this._returnResult({data:{provider:e.provider,url:i?.url},error:null})}catch(i){if(me(i))return this._returnResult({data:{provider:e.provider,url:null},error:i});throw i}}async linkIdentityIdToken(e){return await this._useSession(async a=>{var i;try{const{error:l,data:{session:d}}=a;if(l)throw l;const{options:h,provider:m,token:p,access_token:y,nonce:v}=e,x=await ve(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(i=d?.access_token)!==null&&i!==void 0?i:void 0,body:{provider:m,id_token:p,access_token:y,nonce:v,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:Rn}),{data:w,error:j}=x;return j?this._returnResult({data:{user:null,session:null},error:j}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new Jr}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:j}))}catch(l){if(await Ot(this.storage,`${this.storageKey}-code-verifier`),me(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}})}async unlinkIdentity(e){try{return await this._useSession(async a=>{var i,l;const{data:d,error:h}=a;if(h)throw h;return await ve(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(l=(i=d.session)===null||i===void 0?void 0:i.access_token)!==null&&l!==void 0?l:void 0})})}catch(a){if(me(a))return this._returnResult({data:null,error:a});throw a}}async _refreshAccessToken(e){const a=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(a,"begin");try{const i=Date.now();return await HA(async l=>(l>0&&await $A(200*Math.pow(2,l-1)),this._debug(a,"refreshing attempt",l),await ve(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Rn})),(l,d)=>{const h=200*Math.pow(2,l);return d&&of(d)&&Date.now()+h-i<ii})}catch(i){if(this._debug(a,"error",i),me(i))return this._returnResult({data:{session:null,user:null},error:i});throw i}finally{this._debug(a,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,a){const i=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:a.redirectTo,scopes:a.scopes,queryParams:a.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",a,"url",i),Dt()&&!a.skipBrowserRedirect&&window.location.assign(i),{data:{provider:e,url:i},error:null}}async _recoverAndRefresh(){var e,a;const i="#_recoverAndRefresh()";this._debug(i,"begin");try{const l=await Ma(this.storage,this.storageKey);if(l&&this.userStorage){let h=await Ma(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:l.user},await oi(this.userStorage,this.storageKey+"-user",h)),l.user=(e=h?.user)!==null&&e!==void 0?e:cf()}else if(l&&!l.user&&!l.user){const h=await Ma(this.storage,this.storageKey+"-user");h&&h?.user?(l.user=h.user,await Ot(this.storage,this.storageKey+"-user"),await oi(this.storage,this.storageKey,l)):l.user=cf()}if(this._debug(i,"session from storage",l),!this._isValidSession(l)){this._debug(i,"session is not valid"),l!==null&&await this._removeSession();return}const d=((a=l.expires_at)!==null&&a!==void 0?a:1/0)*1e3-Date.now()<rf;if(this._debug(i,`session has${d?"":" not"} expired with margin of ${rf}s`),d){if(this.autoRefreshToken&&l.refresh_token){const{error:h}=await this._callRefreshToken(l.refresh_token);h&&(console.error(h),of(h)||(this._debug(i,"refresh failed with a non-retryable error, removing the session",h),await this._removeSession()))}}else if(l.user&&l.user.__isUserNotAvailableProxy===!0)try{const{data:h,error:m}=await this._getUser(l.access_token);!m&&h?.user?(l.user=h.user,await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)):this._debug(i,"could not get user data, skipping SIGNED_IN notification")}catch(h){console.error("Error getting user data:",h),this._debug(i,"error getting user data, skipping SIGNED_IN notification",h)}else await this._notifyAllSubscribers("SIGNED_IN",l)}catch(l){this._debug(i,"error",l),console.error(l);return}finally{this._debug(i,"end")}}async _callRefreshToken(e){var a,i;if(!e)throw new on;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const l=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(l,"begin");try{this.refreshingDeferred=new Tu;const{data:d,error:h}=await this._refreshAccessToken(e);if(h)throw h;if(!d.session)throw new on;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(l,"error",d),me(d)){const h={data:null,error:d};return of(d)||await this._removeSession(),(a=this.refreshingDeferred)===null||a===void 0||a.resolve(h),h}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(d),d}finally{this.refreshingDeferred=null,this._debug(l,"end")}}async _notifyAllSubscribers(e,a,i=!0){const l=`#_notifyAllSubscribers(${e})`;this._debug(l,"begin",a,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:e,session:a});const d=[],h=Array.from(this.stateChangeEmitters.values()).map(async m=>{try{await m.callback(e,a)}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(l,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Ot(this.storage,`${this.storageKey}-code-verifier`);const a=Object.assign({},e),i=a.user&&a.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!i&&a.user&&await oi(this.userStorage,this.storageKey+"-user",{user:a.user});const l=Object.assign({},a);delete l.user;const d=$0(l);await oi(this.storage,this.storageKey,d)}else{const l=$0(a);await oi(this.storage,this.storageKey,l)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ot(this.storage,this.storageKey),await Ot(this.storage,this.storageKey+"-code-verifier"),await Ot(this.storage,this.storageKey+"-user"),this.userStorage&&await Ot(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Dt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(a){console.error("removing visibilitychange callback failed",a)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ii);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const a=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=a,a&&typeof a=="object"&&typeof a.unref=="function"?a.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(a)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const a=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,a&&clearTimeout(a)}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 e=Date.now();try{return await this._useSession(async a=>{const{data:{session:i}}=a;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const l=Math.floor((i.expires_at*1e3-e)/ii);this._debug("#_autoRefreshTokenTick()",`access token expires in ${l} ticks, a tick lasts ${ii}ms, refresh threshold is ${Gf} ticks`),l<=Gf&&await this._callRefreshToken(i.refresh_token)})}catch(a){console.error("Auto refresh tick failed with error. This is likely a transient error.",a)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof ww)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Dt()||!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(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const a=`#_onVisibilityChanged(${e})`;this._debug(a,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(a,"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(e,a,i){const l=[`provider=${encodeURIComponent(a)}`];if(i?.redirectTo&&l.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&l.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){const[d,h]=await Zr(this.storage,this.storageKey),m=new URLSearchParams({code_challenge:`${encodeURIComponent(d)}`,code_challenge_method:`${encodeURIComponent(h)}`});l.push(m.toString())}if(i?.queryParams){const d=new URLSearchParams(i.queryParams);l.push(d.toString())}return i?.skipBrowserRedirect&&l.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${l.join("&")}`}async _unenroll(e){try{return await this._useSession(async a=>{var i;const{data:l,error:d}=a;return d?this._returnResult({data:null,error:d}):await ve(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=l?.session)===null||i===void 0?void 0:i.access_token})})}catch(a){if(me(a))return this._returnResult({data:null,error:a});throw a}}async _enroll(e){try{return await this._useSession(async a=>{var i,l;const{data:d,error:h}=a;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:p,error:y}=await ve(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(i=d?.session)===null||i===void 0?void 0:i.access_token});return y?this._returnResult({data:null,error:y}):(e.factorType==="totp"&&p.type==="totp"&&(!((l=p?.totp)===null||l===void 0)&&l.qr_code)&&(p.totp.qr_code=`data:image/svg+xml;utf-8,${p.totp.qr_code}`),this._returnResult({data:p,error:null}))})}catch(a){if(me(a))return this._returnResult({data:null,error:a});throw a}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async a=>{var i;const{data:l,error:d}=a;if(d)return this._returnResult({data:null,error:d});const h=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?bk(e.webauthn.credential_response):wk(e.webauthn.credential_response)})}:{code:e.code}),{data:m,error:p}=await ve(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:h,headers:this.headers,jwt:(i=l?.session)===null||i===void 0?void 0:i.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(a){if(me(a))return this._returnResult({data:null,error:a});throw a}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async a=>{var i;const{data:l,error:d}=a;if(d)return this._returnResult({data:null,error:d});const h=await ve(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=l?.session)===null||i===void 0?void 0:i.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:vk(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:xk(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(a){if(me(a))return this._returnResult({data:null,error:a});throw a}})}async _challengeAndVerify(e){const{data:a,error:i}=await this._challenge({factorId:e.factorId});return i?this._returnResult({data:null,error:i}):await this._verify({factorId:e.factorId,challengeId:a.id,code:e.code})}async _listFactors(){var e;const{data:{user:a},error:i}=await this.getUser();if(i)return{data:null,error:i};const l={all:[],phone:[],totp:[],webauthn:[]};for(const d of(e=a?.factors)!==null&&e!==void 0?e:[])l.all.push(d),d.status==="verified"&&l[d.factor_type].push(d);return{data:l,error:null}}async _getAuthenticatorAssuranceLevel(){var e,a;const{data:{session:i},error:l}=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:d}=lf(i.access_token);let h=null;d.aal&&(h=d.aal);let m=h;((a=(e=i.user.factors)===null||e===void 0?void 0:e.filter(v=>v.status==="verified"))!==null&&a!==void 0?a:[]).length>0&&(m="aal2");const y=d.amr||[];return{data:{currentLevel:h,nextLevel:m,currentAuthenticationMethods:y},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async a=>{const{data:{session:i},error:l}=a;return l?this._returnResult({data:null,error:l}):i?await ve(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:i.access_token,xform:d=>({data:d,error:null})}):this._returnResult({data:null,error:new on})})}catch(a){if(me(a))return this._returnResult({data:null,error:a});throw a}}async _approveAuthorization(e,a){try{return await this._useSession(async i=>{const{data:{session:l},error:d}=i;if(d)return this._returnResult({data:null,error:d});if(!l)return this._returnResult({data:null,error:new on});const h=await ve(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"approve"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Dt()&&!a?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(i){if(me(i))return this._returnResult({data:null,error:i});throw i}}async _denyAuthorization(e,a){try{return await this._useSession(async i=>{const{data:{session:l},error:d}=i;if(d)return this._returnResult({data:null,error:d});if(!l)return this._returnResult({data:null,error:new on});const h=await ve(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"deny"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Dt()&&!a?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(i){if(me(i))return this._returnResult({data:null,error:i});throw i}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:a},error:i}=e;return i?this._returnResult({data:null,error:i}):a?await ve(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:a.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new on})})}catch(e){if(me(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async a=>{const{data:{session:i},error:l}=a;return l?this._returnResult({data:null,error:l}):i?(await ve(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:i.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new on})})}catch(a){if(me(a))return this._returnResult({data:null,error:a});throw a}}async fetchJwk(e,a={keys:[]}){let i=a.keys.find(m=>m.kid===e);if(i)return i;const l=Date.now();if(i=this.jwks.keys.find(m=>m.kid===e),i&&this.jwks_cached_at+AA>l)return i;const{data:d,error:h}=await ve(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=l,i=d.keys.find(m=>m.kid===e),!i)?null:i}async getClaims(e,a={}){try{let i=e;if(!i){const{data:j,error:_}=await this.getSession();if(_||!j.session)return this._returnResult({data:null,error:_});i=j.session.access_token}const{header:l,payload:d,signature:h,raw:{header:m,payload:p}}=lf(i);a?.allowExpired||JA(d.exp);const y=!l.alg||l.alg.startsWith("HS")||!l.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(l.kid,a?.keys?{keys:a.keys}:a?.jwks);if(!y){const{error:j}=await this.getUser(i);if(j)throw j;return{data:{claims:d,header:l,signature:h},error:null}}const v=ZA(l.alg),x=await crypto.subtle.importKey("jwk",y,v,!0,["verify"]);if(!await crypto.subtle.verify(v,x,h,PA(`${m}.${p}`)))throw new Yf("Invalid JWT signature");return{data:{claims:d,header:l,signature:h},error:null}}catch(i){if(me(i))return this._returnResult({data:null,error:i});throw i}}}Ko.nextInstanceID={};const Ck=Ko,Rk="2.90.1";let Co="";typeof Deno<"u"?Co="deno":typeof document<"u"?Co="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Co="react-native":Co="node";const Ok={"X-Client-Info":`supabase-js-${Co}/${Rk}`},Dk={headers:Ok},Mk={schema:"public"},zk={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Lk={};function Yo(n){"@babel/helpers - typeof";return Yo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yo(n)}function Uk(n,e){if(Yo(n)!="object"||!n)return n;var a=n[Symbol.toPrimitive];if(a!==void 0){var i=a.call(n,e);if(Yo(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Pk(n){var e=Uk(n,"string");return Yo(e)=="symbol"?e:e+""}function Vk(n,e,a){return(e=Pk(e))in n?Object.defineProperty(n,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[e]=a,n}function W0(n,e){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),a.push.apply(a,i)}return a}function rt(n){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?W0(Object(a),!0).forEach(function(i){Vk(n,i,a[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):W0(Object(a)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(a,i))})}return n}const Bk=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),Ik=()=>Headers,qk=(n,e,a)=>{const i=Bk(a),l=Ik();return async(d,h)=>{var m;const p=(m=await e())!==null&&m!==void 0?m:n;let y=new l(h?.headers);return y.has("apikey")||y.set("apikey",n),y.has("Authorization")||y.set("Authorization",`Bearer ${p}`),i(d,rt(rt({},h),{},{headers:y}))}};function $k(n){return n.endsWith("/")?n:n+"/"}function Hk(n,e){var a,i;const{db:l,auth:d,realtime:h,global:m}=n,{db:p,auth:y,realtime:v,global:x}=e,w={db:rt(rt({},p),l),auth:rt(rt({},y),d),realtime:rt(rt({},v),h),storage:{},global:rt(rt(rt({},x),m),{},{headers:rt(rt({},(a=x?.headers)!==null&&a!==void 0?a:{}),(i=m?.headers)!==null&&i!==void 0?i:{})}),accessToken:async()=>""};return n.accessToken?w.accessToken=n.accessToken:delete w.accessToken,w}function Gk(n){const e=n?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL($k(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Fk=class extends Ck{constructor(n){super(n)}},Kk=class{constructor(n,e,a){var i,l;this.supabaseUrl=n,this.supabaseKey=e;const d=Gk(n);if(!e)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:Mk,realtime:Lk,auth:rt(rt({},zk),{},{storageKey:h}),global:Dk},p=Hk(a??{},m);if(this.storageKey=(i=p.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(l=p.global.headers)!==null&&l!==void 0?l:{},p.accessToken)this.accessToken=p.accessToken,this.auth=new Proxy({},{get:(v,x)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(x)} is not possible`)}});else{var y;this.auth=this._initSupabaseAuthClient((y=p.auth)!==null&&y!==void 0?y:{},this.headers,p.global.fetch)}this.fetch=qk(e,this._getAccessToken.bind(this),p.global.fetch),this.realtime=this._initRealtimeClient(rt({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 T2(new URL("rest/v1",d).href,{headers:this.headers,schema:p.db.schema,fetch:this.fetch}),this.storage=new _A(this.storageUrl.href,this.headers,this.fetch,a?.storage),p.accessToken||this._listenForAuthEvents()}get functions(){return new w2(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,e={},a={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,e,a)}channel(n,e={config:{}}){return this.realtime.channel(n,e)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,e,a;if(n.accessToken)return await n.accessToken();const{data:i}=await n.auth.getSession();return(e=(a=i.session)===null||a===void 0?void 0:a.access_token)!==null&&e!==void 0?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:e,detectSessionInUrl:a,storage:i,userStorage:l,storageKey:d,flowType:h,lock:m,debug:p,throwOnError:y},v,x){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Fk({url:this.authUrl.href,headers:rt(rt({},w),v),storageKey:d,autoRefreshToken:n,persistSession:e,detectSessionInUrl:a,storage:i,userStorage:l,flowType:h,lock:m,debug:p,throwOnError:y,fetch:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(j=>j.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new $2(this.realtimeUrl.href,rt(rt({},n),{},{params:rt(rt({},{apikey:this.supabaseKey}),n?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,e)=>{this._handleTokenChanged(n,"CLIENT",e?.access_token)})}_handleTokenChanged(n,e,a){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==a?(this.changedAccessToken=a,this.realtime.setAuth(a)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Xf=(n,e,a)=>new Kk(n,e,a);function Yk(){if(typeof window<"u")return!1;const n=globalThis.process;if(!n)return!1;const e=n.version;if(e==null)return!1;const a=e.match(/^v(\d+)\./);return a?parseInt(a[1],10)<=18:!1}Yk()&&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 Nu="email_automator_supabase_config";function ji(){const n=a=>a&&typeof a.url=="string"&&typeof a.anonKey=="string"&&a.url.startsWith("http")&&!a.url.includes("placeholder.supabase.co")&&a.url!=="your_supabase_url"&&a.anonKey!=="your_supabase_anon_key";try{const a=localStorage.getItem(Nu);if(a){const i=JSON.parse(a);if(n(i))return i}}catch(a){console.error("Error reading Supabase config:",a)}const e={url:void 0,anonKey:void 0};return n(e)?e:null}function df(n){try{localStorage.setItem(Nu,JSON.stringify(n))}catch(e){console.error("Error saving Supabase config:",e)}}function Xk(){try{localStorage.removeItem(Nu)}catch(n){console.error("Error clearing Supabase config:",n)}}async function Wk(n,e){try{if(!n.startsWith("http://")&&!n.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const a=e.startsWith("eyJ"),i=e.startsWith("sb_publishable_");if(!a&&!i)return{valid:!1,error:"Invalid API key format (must be anon or publishable key)"};if(i)return{valid:!0};const l=await fetch(`${n}/rest/v1/`,{method:"GET",headers:{apikey:e,Authorization:`Bearer ${e}`}});return l.ok?{valid:!0}:l.status===401||l.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${l.statusText}`}}catch(a){return{valid:!1,error:a instanceof Error?a.message:"Connection failed"}}}function Jk(){return localStorage.getItem(Nu)?"ui":"none"}function Zk(){const n=ji();return!n||!n.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Xf("https://placeholder.supabase.co","placeholder-key")):Xf(n.url,n.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const Ze=Zk();function J0(){const n=ji(),e=n?`${n.url}/functions/v1`:"",a=n?n.anonKey:"",i=window.location.port==="5173";let l="";return i?l="http://localhost:3004":l=window.location.origin,{edgeFunctionsUrl:e,expressApiUrl:l,anonKey:a}}class Qk{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const e=J0();this.edgeFunctionsUrl=e.edgeFunctionsUrl,this.expressApiUrl=e.expressApiUrl,this.anonKey=e.anonKey}setSupabaseClient(e){this.supabaseClient=e}setToken(e){console.debug(e?"[HybridApiClient] Token updated":"[HybridApiClient] Token cleared"),this.token=e}async request(e,a,i={}){const{auth:l=!0,...d}=i,h={"Content-Type":"application/json",...i.headers||{}};if(l&&this.supabaseClient)try{const{data:{session:m},error:p}=await this.supabaseClient.auth.getSession();p?console.error("[HybridApiClient] Failed to get Supabase session:",p):m?.access_token&&(this.token=m.access_token)}catch(m){console.error("[HybridApiClient] Session recovery error:",m)}if(l&&!this.token)return console.warn(`[HybridApiClient] Attempted protected request to ${a} without token`),{error:{code:"AUTH_REQUIRED",message:"You must be logged in to perform this action"}};l&&this.token&&(h.Authorization=`Bearer ${this.token}`);try{console.debug(`[HybridApiClient] ${i.method||"GET"} ${e}${a}`);const m=await fetch(`${e}${a}`,{...d,headers:h});if(!m.ok){const y=await m.json().catch(()=>({})),v=typeof y.error=="string"?y.error:y.error?.message||`Request failed: ${m.status}`;return{error:{code:y.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(e,a){const i={...a?.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,e,{...a,headers:i})}expressRequest(e,a){const i=J0(),l={...a?.headers||{},"X-Supabase-Url":i.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":i.anonKey};return this.request(this.expressApiUrl,e,{...a,headers:l})}async getGmailAuthUrl(){return this.edgeRequest("/auth-gmail?action=url",{method:"GET"})}async connectGmail(e){return this.edgeRequest("/auth-gmail",{method:"POST",body:JSON.stringify({code:e})})}async startMicrosoftDeviceFlow(){return this.edgeRequest("/auth-microsoft?action=device-flow",{method:"POST"})}async pollMicrosoftDeviceCode(e){return this.edgeRequest("/auth-microsoft?action=poll",{method:"POST",body:JSON.stringify({deviceCode:e})})}async getAccounts(){return this.edgeRequest("/api-v1-accounts")}async disconnectAccount(e){return this.edgeRequest(`/api-v1-accounts/${e}`,{method:"DELETE"})}async updateAccount(e,a){return this.edgeRequest(`/api-v1-accounts/${e}`,{method:"PATCH",body:JSON.stringify(a)})}async getEmails(e={}){const a=new URLSearchParams;return e.limit&&a.set("limit",e.limit.toString()),e.offset&&a.set("offset",e.offset.toString()),e.category&&a.set("category",e.category),e.search&&a.set("search",e.search),e.sort_by&&a.set("sort_by",e.sort_by),e.sort_order&&a.set("sort_order",e.sort_order),this.edgeRequest(`/api-v1-emails?${a}`)}async getEmail(e){return this.edgeRequest(`/api-v1-emails/${e}`)}async getEmailEvents(e){return this.edgeRequest(`/api-v1-emails/${e}/events`)}async deleteEmail(e){return this.edgeRequest(`/api-v1-emails/${e}`,{method:"DELETE"})}async getCategorySummary(){return this.edgeRequest("/api-v1-emails/summary/categories")}async retryEmail(e){return this.expressRequest(`/api/emails/${e}/retry`,{method:"POST"})}async getRules(){return this.expressRequest("/api/rules")}async createRule(e){return this.expressRequest("/api/rules",{method:"POST",body:JSON.stringify(e)})}async updateRule(e,a){return this.expressRequest(`/api/rules/${e}`,{method:"PATCH",body:JSON.stringify(a)})}async deleteRule(e){return this.expressRequest(`/api/rules/${e}`,{method:"DELETE"})}async toggleRule(e){return this.expressRequest(`/api/rules/${e}/toggle`,{method:"POST"})}async getSettings(){return this.edgeRequest("/api-v1-settings")}async getRunEvents(e){return this.edgeRequest(`/api-v1-settings/logs/${e}/events`)}async updateSettings(e){return this.edgeRequest("/api-v1-settings",{method:"PATCH",body:JSON.stringify(e)})}async getStats(){return this.edgeRequest("/api-v1-settings/stats")}async testLlm(e){return this.expressRequest("/api/settings/test-llm",{method:"POST",body:JSON.stringify(e||{})})}async getChatProviders(){return this.expressRequest("/api/sdk/providers/chat")}async triggerSync(e){return this.expressRequest("/api/sync",{method:"POST",body:JSON.stringify({accountId:e})})}async syncAll(){return this.expressRequest("/api/sync/all",{method:"POST"})}async getSyncLogs(e=10){return this.expressRequest(`/api/sync/logs?limit=${e}`)}async stopSync(){return this.expressRequest("/api/sync/stop",{method:"POST"})}async executeAction(e,a,i){return this.expressRequest("/api/actions/execute",{method:"POST",body:JSON.stringify({emailId:e,action:a,draftContent:i})})}async generateDraft(e,a){return this.expressRequest(`/api/actions/draft/${e}`,{method:"POST",body:JSON.stringify({instructions:a})})}async bulkAction(e,a){return this.expressRequest("/api/actions/bulk",{method:"POST",body:JSON.stringify({emailIds:e,action:a})})}async healthCheck(){return this.expressRequest("/api/health",{auth:!1})}async getProfile(){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:e}}=await this.supabaseClient.auth.getUser();if(!e)return{error:"Not authenticated"};const{data:a,error:i}=await this.supabaseClient.from("profiles").select("*").eq("id",e.id).single();return{data:a,error:i}}async updateProfile(e){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:i,error:l}=await this.supabaseClient.from("profiles").update({...e,updated_at:new Date().toISOString()}).eq("id",a.id).select().single();return{data:i,error:l}}async changePassword(e){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{error:a}=await this.supabaseClient.auth.updateUser({password:e});return{success:!a,error:a}}async getAvailablePacks(){return await this.expressRequest("/rule-packs")}async getInstalledPacks(){return await this.expressRequest("/rule-packs/installed")}async getPack(e){return await this.expressRequest(`/rule-packs/${e}`)}async getPacksForRole(e){return await this.expressRequest(`/rule-packs/for-role/${e}`)}async installPack(e){return await this.expressRequest("/rule-packs/install",{method:"POST",body:JSON.stringify({packId:e})})}async uninstallPack(e){return await this.expressRequest("/rule-packs/uninstall",{method:"POST",body:JSON.stringify({packId:e})})}async setUserRole(e){return await this.expressRequest("/rule-packs/set-role",{method:"POST",body:JSON.stringify({role:e})})}}const ze=new Qk;async function jw(n){ze.setSupabaseClient(n);const{data:{session:e}}=await n.auth.getSession();e?.access_token&&ze.setToken(e.access_token),n.auth.onAuthStateChange((a,i)=>{ze.setToken(i?.access_token||null)})}const eC=Object.freeze(Object.defineProperty({__proto__:null,api:ze,initializeApi:jw},Symbol.toStringTag,{value:"Module"}));function tC({userId:n,onInsert:e,onUpdate:a,onDelete:i,enabled:l=!0}){const[d,h]=S.useState(!1);return S.useEffect(()=>{if(!l||!n){h(!1);return}const m=Ze.channel(`emails-realtime-${n}`).on("postgres_changes",{event:"*",schema:"public",table:"emails"},p=>{p.eventType==="INSERT"?e?.(p.new):p.eventType==="UPDATE"?a?.(p.new):p.eventType==="DELETE"&&i?.(p.old.id)}).subscribe(p=>{h(p==="SUBSCRIBED")});return()=>{Ze.removeChannel(m)}},[n,l,e,a,i]),{isSubscribed:d}}class nC{ctx=null;enabled=!1;constructor(){const e=localStorage.getItem("ea_sounds_enabled");this.enabled=e!=="false"}setEnabled(e){this.enabled=e,localStorage.setItem("ea_sounds_enabled",e?"true":"false")}isEnabled(){return this.enabled}initCtx(){return this.ctx||(this.ctx=new(window.AudioContext||window.webkitAudioContext)),this.ctx.state==="suspended"&&this.ctx.resume(),this.ctx}haptic(e=10){typeof navigator<"u"&&navigator.vibrate&&navigator.vibrate(e)}playNotify(){if(!this.enabled)return;const e=this.initCtx(),a=e.createOscillator(),i=e.createGain();a.type="sine",a.frequency.setValueAtTime(880,e.currentTime),a.frequency.exponentialRampToValueAtTime(440,e.currentTime+.1),i.gain.setValueAtTime(0,e.currentTime),i.gain.linearRampToValueAtTime(.1,e.currentTime+.01),i.gain.exponentialRampToValueAtTime(.001,e.currentTime+.3),a.connect(i),i.connect(e.destination),a.start(),a.stop(e.currentTime+.3),this.haptic(10)}playAlert(){if(!this.enabled)return;const e=this.initCtx(),a=(i,l)=>{const d=e.createOscillator(),h=e.createGain();d.type="sine",d.frequency.setValueAtTime(i,e.currentTime+l),h.gain.setValueAtTime(0,e.currentTime+l),h.gain.linearRampToValueAtTime(.1,e.currentTime+l+.05),h.gain.exponentialRampToValueAtTime(.001,e.currentTime+l+.4),d.connect(h),h.connect(e.destination),d.start(e.currentTime+l),d.stop(e.currentTime+l+.4)};a(660,0),a(880,.1),this.haptic([20,50,20])}playStart(){if(!this.enabled)return;const e=this.initCtx(),a=e.createOscillator(),i=e.createGain();a.type="sine",a.frequency.setValueAtTime(440,e.currentTime),a.frequency.exponentialRampToValueAtTime(880,e.currentTime+.2),i.gain.setValueAtTime(0,e.currentTime),i.gain.linearRampToValueAtTime(.05,e.currentTime+.05),i.gain.exponentialRampToValueAtTime(.001,e.currentTime+.2),a.connect(i),i.connect(e.destination),a.start(),a.stop(e.currentTime+.2),this.haptic(10)}playSuccess(){if(!this.enabled)return;const e=this.initCtx(),a=e.createOscillator(),i=e.createGain();a.type="triangle",a.frequency.setValueAtTime(523.25,e.currentTime),a.frequency.exponentialRampToValueAtTime(1046.5,e.currentTime+.1),i.gain.setValueAtTime(0,e.currentTime),i.gain.linearRampToValueAtTime(.05,e.currentTime+.02),i.gain.exponentialRampToValueAtTime(.001,e.currentTime+.2),a.connect(i),i.connect(e.destination),a.start(),a.stop(e.currentTime+.2),this.haptic(15)}}const $n=new nC;let In=[],Wf=new Set;function Jf(){Wf.forEach(n=>n())}const ae={success:(n,e)=>Pc("success",n,e),error:(n,e)=>Pc("error",n,e),info:(n,e)=>Pc("info",n,e),warning:(n,e)=>Pc("warning",n,e)};function Pc(n,e,a=5e3){const i=In.findIndex(d=>d.message===e&&d.type===n);if(i!==-1){const d=In[i];In=[...In],In[i]={...d,count:(d.count||1)+1,lastUpdated:Date.now()},Jf();return}const l=Math.random().toString(36).substr(2,9);In=[...In,{id:l,type:n,message:e,duration:a,count:1,lastUpdated:Date.now()}],Jf(),a>0&&setTimeout(()=>Ew(l),a)}function Ew(n){In=In.filter(e=>e.id!==n),Jf()}function sC(){const[,n]=S.useState(0);return S.useEffect(()=>{const e=()=>n(a=>a+1);return Wf.add(e),()=>{Wf.delete(e)}},[]),In}const aC={success:ru,error:Fn,info:vi,warning:xi},rC={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 iC({toast:n}){const e=aC[n.type];return c.jsxs("div",{className:Se("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-left-full duration-300",rC[n.type]),children:[c.jsxs("div",{className:"relative",children:[c.jsx(e,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),n.count&&n.count>1&&c.jsx("span",{className:"absolute -top-2 -right-2 bg-primary text-primary-foreground text-[10px] font-bold px-1.5 rounded-full border border-background scale-90 animate-in zoom-in duration-200",children:n.count})]}),c.jsx("p",{className:"text-sm flex-1",children:n.message}),c.jsx("button",{onClick:()=>Ew(n.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:c.jsx(ra,{className:"w-4 h-4"})})]})}function oC(){const n=sC();return n.length===0?null:c.jsx("div",{className:"fixed bottom-4 left-4 z-50 flex flex-col-reverse gap-2 max-w-sm w-full",children:n.map(e=>c.jsx(iC,{toast:e},e.id))})}function wn(n,e){return n?typeof n=="string"?n:n.message||e:e}const Tw={user:null,isAuthenticated:!1,profile:null,emails:[],accounts:[],rules:[],settings:null,stats:null,isLoading:!0,isInitialized:!1,error:null,selectedEmailId:null,emailsTotal:0,emailsOffset:0,sortBy:"created_at",sortOrder:"desc",activeCategory:null,activeSearch:"",isSyncing:!1};function lC(n,e){switch(e.type){case"SET_USER":return{...n,user:e.payload,isAuthenticated:!!e.payload,isLoading:!1};case"SET_LOADING":return{...n,isLoading:e.payload};case"SET_INITIALIZED":return{...n,isInitialized:e.payload};case"SET_ERROR":return{...n,error:e.payload,isLoading:!1};case"SET_EMAILS":return{...n,emails:e.payload.emails,emailsTotal:e.payload.total,emailsOffset:e.payload.offset,activeCategory:e.payload.category!==void 0?e.payload.category:n.activeCategory,activeSearch:e.payload.search!==void 0?e.payload.search:n.activeSearch,sortBy:e.payload.sortBy||n.sortBy,sortOrder:e.payload.sortOrder||n.sortOrder};case"ADD_EMAIL":{const a=e.payload,i=!n.activeCategory||a.category===n.activeCategory,l=!n.activeSearch||a.subject?.toLowerCase().includes(n.activeSearch.toLowerCase())||a.sender?.toLowerCase().includes(n.activeSearch.toLowerCase());return!i||!l?{...n,emailsTotal:n.emailsTotal+1}:{...n,emails:[a,...n.emails],emailsTotal:n.emailsTotal+1}}case"UPDATE_EMAIL":{const a=e.payload;if(n.emails.findIndex(h=>h.id===a.id)!==-1)return{...n,emails:n.emails.map(h=>h.id===a.id?a:h)};const l=!n.activeCategory||a.category===n.activeCategory,d=!n.activeSearch||a.subject?.toLowerCase().includes(n.activeSearch.toLowerCase())||a.sender?.toLowerCase().includes(n.activeSearch.toLowerCase());return l&&d?{...n,emails:[a,...n.emails]}:n}case"REMOVE_EMAIL":return{...n,emails:n.emails.filter(a=>a.id!==e.payload),emailsTotal:Math.max(0,n.emailsTotal-1)};case"SET_PROFILE":return{...n,profile:e.payload};case"UPDATE_PROFILE":return{...n,profile:e.payload};case"SET_ACCOUNTS":return{...n,accounts:e.payload};case"ADD_ACCOUNT":return{...n,accounts:[e.payload,...n.accounts]};case"REMOVE_ACCOUNT":return{...n,accounts:n.accounts.filter(a=>a.id!==e.payload)};case"SET_RULES":return{...n,rules:e.payload};case"ADD_RULE":return{...n,rules:[e.payload,...n.rules]};case"UPDATE_RULE":return{...n,rules:n.rules.map(a=>a.id===e.payload.id?e.payload:a)};case"REMOVE_RULE":return{...n,rules:n.rules.filter(a=>a.id!==e.payload)};case"SET_SETTINGS":return{...n,settings:e.payload};case"SET_STATS":return{...n,stats:e.payload};case"SET_SELECTED_EMAIL":return{...n,selectedEmailId:e.payload};case"SET_SYNCING":return{...n,isSyncing:e.payload};case"CLEAR_DATA":return{...Tw,isLoading:!1,isInitialized:!0};default:return n}}const Nw=S.createContext(null);function cC({children:n}){const[e,a]=S.useReducer(lC,Tw),i=S.useCallback(async(y,v=3,x=500)=>{for(let w=1;w<=v;w++){const j=await ze.getEmail(y);if(j.data?.email)return j.data.email;w<v&&await new Promise(_=>setTimeout(_,x))}return null},[]),l=S.useCallback(async y=>{const v=await i(y.id);v&&(a({type:"ADD_EMAIL",payload:v}),v.processing_status==="completed"&&(v.ai_analysis?.priority==="High"?($n.playAlert(),ae.success("High Priority Email Processed!")):($n.playNotify(),ae.info("New email processed"))))},[a,i]),d=S.useCallback(async y=>{const v=await i(y.id);v&&(a({type:"UPDATE_EMAIL",payload:v}),v.processing_status==="completed"&&y.processing_status==="completed"&&(v.ai_analysis?.priority==="High"?($n.playAlert(),ae.success("High Priority Email Processed!")):($n.playNotify(),ae.info("Email analysis complete"))))},[a,i]),h=S.useCallback(y=>{a({type:"REMOVE_EMAIL",payload:y})},[a]),{isSubscribed:m}=tC({userId:e.user?.id,onInsert:l,onUpdate:d,onDelete:h,enabled:e.isAuthenticated});S.useEffect(()=>{async function y(){if(!ji()){a({type:"SET_INITIALIZED",payload:!0});return}try{const{error:x}=await Ze.from("init_state").select("count",{count:"exact",head:!0});if(x&&x.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),a({type:"SET_INITIALIZED",payload:!0});return}await jw(Ze);const{data:{session:w}}=await Ze.auth.getSession();a({type:"SET_USER",payload:w?.user||null}),a({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:j}}=Ze.auth.onAuthStateChange((_,T)=>{a({type:"SET_USER",payload:T?.user||null}),T||a({type:"CLEAR_DATA"})});return()=>j.unsubscribe()}catch(x){console.error("[AppContext] Init error:",x),a({type:"SET_ERROR",payload:"Failed to initialize"}),a({type:"SET_INITIALIZED",payload:!0})}}y()},[]);const p={fetchEmails:async(y={})=>{const v=await ze.getEmails({limit:20,offset:y.offset||0,category:y.category,search:y.search,sort_by:y.sortBy||e.sortBy,sort_order:y.sortOrder||e.sortOrder});v.data&&a({type:"SET_EMAILS",payload:{emails:v.data.emails,total:v.data.total,offset:y.offset||0,category:y.category||null,search:y.search||"",sortBy:y.sortBy,sortOrder:y.sortOrder}})},fetchAccounts:async()=>{const y=await ze.getAccounts();y.data&&a({type:"SET_ACCOUNTS",payload:y.data.accounts})},fetchRules:async()=>{const y=await ze.getRules();y.data&&a({type:"SET_RULES",payload:y.data.rules})},fetchSettings:async()=>{const y=await ze.getSettings();y.data&&a({type:"SET_SETTINGS",payload:y.data.settings})},fetchProfile:async()=>{const y=await ze.getProfile();y.data&&a({type:"SET_PROFILE",payload:y.data})},fetchStats:async()=>{const y=await ze.getStats();y.data&&a({type:"SET_STATS",payload:y.data.stats})},executeAction:async(y,v,x)=>{const w=await ze.executeAction(y,v,x);if(w.data?.success){const j=e.emails.find(_=>_.id===y);return j&&a({type:"UPDATE_EMAIL",payload:{...j,action_taken:v}}),!0}return a({type:"SET_ERROR",payload:wn(w.error,"Action failed")}),!1},triggerSync:async y=>{a({type:"SET_SYNCING",payload:!0});try{const v=y?await ze.triggerSync(y):await ze.syncAll();return await p.fetchAccounts(),v.error?(a({type:"SET_ERROR",payload:wn(v.error,"Sync failed")}),!1):!0}finally{a({type:"SET_SYNCING",payload:!1})}},stopSync:async()=>{const y=await ze.stopSync();return y.data?.success?(ae.info("Stop request sent"),!0):(a({type:"SET_ERROR",payload:wn(y.error,"Failed to stop sync")}),!1)},disconnectAccount:async y=>{const v=await ze.disconnectAccount(y);return v.data?.success?(a({type:"REMOVE_ACCOUNT",payload:y}),!0):(a({type:"SET_ERROR",payload:wn(v.error,"Failed to disconnect")}),!1)},updateSettings:async y=>{const v=await ze.updateSettings(y);return v.data?(a({type:"SET_SETTINGS",payload:v.data.settings}),!0):(a({type:"SET_ERROR",payload:wn(v.error,"Failed to update settings")}),!1)},updateProfile:async y=>{const v=await ze.updateProfile(y);return v.data?(a({type:"UPDATE_PROFILE",payload:v.data}),!0):(a({type:"SET_ERROR",payload:wn(v.error,"Failed to update profile")}),!1)},updateAccount:async(y,v)=>{const x=await ze.updateAccount(y,v);return x.data?(a({type:"SET_ACCOUNTS",payload:e.accounts.map(w=>w.id===y?{...w,...v}:w)}),!0):(a({type:"SET_ERROR",payload:wn(x.error,"Failed to update account")}),!1)},retryProcessing:async y=>{const v=await ze.retryEmail(y);if(v.data?.success){const x=e.emails.find(w=>w.id===y);return x&&a({type:"UPDATE_EMAIL",payload:{...x,processing_status:"pending",processing_error:null}}),!0}return a({type:"SET_ERROR",payload:wn(v.error,"Retry failed")}),!1},createRule:async y=>{const v=await ze.createRule(y);return v.data?(a({type:"ADD_RULE",payload:v.data.rule}),!0):(a({type:"SET_ERROR",payload:wn(v.error,"Failed to create rule")}),!1)},updateRule:async(y,v)=>{const x=await ze.updateRule(y,v);return x.data?(a({type:"UPDATE_RULE",payload:x.data.rule}),!0):(a({type:"SET_ERROR",payload:wn(x.error,"Failed to update rule")}),!1)},deleteRule:async y=>{const v=await ze.deleteRule(y);return v.data?.success?(a({type:"REMOVE_RULE",payload:y}),!0):(a({type:"SET_ERROR",payload:wn(v.error,"Failed to delete rule")}),!1)},toggleRule:async y=>{const v=await ze.toggleRule(y);return v.data?(a({type:"UPDATE_RULE",payload:v.data.rule}),!0):(a({type:"SET_ERROR",payload:wn(v.error,"Failed to toggle rule")}),!1)}};return c.jsx(Nw.Provider,{value:{state:e,isSubscribed:m,dispatch:a,actions:p},children:n})}function ia(){const n=S.useContext(Nw);if(!n)throw new Error("useApp must be used within AppProvider");return n}const uC=S.createContext(void 0);function dC({children:n,value:e}){return c.jsx(uC.Provider,{value:e,children:n})}const Aw=S.createContext(null);function hC({children:n}){const[e,a]=S.useState(!1),i=()=>a(!0),l=()=>a(!1);return c.jsx(Aw.Provider,{value:{isExpanded:e,setIsExpanded:a,openTerminal:i,closeTerminal:l},children:n})}function kw(){const n=S.useContext(Aw);if(!n)throw new Error("useTerminal must be used within a TerminalProvider");return n}const It=S.forwardRef(({className:n,...e},a)=>c.jsx("div",{ref:a,className:Se("rounded-xl border bg-card text-card-foreground shadow",n),...e}));It.displayName="Card";const Zs=S.forwardRef(({className:n,...e},a)=>c.jsx("div",{ref:a,className:Se("flex flex-col space-y-1.5 p-6",n),...e}));Zs.displayName="CardHeader";const Qs=S.forwardRef(({className:n,...e},a)=>c.jsx("div",{ref:a,className:Se("font-semibold leading-none tracking-tight",n),...e}));Qs.displayName="CardTitle";const Fa=S.forwardRef(({className:n,...e},a)=>c.jsx("div",{ref:a,className:Se("text-sm text-muted-foreground",n),...e}));Fa.displayName="CardDescription";const ea=S.forwardRef(({className:n,...e},a)=>c.jsx("div",{ref:a,className:Se("p-6 pt-0",n),...e}));ea.displayName="CardContent";const fC=S.forwardRef(({className:n,...e},a)=>c.jsx("div",{ref:a,className:Se("flex items-center p-6 pt-0",n),...e}));fC.displayName="CardFooter";class mC extends S.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,a){console.error("ErrorBoundary caught an error:",e,a)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:c.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:c.jsxs(It,{className:"max-w-md w-full p-8 text-center",children:[c.jsx("div",{className:"w-16 h-16 bg-destructive/10 text-destructive rounded-full flex items-center justify-center mx-auto mb-6",children:c.jsx(xi,{className:"w-8 h-8"})}),c.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&c.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}),c.jsxs("div",{className:"flex gap-3 justify-center",children:[c.jsxs(ee,{onClick:this.handleReset,variant:"outline",children:[c.jsx(Zt,{className:"w-4 h-4 mr-2"}),"Try Again"]}),c.jsx(ee,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function pt({size:n="md",className:e,text:a}){const i={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};return c.jsxs("div",{className:Se("flex flex-col items-center justify-center gap-3",e),children:[c.jsx(Lt,{className:Se("animate-spin text-primary",i[n])}),a&&c.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})}function fu({text:n="Loading..."}){return c.jsx("div",{className:"min-h-screen flex items-center justify-center",children:c.jsx(pt,{size:"lg",text:n})})}function pC(){return c.jsx("div",{className:"p-12 flex items-center justify-center",children:c.jsx(pt,{size:"md"})})}const zm=S.createContext({});function Lm(n){const e=S.useRef(null);return e.current===null&&(e.current=n()),e.current}const Cw=typeof window<"u",Rw=Cw?S.useLayoutEffect:S.useEffect,Au=S.createContext(null);function Um(n,e){n.indexOf(e)===-1&&n.push(e)}function Pm(n,e){const a=n.indexOf(e);a>-1&&n.splice(a,1)}const Gn=(n,e,a)=>a>e?e:a<n?n:a;let Vm=()=>{};const ys={},Ow=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n);function Dw(n){return typeof n=="object"&&n!==null}const Mw=n=>/^0[^.\s]+$/u.test(n);function Bm(n){let e;return()=>(e===void 0&&(e=n()),e)}const jn=n=>n,gC=(n,e)=>a=>e(n(a)),sl=(...n)=>n.reduce(gC),Xo=(n,e,a)=>{const i=e-n;return i===0?1:(a-n)/i};class Im{constructor(){this.subscriptions=[]}add(e){return Um(this.subscriptions,e),()=>Pm(this.subscriptions,e)}notify(e,a,i){const l=this.subscriptions.length;if(l)if(l===1)this.subscriptions[0](e,a,i);else for(let d=0;d<l;d++){const h=this.subscriptions[d];h&&h(e,a,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const gs=n=>n*1e3,_n=n=>n/1e3;function zw(n,e){return e?n*(1e3/e):0}const Lw=(n,e,a)=>(((1-3*a+3*e)*n+(3*a-6*e))*n+3*e)*n,yC=1e-7,vC=12;function xC(n,e,a,i,l){let d,h,m=0;do h=e+(a-e)/2,d=Lw(h,i,l)-n,d>0?a=h:e=h;while(Math.abs(d)>yC&&++m<vC);return h}function al(n,e,a,i){if(n===e&&a===i)return jn;const l=d=>xC(d,0,1,n,a);return d=>d===0||d===1?d:Lw(l(d),e,i)}const Uw=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,Pw=n=>e=>1-n(1-e),Vw=al(.33,1.53,.69,.99),qm=Pw(Vw),Bw=Uw(qm),Iw=n=>(n*=2)<1?.5*qm(n):.5*(2-Math.pow(2,-10*(n-1))),$m=n=>1-Math.sin(Math.acos(n)),qw=Pw($m),$w=Uw($m),bC=al(.42,0,1,1),wC=al(0,0,.58,1),Hw=al(.42,0,.58,1),SC=n=>Array.isArray(n)&&typeof n[0]!="number",Gw=n=>Array.isArray(n)&&typeof n[0]=="number",_C={linear:jn,easeIn:bC,easeInOut:Hw,easeOut:wC,circIn:$m,circInOut:$w,circOut:qw,backIn:qm,backInOut:Bw,backOut:Vw,anticipate:Iw},jC=n=>typeof n=="string",Z0=n=>{if(Gw(n)){Vm(n.length===4);const[e,a,i,l]=n;return al(e,a,i,l)}else if(jC(n))return _C[n];return n},Vc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function EC(n,e){let a=new Set,i=new Set,l=!1,d=!1;const h=new WeakSet;let m={delta:0,timestamp:0,isProcessing:!1};function p(v){h.has(v)&&(y.schedule(v),n()),v(m)}const y={schedule:(v,x=!1,w=!1)=>{const _=w&&l?a:i;return x&&h.add(v),_.has(v)||_.add(v),v},cancel:v=>{i.delete(v),h.delete(v)},process:v=>{if(m=v,l){d=!0;return}l=!0,[a,i]=[i,a],a.forEach(p),a.clear(),l=!1,d&&(d=!1,y.process(v))}};return y}const TC=40;function Fw(n,e){let a=!1,i=!0;const l={delta:0,timestamp:0,isProcessing:!1},d=()=>a=!0,h=Vc.reduce((k,U)=>(k[U]=EC(d),k),{}),{setup:m,read:p,resolveKeyframes:y,preUpdate:v,update:x,preRender:w,render:j,postRender:_}=h,T=()=>{const k=ys.useManualTiming?l.timestamp:performance.now();a=!1,ys.useManualTiming||(l.delta=i?1e3/60:Math.max(Math.min(k-l.timestamp,TC),1)),l.timestamp=k,l.isProcessing=!0,m.process(l),p.process(l),y.process(l),v.process(l),x.process(l),w.process(l),j.process(l),_.process(l),l.isProcessing=!1,a&&e&&(i=!1,n(T))},N=()=>{a=!0,i=!0,l.isProcessing||n(T)};return{schedule:Vc.reduce((k,U)=>{const F=h[U];return k[U]=(K,P=!1,z=!1)=>(a||N(),F.schedule(K,P,z)),k},{}),cancel:k=>{for(let U=0;U<Vc.length;U++)h[Vc[U]].cancel(k)},state:l,steps:h}}const{schedule:Qe,cancel:sa,state:Mt,steps:hf}=Fw(typeof requestAnimationFrame<"u"?requestAnimationFrame:jn,!0);let Zc;function NC(){Zc=void 0}const qt={now:()=>(Zc===void 0&&qt.set(Mt.isProcessing||ys.useManualTiming?Mt.timestamp:performance.now()),Zc),set:n=>{Zc=n,queueMicrotask(NC)}},Kw=n=>e=>typeof e=="string"&&e.startsWith(n),Yw=Kw("--"),AC=Kw("var(--"),Hm=n=>AC(n)?kC.test(n.split("/*")[0].trim()):!1,kC=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Q0(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const Ei={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Wo={...Ei,transform:n=>Gn(0,1,n)},Bc={...Ei,default:1},zo=n=>Math.round(n*1e5)/1e5,Gm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function CC(n){return n==null}const RC=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fm=(n,e)=>a=>!!(typeof a=="string"&&RC.test(a)&&a.startsWith(n)||e&&!CC(a)&&Object.prototype.hasOwnProperty.call(a,e)),Xw=(n,e,a)=>i=>{if(typeof i!="string")return i;const[l,d,h,m]=i.match(Gm);return{[n]:parseFloat(l),[e]:parseFloat(d),[a]:parseFloat(h),alpha:m!==void 0?parseFloat(m):1}},OC=n=>Gn(0,255,n),ff={...Ei,transform:n=>Math.round(OC(n))},Ha={test:Fm("rgb","red"),parse:Xw("red","green","blue"),transform:({red:n,green:e,blue:a,alpha:i=1})=>"rgba("+ff.transform(n)+", "+ff.transform(e)+", "+ff.transform(a)+", "+zo(Wo.transform(i))+")"};function DC(n){let e="",a="",i="",l="";return n.length>5?(e=n.substring(1,3),a=n.substring(3,5),i=n.substring(5,7),l=n.substring(7,9)):(e=n.substring(1,2),a=n.substring(2,3),i=n.substring(3,4),l=n.substring(4,5),e+=e,a+=a,i+=i,l+=l),{red:parseInt(e,16),green:parseInt(a,16),blue:parseInt(i,16),alpha:l?parseInt(l,16)/255:1}}const Zf={test:Fm("#"),parse:DC,transform:Ha.transform},rl=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Gs=rl("deg"),Hn=rl("%"),ue=rl("px"),MC=rl("vh"),zC=rl("vw"),ex={...Hn,parse:n=>Hn.parse(n)/100,transform:n=>Hn.transform(n*100)},ci={test:Fm("hsl","hue"),parse:Xw("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:a,alpha:i=1})=>"hsla("+Math.round(n)+", "+Hn.transform(zo(e))+", "+Hn.transform(zo(a))+", "+zo(Wo.transform(i))+")"},gt={test:n=>Ha.test(n)||Zf.test(n)||ci.test(n),parse:n=>Ha.test(n)?Ha.parse(n):ci.test(n)?ci.parse(n):Zf.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Ha.transform(n):ci.transform(n),getAnimatableNone:n=>{const e=gt.parse(n);return e.alpha=0,gt.transform(e)}},LC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function UC(n){return isNaN(n)&&typeof n=="string"&&(n.match(Gm)?.length||0)+(n.match(LC)?.length||0)>0}const Ww="number",Jw="color",PC="var",VC="var(",tx="${}",BC=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Jo(n){const e=n.toString(),a=[],i={color:[],number:[],var:[]},l=[];let d=0;const m=e.replace(BC,p=>(gt.test(p)?(i.color.push(d),l.push(Jw),a.push(gt.parse(p))):p.startsWith(VC)?(i.var.push(d),l.push(PC),a.push(p)):(i.number.push(d),l.push(Ww),a.push(parseFloat(p))),++d,tx)).split(tx);return{values:a,split:m,indexes:i,types:l}}function Zw(n){return Jo(n).values}function Qw(n){const{split:e,types:a}=Jo(n),i=e.length;return l=>{let d="";for(let h=0;h<i;h++)if(d+=e[h],l[h]!==void 0){const m=a[h];m===Ww?d+=zo(l[h]):m===Jw?d+=gt.transform(l[h]):d+=l[h]}return d}}const IC=n=>typeof n=="number"?0:gt.test(n)?gt.getAnimatableNone(n):n;function qC(n){const e=Zw(n);return Qw(n)(e.map(IC))}const aa={test:UC,parse:Zw,createTransformer:Qw,getAnimatableNone:qC};function mf(n,e,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?n+(e-n)*6*a:a<1/2?e:a<2/3?n+(e-n)*(2/3-a)*6:n}function $C({hue:n,saturation:e,lightness:a,alpha:i}){n/=360,e/=100,a/=100;let l=0,d=0,h=0;if(!e)l=d=h=a;else{const m=a<.5?a*(1+e):a+e-a*e,p=2*a-m;l=mf(p,m,n+1/3),d=mf(p,m,n),h=mf(p,m,n-1/3)}return{red:Math.round(l*255),green:Math.round(d*255),blue:Math.round(h*255),alpha:i}}function mu(n,e){return a=>a>0?e:n}const nt=(n,e,a)=>n+(e-n)*a,pf=(n,e,a)=>{const i=n*n,l=a*(e*e-i)+i;return l<0?0:Math.sqrt(l)},HC=[Zf,Ha,ci],GC=n=>HC.find(e=>e.test(n));function nx(n){const e=GC(n);if(!e)return!1;let a=e.parse(n);return e===ci&&(a=$C(a)),a}const sx=(n,e)=>{const a=nx(n),i=nx(e);if(!a||!i)return mu(n,e);const l={...a};return d=>(l.red=pf(a.red,i.red,d),l.green=pf(a.green,i.green,d),l.blue=pf(a.blue,i.blue,d),l.alpha=nt(a.alpha,i.alpha,d),Ha.transform(l))},Qf=new Set(["none","hidden"]);function FC(n,e){return Qf.has(n)?a=>a<=0?n:e:a=>a>=1?e:n}function KC(n,e){return a=>nt(n,e,a)}function Km(n){return typeof n=="number"?KC:typeof n=="string"?Hm(n)?mu:gt.test(n)?sx:WC:Array.isArray(n)?e1:typeof n=="object"?gt.test(n)?sx:YC:mu}function e1(n,e){const a=[...n],i=a.length,l=n.map((d,h)=>Km(d)(d,e[h]));return d=>{for(let h=0;h<i;h++)a[h]=l[h](d);return a}}function YC(n,e){const a={...n,...e},i={};for(const l in a)n[l]!==void 0&&e[l]!==void 0&&(i[l]=Km(n[l])(n[l],e[l]));return l=>{for(const d in i)a[d]=i[d](l);return a}}function XC(n,e){const a=[],i={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const d=e.types[l],h=n.indexes[d][i[d]],m=n.values[h]??0;a[l]=m,i[d]++}return a}const WC=(n,e)=>{const a=aa.createTransformer(e),i=Jo(n),l=Jo(e);return i.indexes.var.length===l.indexes.var.length&&i.indexes.color.length===l.indexes.color.length&&i.indexes.number.length>=l.indexes.number.length?Qf.has(n)&&!l.values.length||Qf.has(e)&&!i.values.length?FC(n,e):sl(e1(XC(i,l),l.values),a):mu(n,e)};function t1(n,e,a){return typeof n=="number"&&typeof e=="number"&&typeof a=="number"?nt(n,e,a):Km(n)(n,e)}const JC=n=>{const e=({timestamp:a})=>n(a);return{start:(a=!0)=>Qe.update(e,a),stop:()=>sa(e),now:()=>Mt.isProcessing?Mt.timestamp:qt.now()}},n1=(n,e,a=10)=>{let i="";const l=Math.max(Math.round(e/a),2);for(let d=0;d<l;d++)i+=Math.round(n(d/(l-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},pu=2e4;function Ym(n){let e=0;const a=50;let i=n.next(e);for(;!i.done&&e<pu;)e+=a,i=n.next(e);return e>=pu?1/0:e}function ZC(n,e=100,a){const i=a({...n,keyframes:[0,e]}),l=Math.min(Ym(i),pu);return{type:"keyframes",ease:d=>i.next(l*d).value/e,duration:_n(l)}}const QC=5;function s1(n,e,a){const i=Math.max(e-QC,0);return zw(a-n(i),e-i)}const it={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},gf=.001;function eR({duration:n=it.duration,bounce:e=it.bounce,velocity:a=it.velocity,mass:i=it.mass}){let l,d,h=1-e;h=Gn(it.minDamping,it.maxDamping,h),n=Gn(it.minDuration,it.maxDuration,_n(n)),h<1?(l=y=>{const v=y*h,x=v*n,w=v-a,j=em(y,h),_=Math.exp(-x);return gf-w/j*_},d=y=>{const x=y*h*n,w=x*a+a,j=Math.pow(h,2)*Math.pow(y,2)*n,_=Math.exp(-x),T=em(Math.pow(y,2),h);return(-l(y)+gf>0?-1:1)*((w-j)*_)/T}):(l=y=>{const v=Math.exp(-y*n),x=(y-a)*n+1;return-gf+v*x},d=y=>{const v=Math.exp(-y*n),x=(a-y)*(n*n);return v*x});const m=5/n,p=nR(l,d,m);if(n=gs(n),isNaN(p))return{stiffness:it.stiffness,damping:it.damping,duration:n};{const y=Math.pow(p,2)*i;return{stiffness:y,damping:h*2*Math.sqrt(i*y),duration:n}}}const tR=12;function nR(n,e,a){let i=a;for(let l=1;l<tR;l++)i=i-n(i)/e(i);return i}function em(n,e){return n*Math.sqrt(1-e*e)}const sR=["duration","bounce"],aR=["stiffness","damping","mass"];function ax(n,e){return e.some(a=>n[a]!==void 0)}function rR(n){let e={velocity:it.velocity,stiffness:it.stiffness,damping:it.damping,mass:it.mass,isResolvedFromDuration:!1,...n};if(!ax(n,aR)&&ax(n,sR))if(n.visualDuration){const a=n.visualDuration,i=2*Math.PI/(a*1.2),l=i*i,d=2*Gn(.05,1,1-(n.bounce||0))*Math.sqrt(l);e={...e,mass:it.mass,stiffness:l,damping:d}}else{const a=eR(n);e={...e,...a,mass:it.mass},e.isResolvedFromDuration=!0}return e}function gu(n=it.visualDuration,e=it.bounce){const a=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:e}:n;let{restSpeed:i,restDelta:l}=a;const d=a.keyframes[0],h=a.keyframes[a.keyframes.length-1],m={done:!1,value:d},{stiffness:p,damping:y,mass:v,duration:x,velocity:w,isResolvedFromDuration:j}=rR({...a,velocity:-_n(a.velocity||0)}),_=w||0,T=y/(2*Math.sqrt(p*v)),N=h-d,A=_n(Math.sqrt(p/v)),M=Math.abs(N)<5;i||(i=M?it.restSpeed.granular:it.restSpeed.default),l||(l=M?it.restDelta.granular:it.restDelta.default);let k;if(T<1){const F=em(A,T);k=K=>{const P=Math.exp(-T*A*K);return h-P*((_+T*A*N)/F*Math.sin(F*K)+N*Math.cos(F*K))}}else if(T===1)k=F=>h-Math.exp(-A*F)*(N+(_+A*N)*F);else{const F=A*Math.sqrt(T*T-1);k=K=>{const P=Math.exp(-T*A*K),z=Math.min(F*K,300);return h-P*((_+T*A*N)*Math.sinh(z)+F*N*Math.cosh(z))/F}}const U={calculatedDuration:j&&x||null,next:F=>{const K=k(F);if(j)m.done=F>=x;else{let P=F===0?_:0;T<1&&(P=F===0?gs(_):s1(k,F,K));const z=Math.abs(P)<=i,Z=Math.abs(h-K)<=l;m.done=z&&Z}return m.value=m.done?h:K,m},toString:()=>{const F=Math.min(Ym(U),pu),K=n1(P=>U.next(F*P).value,F,30);return F+"ms "+K},toTransition:()=>{}};return U}gu.applyToOptions=n=>{const e=ZC(n,100,gu);return n.ease=e.ease,n.duration=gs(e.duration),n.type="keyframes",n};function tm({keyframes:n,velocity:e=0,power:a=.8,timeConstant:i=325,bounceDamping:l=10,bounceStiffness:d=500,modifyTarget:h,min:m,max:p,restDelta:y=.5,restSpeed:v}){const x=n[0],w={done:!1,value:x},j=z=>m!==void 0&&z<m||p!==void 0&&z>p,_=z=>m===void 0?p:p===void 0||Math.abs(m-z)<Math.abs(p-z)?m:p;let T=a*e;const N=x+T,A=h===void 0?N:h(N);A!==N&&(T=A-x);const M=z=>-T*Math.exp(-z/i),k=z=>A+M(z),U=z=>{const Z=M(z),ie=k(z);w.done=Math.abs(Z)<=y,w.value=w.done?A:ie};let F,K;const P=z=>{j(w.value)&&(F=z,K=gu({keyframes:[w.value,_(w.value)],velocity:s1(k,z,w.value),damping:l,stiffness:d,restDelta:y,restSpeed:v}))};return P(0),{calculatedDuration:null,next:z=>{let Z=!1;return!K&&F===void 0&&(Z=!0,U(z),P(z)),F!==void 0&&z>=F?K.next(z-F):(!Z&&U(z),w)}}}function iR(n,e,a){const i=[],l=a||ys.mix||t1,d=n.length-1;for(let h=0;h<d;h++){let m=l(n[h],n[h+1]);if(e){const p=Array.isArray(e)?e[h]||jn:e;m=sl(p,m)}i.push(m)}return i}function oR(n,e,{clamp:a=!0,ease:i,mixer:l}={}){const d=n.length;if(Vm(d===e.length),d===1)return()=>e[0];if(d===2&&e[0]===e[1])return()=>e[1];const h=n[0]===n[1];n[0]>n[d-1]&&(n=[...n].reverse(),e=[...e].reverse());const m=iR(e,i,l),p=m.length,y=v=>{if(h&&v<n[0])return e[0];let x=0;if(p>1)for(;x<n.length-2&&!(v<n[x+1]);x++);const w=Xo(n[x],n[x+1],v);return m[x](w)};return a?v=>y(Gn(n[0],n[d-1],v)):y}function lR(n,e){const a=n[n.length-1];for(let i=1;i<=e;i++){const l=Xo(0,e,i);n.push(nt(a,1,l))}}function cR(n){const e=[0];return lR(e,n.length-1),e}function uR(n,e){return n.map(a=>a*e)}function dR(n,e){return n.map(()=>e||Hw).splice(0,n.length-1)}function Lo({duration:n=300,keyframes:e,times:a,ease:i="easeInOut"}){const l=SC(i)?i.map(Z0):Z0(i),d={done:!1,value:e[0]},h=uR(a&&a.length===e.length?a:cR(e),n),m=oR(h,e,{ease:Array.isArray(l)?l:dR(e,l)});return{calculatedDuration:n,next:p=>(d.value=m(p),d.done=p>=n,d)}}const hR=n=>n!==null;function Xm(n,{repeat:e,repeatType:a="loop"},i,l=1){const d=n.filter(hR),m=l<0||e&&a!=="loop"&&e%2===1?0:d.length-1;return!m||i===void 0?d[m]:i}const fR={decay:tm,inertia:tm,tween:Lo,keyframes:Lo,spring:gu};function a1(n){typeof n.type=="string"&&(n.type=fR[n.type])}class Wm{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,a){return this.finished.then(e,a)}}const mR=n=>n/100;class Jm extends Wm{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:a}=this.options;a&&a.updatedAt!==qt.now()&&this.tick(qt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;a1(e);const{type:a=Lo,repeat:i=0,repeatDelay:l=0,repeatType:d,velocity:h=0}=e;let{keyframes:m}=e;const p=a||Lo;p!==Lo&&typeof m[0]!="number"&&(this.mixKeyframes=sl(mR,t1(m[0],m[1])),m=[0,100]);const y=p({...e,keyframes:m});d==="mirror"&&(this.mirroredGenerator=p({...e,keyframes:[...m].reverse(),velocity:-h})),y.calculatedDuration===null&&(y.calculatedDuration=Ym(y));const{calculatedDuration:v}=y;this.calculatedDuration=v,this.resolvedDuration=v+l,this.totalDuration=this.resolvedDuration*(i+1)-l,this.generator=y}updateTime(e){const a=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=a}tick(e,a=!1){const{generator:i,totalDuration:l,mixKeyframes:d,mirroredGenerator:h,resolvedDuration:m,calculatedDuration:p}=this;if(this.startTime===null)return i.next(0);const{delay:y=0,keyframes:v,repeat:x,repeatType:w,repeatDelay:j,type:_,onUpdate:T,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-l/this.speed,this.startTime)),a?this.currentTime=e:this.updateTime(e);const A=this.currentTime-y*(this.playbackSpeed>=0?1:-1),M=this.playbackSpeed>=0?A<0:A>l;this.currentTime=Math.max(A,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=l);let k=this.currentTime,U=i;if(x){const z=Math.min(this.currentTime,l)/m;let Z=Math.floor(z),ie=z%1;!ie&&z>=1&&(ie=1),ie===1&&Z--,Z=Math.min(Z,x+1),Z%2&&(w==="reverse"?(ie=1-ie,j&&(ie-=j/m)):w==="mirror"&&(U=h)),k=Gn(0,1,ie)*m}const F=M?{done:!1,value:v[0]}:U.next(k);d&&(F.value=d(F.value));let{done:K}=F;!M&&p!==null&&(K=this.playbackSpeed>=0?this.currentTime>=l:this.currentTime<=0);const P=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&K);return P&&_!==tm&&(F.value=Xm(v,this.options,N,this.speed)),T&&T(F.value),P&&this.finish(),F}then(e,a){return this.finished.then(e,a)}get duration(){return _n(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+_n(e)}get time(){return _n(this.currentTime)}set time(e){e=gs(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(qt.now());const a=this.playbackSpeed!==e;this.playbackSpeed=e,a&&(this.time=_n(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=JC,startTime:a}=this.options;this.driver||(this.driver=e(l=>this.tick(l))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=a??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(qt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function pR(n){for(let e=1;e<n.length;e++)n[e]??(n[e]=n[e-1])}const Ga=n=>n*180/Math.PI,nm=n=>{const e=Ga(Math.atan2(n[1],n[0]));return sm(e)},gR={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:nm,rotateZ:nm,skewX:n=>Ga(Math.atan(n[1])),skewY:n=>Ga(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},sm=n=>(n=n%360,n<0&&(n+=360),n),rx=nm,ix=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),ox=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),yR={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ix,scaleY:ox,scale:n=>(ix(n)+ox(n))/2,rotateX:n=>sm(Ga(Math.atan2(n[6],n[5]))),rotateY:n=>sm(Ga(Math.atan2(-n[2],n[0]))),rotateZ:rx,rotate:rx,skewX:n=>Ga(Math.atan(n[4])),skewY:n=>Ga(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function am(n){return n.includes("scale")?1:0}function rm(n,e){if(!n||n==="none")return am(e);const a=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,l;if(a)i=yR,l=a;else{const m=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=gR,l=m}if(!l)return am(e);const d=i[e],h=l[1].split(",").map(xR);return typeof d=="function"?d(h):h[d]}const vR=(n,e)=>{const{transform:a="none"}=getComputedStyle(n);return rm(a,e)};function xR(n){return parseFloat(n.trim())}const Ti=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ni=new Set(Ti),lx=n=>n===Ei||n===ue,bR=new Set(["x","y","z"]),wR=Ti.filter(n=>!bR.has(n));function SR(n){const e=[];return wR.forEach(a=>{const i=n.getValue(a);i!==void 0&&(e.push([a,i.get()]),i.set(a.startsWith("scale")?1:0))}),e}const Js={width:({x:n},{paddingLeft:e="0",paddingRight:a="0"})=>n.max-n.min-parseFloat(e)-parseFloat(a),height:({y:n},{paddingTop:e="0",paddingBottom:a="0"})=>n.max-n.min-parseFloat(e)-parseFloat(a),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:(n,{transform:e})=>rm(e,"x"),y:(n,{transform:e})=>rm(e,"y")};Js.translateX=Js.x;Js.translateY=Js.y;const Ka=new Set;let im=!1,om=!1,lm=!1;function r1(){if(om){const n=Array.from(Ka).filter(i=>i.needsMeasurement),e=new Set(n.map(i=>i.element)),a=new Map;e.forEach(i=>{const l=SR(i);l.length&&(a.set(i,l),i.render())}),n.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const l=a.get(i);l&&l.forEach(([d,h])=>{i.getValue(d)?.set(h)})}),n.forEach(i=>i.measureEndState()),n.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}om=!1,im=!1,Ka.forEach(n=>n.complete(lm)),Ka.clear()}function i1(){Ka.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(om=!0)})}function _R(){lm=!0,i1(),r1(),lm=!1}class Zm{constructor(e,a,i,l,d,h=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=a,this.name=i,this.motionValue=l,this.element=d,this.isAsync=h}scheduleResolve(){this.state="scheduled",this.isAsync?(Ka.add(this),im||(im=!0,Qe.read(i1),Qe.resolveKeyframes(r1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:a,element:i,motionValue:l}=this;if(e[0]===null){const d=l?.get(),h=e[e.length-1];if(d!==void 0)e[0]=d;else if(i&&a){const m=i.readValue(a,h);m!=null&&(e[0]=m)}e[0]===void 0&&(e[0]=h),l&&d===void 0&&l.set(e[0])}pR(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Ka.delete(this)}cancel(){this.state==="scheduled"&&(Ka.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const jR=n=>n.startsWith("--");function ER(n,e,a){jR(e)?n.style.setProperty(e,a):n.style[e]=a}const TR=Bm(()=>window.ScrollTimeline!==void 0),NR={};function AR(n,e){const a=Bm(n);return()=>NR[e]??a()}const o1=AR(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ro=([n,e,a,i])=>`cubic-bezier(${n}, ${e}, ${a}, ${i})`,cx={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ro([0,.65,.55,1]),circOut:Ro([.55,0,1,.45]),backIn:Ro([.31,.01,.66,-.59]),backOut:Ro([.33,1.53,.69,.99])};function l1(n,e){if(n)return typeof n=="function"?o1()?n1(n,e):"ease-out":Gw(n)?Ro(n):Array.isArray(n)?n.map(a=>l1(a,e)||cx.easeOut):cx[n]}function kR(n,e,a,{delay:i=0,duration:l=300,repeat:d=0,repeatType:h="loop",ease:m="easeOut",times:p}={},y=void 0){const v={[e]:a};p&&(v.offset=p);const x=l1(m,l);Array.isArray(x)&&(v.easing=x);const w={delay:i,duration:l,easing:Array.isArray(x)?"linear":x,fill:"both",iterations:d+1,direction:h==="reverse"?"alternate":"normal"};return y&&(w.pseudoElement=y),n.animate(v,w)}function c1(n){return typeof n=="function"&&"applyToOptions"in n}function CR({type:n,...e}){return c1(n)&&o1()?n.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class RR extends Wm{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:a,name:i,keyframes:l,pseudoElement:d,allowFlatten:h=!1,finalKeyframe:m,onComplete:p}=e;this.isPseudoElement=!!d,this.allowFlatten=h,this.options=e,Vm(typeof e.type!="string");const y=CR(e);this.animation=kR(a,i,l,y,d),y.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!d){const v=Xm(l,this.options,m,this.speed);this.updateMotionValue?this.updateMotionValue(v):ER(a,i,v),this.animation.cancel()}p?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return _n(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+_n(e)}get time(){return _n(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=gs(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&TR()?(this.animation.timeline=e,jn):a(this)}}const u1={anticipate:Iw,backInOut:Bw,circInOut:$w};function OR(n){return n in u1}function DR(n){typeof n.ease=="string"&&OR(n.ease)&&(n.ease=u1[n.ease])}const yf=10;class MR extends RR{constructor(e){DR(e),a1(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:a,onUpdate:i,onComplete:l,element:d,...h}=this.options;if(!a)return;if(e!==void 0){a.set(e);return}const m=new Jm({...h,autoplay:!1}),p=Math.max(yf,qt.now()-this.startTime),y=Gn(0,yf,p-yf);a.setWithVelocity(m.sample(Math.max(0,p-y)).value,m.sample(p).value,y),m.stop()}}const ux=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(aa.test(n)||n==="0")&&!n.startsWith("url("));function zR(n){const e=n[0];if(n.length===1)return!0;for(let a=0;a<n.length;a++)if(n[a]!==e)return!0}function LR(n,e,a,i){const l=n[0];if(l===null)return!1;if(e==="display"||e==="visibility")return!0;const d=n[n.length-1],h=ux(l,e),m=ux(d,e);return!h||!m?!1:zR(n)||(a==="spring"||c1(a))&&i}function cm(n){n.duration=0,n.type="keyframes"}const UR=new Set(["opacity","clipPath","filter","transform"]),PR=Bm(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function VR(n){const{motionValue:e,name:a,repeatDelay:i,repeatType:l,damping:d,type:h}=n;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:y}=e.owner.getProps();return PR()&&a&&UR.has(a)&&(a!=="transform"||!y)&&!p&&!i&&l!=="mirror"&&d!==0&&h!=="inertia"}const BR=40;class IR extends Wm{constructor({autoplay:e=!0,delay:a=0,type:i="keyframes",repeat:l=0,repeatDelay:d=0,repeatType:h="loop",keyframes:m,name:p,motionValue:y,element:v,...x}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=qt.now();const w={autoplay:e,delay:a,type:i,repeat:l,repeatDelay:d,repeatType:h,name:p,motionValue:y,element:v,...x},j=v?.KeyframeResolver||Zm;this.keyframeResolver=new j(m,(_,T,N)=>this.onKeyframesResolved(_,T,w,!N),p,y,v),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,a,i,l){this.keyframeResolver=void 0;const{name:d,type:h,velocity:m,delay:p,isHandoff:y,onUpdate:v}=i;this.resolvedAt=qt.now(),LR(e,d,h,m)||((ys.instantAnimations||!p)&&v?.(Xm(e,i,a)),e[0]=e[e.length-1],cm(i),i.repeat=0);const w={startTime:l?this.resolvedAt?this.resolvedAt-this.createdAt>BR?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:a,...i,keyframes:e},j=!y&&VR(w),_=w.motionValue?.owner?.current,T=j?new MR({...w,element:_}):new Jm(w);T.finished.then(()=>{this.notifyFinished()}).catch(jn),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(e,a){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),_R()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function d1(n,e,a,i=0,l=1){const d=Array.from(n).sort((y,v)=>y.sortNodePosition(v)).indexOf(e),h=n.size,m=(h-1)*i;return typeof a=="function"?a(d,h):l===1?d*i:m-d*i}const qR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function $R(n){const e=qR.exec(n);if(!e)return[,];const[,a,i,l]=e;return[`--${a??i}`,l]}function h1(n,e,a=1){const[i,l]=$R(n);if(!i)return;const d=window.getComputedStyle(e).getPropertyValue(i);if(d){const h=d.trim();return Ow(h)?parseFloat(h):h}return Hm(l)?h1(l,e,a+1):l}const HR={type:"spring",stiffness:500,damping:25,restSpeed:10},GR=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),FR={type:"keyframes",duration:.8},KR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},YR=(n,{keyframes:e})=>e.length>2?FR:Ni.has(n)?n.startsWith("scale")?GR(e[1]):HR:KR,XR=n=>n!==null;function WR(n,{repeat:e,repeatType:a="loop"},i){const l=n.filter(XR),d=e&&a!=="loop"&&e%2===1?0:l.length-1;return l[d]}function Qm(n,e){return n?.[e]??n?.default??n}function JR({when:n,delay:e,delayChildren:a,staggerChildren:i,staggerDirection:l,repeat:d,repeatType:h,repeatDelay:m,from:p,elapsed:y,...v}){return!!Object.keys(v).length}const ep=(n,e,a,i={},l,d)=>h=>{const m=Qm(i,n)||{},p=m.delay||i.delay||0;let{elapsed:y=0}=i;y=y-gs(p);const v={keyframes:Array.isArray(a)?a:[null,a],ease:"easeOut",velocity:e.getVelocity(),...m,delay:-y,onUpdate:w=>{e.set(w),m.onUpdate&&m.onUpdate(w)},onComplete:()=>{h(),m.onComplete&&m.onComplete()},name:n,motionValue:e,element:d?void 0:l};JR(m)||Object.assign(v,YR(n,v)),v.duration&&(v.duration=gs(v.duration)),v.repeatDelay&&(v.repeatDelay=gs(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let x=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(cm(v),v.delay===0&&(x=!0)),(ys.instantAnimations||ys.skipAnimations)&&(x=!0,cm(v),v.delay=0),v.allowFlatten=!m.type&&!m.ease,x&&!d&&e.get()!==void 0){const w=WR(v.keyframes,m);if(w!==void 0){Qe.update(()=>{v.onUpdate(w),v.onComplete()});return}}return m.isSync?new Jm(v):new IR(v)};function dx(n){const e=[{},{}];return n?.values.forEach((a,i)=>{e[0][i]=a.get(),e[1][i]=a.getVelocity()}),e}function tp(n,e,a,i){if(typeof e=="function"){const[l,d]=dx(i);e=e(a!==void 0?a:n.custom,l,d)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[l,d]=dx(i);e=e(a!==void 0?a:n.custom,l,d)}return e}function pi(n,e,a){const i=n.getProps();return tp(i,e,a!==void 0?a:i.custom,n)}const f1=new Set(["width","height","top","left","right","bottom",...Ti]),hx=30,ZR=n=>!isNaN(parseFloat(n));class QR{constructor(e,a={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const l=qt.now();if(this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const d of this.dependents)d.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=a.owner}setCurrent(e){this.current=e,this.updatedAt=qt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ZR(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,a){this.events[e]||(this.events[e]=new Im);const i=this.events[e].add(a);return e==="change"?()=>{i(),Qe.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,a){this.passiveEffect=e,this.stopPassiveEffect=a}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,a,i){this.set(a),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,a=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=qt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>hx)return 0;const a=Math.min(this.updatedAt-this.prevUpdatedAt,hx);return zw(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(e){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=e(a),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function bi(n,e){return new QR(n,e)}const um=n=>Array.isArray(n);function eO(n,e,a){n.hasValue(e)?n.getValue(e).set(a):n.addValue(e,bi(a))}function tO(n){return um(n)?n[n.length-1]||0:n}function nO(n,e){const a=pi(n,e);let{transitionEnd:i={},transition:l={},...d}=a||{};d={...d,...i};for(const h in d){const m=tO(d[h]);eO(n,h,m)}}const Ut=n=>!!(n&&n.getVelocity);function sO(n){return!!(Ut(n)&&n.add)}function dm(n,e){const a=n.getValue("willChange");if(sO(a))return a.add(e);if(!a&&ys.WillChange){const i=new ys.WillChange("auto");n.addValue("willChange",i),i.add(e)}}function np(n){return n.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const aO="framerAppearId",m1="data-"+np(aO);function p1(n){return n.props[m1]}function rO({protectedKeys:n,needsAnimating:e},a){const i=n.hasOwnProperty(a)&&e[a]!==!0;return e[a]=!1,i}function g1(n,e,{delay:a=0,transitionOverride:i,type:l}={}){let{transition:d=n.getDefaultTransition(),transitionEnd:h,...m}=e;const p=d?.reduceMotion;i&&(d=i);const y=[],v=l&&n.animationState&&n.animationState.getState()[l];for(const x in m){const w=n.getValue(x,n.latestValues[x]??null),j=m[x];if(j===void 0||v&&rO(v,x))continue;const _={delay:a,...Qm(d||{},x)},T=w.get();if(T!==void 0&&!w.isAnimating&&!Array.isArray(j)&&j===T&&!_.velocity)continue;let N=!1;if(window.MotionHandoffAnimation){const k=p1(n);if(k){const U=window.MotionHandoffAnimation(k,x,Qe);U!==null&&(_.startTime=U,N=!0)}}dm(n,x);const A=p??n.shouldReduceMotion;w.start(ep(x,w,j,A&&f1.has(x)?{type:!1}:_,n,N));const M=w.animation;M&&y.push(M)}return h&&Promise.all(y).then(()=>{Qe.update(()=>{h&&nO(n,h)})}),y}function hm(n,e,a={}){const i=pi(n,e,a.type==="exit"?n.presenceContext?.custom:void 0);let{transition:l=n.getDefaultTransition()||{}}=i||{};a.transitionOverride&&(l=a.transitionOverride);const d=i?()=>Promise.all(g1(n,i,a)):()=>Promise.resolve(),h=n.variantChildren&&n.variantChildren.size?(p=0)=>{const{delayChildren:y=0,staggerChildren:v,staggerDirection:x}=l;return iO(n,e,p,y,v,x,a)}:()=>Promise.resolve(),{when:m}=l;if(m){const[p,y]=m==="beforeChildren"?[d,h]:[h,d];return p().then(()=>y())}else return Promise.all([d(),h(a.delay)])}function iO(n,e,a=0,i=0,l=0,d=1,h){const m=[];for(const p of n.variantChildren)p.notify("AnimationStart",e),m.push(hm(p,e,{...h,delay:a+(typeof i=="function"?0:i)+d1(n.variantChildren,p,i,l,d)}).then(()=>p.notify("AnimationComplete",e)));return Promise.all(m)}function oO(n,e,a={}){n.notify("AnimationStart",e);let i;if(Array.isArray(e)){const l=e.map(d=>hm(n,d,a));i=Promise.all(l)}else if(typeof e=="string")i=hm(n,e,a);else{const l=typeof e=="function"?pi(n,e,a.custom):e;i=Promise.all(g1(n,l,a))}return i.then(()=>{n.notify("AnimationComplete",e)})}const lO={test:n=>n==="auto",parse:n=>n},y1=n=>e=>e.test(n),v1=[Ei,ue,Hn,Gs,zC,MC,lO],fx=n=>v1.find(y1(n));function cO(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||Mw(n):!0}const uO=new Set(["brightness","contrast","saturate","opacity"]);function dO(n){const[e,a]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[i]=a.match(Gm)||[];if(!i)return n;const l=a.replace(i,"");let d=uO.has(e)?1:0;return i!==a&&(d*=100),e+"("+d+l+")"}const hO=/\b([a-z-]*)\(.*?\)/gu,fm={...aa,getAnimatableNone:n=>{const e=n.match(hO);return e?e.map(dO).join(" "):n}},mx={...Ei,transform:Math.round},fO={rotate:Gs,rotateX:Gs,rotateY:Gs,rotateZ:Gs,scale:Bc,scaleX:Bc,scaleY:Bc,scaleZ:Bc,skew:Gs,skewX:Gs,skewY:Gs,distance:ue,translateX:ue,translateY:ue,translateZ:ue,x:ue,y:ue,z:ue,perspective:ue,transformPerspective:ue,opacity:Wo,originX:ex,originY:ex,originZ:ue},sp={borderWidth:ue,borderTopWidth:ue,borderRightWidth:ue,borderBottomWidth:ue,borderLeftWidth:ue,borderRadius:ue,borderTopLeftRadius:ue,borderTopRightRadius:ue,borderBottomRightRadius:ue,borderBottomLeftRadius:ue,width:ue,maxWidth:ue,height:ue,maxHeight:ue,top:ue,right:ue,bottom:ue,left:ue,inset:ue,insetBlock:ue,insetBlockStart:ue,insetBlockEnd:ue,insetInline:ue,insetInlineStart:ue,insetInlineEnd:ue,padding:ue,paddingTop:ue,paddingRight:ue,paddingBottom:ue,paddingLeft:ue,paddingBlock:ue,paddingBlockStart:ue,paddingBlockEnd:ue,paddingInline:ue,paddingInlineStart:ue,paddingInlineEnd:ue,margin:ue,marginTop:ue,marginRight:ue,marginBottom:ue,marginLeft:ue,marginBlock:ue,marginBlockStart:ue,marginBlockEnd:ue,marginInline:ue,marginInlineStart:ue,marginInlineEnd:ue,fontSize:ue,backgroundPositionX:ue,backgroundPositionY:ue,...fO,zIndex:mx,fillOpacity:Wo,strokeOpacity:Wo,numOctaves:mx},mO={...sp,color:gt,backgroundColor:gt,outlineColor:gt,fill:gt,stroke:gt,borderColor:gt,borderTopColor:gt,borderRightColor:gt,borderBottomColor:gt,borderLeftColor:gt,filter:fm,WebkitFilter:fm},x1=n=>mO[n];function b1(n,e){let a=x1(n);return a!==fm&&(a=aa),a.getAnimatableNone?a.getAnimatableNone(e):void 0}const pO=new Set(["auto","none","0"]);function gO(n,e,a){let i=0,l;for(;i<n.length&&!l;){const d=n[i];typeof d=="string"&&!pO.has(d)&&Jo(d).values.length&&(l=n[i]),i++}if(l&&a)for(const d of e)n[d]=b1(a,l)}class yO extends Zm{constructor(e,a,i,l,d){super(e,a,i,l,d,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:a,name:i}=this;if(!a||!a.current)return;super.readKeyframes();for(let v=0;v<e.length;v++){let x=e[v];if(typeof x=="string"&&(x=x.trim(),Hm(x))){const w=h1(x,a.current);w!==void 0&&(e[v]=w),v===e.length-1&&(this.finalKeyframe=x)}}if(this.resolveNoneKeyframes(),!f1.has(i)||e.length!==2)return;const[l,d]=e,h=fx(l),m=fx(d),p=Q0(l),y=Q0(d);if(p!==y&&Js[i]){this.needsMeasurement=!0;return}if(h!==m)if(lx(h)&&lx(m))for(let v=0;v<e.length;v++){const x=e[v];typeof x=="string"&&(e[v]=parseFloat(x))}else Js[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:a}=this,i=[];for(let l=0;l<e.length;l++)(e[l]===null||cO(e[l]))&&i.push(l);i.length&&gO(e,i,a)}measureInitialState(){const{element:e,unresolvedKeyframes:a,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Js[i](e.measureViewportBox(),window.getComputedStyle(e.current)),a[0]=this.measuredOrigin;const l=a[a.length-1];l!==void 0&&e.getValue(i,l).jump(l,!1)}measureEndState(){const{element:e,name:a,unresolvedKeyframes:i}=this;if(!e||!e.current)return;const l=e.getValue(a);l&&l.jump(this.measuredOrigin,!1);const d=i.length-1,h=i[d];i[d]=Js[a](e.measureViewportBox(),window.getComputedStyle(e.current)),h!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=h),this.removedTransforms?.length&&this.removedTransforms.forEach(([m,p])=>{e.getValue(m).set(p)}),this.resolveNoneKeyframes()}}function vO(n,e,a){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){let i=document;const l=a?.[n]??i.querySelectorAll(n);return l?Array.from(l):[]}return Array.from(n).filter(i=>i!=null)}const w1=(n,e)=>e&&typeof n=="number"?e.transform(n):n;function mm(n){return Dw(n)&&"offsetHeight"in n}const{schedule:ap}=Fw(queueMicrotask,!1),On={x:!1,y:!1};function S1(){return On.x||On.y}function xO(n){return n==="x"||n==="y"?On[n]?null:(On[n]=!0,()=>{On[n]=!1}):On.x||On.y?null:(On.x=On.y=!0,()=>{On.x=On.y=!1})}function _1(n,e){const a=vO(n),i=new AbortController,l={passive:!0,...e,signal:i.signal};return[a,l,()=>i.abort()]}function px(n){return!(n.pointerType==="touch"||S1())}function bO(n,e,a={}){const[i,l,d]=_1(n,a),h=m=>{if(!px(m))return;const{target:p}=m,y=e(p,m);if(typeof y!="function"||!p)return;const v=x=>{px(x)&&(y(x),p.removeEventListener("pointerleave",v))};p.addEventListener("pointerleave",v,l)};return i.forEach(m=>{m.addEventListener("pointerenter",h,l)}),d}const j1=(n,e)=>e?n===e?!0:j1(n,e.parentElement):!1,rp=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,wO=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function E1(n){return wO.has(n.tagName)||n.isContentEditable===!0}const Qc=new WeakSet;function gx(n){return e=>{e.key==="Enter"&&n(e)}}function vf(n,e){n.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const SO=(n,e)=>{const a=n.currentTarget;if(!a)return;const i=gx(()=>{if(Qc.has(a))return;vf(a,"down");const l=gx(()=>{vf(a,"up")}),d=()=>vf(a,"cancel");a.addEventListener("keyup",l,e),a.addEventListener("blur",d,e)});a.addEventListener("keydown",i,e),a.addEventListener("blur",()=>a.removeEventListener("keydown",i),e)};function yx(n){return rp(n)&&!S1()}function _O(n,e,a={}){const[i,l,d]=_1(n,a),h=m=>{const p=m.currentTarget;if(!yx(m))return;Qc.add(p);const y=e(p,m),v=(j,_)=>{window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",w),Qc.has(p)&&Qc.delete(p),yx(j)&&typeof y=="function"&&y(j,{success:_})},x=j=>{v(j,p===window||p===document||a.useGlobalTarget||j1(p,j.target))},w=j=>{v(j,!1)};window.addEventListener("pointerup",x,l),window.addEventListener("pointercancel",w,l)};return i.forEach(m=>{(a.useGlobalTarget?window:m).addEventListener("pointerdown",h,l),mm(m)&&(m.addEventListener("focus",y=>SO(y,l)),!E1(m)&&!m.hasAttribute("tabindex")&&(m.tabIndex=0))}),d}function T1(n){return Dw(n)&&"ownerSVGElement"in n}function jO(n){return T1(n)&&n.tagName==="svg"}const EO=[...v1,gt,aa],TO=n=>EO.find(y1(n)),vx=()=>({translate:0,scale:1,origin:0,originPoint:0}),ui=()=>({x:vx(),y:vx()}),xx=()=>({min:0,max:0}),St=()=>({x:xx(),y:xx()}),pm={current:null},N1={current:!1},NO=typeof window<"u";function AO(){if(N1.current=!0,!!NO)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>pm.current=n.matches;n.addEventListener("change",e),e()}else pm.current=!1}const kO=new WeakMap;function ku(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function Zo(n){return typeof n=="string"||Array.isArray(n)}const ip=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],op=["initial",...ip];function Cu(n){return ku(n.animate)||op.some(e=>Zo(n[e]))}function A1(n){return!!(Cu(n)||n.variants)}function CO(n,e,a){for(const i in e){const l=e[i],d=a[i];if(Ut(l))n.addValue(i,l);else if(Ut(d))n.addValue(i,bi(l,{owner:n}));else if(d!==l)if(n.hasValue(i)){const h=n.getValue(i);h.liveStyle===!0?h.jump(l):h.hasAnimated||h.set(l)}else{const h=n.getStaticValue(i);n.addValue(i,bi(h!==void 0?h:l,{owner:n}))}}for(const i in a)e[i]===void 0&&n.removeValue(i);return e}const bx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let yu={};function k1(n){yu=n}function RO(){return yu}class OO{scrapeMotionValuesFromProps(e,a,i){return{}}constructor({parent:e,props:a,presenceContext:i,reducedMotionConfig:l,blockInitialAnimation:d,visualState:h},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Zm,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const w=qt.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,Qe.render(this.render,!1,!0))};const{latestValues:p,renderState:y}=h;this.latestValues=p,this.baseTarget={...p},this.initialValues=a.initial?{...p}:{},this.renderState=y,this.parent=e,this.props=a,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=l,this.options=m,this.blockInitialAnimation=!!d,this.isControllingVariants=Cu(a),this.isVariantNode=A1(a),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:v,...x}=this.scrapeMotionValuesFromProps(a,{},this);for(const w in x){const j=x[w];p[w]!==void 0&&Ut(j)&&j.set(p[w])}}mount(e){this.current=e,kO.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,i)=>this.bindToMotionValue(i,a)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(N1.current||AO(),this.shouldReduceMotion=pm.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),sa(this.notifyUpdate),sa(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const a=this.features[e];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,a){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Ni.has(e);i&&this.onBindTransform&&this.onBindTransform();const l=a.on("change",h=>{this.latestValues[e]=h,this.props.onUpdate&&Qe.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let d;typeof window<"u"&&window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,e,a)),this.valueSubscriptions.set(e,()=>{l(),d&&d(),a.owner&&a.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in yu){const a=yu[e];if(!a)continue;const{isEnabled:i,Feature:l}=a;if(!this.features[e]&&l&&i(this.props)&&(this.features[e]=new l(this)),this.features[e]){const d=this.features[e];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):St()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,a){this.latestValues[e]=a}update(e,a){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=a;for(let i=0;i<bx.length;i++){const l=bx[i];this.propEventSubscriptions[l]&&(this.propEventSubscriptions[l](),delete this.propEventSubscriptions[l]);const d="on"+l,h=e[d];h&&(this.propEventSubscriptions[l]=this.on(l,h))}this.prevMotionValues=CO(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const a=this.getClosestVariantNode();if(a)return a.variantChildren&&a.variantChildren.add(e),()=>a.variantChildren.delete(e)}addValue(e,a){const i=this.values.get(e);a!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,a),this.values.set(e,a),this.latestValues[e]=a.get())}removeValue(e){this.values.delete(e);const a=this.valueSubscriptions.get(e);a&&(a(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,a){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&a!==void 0&&(i=bi(a===null?void 0:a,{owner:this}),this.addValue(e,i)),i}readValue(e,a){let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(Ow(i)||Mw(i))?i=parseFloat(i):!TO(i)&&aa.test(a)&&(i=b1(e,a)),this.setBaseTarget(e,Ut(i)?i.get():i)),Ut(i)?i.get():i}setBaseTarget(e,a){this.baseTarget[e]=a}getBaseTarget(e){const{initial:a}=this.props;let i;if(typeof a=="string"||typeof a=="object"){const d=tp(this.props,a,this.presenceContext?.custom);d&&(i=d[e])}if(a&&i!==void 0)return i;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!Ut(l)?l:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,a){return this.events[e]||(this.events[e]=new Im),this.events[e].add(a)}notify(e,...a){this.events[e]&&this.events[e].notify(...a)}scheduleRenderMicrotask(){ap.render(this.render)}}class C1 extends OO{constructor(){super(...arguments),this.KeyframeResolver=yO}sortInstanceNodePosition(e,a){return e.compareDocumentPosition(a)&2?1:-1}getBaseTargetFromProps(e,a){const i=e.style;return i?i[a]:void 0}removeValueFromRenderState(e,{vars:a,style:i}){delete a[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ut(e)&&(this.childSubscription=e.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}}class oa{constructor(e){this.isMounted=!1,this.node=e}update(){}}function R1({top:n,left:e,right:a,bottom:i}){return{x:{min:e,max:a},y:{min:n,max:i}}}function DO({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function MO(n,e){if(!e)return n;const a=e({x:n.left,y:n.top}),i=e({x:n.right,y:n.bottom});return{top:a.y,left:a.x,bottom:i.y,right:i.x}}function xf(n){return n===void 0||n===1}function gm({scale:n,scaleX:e,scaleY:a}){return!xf(n)||!xf(e)||!xf(a)}function Ua(n){return gm(n)||O1(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function O1(n){return wx(n.x)||wx(n.y)}function wx(n){return n&&n!=="0%"}function vu(n,e,a){const i=n-a,l=e*i;return a+l}function Sx(n,e,a,i,l){return l!==void 0&&(n=vu(n,l,i)),vu(n,a,i)+e}function ym(n,e=0,a=1,i,l){n.min=Sx(n.min,e,a,i,l),n.max=Sx(n.max,e,a,i,l)}function D1(n,{x:e,y:a}){ym(n.x,e.translate,e.scale,e.originPoint),ym(n.y,a.translate,a.scale,a.originPoint)}const _x=.999999999999,jx=1.0000000000001;function zO(n,e,a,i=!1){const l=a.length;if(!l)return;e.x=e.y=1;let d,h;for(let m=0;m<l;m++){d=a[m],h=d.projectionDelta;const{visualElement:p}=d.options;p&&p.props.style&&p.props.style.display==="contents"||(i&&d.options.layoutScroll&&d.scroll&&d!==d.root&&hi(n,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),h&&(e.x*=h.x.scale,e.y*=h.y.scale,D1(n,h)),i&&Ua(d.latestValues)&&hi(n,d.latestValues))}e.x<jx&&e.x>_x&&(e.x=1),e.y<jx&&e.y>_x&&(e.y=1)}function di(n,e){n.min=n.min+e,n.max=n.max+e}function Ex(n,e,a,i,l=.5){const d=nt(n.min,n.max,l);ym(n,e,a,d,i)}function hi(n,e){Ex(n.x,e.x,e.scaleX,e.scale,e.originX),Ex(n.y,e.y,e.scaleY,e.scale,e.originY)}function M1(n,e){return R1(MO(n.getBoundingClientRect(),e))}function LO(n,e,a){const i=M1(n,a),{scroll:l}=e;return l&&(di(i.x,l.offset.x),di(i.y,l.offset.y)),i}const UO={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},PO=Ti.length;function VO(n,e,a){let i="",l=!0;for(let d=0;d<PO;d++){const h=Ti[d],m=n[h];if(m===void 0)continue;let p=!0;if(typeof m=="number")p=m===(h.startsWith("scale")?1:0);else{const y=parseFloat(m);p=h.startsWith("scale")?y===1:y===0}if(!p||a){const y=w1(m,sp[h]);if(!p){l=!1;const v=UO[h]||h;i+=`${v}(${y}) `}a&&(e[h]=y)}}return i=i.trim(),a?i=a(e,l?"":i):l&&(i="none"),i}function lp(n,e,a){const{style:i,vars:l,transformOrigin:d}=n;let h=!1,m=!1;for(const p in e){const y=e[p];if(Ni.has(p)){h=!0;continue}else if(Yw(p)){l[p]=y;continue}else{const v=w1(y,sp[p]);p.startsWith("origin")?(m=!0,d[p]=v):i[p]=v}}if(e.transform||(h||a?i.transform=VO(e,n.transform,a):i.transform&&(i.transform="none")),m){const{originX:p="50%",originY:y="50%",originZ:v=0}=d;i.transformOrigin=`${p} ${y} ${v}`}}function z1(n,{style:e,vars:a},i,l){const d=n.style;let h;for(h in e)d[h]=e[h];l?.applyProjectionStyles(d,i);for(h in a)d.setProperty(h,a[h])}function Tx(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Ao={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(ue.test(n))n=parseFloat(n);else return n;const a=Tx(n,e.target.x),i=Tx(n,e.target.y);return`${a}% ${i}%`}},BO={correct:(n,{treeScale:e,projectionDelta:a})=>{const i=n,l=aa.parse(n);if(l.length>5)return i;const d=aa.createTransformer(n),h=typeof l[0]!="number"?1:0,m=a.x.scale*e.x,p=a.y.scale*e.y;l[0+h]/=m,l[1+h]/=p;const y=nt(m,p,.5);return typeof l[2+h]=="number"&&(l[2+h]/=y),typeof l[3+h]=="number"&&(l[3+h]/=y),d(l)}},vm={borderRadius:{...Ao,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ao,borderTopRightRadius:Ao,borderBottomLeftRadius:Ao,borderBottomRightRadius:Ao,boxShadow:BO};function L1(n,{layout:e,layoutId:a}){return Ni.has(n)||n.startsWith("origin")||(e||a!==void 0)&&(!!vm[n]||n==="opacity")}function cp(n,e,a){const i=n.style,l=e?.style,d={};if(!i)return d;for(const h in i)(Ut(i[h])||l&&Ut(l[h])||L1(h,n)||a?.getValue(h)?.liveStyle!==void 0)&&(d[h]=i[h]);return d}function IO(n){return window.getComputedStyle(n)}class qO extends C1{constructor(){super(...arguments),this.type="html",this.renderInstance=z1}readValueFromInstance(e,a){if(Ni.has(a))return this.projection?.isProjecting?am(a):vR(e,a);{const i=IO(e),l=(Yw(a)?i.getPropertyValue(a):i[a])||0;return typeof l=="string"?l.trim():l}}measureInstanceViewportBox(e,{transformPagePoint:a}){return M1(e,a)}build(e,a,i){lp(e,a,i.transformTemplate)}scrapeMotionValuesFromProps(e,a,i){return cp(e,a,i)}}const $O={offset:"stroke-dashoffset",array:"stroke-dasharray"},HO={offset:"strokeDashoffset",array:"strokeDasharray"};function GO(n,e,a=1,i=0,l=!0){n.pathLength=1;const d=l?$O:HO;n[d.offset]=`${-i}`,n[d.array]=`${e} ${a}`}const FO=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function U1(n,{attrX:e,attrY:a,attrScale:i,pathLength:l,pathSpacing:d=1,pathOffset:h=0,...m},p,y,v){if(lp(n,m,y),p){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:x,style:w}=n;x.transform&&(w.transform=x.transform,delete x.transform),(w.transform||x.transformOrigin)&&(w.transformOrigin=x.transformOrigin??"50% 50%",delete x.transformOrigin),w.transform&&(w.transformBox=v?.transformBox??"fill-box",delete x.transformBox);for(const j of FO)x[j]!==void 0&&(w[j]=x[j],delete x[j]);e!==void 0&&(x.x=e),a!==void 0&&(x.y=a),i!==void 0&&(x.scale=i),l!==void 0&&GO(x,l,d,h,!1)}const P1=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),V1=n=>typeof n=="string"&&n.toLowerCase()==="svg";function KO(n,e,a,i){z1(n,e,void 0,i);for(const l in e.attrs)n.setAttribute(P1.has(l)?l:np(l),e.attrs[l])}function B1(n,e,a){const i=cp(n,e,a);for(const l in n)if(Ut(n[l])||Ut(e[l])){const d=Ti.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;i[d]=n[l]}return i}class YO extends C1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=St}getBaseTargetFromProps(e,a){return e[a]}readValueFromInstance(e,a){if(Ni.has(a)){const i=x1(a);return i&&i.default||0}return a=P1.has(a)?a:np(a),e.getAttribute(a)}scrapeMotionValuesFromProps(e,a,i){return B1(e,a,i)}build(e,a,i){U1(e,a,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,a,i,l){KO(e,a,i,l)}mount(e){this.isSVGTag=V1(e.tagName),super.mount(e)}}const XO=op.length;function I1(n){if(!n)return;if(!n.isControllingVariants){const a=n.parent?I1(n.parent)||{}:{};return n.props.initial!==void 0&&(a.initial=n.props.initial),a}const e={};for(let a=0;a<XO;a++){const i=op[a],l=n.props[i];(Zo(l)||l===!1)&&(e[i]=l)}return e}function q1(n,e){if(!Array.isArray(e))return!1;const a=e.length;if(a!==n.length)return!1;for(let i=0;i<a;i++)if(e[i]!==n[i])return!1;return!0}const WO=[...ip].reverse(),JO=ip.length;function ZO(n){return e=>Promise.all(e.map(({animation:a,options:i})=>oO(n,a,i)))}function QO(n){let e=ZO(n),a=Nx(),i=!0;const l=p=>(y,v)=>{const x=pi(n,v,p==="exit"?n.presenceContext?.custom:void 0);if(x){const{transition:w,transitionEnd:j,..._}=x;y={...y,..._,...j}}return y};function d(p){e=p(n)}function h(p){const{props:y}=n,v=I1(n.parent)||{},x=[],w=new Set;let j={},_=1/0;for(let N=0;N<JO;N++){const A=WO[N],M=a[A],k=y[A]!==void 0?y[A]:v[A],U=Zo(k),F=A===p?M.isActive:null;F===!1&&(_=N);let K=k===v[A]&&k!==y[A]&&U;if(K&&i&&n.manuallyAnimateOnMount&&(K=!1),M.protectedKeys={...j},!M.isActive&&F===null||!k&&!M.prevProp||ku(k)||typeof k=="boolean")continue;const P=eD(M.prevProp,k);let z=P||A===p&&M.isActive&&!K&&U||N>_&&U,Z=!1;const ie=Array.isArray(k)?k:[k];let be=ie.reduce(l(A),{});F===!1&&(be={});const{prevResolvedValues:de={}}=M,qe={...de,...be},Be=q=>{z=!0,w.has(q)&&(Z=!0,w.delete(q)),M.needsAnimating[q]=!0;const I=n.getValue(q);I&&(I.liveStyle=!1)};for(const q in qe){const I=be[q],he=de[q];if(j.hasOwnProperty(q))continue;let _e=!1;um(I)&&um(he)?_e=!q1(I,he):_e=I!==he,_e?I!=null?Be(q):w.add(q):I!==void 0&&w.has(q)?Be(q):M.protectedKeys[q]=!0}M.prevProp=k,M.prevResolvedValues=be,M.isActive&&(j={...j,...be}),i&&n.blockInitialAnimation&&(z=!1);const te=K&&P;z&&(!te||Z)&&x.push(...ie.map(q=>{const I={type:A};if(typeof q=="string"&&i&&!te&&n.manuallyAnimateOnMount&&n.parent){const{parent:he}=n,_e=pi(he,q);if(he.enteringChildren&&_e){const{delayChildren:O}=_e.transition||{};I.delay=d1(he.enteringChildren,n,O)}}return{animation:q,options:I}}))}if(w.size){const N={};if(typeof y.initial!="boolean"){const A=pi(n,Array.isArray(y.initial)?y.initial[0]:y.initial);A&&A.transition&&(N.transition=A.transition)}w.forEach(A=>{const M=n.getBaseTarget(A),k=n.getValue(A);k&&(k.liveStyle=!0),N[A]=M??null}),x.push({animation:N})}let T=!!x.length;return i&&(y.initial===!1||y.initial===y.animate)&&!n.manuallyAnimateOnMount&&(T=!1),i=!1,T?e(x):Promise.resolve()}function m(p,y){if(a[p].isActive===y)return Promise.resolve();n.variantChildren?.forEach(x=>x.animationState?.setActive(p,y)),a[p].isActive=y;const v=h(p);for(const x in a)a[x].protectedKeys={};return v}return{animateChanges:h,setActive:m,setAnimateFunction:d,getState:()=>a,reset:()=>{a=Nx()}}}function eD(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!q1(e,n):!1}function za(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Nx(){return{animate:za(!0),whileInView:za(),whileHover:za(),whileTap:za(),whileDrag:za(),whileFocus:za(),exit:za()}}function Ax(n,e){n.min=e.min,n.max=e.max}function Cn(n,e){Ax(n.x,e.x),Ax(n.y,e.y)}function kx(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}const $1=1e-4,tD=1-$1,nD=1+$1,H1=.01,sD=0-H1,aD=0+H1;function $t(n){return n.max-n.min}function rD(n,e,a){return Math.abs(n-e)<=a}function Cx(n,e,a,i=.5){n.origin=i,n.originPoint=nt(e.min,e.max,n.origin),n.scale=$t(a)/$t(e),n.translate=nt(a.min,a.max,n.origin)-n.originPoint,(n.scale>=tD&&n.scale<=nD||isNaN(n.scale))&&(n.scale=1),(n.translate>=sD&&n.translate<=aD||isNaN(n.translate))&&(n.translate=0)}function Uo(n,e,a,i){Cx(n.x,e.x,a.x,i?i.originX:void 0),Cx(n.y,e.y,a.y,i?i.originY:void 0)}function Rx(n,e,a){n.min=a.min+e.min,n.max=n.min+$t(e)}function iD(n,e,a){Rx(n.x,e.x,a.x),Rx(n.y,e.y,a.y)}function Ox(n,e,a){n.min=e.min-a.min,n.max=n.min+$t(e)}function xu(n,e,a){Ox(n.x,e.x,a.x),Ox(n.y,e.y,a.y)}function Dx(n,e,a,i,l){return n-=e,n=vu(n,1/a,i),l!==void 0&&(n=vu(n,1/l,i)),n}function oD(n,e=0,a=1,i=.5,l,d=n,h=n){if(Hn.test(e)&&(e=parseFloat(e),e=nt(h.min,h.max,e/100)-h.min),typeof e!="number")return;let m=nt(d.min,d.max,i);n===d&&(m-=e),n.min=Dx(n.min,e,a,m,l),n.max=Dx(n.max,e,a,m,l)}function Mx(n,e,[a,i,l],d,h){oD(n,e[a],e[i],e[l],e.scale,d,h)}const lD=["x","scaleX","originX"],cD=["y","scaleY","originY"];function zx(n,e,a,i){Mx(n.x,e,lD,a?a.x:void 0,i?i.x:void 0),Mx(n.y,e,cD,a?a.y:void 0,i?i.y:void 0)}function Lx(n){return n.translate===0&&n.scale===1}function G1(n){return Lx(n.x)&&Lx(n.y)}function Ux(n,e){return n.min===e.min&&n.max===e.max}function uD(n,e){return Ux(n.x,e.x)&&Ux(n.y,e.y)}function Px(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function F1(n,e){return Px(n.x,e.x)&&Px(n.y,e.y)}function Vx(n){return $t(n.x)/$t(n.y)}function Bx(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}function Sn(n){return[n("x"),n("y")]}function dD(n,e,a){let i="";const l=n.x.translate/e.x,d=n.y.translate/e.y,h=a?.z||0;if((l||d||h)&&(i=`translate3d(${l}px, ${d}px, ${h}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),a){const{transformPerspective:y,rotate:v,rotateX:x,rotateY:w,skewX:j,skewY:_}=a;y&&(i=`perspective(${y}px) ${i}`),v&&(i+=`rotate(${v}deg) `),x&&(i+=`rotateX(${x}deg) `),w&&(i+=`rotateY(${w}deg) `),j&&(i+=`skewX(${j}deg) `),_&&(i+=`skewY(${_}deg) `)}const m=n.x.scale*e.x,p=n.y.scale*e.y;return(m!==1||p!==1)&&(i+=`scale(${m}, ${p})`),i||"none"}const K1=["TopLeft","TopRight","BottomLeft","BottomRight"],hD=K1.length,Ix=n=>typeof n=="string"?parseFloat(n):n,qx=n=>typeof n=="number"||ue.test(n);function fD(n,e,a,i,l,d){l?(n.opacity=nt(0,a.opacity??1,mD(i)),n.opacityExit=nt(e.opacity??1,0,pD(i))):d&&(n.opacity=nt(e.opacity??1,a.opacity??1,i));for(let h=0;h<hD;h++){const m=`border${K1[h]}Radius`;let p=$x(e,m),y=$x(a,m);if(p===void 0&&y===void 0)continue;p||(p=0),y||(y=0),p===0||y===0||qx(p)===qx(y)?(n[m]=Math.max(nt(Ix(p),Ix(y),i),0),(Hn.test(y)||Hn.test(p))&&(n[m]+="%")):n[m]=y}(e.rotate||a.rotate)&&(n.rotate=nt(e.rotate||0,a.rotate||0,i))}function $x(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const mD=Y1(0,.5,qw),pD=Y1(.5,.95,jn);function Y1(n,e,a){return i=>i<n?0:i>e?1:a(Xo(n,e,i))}function gD(n,e,a){const i=Ut(n)?n:bi(n);return i.start(ep("",i,e,a)),i.animation}function Qo(n,e,a,i={passive:!0}){return n.addEventListener(e,a,i),()=>n.removeEventListener(e,a)}const yD=(n,e)=>n.depth-e.depth;class vD{constructor(){this.children=[],this.isDirty=!1}add(e){Um(this.children,e),this.isDirty=!0}remove(e){Pm(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(yD),this.isDirty=!1,this.children.forEach(e)}}function xD(n,e){const a=qt.now(),i=({timestamp:l})=>{const d=l-a;d>=e&&(sa(i),n(d-e))};return Qe.setup(i,!0),()=>sa(i)}function eu(n){return Ut(n)?n.get():n}class bD{constructor(){this.members=[]}add(e){Um(this.members,e),e.scheduleRender()}remove(e){if(Pm(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(e){const a=this.members.findIndex(l=>e===l);if(a===0)return!1;let i;for(let l=a;l>=0;l--){const d=this.members[l];if(d.isPresent!==!1){i=d;break}}return i?(this.promote(i),!0):!1}promote(e,a){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender();const l=i.options.layoutDependency,d=e.options.layoutDependency;l!==void 0&&d!==void 0&&l===d||(e.resumeFrom=i,a&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));const{crossfade:m}=e.options;m===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:a,resumingFrom:i}=e;a.onExitComplete&&a.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const tu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},bf=["","X","Y","Z"],wD=1e3;let SD=0;function wf(n,e,a,i){const{latestValues:l}=e;l[n]&&(a[n]=l[n],e.setStaticValue(n,0),i&&(i[n]=0))}function X1(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const a=p1(e);if(window.MotionHasOptimisedAnimation(a,"transform")){const{layout:l,layoutId:d}=n.options;window.MotionCancelOptimisedAnimation(a,"transform",Qe,!(l||d))}const{parent:i}=n;i&&!i.hasCheckedOptimisedAppear&&X1(i)}function W1({attachResizeListener:n,defaultParent:e,measureScroll:a,checkIsScrollRoot:i,resetTransform:l}){return class{constructor(h={},m=e?.()){this.id=SD++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(ED),this.nodes.forEach(kD),this.nodes.forEach(CD),this.nodes.forEach(TD)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=h,this.root=m?m.root||m:this,this.path=m?[...m.path,m]:[],this.parent=m,this.depth=m?m.depth+1:0;for(let p=0;p<this.path.length;p++)this.path[p].shouldResetTransform=!0;this.root===this&&(this.nodes=new vD)}addEventListener(h,m){return this.eventHandlers.has(h)||this.eventHandlers.set(h,new Im),this.eventHandlers.get(h).add(m)}notifyListeners(h,...m){const p=this.eventHandlers.get(h);p&&p.notify(...m)}hasListeners(h){return this.eventHandlers.has(h)}mount(h){if(this.instance)return;this.isSVG=T1(h)&&!jO(h),this.instance=h;const{layoutId:m,layout:p,visualElement:y}=this.options;if(y&&!y.current&&y.mount(h),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(p||m)&&(this.isLayoutDirty=!0),n){let v,x=0;const w=()=>this.root.updateBlockedByResize=!1;Qe.read(()=>{x=window.innerWidth}),n(h,()=>{const j=window.innerWidth;j!==x&&(x=j,this.root.updateBlockedByResize=!0,v&&v(),v=xD(w,250),tu.hasAnimatedSinceResize&&(tu.hasAnimatedSinceResize=!1,this.nodes.forEach(Fx)))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&y&&(m||p)&&this.addEventListener("didUpdate",({delta:v,hasLayoutChanged:x,hasRelativeLayoutChanged:w,layout:j})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const _=this.options.transition||y.getDefaultTransition()||zD,{onLayoutAnimationStart:T,onLayoutAnimationComplete:N}=y.getProps(),A=!this.targetLayout||!F1(this.targetLayout,j),M=!x&&w;if(this.options.layoutRoot||this.resumeFrom||M||x&&(A||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...Qm(_,"layout"),onPlay:T,onComplete:N};(y.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(v,M)}else x||Fx(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=j})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const h=this.getStack();h&&h.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),sa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(RD),this.animationId++)}getTransformTemplate(){const{visualElement:h}=this.options;return h&&h.getProps().transformTemplate}willUpdate(h=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&X1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const x=this.path[v];x.shouldResetTransform=!0,x.updateScroll("snapshot"),x.options.layoutRoot&&x.willUpdate(!1)}const{layoutId:m,layout:p}=this.options;if(m===void 0&&!p)return;const y=this.getTransformTemplate();this.prevTransformTemplateValue=y?y(this.latestValues,""):void 0,this.updateSnapshot(),h&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Hx);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Gx);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(AD),this.nodes.forEach(_D),this.nodes.forEach(jD)):this.nodes.forEach(Gx),this.clearAllSnapshots();const m=qt.now();Mt.delta=Gn(0,1e3/60,m-Mt.timestamp),Mt.timestamp=m,Mt.isProcessing=!0,hf.update.process(Mt),hf.preRender.process(Mt),hf.render.process(Mt),Mt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ap.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ND),this.sharedNodes.forEach(OD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Qe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Qe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!$t(this.snapshot.measuredBox.x)&&!$t(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let p=0;p<this.path.length;p++)this.path[p].updateScroll();const h=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=St(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:m}=this.options;m&&m.notify("LayoutMeasure",this.layout.layoutBox,h?h.layoutBox:void 0)}updateScroll(h="measure"){let m=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===h&&(m=!1),m&&this.instance){const p=i(this.instance);this.scroll={animationId:this.root.animationId,phase:h,isRoot:p,offset:a(this.instance),wasRoot:this.scroll?this.scroll.isRoot:p}}}resetTransform(){if(!l)return;const h=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,m=this.projectionDelta&&!G1(this.projectionDelta),p=this.getTransformTemplate(),y=p?p(this.latestValues,""):void 0,v=y!==this.prevTransformTemplateValue;h&&this.instance&&(m||Ua(this.latestValues)||v)&&(l(this.instance,y),this.shouldResetTransform=!1,this.scheduleRender())}measure(h=!0){const m=this.measurePageBox();let p=this.removeElementScroll(m);return h&&(p=this.removeTransform(p)),LD(p),{animationId:this.root.animationId,measuredBox:m,layoutBox:p,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:h}=this.options;if(!h)return St();const m=h.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(UD))){const{scroll:y}=this.root;y&&(di(m.x,y.offset.x),di(m.y,y.offset.y))}return m}removeElementScroll(h){const m=St();if(Cn(m,h),this.scroll?.wasRoot)return m;for(let p=0;p<this.path.length;p++){const y=this.path[p],{scroll:v,options:x}=y;y!==this.root&&v&&x.layoutScroll&&(v.wasRoot&&Cn(m,h),di(m.x,v.offset.x),di(m.y,v.offset.y))}return m}applyTransform(h,m=!1){const p=St();Cn(p,h);for(let y=0;y<this.path.length;y++){const v=this.path[y];!m&&v.options.layoutScroll&&v.scroll&&v!==v.root&&hi(p,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Ua(v.latestValues)&&hi(p,v.latestValues)}return Ua(this.latestValues)&&hi(p,this.latestValues),p}removeTransform(h){const m=St();Cn(m,h);for(let p=0;p<this.path.length;p++){const y=this.path[p];if(!y.instance||!Ua(y.latestValues))continue;gm(y.latestValues)&&y.updateSnapshot();const v=St(),x=y.measurePageBox();Cn(v,x),zx(m,y.latestValues,y.snapshot?y.snapshot.layoutBox:void 0,v)}return Ua(this.latestValues)&&zx(m,this.latestValues),m}setTargetDelta(h){this.targetDelta=h,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(h){this.options={...this.options,...h,crossfade:h.crossfade!==void 0?h.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Mt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(h=!1){const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const p=!!this.resumingFrom||this!==m;if(!(h||p&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:v,layoutId:x}=this.options;if(!this.layout||!(v||x))return;this.resolvedRelativeTargetAt=Mt.timestamp;const w=this.getClosestProjectingParent();w&&this.linkedParentVersion!==w.layoutVersion&&!w.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(w&&w.layout?this.createRelativeTarget(w,this.layout.layoutBox,w.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=St(),this.targetWithTransforms=St()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),iD(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Cn(this.target,this.layout.layoutBox),D1(this.target,this.targetDelta)):Cn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,w&&!!w.resumingFrom==!!this.resumingFrom&&!w.options.layoutScroll&&w.target&&this.animationProgress!==1?this.createRelativeTarget(w,this.target,w.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||gm(this.parent.latestValues)||O1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(h,m,p){this.relativeParent=h,this.linkedParentVersion=h.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=St(),this.relativeTargetOrigin=St(),xu(this.relativeTargetOrigin,m,p),Cn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const h=this.getLead(),m=!!this.resumingFrom||this!==h;let p=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(p=!1),m&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(p=!1),this.resolvedRelativeTargetAt===Mt.timestamp&&(p=!1),p)return;const{layout:y,layoutId:v}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(y||v))return;Cn(this.layoutCorrected,this.layout.layoutBox);const x=this.treeScale.x,w=this.treeScale.y;zO(this.layoutCorrected,this.treeScale,this.path,m),h.layout&&!h.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(h.target=h.layout.layoutBox,h.targetWithTransforms=St());const{target:j}=h;if(!j){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(kx(this.prevProjectionDelta.x,this.projectionDelta.x),kx(this.prevProjectionDelta.y,this.projectionDelta.y)),Uo(this.projectionDelta,this.layoutCorrected,j,this.latestValues),(this.treeScale.x!==x||this.treeScale.y!==w||!Bx(this.projectionDelta.x,this.prevProjectionDelta.x)||!Bx(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",j))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(h=!0){if(this.options.visualElement?.scheduleRender(),h){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ui(),this.projectionDelta=ui(),this.projectionDeltaWithTransform=ui()}setAnimationOrigin(h,m=!1){const p=this.snapshot,y=p?p.latestValues:{},v={...this.latestValues},x=ui();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!m;const w=St(),j=p?p.source:void 0,_=this.layout?this.layout.source:void 0,T=j!==_,N=this.getStack(),A=!N||N.members.length<=1,M=!!(T&&!A&&this.options.crossfade===!0&&!this.path.some(MD));this.animationProgress=0;let k;this.mixTargetDelta=U=>{const F=U/1e3;Kx(x.x,h.x,F),Kx(x.y,h.y,F),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(xu(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox),DD(this.relativeTarget,this.relativeTargetOrigin,w,F),k&&uD(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=St()),Cn(k,this.relativeTarget)),T&&(this.animationValues=v,fD(v,y,this.latestValues,F,M,A)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=F},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(h){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(sa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Qe.update(()=>{tu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=bi(0)),this.currentAnimation=gD(this.motionValue,[0,1e3],{...h,velocity:0,isSync:!0,onUpdate:m=>{this.mixTargetDelta(m),h.onUpdate&&h.onUpdate(m)},onStop:()=>{},onComplete:()=>{h.onComplete&&h.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const h=this.getStack();h&&h.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(wD),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const h=this.getLead();let{targetWithTransforms:m,target:p,layout:y,latestValues:v}=h;if(!(!m||!p||!y)){if(this!==h&&this.layout&&y&&J1(this.options.animationType,this.layout.layoutBox,y.layoutBox)){p=this.target||St();const x=$t(this.layout.layoutBox.x);p.x.min=h.target.x.min,p.x.max=p.x.min+x;const w=$t(this.layout.layoutBox.y);p.y.min=h.target.y.min,p.y.max=p.y.min+w}Cn(m,p),hi(m,v),Uo(this.projectionDeltaWithTransform,this.layoutCorrected,m,v)}}registerSharedNode(h,m){this.sharedNodes.has(h)||this.sharedNodes.set(h,new bD),this.sharedNodes.get(h).add(m);const y=m.options.initialPromotionConfig;m.promote({transition:y?y.transition:void 0,preserveFollowOpacity:y&&y.shouldPreserveFollowOpacity?y.shouldPreserveFollowOpacity(m):void 0})}isLead(){const h=this.getStack();return h?h.lead===this:!0}getLead(){const{layoutId:h}=this.options;return h?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:h}=this.options;return h?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:h}=this.options;if(h)return this.root.sharedNodes.get(h)}promote({needsReset:h,transition:m,preserveFollowOpacity:p}={}){const y=this.getStack();y&&y.promote(this,p),h&&(this.projectionDelta=void 0,this.needsReset=!0),m&&this.setOptions({transition:m})}relegate(){const h=this.getStack();return h?h.relegate(this):!1}resetSkewAndRotation(){const{visualElement:h}=this.options;if(!h)return;let m=!1;const{latestValues:p}=h;if((p.z||p.rotate||p.rotateX||p.rotateY||p.rotateZ||p.skewX||p.skewY)&&(m=!0),!m)return;const y={};p.z&&wf("z",h,y,this.animationValues);for(let v=0;v<bf.length;v++)wf(`rotate${bf[v]}`,h,y,this.animationValues),wf(`skew${bf[v]}`,h,y,this.animationValues);h.render();for(const v in y)h.setStaticValue(v,y[v]),this.animationValues&&(this.animationValues[v]=y[v]);h.scheduleRender()}applyProjectionStyles(h,m){if(!this.instance||this.isSVG)return;if(!this.isVisible){h.visibility="hidden";return}const p=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,h.visibility="",h.opacity="",h.pointerEvents=eu(m?.pointerEvents)||"",h.transform=p?p(this.latestValues,""):"none";return}const y=this.getLead();if(!this.projectionDelta||!this.layout||!y.target){this.options.layoutId&&(h.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,h.pointerEvents=eu(m?.pointerEvents)||""),this.hasProjected&&!Ua(this.latestValues)&&(h.transform=p?p({},""):"none",this.hasProjected=!1);return}h.visibility="";const v=y.animationValues||y.latestValues;this.applyTransformsToTarget();let x=dD(this.projectionDeltaWithTransform,this.treeScale,v);p&&(x=p(v,x)),h.transform=x;const{x:w,y:j}=this.projectionDelta;h.transformOrigin=`${w.origin*100}% ${j.origin*100}% 0`,y.animationValues?h.opacity=y===this?v.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:v.opacityExit:h.opacity=y===this?v.opacity!==void 0?v.opacity:"":v.opacityExit!==void 0?v.opacityExit:0;for(const _ in vm){if(v[_]===void 0)continue;const{correct:T,applyTo:N,isCSSVariable:A}=vm[_],M=x==="none"?v[_]:T(v[_],y);if(N){const k=N.length;for(let U=0;U<k;U++)h[N[U]]=M}else A?this.options.visualElement.renderState.vars[_]=M:h[_]=M}this.options.layoutId&&(h.pointerEvents=y===this?eu(m?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(h=>h.currentAnimation?.stop()),this.root.nodes.forEach(Hx),this.root.sharedNodes.clear()}}}function _D(n){n.updateLayout()}function jD(n){const e=n.resumeFrom?.snapshot||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:i}=n.layout,{animationType:l}=n.options,d=e.source!==n.layout.source;l==="size"?Sn(v=>{const x=d?e.measuredBox[v]:e.layoutBox[v],w=$t(x);x.min=a[v].min,x.max=x.min+w}):J1(l,e.layoutBox,a)&&Sn(v=>{const x=d?e.measuredBox[v]:e.layoutBox[v],w=$t(a[v]);x.max=x.min+w,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[v].max=n.relativeTarget[v].min+w)});const h=ui();Uo(h,a,e.layoutBox);const m=ui();d?Uo(m,n.applyTransform(i,!0),e.measuredBox):Uo(m,a,e.layoutBox);const p=!G1(h);let y=!1;if(!n.resumeFrom){const v=n.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:x,layout:w}=v;if(x&&w){const j=St();xu(j,e.layoutBox,x.layoutBox);const _=St();xu(_,a,w.layoutBox),F1(j,_)||(y=!0),v.options.layoutRoot&&(n.relativeTarget=_,n.relativeTargetOrigin=j,n.relativeParent=v)}}}n.notifyListeners("didUpdate",{layout:a,snapshot:e,delta:m,layoutDelta:h,hasLayoutChanged:p,hasRelativeLayoutChanged:y})}else if(n.isLead()){const{onExitComplete:a}=n.options;a&&a()}n.options.transition=void 0}function ED(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function TD(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function ND(n){n.clearSnapshot()}function Hx(n){n.clearMeasurements()}function Gx(n){n.isLayoutDirty=!1}function AD(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function Fx(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function kD(n){n.resolveTargetDelta()}function CD(n){n.calcProjection()}function RD(n){n.resetSkewAndRotation()}function OD(n){n.removeLeadSnapshot()}function Kx(n,e,a){n.translate=nt(e.translate,0,a),n.scale=nt(e.scale,1,a),n.origin=e.origin,n.originPoint=e.originPoint}function Yx(n,e,a,i){n.min=nt(e.min,a.min,i),n.max=nt(e.max,a.max,i)}function DD(n,e,a,i){Yx(n.x,e.x,a.x,i),Yx(n.y,e.y,a.y,i)}function MD(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const zD={duration:.45,ease:[.4,0,.1,1]},Xx=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),Wx=Xx("applewebkit/")&&!Xx("chrome/")?Math.round:jn;function Jx(n){n.min=Wx(n.min),n.max=Wx(n.max)}function LD(n){Jx(n.x),Jx(n.y)}function J1(n,e,a){return n==="position"||n==="preserve-aspect"&&!rD(Vx(e),Vx(a),.2)}function UD(n){return n!==n.root&&n.scroll?.wasRoot}const PD=W1({attachResizeListener:(n,e)=>Qo(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Sf={current:void 0},Z1=W1({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!Sf.current){const n=new PD({});n.mount(window),n.setOptions({layoutScroll:!0}),Sf.current=n}return Sf.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),up=S.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function Zx(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function VD(...n){return e=>{let a=!1;const i=n.map(l=>{const d=Zx(l,e);return!a&&typeof d=="function"&&(a=!0),d});if(a)return()=>{for(let l=0;l<i.length;l++){const d=i[l];typeof d=="function"?d():Zx(n[l],null)}}}}function BD(...n){return S.useCallback(VD(...n),n)}class ID extends S.Component{getSnapshotBeforeUpdate(e){const a=this.props.childRef.current;if(a&&e.isPresent&&!this.props.isPresent){const i=a.offsetParent,l=mm(i)&&i.offsetWidth||0,d=mm(i)&&i.offsetHeight||0,h=this.props.sizeRef.current;h.height=a.offsetHeight||0,h.width=a.offsetWidth||0,h.top=a.offsetTop,h.left=a.offsetLeft,h.right=l-h.width-h.left,h.bottom=d-h.height-h.top}return null}componentDidUpdate(){}render(){return this.props.children}}function qD({children:n,isPresent:e,anchorX:a,anchorY:i,root:l}){const d=S.useId(),h=S.useRef(null),m=S.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:p}=S.useContext(up),y=n.props?.ref??n?.ref,v=BD(h,y);return S.useInsertionEffect(()=>{const{width:x,height:w,top:j,left:_,right:T,bottom:N}=m.current;if(e||!h.current||!x||!w)return;const A=a==="left"?`left: ${_}`:`right: ${T}`,M=i==="bottom"?`bottom: ${N}`:`top: ${j}`;h.current.dataset.motionPopId=d;const k=document.createElement("style");p&&(k.nonce=p);const U=l??document.head;return U.appendChild(k),k.sheet&&k.sheet.insertRule(`
52
- [data-motion-pop-id="${d}"] {
53
- position: absolute !important;
54
- width: ${x}px !important;
55
- height: ${w}px !important;
56
- ${A}px !important;
57
- ${M}px !important;
58
- }
59
- `),()=>{U.contains(k)&&U.removeChild(k)}},[e]),c.jsx(ID,{isPresent:e,childRef:h,sizeRef:m,children:S.cloneElement(n,{ref:v})})}const $D=({children:n,initial:e,isPresent:a,onExitComplete:i,custom:l,presenceAffectsLayout:d,mode:h,anchorX:m,anchorY:p,root:y})=>{const v=Lm(HD),x=S.useId();let w=!0,j=S.useMemo(()=>(w=!1,{id:x,initial:e,isPresent:a,custom:l,onExitComplete:_=>{v.set(_,!0);for(const T of v.values())if(!T)return;i&&i()},register:_=>(v.set(_,!1),()=>v.delete(_))}),[a,v,i]);return d&&w&&(j={...j}),S.useMemo(()=>{v.forEach((_,T)=>v.set(T,!1))},[a]),S.useEffect(()=>{!a&&!v.size&&i&&i()},[a]),h==="popLayout"&&(n=c.jsx(qD,{isPresent:a,anchorX:m,anchorY:p,root:y,children:n})),c.jsx(Au.Provider,{value:j,children:n})};function HD(){return new Map}function Q1(n=!0){const e=S.useContext(Au);if(e===null)return[!0,null];const{isPresent:a,onExitComplete:i,register:l}=e,d=S.useId();S.useEffect(()=>{if(n)return l(d)},[n]);const h=S.useCallback(()=>n&&i&&i(d),[d,i,n]);return!a&&i?[!1,h]:[!0]}const Ic=n=>n.key||"";function Qx(n){const e=[];return S.Children.forEach(n,a=>{S.isValidElement(a)&&e.push(a)}),e}const eS=({children:n,custom:e,initial:a=!0,onExitComplete:i,presenceAffectsLayout:l=!0,mode:d="sync",propagate:h=!1,anchorX:m="left",anchorY:p="top",root:y})=>{const[v,x]=Q1(h),w=S.useMemo(()=>Qx(n),[n]),j=h&&!v?[]:w.map(Ic),_=S.useRef(!0),T=S.useRef(w),N=Lm(()=>new Map),A=S.useRef(new Set),[M,k]=S.useState(w),[U,F]=S.useState(w);Rw(()=>{_.current=!1,T.current=w;for(let z=0;z<U.length;z++){const Z=Ic(U[z]);j.includes(Z)?(N.delete(Z),A.current.delete(Z)):N.get(Z)!==!0&&N.set(Z,!1)}},[U,j.length,j.join("-")]);const K=[];if(w!==M){let z=[...w];for(let Z=0;Z<U.length;Z++){const ie=U[Z],be=Ic(ie);j.includes(be)||(z.splice(Z,0,ie),K.push(ie))}return d==="wait"&&K.length&&(z=K),F(Qx(z)),k(w),null}const{forceRender:P}=S.useContext(zm);return c.jsx(c.Fragment,{children:U.map(z=>{const Z=Ic(z),ie=h&&!v?!1:w===U||j.includes(Z),be=()=>{if(A.current.has(Z))return;if(A.current.add(Z),N.has(Z))N.set(Z,!0);else return;let de=!0;N.forEach(qe=>{qe||(de=!1)}),de&&(P?.(),F(T.current),h&&x?.(),i&&i())};return c.jsx($D,{isPresent:ie,initial:!_.current||a?void 0:!1,custom:e,presenceAffectsLayout:l,mode:d,root:y,onExitComplete:ie?void 0:be,anchorX:m,anchorY:p,children:z},Z)})})},tS=S.createContext({strict:!1}),eb={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let tb=!1;function GD(){if(tb)return;const n={};for(const e in eb)n[e]={isEnabled:a=>eb[e].some(i=>!!a[i])};k1(n),tb=!0}function nS(){return GD(),RO()}function FD(n){const e=nS();for(const a in n)e[a]={...e[a],...n[a]};k1(e)}const KD=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function bu(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||KD.has(n)}let sS=n=>!bu(n);function YD(n){typeof n=="function"&&(sS=e=>e.startsWith("on")?!bu(e):n(e))}try{YD(require("@emotion/is-prop-valid").default)}catch{}function XD(n,e,a){const i={};for(const l in n)l==="values"&&typeof n.values=="object"||(sS(l)||a===!0&&bu(l)||!e&&!bu(l)||n.draggable&&l.startsWith("onDrag"))&&(i[l]=n[l]);return i}const Ru=S.createContext({});function WD(n,e){if(Cu(n)){const{initial:a,animate:i}=n;return{initial:a===!1||Zo(a)?a:void 0,animate:Zo(i)?i:void 0}}return n.inherit!==!1?e:{}}function JD(n){const{initial:e,animate:a}=WD(n,S.useContext(Ru));return S.useMemo(()=>({initial:e,animate:a}),[nb(e),nb(a)])}function nb(n){return Array.isArray(n)?n.join(" "):n}const dp=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function aS(n,e,a){for(const i in e)!Ut(e[i])&&!L1(i,a)&&(n[i]=e[i])}function ZD({transformTemplate:n},e){return S.useMemo(()=>{const a=dp();return lp(a,e,n),Object.assign({},a.vars,a.style)},[e])}function QD(n,e){const a=n.style||{},i={};return aS(i,a,n),Object.assign(i,ZD(n,e)),i}function e5(n,e){const a={},i=QD(n,e);return n.drag&&n.dragListener!==!1&&(a.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(a.tabIndex=0),a.style=i,a}const rS=()=>({...dp(),attrs:{}});function t5(n,e,a,i){const l=S.useMemo(()=>{const d=rS();return U1(d,e,V1(i),n.transformTemplate,n.style),{...d.attrs,style:{...d.style}}},[e]);if(n.style){const d={};aS(d,n.style,n),l.style={...d,...l.style}}return l}const n5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function hp(n){return typeof n!="string"||n.includes("-")?!1:!!(n5.indexOf(n)>-1||/[A-Z]/u.test(n))}function s5(n,e,a,{latestValues:i},l,d=!1,h){const p=(h??hp(n)?t5:e5)(e,i,l,n),y=XD(e,typeof n=="string",d),v=n!==S.Fragment?{...y,...p,ref:a}:{},{children:x}=e,w=S.useMemo(()=>Ut(x)?x.get():x,[x]);return S.createElement(n,{...v,children:w})}function a5({scrapeMotionValuesFromProps:n,createRenderState:e},a,i,l){return{latestValues:r5(a,i,l,n),renderState:e()}}function r5(n,e,a,i){const l={},d=i(n,{});for(const w in d)l[w]=eu(d[w]);let{initial:h,animate:m}=n;const p=Cu(n),y=A1(n);e&&y&&!p&&n.inherit!==!1&&(h===void 0&&(h=e.initial),m===void 0&&(m=e.animate));let v=a?a.initial===!1:!1;v=v||h===!1;const x=v?m:h;if(x&&typeof x!="boolean"&&!ku(x)){const w=Array.isArray(x)?x:[x];for(let j=0;j<w.length;j++){const _=tp(n,w[j]);if(_){const{transitionEnd:T,transition:N,...A}=_;for(const M in A){let k=A[M];if(Array.isArray(k)){const U=v?k.length-1:0;k=k[U]}k!==null&&(l[M]=k)}for(const M in T)l[M]=T[M]}}}return l}const iS=n=>(e,a)=>{const i=S.useContext(Ru),l=S.useContext(Au),d=()=>a5(n,e,i,l);return a?d():Lm(d)},i5=iS({scrapeMotionValuesFromProps:cp,createRenderState:dp}),o5=iS({scrapeMotionValuesFromProps:B1,createRenderState:rS}),l5=Symbol.for("motionComponentSymbol");function c5(n,e,a){const i=S.useRef(a);S.useInsertionEffect(()=>{i.current=a});const l=S.useRef(null);return S.useCallback(d=>{d&&n.onMount?.(d),e&&(d?e.mount(d):e.unmount());const h=i.current;if(typeof h=="function")if(d){const m=h(d);typeof m=="function"&&(l.current=m)}else l.current?(l.current(),l.current=null):h(d);else h&&(h.current=d)},[e])}const oS=S.createContext({});function Oo(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function u5(n,e,a,i,l,d){const{visualElement:h}=S.useContext(Ru),m=S.useContext(tS),p=S.useContext(Au),y=S.useContext(up).reducedMotion,v=S.useRef(null),x=S.useRef(!1);i=i||m.renderer,!v.current&&i&&(v.current=i(n,{visualState:e,parent:h,props:a,presenceContext:p,blockInitialAnimation:p?p.initial===!1:!1,reducedMotionConfig:y,isSVG:d}),x.current&&v.current&&(v.current.manuallyAnimateOnMount=!0));const w=v.current,j=S.useContext(oS);w&&!w.projection&&l&&(w.type==="html"||w.type==="svg")&&d5(v.current,a,l,j);const _=S.useRef(!1);S.useInsertionEffect(()=>{w&&_.current&&w.update(a,p)});const T=a[m1],N=S.useRef(!!T&&!window.MotionHandoffIsComplete?.(T)&&window.MotionHasOptimisedAnimation?.(T));return Rw(()=>{x.current=!0,w&&(_.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),N.current&&w.animationState&&w.animationState.animateChanges())}),S.useEffect(()=>{w&&(!N.current&&w.animationState&&w.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(T)}),N.current=!1),w.enteringChildren=void 0)}),w}function d5(n,e,a,i){const{layoutId:l,layout:d,drag:h,dragConstraints:m,layoutScroll:p,layoutRoot:y,layoutCrossfade:v}=e;n.projection=new a(n.latestValues,e["data-framer-portal-id"]?void 0:lS(n.parent)),n.projection.setOptions({layoutId:l,layout:d,alwaysMeasureLayout:!!h||m&&Oo(m),visualElement:n,animationType:typeof d=="string"?d:"both",initialPromotionConfig:i,crossfade:v,layoutScroll:p,layoutRoot:y})}function lS(n){if(n)return n.options.allowProjection!==!1?n.projection:lS(n.parent)}function _f(n,{forwardMotionProps:e=!1,type:a}={},i,l){i&&FD(i);const d=a?a==="svg":hp(n),h=d?o5:i5;function m(y,v){let x;const w={...S.useContext(up),...y,layoutId:h5(y)},{isStatic:j}=w,_=JD(y),T=h(y,j);if(!j&&Cw){f5();const N=m5(w);x=N.MeasureLayout,_.visualElement=u5(n,T,w,l,N.ProjectionNode,d)}return c.jsxs(Ru.Provider,{value:_,children:[x&&_.visualElement?c.jsx(x,{visualElement:_.visualElement,...w}):null,s5(n,y,c5(T,_.visualElement,v),T,j,e,d)]})}m.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const p=S.forwardRef(m);return p[l5]=n,p}function h5({layoutId:n}){const e=S.useContext(zm).id;return e&&n!==void 0?e+"-"+n:n}function f5(n,e){S.useContext(tS).strict}function m5(n){const e=nS(),{drag:a,layout:i}=e;if(!a&&!i)return{};const l={...a,...i};return{MeasureLayout:a?.isEnabled(n)||i?.isEnabled(n)?l.MeasureLayout:void 0,ProjectionNode:l.ProjectionNode}}function p5(n,e){if(typeof Proxy>"u")return _f;const a=new Map,i=(d,h)=>_f(d,h,n,e),l=(d,h)=>i(d,h);return new Proxy(l,{get:(d,h)=>h==="create"?i:(a.has(h)||a.set(h,_f(h,void 0,n,e)),a.get(h))})}const g5=(n,e)=>e.isSVG??hp(n)?new YO(e):new qO(e,{allowProjection:n!==S.Fragment});class y5 extends oa{constructor(e){super(e),e.animationState||(e.animationState=QO(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ku(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:a}=this.node.prevProps||{};e!==a&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let v5=0;class x5 extends oa{constructor(){super(...arguments),this.id=v5++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:a}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const l=this.node.animationState.setActive("exit",!e);a&&!e&&l.then(()=>{a(this.id)})}mount(){const{register:e,onExitComplete:a}=this.node.presenceContext||{};a&&a(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const b5={animation:{Feature:y5},exit:{Feature:x5}};function il(n){return{point:{x:n.pageX,y:n.pageY}}}const w5=n=>e=>rp(e)&&n(e,il(e));function Po(n,e,a,i){return Qo(n,e,w5(a),i)}const cS=({current:n})=>n?n.ownerDocument.defaultView:null,sb=(n,e)=>Math.abs(n-e);function S5(n,e){const a=sb(n.x,e.x),i=sb(n.y,e.y);return Math.sqrt(a**2+i**2)}const ab=new Set(["auto","scroll"]);class uS{constructor(e,a,{transformPagePoint:i,contextWindow:l=window,dragSnapToOrigin:d=!1,distanceThreshold:h=3,element:m}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=j=>{this.handleScroll(j.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=Ef(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,T=S5(j.offset,{x:0,y:0})>=this.distanceThreshold;if(!_&&!T)return;const{point:N}=j,{timestamp:A}=Mt;this.history.push({...N,timestamp:A});const{onStart:M,onMove:k}=this.handlers;_||(M&&M(this.lastMoveEvent,j),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,j)},this.handlePointerMove=(j,_)=>{this.lastMoveEvent=j,this.lastMoveEventInfo=jf(_,this.transformPagePoint),Qe.update(this.updatePoint,!0)},this.handlePointerUp=(j,_)=>{this.end();const{onEnd:T,onSessionEnd:N,resumeAnimation:A}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&A&&A(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const M=Ef(j.type==="pointercancel"?this.lastMoveEventInfo:jf(_,this.transformPagePoint),this.history);this.startEvent&&T&&T(j,M),N&&N(j,M)},!rp(e))return;this.dragSnapToOrigin=d,this.handlers=a,this.transformPagePoint=i,this.distanceThreshold=h,this.contextWindow=l||window;const p=il(e),y=jf(p,this.transformPagePoint),{point:v}=y,{timestamp:x}=Mt;this.history=[{...v,timestamp:x}];const{onSessionStart:w}=a;w&&w(e,Ef(y,this.history)),this.removeListeners=sl(Po(this.contextWindow,"pointermove",this.handlePointerMove),Po(this.contextWindow,"pointerup",this.handlePointerUp),Po(this.contextWindow,"pointercancel",this.handlePointerUp)),m&&this.startScrollTracking(m)}startScrollTracking(e){let a=e.parentElement;for(;a;){const i=getComputedStyle(a);(ab.has(i.overflowX)||ab.has(i.overflowY))&&this.scrollPositions.set(a,{x:a.scrollLeft,y:a.scrollTop}),a=a.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const a=this.scrollPositions.get(e);if(!a)return;const i=e===window,l=i?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},d={x:l.x-a.x,y:l.y-a.y};d.x===0&&d.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=d.x,this.lastMoveEventInfo.point.y+=d.y):this.history.length>0&&(this.history[0].x-=d.x,this.history[0].y-=d.y),this.scrollPositions.set(e,l),Qe.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),sa(this.updatePoint)}}function jf(n,e){return e?{point:e(n.point)}:n}function rb(n,e){return{x:n.x-e.x,y:n.y-e.y}}function Ef({point:n},e){return{point:n,delta:rb(n,dS(e)),offset:rb(n,_5(e)),velocity:j5(e,.1)}}function _5(n){return n[0]}function dS(n){return n[n.length-1]}function j5(n,e){if(n.length<2)return{x:0,y:0};let a=n.length-1,i=null;const l=dS(n);for(;a>=0&&(i=n[a],!(l.timestamp-i.timestamp>gs(e)));)a--;if(!i)return{x:0,y:0};const d=_n(l.timestamp-i.timestamp);if(d===0)return{x:0,y:0};const h={x:(l.x-i.x)/d,y:(l.y-i.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function E5(n,{min:e,max:a},i){return e!==void 0&&n<e?n=i?nt(e,n,i.min):Math.max(n,e):a!==void 0&&n>a&&(n=i?nt(a,n,i.max):Math.min(n,a)),n}function ib(n,e,a){return{min:e!==void 0?n.min+e:void 0,max:a!==void 0?n.max+a-(n.max-n.min):void 0}}function T5(n,{top:e,left:a,bottom:i,right:l}){return{x:ib(n.x,a,l),y:ib(n.y,e,i)}}function ob(n,e){let a=e.min-n.min,i=e.max-n.max;return e.max-e.min<n.max-n.min&&([a,i]=[i,a]),{min:a,max:i}}function N5(n,e){return{x:ob(n.x,e.x),y:ob(n.y,e.y)}}function A5(n,e){let a=.5;const i=$t(n),l=$t(e);return l>i?a=Xo(e.min,e.max-i,n.min):i>l&&(a=Xo(n.min,n.max-l,e.min)),Gn(0,1,a)}function k5(n,e){const a={};return e.min!==void 0&&(a.min=e.min-n.min),e.max!==void 0&&(a.max=e.max-n.min),a}const xm=.35;function C5(n=xm){return n===!1?n=0:n===!0&&(n=xm),{x:lb(n,"left","right"),y:lb(n,"top","bottom")}}function lb(n,e,a){return{min:cb(n,e),max:cb(n,a)}}function cb(n,e){return typeof n=="number"?n:n[e]||0}const R5=new WeakMap;class O5{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=St(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:a=!1,distanceThreshold:i}={}){const{presenceContext:l}=this.visualElement;if(l&&l.isPresent===!1)return;const d=x=>{a?(this.stopAnimation(),this.snapToCursor(il(x).point)):this.pauseAnimation()},h=(x,w)=>{this.stopAnimation();const{drag:j,dragPropagation:_,onDragStart:T}=this.getProps();if(j&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xO(j),!this.openDragLock))return;this.latestPointerEvent=x,this.latestPanInfo=w,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Sn(A=>{let M=this.getAxisMotionValue(A).get()||0;if(Hn.test(M)){const{projection:k}=this.visualElement;if(k&&k.layout){const U=k.layout.layoutBox[A];U&&(M=$t(U)*(parseFloat(M)/100))}}this.originPoint[A]=M}),T&&Qe.postRender(()=>T(x,w)),dm(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},m=(x,w)=>{this.latestPointerEvent=x,this.latestPanInfo=w;const{dragPropagation:j,dragDirectionLock:_,onDirectionLock:T,onDrag:N}=this.getProps();if(!j&&!this.openDragLock)return;const{offset:A}=w;if(_&&this.currentDirection===null){this.currentDirection=D5(A),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",w.point,A),this.updateAxis("y",w.point,A),this.visualElement.render(),N&&N(x,w)},p=(x,w)=>{this.latestPointerEvent=x,this.latestPanInfo=w,this.stop(x,w),this.latestPointerEvent=null,this.latestPanInfo=null},y=()=>Sn(x=>this.getAnimationState(x)==="paused"&&this.getAxisMotionValue(x).animation?.play()),{dragSnapToOrigin:v}=this.getProps();this.panSession=new uS(e,{onSessionStart:d,onStart:h,onMove:m,onSessionEnd:p,resumeAnimation:y},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:v,distanceThreshold:i,contextWindow:cS(this.visualElement),element:this.visualElement.current})}stop(e,a){const i=e||this.latestPointerEvent,l=a||this.latestPanInfo,d=this.isDragging;if(this.cancel(),!d||!l||!i)return;const{velocity:h}=l;this.startAnimation(h);const{onDragEnd:m}=this.getProps();m&&Qe.postRender(()=>m(i,l))}cancel(){this.isDragging=!1;const{projection:e,animationState:a}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),a&&a.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,a,i){const{drag:l}=this.getProps();if(!i||!qc(e,l,this.currentDirection))return;const d=this.getAxisMotionValue(e);let h=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(h=E5(h,this.constraints[e],this.elastic[e])),d.set(h)}resolveConstraints(){const{dragConstraints:e,dragElastic:a}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,l=this.constraints;e&&Oo(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=T5(i.layoutBox,e):this.constraints=!1,this.elastic=C5(a),l!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Sn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=k5(i.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:a}=this.getProps();if(!e||!Oo(e))return!1;const i=e.current,{projection:l}=this.visualElement;if(!l||!l.layout)return!1;const d=LO(i,l.root,this.visualElement.getTransformPagePoint());let h=N5(l.layout.layoutBox,d);if(a){const m=a(DO(h));this.hasMutatedConstraints=!!m,m&&(h=R1(m))}return h}startAnimation(e){const{drag:a,dragMomentum:i,dragElastic:l,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:m}=this.getProps(),p=this.constraints||{},y=Sn(v=>{if(!qc(v,a,this.currentDirection))return;let x=p&&p[v]||{};h&&(x={min:0,max:0});const w=l?200:1e6,j=l?40:1e7,_={type:"inertia",velocity:i?e[v]:0,bounceStiffness:w,bounceDamping:j,timeConstant:750,restDelta:1,restSpeed:10,...d,...x};return this.startAxisValueAnimation(v,_)});return Promise.all(y).then(m)}startAxisValueAnimation(e,a){const i=this.getAxisMotionValue(e);return dm(this.visualElement,e),i.start(ep(e,i,0,a,this.visualElement,!1))}stopAnimation(){Sn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Sn(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const a=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),l=i[a];return l||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Sn(a=>{const{drag:i}=this.getProps();if(!qc(a,i,this.currentDirection))return;const{projection:l}=this.visualElement,d=this.getAxisMotionValue(a);if(l&&l.layout){const{min:h,max:m}=l.layout.layoutBox[a],p=d.get()||0;d.set(e[a]-nt(h,m,.5)+p)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:a}=this.getProps(),{projection:i}=this.visualElement;if(!Oo(a)||!i||!this.constraints)return;this.stopAnimation();const l={x:0,y:0};Sn(h=>{const m=this.getAxisMotionValue(h);if(m&&this.constraints!==!1){const p=m.get();l[h]=A5({min:p,max:p},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Sn(h=>{if(!qc(h,e,null))return;const m=this.getAxisMotionValue(h),{min:p,max:y}=this.constraints[h];m.set(nt(p,y,l[h]))})}addListeners(){if(!this.visualElement.current)return;R5.set(this.visualElement,this);const e=this.visualElement.current,a=Po(e,"pointerdown",p=>{const{drag:y,dragListener:v=!0}=this.getProps(),x=p.target,w=x!==e&&E1(x);y&&v&&!w&&this.start(p)}),i=()=>{const{dragConstraints:p}=this.getProps();Oo(p)&&p.current&&(this.constraints=this.resolveRefConstraints())},{projection:l}=this.visualElement,d=l.addEventListener("measure",i);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),Qe.read(i);const h=Qo(window,"resize",()=>this.scalePositionWithinConstraints()),m=l.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:y})=>{this.isDragging&&y&&(Sn(v=>{const x=this.getAxisMotionValue(v);x&&(this.originPoint[v]+=p[v].translate,x.set(x.get()+p[v].translate))}),this.visualElement.render())}));return()=>{h(),a(),d(),m&&m()}}getProps(){const e=this.visualElement.getProps(),{drag:a=!1,dragDirectionLock:i=!1,dragPropagation:l=!1,dragConstraints:d=!1,dragElastic:h=xm,dragMomentum:m=!0}=e;return{...e,drag:a,dragDirectionLock:i,dragPropagation:l,dragConstraints:d,dragElastic:h,dragMomentum:m}}}function qc(n,e,a){return(e===!0||e===n)&&(a===null||a===n)}function D5(n,e=10){let a=null;return Math.abs(n.y)>e?a="y":Math.abs(n.x)>e&&(a="x"),a}class M5 extends oa{constructor(e){super(e),this.removeGroupControls=jn,this.removeListeners=jn,this.controls=new O5(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||jn}update(){const{dragControls:e}=this.node.getProps(),{dragControls:a}=this.node.prevProps||{};e!==a&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ub=n=>(e,a)=>{n&&Qe.postRender(()=>n(e,a))};class z5 extends oa{constructor(){super(...arguments),this.removePointerDownListener=jn}onPointerDown(e){this.session=new uS(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cS(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:a,onPan:i,onPanEnd:l}=this.node.getProps();return{onSessionStart:ub(e),onStart:ub(a),onMove:i,onEnd:(d,h)=>{delete this.session,l&&Qe.postRender(()=>l(d,h))}}}mount(){this.removePointerDownListener=Po(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Tf=!1;class L5 extends S.Component{componentDidMount(){const{visualElement:e,layoutGroup:a,switchLayoutGroup:i,layoutId:l}=this.props,{projection:d}=e;d&&(a.group&&a.group.add(d),i&&i.register&&l&&i.register(d),Tf&&d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),tu.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:a,visualElement:i,drag:l,isPresent:d}=this.props,{projection:h}=i;return h&&(h.isPresent=d,e.layoutDependency!==a&&h.setOptions({...h.options,layoutDependency:a}),Tf=!0,l||e.layoutDependency!==a||a===void 0||e.isPresent!==d?h.willUpdate():this.safeToRemove(),e.isPresent!==d&&(d?h.promote():h.relegate()||Qe.postRender(()=>{const m=h.getStack();(!m||!m.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ap.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:a,switchLayoutGroup:i}=this.props,{projection:l}=e;Tf=!0,l&&(l.scheduleCheckAfterUnmount(),a&&a.group&&a.group.remove(l),i&&i.deregister&&i.deregister(l))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function hS(n){const[e,a]=Q1(),i=S.useContext(zm);return c.jsx(L5,{...n,layoutGroup:i,switchLayoutGroup:S.useContext(oS),isPresent:e,safeToRemove:a})}const U5={pan:{Feature:z5},drag:{Feature:M5,ProjectionNode:Z1,MeasureLayout:hS}};function db(n,e,a){const{props:i}=n;n.animationState&&i.whileHover&&n.animationState.setActive("whileHover",a==="Start");const l="onHover"+a,d=i[l];d&&Qe.postRender(()=>d(e,il(e)))}class P5 extends oa{mount(){const{current:e}=this.node;e&&(this.unmount=bO(e,(a,i)=>(db(this.node,i,"Start"),l=>db(this.node,l,"End"))))}unmount(){}}class V5 extends oa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=sl(Qo(this.node.current,"focus",()=>this.onFocus()),Qo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function hb(n,e,a){const{props:i}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&i.whileTap&&n.animationState.setActive("whileTap",a==="Start");const l="onTap"+(a==="End"?"":a),d=i[l];d&&Qe.postRender(()=>d(e,il(e)))}class B5 extends oa{mount(){const{current:e}=this.node;e&&(this.unmount=_O(e,(a,i)=>(hb(this.node,i,"Start"),(l,{success:d})=>hb(this.node,l,d?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const bm=new WeakMap,Nf=new WeakMap,I5=n=>{const e=bm.get(n.target);e&&e(n)},q5=n=>{n.forEach(I5)};function $5({root:n,...e}){const a=n||document;Nf.has(a)||Nf.set(a,{});const i=Nf.get(a),l=JSON.stringify(e);return i[l]||(i[l]=new IntersectionObserver(q5,{root:n,...e})),i[l]}function H5(n,e,a){const i=$5(e);return bm.set(n,a),i.observe(n),()=>{bm.delete(n),i.unobserve(n)}}const G5={some:0,all:1};class F5 extends oa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:a,margin:i,amount:l="some",once:d}=e,h={root:a?a.current:void 0,rootMargin:i,threshold:typeof l=="number"?l:G5[l]},m=p=>{const{isIntersecting:y}=p;if(this.isInView===y||(this.isInView=y,d&&!y&&this.hasEnteredView))return;y&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",y);const{onViewportEnter:v,onViewportLeave:x}=this.node.getProps(),w=y?v:x;w&&w(p)};return H5(this.node.current,h,m)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:a}=this.node;["amount","margin","root"].some(K5(e,a))&&this.startObserver()}unmount(){}}function K5({viewport:n={}},{viewport:e={}}={}){return a=>n[a]!==e[a]}const Y5={inView:{Feature:F5},tap:{Feature:B5},focus:{Feature:V5},hover:{Feature:P5}},X5={layout:{ProjectionNode:Z1,MeasureLayout:hS}},W5={...b5,...Y5,...U5,...X5},Xs=p5(W5,g5),J5="modulepreload",Z5=function(n){return"/"+n},fb={},Pa=function(e,a,i){let l=Promise.resolve();if(a&&a.length>0){let y=function(v){return Promise.all(v.map(x=>Promise.resolve(x).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};var h=y;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=m?.nonce||m?.getAttribute("nonce");l=y(a.map(v=>{if(v=Z5(v),v in fb)return;fb[v]=!0;const x=v.endsWith(".css"),w=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${w}`))return;const j=document.createElement("link");if(j.rel=x?"stylesheet":J5,x||(j.as="script"),j.crossOrigin="",j.href=v,p&&j.setAttribute("nonce",p),document.head.appendChild(j),x)return new Promise((_,T)=>{j.addEventListener("load",_),j.addEventListener("error",()=>T(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 l.then(m=>{for(const p of m||[])p.status==="rejected"&&d(p.reason);return e().catch(d)})},Q5=(n,e,a)=>{const i=n[e];return i?typeof i=="function"?i():Promise.resolve(i):new Promise((l,d)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(d.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==a?". Note that variables only represent file names one level deep.":""))))})},fS={"app.name":"Email Automator","app.connecting":"Connecting account...","app.loadingWorkspace":"Loading your workspace...","app.loggedOut":"Logged out successfully","app.statusLive":"LIVE","app.statusOffline":"OFFLINE","common.loading":"Loading...","common.save":"Save Changes","common.cancel":"Cancel","common.delete":"Delete","common.success":"Success","common.error":"Error","common.warning":"Warning","common.syncNow":"Sync Now","common.syncing":"Syncing...","common.stopSync":"Stop Sync","common.systemSync":"System Sync","common.viewLogs":"View Logs","common.saveChanges":"Save Changes","common.errorOccurred":"An error occurred","common.previous":"Previous","common.next":"Next","common.of":"of","common.yes":"Yes","common.no":"No","common.archive":"Archive","common.flag":"Flag","common.on":"On","common.off":"Off","common.enabled":"Enabled","common.disabled":"Disabled","common.active":"Active","common.inactive":"Inactive","common.draft":"Draft","common.star":"Star","nav.dashboard":"Dashboard","nav.autopilot":"Auto-Pilot","nav.analytics":"Analytics","nav.configuration":"Configuration","nav.accountSettings":"Account Settings","nav.signOut":"Sign Out","login.title":"Welcome Back","login.subtitle":"Sign in to your AI email agent","login.email":"Email Address","login.password":"Password","login.signIn":"Sign In","login.noAccount":"Don't have an account?","login.alreadyHaveAccount":"Already have an account?","login.signUp":"Sign Up","login.forgotPassword":"Forgot your password?","login.initialize":"Initialize Automator","login.secureLogin":"Secure Login","login.firstNamePlaceholder":"John","login.lastNamePlaceholder":"Doe","login.emailPlaceholder":"admin@automator.ai","login.initializeMaster":"Initialize Master","login.sendMagicLink":"Send Magic Link","login.openDashboard":"Open Dashboard","setup.title":"Automator Forge","setup.initiation":"Initiation","setup.coordinates":"Coordinates","setup.foundation":"Foundation","setup.ignition":"Ignition","setup.start":"Start Forge","setup.welcomeTitle":"Automator Initializing","setup.welcomeSubtitle":"Specialized environment is ready for assembly for high-frequency inbox intelligence.","setup.encryptedTitle":"Encrypted","setup.encryptedDesc":"Self-hosted data security.","setup.turboTitle":"Turbo","setup.turboDesc":"Sub-second AI inference.","setup.getStarted":"Get Started","setup.connectionMode":"Connection Mode","setup.selectVector":"Select deployment vector","setup.quickIgnition":"Quick Ignition","setup.autoProvision":"Auto-provision via token","setup.manualSync":"Manual Sync","setup.existingCredentials":"Existing Credentials","setup.abortAccess":"Abort Access","setup.injectCoordinates":"Inject existing coordinates","setup.platformUrl":"Platform URL","setup.urlHelp":"Enter full URL or just the Project ID","setup.anonMatrixKey":"Anon Matrix Key","setup.keyHelp":"Found in your Supabase project settings","setup.back":"Back","setup.engage":"Engage","setup.installation":"Installation","setup.applyingSchema":"Applying Schema DNA...","setup.emptyProject":"Empty project detected. Initialization is mandatory to install core AI systems.","setup.versionMismatch":"Version mismatch detected. Normalization recommended.","setup.tokenRequired":"Management Token Required","setup.migrateHelp":"Used once to run migrations on your backend.","setup.bypassRisk":"Bypass (Risky)","setup.installSystems":"Install Systems","setup.normalizeSystem":"Normalize System","setup.retryInstallation":"Retry Installation","dashboard.recentAnalysis":"Recent Analysis","dashboard.emails":"emails","dashboard.noEmails":"No emails found","dashboard.noEmailsConnected":"Connect your email account to get started.","dashboard.noEmailsFilters":"Try syncing or adjusting your filters.","dashboard.syncInProgress":"Sync in progress...","dashboard.syncInProgressDesc":"Fetching and analyzing emails. New emails will appear below automatically.","dashboard.aiTrace":"AI Processing Trace","dashboard.aiTraceDesc":"Step-by-step logs of how AI analyzed and actioned this email.","dashboard.noTrace":"No detailed trace events found for this email.","dashboard.syncNow":"Sync Now","dashboard.syncing":"Syncing...","dashboard.searchPlaceholder":"Search emails...","dashboard.search":"Search","dashboard.receivedTime":"Received Time","dashboard.processedTime":"Processed Time","dashboard.receivedAbbr":"REC","dashboard.processedAbbr":"PROC","dashboard.sortOldest":"Sorting: Oldest First","dashboard.sortNewest":"Sorting: Newest First","dashboard.category.all":"All","dashboard.category.none":"none","dashboard.emailDetails":"Email Details","dashboard.emailContent":"Email Content (sent to LLM)","dashboard.from":"From:","dashboard.subject":"Subject:","dashboard.summary":"Summary:","dashboard.keyPoints":"Key Points:","dashboard.aiDraftReply":"AI Draft Reply","dashboard.draftSavedHelp":"* This draft is already saved in your {provider} Drafts folder.","dashboard.syncScope":"Sync Scope","dashboard.syncFrom":"Sync From","dashboard.maxEmails":"Max Emails","dashboard.lastSync":"Last sync:","dashboard.error":"Error:","dashboard.resetCheckpoint":"Reset Checkpoint (Force Full Re-sync from Start Date)","dashboard.syncHistory":"Sync History","dashboard.noSyncHistory":"No sync history available.","dashboard.processed":"Processed:","dashboard.actioned":"Actioned:","dashboard.running":"Running","dashboard.quickStats":"Quick Stats","dashboard.totalProcessed":"Total Processed","dashboard.connectedAccounts":"Connected Accounts","dashboard.activeRules":"Active Rules","dashboard.noSubject":"No Subject","dashboard.queued":"Queued","dashboard.analyzing":"Analyzing","dashboard.analyzed":"Analyzed","dashboard.failed":"Failed","dashboard.retryProcessing":"Retry Processing","dashboard.suggested":"Suggested:","dashboard.done":"Done:","dashboard.deleteConfirm":"Delete?","dashboard.openIn":"Open in {provider}","dashboard.viewTraceTooltip":"View AI Trace (Prompt/Response)","dashboard.syncSuccess":"Sync completed! Check your emails.","dashboard.syncFailed":"Sync failed. Check account status for details.","config.title":"Automation & Rules","config.rules":"Automation Rules","config.createRule":"Create New Rule","config.llmSettings":"AI Intelligence Settings","config.accounts.title":"Email Accounts","config.accounts.desc":"Connect and manage your email accounts","config.accounts.addNew":"Add New Account","config.accounts.yourAccounts":"Your Connected Accounts","config.accounts.noAccounts":"No email accounts connected yet","config.accounts.connectHelp":"Connect your first email account to start automating","config.accounts.disconnect":"Disconnect","config.gmail.connect":"Connect Gmail","config.gmail.connectDesc":"OAuth 2.0 or Service Account","config.gmail.credentialsDesc":"Paste your Google Cloud credentials JSON","config.gmail.authCodeDesc":"Enter the authorization code from Google","config.gmail.pasteJson":"Paste credentials.json content","config.gmail.downloadHelp":"Download from Google Cloud Console → APIs & Services → Credentials","config.gmail.orEnterManually":"Or enter manually","config.outlook.connect":"Connect Outlook","config.outlook.connectDesc":"Microsoft 365 or Outlook.com","config.outlook.credentialsDesc":"Paste your Azure App credentials JSON","config.outlook.instructions":"Follow the OAuth flow to connect","config.outlook.signinRequired":"Sign-in Required","config.outlook.waitingSignin":"Waiting for sign-in...","config.model.title":"AI Model Configuration","config.model.desc":"Configure your AI model and processing settings","config.model.provider":"LLM Provider","config.model.name":"Model Name","config.model.selectModel":"Select a model","config.model.storagePath":"Storage Path","config.model.storagePlaceholder":"Path for model storage","config.model.storageHelp":"Local directory for caching models","config.model.syncInterval":"Sync Interval (minutes)","config.model.syncHelp":"How often to check for new emails","config.model.intelligentRename":"Intelligent Rename","config.model.renameHelp":"Use AI to suggest better file names","config.model.checkConnection":"Check Connection","config.model.saveConfig":"Save Configuration","config.byok.title":"Bring Your Own Key (BYOK)","config.byok.desc":"Use your own API keys for AI providers","config.byok.systemDefault":"Use system default","config.byok.save":"Save API Key","config.rules.edit":"Edit Rule","config.rules.create":"Create Rule","config.rules.createRule":"Create Rule","config.rules.desc":"Define conditions and actions for email automation","config.rules.name":"Rule Name","config.rules.namePlaceholder":"e.g., Archive Newsletters","config.rules.description":"Description","config.rules.descriptionPlaceholder":"What this rule does","config.rules.semanticHelp":"AI will match emails based on this description","config.rules.intent":"Intent","config.rules.intentPlaceholder":"What should happen when this rule triggers","config.rules.intentHelp":"Used to generate appropriate responses","config.rules.conditionField":"Condition Field","config.rules.aiAnalysis":"AI Analysis","config.rules.metadata":"Metadata","config.rules.category":"Category","config.rules.sentiment":"Sentiment","config.rules.priority":"Priority","config.rules.senderEmail":"Sender Email","config.rules.senderDomain":"Sender Domain","config.rules.senderContains":"Sender Contains","config.rules.subjectContains":"Subject Contains","config.rules.bodyContains":"Body Contains","config.rules.equalsValue":"Equals Value","config.rules.keywordsPlaceholder":"Enter keywords...","config.rules.olderThan":"Only if email is older than (days)","config.rules.olderThanHelp":"Leave empty or 0 to apply immediately","config.rules.performActions":"Then Perform Actions","config.rules.draftInstructions":"Draft Instructions","config.rules.contextHelp":"Specific context for AI to use when drafting","config.rules.addAttachment":"Add Attachment","config.rules.attachmentHelp":"Files will be attached to generated drafts","config.rules.uploading":"Uploading...","config.rules.saveChanges":"Save Changes","account.title":"Account Settings","account.subtitle":"Manage your profile and preferences","account.profile":"Profile","account.security":"Security","account.database":"Supabase","account.logout":"Logout","account.logoutSuccess":"Logged out successfully","account.version":"Version","account.profile.title":"Profile Information","account.profile.desc":"Update your personal information","account.profile.firstName":"First Name","account.profile.firstNamePlaceholder":"John","account.profile.lastName":"Last Name","account.profile.lastNamePlaceholder":"Doe","account.profile.email":"Email","account.profile.emailHelp":"This is your login email and cannot be changed","account.profile.sounds":"Sound & Haptic Feedback","account.profile.soundsHelp":"Play sounds for email notifications","account.profile.soundsEnabled":"Sounds enabled","account.profile.soundsDisabled":"Sounds disabled","account.profile.updated":"Profile updated successfully","account.profile.avatarUpdated":"Avatar updated successfully","account.profile.avatarError":"Failed to update avatar","account.security.title":"Security","account.security.desc":"Update your password","account.security.newPassword":"New Password","account.security.confirmPassword":"Confirm Password","account.security.updatePassword":"Update Password","account.security.enterPassword":"Please enter a password","account.security.passwordsMismatch":"Passwords do not match","account.security.passwordTooShort":"Password must be at least 6 characters","account.security.passwordChanged":"Password changed successfully","account.database.title":"Database Connection","account.database.desc":"Manage your Supabase connection","account.database.connected":"Connected","account.database.noConnection":"No Connection","account.database.configureHelp":"Configure your Supabase connection in the Setup Wizard","account.database.anonKey":"Anon Key","account.database.envAlert":"Connection configured via environment variables","account.database.changeConnection":"Change Connection","account.database.clearConfig":"Clear Configuration","account.database.clearConfirm":"Are you sure you want to clear your database configuration?","account.database.setup":"Setup Database","trace.runTrace":"Sync Run Trace","trace.fullLogFor":"Full log for account: {email}","trace.historicalLog":"Historical log for this synchronization run.","trace.loadingTrace":"Loading trace...","trace.noTraceEvents":"No granular trace events found for this run.","analytics.title":"Analytics Dashboard","analytics.totalEmails":"Total Emails","analytics.spamCaught":"Spam Caught","analytics.actionsTaken":"Actions Taken","analytics.accounts":"Accounts","analytics.categories":"Email Categories","analytics.recentActivity":"Recent Sync Activity","analytics.noActivity":"No sync activity yet","analytics.emails":"{count} emails","analytics.deleted":"{count} deleted","analytics.drafted":"{count} drafted","autopilot.title":"Auto-Pilot Rules","autopilot.rulesEnabled":"{enabled} of {total} rules enabled","autopilot.loadingRules":"Loading rules...","autopilot.loadError":"Failed to load rules","autopilot.deleteConfirm":"Are you sure you want to delete this rule?","autopilot.ruleDeleted":"Rule deleted","autopilot.ruleDeleteFailed":"Failed to delete rule","autopilot.ruleDeleteError":"An error occurred while deleting the rule","autopilot.ruleUpdated":"Rule updated","autopilot.ruleCreated":"Rule created","autopilot.ruleUpdateFailed":"Failed to update rule","autopilot.ruleCreateFailed":"Failed to create rule","autopilot.ruleSaveError":"An error occurred while saving the rule","autopilot.fileUploaded":"File uploaded","autopilot.fileUploadFailed":"Failed to upload file","autopilot.noRulesTitle":"No Rules Yet","autopilot.noRulesDesc":"Rules will be automatically created when you sign up or connect your first email account.","autopilot.addCustomRule":"Add Custom Rule","autopilot.refresh":"Refresh","autopilot.infoDesc":"Auto-Pilot rules use AI to automatically organize your inbox. Toggle any rule on or off to customize behavior.","autopilot.customRules":"Custom Rules","autopilot.customRulesDesc":"Rules you've created manually","autopilot.category.email_organization.label":"Email Organization","autopilot.category.email_organization.desc":"Automatically organize common email types","autopilot.category.priority_alerts.label":"Priority & Alerts","autopilot.category.priority_alerts.desc":"Surface urgent and important messages","autopilot.category.development.label":"Development","autopilot.category.development.desc":"GitHub, CI/CD, and dev tool notifications","autopilot.category.sales_business.label":"Sales & Business","autopilot.category.sales_business.desc":"Lead management and business communications","autopilot.category.operations.label":"Operations","autopilot.category.operations.desc":"Support, internal requests, and system alerts","autopilot.enabledCount":"({enabled}/{total} enabled)","autopilot.badge":"Auto-Pilot","autopilot.editRuleTooltip":"Edit Rule","autopilot.deleteRuleTooltip":"Delete Rule","autopilot.triggeredToday":"{count} today","autopilot.pack.active":"Active","autopilot.pack.partial":"Partial","autopilot.pack.inactive":"Inactive","autopilot.pack.disableTooltip":"Disable all rules","autopilot.pack.enableTooltip":"Enable all rules","autopilot.pack.rulesActive":"{active}/{total} rules active","autopilot.pack.actionsToday":"{count} actions today","autopilot.pack.noRules":"No rules in this pack","autopilot.editDialog.editTitle":"Edit Rule","autopilot.editDialog.createTitle":"Create Custom Rule","autopilot.editDialog.desc":"Define a condition based on AI analysis to trigger an action.","autopilot.editDialog.ruleName":"Rule Name","autopilot.editDialog.namePlaceholder":"e.g. Archive Newsletters","autopilot.editDialog.description":"Description","autopilot.editDialog.descPlaceholder":"e.g. Handle all marketing newsletters and promotional content from subscription services","autopilot.editDialog.descriptionHelp":"Describe what this rule is for. The AI uses this to semantically match emails.","autopilot.editDialog.intent":"Intent","autopilot.editDialog.intentPlaceholder":"e.g. Politely decline all sales pitches","autopilot.editDialog.intentHelp":"The goal of this rule. Used to generate appropriate draft replies.","autopilot.editDialog.conditionField":"If Condition Field","autopilot.editDialog.aiAnalysisGroup":"AI Analysis","autopilot.editDialog.metadataGroup":"Metadata","autopilot.editDialog.category":"Category","autopilot.editDialog.sentiment":"Sentiment","autopilot.editDialog.priority":"Priority","autopilot.editDialog.senderEmail":"Specific Email (Exact)","autopilot.editDialog.senderDomain":"Email Domain (@...)","autopilot.editDialog.senderContains":"Sender contains...","autopilot.editDialog.subjectContains":"Subject contains...","autopilot.editDialog.bodyContains":"Body contains...","autopilot.editDialog.equalsValue":"Equals Value","autopilot.editDialog.cat.newsletter":"Newsletter","autopilot.editDialog.cat.spam":"Spam","autopilot.editDialog.cat.promotional":"Promotional","autopilot.editDialog.cat.transactional":"Transactional","autopilot.editDialog.cat.social":"Social","autopilot.editDialog.cat.support":"Support","autopilot.editDialog.cat.client":"Client","autopilot.editDialog.cat.internal":"Internal","autopilot.editDialog.cat.personal":"Personal","autopilot.editDialog.cat.other":"Other","autopilot.editDialog.sent.positive":"Positive","autopilot.editDialog.sent.neutral":"Neutral","autopilot.editDialog.sent.negative":"Negative","autopilot.editDialog.prio.high":"High","autopilot.editDialog.prio.medium":"Medium","autopilot.editDialog.prio.low":"Low","autopilot.editDialog.keywordsPlaceholder":"Keywords...","autopilot.editDialog.olderThan":"Only if email is older than... (Optional)","autopilot.editDialog.days":"days","autopilot.editDialog.olderThanHelp":"Leave empty or 0 to apply rule immediately upon receipt.","autopilot.editDialog.performActions":"Then Perform Action(s)","autopilot.editDialog.actionsDesc":"Select one or more actions to execute when the rule matches","autopilot.editDialog.action.archive":"Archive Email","autopilot.editDialog.action.delete":"Delete Email","autopilot.editDialog.action.draft":"Draft Reply","autopilot.editDialog.action.star":"Star / Flag","autopilot.editDialog.draftInstructions":"Draft Instructions (Context)","autopilot.editDialog.draftInstPlaceholder":"e.g. Tell them I'm busy until Friday, but interested in the proposal.","autopilot.editDialog.draftInstHelp":"Specific context for the AI ghostwriter.","autopilot.editDialog.attachments":"Attachments (Optional)","autopilot.editDialog.uploading":"Uploading...","autopilot.editDialog.addAttachment":"Add Attachment","autopilot.editDialog.attachmentsHelp":"Files will be attached to every draft generated by this rule.","autopilot.onboarding.allSet":"All Set!","autopilot.onboarding.enabledDesc":"We've enabled {count} automation rules for you","autopilot.onboarding.rules":"rules","autopilot.onboarding.universalDesc":"Essential rules that help everyone stay organized","autopilot.onboarding.executiveDesc":"Focus on high-priority communications and strategic matters","autopilot.onboarding.developerDesc":"Surface critical alerts and filter tool noise","autopilot.onboarding.salesDesc":"Prioritize leads and customer communications","autopilot.onboarding.operationsDesc":"Organize tickets and internal communications","autopilot.onboarding.tip":"Tip: All rules are enabled by default, but you can customize or disable them anytime in the Auto-Pilot section.","autopilot.onboarding.start":"Start Using Email Automator →","autopilot.role.title":"One Last Step!","autopilot.role.subtitle":"What best describes your role? We'll set up the right automation rules for you.","autopilot.role.executive.label":"Executive / Leadership","autopilot.role.executive.desc":"Focus on VIPs, contracts, and strategic communications","autopilot.role.executive.preview":"VIP Client Prioritizer;Travel Organizer;Legal & Contracts","autopilot.role.sales.label":"Sales / Business Development","autopilot.role.sales.desc":"Prioritize leads and customer communications","autopilot.role.sales.preview":"Customer Questions;CRM Organizer;Proposal Tracker","autopilot.role.developer.label":"Developer / Engineer","autopilot.role.developer.desc":"Surface critical alerts and filter tool noise","autopilot.role.developer.preview":"System Alerts;Code Reviews;Project Management","autopilot.role.operations.label":"Operations / Support","autopilot.role.operations.desc":"Organize tickets and internal communications","autopilot.role.operations.preview":"Support Tickets;System Monitoring;Internal Comms","autopilot.role.marketing.label":"Marketing","autopilot.role.marketing.desc":"Track campaigns and customer engagement","autopilot.role.marketing.preview":"Campaign Tracking;Analytics Reports;Social Media","autopilot.role.other.label":"Other / Manual Setup","autopilot.role.other.desc":"I'll configure my own automation rules","autopilot.role.includes":"Includes:","autopilot.role.skip":"Skip for now","autopilot.role.settingUp":"Setting up...","autopilot.role.continue":"Continue →","terminal.title":"Agent Terminal","terminal.liveActivity":"Live Activity","terminal.syncing":"SYNCING","terminal.live":"LIVE","terminal.stopSync":"STOP SYNC","terminal.clear":"Clear","terminal.waiting":"Waiting for agent activity...","terminal.details":"Details","terminal.useless":"USELESS","terminal.relevant":"RELEVANT","terminal.executionComplete":"Execution Complete","terminal.batchFinished":"Batch Sync Finished","terminal.processed":"Processed","terminal.actions":"Actions","terminal.action.delete":"Moved to Trash","terminal.action.archive":"Archived Email","terminal.action.draft":"Drafted Reply","terminal.action.star":"Starred Email"},e4=Object.freeze(Object.defineProperty({__proto__:null,default:fS},Symbol.toStringTag,{value:"Module"})),mb={en:{name:"English",flag:"🇺🇸"},fr:{name:"Français",flag:"🇫🇷"},es:{name:"Español",flag:"🇪🇸"},ja:{name:"日本語",flag:"🇯🇵"},ko:{name:"한국어",flag:"🇰🇷"},vi:{name:"Tiếng Việt",flag:"🇻🇳"}},$c=fS,mS=S.createContext(void 0);function t4({children:n}){const[e,a]=S.useState(()=>localStorage.getItem("app_language")||"en"),[i,l]=S.useState(e==="en"?$c:{}),[d,h]=S.useState(e!=="en");S.useEffect(()=>{localStorage.setItem("app_language",e),document.documentElement.lang=e,(async()=>{if(e==="en"){l($c),h(!1);return}h(!0);try{const v=await Q5(Object.assign({"../locales/languages/en.json":()=>Pa(()=>Promise.resolve().then(()=>e4),void 0),"../locales/languages/es.json":()=>Pa(()=>import("./es-CGY9UNRq.js"),[]),"../locales/languages/fr.json":()=>Pa(()=>import("./fr-D8XVW7Gh.js"),[]),"../locales/languages/ja.json":()=>Pa(()=>import("./ja-t-yTTQOn.js"),[]),"../locales/languages/ko.json":()=>Pa(()=>import("./ko-DQmJ_ia_.js"),[]),"../locales/languages/vi.json":()=>Pa(()=>import("./vi-8Cvx3WlN.js"),[])}),`../locales/languages/${e}.json`,4);l(v.default)}catch(v){console.error(`Failed to load translations for ${e}:`,v),l($c)}finally{h(!1)}})()},[e]);const m=y=>{a(y)},p=y=>i[y]||$c[y]||y;return c.jsx(mS.Provider,{value:{language:e,setLanguage:m,t:p,isLoading:d},children:n})}function yt(){const n=S.useContext(mS);if(n===void 0)throw new Error("useLanguage must be used within a LanguageProvider");return n}function fp({className:n}){const{language:e,setLanguage:a}=yt(),[i,l]=S.useState(!1),d=S.useRef(null);S.useEffect(()=>{function m(p){d.current&&!d.current.contains(p.target)&&l(!1)}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const h=mb[e];return c.jsxs("div",{className:Se("relative z-50",n),ref:d,children:[c.jsxs("button",{onClick:()=>l(!i),className:Se("flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","bg-secondary/50 hover:bg-secondary border border-border/50 hover:border-border shadow-sm",i&&"ring-2 ring-primary/20 border-primary/50"),children:[c.jsx("span",{className:"text-lg leading-none",children:h.flag}),c.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",children:e}),c.jsx(Mb,{className:Se("w-3 h-3 transition-transform duration-200",i&&"rotate-180")})]}),i&&c.jsxs("div",{className:Se("absolute right-0 mt-2 w-48 rounded-xl border border-border bg-card p-1.5 shadow-xl animate-in fade-in zoom-in duration-200","backdrop-blur-xl"),children:[c.jsx("div",{className:"px-2 py-1.5 mb-1 text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:"Choose Language"}),Object.entries(mb).map(([m,{name:p,flag:y}])=>c.jsxs("button",{onClick:()=>{a(m),l(!1)},className:Se("flex items-center justify-between w-full px-3 py-2 rounded-lg text-sm transition-colors",e===m?"bg-primary/10 text-primary font-bold":"hover:bg-secondary text-muted-foreground hover:text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-lg leading-none",children:y}),c.jsx("span",{children:p})]}),e===m&&c.jsx(Ks,{className:"w-4 h-4"})]},m))]})]})}const gi="2.19.0",n4="20260131210000";function s4(n,e){const a=n.split(".").map(Number),i=e.split(".").map(Number);for(let l=0;l<Math.max(a.length,i.length);l++){const d=a[l]||0,h=i[l]||0;if(d>h)return 1;if(d<h)return-1}return 0}async function a4(n){try{const{data:e,error:a}=await n.rpc("get_latest_migration_timestamp");return a?a.code==="42883"?(console.info("[Migration Check] RPC function missing - assuming fresh DB."),{version:null,latestMigrationTimestamp:"0"}):(console.warn("Could not get latest migration timestamp:",a.message),{version:null,latestMigrationTimestamp:null}):{version:gi,latestMigrationTimestamp:e||null}}catch(e){return console.error("Error checking database migration info:",e),{version:null,latestMigrationTimestamp:null}}}async function mp(n){const e=gi,a=n4,i=await a4(n);if(console.log("[Migration Check]",{appVersion:e,appMigrationTimestamp:a,dbVersion:i.version,dbMigrationTimestamp:i.latestMigrationTimestamp}),i.latestMigrationTimestamp&&i.latestMigrationTimestamp.trim()!==""){const l=a,d=i.latestMigrationTimestamp;return l>d?{needsMigration:!0,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:d,message:`New migrations available. Database is at ${d}, app has ${l}.`}:l<d?(console.warn("[Migration Check] DB is ahead of app - possible downgrade"),{needsMigration:!1,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:d,message:`Database (${d}) is ahead of app (${l}).`}):(console.log("[Migration Check] Timestamps match - database is up-to-date"),{needsMigration:!1,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:d,message:"Database schema is up-to-date."})}if(i.version){console.log("[Migration Check] Legacy DB detected (no timestamp). Falling back to SemVer.");const l=s4(e,i.version);return l>0?{needsMigration:!0,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:null,message:`Database schema (v${i.version}) is outdated. Migration to v${e} required.`}:l===0?(console.warn("[Migration Check] Legacy DB with matching version - forcing migration to add timestamp tracking"),{needsMigration:!0,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:null,message:`Database lacks timestamp tracking. Please run migration to upgrade to modern schema (v${e}).`}):{needsMigration:!1,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:null,message:`Database version (v${i.version}) is ahead of app (v${e}).`}}return console.log("[Migration Check] No DB info found - assuming migration needed"),{needsMigration:!0,appVersion:e,dbVersion:null,latestMigrationTimestamp:null,message:`Database schema unknown. Migration required to v${e}.`}}const pS="email_automator_migration_reminder_dismissed_at";function r4(n=24){try{const e=localStorage.getItem(pS);if(!e)return!1;const a=new Date(e).getTime();return(Date.now()-a)/(1e3*60*60)<n}catch(e){return console.error("Error checking migration reminder:",e),!1}}function i4(){try{localStorage.setItem(pS,new Date().toISOString())}catch(n){console.error("Error dismissing migration reminder:",n)}}const wm={step:"welcome",managed:{accessToken:"",organizations:[],selectedOrg:"",projectName:"Email-Automator-AI",region:"us-east-1",isFetchingOrgs:!1},manual:{url:"",anonKey:""},projectId:"",logs:[],error:null,isMigrating:!1,migrationStatus:null};function o4(n,e){switch(e.type){case"SET_STEP":return{...n,step:e.payload,error:null};case"SET_ACCESS_TOKEN":return{...n,managed:{...n.managed,accessToken:e.payload}};case"SET_ORGANIZATIONS":return{...n,managed:{...n.managed,organizations:e.payload,selectedOrg:e.payload.length>0?e.payload[0].id:""}};case"SET_SELECTED_ORG":return{...n,managed:{...n.managed,selectedOrg:e.payload}};case"SET_PROJECT_NAME":return{...n,managed:{...n.managed,projectName:e.payload}};case"SET_REGION":return{...n,managed:{...n.managed,region:e.payload}};case"SET_FETCHING_ORGS":return{...n,managed:{...n.managed,isFetchingOrgs:e.payload}};case"SET_MANUAL_URL":return{...n,manual:{...n.manual,url:e.payload}};case"SET_MANUAL_ANON_KEY":return{...n,manual:{...n.manual,anonKey:e.payload}};case"SET_PROJECT_ID":return{...n,projectId:e.payload};case"ADD_LOG":return{...n,logs:[...n.logs,{...e.payload,timestamp:Date.now()}].slice(-500)};case"CLEAR_LOGS":return{...n,logs:[]};case"SET_ERROR":return{...n,error:e.payload};case"SET_MIGRATING":return{...n,isMigrating:e.payload};case"SET_MIGRATION_STATUS":return{...n,migrationStatus:e.payload};case"RESET_MANAGED_FLOW":return{...n,managed:{...wm.managed},error:null};case"RESET_MANUAL_FLOW":return{...n,manual:{...wm.manual},error:null};default:return n}}function Af(n){const e=n.trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}.supabase.co`:""}function gS(n){const e=n.trim();return e?e.startsWith("sbp_")?e.length<20?{valid:!1,message:"Token is too short"}:{valid:!0,message:"Valid access token"}:{valid:!1,message:"Token must start with sbp_"}:{valid:!1,message:"Access token is required"}}function pb(n){const e=n.trim();if(!e)return null;if(!e.includes(".")&&!e.includes("/"))return e;try{return new URL(e.startsWith("http")?e:`https://${e}`).hostname.split(".")[0]||null}catch{return null}}class l4{buffer="";processChunk(e){const a=[];this.buffer+=e;const i=this.buffer.split(`
60
- `);this.buffer=i.pop()||"";for(const l of i)if(l.startsWith("data: "))try{const d=l.slice(6),h=JSON.parse(d);a.push(h)}catch(d){console.warn("[SSEParser] Failed to parse event:",l,d)}return a}flush(){if(!this.buffer.trim())return[];const e=[];if(this.buffer.startsWith("data: "))try{const a=this.buffer.slice(6),i=JSON.parse(a);e.push(i)}catch(a){console.warn("[SSEParser] Failed to parse final buffer:",this.buffer,a)}return this.buffer="",e}reset(){this.buffer=""}}async function yS(n,e,a={}){const{timeout:i=3e5,onError:l}=a;if(!n.body)throw new Error("Response body is empty");const d=n.body.getReader(),h=new TextDecoder,m=new l4,p=setTimeout(()=>{d.cancel("Timeout")},i);try{for(;;){const{value:y,done:v}=await d.read();if(v){m.flush().forEach(e);break}const x=h.decode(y,{stream:!0});m.processChunk(x).forEach(e)}}catch(y){const v=y instanceof Error?y:new Error(String(y));if(l)l(v);else throw v}finally{clearTimeout(p),m.reset()}}class ta extends Error{constructor(e,a,i){super(e),this.code=a,this.status=i,this.name="SetupApiError"}}async function c4(n){const e=await fetch("/api/setup/organizations",{headers:{Authorization:`Bearer ${n}`}}),a=await e.json();if(!e.ok)throw new ta(a.error||"Failed to fetch organizations","FETCH_ORGS_FAILED",e.status);return a}async function u4(n,e){const a=await fetch("/api/setup/auto-provision",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.accessToken}`},body:JSON.stringify({orgId:n.orgId,projectName:n.projectName,region:n.region})});if(!a.ok){const i=await a.json().catch(()=>({}));throw new ta(i.error||"Failed to provision project","PROVISION_FAILED",a.status)}await yS(a,e,{timeout:3e5,onError:i=>{throw new ta(`Provisioning stream error: ${i.message}`,"STREAM_ERROR")}})}async function d4(n,e){const a=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:n.projectRef,dbPassword:n.dbPassword,accessToken:n.accessToken})});if(!a.ok){const i=await a.json().catch(()=>({}));throw new ta(i.error||"Failed to start migration","MIGRATION_FAILED",a.status)}await yS(a,e,{timeout:6e5,onError:i=>{throw new ta(`Migration stream error: ${i.message}`,"STREAM_ERROR")}})}function h4({onNext:n}){const{t:e}=yt();return c.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-8",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("h2",{className:"text-4xl font-black italic tracking-tighter uppercase leading-none",children:e("setup.welcomeTitle")}),c.jsx("p",{className:"text-sm text-muted-foreground font-medium max-w-sm",children:e("setup.welcomeSubtitle")})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"p-4 rounded-2xl bg-muted/40 border border-border/50 flex flex-col gap-2 group hover:bg-primary/5 hover:border-primary/20 transition-all",children:[c.jsx(Shield,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),c.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest",children:e("setup.encryptedTitle")}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:e("setup.encryptedDesc")})]}),c.jsxs("div",{className:"p-4 rounded-2xl bg-muted/40 border border-border/50 flex flex-col gap-2 group hover:bg-primary/5 hover:border-primary/20 transition-all",children:[c.jsx(Zap,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),c.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest",children:e("setup.turboTitle")}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:e("setup.turboDesc")})]})]}),c.jsxs(ee,{onClick:n,size:"lg",className:"h-14 rounded-2xl text-md font-bold uppercase tracking-widest group shadow-xl hover:shadow-primary/20 transition-all active:scale-95 bg-primary text-primary-foreground hover:bg-primary/90",children:[e("setup.getStarted"),c.jsx(ArrowLeft,{className:"w-5 h-5 ml-4 rotate-180 group-hover:translate-x-1 transition-transform","aria-hidden":"true"})]})]})}function f4({onManaged:n,onManual:e,onBack:a}){const{t:i}=yt();return c.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:i("setup.connectionMode")}),c.jsx("p",{className:"text-xs text-muted-foreground font-bold tracking-widest uppercase",children:i("setup.selectVector")})]}),c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("button",{onClick:n,className:"group relative flex items-center justify-between p-6 rounded-2xl bg-primary/5 border border-primary/20 hover:bg-primary/10 hover:border-primary/40 transition-all text-left","aria-label":"Quick Ignition - Auto-provision via token",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"p-3 bg-primary rounded-xl shadow-lg ring-4 ring-primary/10",children:c.jsx(VT,{className:"w-6 h-6 text-primary-foreground","aria-hidden":"true"})}),c.jsxs("div",{children:[c.jsx("p",{className:"font-black uppercase italic text-sm tracking-tight",children:i("setup.quickIgnition")}),c.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:i("setup.autoProvision")})]})]}),c.jsx(au,{className:"w-5 h-5 text-primary opacity-50 group-hover:opacity-100 transition-all group-hover:translate-x-1"})]}),c.jsxs("button",{onClick:e,className:"group relative flex items-center justify-between p-6 rounded-2xl border border-border hover:bg-muted/50 transition-all text-left","aria-label":"Manual Sync - Use existing credentials",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"p-3 bg-muted rounded-xl",children:c.jsx(Su,{className:"w-6 h-6 text-muted-foreground","aria-hidden":"true"})}),c.jsxs("div",{children:[c.jsx("p",{className:"font-black uppercase italic text-sm tracking-tight text-foreground/80",children:i("setup.manualSync")}),c.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:i("setup.existingCredentials")})]})]}),c.jsx(au,{className:"w-5 h-5 text-muted-foreground opacity-50 group-hover:opacity-100 transition-all group-hover:translate-x-1"})]})]}),c.jsxs("button",{onClick:a,className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground flex items-center gap-2 hover:text-primary pt-4 transition-colors","aria-label":"Go back to welcome screen",children:[c.jsx(Ob,{size:12,"aria-hidden":"true"})," ",i("setup.abortAccess")]})]})}const Ae=S.forwardRef(({className:n,type:e,...a},i)=>c.jsx("input",{type:e,className:Se("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:i,...a}));Ae.displayName="Input";var vS=Cb();const m4=jm(vS);var p4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],g4=p4.reduce((n,e)=>{const a=Hb(`Primitive.${e}`),i=S.forwardRef((l,d)=>{const{asChild:h,...m}=l,p=h?a:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(p,{...m,ref:d})});return i.displayName=`Primitive.${e}`,{...n,[e]:i}},{}),y4="Label",xS=S.forwardRef((n,e)=>c.jsx(g4.label,{...n,ref:e,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(n.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));xS.displayName=y4;var v4=xS;function Ht({className:n,...e}){return c.jsx(v4,{"data-slot":"label",className:Se("flex items-center gap-2 text-sm leading-none font-medium select-none text-muted-foreground group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...e})}const x4=Kb("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 er({className:n,variant:e,...a}){return c.jsx("div",{"data-slot":"alert",role:"alert",className:Se(x4({variant:e}),n),...a})}function tr({className:n,...e}){return c.jsx("div",{"data-slot":"alert-description",className:Se("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",n),...e})}function b4({accessToken:n,error:e,isFetching:a,onTokenChange:i,onFetchOrgs:l,onBack:d}){const m=gS(n).valid;return c.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Forge Token"}),c.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Supabase API coordinates"})]}),e&&c.jsxs(er,{variant:"destructive",className:"rounded-xl bg-destructive/5 text-destructive border-destructive/20 text-[11px] font-bold",children:[c.jsx(Fn,{className:"h-4 w-4"}),c.jsx(tr,{children:e})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ht,{htmlFor:"access-token",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Personal Access Token"}),c.jsxs("div",{className:"relative",children:[c.jsx(Am,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:14,"aria-hidden":"true"}),c.jsx(Ae,{id:"access-token",type:"password",placeholder:"sbp_xxxxxxxxxxxxxxxx",value:n,onChange:p=>i(p.target.value),className:"pl-10 h-12 bg-muted/20 border-border/50 rounded-xl","aria-describedby":"token-help","aria-invalid":e?"true":"false"})]}),c.jsxs("p",{id:"token-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:["Generate at"," ",c.jsx("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"supabase.com/dashboard/tokens"})]})]}),c.jsxs("div",{className:"flex gap-3 pt-4",children:[c.jsx(ee,{variant:"outline",onClick:d,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",disabled:a,children:"Back"}),c.jsx(ee,{onClick:l,disabled:!m||a,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest group shadow-lg hover:shadow-primary/20",children:a?c.jsx(Lt,{className:"w-4 h-4 animate-spin"}):c.jsxs(c.Fragment,{children:["Scan Organizations"," ",c.jsx(au,{size:14,className:"ml-2 group-hover:translate-x-1 transition-transform"})]})})]})]})]})}function w4({organizations:n,selectedOrg:e,projectName:a,region:i,onOrgSelect:l,onProjectNameChange:d,onRegionChange:h,onProvision:m,onBack:p}){return c.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Project Config"}),c.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Engine parameters"})]}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Ht,{htmlFor:"project-name",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Project Name"}),c.jsx(Ae,{id:"project-name",value:a,onChange:y=>d(y.target.value),className:"bg-muted/20 border-border/50 rounded-xl text-[11px]"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Ht,{htmlFor:"region",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Hosting Sector"}),c.jsxs("select",{id:"region",value:i,onChange:y=>h(y.target.value),className:"w-full h-10 bg-muted/20 border border-border/50 rounded-xl px-3 text-[11px] font-sans focus:outline-none focus:ring-1 focus:ring-primary/50",children:[c.jsx("option",{value:"us-east-1",children:"US East (N. Virginia)"}),c.jsx("option",{value:"us-west-1",children:"US West (N. California)"}),c.jsx("option",{value:"eu-central-1",children:"Europe (Frankfurt)"}),c.jsx("option",{value:"ap-southeast-1",children:"Asia Pacific (Singapore)"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ht,{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Vessel (Organization)"}),c.jsx("div",{className:"max-h-[160px] overflow-y-auto space-y-2 pr-1 custom-scrollbar",role:"radiogroup","aria-label":"Select organization",children:n.map(y=>c.jsxs("button",{onClick:()=>l(y.id),role:"radio","aria-checked":e===y.id,className:Se("w-full flex items-center justify-between p-3 rounded-xl border text-[11px] font-bold transition-all",e===y.id?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/30 border-border/50"),children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(mT,{className:Se("w-3.5 h-3.5",e===y.id?"text-primary":"text-muted-foreground/50"),"aria-hidden":"true"}),c.jsx("span",{children:y.name})]}),e===y.id&&c.jsx("div",{className:"w-2 h-2 rounded-full bg-primary animate-pulse","aria-hidden":"true"})]},y.id))})]}),c.jsxs("div",{className:"flex gap-3 pt-2",children:[c.jsx(ee,{variant:"outline",onClick:p,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Back"}),c.jsx(ee,{onClick:m,disabled:!e,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest shadow-md",children:"Initialize System"})]})]})]})}function bS({logs:n,className:e}){const a=S.useRef(null);return S.useEffect(()=>{a.current?.scrollIntoView({behavior:"smooth"})},[n]),c.jsxs("div",{className:Se("bg-slate-950 rounded-2xl p-4 font-mono text-[10px] h-[240px] overflow-y-auto border border-white/5 shadow-inner custom-scrollbar relative",e),role:"log","aria-live":"polite","aria-label":"Setup progress logs",children:[c.jsxs("div",{className:"absolute top-2 right-4 flex items-center gap-2 text-[9px] font-bold text-muted-foreground/30 uppercase tracking-widest pointer-events-none",children:[c.jsx(iu,{size:10,"aria-hidden":"true"}),c.jsx("span",{children:"Live Feed"})]}),n.length===0?c.jsx("div",{className:"text-slate-600 italic animate-pulse",role:"status",children:"Awaiting kernel signals..."}):c.jsxs(c.Fragment,{children:[n.map((i,l)=>c.jsxs("div",{className:Se("mb-1 break-all transition-all duration-300",i.type==="error"&&"text-red-400 font-bold",i.type==="success"&&"text-green-400 font-bold",i.type==="info"&&"text-blue-300",i.type==="stdout"&&"text-slate-400",i.type==="stderr"&&"text-yellow-400"),children:[c.jsxs("span",{className:"text-slate-600 mr-2 tabular-nums",children:["[",new Date(i.timestamp).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),"]"]}),i.message]},`${i.timestamp}-${l}`)),c.jsx("div",{ref:a})]})]})}function S4({logs:n,error:e,onRetry:a}){return c.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Lt,{className:"w-5 h-5 animate-spin text-primary","aria-hidden":"true"}),c.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Provisioning"})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Assembling infrastructure..."})]}),c.jsx(bS,{logs:n}),e&&c.jsx(ee,{variant:"destructive",onClick:a,className:"w-full h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Re-Initialize Engine"})]})}function _4({url:n,anonKey:e,error:a,onUrlChange:i,onAnonKeyChange:l,onSave:d,onBack:h}){const{t:m}=yt(),p=n.trim().length>0&&e.trim().length>0;return c.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:m("setup.manualSync")}),c.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:m("setup.injectCoordinates")})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Ht,{htmlFor:"platform-url",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:m("setup.platformUrl")}),c.jsx(Input,{id:"platform-url",placeholder:"https://xyz.supabase.co",value:n,onChange:y=>i(y.target.value),className:"bg-muted/20 border-border/50 rounded-xl h-12","aria-describedby":"url-help","aria-invalid":a?"true":"false"}),c.jsx("p",{id:"url-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:m("setup.urlHelp")})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Ht,{htmlFor:"anon-key",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:m("setup.anonMatrixKey")}),c.jsx(Input,{id:"anon-key",type:"password",placeholder:"eyJ...",value:e,onChange:y=>l(y.target.value),className:"bg-muted/20 border-border/50 rounded-xl h-12","aria-describedby":"key-help","aria-invalid":a?"true":"false"}),c.jsx("p",{id:"key-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:m("setup.keyHelp")})]})]}),a&&c.jsxs(motion.div,{initial:{y:5,opacity:0},animate:{y:0,opacity:1},className:"p-3 bg-destructive/5 border border-destructive/20 text-destructive text-[11px] font-bold rounded-xl flex items-center gap-2",role:"alert",children:[c.jsx(AlertCircle,{size:14,"aria-hidden":"true"}),c.jsx("span",{children:a})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-4",children:[c.jsx(Button,{variant:"outline",onClick:h,className:"h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:m("setup.back")}),c.jsx(Button,{onClick:d,disabled:!p,className:"h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest bg-primary shadow-lg hover:shadow-primary/20",children:m("setup.engage")})]})]})}function j4({logs:n,error:e,isMigrating:a,migrationStatus:i,accessToken:l,onTokenChange:d,onRunMigration:h,onBypass:m}){const p=!l,y=i?.dbVersion!==null&&!i?.isUnknown,v=i?.dbVersion===null||i?.isUnknown;return c.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[a?c.jsx(Lt,{className:"w-5 h-5 animate-spin text-primary","aria-hidden":"true"}):c.jsx(ME,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),c.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Installation"})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Applying schema DNA..."})]}),c.jsx(bS,{logs:n}),!a&&c.jsxs(Xs.div,{initial:{y:10,opacity:0},animate:{y:0,opacity:1},className:"p-5 bg-primary/5 rounded-2xl space-y-4 border border-primary/20",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed font-medium",children:v?"Empty project detected. Initialization is mandatory to install core AI systems.":`Version mismatch detected (v${i?.dbVersion||"?.?"} → v${i?.appVersion||gi}). Normalization is recommended.`}),p&&c.jsxs("div",{className:"space-y-2 pt-2 border-t border-primary/10",children:[c.jsx(Ht,{htmlFor:"migration-token",className:"text-[10px] font-bold uppercase tracking-widest text-primary/60",children:"Management Token Required"}),c.jsxs("div",{className:"relative",children:[c.jsx(Am,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-primary/30",size:12,"aria-hidden":"true"}),c.jsx(Ae,{id:"migration-token",type:"password",placeholder:"sbp_xxxxxxxxxxxxxxxx",value:l,onChange:x=>d(x.target.value),className:"pl-9 h-10 bg-background/50 border-primary/20 rounded-xl text-[11px]","aria-describedby":"migration-token-help"})]}),c.jsxs("p",{id:"migration-token-help",className:"text-[9px] text-muted-foreground/60 italic px-1",children:["Used once to run ",c.jsx("code",{className:"text-primary/70",children:"migrate.sh"})," on your backend."]})]})]}),c.jsxs("div",{className:"flex gap-3",children:[y&&c.jsx(ee,{variant:"ghost",onClick:m,className:"flex-1 h-11 text-[10px] font-bold uppercase tracking-widest opacity-60 hover:opacity-100","aria-label":"Skip migration (risky)",children:"Bypass (Risk)"}),c.jsx(ee,{onClick:h,disabled:p,className:"flex-1 h-11 bg-primary text-[10px] font-bold uppercase tracking-widest shadow-lg hover:shadow-primary/30",children:v?"Install Systems":"Normalize System"})]})]}),e&&c.jsxs("div",{className:"space-y-3",children:[c.jsxs(er,{variant:"destructive",className:"rounded-xl border-destructive/20 bg-destructive/5 text-destructive font-bold text-[11px]",children:[c.jsx(Fn,{className:"h-4 w-4"}),c.jsx(tr,{children:e})]}),c.jsx(ee,{variant:"outline",onClick:h,className:"w-full h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Retry Installation"})]})]})}function Hc({step:n,currentStep:e,label:a}){const i=Array.isArray(n)?n.includes(e):e===n;return c.jsx("div",{className:Se("px-3 py-1.5 rounded-full text-[9px] font-black uppercase tracking-[0.2em] transition-all duration-500",i?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground opacity-40"),role:"status","aria-current":i,children:a})}function pp({className:n}){return c.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Se("w-9 h-9",n),children:[c.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",stroke:"currentColor",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M64 160 L240 290 C250 295 262 295 272 290 L448 160",stroke:"currentColor",strokeWidth:"28",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M256 160 C256 160 270 190 290 195 C270 200 256 230 256 230 C256 230 242 200 222 195 C242 190 256 160 256 160 Z",fill:"currentColor",className:"opacity-50"})]})}function wS({onComplete:n,open:e=!0,canClose:a=!1}){const[i,l]=S.useReducer(o4,wm),{t:d}=yt(),h=S.useRef(""),m=S.useRef("");S.useEffect(()=>()=>{h.current="",m.current=""},[]);const p=S.useCallback((_,T)=>{l({type:"ADD_LOG",payload:{type:_,message:T}})},[]),y=S.useCallback(async()=>{l({type:"SET_ERROR",payload:null}),l({type:"SET_FETCHING_ORGS",payload:!0});const _=i.managed.accessToken.trim(),T=gS(_);if(!T.valid){l({type:"SET_ERROR",payload:T.message||"Invalid token"}),l({type:"SET_FETCHING_ORGS",payload:!1});return}try{h.current=_;const N=await c4(_);l({type:"SET_ORGANIZATIONS",payload:N}),l({type:"SET_STEP",payload:"managed-org"})}catch(N){const A=N instanceof ta?N:new Error(String(N));l({type:"SET_ERROR",payload:A.message})}finally{l({type:"SET_FETCHING_ORGS",payload:!1})}},[i.managed.accessToken]),v=S.useCallback(async()=>{l({type:"SET_ERROR",payload:null}),l({type:"SET_STEP",payload:"provisioning"}),l({type:"CLEAR_LOGS"}),p("info","Connecting to Supabase provisioning engine...");const _=h.current||i.managed.accessToken.trim();let T=null;try{if(await u4({accessToken:_,orgId:i.managed.selectedOrg,projectName:i.managed.projectName,region:i.managed.region},N=>{switch(N.type){case"info":p("info",N.data);break;case"project_id":l({type:"SET_PROJECT_ID",payload:N.data});break;case"success":T=N.data,p("success","✨ Project ready! Initializing database..."),df({url:Af(T.url),anonKey:T.anonKey.trim()}),m.current=T.dbPass,l({type:"SET_MIGRATION_STATUS",payload:{needsMigration:!0,dbVersion:null,appVersion:gi,isUnknown:!0}});break;case"error":l({type:"SET_ERROR",payload:N.data}),p("error",N.data);break}}),T){const N=T;await x(N.projectId,_,N.url,N.anonKey)}}catch(N){const A=N instanceof ta?N:new Error(String(N));l({type:"SET_ERROR",payload:A.message}),p("error",`Provisioning failed: ${A.message}`)}},[i.managed.selectedOrg,i.managed.projectName,i.managed.region,i.managed.accessToken,p]),x=S.useCallback(async(_,T,N,A)=>{const M=_||i.projectId||pb(i.manual.url),k=T||h.current||i.managed.accessToken.trim(),U=N||i.manual.url,F=A||i.manual.anonKey;if(!M||!k){l({type:"SET_ERROR",payload:"Project ID and Access Token are required for migration."});return}l({type:"SET_STEP",payload:"migration"}),l({type:"SET_ERROR",payload:null}),l({type:"SET_MIGRATING",payload:!0}),l({type:"CLEAR_LOGS"}),p("info","📦 Preparing database schema initialization...");try{let K=!1;if(await d4({projectRef:M,dbPassword:m.current,accessToken:k},P=>{switch(P.type){case"stdout":p("stdout",P.data);break;case"stderr":p("stderr",`⚠️ ${P.data}`);break;case"info":p("info",P.data);break;case"error":p("error",P.data);break;case"done":P.data==="success"?(K=!0,p("success","✅ Database setup complete!"),U&&F&&df({url:Af(U),anonKey:F.trim()}),h.current="",m.current="",setTimeout(()=>{n(),window.location.reload()},2e3)):l({type:"SET_ERROR",payload:"Migration failed. Check terminal logs for details."});break}}),!K)throw new Error("Migration did not complete successfully")}catch(K){const P=K instanceof ta?K:new Error(String(K));l({type:"SET_ERROR",payload:P.message}),p("error",`Migration failed: ${P.message}`)}finally{l({type:"SET_MIGRATING",payload:!1})}},[i.projectId,i.manual.url,i.manual.anonKey,i.managed.accessToken,p,n]),w=S.useCallback(async()=>{l({type:"SET_ERROR",payload:null}),l({type:"SET_STEP",payload:"validating"});const _=Af(i.manual.url),T=i.manual.anonKey.trim(),N=await Wk(_,T);if(N.valid){l({type:"SET_MANUAL_URL",payload:_});const A=pb(_);A&&l({type:"SET_PROJECT_ID",payload:A}),df({url:_,anonKey:T});try{const M=Xf(_,T),k=await mp(M);l({type:"SET_MIGRATION_STATUS",payload:k}),k.needsMigration?l({type:"SET_STEP",payload:"migration"}):(p("success","✨ Database is already up-to-date! Redirecting..."),setTimeout(()=>{n(),window.location.reload()},2e3))}catch(M){console.warn("[SetupWizard] Migration check failed:",M),l({type:"SET_MIGRATION_STATUS",payload:{needsMigration:!0,dbVersion:null,appVersion:gi,isUnknown:!0}}),l({type:"SET_STEP",payload:"migration"})}}else l({type:"SET_ERROR",payload:N.error||"Connection failed"}),l({type:"SET_STEP",payload:"credentials"})},[i.manual.url,i.manual.anonKey,p,n]);if(!e)return null;const j={initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20}};return c.jsx("div",{className:"fixed inset-0 z-50 bg-background flex flex-col items-center justify-center p-0 md:p-8",children:c.jsxs("div",{className:"w-full h-full max-w-6xl mx-auto overflow-hidden bg-background/80 backdrop-blur-xl border border-border/50 shadow-2xl rounded-3xl flex",children:[c.jsxs("div",{className:"w-[280px] bg-muted/30 border-r border-border/10 p-8 flex flex-col justify-between relative overflow-hidden hidden md:flex shrink-0",children:[c.jsxs("div",{className:"space-y-8 relative z-10",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[c.jsx("div",{className:"p-2 bg-primary rounded-lg flex-shrink-0",children:c.jsx(pp,{className:"w-5 h-5 text-primary-foreground"})}),c.jsx("span",{className:"font-black italic tracking-tighter uppercase text-xs truncate",children:"Automator Forge"})]}),c.jsxs("div",{className:"space-y-6",children:[c.jsx("p",{className:"text-[9px] font-black uppercase tracking-[0.4em] text-muted-foreground/30 ml-1",children:"Assembly Phase"}),c.jsxs("div",{className:"space-y-4 px-1",children:[c.jsx(Hc,{step:"welcome",currentStep:i.step,label:d("setup.initiation")}),c.jsx(Hc,{step:["type","managed-token","credentials"],currentStep:i.step,label:d("setup.coordinates")}),c.jsx(Hc,{step:["managed-org","provisioning","validating"],currentStep:i.step,label:d("setup.foundation")}),c.jsx(Hc,{step:"migration",currentStep:i.step,label:d("setup.ignition")})]})]})]}),c.jsx("div",{className:"relative z-10 space-y-4",children:c.jsxs("p",{className:"text-[9px] font-bold text-muted-foreground/30 uppercase tracking-[0.4em] px-2 text-center",children:["v",gi," // Stable Build"]})})]}),c.jsxs("div",{className:"flex-1 p-8 md:p-12 flex flex-col relative",children:[a&&c.jsx("button",{onClick:n,className:"absolute top-6 right-6 p-2 rounded-full hover:bg-secondary transition-colors z-[60]","aria-label":"Close setup wizard",children:c.jsx(ra,{className:"w-5 h-5 text-muted-foreground opacity-40 hover:opacity-100 transition-opacity"})}),c.jsx("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:c.jsx(fp,{})}),c.jsx(eS,{mode:"wait",children:c.jsxs(Xs.div,{initial:"initial",animate:"animate",exit:"exit",variants:j,transition:{type:"spring",damping:25,stiffness:200},className:"flex-1 flex flex-col",children:[i.step==="welcome"&&c.jsx(h4,{onNext:()=>l({type:"SET_STEP",payload:"type"})}),i.step==="type"&&c.jsx(f4,{onManaged:()=>{l({type:"RESET_MANUAL_FLOW"}),l({type:"SET_STEP",payload:"managed-token"})},onManual:()=>{l({type:"RESET_MANAGED_FLOW"}),l({type:"SET_STEP",payload:"credentials"})},onBack:()=>l({type:"SET_STEP",payload:"welcome"})}),i.step==="managed-token"&&c.jsx(b4,{accessToken:i.managed.accessToken,error:i.error,isFetching:i.managed.isFetchingOrgs,onTokenChange:_=>l({type:"SET_ACCESS_TOKEN",payload:_}),onFetchOrgs:y,onBack:()=>l({type:"SET_STEP",payload:"type"})}),i.step==="managed-org"&&c.jsx(w4,{organizations:i.managed.organizations,selectedOrg:i.managed.selectedOrg,projectName:i.managed.projectName,region:i.managed.region,onOrgSelect:_=>l({type:"SET_SELECTED_ORG",payload:_}),onProjectNameChange:_=>l({type:"SET_PROJECT_NAME",payload:_}),onRegionChange:_=>l({type:"SET_REGION",payload:_}),onProvision:v,onBack:()=>l({type:"SET_STEP",payload:"managed-token"})}),i.step==="provisioning"&&c.jsx(S4,{logs:i.logs,error:i.error,onRetry:()=>l({type:"SET_STEP",payload:"managed-token"})}),i.step==="credentials"&&c.jsx(_4,{url:i.manual.url,anonKey:i.manual.anonKey,error:i.error,onUrlChange:_=>l({type:"SET_MANUAL_URL",payload:_}),onAnonKeyChange:_=>l({type:"SET_MANUAL_ANON_KEY",payload:_}),onSave:w,onBack:()=>l({type:"SET_STEP",payload:"type"})}),i.step==="migration"&&c.jsx(j4,{logs:i.logs,error:i.error,isMigrating:i.isMigrating,migrationStatus:i.migrationStatus,accessToken:i.managed.accessToken,onTokenChange:_=>l({type:"SET_ACCESS_TOKEN",payload:_}),onRunMigration:()=>x(),onBypass:()=>{n(),window.location.reload()}})]},i.step)})]})]})})}function na(n,e,{checkForDefaultPrevented:a=!0}={}){return function(l){if(n?.(l),a===!1||!l.defaultPrevented)return e?.(l)}}function E4(n,e){const a=S.createContext(e),i=d=>{const{children:h,...m}=d,p=S.useMemo(()=>m,Object.values(m));return c.jsx(a.Provider,{value:p,children:h})};i.displayName=n+"Provider";function l(d){const h=S.useContext(a);if(h)return h;if(e!==void 0)return e;throw new Error(`\`${d}\` must be used within \`${n}\``)}return[i,l]}function T4(n,e=[]){let a=[];function i(d,h){const m=S.createContext(h),p=a.length;a=[...a,h];const y=x=>{const{scope:w,children:j,..._}=x,T=w?.[n]?.[p]||m,N=S.useMemo(()=>_,Object.values(_));return c.jsx(T.Provider,{value:N,children:j})};y.displayName=d+"Provider";function v(x,w){const j=w?.[n]?.[p]||m,_=S.useContext(j);if(_)return _;if(h!==void 0)return h;throw new Error(`\`${x}\` must be used within \`${d}\``)}return[y,v]}const l=()=>{const d=a.map(h=>S.createContext(h));return function(m){const p=m?.[n]||d;return S.useMemo(()=>({[`__scope${n}`]:{...m,[n]:p}}),[m,p])}};return l.scopeName=n,[i,N4(l,...e)]}function N4(...n){const e=n[0];if(n.length===1)return e;const a=()=>{const i=n.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(d){const h=i.reduce((m,{useScope:p,scopeName:y})=>{const x=p(d)[`__scope${y}`];return{...m,...x}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:h}),[h])}};return a.scopeName=e.scopeName,a}var el=globalThis?.document?S.useLayoutEffect:()=>{},A4=Tm[" useId ".trim().toString()]||(()=>{}),k4=0;function kf(n){const[e,a]=S.useState(A4());return el(()=>{a(i=>i??String(k4++))},[n]),n||(e?`radix-${e}`:"")}var C4=Tm[" useInsertionEffect ".trim().toString()]||el;function R4({prop:n,defaultProp:e,onChange:a=()=>{},caller:i}){const[l,d,h]=O4({defaultProp:e,onChange:a}),m=n!==void 0,p=m?n:l;{const v=S.useRef(n!==void 0);S.useEffect(()=>{const x=v.current;x!==m&&console.warn(`${i} is changing from ${x?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=m},[m,i])}const y=S.useCallback(v=>{if(m){const x=D4(v)?v(n):v;x!==n&&h.current?.(x)}else d(v)},[m,n,d,h]);return[p,y]}function O4({defaultProp:n,onChange:e}){const[a,i]=S.useState(n),l=S.useRef(a),d=S.useRef(e);return C4(()=>{d.current=e},[e]),S.useEffect(()=>{l.current!==a&&(d.current?.(a),l.current=a)},[a,l]),[a,i,d]}function D4(n){return typeof n=="function"}function M4(n){const e=z4(n),a=S.forwardRef((i,l)=>{const{children:d,...h}=i,m=S.Children.toArray(d),p=m.find(U4);if(p){const y=p.props.children,v=m.map(x=>x===p?S.Children.count(y)>1?S.Children.only(null):S.isValidElement(y)?y.props.children:null:x);return c.jsx(e,{...h,ref:l,children:S.isValidElement(y)?S.cloneElement(y,void 0,v):null})}return c.jsx(e,{...h,ref:l,children:d})});return a.displayName=`${n}.Slot`,a}function z4(n){const e=S.forwardRef((a,i)=>{const{children:l,...d}=a;if(S.isValidElement(l)){const h=V4(l),m=P4(d,l.props);return l.type!==S.Fragment&&(m.ref=i?ju(i,h):h),S.cloneElement(l,m)}return S.Children.count(l)>1?S.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var L4=Symbol("radix.slottable");function U4(n){return S.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===L4}function P4(n,e){const a={...e};for(const i in e){const l=n[i],d=e[i];/^on[A-Z]/.test(i)?l&&d?a[i]=(...m)=>{const p=d(...m);return l(...m),p}:l&&(a[i]=l):i==="style"?a[i]={...l,...d}:i==="className"&&(a[i]=[l,d].filter(Boolean).join(" "))}return{...n,...a}}function V4(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,a=e&&"isReactWarning"in e&&e.isReactWarning;return a?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,a=e&&"isReactWarning"in e&&e.isReactWarning,a?n.props.ref:n.props.ref||n.ref)}var B4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xs=B4.reduce((n,e)=>{const a=M4(`Primitive.${e}`),i=S.forwardRef((l,d)=>{const{asChild:h,...m}=l,p=h?a:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(p,{...m,ref:d})});return i.displayName=`Primitive.${e}`,{...n,[e]:i}},{});function I4(n,e){n&&vS.flushSync(()=>n.dispatchEvent(e))}function tl(n){const e=S.useRef(n);return S.useEffect(()=>{e.current=n}),S.useMemo(()=>(...a)=>e.current?.(...a),[])}function q4(n,e=globalThis?.document){const a=tl(n);S.useEffect(()=>{const i=l=>{l.key==="Escape"&&a(l)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[a,e])}var $4="DismissableLayer",Sm="dismissableLayer.update",H4="dismissableLayer.pointerDownOutside",G4="dismissableLayer.focusOutside",gb,SS=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_S=S.forwardRef((n,e)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...p}=n,y=S.useContext(SS),[v,x]=S.useState(null),w=v?.ownerDocument??globalThis?.document,[,j]=S.useState({}),_=sr(e,P=>x(P)),T=Array.from(y.layers),[N]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),A=T.indexOf(N),M=v?T.indexOf(v):-1,k=y.layersWithOutsidePointerEventsDisabled.size>0,U=M>=A,F=Y4(P=>{const z=P.target,Z=[...y.branches].some(ie=>ie.contains(z));!U||Z||(l?.(P),h?.(P),P.defaultPrevented||m?.())},w),K=X4(P=>{const z=P.target;[...y.branches].some(ie=>ie.contains(z))||(d?.(P),h?.(P),P.defaultPrevented||m?.())},w);return q4(P=>{M===y.layers.size-1&&(i?.(P),!P.defaultPrevented&&m&&(P.preventDefault(),m()))},w),S.useEffect(()=>{if(v)return a&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(gb=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(v)),y.layers.add(v),yb(),()=>{a&&y.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=gb)}},[v,w,a,y]),S.useEffect(()=>()=>{v&&(y.layers.delete(v),y.layersWithOutsidePointerEventsDisabled.delete(v),yb())},[v,y]),S.useEffect(()=>{const P=()=>j({});return document.addEventListener(Sm,P),()=>document.removeEventListener(Sm,P)},[]),c.jsx(xs.div,{...p,ref:_,style:{pointerEvents:k?U?"auto":"none":void 0,...n.style},onFocusCapture:na(n.onFocusCapture,K.onFocusCapture),onBlurCapture:na(n.onBlurCapture,K.onBlurCapture),onPointerDownCapture:na(n.onPointerDownCapture,F.onPointerDownCapture)})});_S.displayName=$4;var F4="DismissableLayerBranch",K4=S.forwardRef((n,e)=>{const a=S.useContext(SS),i=S.useRef(null),l=sr(e,i);return S.useEffect(()=>{const d=i.current;if(d)return a.branches.add(d),()=>{a.branches.delete(d)}},[a.branches]),c.jsx(xs.div,{...n,ref:l})});K4.displayName=F4;function Y4(n,e=globalThis?.document){const a=tl(n),i=S.useRef(!1),l=S.useRef(()=>{});return S.useEffect(()=>{const d=m=>{if(m.target&&!i.current){let p=function(){jS(H4,a,y,{discrete:!0})};const y={originalEvent:m};m.pointerType==="touch"?(e.removeEventListener("click",l.current),l.current=p,e.addEventListener("click",l.current,{once:!0})):p()}else e.removeEventListener("click",l.current);i.current=!1},h=window.setTimeout(()=>{e.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(h),e.removeEventListener("pointerdown",d),e.removeEventListener("click",l.current)}},[e,a]),{onPointerDownCapture:()=>i.current=!0}}function X4(n,e=globalThis?.document){const a=tl(n),i=S.useRef(!1);return S.useEffect(()=>{const l=d=>{d.target&&!i.current&&jS(G4,a,{originalEvent:d},{discrete:!1})};return e.addEventListener("focusin",l),()=>e.removeEventListener("focusin",l)},[e,a]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function yb(){const n=new CustomEvent(Sm);document.dispatchEvent(n)}function jS(n,e,a,{discrete:i}){const l=a.originalEvent.target,d=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:a});e&&l.addEventListener(n,e,{once:!0}),i?I4(l,d):l.dispatchEvent(d)}var Cf="focusScope.autoFocusOnMount",Rf="focusScope.autoFocusOnUnmount",vb={bubbles:!1,cancelable:!0},W4="FocusScope",ES=S.forwardRef((n,e)=>{const{loop:a=!1,trapped:i=!1,onMountAutoFocus:l,onUnmountAutoFocus:d,...h}=n,[m,p]=S.useState(null),y=tl(l),v=tl(d),x=S.useRef(null),w=sr(e,T=>p(T)),j=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(i){let T=function(k){if(j.paused||!m)return;const U=k.target;m.contains(U)?x.current=U:Fs(x.current,{select:!0})},N=function(k){if(j.paused||!m)return;const U=k.relatedTarget;U!==null&&(m.contains(U)||Fs(x.current,{select:!0}))},A=function(k){if(document.activeElement===document.body)for(const F of k)F.removedNodes.length>0&&Fs(m)};document.addEventListener("focusin",T),document.addEventListener("focusout",N);const M=new MutationObserver(A);return m&&M.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",T),document.removeEventListener("focusout",N),M.disconnect()}}},[i,m,j.paused]),S.useEffect(()=>{if(m){bb.add(j);const T=document.activeElement;if(!m.contains(T)){const A=new CustomEvent(Cf,vb);m.addEventListener(Cf,y),m.dispatchEvent(A),A.defaultPrevented||(J4(nM(TS(m)),{select:!0}),document.activeElement===T&&Fs(m))}return()=>{m.removeEventListener(Cf,y),setTimeout(()=>{const A=new CustomEvent(Rf,vb);m.addEventListener(Rf,v),m.dispatchEvent(A),A.defaultPrevented||Fs(T??document.body,{select:!0}),m.removeEventListener(Rf,v),bb.remove(j)},0)}}},[m,y,v,j]);const _=S.useCallback(T=>{if(!a&&!i||j.paused)return;const N=T.key==="Tab"&&!T.altKey&&!T.ctrlKey&&!T.metaKey,A=document.activeElement;if(N&&A){const M=T.currentTarget,[k,U]=Z4(M);k&&U?!T.shiftKey&&A===U?(T.preventDefault(),a&&Fs(k,{select:!0})):T.shiftKey&&A===k&&(T.preventDefault(),a&&Fs(U,{select:!0})):A===M&&T.preventDefault()}},[a,i,j.paused]);return c.jsx(xs.div,{tabIndex:-1,...h,ref:w,onKeyDown:_})});ES.displayName=W4;function J4(n,{select:e=!1}={}){const a=document.activeElement;for(const i of n)if(Fs(i,{select:e}),document.activeElement!==a)return}function Z4(n){const e=TS(n),a=xb(e,n),i=xb(e.reverse(),n);return[a,i]}function TS(n){const e=[],a=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const l=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||l?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)e.push(a.currentNode);return e}function xb(n,e){for(const a of n)if(!Q4(a,{upTo:e}))return a}function Q4(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function eM(n){return n instanceof HTMLInputElement&&"select"in n}function Fs(n,{select:e=!1}={}){if(n&&n.focus){const a=document.activeElement;n.focus({preventScroll:!0}),n!==a&&eM(n)&&e&&n.select()}}var bb=tM();function tM(){let n=[];return{add(e){const a=n[0];e!==a&&a?.pause(),n=wb(n,e),n.unshift(e)},remove(e){n=wb(n,e),n[0]?.resume()}}}function wb(n,e){const a=[...n],i=a.indexOf(e);return i!==-1&&a.splice(i,1),a}function nM(n){return n.filter(e=>e.tagName!=="A")}var sM="Portal",NS=S.forwardRef((n,e)=>{const{container:a,...i}=n,[l,d]=S.useState(!1);el(()=>d(!0),[]);const h=a||l&&globalThis?.document?.body;return h?m4.createPortal(c.jsx(xs.div,{...i,ref:e}),h):null});NS.displayName=sM;function aM(n,e){return S.useReducer((a,i)=>e[a][i]??a,n)}var Ou=n=>{const{present:e,children:a}=n,i=rM(e),l=typeof a=="function"?a({present:i.isPresent}):S.Children.only(a),d=sr(i.ref,iM(l));return typeof a=="function"||i.isPresent?S.cloneElement(l,{ref:d}):null};Ou.displayName="Presence";function rM(n){const[e,a]=S.useState(),i=S.useRef(null),l=S.useRef(n),d=S.useRef("none"),h=n?"mounted":"unmounted",[m,p]=aM(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const y=Gc(i.current);d.current=m==="mounted"?y:"none"},[m]),el(()=>{const y=i.current,v=l.current;if(v!==n){const w=d.current,j=Gc(y);n?p("MOUNT"):j==="none"||y?.display==="none"?p("UNMOUNT"):p(v&&w!==j?"ANIMATION_OUT":"UNMOUNT"),l.current=n}},[n,p]),el(()=>{if(e){let y;const v=e.ownerDocument.defaultView??window,x=j=>{const T=Gc(i.current).includes(CSS.escape(j.animationName));if(j.target===e&&T&&(p("ANIMATION_END"),!l.current)){const N=e.style.animationFillMode;e.style.animationFillMode="forwards",y=v.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=N)})}},w=j=>{j.target===e&&(d.current=Gc(i.current))};return e.addEventListener("animationstart",w),e.addEventListener("animationcancel",x),e.addEventListener("animationend",x),()=>{v.clearTimeout(y),e.removeEventListener("animationstart",w),e.removeEventListener("animationcancel",x),e.removeEventListener("animationend",x)}}else p("ANIMATION_END")},[e,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:S.useCallback(y=>{i.current=y?getComputedStyle(y):null,a(y)},[])}}function Gc(n){return n?.animationName||"none"}function iM(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,a=e&&"isReactWarning"in e&&e.isReactWarning;return a?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,a=e&&"isReactWarning"in e&&e.isReactWarning,a?n.props.ref:n.props.ref||n.ref)}var Of=0;function oM(){S.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??Sb()),document.body.insertAdjacentElement("beforeend",n[1]??Sb()),Of++,()=>{Of===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Of--}},[])}function Sb(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var nu="right-scroll-bar-position",su="width-before-scroll-bar",lM="with-scroll-bars-hidden",cM="--removed-body-scroll-bar-size";function Df(n,e){return typeof n=="function"?n(e):n&&(n.current=e),n}function uM(n,e){var a=S.useState(function(){return{value:n,callback:e,facade:{get current(){return a.value},set current(i){var l=a.value;l!==i&&(a.value=i,a.callback(i,l))}}}})[0];return a.callback=e,a.facade}var dM=typeof window<"u"?S.useLayoutEffect:S.useEffect,_b=new WeakMap;function hM(n,e){var a=uM(null,function(i){return n.forEach(function(l){return Df(l,i)})});return dM(function(){var i=_b.get(a);if(i){var l=new Set(i),d=new Set(n),h=a.current;l.forEach(function(m){d.has(m)||Df(m,null)}),d.forEach(function(m){l.has(m)||Df(m,h)})}_b.set(a,n)},[n]),a}function fM(n){return n}function mM(n,e){e===void 0&&(e=fM);var a=[],i=!1,l={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return a.length?a[a.length-1]:n},useMedium:function(d){var h=e(d,i);return a.push(h),function(){a=a.filter(function(m){return m!==h})}},assignSyncMedium:function(d){for(i=!0;a.length;){var h=a;a=[],h.forEach(d)}a={push:function(m){return d(m)},filter:function(){return a}}},assignMedium:function(d){i=!0;var h=[];if(a.length){var m=a;a=[],m.forEach(d),h=a}var p=function(){var v=h;h=[],v.forEach(d)},y=function(){return Promise.resolve().then(p)};y(),a={push:function(v){h.push(v),y()},filter:function(v){return h=h.filter(v),a}}}};return l}function pM(n){n===void 0&&(n={});var e=mM(null);return e.options=qn({async:!0,ssr:!1},n),e}var AS=function(n){var e=n.sideCar,a=_i(n,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=e.read();if(!i)throw new Error("Sidecar medium not found");return S.createElement(i,qn({},a))};AS.isSideCarExport=!0;function gM(n,e){return n.useMedium(e),AS}var kS=pM(),Mf=function(){},Du=S.forwardRef(function(n,e){var a=S.useRef(null),i=S.useState({onScrollCapture:Mf,onWheelCapture:Mf,onTouchMoveCapture:Mf}),l=i[0],d=i[1],h=n.forwardProps,m=n.children,p=n.className,y=n.removeScrollBar,v=n.enabled,x=n.shards,w=n.sideCar,j=n.noRelative,_=n.noIsolation,T=n.inert,N=n.allowPinchZoom,A=n.as,M=A===void 0?"div":A,k=n.gapMode,U=_i(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=w,K=hM([a,e]),P=qn(qn({},U),l);return S.createElement(S.Fragment,null,v&&S.createElement(F,{sideCar:kS,removeScrollBar:y,shards:x,noRelative:j,noIsolation:_,inert:T,setCallbacks:d,allowPinchZoom:!!N,lockRef:a,gapMode:k}),h?S.cloneElement(S.Children.only(m),qn(qn({},P),{ref:K})):S.createElement(M,qn({},P,{className:p,ref:K}),m))});Du.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Du.classNames={fullWidth:su,zeroRight:nu};var yM=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vM(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var e=yM();return e&&n.setAttribute("nonce",e),n}function xM(n,e){n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}function bM(n){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(n)}var wM=function(){var n=0,e=null;return{add:function(a){n==0&&(e=vM())&&(xM(e,a),bM(e)),n++},remove:function(){n--,!n&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},SM=function(){var n=wM();return function(e,a){S.useEffect(function(){return n.add(e),function(){n.remove()}},[e&&a])}},CS=function(){var n=SM(),e=function(a){var i=a.styles,l=a.dynamic;return n(i,l),null};return e},_M={left:0,top:0,right:0,gap:0},zf=function(n){return parseInt(n||"",10)||0},jM=function(n){var e=window.getComputedStyle(document.body),a=e[n==="padding"?"paddingLeft":"marginLeft"],i=e[n==="padding"?"paddingTop":"marginTop"],l=e[n==="padding"?"paddingRight":"marginRight"];return[zf(a),zf(i),zf(l)]},EM=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return _M;var e=jM(n),a=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-a+e[2]-e[0])}},TM=CS(),yi="data-scroll-locked",NM=function(n,e,a,i){var l=n.left,d=n.top,h=n.right,m=n.gap;return a===void 0&&(a="margin"),`
61
- .`.concat(lM,` {
62
- overflow: hidden `).concat(i,`;
63
- padding-right: `).concat(m,"px ").concat(i,`;
64
- }
65
- body[`).concat(yi,`] {
66
- overflow: hidden `).concat(i,`;
67
- overscroll-behavior: contain;
68
- `).concat([e&&"position: relative ".concat(i,";"),a==="margin"&&`
69
- padding-left: `.concat(l,`px;
70
- padding-top: `).concat(d,`px;
71
- padding-right: `).concat(h,`px;
72
- margin-left:0;
73
- margin-top:0;
74
- margin-right: `).concat(m,"px ").concat(i,`;
75
- `),a==="padding"&&"padding-right: ".concat(m,"px ").concat(i,";")].filter(Boolean).join(""),`
76
- }
77
-
78
- .`).concat(nu,` {
79
- right: `).concat(m,"px ").concat(i,`;
80
- }
81
-
82
- .`).concat(su,` {
83
- margin-right: `).concat(m,"px ").concat(i,`;
84
- }
85
-
86
- .`).concat(nu," .").concat(nu,` {
87
- right: 0 `).concat(i,`;
88
- }
89
-
90
- .`).concat(su," .").concat(su,` {
91
- margin-right: 0 `).concat(i,`;
92
- }
93
-
94
- body[`).concat(yi,`] {
95
- `).concat(cM,": ").concat(m,`px;
96
- }
97
- `)},jb=function(){var n=parseInt(document.body.getAttribute(yi)||"0",10);return isFinite(n)?n:0},AM=function(){S.useEffect(function(){return document.body.setAttribute(yi,(jb()+1).toString()),function(){var n=jb()-1;n<=0?document.body.removeAttribute(yi):document.body.setAttribute(yi,n.toString())}},[])},kM=function(n){var e=n.noRelative,a=n.noImportant,i=n.gapMode,l=i===void 0?"margin":i;AM();var d=S.useMemo(function(){return EM(l)},[l]);return S.createElement(TM,{styles:NM(d,!e,l,a?"":"!important")})},_m=!1;if(typeof window<"u")try{var Fc=Object.defineProperty({},"passive",{get:function(){return _m=!0,!0}});window.addEventListener("test",Fc,Fc),window.removeEventListener("test",Fc,Fc)}catch{_m=!1}var ni=_m?{passive:!1}:!1,CM=function(n){return n.tagName==="TEXTAREA"},RS=function(n,e){if(!(n instanceof Element))return!1;var a=window.getComputedStyle(n);return a[e]!=="hidden"&&!(a.overflowY===a.overflowX&&!CM(n)&&a[e]==="visible")},RM=function(n){return RS(n,"overflowY")},OM=function(n){return RS(n,"overflowX")},Eb=function(n,e){var a=e.ownerDocument,i=e;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var l=OS(n,i);if(l){var d=DS(n,i),h=d[1],m=d[2];if(h>m)return!0}i=i.parentNode}while(i&&i!==a.body);return!1},DM=function(n){var e=n.scrollTop,a=n.scrollHeight,i=n.clientHeight;return[e,a,i]},MM=function(n){var e=n.scrollLeft,a=n.scrollWidth,i=n.clientWidth;return[e,a,i]},OS=function(n,e){return n==="v"?RM(e):OM(e)},DS=function(n,e){return n==="v"?DM(e):MM(e)},zM=function(n,e){return n==="h"&&e==="rtl"?-1:1},LM=function(n,e,a,i,l){var d=zM(n,window.getComputedStyle(e).direction),h=d*i,m=a.target,p=e.contains(m),y=!1,v=h>0,x=0,w=0;do{if(!m)break;var j=DS(n,m),_=j[0],T=j[1],N=j[2],A=T-N-d*_;(_||A)&&OS(n,m)&&(x+=A,w+=_);var M=m.parentNode;m=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!p&&m!==document.body||p&&(e.contains(m)||e===m));return(v&&Math.abs(x)<1||!v&&Math.abs(w)<1)&&(y=!0),y},Kc=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Tb=function(n){return[n.deltaX,n.deltaY]},Nb=function(n){return n&&"current"in n?n.current:n},UM=function(n,e){return n[0]===e[0]&&n[1]===e[1]},PM=function(n){return`
98
- .block-interactivity-`.concat(n,` {pointer-events: none;}
99
- .allow-interactivity-`).concat(n,` {pointer-events: all;}
100
- `)},VM=0,si=[];function BM(n){var e=S.useRef([]),a=S.useRef([0,0]),i=S.useRef(),l=S.useState(VM++)[0],d=S.useState(CS)[0],h=S.useRef(n);S.useEffect(function(){h.current=n},[n]),S.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(l));var T=v2([n.lockRef.current],(n.shards||[]).map(Nb),!0).filter(Boolean);return T.forEach(function(N){return N.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),T.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(l))})}}},[n.inert,n.lockRef.current,n.shards]);var m=S.useCallback(function(T,N){if("touches"in T&&T.touches.length===2||T.type==="wheel"&&T.ctrlKey)return!h.current.allowPinchZoom;var A=Kc(T),M=a.current,k="deltaX"in T?T.deltaX:M[0]-A[0],U="deltaY"in T?T.deltaY:M[1]-A[1],F,K=T.target,P=Math.abs(k)>Math.abs(U)?"h":"v";if("touches"in T&&P==="h"&&K.type==="range")return!1;var z=window.getSelection(),Z=z&&z.anchorNode,ie=Z?Z===K||Z.contains(K):!1;if(ie)return!1;var be=Eb(P,K);if(!be)return!0;if(be?F=P:(F=P==="v"?"h":"v",be=Eb(P,K)),!be)return!1;if(!i.current&&"changedTouches"in T&&(k||U)&&(i.current=F),!F)return!0;var de=i.current||F;return LM(de,N,T,de==="h"?k:U)},[]),p=S.useCallback(function(T){var N=T;if(!(!si.length||si[si.length-1]!==d)){var A="deltaY"in N?Tb(N):Kc(N),M=e.current.filter(function(F){return F.name===N.type&&(F.target===N.target||N.target===F.shadowParent)&&UM(F.delta,A)})[0];if(M&&M.should){N.cancelable&&N.preventDefault();return}if(!M){var k=(h.current.shards||[]).map(Nb).filter(Boolean).filter(function(F){return F.contains(N.target)}),U=k.length>0?m(N,k[0]):!h.current.noIsolation;U&&N.cancelable&&N.preventDefault()}}},[]),y=S.useCallback(function(T,N,A,M){var k={name:T,delta:N,target:A,should:M,shadowParent:IM(A)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(U){return U!==k})},1)},[]),v=S.useCallback(function(T){a.current=Kc(T),i.current=void 0},[]),x=S.useCallback(function(T){y(T.type,Tb(T),T.target,m(T,n.lockRef.current))},[]),w=S.useCallback(function(T){y(T.type,Kc(T),T.target,m(T,n.lockRef.current))},[]);S.useEffect(function(){return si.push(d),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:w}),document.addEventListener("wheel",p,ni),document.addEventListener("touchmove",p,ni),document.addEventListener("touchstart",v,ni),function(){si=si.filter(function(T){return T!==d}),document.removeEventListener("wheel",p,ni),document.removeEventListener("touchmove",p,ni),document.removeEventListener("touchstart",v,ni)}},[]);var j=n.removeScrollBar,_=n.inert;return S.createElement(S.Fragment,null,_?S.createElement(d,{styles:PM(l)}):null,j?S.createElement(kM,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function IM(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const qM=gM(kS,BM);var MS=S.forwardRef(function(n,e){return S.createElement(Du,qn({},n,{ref:e,sideCar:qM}))});MS.classNames=Du.classNames;var $M=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},ai=new WeakMap,Yc=new WeakMap,Xc={},Lf=0,zS=function(n){return n&&(n.host||zS(n.parentNode))},HM=function(n,e){return e.map(function(a){if(n.contains(a))return a;var i=zS(a);return i&&n.contains(i)?i:(console.error("aria-hidden",a,"in not contained inside",n,". Doing nothing"),null)}).filter(function(a){return!!a})},GM=function(n,e,a,i){var l=HM(e,Array.isArray(n)?n:[n]);Xc[a]||(Xc[a]=new WeakMap);var d=Xc[a],h=[],m=new Set,p=new Set(l),y=function(x){!x||m.has(x)||(m.add(x),y(x.parentNode))};l.forEach(y);var v=function(x){!x||p.has(x)||Array.prototype.forEach.call(x.children,function(w){if(m.has(w))v(w);else try{var j=w.getAttribute(i),_=j!==null&&j!=="false",T=(ai.get(w)||0)+1,N=(d.get(w)||0)+1;ai.set(w,T),d.set(w,N),h.push(w),T===1&&_&&Yc.set(w,!0),N===1&&w.setAttribute(a,"true"),_||w.setAttribute(i,"true")}catch(A){console.error("aria-hidden: cannot operate on ",w,A)}})};return v(e),m.clear(),Lf++,function(){h.forEach(function(x){var w=ai.get(x)-1,j=d.get(x)-1;ai.set(x,w),d.set(x,j),w||(Yc.has(x)||x.removeAttribute(i),Yc.delete(x)),j||x.removeAttribute(a)}),Lf--,Lf||(ai=new WeakMap,ai=new WeakMap,Yc=new WeakMap,Xc={})}},FM=function(n,e,a){a===void 0&&(a="data-aria-hidden");var i=Array.from(Array.isArray(n)?n:[n]),l=$M(n);return l?(i.push.apply(i,Array.from(l.querySelectorAll("[aria-live], script"))),GM(i,l,a,"aria-hidden")):function(){return null}};function KM(n){const e=YM(n),a=S.forwardRef((i,l)=>{const{children:d,...h}=i,m=S.Children.toArray(d),p=m.find(WM);if(p){const y=p.props.children,v=m.map(x=>x===p?S.Children.count(y)>1?S.Children.only(null):S.isValidElement(y)?y.props.children:null:x);return c.jsx(e,{...h,ref:l,children:S.isValidElement(y)?S.cloneElement(y,void 0,v):null})}return c.jsx(e,{...h,ref:l,children:d})});return a.displayName=`${n}.Slot`,a}function YM(n){const e=S.forwardRef((a,i)=>{const{children:l,...d}=a;if(S.isValidElement(l)){const h=ZM(l),m=JM(d,l.props);return l.type!==S.Fragment&&(m.ref=i?ju(i,h):h),S.cloneElement(l,m)}return S.Children.count(l)>1?S.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var XM=Symbol("radix.slottable");function WM(n){return S.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===XM}function JM(n,e){const a={...e};for(const i in e){const l=n[i],d=e[i];/^on[A-Z]/.test(i)?l&&d?a[i]=(...m)=>{const p=d(...m);return l(...m),p}:l&&(a[i]=l):i==="style"?a[i]={...l,...d}:i==="className"&&(a[i]=[l,d].filter(Boolean).join(" "))}return{...n,...a}}function ZM(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,a=e&&"isReactWarning"in e&&e.isReactWarning;return a?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,a=e&&"isReactWarning"in e&&e.isReactWarning,a?n.props.ref:n.props.ref||n.ref)}var Mu="Dialog",[LS]=T4(Mu),[QM,zn]=LS(Mu),US=n=>{const{__scopeDialog:e,children:a,open:i,defaultOpen:l,onOpenChange:d,modal:h=!0}=n,m=S.useRef(null),p=S.useRef(null),[y,v]=R4({prop:i,defaultProp:l??!1,onChange:d,caller:Mu});return c.jsx(QM,{scope:e,triggerRef:m,contentRef:p,contentId:kf(),titleId:kf(),descriptionId:kf(),open:y,onOpenChange:v,onOpenToggle:S.useCallback(()=>v(x=>!x),[v]),modal:h,children:a})};US.displayName=Mu;var PS="DialogTrigger",e3=S.forwardRef((n,e)=>{const{__scopeDialog:a,...i}=n,l=zn(PS,a),d=sr(e,l.triggerRef);return c.jsx(xs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":vp(l.open),...i,ref:d,onClick:na(n.onClick,l.onOpenToggle)})});e3.displayName=PS;var gp="DialogPortal",[t3,VS]=LS(gp,{forceMount:void 0}),BS=n=>{const{__scopeDialog:e,forceMount:a,children:i,container:l}=n,d=zn(gp,e);return c.jsx(t3,{scope:e,forceMount:a,children:S.Children.map(i,h=>c.jsx(Ou,{present:a||d.open,children:c.jsx(NS,{asChild:!0,container:l,children:h})}))})};BS.displayName=gp;var wu="DialogOverlay",IS=S.forwardRef((n,e)=>{const a=VS(wu,n.__scopeDialog),{forceMount:i=a.forceMount,...l}=n,d=zn(wu,n.__scopeDialog);return d.modal?c.jsx(Ou,{present:i||d.open,children:c.jsx(s3,{...l,ref:e})}):null});IS.displayName=wu;var n3=KM("DialogOverlay.RemoveScroll"),s3=S.forwardRef((n,e)=>{const{__scopeDialog:a,...i}=n,l=zn(wu,a);return c.jsx(MS,{as:n3,allowPinchZoom:!0,shards:[l.contentRef],children:c.jsx(xs.div,{"data-state":vp(l.open),...i,ref:e,style:{pointerEvents:"auto",...i.style}})})}),nr="DialogContent",qS=S.forwardRef((n,e)=>{const a=VS(nr,n.__scopeDialog),{forceMount:i=a.forceMount,...l}=n,d=zn(nr,n.__scopeDialog);return c.jsx(Ou,{present:i||d.open,children:d.modal?c.jsx(a3,{...l,ref:e}):c.jsx(r3,{...l,ref:e})})});qS.displayName=nr;var a3=S.forwardRef((n,e)=>{const a=zn(nr,n.__scopeDialog),i=S.useRef(null),l=sr(e,a.contentRef,i);return S.useEffect(()=>{const d=i.current;if(d)return FM(d)},[]),c.jsx($S,{...n,ref:l,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:na(n.onCloseAutoFocus,d=>{d.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:na(n.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:na(n.onFocusOutside,d=>d.preventDefault())})}),r3=S.forwardRef((n,e)=>{const a=zn(nr,n.__scopeDialog),i=S.useRef(!1),l=S.useRef(!1);return c.jsx($S,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{n.onCloseAutoFocus?.(d),d.defaultPrevented||(i.current||a.triggerRef.current?.focus(),d.preventDefault()),i.current=!1,l.current=!1},onInteractOutside:d=>{n.onInteractOutside?.(d),d.defaultPrevented||(i.current=!0,d.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const h=d.target;a.triggerRef.current?.contains(h)&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&l.current&&d.preventDefault()}})}),$S=S.forwardRef((n,e)=>{const{__scopeDialog:a,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:d,...h}=n,m=zn(nr,a),p=S.useRef(null),y=sr(e,p);return oM(),c.jsxs(c.Fragment,{children:[c.jsx(ES,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:l,onUnmountAutoFocus:d,children:c.jsx(_S,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":vp(m.open),...h,ref:y,onDismiss:()=>m.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(i3,{titleId:m.titleId}),c.jsx(l3,{contentRef:p,descriptionId:m.descriptionId})]})]})}),yp="DialogTitle",HS=S.forwardRef((n,e)=>{const{__scopeDialog:a,...i}=n,l=zn(yp,a);return c.jsx(xs.h2,{id:l.titleId,...i,ref:e})});HS.displayName=yp;var GS="DialogDescription",FS=S.forwardRef((n,e)=>{const{__scopeDialog:a,...i}=n,l=zn(GS,a);return c.jsx(xs.p,{id:l.descriptionId,...i,ref:e})});FS.displayName=GS;var KS="DialogClose",YS=S.forwardRef((n,e)=>{const{__scopeDialog:a,...i}=n,l=zn(KS,a);return c.jsx(xs.button,{type:"button",...i,ref:e,onClick:na(n.onClick,()=>l.onOpenChange(!1))})});YS.displayName=KS;function vp(n){return n?"open":"closed"}var XS="DialogTitleWarning",[Q3,WS]=E4(XS,{contentName:nr,titleName:yp,docsSlug:"dialog"}),i3=({titleId:n})=>{const e=WS(XS),a=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
101
-
102
- If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
103
-
104
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return S.useEffect(()=>{n&&(document.getElementById(n)||console.error(a))},[a,n]),null},o3="DialogDescriptionWarning",l3=({contentRef:n,descriptionId:e})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${WS(o3).contentName}}.`;return S.useEffect(()=>{const l=n.current?.getAttribute("aria-describedby");e&&l&&(document.getElementById(e)||console.warn(i))},[i,n,e]),null},c3=US,u3=BS,d3=IS,h3=qS,f3=HS,m3=FS,p3=YS;function Ya({...n}){return c.jsx(c3,{"data-slot":"dialog",...n})}function g3({...n}){return c.jsx(u3,{"data-slot":"dialog-portal",...n})}function y3({className:n,...e}){return c.jsx(d3,{"data-slot":"dialog-overlay",className:Se("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),...e})}function Xa({className:n,children:e,...a}){return c.jsxs(g3,{"data-slot":"dialog-portal",children:[c.jsx(y3,{}),c.jsxs(h3,{"data-slot":"dialog-content",className:Se("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",n),...a,children:[e,c.jsxs(p3,{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:[c.jsx(ra,{}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Wa({className:n,...e}){return c.jsx("div",{"data-slot":"dialog-header",className:Se("flex flex-col gap-2 text-center sm:text-left",n),...e})}function Ia({className:n,...e}){return c.jsx("div",{"data-slot":"dialog-footer",className:Se("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...e})}function Ja({className:n,...e}){return c.jsx(f3,{"data-slot":"dialog-title",className:Se("text-lg leading-none font-semibold",n),...e})}function Za({className:n,...e}){return c.jsx(m3,{"data-slot":"dialog-description",className:Se("text-muted-foreground text-sm",n),...e})}function v3({email:n,isOpen:e,onOpenChange:a,onRetry:i}){const{t:l}=yt(),[d,h]=S.useState([]),[m,p]=S.useState(!1);S.useEffect(()=>{e&&n&&y()},[e,n]);const y=async()=>{if(n){p(!0);try{const x=await ze.getEmailEvents(n.id);x.data&&h(x.data.events)}catch(x){console.error("Failed to fetch trace:",x)}finally{p(!1)}}},v=x=>{switch(x){case"analysis":return c.jsx(Vo,{className:"w-4 h-4 text-purple-500"});case"action":return c.jsx(ou,{className:"w-4 h-4 text-emerald-500"});case"error":return c.jsx(Fn,{className:"w-4 h-4 text-red-500"});default:return c.jsx(vi,{className:"w-4 h-4 text-blue-500"})}};return c.jsx(Ya,{open:e,onOpenChange:a,children:c.jsxs(Xa,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[c.jsxs(Wa,{className:"p-6 border-b flex flex-row items-center justify-between",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Su,{className:"w-5 h-5 text-primary"}),c.jsx(Ja,{children:l("dashboard.aiTrace")})]}),c.jsx(Za,{children:l("dashboard.aiTraceDesc")})]}),n?.processing_status==="failed"&&i&&c.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>{i(n),a(!1)},className:"gap-2 text-destructive border-destructive/20 hover:bg-destructive/10",children:[c.jsx(Zt,{className:"w-3.5 h-3.5"}),l("dashboard.retryProcessing")]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:m?c.jsx("div",{className:"py-20 flex justify-center",children:c.jsx(pt,{})}):d.length===0?c.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:l("dashboard.noTrace")}):d.map((x,w)=>c.jsxs("div",{className:"relative pl-8",children:[w!==d.length-1&&c.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),c.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:v(x.event_type)}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground/70",children:x.agent_state}),c.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[c.jsx(Qa,{className:"w-3 h-3"}),new Date(x.created_at).toLocaleTimeString()]})]}),c.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[x.event_type==="info"&&c.jsxs("div",{className:"space-y-3",children:[c.jsx("p",{className:"text-sm text-foreground/90",children:x.details?.message}),x.details?.system_prompt&&c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[c.jsx(ps,{className:"w-3 h-3"})," System Prompt"]}),c.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:x.details.system_prompt})]}),x.details?.content_preview&&c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[c.jsx(ps,{className:"w-3 h-3"})," ",l("dashboard.emailContent")]}),c.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:x.details.content_preview})]})]}),x.event_type==="analysis"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[c.jsxs("span",{className:"text-muted-foreground mr-1",children:[l("config.rules.category"),":"]}),c.jsx("span",{className:"font-bold uppercase",children:x.details?.category||l("dashboard.analyzing")})]}),c.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[c.jsxs("span",{className:"text-muted-foreground mr-1",children:[l("config.rules.sentiment"),":"]}),c.jsx("span",{className:"font-bold uppercase",children:x.details?.sentiment||l("dashboard.analyzing")})]})]}),x.details?.system_prompt&&c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[c.jsx(ps,{className:"w-3 h-3"})," System Prompt"]}),c.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:x.details?.system_prompt})]}),x.details?._raw_response&&c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[c.jsx(ps,{className:"w-3 h-3"})," Raw LLM Response"]}),c.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(x.details._raw_response),null,2)})]}),x.details?.usage&&c.jsxs("div",{className:"flex gap-4 pt-2 border-t border-border/50",children:[c.jsxs("div",{className:"text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground mr-1",children:"Prompt:"}),c.jsx("span",{className:"font-mono font-bold",children:x.details.usage.prompt_tokens})]}),c.jsxs("div",{className:"text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground mr-1",children:"Completion:"}),c.jsx("span",{className:"font-mono font-bold",children:x.details.usage.completion_tokens})]}),c.jsxs("div",{className:"text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground mr-1",children:"Total:"}),c.jsx("span",{className:"font-mono font-bold text-primary",children:x.details.usage.total_tokens})]})]})]}),x.event_type==="action"&&c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:[l("dashboard.done")," ",x.details?.action]}),c.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',x.details?.reason,'"']})]}),c.jsx(Nm,{className:"w-5 h-5 text-emerald-500"})]}),x.event_type==="error"&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:typeof x.details?.error=="object"?x.details.error.message||JSON.stringify(x.details.error):x.details?.error}),x.details?.raw_response&&c.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 x.details.raw_response=="object"?JSON.stringify(x.details.raw_response,null,2):x.details.raw_response})]})]})]})]},x.id))})]})})}const x3={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 b3(){const{state:n,actions:e}=ia(),{t:a}=yt(),{openTerminal:i}=kw(),[l,d]=S.useState(!0),{isSyncing:h}=n,[m,p]=S.useState(""),[y,v]=S.useState(null),[x,w]=S.useState(null),[j,_]=S.useState({}),[T,N]=S.useState(null),[A,M]=S.useState(!1),[k,U]=S.useState(null);S.useEffect(()=>{n.isAuthenticated?(F(),e.fetchStats()):d(!1)},[y,n.isAuthenticated]);const F=async(te=0)=>{d(!0),await e.fetchEmails({category:y||void 0,search:m||void 0,offset:te,sortBy:n.sortBy,sortOrder:n.sortOrder}),d(!1)},K=te=>{e.fetchEmails({category:y||void 0,search:m||void 0,offset:0,sortBy:te,sortOrder:n.sortOrder})},P=()=>{e.fetchEmails({category:y||void 0,search:m||void 0,offset:0,sortBy:n.sortBy,sortOrder:n.sortOrder==="asc"?"desc":"asc"})},z=async()=>{if(n.accounts.length===0){ae.warning(a("dashboard.noEmailsConnected"));return}$n.playStart(),i(),await e.triggerSync()?($n.playSuccess(),ae.success(a("dashboard.syncSuccess"))):ae.error(a("dashboard.syncFailed"))},Z=async(te,R)=>{if(R==="delete"&&T!==te.id){N(te.id);return}N(null),_(I=>({...I,[te.id]:R}));const q=await e.executeAction(te.id,R);_(I=>{const he={...I};return delete he[te.id],he}),q&&(ae.success(`Email ${R==="delete"?"deleted":R==="archive"?"archived":"updated"}`),R==="delete"&&F(n.emailsOffset))},ie=()=>{N(null)},be=te=>{te.preventDefault(),F()},de=te=>{const R=te==="next"?n.emailsOffset+20:Math.max(0,n.emailsOffset-20);F(R)},qe=te=>{U(te),M(!0)},Be=async te=>{await e.retryProcessing(te.id)&&ae.success("Retrying email processing...")};return c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 animate-in fade-in duration-500",children:[c.jsxs("section",{className:"lg:col-span-2 space-y-4",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-4",children:[c.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[c.jsx(Io,{className:"w-5 h-5 text-primary"}),a("dashboard.recentAnalysis")]}),c.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[c.jsxs(ee,{onClick:z,size:"sm",variant:"default",className:"h-9 shadow-md px-4",disabled:h,children:[c.jsx(Zt,{className:Se("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),a(h?"dashboard.syncing":"dashboard.syncNow")]}),c.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:[n.emailsTotal," ",a("dashboard.emails")]})]})]}),h&&c.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:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:c.jsx(Lt,{className:"w-5 h-5 text-primary animate-spin"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-sm",children:a("dashboard.syncInProgress")}),c.jsx("p",{className:"text-xs text-muted-foreground",children:a("dashboard.syncInProgressDesc")})]})]}),c.jsxs(ee,{variant:"outline",size:"sm",onClick:i,className:"h-8 text-xs",children:[c.jsx(Su,{className:"w-3.5 h-3.5 mr-2"}),a("common.viewLogs")]})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-center",children:[c.jsxs("form",{onSubmit:be,className:"flex-1 flex gap-2 w-full",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(HT,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),c.jsx(Ae,{placeholder:a("dashboard.searchPlaceholder"),value:m,onChange:te=>p(te.target.value),className:"pl-9 h-9"})]}),c.jsx(ee,{type:"submit",size:"sm",className:"h-9 px-4",children:a("dashboard.search")})]}),c.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50 h-9",children:[c.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-full",value:n.sortBy,onChange:te=>K(te.target.value),children:[c.jsx("option",{value:"date",children:a("dashboard.receivedTime")}),c.jsx("option",{value:"created_at",children:a("dashboard.processedTime")})]}),c.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-primary",onClick:P,title:n.sortOrder==="asc"?a("dashboard.sortOldest"):a("dashboard.sortNewest"),children:n.sortOrder==="asc"?c.jsx(OE,{className:"w-3.5 h-3.5"}):c.jsx(kE,{className:"w-3.5 h-3.5"})})]})]}),c.jsxs("div",{className:"flex gap-1 flex-wrap",children:[c.jsx(ee,{size:"sm",variant:n.activeCategory===null?"secondary":"ghost",onClick:()=>v(null),children:a("dashboard.category.all")}),["spam","client","newsletter","support"].map(te=>c.jsx(ee,{size:"sm",variant:n.activeCategory===te?"secondary":"ghost",onClick:()=>v(te),className:"capitalize",children:te},te))]}),l?c.jsx(pC,{}):n.emails.length===0?c.jsxs(It,{className:"p-20 text-center shadow-sm",children:[c.jsx("div",{className:"w-16 h-16 bg-primary/10 text-primary rounded-full flex items-center justify-center mx-auto mb-6",children:c.jsx(Io,{className:"w-8 h-8"})}),c.jsx("h3",{className:"text-lg font-medium",children:a("dashboard.noEmails")}),c.jsx("p",{className:"text-muted-foreground mt-2 mb-6",children:n.accounts.length===0?a("dashboard.noEmailsConnected"):a("dashboard.noEmailsFilters")}),n.accounts.length>0&&c.jsxs(ee,{onClick:()=>{i(),z()},disabled:h,children:[c.jsx(Zt,{className:Se("w-4 h-4 mr-2",h&&"animate-spin")}),a("dashboard.syncNow")]})]}):c.jsxs(c.Fragment,{children:[n.emails.map(te=>c.jsx(_3,{email:te,onAction:Z,onRetry:Be,onViewTrace:qe,onSelect:()=>w(te),isSelected:x?.id===te.id,loadingAction:j[te.id],isDeletePending:T===te.id,onCancelDelete:ie},te.id)),c.jsx(v3,{isOpen:A,onOpenChange:M,email:k,onRetry:Be}),n.emailsTotal>20&&c.jsxs("div",{className:"flex items-center justify-between pt-4",children:[c.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>de("prev"),disabled:n.emailsOffset===0,children:[c.jsx(FE,{className:"w-4 h-4 mr-1"}),a("common.previous")]}),c.jsxs("span",{className:"text-sm text-muted-foreground",children:[n.emailsOffset+1," - ",Math.min(n.emailsOffset+20,n.emailsTotal)," ",a("common.of")," ",n.emailsTotal]}),c.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>de("next"),disabled:n.emailsOffset+20>=n.emailsTotal,children:[a("common.next"),c.jsx(au,{className:"w-4 h-4 ml-1"})]})]})]})]}),c.jsxs("aside",{className:"space-y-6",children:[x&&c.jsxs(It,{className:"p-6 border-primary/20 bg-primary/5 animate-in slide-in-from-right-5",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("h3",{className:"font-semibold",children:a("dashboard.emailDetails")}),c.jsx(ee,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>w(null),children:c.jsx(ra,{className:"w-4 h-4"})})]}),c.jsxs("div",{className:"space-y-3 text-sm",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-muted-foreground",children:a("dashboard.from")}),c.jsx("p",{className:"font-medium truncate",children:x.sender})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-muted-foreground",children:a("dashboard.subject")}),c.jsx("p",{className:"font-medium",children:x.subject})]}),x.ai_analysis&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-muted-foreground",children:a("dashboard.summary")}),c.jsx("p",{className:"text-xs mt-1",children:x.ai_analysis.summary})]}),x.ai_analysis.key_points&&c.jsxs("div",{children:[c.jsx("span",{className:"text-muted-foreground",children:a("dashboard.keyPoints")}),c.jsx("ul",{className:"text-xs mt-1 list-disc list-inside",children:x.ai_analysis.key_points.map((te,R)=>c.jsx("li",{children:te},R))})]}),x.ai_analysis.draft_response&&c.jsxs("div",{className:"mt-4 p-3 bg-emerald-500/5 border border-emerald-500/20 rounded-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2 text-emerald-600 dark:text-emerald-400",children:[c.jsx(FT,{className:"w-3.5 h-3.5"}),c.jsx("span",{className:"text-xs font-bold uppercase",children:a("dashboard.aiDraftReply")})]}),c.jsx("p",{className:"text-xs leading-relaxed whitespace-pre-wrap italic text-foreground/80",children:x.ai_analysis.draft_response}),c.jsx("p",{className:"mt-2 text-[9px] text-muted-foreground",children:a("dashboard.draftSavedHelp").replace("{provider}",x.email_accounts?.provider==="gmail"?"Gmail":"Outlook")})]})]})]})]}),c.jsx(w3,{accounts:n.accounts,onUpdate:e.updateAccount,onSync:e.triggerSync,settings:n.settings,onUpdateSettings:e.updateSettings,openTerminal:i}),c.jsxs(It,{className:"p-6",children:[c.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[c.jsx(Pb,{className:"w-4 h-4 text-primary"}),a("dashboard.syncHistory")]}),c.jsx("div",{className:"space-y-4",children:!n.stats?.recentSyncs||n.stats.recentSyncs.length===0?c.jsx("p",{className:"text-xs text-muted-foreground italic",children:a("dashboard.noSyncHistory")}):n.stats.recentSyncs.slice(0,5).map(te=>c.jsxs("div",{className:"flex justify-between items-start text-sm border-b last:border-0 pb-3 last:pb-0",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:Se("w-1.5 h-1.5 rounded-full",te.status==="success"?"bg-emerald-500":te.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),c.jsxs("p",{className:"font-medium text-xs",children:[new Date(te.started_at).toLocaleDateString()," ",new Date(te.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),c.jsxs("p",{className:"text-[10px] text-muted-foreground pl-3.5",children:[a("dashboard.processed")," ",c.jsx("span",{className:"font-medium text-foreground",children:te.emails_processed})," •",a("dashboard.actioned")," ",c.jsx("span",{className:"font-medium text-foreground",children:te.emails_deleted+te.emails_drafted})]}),te.error_message&&c.jsxs("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:te.error_message,children:[a("dashboard.error")," ",te.error_message]})]}),c.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:te.status==="running"?a("dashboard.running"):te.completed_at?`${Math.round((new Date(te.completed_at).getTime()-new Date(te.started_at).getTime())/1e3)}s`:"..."})]},te.id))})]}),c.jsxs(It,{className:"p-6",children:[c.jsx("h3",{className:"font-semibold mb-4",children:a("dashboard.quickStats")}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:a("dashboard.totalProcessed")}),c.jsx("span",{className:"font-medium",children:n.emailsTotal})]}),c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:a("dashboard.connectedAccounts")}),c.jsx("span",{className:"font-medium",children:n.accounts.length})]}),c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:a("dashboard.activeRules")}),c.jsx("span",{className:"font-medium",children:n.rules.filter(te=>te.is_enabled).length})]})]})]})]})]})}function w3({accounts:n,onUpdate:e,onSync:a,settings:i,onUpdateSettings:l,openTerminal:d}){return n.length===0?null:c.jsxs(It,{className:"p-6",children:[c.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[c.jsx(XT,{className:"w-4 h-4 text-primary"}),t("dashboard.syncScope")]}),c.jsx("div",{className:"space-y-6",children:n.map(h=>c.jsx(S3,{account:h,onUpdate:e,onSync:a,openTerminal:d},h.id))})]})}function S3({account:n,onUpdate:e,onSync:a,openTerminal:i}){const[l,d]=S.useState(!1),[h,m]=S.useState(""),[p,y]=S.useState(""),v=_=>{if(!_)return"";const T=typeof _=="string"&&/^\d+$/.test(_)?parseInt(_):_,N=new Date(T);if(isNaN(N.getTime()))return"";const A=M=>M<10?"0"+M:M;return N.getFullYear()+"-"+A(N.getMonth()+1)+"-"+A(N.getDate())+"T"+A(N.getHours())+":"+A(N.getMinutes())};S.useEffect(()=>{const _=n.sync_start_date||n.last_sync_checkpoint||n.last_sync_at;m(v(_)),y((n.sync_max_emails_per_run||50).toString())},[n.id,n.sync_start_date,n.last_sync_checkpoint,n.last_sync_at,n.sync_max_emails_per_run]);const x=async _=>{d(!0),await e(n.id,_),d(!1)},w=()=>{const _=n.sync_start_date?new Date(n.sync_start_date).toISOString():"",T=h?new Date(h).toISOString():"";T!==_&&x({sync_start_date:T||null})},j=()=>{const _=parseInt(p,10)||50;_!==n.sync_max_emails_per_run&&x({sync_max_emails_per_run:_})};return c.jsxs("div",{className:"space-y-3 pb-4 border-b last:border-0 last:pb-0",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-xs font-medium truncate max-w-[150px]",title:n.email_address,children:n.email_address}),c.jsxs("div",{className:"flex items-center gap-1",children:[n.last_sync_status==="syncing"?c.jsx(Lt,{className:"w-3 h-3 text-primary animate-spin"}):n.last_sync_status==="success"?c.jsx(Nm,{className:"w-3 h-3 text-emerald-500"}):n.last_sync_status==="error"?c.jsx("span",{title:n.last_sync_error||"Error",children:c.jsx(Fn,{className:"w-3 h-3 text-destructive"})}):null,c.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{i(),a(n.id)},disabled:n.last_sync_status==="syncing",children:c.jsx(Zt,{className:Se("w-3 h-3",n.last_sync_status==="syncing"&&"animate-spin")})}),c.jsx(ee,{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:()=>e(n.id,{last_sync_checkpoint:null}),disabled:n.last_sync_status==="syncing",children:c.jsx(Pb,{className:"w-3 h-3"})})]})]}),c.jsxs("div",{className:"grid grid-cols-[1.5fr_1fr] gap-2",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[c.jsx(VE,{className:"w-2.5 h-2.5"})," ",t("dashboard.syncFrom")]}),c.jsx(Ae,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:h,onChange:_=>m(_.target.value),onBlur:w,disabled:l||n.last_sync_status==="syncing"})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[c.jsx(gT,{className:"w-2.5 h-2.5"})," ",t("dashboard.maxEmails")]}),c.jsx(Ae,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:p,onChange:_=>y(_.target.value),onBlur:j,disabled:l||n.last_sync_status==="syncing"})]})]}),n.last_sync_at&&c.jsxs("p",{className:"text-[9px] text-muted-foreground",children:[t("dashboard.lastSync")," ",new Date(n.last_sync_at).toLocaleString()]}),n.last_sync_error&&c.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:n.last_sync_error,children:[t("dashboard.error")," ",n.last_sync_error]})]})}function _3({email:n,onAction:e,onRetry:a,onViewTrace:i,onSelect:l,isSelected:d,loadingAction:h,isDeletePending:m,onCancelDelete:p}){if(!n)return null;const y=x3[n.category||"other"],v=!!h,x=()=>{if(!n.email_accounts)return"#";const{provider:w,email_address:j}=n.email_accounts;return w==="gmail"?`https://mail.google.com/mail/u/${j}/#all/${n.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(n.external_id)}`};return c.jsx(It,{className:Se("hover:shadow-md transition-shadow group cursor-pointer",d&&"ring-2 ring-primary"),onClick:l,children:c.jsxs("div",{className:"p-5",children:[c.jsxs("div",{className:"flex justify-between items-start mb-3 gap-4",children:[c.jsxs("div",{className:"flex gap-3 flex-1 min-w-0",children:[c.jsx("div",{className:Se("w-8 h-8 rounded-full flex-shrink-0 flex items-center justify-center font-bold text-white text-xs",n.category==="spam"?"bg-destructive":"bg-primary"),children:n.sender?.[0]?.toUpperCase()||"?"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:n.subject||t("dashboard.noSubject")}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",title:n.sender||"",children:n.sender})]})]}),c.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[c.jsx("span",{className:Se("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",y),children:n.category||"unknown"}),c.jsxs("div",{className:"flex items-center justify-end gap-1",children:[n.processing_status==="pending"&&c.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[c.jsx(Qa,{className:"w-2.5 h-2.5"})," ",t("dashboard.queued")]}),n.processing_status==="processing"&&c.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:[c.jsx(Lt,{className:"w-2.5 h-2.5 animate-spin"})," ",t("dashboard.analyzing")]}),n.processing_status==="completed"&&c.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:[c.jsx(Vo,{className:"w-2.5 h-2.5"})," ",t("dashboard.analyzed")]}),n.processing_status==="failed"&&c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsxs("span",{className:"text-[9px] text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",title:n.processing_error||t("common.error"),children:[c.jsx(Fn,{className:"w-2.5 h-2.5"})," ",t("dashboard.failed")]}),c.jsx(ee,{variant:"ghost",size:"icon",className:"h-5 w-5 text-red-600 hover:bg-red-500/10",onClick:w=>{w.stopPropagation(),a(n)},title:t("dashboard.retryProcessing"),children:c.jsx(Zt,{className:"w-2.5 h-2.5"})})]}),!n.processing_status&&!n.ai_analysis&&c.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[c.jsx(Lt,{className:"w-2.5 h-2.5 animate-spin"})," ",t("dashboard.queued")]}),!n.processing_status&&n.ai_analysis&&c.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:[c.jsx(Vo,{className:"w-2.5 h-2.5"})," ",t("dashboard.analyzed")]})]}),c.jsxs("div",{className:"flex items-center justify-end gap-2 text-[10px] text-muted-foreground/80 leading-tight",children:[c.jsxs("span",{title:n.date?new Date(n.date).toLocaleString():"",className:"whitespace-nowrap",children:[c.jsxs("span",{className:"opacity-70 text-[9px]",children:[t("dashboard.receivedAbbr"),":"]})," ",n.date?new Date(n.date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),c.jsx("span",{className:"opacity-30",children:"•"}),c.jsxs("span",{title:new Date(n.created_at).toLocaleString(),className:"whitespace-nowrap",children:[c.jsxs("span",{className:"opacity-70 text-[9px]",children:[t("dashboard.processedAbbr"),":"]})," ",new Date(n.created_at).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),c.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:n.body_snippet}),c.jsxs("div",{className:"bg-secondary/30 p-3 rounded-lg border border-border/50 flex justify-between items-center",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[c.jsx(Vb,{className:"w-3.5 h-3.5 text-emerald-500"}),t("dashboard.suggested"),n.suggested_actions&&n.suggested_actions.length>0?c.jsx("div",{className:"flex gap-1 flex-wrap",children:n.suggested_actions.map(w=>c.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:w},w))}):c.jsx("span",{className:"text-foreground",children:n.suggested_action||t("dashboard.category.none")}),n.actions_taken&&n.actions_taken.length>0?c.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:n.actions_taken.join(", "),children:["(",t("dashboard.done")," ",n.actions_taken.join(", "),")"]}):n.action_taken?c.jsxs("span",{className:"text-muted-foreground ml-2",children:["(",t("dashboard.done")," ",n.action_taken,")"]}):null]}),c.jsx("div",{className:"flex gap-1 items-center",onClick:w=>w.stopPropagation(),children:m?c.jsxs("div",{className:"flex items-center gap-1 animate-in fade-in duration-200",children:[c.jsx("span",{className:"text-xs text-destructive mr-1",children:t("dashboard.deleteConfirm")}),c.jsx(ee,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>e(n,"delete"),disabled:v,children:h==="delete"?c.jsx(Lt,{className:"w-3 h-3 animate-spin"}):t("common.yes")}),c.jsx(ee,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:p,disabled:v,children:t("common.no")})]}):c.jsxs(c.Fragment,{children:[c.jsx("a",{href:x(),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:t("dashboard.openIn").replace("{provider}",n.email_accounts?.provider==="gmail"?"Gmail":"Outlook"),children:c.jsx(Bo,{className:"w-3.5 h-3.5"})}),c.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>i(n),title:t("dashboard.viewTraceTooltip"),children:c.jsx(zb,{className:"w-3.5 h-3.5"})}),c.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>e(n,"delete"),disabled:v,title:t("common.delete"),children:h==="delete"?c.jsx(Lt,{className:"w-3.5 h-3.5 animate-spin"}):c.jsx(_u,{className:"w-3.5 h-3.5"})}),c.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>e(n,"archive"),disabled:v,title:t("common.archive"),children:h==="archive"?c.jsx(Lt,{className:"w-3.5 h-3.5 animate-spin"}):c.jsx(NE,{className:"w-3.5 h-3.5"})}),c.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>e(n,"flag"),disabled:v,title:t("common.flag"),children:h==="flag"?c.jsx(Lt,{className:"w-3.5 h-3.5 animate-spin"}):c.jsx(hT,{className:"w-3.5 h-3.5"})})]})})]})]})})}const ko="realtimexai";function j3(){const{state:n,actions:e}=ia(),{t:a}=yt(),[i,l]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(null),[y,v]=S.useState(!1),[x,w]=S.useState(!1),[j,_]=S.useState({}),[T,N]=S.useState(!1),[A,M]=S.useState("credentials"),[k,U]=S.useState(""),[F,K]=S.useState(""),[P,z]=S.useState(""),[Z,ie]=S.useState(""),[be,de]=S.useState(!1),[qe,Be]=S.useState(!1),[te,R]=S.useState(!1),[q,I]=S.useState("credentials"),[he,_e]=S.useState(""),[O,X]=S.useState(""),[Q,se]=S.useState(!1),[we,je]=S.useState(!1),[ge,ot]=S.useState(""),[Ue,un]=S.useState("category"),[Gt,Et]=S.useState("newsletter"),[En,Tn]=S.useState(["archive"]),[la,ar]=S.useState(""),[ol,Ai]=S.useState(""),[rr,ir]=S.useState(""),[or,ll]=S.useState(""),[cl,Tt]=S.useState([]),[lr,ki]=S.useState(!1),[Ci,ca]=S.useState(!1),[Kn,ul]=S.useState([]),[cr,dl]=S.useState(!1),[bs,Nt]=S.useState(null);S.useEffect(()=>{(async()=>{dl(!0),Nt(null);try{const ne=await ze.getChatProviders();ne.data?.success?ul(ne.data.providers||[]):Nt(ne.data?.message||"Failed to load providers")}catch(ne){console.error("Failed to fetch providers:",ne),Nt("Failed to load providers. Using defaults.")}finally{dl(!1)}})()},[]);const vt=Kn.find($=>$.provider===(j.llm_provider||ko))?.models||[],hl=S.useMemo(()=>!j.llm_model||vt.some(ne=>ne.id===j.llm_model)?vt:[{id:j.llm_model,name:`${j.llm_model} (saved)`},...vt],[vt,j.llm_model]),zu=S.useMemo(()=>!j.llm_provider||j.llm_provider===ko||Kn.some(ne=>ne.provider===j.llm_provider)?Kn:[{provider:j.llm_provider,name:`${j.llm_provider} (saved)`,models:[]},...Kn],[Kn,j.llm_provider]),Lu=$=>{const ne=Kn.find(ke=>ke.provider===$);_(ke=>({...ke,llm_provider:$,llm_model:ne?.models?.[0]?.id||""}))},ur=async()=>{w(!0);try{const $=await ze.testLlm({llm_provider:j.llm_provider||void 0,llm_model:j.llm_model||void 0});$.data?.success?ae.success($.data.message):ae.error($.data?.message||"Connection failed")}catch($){ae.error($.response?.data?.message||"Connection failed")}finally{w(!1)}},[Ri,Oi]=S.useState(null),[Pt,ua]=S.useState(null);S.useEffect(()=>{e.fetchAccounts(),e.fetchRules(),e.fetchSettings()},[]),S.useEffect(()=>{n.settings&&_(n.settings)},[n.settings]);const da=S.useRef(null),Uu=()=>{M("credentials"),U(""),K(""),z(""),ie(""),N(!0)},fl=$=>{U($);try{const ne=JSON.parse($),ke=ne.installed||ne.web||ne;ke.client_id&&K(ke.client_id),ke.client_secret&&z(ke.client_secret),ne.installed?ae.success("Detected Desktop app credentials"):ne.web&&ae.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Di=async()=>{if(!F||!P){ae.error("Please provide both Client ID and Client Secret");return}de(!0);try{if(await e.updateSettings({...j,google_client_id:F,google_client_secret:P})){_(ke=>({...ke,google_client_id:F,google_client_secret:P}));const ne=await ze.getGmailAuthUrl();if(ne.data?.url)window.open(ne.data.url,"_blank"),M("code"),ae.success("Please authorize in the opened tab, then paste the code here");else{const ke=typeof ne.error=="string"?ne.error:ne.error?.message;ae.error(ke||"Failed to get OAuth URL")}}else ae.error("Failed to save credentials")}catch{ae.error("Failed to save credentials")}finally{de(!1)}},ha=async()=>{if(!Z.trim()){ae.error("Please paste the authorization code");return}Be(!0);try{const $=await ze.connectGmail(Z.trim());if($.data?.success)ae.success("Gmail account connected successfully!"),N(!1),e.fetchAccounts();else{const ne=typeof $.error=="string"?$.error:$.error?.message;ae.error(ne||"Failed to connect Gmail")}}catch{ae.error("Failed to connect Gmail")}finally{Be(!1)}},Pu=()=>{I("credentials"),_e(""),X(""),R(!0)},ml=async()=>{if(!he){ae.error("Please provide the Client ID");return}se(!0);try{if(await e.updateSettings({...j,microsoft_client_id:he,microsoft_tenant_id:O||"common"})){_(ke=>({...ke,microsoft_client_id:he,microsoft_tenant_id:O||"common"}));const ne=await ze.startMicrosoftDeviceFlow();if(ne.data)p(ne.data),I("device-code"),pl(ne.data.deviceCode,ne.data.interval);else{const ke=typeof ne.error=="string"?ne.error:ne.error?.message;ae.error(ke||"Failed to start device flow")}}else ae.error("Failed to save credentials")}catch{ae.error("Failed to save credentials")}finally{se(!1)}},pl=async($,ne)=>{const ke=setInterval(async()=>{try{const Vt=await ze.pollMicrosoftDeviceCode($);Vt.data?.status==="completed"?(clearInterval(ke),p(null),h(!1),R(!1),ae.success("Outlook account connected"),e.fetchAccounts()):Vt.error&&typeof Vt.error=="object"&&Vt.error.code}catch{}},ne*1e3);setTimeout(()=>{clearInterval(ke),d&&(p(null),h(!1),R(!1),ae.error("Connection timed out. Please try again."))},900*1e3)},gl=async()=>{if(!ge){ae.error("Please name your rule");return}if(En.length===0){ae.error("Please select at least one action");return}ca(!0);try{const $={[Ue]:Gt};la&&($.older_than_days=parseInt(la,10));const ne=En.includes("draft"),ke={name:ge,description:rr||void 0,intent:or||void 0,condition:$,actions:En,instructions:ne?ol:void 0,attachments:ne?cl:[],is_enabled:!0};let Vt=!1;Pt?Vt=await e.updateRule(Pt.id,ke):Vt=await e.createRule(ke),Vt?(ae.success(Pt?"Rule updated":"Rule created"),je(!1),ua(null),ot(""),Tn(["archive"]),ar(""),Ai(""),ir(""),ll(""),Tt([]),e.fetchRules()):ae.error(`Failed to ${Pt?"update":"create"} rule`)}catch{ae.error("An error occurred while saving the rule")}finally{ca(!1)}},Mi=async $=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await e.disconnectAccount($)&&ae.success("Account disconnected")},dr=async()=>{v(!0);const $=await e.updateSettings(j);v(!1),$&&ae.success("Settings saved")},yl=async $=>{const ne=$.target.files;if(!ne||ne.length===0)return;ki(!0);const ke=ne[0],Vt=ke.name.split(".").pop(),Vu=`${Math.random().toString(36).substring(2)}.${Vt}`,xl=`${n.user.id}/${Vu}`;try{const{error:fa}=await Ze.storage.from("rule-attachments").upload(xl,ke);if(fa)throw fa;const ma={name:ke.name,path:xl,type:ke.type,size:ke.size};Tt(zi=>[...zi,ma]),ae.success("File uploaded")}catch(fa){console.error("Upload error:",fa),ae.error("Failed to upload file")}finally{ki(!1),$.target.value=""}},vl=$=>{Tt(ne=>ne.filter(ke=>ke.path!==$))},Ln=$=>$==="gmail"?c.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"}):c.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 c.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[c.jsx(Ya,{open:T,onOpenChange:N,children:c.jsxs(Xa,{className:"sm:max-w-lg",children:[c.jsxs(Wa,{children:[c.jsxs(Ja,{className:"flex items-center gap-2",children:[c.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"}),a("config.gmail.connect")]}),c.jsx(Za,{children:a(A==="credentials"?"config.gmail.credentialsDesc":"config.gmail.authCodeDesc")})]}),A==="credentials"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(oN,{className:"w-4 h-4"}),a("config.gmail.pasteJson")]}),c.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:k,onChange:$=>fl($.target.value)}),c.jsx("p",{className:"text-xs text-muted-foreground",children:a("config.gmail.downloadHelp")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"absolute inset-0 flex items-center",children:c.jsx("span",{className:"w-full border-t"})}),c.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:c.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:a("config.gmail.orEnterManually")})})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),c.jsx(Ae,{placeholder:"xxx.apps.googleusercontent.com",value:F,onChange:$=>K($.target.value)})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),c.jsx(Ae,{type:"password",placeholder:"GOCSPX-...",value:P,onChange:$=>z($.target.value)})]})]})]}),c.jsxs(Ia,{children:[c.jsx(ee,{variant:"outline",onClick:()=>N(!1),children:a("common.cancel")}),c.jsxs(ee,{onClick:Di,disabled:be||!F||!P,children:[be?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(Ks,{className:"w-4 h-4 mr-2"}),a("common.save")," & ",a("setup.engage")]})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:c.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["1. A new tab opened with Google Sign-In",c.jsx("br",{}),"2. Sign in and authorize the app",c.jsx("br",{}),"3. Copy the authorization code shown",c.jsx("br",{}),"4. Paste it below"]})}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Authorization Code"}),c.jsx(Ae,{placeholder:"4/0AQlEd8x...",value:Z,onChange:$=>ie($.target.value),className:"font-mono"})]})]}),c.jsxs(Ia,{children:[c.jsx(ee,{variant:"outline",onClick:()=>M("credentials"),children:a("setup.back")}),c.jsxs(ee,{onClick:ha,disabled:qe||!Z.trim(),children:[qe?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(Ks,{className:"w-4 h-4 mr-2"}),a("setup.engage")]})]})]})]})}),c.jsx(Ya,{open:te,onOpenChange:R,children:c.jsxs(Xa,{className:"sm:max-w-lg",children:[c.jsxs(Wa,{children:[c.jsxs(Ja,{className:"flex items-center gap-2",children:[c.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"}),a("config.outlook.connect")]}),c.jsx(Za,{children:a(q==="credentials"?"config.outlook.credentialsDesc":"config.outlook.instructions")})]}),q==="credentials"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsx("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:c.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"Note: You need an Azure App Registration for this to work."})}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Client ID (Application ID)"}),c.jsx(Ae,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:he,onChange:$=>_e($.target.value)})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),c.jsx(Ae,{placeholder:"common",value:O,onChange:$=>X($.target.value)}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:'Default is "common". Use your specific Tenant ID for organization accounts.'})]})]})]}),c.jsxs(Ia,{children:[c.jsx(ee,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),c.jsxs(ee,{onClick:ml,disabled:Q||!he,children:[Q?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(Ks,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):c.jsxs(c.Fragment,{children:[m&&c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[c.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Action Required"}),c.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:m.message}),c.jsxs("div",{className:"flex flex-col gap-3",children:[c.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:c.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:m.userCode})}),c.jsxs(ee,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(m.verificationUri,"_blank"),children:["Open Microsoft Login",c.jsx(Bo,{className:"w-4 h-4 ml-2"})]})]})]}),c.jsx("div",{className:"flex justify-center",children:c.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[c.jsx(pt,{size:"sm"}),"Waiting for authorization..."]})})]}),c.jsx(Ia,{children:c.jsx(ee,{variant:"outline",onClick:()=>R(!1),children:"Cancel"})})]})]})}),c.jsx(Ya,{open:we,onOpenChange:$=>{je($),$||ua(null)},children:c.jsxs(Xa,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[c.jsxs(Wa,{className:"p-6 border-b",children:[c.jsx(Ja,{children:a(Pt?"config.rules.edit":"config.rules.create")}),c.jsx(Za,{children:a("config.rules.desc")})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.rules.name")}),c.jsx(Ae,{placeholder:a("config.rules.namePlaceholder"),value:ge,onChange:$=>ot($.target.value)})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.rules.description")}),c.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:a("config.rules.descriptionPlaceholder"),value:rr,onChange:$=>ir($.target.value)}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("config.rules.semanticHelp")})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.rules.intent")}),c.jsx(Ae,{placeholder:a("config.rules.intentPlaceholder"),value:or,onChange:$=>ll($.target.value)}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("config.rules.intentHelp")})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.rules.conditionField")}),c.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ue,onChange:$=>{un($.target.value),$.target.value==="category"?Et("newsletter"):$.target.value==="sentiment"?Et("Positive"):$.target.value==="priority"?Et("High"):Et("")},children:[c.jsxs("optgroup",{label:a("config.rules.aiAnalysis"),children:[c.jsx("option",{value:"category",children:a("config.rules.category")}),c.jsx("option",{value:"sentiment",children:a("config.rules.sentiment")}),c.jsx("option",{value:"priority",children:a("config.rules.priority")})]}),c.jsxs("optgroup",{label:a("config.rules.metadata"),children:[c.jsx("option",{value:"sender_email",children:a("config.rules.senderEmail")}),c.jsx("option",{value:"sender_domain",children:a("config.rules.senderDomain")}),c.jsx("option",{value:"sender_contains",children:a("config.rules.senderContains")}),c.jsx("option",{value:"subject_contains",children:a("config.rules.subjectContains")}),c.jsx("option",{value:"body_contains",children:a("config.rules.bodyContains")})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.rules.equalsValue")}),Ue==="category"?c.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Gt,onChange:$=>Et($.target.value),children:[c.jsx("option",{value:"newsletter",children:"Newsletter"}),c.jsx("option",{value:"spam",children:"Spam"}),c.jsx("option",{value:"promotional",children:"Promotional"}),c.jsx("option",{value:"transactional",children:"Transactional"}),c.jsx("option",{value:"social",children:"Social"}),c.jsx("option",{value:"support",children:"Support"}),c.jsx("option",{value:"client",children:"Client"}),c.jsx("option",{value:"internal",children:"Internal"}),c.jsx("option",{value:"personal",children:"Personal"}),c.jsx("option",{value:"other",children:"Other"})]}):Ue==="sentiment"?c.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Gt,onChange:$=>Et($.target.value),children:[c.jsx("option",{value:"Positive",children:"Positive"}),c.jsx("option",{value:"Neutral",children:"Neutral"}),c.jsx("option",{value:"Negative",children:"Negative"})]}):Ue==="priority"?c.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Gt,onChange:$=>Et($.target.value),children:[c.jsx("option",{value:"High",children:"High"}),c.jsx("option",{value:"Medium",children:"Medium"}),c.jsx("option",{value:"Low",children:"Low"})]}):c.jsx(Ae,{placeholder:Ue==="sender_domain"?"rta.vn":Ue==="sender_email"?"john@example.com":a("config.rules.keywordsPlaceholder"),value:Gt,onChange:$=>Et($.target.value)})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(Qa,{className:"w-4 h-4"}),a("config.rules.olderThan")]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Ae,{type:"number",min:"0",placeholder:"0",className:"w-24",value:la,onChange:$=>ar($.target.value)}),c.jsx("span",{className:"text-sm text-muted-foreground",children:"days"})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("config.rules.olderThanHelp")})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.rules.performActions")}),c.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Select one or more actions to execute when the rule matches"}),c.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"archive",label:a("common.archive")},{value:"delete",label:a("common.delete")},{value:"draft",label:a("common.draft")},{value:"star",label:a("common.star")}].map($=>c.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${En.includes($.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[c.jsx("input",{type:"checkbox",checked:En.includes($.value),onChange:ne=>{ne.target.checked?Tn([...En,$.value]):Tn(En.filter(ke=>ke!==$.value))},className:"rounded border-gray-300"}),c.jsx("span",{className:"text-sm",children:$.label})]},$.value))})]}),En.includes("draft")&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.rules.draftInstructions")}),c.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:ol,onChange:$=>Ai($.target.value)}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("config.rules.contextHelp")})]}),c.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[c.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(Lb,{className:"w-4 h-4"}),"Attachments (Optional)"]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[cl.map($=>c.jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary/50 rounded border text-xs",children:[c.jsx("span",{className:"truncate max-w-[200px]",children:$.name}),c.jsx(ee,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>vl($.path),children:c.jsx(ra,{className:"w-3 h-3"})})]},$.path)),c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:yl,disabled:lr}),c.jsxs(ee,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:lr,children:[lr?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(qa,{className:"w-3 h-3 mr-2"}),a(lr?"config.rules.uploading":"config.rules.addAttachment")]})]})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("config.rules.attachmentHelp")})]})]})]}),c.jsxs(Ia,{className:"p-6 border-t bg-secondary/5",children:[c.jsx(ee,{variant:"outline",onClick:()=>je(!1),children:a("common.cancel")}),c.jsxs(ee,{onClick:gl,disabled:Ci,children:[Ci?c.jsx(pt,{size:"sm",className:"mr-2"}):Pt?c.jsx(Ks,{className:"w-4 h-4 mr-2"}):c.jsx(qa,{className:"w-4 h-4 mr-2"}),a(Pt?"config.rules.saveChanges":"config.rules.createRule")]})]})]})}),c.jsxs(It,{children:[c.jsxs(Zs,{children:[c.jsxs(Qs,{className:"flex items-center gap-2",children:[c.jsx(fi,{className:"w-5 h-5 text-primary"}),a("config.accounts.title")]}),c.jsx(Fa,{children:a("config.accounts.desc")})]}),c.jsx(ea,{children:c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-semibold mb-3",children:a("config.accounts.addNew")}),c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx(ee,{className:"w-full border-dashed justify-start h-auto py-4",variant:"outline",onClick:Uu,disabled:i||d,children:c.jsxs("div",{className:"flex items-center gap-3 w-full",children:[c.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 shrink-0",children:"G"}),c.jsxs("div",{className:"flex-1 text-left",children:[c.jsx("div",{className:"font-medium",children:"Gmail"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:a("config.gmail.connectDesc")})]}),i?c.jsx(pt,{size:"sm"}):c.jsx(qa,{className:"w-5 h-5 shrink-0"})]})}),c.jsx(ee,{className:"w-full border-dashed justify-start h-auto py-4",variant:"outline",onClick:Pu,disabled:i||d,children:c.jsxs("div",{className:"flex items-center gap-3 w-full",children:[c.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 shrink-0",children:"O"}),c.jsxs("div",{className:"flex-1 text-left",children:[c.jsx("div",{className:"font-medium",children:"Outlook"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:a("config.outlook.connectDesc")})]}),d&&!m?c.jsx(pt,{size:"sm"}):c.jsx(qa,{className:"w-5 h-5 shrink-0"})]})})]})]}),m&&c.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:[c.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:a("config.outlook.signinRequired")}),c.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:m.message}),c.jsxs("div",{className:"flex flex-col gap-3",children:[c.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:c.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:m.userCode})}),c.jsxs(ee,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(m.verificationUri,"_blank"),children:["Open Microsoft Login",c.jsx(Bo,{className:"w-4 h-4 ml-2"})]}),c.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:a("config.outlook.waitingSignin")})]})]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("h3",{className:"text-sm font-semibold mb-3",children:a("config.accounts.yourAccounts")}),n.accounts.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 border-2 border-dashed rounded-lg",children:[c.jsx(fi,{className:"w-12 h-12 text-muted-foreground/40 mb-3"}),c.jsx("p",{className:"text-sm text-muted-foreground text-center",children:a("config.accounts.noAccounts")}),c.jsx("p",{className:"text-xs text-muted-foreground text-center mt-1",children:a("config.accounts.connectHelp")})]}):c.jsx("div",{className:"space-y-3",children:n.accounts.map($=>c.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-card hover:bg-secondary/30 transition-colors",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[Ln($.provider),c.jsxs("div",{children:[c.jsx("h4",{className:"font-medium capitalize",children:$.provider}),c.jsx("p",{className:"text-xs text-muted-foreground",children:$.email_address})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[$.is_active?c.jsx("span",{className:"text-xs text-emerald-600 bg-emerald-500/10 px-2 py-1 rounded-full",children:a("common.active")}):c.jsx("span",{className:"text-xs text-yellow-600 bg-yellow-500/10 px-2 py-1 rounded-full",children:a("common.inactive")}),c.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",onClick:()=>Mi($.id),title:a("config.accounts.disconnect"),children:c.jsx(_u,{className:"w-4 h-4"})})]})]},$.id))})]})]})})]}),c.jsxs(It,{children:[c.jsxs(Zs,{children:[c.jsxs(Qs,{className:"flex items-center gap-2",children:[c.jsx(Zt,{className:"w-5 h-5 text-indigo-500"}),a("config.model.title")]}),c.jsx(Fa,{children:a("config.model.desc")})]}),c.jsxs(ea,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.model.provider")}),cr?c.jsxs("div",{className:"h-10 border rounded-md flex items-center px-3 bg-muted/20",children:[c.jsx(pt,{size:"sm",className:"mr-2"}),c.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Discovering..."})]}):c.jsxs(c.Fragment,{children:[c.jsxs("select",{className:"w-full h-10 px-3 border rounded-md bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary",value:j.llm_provider||ko,onChange:$=>Lu($.target.value),disabled:cr,children:[c.jsx("option",{value:ko,children:"RealTimeX AI (Default)"}),zu.filter($=>$.provider!==ko).map($=>c.jsx("option",{value:$.provider,children:$.name||$.provider},$.provider))]}),bs&&c.jsxs("div",{className:"text-[10px] text-amber-500 mt-1 px-1 bg-amber-50/50 rounded",children:["⚠️ ",bs]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:a("config.model.name")}),hl.length>0||cr?c.jsxs("select",{className:"w-full h-10 px-3 border rounded-md bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary",value:j.llm_model||"",onChange:$=>_(ne=>({...ne,llm_model:$.target.value})),disabled:cr,children:[!j.llm_model&&c.jsx("option",{value:"",children:a("config.model.selectModel")}),hl.map($=>c.jsx("option",{value:$.id,children:$.name||$.id},$.id))]}):c.jsx(Ae,{placeholder:"e.g. gpt-4o-mini",value:j.llm_model||"",onChange:$=>_(ne=>({...ne,llm_model:$.target.value}))})]})]}),c.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[c.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(fi,{className:"w-4 h-4"}),a("config.model.storagePath")]}),c.jsx(Ae,{placeholder:a("config.model.storagePlaceholder"),value:j.storage_path||"",onChange:$=>_(ne=>({...ne,storage_path:$.target.value}))}),c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:a("config.model.storageHelp")})]}),c.jsxs("div",{className:"flex justify-between items-center py-3 border-t border-border/50",children:[c.jsxs("div",{children:[c.jsx("h4",{className:"font-medium text-sm",children:a("config.model.intelligentRename")}),c.jsx("p",{className:"text-xs text-muted-foreground",children:a("config.model.renameHelp")})]}),c.jsxs(ee,{variant:j.intelligent_rename?"default":"outline",size:"sm",onClick:()=>_($=>({...$,intelligent_rename:!$.intelligent_rename})),children:[c.jsx(Ub,{className:"w-4 h-4 mr-1"}),j.intelligent_rename?a("common.enabled"):a("common.disabled")]})]}),c.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[c.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(Qa,{className:"w-4 h-4"}),a("config.model.syncInterval")]}),c.jsx(Ae,{type:"number",min:1,max:1440,value:j.sync_interval_minutes||5,onChange:$=>_(ne=>({...ne,sync_interval_minutes:parseInt($.target.value,10)||5}))}),c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:a("config.model.syncHelp")})]}),c.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[c.jsxs(ee,{variant:"outline",onClick:ur,disabled:x,children:[x?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(Zt,{className:"w-4 h-4 mr-2"}),a("config.model.checkConnection")]}),c.jsxs(ee,{onClick:dr,disabled:y,children:[y?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(Ks,{className:"w-4 h-4 mr-2"}),a("config.model.saveConfig")]})]})]})]}),c.jsx("div",{ref:da,children:c.jsxs(It,{children:[c.jsxs(Zs,{children:[c.jsxs(Qs,{className:"flex items-center gap-2",children:[c.jsx(Vb,{className:"w-5 h-5 text-orange-500"}),a("config.byok.title")]}),c.jsxs(Fa,{children:[a("config.byok.desc"),a("config.byok.systemDefault")]})]}),c.jsxs(ea,{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-4 border-b pb-4",children:[c.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Google / Gmail"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),c.jsx(Ae,{type:"password",placeholder:"...apps.googleusercontent.com",value:j.google_client_id||"",onChange:$=>_(ne=>({...ne,google_client_id:$.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),c.jsx(Ae,{type:"password",placeholder:"GOCSPX-...",value:j.google_client_secret||"",onChange:$=>_(ne=>({...ne,google_client_secret:$.target.value}))})]})]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500"})," Microsoft / Outlook"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),c.jsx(Ae,{type:"password",value:j.microsoft_client_id||"",onChange:$=>_(ne=>({...ne,microsoft_client_id:$.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),c.jsx(Ae,{type:"password",value:j.microsoft_client_secret||"",onChange:$=>_(ne=>({...ne,microsoft_client_secret:$.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),c.jsx(Ae,{placeholder:"common",value:j.microsoft_tenant_id||"",onChange:$=>_(ne=>({...ne,microsoft_tenant_id:$.target.value}))})]})]})]}),c.jsx("div",{className:"flex justify-end mt-4",children:c.jsxs(ee,{onClick:dr,disabled:y,variant:"secondary",children:[y?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(Ks,{className:"w-4 h-4 mr-2"}),a("config.byok.save")]})})]})]})})]})}function E3(){const{t:n}=yt(),[e,a]=S.useState("profile"),{state:i,actions:l}=ia();S.useEffect(()=>{l.fetchProfile()},[]);const d=[{id:"profile",label:n("account.profile"),icon:Ib},{id:"security",label:n("account.security"),icon:Bb},{id:"database",label:n("account.database"),icon:fi}];return c.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 animate-in fade-in duration-500",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:n("account.title")}),c.jsx("p",{className:"text-muted-foreground",children:n("account.subtitle")})]}),c.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[c.jsxs("aside",{className:"w-full md:w-64 flex flex-col justify-between",children:[c.jsx("nav",{className:"space-y-1",children:d.map(h=>{const m=h.icon,p=e===h.id;return c.jsxs("button",{onClick:()=>a(h.id),className:`w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors ${p?"bg-primary text-primary-foreground":"hover:bg-secondary text-muted-foreground"}`,children:[c.jsx(m,{className:"w-4 h-4"}),h.label]},h.id)})}),c.jsxs("div",{className:"mt-auto space-y-1",children:[c.jsxs("button",{onClick:async()=>{await Ze.auth.signOut(),ae.success(n("account.logoutSuccess")),window.location.reload()},className:"w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors hover:bg-destructive/10 text-destructive",children:[c.jsx(TT,{className:"w-4 h-4"}),n("account.logout")]}),c.jsxs("div",{className:"px-4 py-4 border-t border-border/40 text-center md:text-left",children:[c.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-widest mb-1",children:n("account.version")}),c.jsxs("p",{className:"text-xs font-mono text-muted-foreground/70",children:["v","2.19.0"]})]})]})]}),c.jsxs("div",{className:"flex-1 space-y-6",children:[e==="profile"&&c.jsx(T3,{}),e==="security"&&c.jsx(N3,{}),e==="database"&&c.jsx(A3,{})]})]})]})}function T3(){const{t:n}=yt(),{state:e,actions:a}=ia(),[i,l]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[y,v]=S.useState(!1),[x,w]=S.useState($n.isEnabled());S.useEffect(()=>{e.profile&&(l(e.profile.first_name||""),h(e.profile.last_name||""))},[e.profile]);const j=()=>{const N=!x;$n.setEnabled(N),w(N),N?($n.playSuccess(),ae.success(n("account.profile.soundsEnabled"))):ae.info(n("account.profile.soundsDisabled"))},_=async()=>{p(!0);const N=await a.updateProfile({first_name:i,last_name:d});p(!1),N&&ae.success(n("account.profile.updated"))},T=async N=>{const A=N.target.files?.[0];if(!(!A||!e.user)){v(!0);try{const M=A.name.split(".").pop(),k=`${e.user.id}/avatar.${M}`,{data:U,error:F}=await Ze.storage.from("avatars").upload(k,A,{upsert:!0});if(F)throw F;const{data:{publicUrl:K}}=Ze.storage.from("avatars").getPublicUrl(k);await a.updateProfile({avatar_url:K}),ae.success(n("account.profile.avatarUpdated"))}catch(M){console.error("Avatar upload error:",M),ae.error(n("account.profile.avatarError"))}finally{v(!1)}}};return c.jsxs(It,{children:[c.jsxs(Zs,{children:[c.jsx(Qs,{children:n("account.profile.title")}),c.jsx(Fa,{children:n("account.profile.desc")})]}),c.jsxs(ea,{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col items-center sm:flex-row sm:items-start gap-6",children:[c.jsxs("div",{className:"relative group",children:[c.jsx("div",{className:"w-24 h-24 rounded-full bg-secondary overflow-hidden border-2 border-border flex items-center justify-center",children:e.profile?.avatar_url?c.jsx("img",{src:e.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):c.jsx(Ib,{className:"w-12 h-12 text-muted-foreground"})}),c.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:[c.jsx(IE,{className:"w-6 h-6 text-white"}),c.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:T,disabled:y})]}),y&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:c.jsx(pt,{size:"sm"})})]}),c.jsxs("div",{className:"flex-1 space-y-4 w-full",children:[c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ht,{htmlFor:"first-name",children:n("account.profile.firstName")}),c.jsx(Ae,{id:"first-name",value:i,onChange:N=>l(N.target.value),placeholder:n("account.profile.firstNamePlaceholder")})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ht,{htmlFor:"last-name",children:n("account.profile.lastName")}),c.jsx(Ae,{id:"last-name",value:d,onChange:N=>h(N.target.value),placeholder:n("account.profile.lastNamePlaceholder")})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ht,{htmlFor:"email",children:n("account.profile.email")}),c.jsx(Ae,{id:"email",value:e.profile?.email||"",disabled:!0,className:"bg-secondary/50"}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:n("account.profile.emailHelp")})]})]})]}),c.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[c.jsxs("div",{className:"space-y-0.5",children:[c.jsx("label",{className:"text-sm font-medium",children:n("account.profile.sounds")}),c.jsx("p",{className:"text-xs text-muted-foreground",children:n("account.profile.soundsHelp")})]}),c.jsxs(ee,{variant:x?"default":"outline",size:"sm",onClick:j,className:"gap-2",children:[x?c.jsx(hN,{className:"w-4 h-4"}):c.jsx(mN,{className:"w-4 h-4"}),n(x?"common.enabled":"common.disabled")]})]}),c.jsx("div",{className:"flex justify-end pt-4 border-t",children:c.jsxs(ee,{onClick:_,disabled:m,children:[m?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(qT,{className:"w-4 h-4 mr-2"}),n("common.saveChanges")]})})]})]})}function N3(){const{t:n}=yt(),[e,a]=S.useState(""),[i,l]=S.useState(""),[d,h]=S.useState(!1),m=async()=>{if(!e){ae.error(n("account.security.enterPassword"));return}if(e!==i){ae.error(n("account.security.passwordsMismatch"));return}if(e.length<6){ae.error(n("account.security.passwordTooShort"));return}h(!0);try{const{api:p}=await Pa(async()=>{const{api:v}=await Promise.resolve().then(()=>eC);return{api:v}},void 0),y=await p.changePassword(e);y.success?(ae.success(n("account.security.passwordChanged")),a(""),l("")):ae.error(y.error?.message||"Failed to change password")}catch{ae.error(n("common.errorOccurred"))}finally{h(!1)}};return c.jsxs(It,{children:[c.jsxs(Zs,{children:[c.jsx(Qs,{children:n("account.security.title")}),c.jsx(Fa,{children:n("account.security.desc")})]}),c.jsxs(ea,{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ht,{htmlFor:"new-password",children:n("account.security.newPassword")}),c.jsx(Ae,{id:"new-password",type:"password",value:e,onChange:p=>a(p.target.value),placeholder:"••••••••"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ht,{htmlFor:"confirm-password",children:n("account.security.confirmPassword")}),c.jsx(Ae,{id:"confirm-password",type:"password",value:i,onChange:p=>l(p.target.value),placeholder:"••••••••"})]}),c.jsx("div",{className:"flex justify-end pt-4 border-t",children:c.jsxs(ee,{onClick:m,disabled:d,children:[d?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(Am,{className:"w-4 h-4 mr-2"}),n("account.security.updatePassword")]})})]})]})}function A3(){const{t:n}=yt(),[e,a]=S.useState(!1),[i,l]=S.useState(null),d=ji(),h=Jk();S.useEffect(()=>{d&&mp(Ze).then(l)},[]);const m=()=>{confirm(n("account.database.clearConfirm"))&&(Xk(),window.location.reload())};return c.jsxs(c.Fragment,{children:[c.jsxs(It,{children:[c.jsxs(Zs,{children:[c.jsxs(Qs,{className:"flex items-center gap-2",children:[c.jsx(fi,{className:"w-5 h-5 text-primary"}),n("account.database.title")]}),c.jsx(Fa,{children:n("account.database.desc")})]}),c.jsx(ea,{className:"space-y-6",children:d?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-xl bg-emerald-500/5 border-emerald-500/20",children:[c.jsx(ru,{className:"w-6 h-6 text-emerald-500 mt-0.5"}),c.jsxs("div",{className:"flex-1 space-y-1",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("p",{className:"font-semibold text-emerald-700 dark:text-emerald-400",children:n("account.database.connected")}),i?.latestMigrationTimestamp&&c.jsxs("span",{className:"text-[10px] font-mono bg-emerald-500/10 text-emerald-600 px-1.5 py-0.5 rounded border border-emerald-500/20",title:"Database Schema Version",children:["Schema ",i.latestMigrationTimestamp]})]}),c.jsx("p",{className:"text-sm font-mono break-all opacity-80",children:d.url})]})]}),h==="env"&&c.jsxs(er,{className:"bg-amber-500/5 border-amber-500/20",children:[c.jsx(qo,{className:"h-4 w-4 text-amber-500"}),c.jsx(tr,{className:"text-amber-700 dark:text-amber-400 text-xs",children:n("account.database.envAlert")})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs(ee,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[c.jsx(qo,{className:"w-4 h-4 mr-2"}),n("account.database.changeConnection")]}),h==="ui"&&c.jsxs(ee,{variant:"outline",onClick:m,className:"w-full text-destructive hover:bg-destructive/10",children:[c.jsx(_u,{className:"w-4 h-4 mr-2"}),n("account.database.clearConfig")]})]}),c.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[c.jsx(Ht,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:n("account.database.anonKey")}),c.jsxs("div",{className:"p-2 bg-secondary/50 rounded-lg font-mono text-xs break-all",children:[d.anonKey.substring(0,20),"...",d.anonKey.substring(d.anonKey.length-10)]})]})]}):c.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center space-y-4",children:[c.jsx(nT,{className:"w-12 h-12 text-destructive opacity-20"}),c.jsxs("div",{children:[c.jsx("p",{className:"font-medium",children:n("account.database.noConnection")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:n("account.database.configureHelp")})]}),c.jsxs(ee,{onClick:()=>a(!0),children:[c.jsx(fi,{className:"w-4 h-4 mr-2"}),n("account.database.setup")]})]})})]}),c.jsx(wS,{open:e,onComplete:()=>a(!1),canClose:!0})]})}function Ab({rules:n,onToggleRule:e,onEditRule:a,onDeleteRule:i}){const{t:l}=yt(),d={email_organization:{label:l("autopilot.category.email_organization.label"),icon:Io,emoji:"📧",description:l("autopilot.category.email_organization.desc")},priority_alerts:{label:l("autopilot.category.priority_alerts.label"),icon:Fn,emoji:"🚨",description:l("autopilot.category.priority_alerts.desc")},development:{label:l("autopilot.category.development.label"),icon:ps,emoji:"💻",description:l("autopilot.category.development.desc")},sales_business:{label:l("autopilot.category.sales_business.label"),icon:UE,emoji:"💼",description:l("autopilot.category.sales_business.desc")},operations:{label:l("autopilot.category.operations.label"),icon:qo,emoji:"⚙️",description:l("autopilot.category.operations.desc")}},h=n.reduce((y,v)=>{const x=v.category||"email_organization";return y[x]||(y[x]=[]),y[x].push(v),y},{}),m=y=>{const v=y.filter(w=>w.is_enabled).length,x=y.length;return{enabled:v,total:x}},p=y=>!y||y.length===0?"":y.map(v=>v.startsWith("label:")?`label:${v.substring(6)}`:v).join(" + ");return c.jsx("div",{className:"space-y-8",children:Object.entries(d).map(([y,v])=>{const x=h[y]||[];if(x.length===0)return null;const w=m(x);return c.jsxs("div",{className:"space-y-3",children:[c.jsx("div",{className:"flex items-center justify-between",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-10 h-10 rounded-lg bg-secondary/50 flex items-center justify-center",children:c.jsx("span",{className:"text-xl",children:v.emoji})}),c.jsxs("div",{children:[c.jsxs("h3",{className:"font-semibold text-base flex items-center gap-2",children:[v.label,c.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:l("autopilot.enabledCount").replace("{enabled}",w.enabled.toString()).replace("{total}",w.total.toString())})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:v.description})]})]})}),c.jsx("div",{className:"space-y-1",children:x.map(j=>c.jsxs("div",{className:"flex items-center justify-between py-3 px-4 rounded-lg hover:bg-secondary/30 transition-colors",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h4",{className:"font-medium text-sm truncate",children:j.name}),j.is_system_managed&&c.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 shrink-0",children:l("autopilot.badge")})]}),c.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[j.intent&&c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:j.intent}),j.actions&&j.actions.length>0&&c.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["→ ",p(j.actions)]})]})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[c.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>a(j.id),title:l("autopilot.editRuleTooltip"),children:c.jsx(MT,{className:"w-4 h-4 text-muted-foreground"})}),c.jsxs(ee,{variant:j.is_enabled?"default":"outline",size:"sm",onClick:()=>e(j.id,!j.is_enabled),className:"h-8 px-3",children:[c.jsx(Ub,{className:"w-4 h-4 mr-1"}),j.is_enabled?l("common.on"):l("common.off")]}),!j.is_system_managed&&i&&c.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",onClick:()=>i(j.id),title:l("autopilot.deleteRuleTooltip"),children:c.jsx(_u,{className:"w-4 h-4"})})]})]},j.id))})]},y)})})}function k3({open:n,rule:e,onClose:a,onSave:i,onFileUpload:l,onRemoveAttachment:d}){const{t:h}=yt(),[m,p]=S.useState(!1),[y,v]=S.useState(!1),[x,w]=S.useState(""),[j,_]=S.useState(""),[T,N]=S.useState(""),[A,M]=S.useState("category"),[k,U]=S.useState("newsletter"),[F,K]=S.useState(""),[P,z]=S.useState(["archive"]),[Z,ie]=S.useState(""),[be,de]=S.useState([]);S.useEffect(()=>{if(e){w(e.name||""),_(e.description||""),N(e.intent||""),z(e.actions||["archive"]),ie(e.instructions||""),de(e.attachments||[]);const R=e.condition||{},q=Object.keys(R).filter(I=>I!=="older_than_days");q.length>0&&(M(q[0]),U(R[q[0]])),R.older_than_days&&K(String(R.older_than_days))}else w(""),_(""),N(""),M("category"),U("newsletter"),K(""),z(["archive"]),ie(""),de([])},[e,n]);const qe=async()=>{if(x.trim()&&P.length!==0){p(!0);try{const R={[A]:k};F&&(R.older_than_days=parseInt(F,10));const q=P.includes("draft"),I={name:x.trim(),description:j.trim()||void 0,intent:T.trim()||void 0,condition:R,actions:P,instructions:q?Z:void 0,attachments:q?be:[],is_enabled:!0};await i(I)&&a()}finally{p(!1)}}},Be=async R=>{if(!l)return;const q=R.target.files;if(!(!q||q.length===0)){v(!0);try{const I=await l(q[0]);I&&de(he=>[...he,I])}finally{v(!1),R.target.value=""}}},te=R=>{de(q=>q.filter(I=>I.path!==R)),d&&d(R)};return c.jsx(Ya,{open:n,onOpenChange:R=>!R&&a(),children:c.jsxs(Xa,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[c.jsxs(Wa,{className:"p-6 border-b",children:[c.jsx(Ja,{children:h(e?"autopilot.editDialog.editTitle":"autopilot.editDialog.createTitle")}),c.jsx(Za,{children:h("autopilot.editDialog.desc")})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:h("autopilot.editDialog.ruleName")}),c.jsx(Ae,{placeholder:h("autopilot.editDialog.namePlaceholder"),value:x,onChange:R=>w(R.target.value)})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:h("autopilot.editDialog.description")}),c.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:h("autopilot.editDialog.descPlaceholder"),value:j,onChange:R=>_(R.target.value)}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("autopilot.editDialog.descriptionHelp")})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:h("autopilot.editDialog.intent")}),c.jsx(Ae,{placeholder:h("autopilot.editDialog.intentPlaceholder"),value:T,onChange:R=>N(R.target.value)}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("autopilot.editDialog.intentHelp")})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:h("autopilot.editDialog.conditionField")}),c.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:A,onChange:R=>{M(R.target.value),R.target.value==="category"?U("newsletter"):R.target.value==="sentiment"?U("Positive"):R.target.value==="priority"?U("High"):U("")},children:[c.jsxs("optgroup",{label:h("autopilot.editDialog.aiAnalysisGroup"),children:[c.jsx("option",{value:"category",children:h("autopilot.editDialog.category")}),c.jsx("option",{value:"sentiment",children:h("autopilot.editDialog.sentiment")}),c.jsx("option",{value:"priority",children:h("autopilot.editDialog.priority")})]}),c.jsxs("optgroup",{label:h("autopilot.editDialog.metadataGroup"),children:[c.jsx("option",{value:"sender_email",children:h("autopilot.editDialog.senderEmail")}),c.jsx("option",{value:"sender_domain",children:h("autopilot.editDialog.senderDomain")}),c.jsx("option",{value:"sender_contains",children:h("autopilot.editDialog.senderContains")}),c.jsx("option",{value:"subject_contains",children:h("autopilot.editDialog.subjectContains")}),c.jsx("option",{value:"body_contains",children:h("autopilot.editDialog.bodyContains")})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:h("autopilot.editDialog.equalsValue")}),A==="category"?c.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:k,onChange:R=>U(R.target.value),children:[c.jsx("option",{value:"newsletter",children:h("autopilot.editDialog.cat.newsletter")}),c.jsx("option",{value:"spam",children:h("autopilot.editDialog.cat.spam")}),c.jsx("option",{value:"promotional",children:h("autopilot.editDialog.cat.promotional")}),c.jsx("option",{value:"transactional",children:h("autopilot.editDialog.cat.transactional")}),c.jsx("option",{value:"social",children:h("autopilot.editDialog.cat.social")}),c.jsx("option",{value:"support",children:h("autopilot.editDialog.cat.support")}),c.jsx("option",{value:"client",children:h("autopilot.editDialog.cat.client")}),c.jsx("option",{value:"internal",children:h("autopilot.editDialog.cat.internal")}),c.jsx("option",{value:"personal",children:h("autopilot.editDialog.cat.personal")}),c.jsx("option",{value:"other",children:h("autopilot.editDialog.cat.other")})]}):A==="sentiment"?c.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:k,onChange:R=>U(R.target.value),children:[c.jsx("option",{value:"Positive",children:h("autopilot.editDialog.sent.positive")}),c.jsx("option",{value:"Neutral",children:h("autopilot.editDialog.sent.neutral")}),c.jsx("option",{value:"Negative",children:h("autopilot.editDialog.sent.negative")})]}):A==="priority"?c.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:k,onChange:R=>U(R.target.value),children:[c.jsx("option",{value:"High",children:h("autopilot.editDialog.prio.high")}),c.jsx("option",{value:"Medium",children:h("autopilot.editDialog.prio.medium")}),c.jsx("option",{value:"Low",children:h("autopilot.editDialog.prio.low")})]}):c.jsx(Ae,{placeholder:A==="sender_domain"?"rta.vn":A==="sender_email"?"john@example.com":h("autopilot.editDialog.keywordsPlaceholder"),value:k,onChange:R=>U(R.target.value)})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(Qa,{className:"w-4 h-4"}),h("autopilot.editDialog.olderThan")]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Ae,{type:"number",min:"0",placeholder:"0",className:"w-24",value:F,onChange:R=>K(R.target.value)}),c.jsx("span",{className:"text-sm text-muted-foreground",children:h("autopilot.editDialog.days")})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("autopilot.editDialog.olderThanHelp")})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium",children:h("autopilot.editDialog.performActions")}),c.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:h("autopilot.editDialog.actionsDesc")}),c.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"archive",label:h("autopilot.editDialog.action.archive")},{value:"delete",label:h("autopilot.editDialog.action.delete")},{value:"draft",label:h("autopilot.editDialog.action.draft")},{value:"star",label:h("autopilot.editDialog.action.star")}].map(R=>c.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${P.includes(R.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[c.jsx("input",{type:"checkbox",checked:P.includes(R.value),onChange:q=>{q.target.checked?z([...P,R.value]):z(P.filter(I=>I!==R.value))},className:"rounded border-gray-300"}),c.jsx("span",{className:"text-sm",children:R.label})]},R.value))})]}),P.includes("draft")&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[c.jsx("label",{className:"text-sm font-medium",children:h("autopilot.editDialog.draftInstructions")}),c.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[80px] text-sm",placeholder:h("autopilot.editDialog.draftInstPlaceholder"),value:Z,onChange:R=>ie(R.target.value)}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("autopilot.editDialog.draftInstHelp")})]}),l&&c.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[c.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(Lb,{className:"w-4 h-4"}),h("autopilot.editDialog.attachments")]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[be.map(R=>c.jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary/50 rounded border text-xs",children:[c.jsx("span",{className:"truncate max-w-[200px]",children:R.name}),c.jsx(ee,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>te(R.path),children:c.jsx(ra,{className:"w-3 h-3"})})]},R.path)),c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:Be,disabled:y}),c.jsxs(ee,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:y,children:[y?c.jsx(pt,{size:"sm",className:"mr-2"}):c.jsx(qa,{className:"w-3 h-3 mr-2"}),h(y?"autopilot.editDialog.uploading":"autopilot.editDialog.addAttachment")]})]})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("autopilot.editDialog.attachmentsHelp")})]})]})]}),c.jsxs(Ia,{className:"p-6 border-t bg-secondary/5",children:[c.jsx(ee,{variant:"outline",onClick:a,children:h("common.cancel")}),c.jsxs(ee,{onClick:qe,disabled:m||!x.trim()||P.length===0,children:[m?c.jsx(pt,{size:"sm",className:"mr-2"}):e?c.jsx(Ks,{className:"w-4 h-4 mr-2"}):c.jsx(qa,{className:"w-4 h-4 mr-2"}),h(e?"common.saveChanges":"autopilot.addCustomRule")]})]})]})})}function C3(){const{state:n,actions:e}=ia(),{t:a}=yt(),[i,l]=S.useState([]),[d,h]=S.useState(!0),[m,p]=S.useState(null),[y,v]=S.useState(!1),[x,w]=S.useState(null),j=async()=>{h(!0),p(null);try{const z=await ze.getRules();if(z.error)throw new Error(typeof z.error=="string"?z.error:z.error.message);l(z.data?.rules||[])}catch(z){p(z instanceof Error?z.message:a("autopilot.loadError")),console.error("Error fetching rules:",z)}finally{h(!1)}};S.useEffect(()=>{j()},[]);const _=async(z,Z)=>{try{const ie=await ze.updateRule(z,{is_enabled:Z});if(ie.error)throw new Error(typeof ie.error=="string"?ie.error:ie.error.message);l(be=>be.map(de=>de.id===z?{...de,is_enabled:Z}:de))}catch(ie){console.error("Error toggling rule:",ie),await j()}},T=z=>{const Z=i.find(ie=>ie.id===z);Z&&(w(Z),v(!0))},N=async z=>{if(confirm(a("autopilot.deleteConfirm")))try{await e.deleteRule(z)?(ae.success(a("autopilot.ruleDeleted")),l(ie=>ie.filter(be=>be.id!==z))):ae.error(a("autopilot.ruleDeleteFailed"))}catch(Z){console.error("Error deleting rule:",Z),ae.error(a("autopilot.ruleDeleteError"))}},A=()=>{w(null),v(!0)},M=async z=>{try{let Z=!1;return x?Z=await e.updateRule(x.id,z):Z=await e.createRule(z),Z?(ae.success(a(x?"autopilot.ruleUpdated":"autopilot.ruleCreated")),await j(),!0):(ae.error(a(x?"autopilot.ruleUpdateFailed":"autopilot.ruleCreateFailed")),!1)}catch(Z){return console.error("Error saving rule:",Z),ae.error(a("autopilot.ruleSaveError")),!1}},k=async z=>{try{const Z=z.name.split(".").pop(),ie=`${Math.random().toString(36).substring(2)}.${Z}`,be=`${n.user.id}/${ie}`,{error:de}=await Ze.storage.from("rule-attachments").upload(be,z);if(de)throw de;return ae.success(a("autopilot.fileUploaded")),{name:z.name,path:be,type:z.type,size:z.size}}catch(Z){return console.error("Upload error:",Z),ae.error(a("autopilot.fileUploadFailed")),null}},U=()=>{v(!1),w(null)};if(d)return c.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:c.jsxs("div",{className:"flex flex-col items-center gap-4",children:[c.jsx(Zt,{className:"w-8 h-8 animate-spin text-gray-400"}),c.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a("autopilot.loadingRules")})]})});if(m)return c.jsxs(er,{variant:"destructive",children:[c.jsx(Fn,{className:"h-4 w-4"}),c.jsxs(tr,{children:[m,c.jsxs(ee,{variant:"outline",size:"sm",onClick:j,className:"ml-4",children:[c.jsx(Zt,{className:"w-4 h-4 mr-2"}),a("autopilot.refresh")]})]})]});const F=i.filter(z=>z.is_system_managed),K=i.filter(z=>!z.is_system_managed),P=F.filter(z=>z.is_enabled).length;return i.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] p-8",children:[c.jsx(Jc,{className:"w-16 h-16 text-gray-300 dark:text-gray-700 mb-4"}),c.jsx("h3",{className:"text-lg font-semibold mb-2",children:a("autopilot.noRulesTitle")}),c.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 text-center max-w-md mb-4",children:a("autopilot.noRulesDesc")})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-8",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[c.jsx(Jc,{className:"w-6 h-6 text-blue-500"}),a("autopilot.title")]}),c.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a("autopilot.rulesEnabled").replace("{enabled}",P.toString()).replace("{total}",F.length.toString())})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(ee,{variant:"default",size:"sm",onClick:A,children:[c.jsx(qa,{className:"w-4 h-4 mr-2"}),a("autopilot.addCustomRule")]}),c.jsxs(ee,{variant:"outline",size:"sm",onClick:j,disabled:d,children:[c.jsx(Zt,{className:`w-4 h-4 mr-2 ${d?"animate-spin":""}`}),a("autopilot.refresh")]})]})]}),F.length>0&&c.jsxs(er,{children:[c.jsx(Jc,{className:"h-4 w-4"}),c.jsx(tr,{children:a("autopilot.infoDesc")})]}),F.length>0&&c.jsx(Ab,{rules:F,onToggleRule:_,onEditRule:T,onDeleteRule:N}),K.length>0&&c.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-lg font-semibold",children:a("autopilot.customRules")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:a("autopilot.customRulesDesc")})]}),c.jsx(Ab,{rules:K,onToggleRule:_,onEditRule:T,onDeleteRule:N})]})]}),c.jsx(k3,{open:y,rule:x,onClose:U,onSave:M,onFileUpload:k})]})}function R3({length:n=6,value:e,onChange:a,onComplete:i,disabled:l=!1,error:d=!1}){const h=S.useRef([]),[m,p]=S.useState(null),y=(w,j)=>{const _=j.replace(/[^0-9]/g,"");if(_.length===0){const A=e.split("");A[w]=" ",e.split("");let M=e.split("");w<M.length&&M.splice(w,1);const k=M.join("");a(k),w>0&&h.current[w-1]?.focus();return}e.split("");const T=[...e];T[w]=_[0],a(T.join("")),w<n-1&&h.current[w+1]?.focus();const N=T.join("");N.length===n&&i&&i(N)},v=(w,j)=>{j.key==="Backspace"&&!e[w]&&w>0||j.key==="ArrowLeft"&&w>0?h.current[w-1]?.focus():j.key==="ArrowRight"&&w<n-1&&h.current[w+1]?.focus()},x=w=>{w.preventDefault();const _=w.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,n);a(_);const T=Math.min(_.length,n-1);h.current[T]?.focus(),_.length===n&&i&&i(_)};return c.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:n}).map((w,j)=>c.jsx(Ae,{ref:_=>{h.current[j]=_},type:"text",inputMode:"numeric",maxLength:1,value:e[j]||"",onChange:_=>y(j,_.target.value),onKeyDown:_=>v(j,_),onPaste:x,onFocus:()=>p(j),onBlur:()=>p(null),disabled:l,className:Se("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===j&&"ring-2 ring-ring"),"aria-label":`Digit ${j+1}`},j))})}function O3({onSuccess:n,onConfigure:e,isInitialized:a}){const{t:i}=yt(),[l,d]=S.useState(""),[h,m]=S.useState(""),[p,y]=S.useState(""),[v,x]=S.useState(""),[w,j]=S.useState(!1),[_,T]=S.useState(a===void 0),[N,A]=S.useState(a??!1),[M,k]=S.useState(""),[U,F]=S.useState(!1),[K,P]=S.useState("password"),[z,Z]=S.useState("email"),[ie,be]=S.useState(""),[de,qe]=S.useState(!1);S.useEffect(()=>{a===void 0?Be():qe(!a)},[a]);const Be=async()=>{try{const{data:q,error:I}=await Ze.from("init_state").select("is_initialized");if(I){if(I.code==="42P01"){console.info("[Login] init_state relation missing - fresh database detected."),A(!1),qe(!0);return}console.warn("[Login] Init check error:",I),A(!1),qe(!0),k(I.message);return}const he=q&&q.length>0&&q[0].is_initialized>0;A(he),qe(!he)}catch(q){console.warn("[Login] Init check exception:",q),A(!1),qe(!0),k(q.message||"Connection failed")}finally{T(!1)}},te=async q=>{q.preventDefault(),j(!0),k("");try{if(N){if(K==="password"){const{error:I}=await Ze.auth.signInWithPassword({email:l,password:h});if(I)throw I;ae.success("Logged in successfully"),n?.()}else if(z==="email"){const{error:I}=await Ze.auth.signInWithOtp({email:l,options:{shouldCreateUser:!1}});if(I)throw I;Z("verify"),ae.success("Validation code sent to your email")}}else{const{data:I,error:he}=await Ze.functions.invoke("setup",{body:{email:l,password:h,first_name:p,last_name:v}});if(he||!I){if(he?.message?.includes("First user already exists")){ae.info("System already initialized. Please log in."),A(!0);return}throw new Error(he?.message||"Failed to create admin account")}ae.success("Admin account created! Signing you in...");const{error:_e}=await Ze.auth.signInWithPassword({email:l,password:h});if(_e)throw _e;A(!0),n?.()}}catch(I){k(I?.message||"Authentication failed"),console.error("[Login] Error:",I)}finally{j(!1)}},R=async()=>{j(!0),k("");try{const{data:q,error:I}=await Ze.auth.verifyOtp({email:l,token:ie,type:"magiclink"});if(I)throw I;if(!q.session)throw new Error("Failed to create session");ae.success("Logged in successfully"),n?.()}catch(q){k(q?.message||"Invalid code")}finally{j(!1)}};return _?c.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:c.jsxs("div",{className:"flex flex-col items-center gap-4",children:[c.jsx(Lt,{className:"w-10 h-10 animate-spin text-primary"}),c.jsx("p",{className:"text-xs font-mono uppercase tracking-widest text-muted-foreground",children:"Initializing Engine..."})]})}):c.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-8 relative overflow-hidden",children:[c.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[e&&c.jsxs(ee,{variant:"ghost",size:"sm",onClick:e,className:"text-xs font-bold uppercase tracking-widest text-muted-foreground hover:text-primary transition-all",children:[c.jsx(qo,{className:"w-3.5 h-3.5 mr-2"}),"Configure"]}),c.jsx(iw,{}),c.jsx(fp,{})]}),c.jsxs(Xs.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md relative z-10",children:[c.jsxs("div",{className:"glass p-10 space-y-8 relative overflow-hidden",children:[c.jsxs("div",{className:"text-center space-y-3",children:[c.jsx("div",{className:"mx-auto w-16 h-16 bg-primary rounded-2xl flex items-center justify-center mb-6",children:c.jsx(pp,{className:"w-10 h-10 text-primary-foreground"})}),c.jsx("h2",{className:"text-3xl font-black italic tracking-tighter uppercase text-foreground",children:i(de?"login.initialize":"login.secureLogin")}),c.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-[0.2em] uppercase",children:de?"Create your primary administrator account":K==="otp"?"Magic link authentication":"Personal Access Key Required"})]}),c.jsxs("form",{onSubmit:te,className:"space-y-4",children:[c.jsxs(eS,{mode:"wait",children:[de&&c.jsxs(Xs.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"First Name"}),c.jsx(Ae,{value:p,onChange:q=>y(q.target.value),required:de,placeholder:i("login.firstNamePlaceholder"),className:"bg-background"})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Last Name"}),c.jsx(Ae,{value:v,onChange:q=>x(q.target.value),required:de,placeholder:i("login.lastNamePlaceholder"),className:"bg-background"})]})]},"signup-fields"),K==="password"||z==="email"?c.jsxs(Xs.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Email Coordinates"}),c.jsxs("div",{className:"relative",children:[c.jsx(Io,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:16}),c.jsx(Ae,{type:"email",placeholder:i("login.emailPlaceholder"),value:l,onChange:q=>d(q.target.value),required:!0,className:"pl-10 bg-background",autoComplete:"email",disabled:z==="verify"})]})]},"email-field"):null,K==="password"&&c.jsxs(Xs.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Access Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(x0,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:16}),c.jsx(Ae,{type:U?"text":"password",placeholder:"••••••••",value:h,onChange:q=>m(q.target.value),required:!0,minLength:6,className:"pl-10 pr-10 bg-background",autoComplete:de?"new-password":"current-password"}),c.jsx("button",{type:"button",onClick:()=>F(!U),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground/30 hover:text-primary transition-colors",children:U?c.jsx(cT,{size:16}):c.jsx(zb,{size:16})})]})]},"password-field"),K==="otp"&&z==="verify"&&c.jsxs(Xs.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"space-y-6 py-4",children:[c.jsx("div",{className:"flex justify-center",children:c.jsx(R3,{value:ie,onChange:be,length:6,onComplete:()=>{}})}),c.jsx(ee,{type:"button",variant:"link",className:"w-full text-[10px] font-bold uppercase tracking-widest text-primary/60",onClick:()=>Z("email"),children:"Change Coordinates"}),c.jsxs(ee,{type:"button",onClick:R,disabled:w||ie.length!==6,className:"w-full h-12 shadow-md",children:[w?c.jsx(Lt,{className:"w-5 h-5 animate-spin mr-2"}):c.jsx(Bb,{size:18,className:"mr-2"}),"Verify Access"]})]},"otp-field")]}),M&&c.jsxs(Xs.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"bg-destructive/10 text-destructive text-[11px] font-bold p-3 rounded-xl border border-destructive/20 flex items-start gap-2",children:[c.jsx(Fn,{size:14,className:"mt-0.5 shrink-0"}),c.jsx("p",{children:M})]}),K!=="otp"||z==="email"?c.jsx(ee,{type:"submit",disabled:w||!l||K==="password"&&!h,className:"w-full h-12 shadow-md mt-4",children:w?c.jsx(Lt,{className:"w-5 h-5 animate-spin"}):c.jsxs(c.Fragment,{children:[de?c.jsx(cN,{className:"w-5 h-5 mr-2"}):K==="otp"?c.jsx(Io,{className:"w-5 h-5 mr-2"}):c.jsx(jT,{className:"w-5 h-5 mr-2"}),i(de?"login.initializeMaster":K==="otp"?"login.sendMagicLink":"login.openDashboard")]})}):null]}),c.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/10",children:[!de&&c.jsx("div",{className:"flex flex-col gap-2",children:K==="password"?c.jsxs("button",{type:"button",onClick:()=>{P("otp"),Z("email"),k("")},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-white/5 text-[10px] font-bold uppercase tracking-widest text-muted-foreground hover:text-primary transition-all rounded-xl",children:[c.jsx(x0,{size:14})," Magic Link Login"]}):c.jsxs("button",{type:"button",onClick:()=>{P("password"),k("")},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-white/5 text-[10px] font-bold uppercase tracking-widest text-muted-foreground hover:text-primary transition-all rounded-xl",children:[c.jsx(Ob,{size:14})," Password Access"]})}),c.jsxs("p",{className:"text-center text-[10px] text-muted-foreground font-bold uppercase tracking-wider",children:[de?"Already have an account?":"Need a new account?"," "," ",c.jsx("button",{onClick:()=>{qe(!de),P("password"),k("")},className:"text-primary hover:underline ml-1",children:de?"Login Instead":"Create Account"})]})]})]}),c.jsx("div",{className:"mt-8 text-center",children:c.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/30 uppercase tracking-[0.4em]",children:"Powered by RealTimeX Intelligence"})})]})]})}function D3({status:n,onDismiss:e,onLearnMore:a}){const[i,l]=S.useState(!0);if(!i)return null;const d=()=>{i4(),l(!1),e?.()},h=()=>{a?a():(navigator.clipboard.writeText("npx email-automator migrate"),ae.success("Command copied to clipboard"))};return c.jsx("div",{className:"fixed right-4 top-16 z-50 max-w-sm animate-in slide-in-from-top-5",children:c.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:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(xi,{className:"h-5 w-5 flex-shrink-0 text-yellow-600 dark:text-yellow-500 mt-0.5"}),c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:"Database Update Required"}),c.jsxs(ee,{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:[c.jsx(ra,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),c.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-200",children:["Your app version (",n.appVersion,") requires a database schema update."]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(ee,{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"}),c.jsx(ee,{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 M3({open:n,onOpenChange:e,status:a}){const i=ji(),[l,d]=S.useState(!1),[h,m]=S.useState([]),[p,y]=S.useState(""),v=S.useRef(null),x=S.useMemo(()=>{const j=i?.url;if(!j)return"";try{return new URL(j).hostname.split(".")[0]||""}catch{return""}},[i?.url]);S.useEffect(()=>{v.current&&v.current.scrollIntoView({behavior:"smooth"})},[h]);const w=async()=>{if(!x){ae.error("Missing Project ID");return}if(!p){ae.error("Provide a Supabase Personal Access Token.");return}d(!0),m(["Initializing migration..."]);try{const j=async A=>{const M=new TextDecoder;let k="",U=null;const F=K=>{const P=K.trim();if(!(!P||!P.startsWith("data: ")))try{const z=P.substring(6),Z=JSON.parse(z);Z.type==="done"?(Z.data==="success"||Z.data==="failed")&&(U=Z.data==="success"?"success":"failure"):Z.data&&m(ie=>[...ie,Z.data])}catch(z){console.error("Failed to parse SSE line:",P,z)}};for(;;){const{done:K,value:P}=await A.read();if(K)break;k+=M.decode(P,{stream:!0});const z=k.split(`
105
- `);k=z.pop()||"",z.forEach(F)}return k+=M.decode(),k&&F(k),U};m(A=>[...A,"","📦 Database Migration & Edge Functions Deployment"]);const _=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:x,accessToken:p})});if(!_.ok)throw new Error(`Migration failed: ${_.status} ${_.statusText}`);const T=_.body?.getReader();if(!T)throw new Error("No migration response stream received.");if(await j(T)!=="success")throw new Error("Migration did not complete successfully");m(A=>[...A,"","═".repeat(60),"✅ Setup Complete!","","✓ Database schema updated","✓ Edge Functions deployed","","🎉 Your Email Automator is ready to use!","📝 The application will reload automatically...","═".repeat(60)]),setTimeout(()=>{window.location.reload()},3e3)}catch(j){console.error(j),m(_=>[..._,"",`❌ Error: ${j instanceof Error?j.message:String(j)}`]),ae.error("Setup failed. Check logs for details.")}finally{d(!1)}};return c.jsx(Ya,{open:n,onOpenChange:j=>!l&&e(j),children:c.jsxs(Xa,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[c.jsxs(Wa,{children:[c.jsxs(Ja,{className:"flex items-center gap-2 text-xl",children:[c.jsx(xi,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Setup Required"]}),c.jsxs(Za,{children:["Your application version (",a.appVersion,") requires database migration and Edge Functions deployment to function correctly."]})]}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs(er,{children:[c.jsx(vi,{className:"h-4 w-4"}),c.jsxs(tr,{children:[c.jsx("strong",{children:"Why is this needed?"}),c.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[c.jsxs("li",{children:["Updates your database schema to match version ",a.appVersion]}),c.jsx("li",{children:"Deploys Edge Functions (API endpoints) to your Supabase project"}),c.jsx("li",{children:"Enables new features and performance improvements"}),c.jsx("li",{children:"Your existing data will be preserved (safe migration)"})]})]})]}),c.jsxs("div",{className:"space-y-4 py-2",children:[c.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm p-6",children:[c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Automated Setup"}),c.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Run database migration and deploy Edge Functions directly from your browser. A Supabase Personal Access Token is required to authenticate with your project."}),c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(Ht,{htmlFor:"project-id",children:"Supabase Project ID"}),c.jsx(Ae,{id:"project-id",value:x,disabled:!0,readOnly:!0,className:"bg-muted"})]}),c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx(Ht,{htmlFor:"access-token",children:"Access Token"}),c.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 ",c.jsx(Bo,{className:"h-3 w-3"})]})]}),c.jsx(Ae,{id:"access-token",type:"password",placeholder:"sbp_...",value:p,onChange:j=>y(j.target.value),disabled:l}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"This token is used only for this migration and is not stored."})]}),c.jsx(ee,{onClick:w,disabled:l||!p,className:"w-full",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Lt,{className:"mr-2 h-4 w-4 animate-spin"}),"Running Setup..."]}):c.jsxs(c.Fragment,{children:[c.jsx(iu,{className:"mr-2 h-4 w-4"}),"Start Setup"]})})]})]}),c.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[h.length===0?c.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):h.map((j,_)=>c.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:j},_)),c.jsx("div",{ref:v})]})]}),c.jsxs(er,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[c.jsx(xi,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),c.jsxs(tr,{children:[c.jsx("strong",{children:"Troubleshooting"}),c.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[c.jsxs("li",{children:["Ensure your Access Token has ",c.jsx("code",{children:"read"})," and ",c.jsx("code",{children:"write"})," permissions."]}),c.jsx("li",{children:"Verify that your Supabase Project ID is correct and active."})]})]})]})]}),c.jsx(Ia,{children:c.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:l,children:"Close"})})]})})}const z3="https://registry.npmjs.org/@realtimex/email-automator/latest",L3=300*1e3,JS="email_automator_last_version_check",ZS="email_automator_update_dismissed";function U3(){return"2.19.0"}async function P3(){try{const n=await fetch(z3,{cache:"no-store"});return n.ok?(await n.json()).version||null:(console.warn("[Version Check] Failed to fetch latest version"),null)}catch(n){return console.error("[Version Check] Error fetching latest version:",n),null}}function V3(n,e){if(e==="unknown")return!1;const a=y=>y.replace(/^v/,"").split(".").map(x=>parseInt(x,10)||0),[i,l,d]=a(n),[h,m,p]=a(e);return h>i?!0:h<i?!1:m>l?!0:m<l?!1:p>d}function B3(){try{const n=localStorage.getItem(JS);if(!n)return!0;const e=new Date(n).getTime();return Date.now()-e>L3}catch{return!0}}function I3(){try{localStorage.setItem(JS,new Date().toISOString())}catch(n){console.error("[Version Check] Error saving check timestamp:",n)}}function q3(n=24){try{const e=localStorage.getItem(ZS);if(!e)return!1;const a=new Date(e).getTime();return(Date.now()-a)/(1e3*60*60)<n}catch{return!1}}function $3(){try{localStorage.setItem(ZS,new Date().toISOString())}catch(n){console.error("[Version Check] Error dismissing update prompt:",n)}}async function H3(){if(!B3())return console.log("[Version Check] Skipping (throttled)"),null;const n=U3(),e=await P3();if(I3(),!e)return console.warn("[Version Check] Could not determine latest version"),null;const a=V3(n,e);return console.log("[Version Check]",{current:n,latest:e,updateAvailable:a}),a?{current:n,latest:e,updateAvailable:!0,updateUrl:"https://github.com/realtimex/email-automator/releases/latest"}:null}function G3(){typeof window<"u"&&window.location.reload(),window.electron?.ipcRenderer&&window.electron.ipcRenderer.send("restart-app")}function F3({versionInfo:n,onDismiss:e}){const[a,i]=S.useState(!0),[l,d]=S.useState(!1);if(!a)return null;const h=()=>{$3(),i(!1),e?.()},m=()=>{d(!0),setTimeout(()=>{G3()},500)},p=()=>{n.updateUrl&&window.open(n.updateUrl,"_blank")};return c.jsx("div",{className:"fixed right-4 top-16 z-50 max-w-sm animate-in slide-in-from-top-5",children:c.jsx("div",{className:"rounded-lg border border-blue-500 bg-blue-50 p-4 shadow-lg dark:bg-blue-950/90 dark:border-blue-600",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Zt,{className:"h-5 w-5 flex-shrink-0 text-blue-600 dark:text-blue-500 mt-0.5"}),c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"Update Available"}),c.jsxs(ee,{size:"icon",variant:"ghost",className:"h-5 w-5 -mr-1 -mt-1 text-blue-900 hover:bg-blue-100 dark:text-blue-100 dark:hover:bg-blue-900/30",onClick:h,children:[c.jsx(ra,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),c.jsxs("p",{className:"text-xs text-blue-800 dark:text-blue-200",children:["Version ",n.latest," is now available (you're on ",n.current,")"]}),c.jsxs("div",{className:"flex gap-2 flex-wrap",children:[c.jsx(ee,{size:"sm",variant:"default",className:"h-7 text-xs bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",onClick:m,disabled:l,children:l?c.jsxs(c.Fragment,{children:[c.jsx(Zt,{className:"h-3 w-3 mr-1 animate-spin"}),"Updating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Zt,{className:"h-3 w-3 mr-1"}),"Update Now"]})}),n.updateUrl&&c.jsxs(ee,{size:"sm",variant:"ghost",className:"h-7 text-xs text-blue-900 hover:bg-blue-100 dark:text-blue-100 dark:hover:bg-blue-900/30",onClick:p,children:[c.jsx(Bo,{className:"h-3 w-3 mr-1"}),"What's New"]}),c.jsx(ee,{size:"sm",variant:"ghost",className:"h-7 text-xs text-blue-900 hover:bg-blue-100 dark:text-blue-100 dark:hover:bg-blue-900/30",onClick:h,children:"Later"})]})]})]})})})}function K3(){const{t:n}=yt(),[e,a]=S.useState([]),{isExpanded:i,setIsExpanded:l}=kw(),{state:d,actions:h}=ia(),{isSyncing:m}=d,[p,y]=S.useState({});S.useEffect(()=>{v();const _=Ze.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},T=>{const N=T.new;N.event_type==="error"&&y(A=>({...A,[N.id]:!0})),a(A=>{const M=[N,...A];return N.details?.is_completion&&i&&setTimeout(()=>{l(!1)},3e3),M.length>100?M.slice(0,100):M})}).subscribe();return()=>{Ze.removeChannel(_)}},[i,l]);const v=async()=>{const{data:_}=await Ze.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);_&&a(_)},x=_=>{y(T=>({...T,[_]:!T[_]}))},w=_=>{if(_.details?.is_completion)return c.jsx(ru,{className:"w-3 h-3 text-emerald-500"});switch(_.event_type){case"analysis":return c.jsx(Vo,{className:"w-3 h-3 text-purple-500"});case"action":return c.jsx(ou,{className:"w-3 h-3 text-emerald-500"});case"error":return c.jsx(xi,{className:"w-3 h-3 text-red-500"});default:return c.jsx(vi,{className:"w-3 h-3 text-blue-500"})}},j=_=>new Date(_).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return i?c.jsxs(It,{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:[c.jsxs(Zs,{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:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(iu,{className:"w-4 h-4 text-primary"}),c.jsx(Qs,{className:"text-sm font-mono font-bold",children:n("terminal.title")}),c.jsxs("div",{className:Se("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded-full border font-bold animate-pulse transition-colors duration-500",m?"text-red-600 dark:text-red-400 bg-red-500/10 border-red-500/20":"text-green-600 dark:text-green-400 bg-green-500/10 border-green-500/20"),children:[c.jsx(EE,{className:"w-3 h-3"}),n(m?"terminal.syncing":"terminal.live")]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[m&&c.jsxs(ee,{variant:"destructive",size:"sm",className:"h-7 text-[10px] font-mono font-bold bg-red-600 hover:bg-red-700 animate-in fade-in zoom-in duration-300",onClick:()=>h.stopSync(),children:[c.jsx(eN,{className:"w-3 h-3 mr-1 fill-current"}),n("terminal.stopSync")]}),c.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:n("terminal.clear")}),c.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:c.jsx(kT,{className:"w-4 h-4"})})]})]}),c.jsxs(ea,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[e.length===0&&c.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:n("terminal.waiting")}),e.map((_,T)=>c.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[T!==e.length-1&&c.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),c.jsx("div",{className:Se("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",_.event_type==="error"&&"border-red-500/50 bg-red-500/5",_.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",_.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5",_.details?.is_completion&&"border-emerald-500/50 bg-emerald-500/5"),children:w(_)}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsxs("div",{className:"flex items-center justify-between group",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:Se("font-bold uppercase tracking-tight text-[10px]",_.event_type==="info"&&"text-muted-foreground",_.event_type==="analysis"&&"text-purple-600 dark:text-purple-400",_.event_type==="action"&&"text-emerald-600 dark:text-emerald-400",_.event_type==="error"&&"text-red-600 dark:text-red-400"),children:_.agent_state}),c.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:j(_.created_at)})]}),(_.details?.system_prompt||_.details?._raw_response||_.details?.raw_response)&&c.jsxs(ee,{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:()=>x(_.id),children:[p[_.id]?c.jsx(XE,{className:"w-3 h-3 mr-1"}):c.jsx(Mb,{className:"w-3 h-3 mr-1"}),n("terminal.details")]})]}),_.event_type==="analysis"&&_.details?c.jsxs("div",{className:"bg-purple-500/5 border border-purple-500/10 rounded-lg p-3 space-y-2",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("span",{className:Se("px-1.5 py-0.5 rounded text-[9px] font-bold border",_.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:_.details.is_useless?n("terminal.useless"):n("terminal.relevant")}),c.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:_.details.category})]}),c.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',_.details.summary,'"']}),_.details.suggested_actions&&_.details.suggested_actions.length>0&&c.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:_.details.suggested_actions.map(N=>c.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:[c.jsx(ou,{className:"w-2.5 h-2.5"}),N]},N))}),_.details.usage&&c.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:c.jsxs("span",{children:["Tokens: ",_.details.usage.prompt_tokens," (in) + ",_.details.usage.completion_tokens," (out) = ",c.jsx("span",{className:"text-purple-500 font-bold",children:_.details.usage.total_tokens})]})})]}):_.event_type==="action"&&_.details?c.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/10 rounded-lg p-3",children:[c.jsx("p",{className:"text-emerald-600 dark:text-emerald-400 font-bold mb-1 uppercase text-[9px] tracking-widest",children:n("terminal.executionComplete")}),c.jsxs("p",{className:"text-foreground font-medium",children:[_.details.action==="delete"&&n("terminal.action.delete"),_.details.action==="archive"&&n("terminal.action.archive"),_.details.action==="draft"&&n("terminal.action.draft"),_.details.action==="star"&&n("terminal.action.star"),!["delete","archive","draft","star"].includes(_.details.action)&&_.details.action]}),_.details.reason&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[c.jsx(vi,{className:"w-3 h-3"}),_.details.reason]})]}):_.event_type==="error"&&_.details?c.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 _.details.error=="object"?_.details.error.message||JSON.stringify(_.details.error):_.details.error}):_.details?.is_completion?c.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-lg p-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 dark:text-emerald-400 font-bold uppercase text-[9px] tracking-[0.2em]",children:[c.jsx(ru,{className:"w-3.5 h-3.5"}),n("terminal.batchFinished")]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-1",children:[c.jsxs("div",{className:"space-y-0.5",children:[c.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:n("terminal.processed")}),c.jsx("p",{className:"text-sm font-bold",children:_.details.total_processed||0})]}),c.jsxs("div",{className:"space-y-0.5",children:[c.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:n("terminal.actions")}),c.jsx("p",{className:"text-sm font-bold text-emerald-500",children:(_.details.deleted||0)+(_.details.drafted||0)})]})]}),_.details.errors>0&&c.jsxs("p",{className:"text-[10px] text-red-500 font-bold pt-1 border-t border-emerald-500/10",children:["⚠️ ",_.details.errors," items failed to process."]})]}):c.jsx("p",{className:"text-muted-foreground leading-relaxed",children:_.details?.message||JSON.stringify(_.details)}),p[_.id]&&c.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[_.details?.system_prompt&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[c.jsx(ps,{className:"w-3 h-3"})," System Prompt"]}),c.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:c.jsx("pre",{className:"whitespace-pre-wrap break-words text-[10px] leading-normal text-muted-foreground select-all",children:_.details.system_prompt})})]}),_.details?.content_preview&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[c.jsx(ps,{className:"w-3 h-3"})," Input Content (Cleaned)"]}),c.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border",children:c.jsx("p",{className:"whitespace-pre-wrap break-words text-[10px] text-muted-foreground",children:_.details.content_preview})})]}),_.details?._raw_response&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[c.jsx(ps,{className:"w-3 h-3"})," Raw LLM JSON Output"]}),c.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:c.jsx("pre",{className:"text-[10px] text-muted-foreground select-all",children:JSON.stringify(JSON.parse(_.details._raw_response),null,2)})})]}),_.details?.raw_response&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[c.jsx(ps,{className:"w-3 h-3"})," Raw Response (from Error)"]}),c.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:c.jsx("pre",{className:"text-[10px] text-muted-foreground select-all whitespace-pre-wrap",children:typeof _.details.raw_response=="object"?JSON.stringify(_.details.raw_response,null,2):_.details.raw_response})})]})]})]})]},_.id))]})]}):c.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:c.jsxs(ee,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[c.jsx(iu,{className:"w-4 h-4 mr-2"}),n("terminal.liveActivity"),(e.length>0||m)&&c.jsxs("span",{className:"ml-2 flex h-2 w-2 relative",children:[c.jsx("span",{className:Se("animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",m?"bg-red-400":"bg-green-400")}),c.jsx("span",{className:Se("relative inline-flex rounded-full h-2 w-2",m?"bg-red-500":"bg-green-500")})]})]})})}function Y3(){const{state:n,isSubscribed:e,actions:a}=ia(),{t:i}=yt(),[l,d]=S.useState(null),[h,m]=S.useState(!0),[p,y]=S.useState(!1),[v,x]=S.useState(!0),[w,j]=S.useState("dashboard"),[_,T]=S.useState(!1),[N,A]=S.useState(null),[M,k]=S.useState(!1),[U,F]=S.useState(!1),[K,P]=S.useState(!1),[z,Z]=S.useState(null),[ie,be]=S.useState(!1);if(S.useEffect(()=>{const te=new URLSearchParams(window.location.search).get("code");te&&!_&&(async()=>{T(!0);try{const q=await ze.connectGmail(te);if(q.data?.success)ae.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),a.fetchAccounts());else{const I=typeof q.error=="string"?q.error:q.error?.message;ae.error(I||"Failed to connect Gmail")}}catch{ae.error("Connection failed")}finally{T(!1)}})()},[]),_)return c.jsx(fu,{text:i("app.connecting")});S.useEffect(()=>{(async()=>{if(!ji()){y(!0),m(!1);return}try{const{data:I,error:he}=await Ze.from("init_state").select("is_initialized").single();he?(console.warn("[App] Init check error (might be fresh DB):",he),he.code==="42P01"&&x(!1)):x(I.is_initialized>0);const{data:{session:_e}}=await Ze.auth.getSession();if(d(_e?.user??null),_e?.user){const X=await mp(Ze);A(X.needsMigration?X:null),X.needsMigration&&!r4()&&k(!0)}const O=await H3();O&&!q3()&&(Z(O),be(!0))}catch(I){console.error("[App] Status check failed:",I),I instanceof Error&&I.message.includes("Invalid API key")&&y(!0)}finally{m(!1)}})();const{data:{subscription:te}}=Ze.auth.onAuthStateChange((q,I)=>{d(I?.user??null),I||(A(null),k(!1))}),R=()=>{if($n.isEnabled()){const q=new(window.AudioContext||window.webkitAudioContext);q.state==="suspended"&&q.resume()}window.removeEventListener("click",R),window.removeEventListener("keydown",R)};return window.addEventListener("click",R),window.addEventListener("keydown",R),()=>{te.unsubscribe(),window.removeEventListener("click",R),window.removeEventListener("keydown",R)}},[]),S.useEffect(()=>{l&&(a.fetchAccounts(),a.fetchRules(),a.fetchSettings(),a.fetchProfile())},[l]),S.useEffect(()=>{const Be=async()=>{try{await ze.healthCheck()}catch{console.warn("[App] Keep-alive ping failed")}};Be();const te=setInterval(Be,3e4);return()=>clearInterval(te)},[]);const de=()=>{F(!0),k(!1)},qe={migrationStatus:N,showMigrationBanner:M,showMigrationModal:U,openMigrationModal:de,suppressMigrationBanner:K,setSuppressMigrationBanner:P};return h?c.jsx(fu,{text:i("app.loadingWorkspace")}):p?c.jsx(wS,{onComplete:()=>y(!1)}):l?c.jsx(dC,{value:qe,children:c.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[c.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:c.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("button",{onClick:()=>j("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[c.jsx(pp,{className:"w-8 h-8"}),c.jsx("span",{className:"hidden sm:inline",children:i("app.name")}),c.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),c.jsxs("div",{className:Se("flex items-center gap-1.5 px-2 h-6 rounded-full text-[10px] font-bold border transition-colors",e?"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:[c.jsxs("div",{className:"relative flex items-center justify-center",children:[e&&c.jsx("span",{className:"absolute inline-flex h-3 w-3 rounded-full bg-emerald-500/40 animate-ping"}),c.jsx("div",{className:Se("relative w-2 h-2 rounded-full",e?"bg-emerald-500":"bg-yellow-500")})]}),c.jsx("span",{className:"hidden xs:inline leading-none",children:i(e?"app.statusLive":"app.statusOffline")})]})]}),c.jsxs("div",{className:"flex gap-4 items-center",children:[c.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[c.jsxs(ee,{variant:w==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>j("dashboard"),className:"gap-2",children:[c.jsx(wT,{className:"w-4 h-4"}),c.jsx("span",{className:"hidden sm:inline",children:i("nav.dashboard")})]}),c.jsxs(ee,{variant:w==="autopilot"?"secondary":"ghost",size:"sm",onClick:()=>j("autopilot"),className:"gap-2",children:[c.jsx(Jc,{className:"w-4 h-4"}),c.jsx("span",{className:"hidden sm:inline",children:i("nav.autopilot")})]}),c.jsxs(ee,{variant:w==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>j("analytics"),className:"gap-2",children:[c.jsx(Db,{className:"w-4 h-4"}),c.jsx("span",{className:"hidden sm:inline",children:i("nav.analytics")})]}),c.jsxs(ee,{variant:w==="config"?"secondary":"ghost",size:"sm",onClick:()=>j("config"),className:"gap-2",children:[c.jsx(qo,{className:"w-4 h-4"}),c.jsx("span",{className:"hidden sm:inline",children:i("nav.configuration")})]})]}),c.jsx("div",{className:"h-6 w-px bg-border/50 mx-2 hidden sm:block"}),c.jsx(fp,{variant:"minimal"}),c.jsx(iw,{}),c.jsx(ee,{variant:w==="account"?"secondary":"ghost",size:"sm",onClick:()=>j("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:i("nav.accountSettings"),children:n.profile?.avatar_url?c.jsx("img",{src:n.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):c.jsx(eT,{className:"w-5 h-5"})})]})]})}),c.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4 mb-12",children:[w==="dashboard"&&c.jsx(b3,{}),w==="autopilot"&&c.jsx(C3,{}),w==="config"&&c.jsx(j3,{}),w==="analytics"&&c.jsx(W3,{}),w==="account"&&c.jsx(E3,{})]}),c.jsx("footer",{className:"max-w-7xl mx-auto px-4 sm:px-8 pb-8 text-center sm:text-left",children:c.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/40 uppercase tracking-[0.2em]",children:["Email Automator ",c.jsx("span",{className:"mx-1",children:"•"})," v","2.19.0"]})}),n.error&&c.jsx("div",{className:"fixed bottom-20 left-4 right-4 sm:left-auto sm:right-4 sm:max-w-sm z-50",children:c.jsx("div",{className:"bg-destructive/10 border border-destructive/20 text-destructive p-4 rounded-lg",children:c.jsx("p",{className:"text-sm",children:n.error})})}),N&&M&&!K&&c.jsx(D3,{status:N,onDismiss:()=>k(!1),onLearnMore:de}),z&&ie&&c.jsx(F3,{versionInfo:z,onDismiss:()=>be(!1)}),N&&c.jsx(M3,{open:U,onOpenChange:F,status:N}),c.jsx(K3,{})]})}):c.jsx(O3,{onSuccess:()=>a.fetchProfile(),onConfigure:()=>y(!0),isInitialized:v})}function X3({runId:n,accountEmail:e,isOpen:a,onOpenChange:i}){const{t:l}=yt(),[d,h]=S.useState([]),[m,p]=S.useState(!1);S.useEffect(()=>{a&&n&&y()},[a,n]);const y=async()=>{if(n){p(!0);try{const x=await ze.getRunEvents(n);x.data&&h(x.data.events)}catch(x){console.error("Failed to fetch run trace:",x)}finally{p(!1)}}},v=x=>{switch(x){case"analysis":return c.jsx(Vo,{className:"w-4 h-4 text-purple-500"});case"action":return c.jsx(ou,{className:"w-4 h-4 text-emerald-500"});case"error":return c.jsx(Fn,{className:"w-4 h-4 text-red-500"});default:return c.jsx(vi,{className:"w-4 h-4 text-blue-500"})}};return c.jsx(Ya,{open:a,onOpenChange:i,children:c.jsxs(Xa,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[c.jsxs(Wa,{className:"p-6 border-b",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Su,{className:"w-5 h-5 text-primary"}),c.jsx(Ja,{children:l("trace.runTrace")})]}),c.jsx(Za,{children:e?l("trace.fullLogFor").replace("{email}",e):l("trace.historicalLog")})]}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:m?c.jsx("div",{className:"py-20 flex justify-center",children:c.jsx(fu,{text:l("trace.loadingTrace")})}):d.length===0?c.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:l("trace.noTraceEvents")}):d.map((x,w)=>c.jsxs("div",{className:"relative pl-8",children:[w!==d.length-1&&c.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),c.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:v(x.event_type)}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-foreground/70",children:x.agent_state}),x.emails?.subject&&c.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",x.emails.subject]})]}),c.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[c.jsx(Qa,{className:"w-3 h-3"}),new Date(x.created_at).toLocaleTimeString()]})]}),c.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[x.event_type==="info"&&c.jsx("p",{className:"text-sm text-foreground/90",children:x.details?.message}),x.event_type==="analysis"&&c.jsxs("div",{className:"space-y-2",children:[c.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',x.details?.summary,'"']}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("span",{className:"text-[9px] bg-secondary px-1.5 py-0.5 rounded font-bold uppercase",children:x.details?.category}),x.details?.suggested_actions?.map(j=>c.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:j},j))]}),x.details?.usage&&c.jsxs("div",{className:"flex gap-3 pt-1.5 mt-1 border-t border-border/50 text-[9px] text-muted-foreground",children:[c.jsxs("span",{children:["In: ",c.jsx("b",{children:x.details.usage.prompt_tokens})]}),c.jsxs("span",{children:["Out: ",c.jsx("b",{children:x.details.usage.completion_tokens})]}),c.jsxs("span",{children:["Total: ",c.jsx("span",{className:"text-primary font-bold",children:x.details.usage.total_tokens})]})]})]}),x.event_type==="action"&&c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:[l("dashboard.done")," ",x.details?.action]}),c.jsx(Nm,{className:"w-4 h-4 text-emerald-500"})]}),x.event_type==="error"&&c.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:x.details?.error})]})]})]},x.id))})]})})}function W3(){const{state:n,actions:e}=ia(),{t:a}=yt(),[i,l]=S.useState(null),[d,h]=S.useState(void 0),[m,p]=S.useState(!1);if(S.useEffect(()=>{e.fetchStats()},[]),!n.stats)return c.jsx(fu,{text:a("common.loading")});const y=(x,w)=>{l(x),h(w),p(!0)},{stats:v}=n;return c.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[c.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[c.jsx(Db,{className:"w-6 h-6 text-primary"}),a("analytics.title")]}),c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[c.jsx(Wc,{title:a("analytics.totalEmails"),value:v.totalEmails,color:"primary"}),c.jsx(Wc,{title:a("analytics.spamCaught"),value:v.categoryCounts.spam||0,color:"destructive"}),c.jsx(Wc,{title:a("analytics.actionsTaken"),value:Object.values(v.actionCounts).reduce((x,w)=>x+w,0)-(v.actionCounts.none||0),color:"emerald"}),c.jsx(Wc,{title:a("analytics.accounts"),value:v.accountCount,color:"blue"})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[c.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[c.jsx("h3",{className:"font-semibold mb-4",children:a("analytics.categories")}),c.jsx("div",{className:"space-y-3",children:Object.entries(v.categoryCounts).map(([x,w])=>c.jsx("div",{className:"flex items-center gap-3",children:c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[c.jsx("span",{className:"capitalize",children:x}),c.jsx("span",{className:"text-muted-foreground",children:w})]}),c.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${w/v.totalEmails*100}%`}})})]})},x))})]}),c.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[c.jsx("h3",{className:"font-semibold mb-4",children:a("analytics.actionsTaken")}),c.jsx("div",{className:"space-y-3",children:Object.entries(v.actionCounts).map(([x,w])=>c.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[c.jsx("span",{className:"capitalize",children:x}),c.jsx("span",{className:"font-medium",children:w})]},x))})]})]}),c.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[c.jsx("h3",{className:"font-semibold mb-4",children:a("analytics.recentActivity")}),v.recentSyncs.length===0?c.jsx("p",{className:"text-muted-foreground text-sm",children:a("analytics.noActivity")}):c.jsx("div",{className:"space-y-3",children:v.recentSyncs.map(x=>{const w=x.completed_at?Math.round((new Date(x.completed_at).getTime()-new Date(x.started_at).getTime())/1e3):null;return c.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between p-3 border rounded-lg hover:bg-secondary/30 transition-colors gap-3 cursor-pointer group",onClick:()=>y(x.id,x.email_accounts?.email_address),children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:Se("w-2.5 h-2.5 rounded-full",x.status==="success"?"bg-emerald-500":x.status==="failed"?"bg-destructive":"bg-yellow-500 shadow-[0_0_8px_rgba(234,179,8,0.5)] animate-pulse")}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:x.email_accounts?.email_address||a("common.systemSync")}),c.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[c.jsx(Qa,{className:"w-3 h-3"}),new Date(x.started_at).toLocaleString(),w!==null&&c.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[w,"s"]})]})]})]}),c.jsx("div",{className:"flex items-center gap-4 text-xs",children:c.jsxs("div",{className:"flex flex-col items-end",children:[c.jsx("span",{className:"font-bold text-primary",children:a("analytics.emails").replace("{count}",x.emails_processed.toString())}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[a("analytics.deleted").replace("{count}",x.emails_deleted.toString()),", ",a("analytics.drafted").replace("{count}",x.emails_drafted.toString())]})]})})]},x.id)})})]}),c.jsx(X3,{runId:i,accountEmail:d,isOpen:m,onOpenChange:p})]})}function Wc({title:n,value:e,color:a}){const i={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 c.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:n}),c.jsx("p",{className:`text-3xl font-bold ${i[a]||""}`,children:e})]})}function J3(){return c.jsx(t4,{children:c.jsx(vN,{defaultTheme:"system",storageKey:"email-automator-theme",children:c.jsx(mC,{children:c.jsx(hC,{children:c.jsxs(cC,{children:[c.jsx(Y3,{}),c.jsx(oC,{})]})})})})})}vE.createRoot(document.getElementById("root")).render(c.jsx(kb.StrictMode,{children:c.jsx(J3,{})}));