@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.
@@ -0,0 +1,105 @@
1
+ function oE(t,e){for(var s=0;s<e.length;s++){const r=e[s];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in t)){const u=Object.getOwnPropertyDescriptor(r,o);u&&Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(o){if(o.ep)return;o.ep=!0;const u=s(o);fetch(o.href,u)}})();function _m(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fh={exports:{}},jo={};var c0;function lE(){if(c0)return jo;c0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function s(r,o,u){var d=null;if(u!==void 0&&(d=""+u),o.key!==void 0&&(d=""+o.key),"key"in o){u={};for(var f in o)f!=="key"&&(u[f]=o[f])}else u=o;return o=u.ref,{$$typeof:t,type:r,key:d,ref:o!==void 0?o:null,props:u}}return jo.Fragment=e,jo.jsx=s,jo.jsxs=s,jo}var u0;function cE(){return u0||(u0=1,Fh.exports=lE()),Fh.exports}var l=cE(),Kh={exports:{}},je={};var d0;function uE(){if(d0)return je;d0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function S(R){return R===null||typeof R!="object"?null:(R=b&&R[b]||R["@@iterator"],typeof R=="function"?R:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,T={};function A(R,Y,Z){this.props=R,this.context=Y,this.refs=T,this.updater=Z||_}A.prototype.isReactComponent={},A.prototype.setState=function(R,Y){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,Y,"setState")},A.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function D(){}D.prototype=A.prototype;function N(R,Y,Z){this.props=R,this.context=Y,this.refs=T,this.updater=Z||_}var L=N.prototype=new D;L.constructor=N,E(L,A.prototype),L.isPureReactComponent=!0;var G=Array.isArray;function F(){}var U={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function J(R,Y,Z){var ne=Z.ref;return{$$typeof:t,type:R,key:Y,ref:ne!==void 0?ne:null,props:Z}}function re(R,Y){return J(R.type,Y,R.props)}function xe(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function ue(R){var Y={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(Z){return Y[Z]})}var Ie=/\/+/g;function Ve(R,Y){return typeof R=="object"&&R!==null&&R.key!=null?ue(""+R.key):Y.toString(36)}function ee(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(F,F):(R.status="pending",R.then(function(Y){R.status==="pending"&&(R.status="fulfilled",R.value=Y)},function(Y){R.status==="pending"&&(R.status="rejected",R.reason=Y)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function C(R,Y,Z,ne,be){var _e=typeof R;(_e==="undefined"||_e==="boolean")&&(R=null);var pe=!1;if(R===null)pe=!0;else switch(_e){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(R.$$typeof){case t:case e:pe=!0;break;case y:return pe=R._init,C(pe(R._payload),Y,Z,ne,be)}}if(pe)return be=be(R),pe=ne===""?"."+Ve(R,0):ne,G(be)?(Z="",pe!=null&&(Z=pe.replace(Ie,"$&/")+"/"),C(be,Y,Z,"",function(cn){return cn})):be!=null&&(xe(be)&&(be=re(be,Z+(be.key==null||R&&R.key===be.key?"":(""+be.key).replace(Ie,"$&/")+"/")+pe)),Y.push(be)),1;pe=0;var ot=ne===""?".":ne+":";if(G(R))for(var Le=0;Le<R.length;Le++)ne=R[Le],_e=ot+Ve(ne,Le),pe+=C(ne,Y,Z,_e,be);else if(Le=S(R),typeof Le=="function")for(R=Le.call(R),Le=0;!(ne=R.next()).done;)ne=ne.value,_e=ot+Ve(ne,Le++),pe+=C(ne,Y,Z,_e,be);else if(_e==="object"){if(typeof R.then=="function")return C(ee(R),Y,Z,ne,be);throw Y=String(R),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return pe}function I(R,Y,Z){if(R==null)return R;var ne=[],be=0;return C(R,ne,"","",function(_e){return Y.call(Z,_e,be++)}),ne}function B(R){if(R._status===-1){var Y=R._result;Y=Y(),Y.then(function(Z){(R._status===0||R._status===-1)&&(R._status=1,R._result=Z)},function(Z){(R._status===0||R._status===-1)&&(R._status=2,R._result=Z)}),R._status===-1&&(R._status=0,R._result=Y)}if(R._status===1)return R._result.default;throw R._result}var de=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},Se={map:I,forEach:function(R,Y,Z){I(R,function(){Y.apply(this,arguments)},Z)},count:function(R){var Y=0;return I(R,function(){Y++}),Y},toArray:function(R){return I(R,function(Y){return Y})||[]},only:function(R){if(!xe(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return je.Activity=v,je.Children=Se,je.Component=A,je.Fragment=s,je.Profiler=o,je.PureComponent=N,je.StrictMode=r,je.Suspense=p,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,je.__COMPILER_RUNTIME={__proto__:null,c:function(R){return U.H.useMemoCache(R)}},je.cache=function(R){return function(){return R.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(R,Y,Z){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var ne=E({},R.props),be=R.key;if(Y!=null)for(_e in Y.key!==void 0&&(be=""+Y.key),Y)!M.call(Y,_e)||_e==="key"||_e==="__self"||_e==="__source"||_e==="ref"&&Y.ref===void 0||(ne[_e]=Y[_e]);var _e=arguments.length-2;if(_e===1)ne.children=Z;else if(1<_e){for(var pe=Array(_e),ot=0;ot<_e;ot++)pe[ot]=arguments[ot+2];ne.children=pe}return J(R.type,be,ne)},je.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},je.createElement=function(R,Y,Z){var ne,be={},_e=null;if(Y!=null)for(ne in Y.key!==void 0&&(_e=""+Y.key),Y)M.call(Y,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(be[ne]=Y[ne]);var pe=arguments.length-2;if(pe===1)be.children=Z;else if(1<pe){for(var ot=Array(pe),Le=0;Le<pe;Le++)ot[Le]=arguments[Le+2];be.children=ot}if(R&&R.defaultProps)for(ne in pe=R.defaultProps,pe)be[ne]===void 0&&(be[ne]=pe[ne]);return J(R,_e,be)},je.createRef=function(){return{current:null}},je.forwardRef=function(R){return{$$typeof:f,render:R}},je.isValidElement=xe,je.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:B}},je.memo=function(R,Y){return{$$typeof:m,type:R,compare:Y===void 0?null:Y}},je.startTransition=function(R){var Y=U.T,Z={};U.T=Z;try{var ne=R(),be=U.S;be!==null&&be(Z,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(F,de)}catch(_e){de(_e)}finally{Y!==null&&Z.types!==null&&(Y.types=Z.types),U.T=Y}},je.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},je.use=function(R){return U.H.use(R)},je.useActionState=function(R,Y,Z){return U.H.useActionState(R,Y,Z)},je.useCallback=function(R,Y){return U.H.useCallback(R,Y)},je.useContext=function(R){return U.H.useContext(R)},je.useDebugValue=function(){},je.useDeferredValue=function(R,Y){return U.H.useDeferredValue(R,Y)},je.useEffect=function(R,Y){return U.H.useEffect(R,Y)},je.useEffectEvent=function(R){return U.H.useEffectEvent(R)},je.useId=function(){return U.H.useId()},je.useImperativeHandle=function(R,Y,Z){return U.H.useImperativeHandle(R,Y,Z)},je.useInsertionEffect=function(R,Y){return U.H.useInsertionEffect(R,Y)},je.useLayoutEffect=function(R,Y){return U.H.useLayoutEffect(R,Y)},je.useMemo=function(R,Y){return U.H.useMemo(R,Y)},je.useOptimistic=function(R,Y){return U.H.useOptimistic(R,Y)},je.useReducer=function(R,Y,Z){return U.H.useReducer(R,Y,Z)},je.useRef=function(R){return U.H.useRef(R)},je.useState=function(R){return U.H.useState(R)},je.useSyncExternalStore=function(R,Y,Z){return U.H.useSyncExternalStore(R,Y,Z)},je.useTransition=function(){return U.H.useTransition()},je.version="19.2.3",je}var h0;function jm(){return h0||(h0=1,Kh.exports=uE()),Kh.exports}var w=jm();const Cb=_m(w),Em=oE({__proto__:null,default:Cb},[w]);var Yh={exports:{}},Eo={},Xh={exports:{}},Wh={};var f0;function dE(){return f0||(f0=1,(function(t){function e(C,I){var B=C.length;C.push(I);e:for(;0<B;){var de=B-1>>>1,Se=C[de];if(0<o(Se,I))C[de]=I,C[B]=Se,B=de;else break e}}function s(C){return C.length===0?null:C[0]}function r(C){if(C.length===0)return null;var I=C[0],B=C.pop();if(B!==I){C[0]=B;e:for(var de=0,Se=C.length,R=Se>>>1;de<R;){var Y=2*(de+1)-1,Z=C[Y],ne=Y+1,be=C[ne];if(0>o(Z,B))ne<Se&&0>o(be,Z)?(C[de]=be,C[ne]=B,de=ne):(C[de]=Z,C[Y]=B,de=Y);else if(ne<Se&&0>o(be,B))C[de]=be,C[ne]=B,de=ne;else break e}}return I}function o(C,I){var B=C.sortIndex-I.sortIndex;return B!==0?B:C.id-I.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();t.unstable_now=function(){return d.now()-f}}var p=[],m=[],y=1,v=null,b=3,S=!1,_=!1,E=!1,T=!1,A=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function L(C){for(var I=s(m);I!==null;){if(I.callback===null)r(m);else if(I.startTime<=C)r(m),I.sortIndex=I.expirationTime,e(p,I);else break;I=s(m)}}function G(C){if(E=!1,L(C),!_)if(s(p)!==null)_=!0,F||(F=!0,ue());else{var I=s(m);I!==null&&ee(G,I.startTime-C)}}var F=!1,U=-1,M=5,J=-1;function re(){return T?!0:!(t.unstable_now()-J<M)}function xe(){if(T=!1,F){var C=t.unstable_now();J=C;var I=!0;try{e:{_=!1,E&&(E=!1,D(U),U=-1),S=!0;var B=b;try{t:{for(L(C),v=s(p);v!==null&&!(v.expirationTime>C&&re());){var de=v.callback;if(typeof de=="function"){v.callback=null,b=v.priorityLevel;var Se=de(v.expirationTime<=C);if(C=t.unstable_now(),typeof Se=="function"){v.callback=Se,L(C),I=!0;break t}v===s(p)&&r(p),L(C)}else r(p);v=s(p)}if(v!==null)I=!0;else{var R=s(m);R!==null&&ee(G,R.startTime-C),I=!1}}break e}finally{v=null,b=B,S=!1}I=void 0}}finally{I?ue():F=!1}}}var ue;if(typeof N=="function")ue=function(){N(xe)};else if(typeof MessageChannel<"u"){var Ie=new MessageChannel,Ve=Ie.port2;Ie.port1.onmessage=xe,ue=function(){Ve.postMessage(null)}}else ue=function(){A(xe,0)};function ee(C,I){U=A(function(){C(t.unstable_now())},I)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(C){C.callback=null},t.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<C?Math.floor(1e3/C):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(C){switch(b){case 1:case 2:case 3:var I=3;break;default:I=b}var B=b;b=I;try{return C()}finally{b=B}},t.unstable_requestPaint=function(){T=!0},t.unstable_runWithPriority=function(C,I){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var B=b;b=C;try{return I()}finally{b=B}},t.unstable_scheduleCallback=function(C,I,B){var de=t.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?de+B:de):B=de,C){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=B+Se,C={id:y++,callback:I,priorityLevel:C,startTime:B,expirationTime:Se,sortIndex:-1},B>de?(C.sortIndex=B,e(m,C),s(p)===null&&C===s(m)&&(E?(D(U),U=-1):E=!0,ee(G,B-de))):(C.sortIndex=Se,e(p,C),_||S||(_=!0,F||(F=!0,ue()))),C},t.unstable_shouldYield=re,t.unstable_wrapCallback=function(C){var I=b;return function(){var B=b;b=I;try{return C.apply(this,arguments)}finally{b=B}}}})(Wh)),Wh}var m0;function hE(){return m0||(m0=1,Xh.exports=dE()),Xh.exports}var Jh={exports:{}},Mt={};var p0;function fE(){if(p0)return Mt;p0=1;var t=jm();function e(p){var m="https://react.dev/errors/"+p;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+p+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(e(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(p,m,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:""+v,children:p,containerInfo:m,implementation:y}}var d=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Mt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Mt.createPortal=function(p,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(e(299));return u(p,m,null,y)},Mt.flushSync=function(p){var m=d.T,y=r.p;try{if(d.T=null,r.p=2,p)return p()}finally{d.T=m,r.p=y,r.d.f()}},Mt.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(p,m))},Mt.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Mt.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var y=m.as,v=f(y,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?r.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:S}):y==="script"&&r.d.X(p,{crossOrigin:v,integrity:b,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Mt.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=f(m.as,m.crossOrigin);r.d.M(p,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(p)},Mt.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,v=f(y,m.crossOrigin);r.d.L(p,y,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Mt.preloadModule=function(p,m){if(typeof p=="string")if(m){var y=f(m.as,m.crossOrigin);r.d.m(p,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(p)},Mt.requestFormReset=function(p){r.d.r(p)},Mt.unstable_batchedUpdates=function(p,m){return p(m)},Mt.useFormState=function(p,m,y){return d.H.useFormState(p,m,y)},Mt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Mt.version="19.2.3",Mt}var g0;function Rb(){if(g0)return Jh.exports;g0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Jh.exports=fE(),Jh.exports}var y0;function mE(){if(y0)return Eo;y0=1;var t=hE(),e=jm(),s=Rb();function r(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function u(n){var a=n,i=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(i=a.return),n=a.return;while(n)}return a.tag===3?i:null}function d(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function f(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function p(n){if(u(n)!==n)throw Error(r(188))}function m(n){var a=n.alternate;if(!a){if(a=u(n),a===null)throw Error(r(188));return a!==n?null:n}for(var i=n,c=a;;){var h=i.return;if(h===null)break;var g=h.alternate;if(g===null){if(c=h.return,c!==null){i=c;continue}break}if(h.child===g.child){for(g=h.child;g;){if(g===i)return p(h),n;if(g===c)return p(h),a;g=g.sibling}throw Error(r(188))}if(i.return!==c.return)i=h,c=g;else{for(var x=!1,j=h.child;j;){if(j===i){x=!0,i=h,c=g;break}if(j===c){x=!0,c=h,i=g;break}j=j.sibling}if(!x){for(j=g.child;j;){if(j===i){x=!0,i=g,c=h;break}if(j===c){x=!0,c=g,i=h;break}j=j.sibling}if(!x)throw Error(r(189))}}if(i.alternate!==c)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?n:a}function y(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=y(n),a!==null)return a;n=n.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),N=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),re=Symbol.for("react.memo_cache_sentinel"),xe=Symbol.iterator;function ue(n){return n===null||typeof n!="object"?null:(n=xe&&n[xe]||n["@@iterator"],typeof n=="function"?n:null)}var Ie=Symbol.for("react.client.reference");function Ve(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===Ie?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case E:return"Fragment";case A:return"Profiler";case T:return"StrictMode";case G:return"Suspense";case F:return"SuspenseList";case J:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case _:return"Portal";case N:return n.displayName||"Context";case D:return(n._context.displayName||"Context")+".Consumer";case L:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case U:return a=n.displayName||null,a!==null?a:Ve(n.type)||"Memo";case M:a=n._payload,n=n._init;try{return Ve(n(a))}catch{}}return null}var ee=Array.isArray,C=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},de=[],Se=-1;function R(n){return{current:n}}function Y(n){0>Se||(n.current=de[Se],de[Se]=null,Se--)}function Z(n,a){Se++,de[Se]=n.current,n.current=a}var ne=R(null),be=R(null),_e=R(null),pe=R(null);function ot(n,a){switch(Z(_e,a),Z(be,n),Z(ne,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?Ov(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=Ov(a),n=Dv(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Y(ne),Z(ne,n)}function Le(){Y(ne),Y(be),Y(_e)}function cn(n){n.memoizedState!==null&&Z(pe,n);var a=ne.current,i=Dv(a,n.type);a!==i&&(Z(be,n),Z(ne,i))}function Ht(n){be.current===n&&(Y(ne),Y(be)),pe.current===n&&(Y(pe),bo._currentValue=B)}var jt,jn;function En(n){if(jt===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);jt=a&&a[1]||"",jn=-1<i.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+jt+n+jn}var oa=!1;function sr(n,a){if(!n||oa)return"";oa=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(H){var $=H}Reflect.construct(n,[],W)}else{try{W.call()}catch(H){$=H}n.call(W.prototype)}}else{try{throw Error()}catch(H){$=H}(W=n())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(H){if(H&&$&&typeof H.stack=="string")return[H.stack,$.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=c.DetermineComponentFrameRoot(),x=g[0],j=g[1];if(x&&j){var k=x.split(`
4
+ `),V=j.split(`
5
+ `);for(h=c=0;c<k.length&&!k[c].includes("DetermineComponentFrameRoot");)c++;for(;h<V.length&&!V[h].includes("DetermineComponentFrameRoot");)h++;if(c===k.length||h===V.length)for(c=k.length-1,h=V.length-1;1<=c&&0<=h&&k[c]!==V[h];)h--;for(;1<=c&&0<=h;c--,h--)if(k[c]!==V[h]){if(c!==1||h!==1)do if(c--,h--,0>h||k[c]!==V[h]){var K=`
6
+ `+k[c].replace(" at new "," at ");return n.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",n.displayName)),K}while(1<=c&&0<=h);break}}}finally{oa=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?En(i):""}function ol(n,a){switch(n.tag){case 26:case 27:case 5:return En(n.type);case 16:return En("Lazy");case 13:return n.child!==a&&a!==null?En("Suspense Fallback"):En("Suspense");case 19:return En("SuspenseList");case 0:case 15:return sr(n.type,!1);case 11:return sr(n.type.render,!1);case 1:return sr(n.type,!0);case 31:return En("Activity");default:return""}}function Ni(n){try{var a="",i=null;do a+=ol(n,i),i=n,n=n.return;while(n);return a}catch(c){return`
7
+ Error generating stack: `+c.message+`
8
+ `+c.stack}}var ar=Object.prototype.hasOwnProperty,rr=t.unstable_scheduleCallback,ir=t.unstable_cancelCallback,ll=t.unstable_shouldYield,cl=t.unstable_requestPaint,Et=t.unstable_now,or=t.unstable_getCurrentPriorityLevel,Ai=t.unstable_ImmediatePriority,ki=t.unstable_UserBlockingPriority,la=t.unstable_NormalPriority,Fn=t.unstable_LowPriority,ul=t.unstable_IdlePriority,lr=t.log,dl=t.unstable_setDisableYieldValue,bs=null,Tt=null;function Kn(n){if(typeof lr=="function"&&dl(n),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(bs,n)}catch{}}var yt=Math.clz32?Math.clz32:zu,hl=Math.log,Mu=Math.LN2;function zu(n){return n>>>=0,n===0?32:31-(hl(n)/Mu|0)|0}var cr=256,Ci=262144,Ri=4194304;function Ut(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function ca(n,a,i){var c=n.pendingLanes;if(c===0)return 0;var h=0,g=n.suspendedLanes,x=n.pingedLanes;n=n.warmLanes;var j=c&134217727;return j!==0?(c=j&~g,c!==0?h=Ut(c):(x&=j,x!==0?h=Ut(x):i||(i=j&~n,i!==0&&(h=Ut(i))))):(j=c&~g,j!==0?h=Ut(j):x!==0?h=Ut(x):i||(i=c&~n,i!==0&&(h=Ut(i)))),h===0?0:a!==0&&a!==h&&(a&g)===0&&(g=h&-h,i=a&-a,g>=i||g===32&&(i&4194048)!==0)?a:h}function ua(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Lu(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 n=Ri;return Ri<<=1,(Ri&62914560)===0&&(Ri=4194304),n}function Oi(n){for(var a=[],i=0;31>i;i++)a.push(n);return a}function da(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Uu(n,a,i,c,h,g){var x=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var j=n.entanglements,k=n.expirationTimes,V=n.hiddenUpdates;for(i=x&~i;0<i;){var K=31-yt(i),W=1<<K;j[K]=0,k[K]=-1;var $=V[K];if($!==null)for(V[K]=null,K=0;K<$.length;K++){var H=$[K];H!==null&&(H.lane&=-536870913)}i&=~W}c!==0&&ml(n,c,0),g!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=g&~(x&~a))}function ml(n,a,i){n.pendingLanes|=a,n.suspendedLanes&=~a;var c=31-yt(a);n.entangledLanes|=a,n.entanglements[c]=n.entanglements[c]|1073741824|i&261930}function pl(n,a){var i=n.entangledLanes|=a;for(n=n.entanglements;i;){var c=31-yt(i),h=1<<c;h&a|n[c]&a&&(n[c]|=a),i&=~h}}function gl(n,a){var i=a&-a;return i=(i&42)!==0?1:Di(i),(i&(n.suspendedLanes|a))!==0?0:i}function Di(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function ur(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function yl(){var n=I.p;return n!==0?n:(n=window.event,n===void 0?32:n0(n.type))}function vl(n,a){var i=I.p;try{return I.p=n,a()}finally{I.p=i}}var Ln=Math.random().toString(36).slice(2),q="__reactFiber$"+Ln,te="__reactProps$"+Ln,Ae="__reactContainer$"+Ln,Pt="__reactEvents$"+Ln,Pu="__reactListeners$"+Ln,xl="__reactHandles$"+Ln,ha="__reactResources$"+Ln,fa="__reactMarker$"+Ln;function Mi(n){delete n[q],delete n[te],delete n[Pt],delete n[Pu],delete n[xl]}function dr(n){var a=n[q];if(a)return a;for(var i=n.parentNode;i;){if(a=i[Ae]||i[q]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(n=Bv(n);n!==null;){if(i=n[q])return i;n=Bv(n)}return a}n=i,i=n.parentNode}return null}function hr(n){if(n=n[q]||n[Ae]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function zi(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(r(33))}function fr(n){var a=n[ha];return a||(a=n[ha]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function St(n){n[fa]=!0}var bp=new Set,wp={};function ma(n,a){mr(n,a),mr(n+"Capture",a)}function mr(n,a){for(wp[n]=a,n=0;n<a.length;n++)bp.add(a[n])}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]*$"),Sp={},_p={};function ZS(n){return ar.call(_p,n)?!0:ar.call(Sp,n)?!1:QS.test(n)?_p[n]=!0:(Sp[n]=!0,!1)}function bl(n,a,i){if(ZS(a))if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var c=a.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+i)}}function wl(n,a,i){if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+i)}}function Yn(n,a,i,c){if(c===null)n.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(a,i,""+c)}}function un(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function jp(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function e_(n,a,i){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var h=c.get,g=c.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return h.call(this)},set:function(x){i=""+x,g.call(this,x)}}),Object.defineProperty(n,a,{enumerable:c.enumerable}),{getValue:function(){return i},setValue:function(x){i=""+x},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function Vu(n){if(!n._valueTracker){var a=jp(n)?"checked":"value";n._valueTracker=e_(n,a,""+n[a])}}function Ep(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var i=a.getValue(),c="";return n&&(c=jp(n)?n.checked?"true":"false":n.value),n=c,n!==i?(a.setValue(n),!0):!1}function Sl(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var t_=/[\n"\\]/g;function dn(n){return n.replace(t_,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Bu(n,a,i,c,h,g,x,j){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),a!=null?x==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+un(a)):n.value!==""+un(a)&&(n.value=""+un(a)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),a!=null?Iu(n,x,un(a)):i!=null?Iu(n,x,un(i)):c!=null&&n.removeAttribute("value"),h==null&&g!=null&&(n.defaultChecked=!!g),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?n.name=""+un(j):n.removeAttribute("name")}function Tp(n,a,i,c,h,g,x,j){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(n.type=g),a!=null||i!=null){if(!(g!=="submit"&&g!=="reset"||a!=null)){Vu(n);return}i=i!=null?""+un(i):"",a=a!=null?""+un(a):i,j||a===n.value||(n.value=a),n.defaultValue=a}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=j?n.checked:!!c,n.defaultChecked=!!c,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),Vu(n)}function Iu(n,a,i){a==="number"&&Sl(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function pr(n,a,i,c){if(n=n.options,a){a={};for(var h=0;h<i.length;h++)a["$"+i[h]]=!0;for(i=0;i<n.length;i++)h=a.hasOwnProperty("$"+n[i].value),n[i].selected!==h&&(n[i].selected=h),h&&c&&(n[i].defaultSelected=!0)}else{for(i=""+un(i),a=null,h=0;h<n.length;h++){if(n[h].value===i){n[h].selected=!0,c&&(n[h].defaultSelected=!0);return}a!==null||n[h].disabled||(a=n[h])}a!==null&&(a.selected=!0)}}function Np(n,a,i){if(a!=null&&(a=""+un(a),a!==n.value&&(n.value=a),i==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=i!=null?""+un(i):""}function Ap(n,a,i,c){if(a==null){if(c!=null){if(i!=null)throw Error(r(92));if(ee(c)){if(1<c.length)throw Error(r(93));c=c[0]}i=c}i==null&&(i=""),a=i}i=un(a),n.defaultValue=i,c=n.textContent,c===i&&c!==""&&c!==null&&(n.value=c),Vu(n)}function gr(n,a){if(a){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=a;return}}n.textContent=a}var n_=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 kp(n,a,i){var c=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?c?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":c?n.setProperty(a,i):typeof i!="number"||i===0||n_.has(a)?a==="float"?n.cssFloat=i:n[a]=(""+i).trim():n[a]=i+"px"}function Cp(n,a,i){if(a!=null&&typeof a!="object")throw Error(r(62));if(n=n.style,i!=null){for(var c in i)!i.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var h in a)c=a[h],a.hasOwnProperty(h)&&i[h]!==c&&kp(n,h,c)}else for(var g in a)a.hasOwnProperty(g)&&kp(n,g,a[g])}function qu(n){if(n.indexOf("-")===-1)return!1;switch(n){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 s_=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"]]),a_=/^[\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(n){return a_.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Xn(){}var $u=null;function Hu(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var yr=null,vr=null;function Rp(n){var a=hr(n);if(a&&(n=a.stateNode)){var i=n[te]||null;e:switch(n=a.stateNode,a.type){case"input":if(Bu(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+dn(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var c=i[a];if(c!==n&&c.form===n.form){var h=c[te]||null;if(!h)throw Error(r(90));Bu(c,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(a=0;a<i.length;a++)c=i[a],c.form===n.form&&Ep(c)}break e;case"textarea":Np(n,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&pr(n,!!i.multiple,a,!1)}}}var Gu=!1;function Op(n,a,i){if(Gu)return n(a,i);Gu=!0;try{var c=n(a);return c}finally{if(Gu=!1,(yr!==null||vr!==null)&&(uc(),yr&&(a=yr,n=vr,vr=yr=null,Rp(a),n)))for(a=0;a<n.length;a++)Rp(n[a])}}function Li(n,a){var i=n.stateNode;if(i===null)return null;var c=i[te]||null;if(c===null)return null;i=c[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(r(231,a,typeof i));return i}var Wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(Wn)try{var Ui={};Object.defineProperty(Ui,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",Ui,Ui),window.removeEventListener("test",Ui,Ui)}catch{Fu=!1}var ws=null,Ku=null,jl=null;function Dp(){if(jl)return jl;var n,a=Ku,i=a.length,c,h="value"in ws?ws.value:ws.textContent,g=h.length;for(n=0;n<i&&a[n]===h[n];n++);var x=i-n;for(c=1;c<=x&&a[i-c]===h[g-c];c++);return jl=h.slice(n,1<c?1-c:void 0)}function El(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Tl(){return!0}function Mp(){return!1}function Gt(n){function a(i,c,h,g,x){this._reactName=i,this._targetInst=h,this.type=c,this.nativeEvent=g,this.target=x,this.currentTarget=null;for(var j in n)n.hasOwnProperty(j)&&(i=n[j],this[j]=i?i(g):g[j]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Tl:Mp,this.isPropagationStopped=Mp,this}return v(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Tl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Tl)},persist:function(){},isPersistent:Tl}),a}var pa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nl=Gt(pa),Pi=v({},pa,{view:0,detail:0}),r_=Gt(Pi),Yu,Xu,Vi,Al=v({},Pi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ju,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Vi&&(Vi&&n.type==="mousemove"?(Yu=n.screenX-Vi.screenX,Xu=n.screenY-Vi.screenY):Xu=Yu=0,Vi=n),Yu)},movementY:function(n){return"movementY"in n?n.movementY:Xu}}),zp=Gt(Al),i_=v({},Al,{dataTransfer:0}),o_=Gt(i_),l_=v({},Pi,{relatedTarget:0}),Wu=Gt(l_),c_=v({},pa,{animationName:0,elapsedTime:0,pseudoElement:0}),u_=Gt(c_),d_=v({},pa,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),h_=Gt(d_),f_=v({},pa,{data:0}),Lp=Gt(f_),m_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},p_={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"},g_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function y_(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=g_[n])?!!a[n]:!1}function Ju(){return y_}var v_=v({},Pi,{key:function(n){if(n.key){var a=m_[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=El(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?p_[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ju,charCode:function(n){return n.type==="keypress"?El(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?El(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),x_=Gt(v_),b_=v({},Al,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Up=Gt(b_),w_=v({},Pi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ju}),S_=Gt(w_),__=v({},pa,{propertyName:0,elapsedTime:0,pseudoElement:0}),j_=Gt(__),E_=v({},Al,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),T_=Gt(E_),N_=v({},pa,{newState:0,oldState:0}),A_=Gt(N_),k_=[9,13,27,32],Qu=Wn&&"CompositionEvent"in window,Bi=null;Wn&&"documentMode"in document&&(Bi=document.documentMode);var C_=Wn&&"TextEvent"in window&&!Bi,Pp=Wn&&(!Qu||Bi&&8<Bi&&11>=Bi),Vp=" ",Bp=!1;function Ip(n,a){switch(n){case"keyup":return k_.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qp(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var xr=!1;function R_(n,a){switch(n){case"compositionend":return qp(a);case"keypress":return a.which!==32?null:(Bp=!0,Vp);case"textInput":return n=a.data,n===Vp&&Bp?null:n;default:return null}}function O_(n,a){if(xr)return n==="compositionend"||!Qu&&Ip(n,a)?(n=Dp(),jl=Ku=ws=null,xr=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Pp&&a.locale!=="ko"?null:a.data;default:return null}}var D_={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 $p(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!D_[n.type]:a==="textarea"}function Hp(n,a,i,c){yr?vr?vr.push(c):vr=[c]:yr=c,a=yc(a,"onChange"),0<a.length&&(i=new Nl("onChange","change",null,i,c),n.push({event:i,listeners:a}))}var Ii=null,qi=null;function M_(n){Tv(n,0)}function kl(n){var a=zi(n);if(Ep(a))return n}function Gp(n,a){if(n==="change")return a}var Fp=!1;if(Wn){var Zu;if(Wn){var ed="oninput"in document;if(!ed){var Kp=document.createElement("div");Kp.setAttribute("oninput","return;"),ed=typeof Kp.oninput=="function"}Zu=ed}else Zu=!1;Fp=Zu&&(!document.documentMode||9<document.documentMode)}function Yp(){Ii&&(Ii.detachEvent("onpropertychange",Xp),qi=Ii=null)}function Xp(n){if(n.propertyName==="value"&&kl(qi)){var a=[];Hp(a,qi,n,Hu(n)),Op(M_,a)}}function z_(n,a,i){n==="focusin"?(Yp(),Ii=a,qi=i,Ii.attachEvent("onpropertychange",Xp)):n==="focusout"&&Yp()}function L_(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return kl(qi)}function U_(n,a){if(n==="click")return kl(a)}function P_(n,a){if(n==="input"||n==="change")return kl(a)}function V_(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Qt=typeof Object.is=="function"?Object.is:V_;function $i(n,a){if(Qt(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var i=Object.keys(n),c=Object.keys(a);if(i.length!==c.length)return!1;for(c=0;c<i.length;c++){var h=i[c];if(!ar.call(a,h)||!Qt(n[h],a[h]))return!1}return!0}function Wp(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Jp(n,a){var i=Wp(n);n=0;for(var c;i;){if(i.nodeType===3){if(c=n+i.textContent.length,n<=a&&c>=a)return{node:i,offset:a-n};n=c}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Wp(i)}}function Qp(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Qp(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Zp(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=Sl(n.document);a instanceof n.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)n=a.contentWindow;else break;a=Sl(n.document)}return a}function td(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var B_=Wn&&"documentMode"in document&&11>=document.documentMode,br=null,nd=null,Hi=null,sd=!1;function eg(n,a,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;sd||br==null||br!==Sl(c)||(c=br,"selectionStart"in c&&td(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Hi&&$i(Hi,c)||(Hi=c,c=yc(nd,"onSelect"),0<c.length&&(a=new Nl("onSelect","select",null,a,i),n.push({event:a,listeners:c}),a.target=br)))}function ga(n,a){var i={};return i[n.toLowerCase()]=a.toLowerCase(),i["Webkit"+n]="webkit"+a,i["Moz"+n]="moz"+a,i}var wr={animationend:ga("Animation","AnimationEnd"),animationiteration:ga("Animation","AnimationIteration"),animationstart:ga("Animation","AnimationStart"),transitionrun:ga("Transition","TransitionRun"),transitionstart:ga("Transition","TransitionStart"),transitioncancel:ga("Transition","TransitionCancel"),transitionend:ga("Transition","TransitionEnd")},ad={},tg={};Wn&&(tg=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);function ya(n){if(ad[n])return ad[n];if(!wr[n])return n;var a=wr[n],i;for(i in a)if(a.hasOwnProperty(i)&&i in tg)return ad[n]=a[i];return n}var ng=ya("animationend"),sg=ya("animationiteration"),ag=ya("animationstart"),I_=ya("transitionrun"),q_=ya("transitionstart"),$_=ya("transitioncancel"),rg=ya("transitionend"),ig=new Map,rd="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(" ");rd.push("scrollEnd");function Tn(n,a){ig.set(n,a),ma(a,[n])}var Cl=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},hn=[],Sr=0,id=0;function Rl(){for(var n=Sr,a=id=Sr=0;a<n;){var i=hn[a];hn[a++]=null;var c=hn[a];hn[a++]=null;var h=hn[a];hn[a++]=null;var g=hn[a];if(hn[a++]=null,c!==null&&h!==null){var x=c.pending;x===null?h.next=h:(h.next=x.next,x.next=h),c.pending=h}g!==0&&og(i,h,g)}}function Ol(n,a,i,c){hn[Sr++]=n,hn[Sr++]=a,hn[Sr++]=i,hn[Sr++]=c,id|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function od(n,a,i,c){return Ol(n,a,i,c),Dl(n)}function va(n,a){return Ol(n,null,null,a),Dl(n)}function og(n,a,i){n.lanes|=i;var c=n.alternate;c!==null&&(c.lanes|=i);for(var h=!1,g=n.return;g!==null;)g.childLanes|=i,c=g.alternate,c!==null&&(c.childLanes|=i),g.tag===22&&(n=g.stateNode,n===null||n._visibility&1||(h=!0)),n=g,g=g.return;return n.tag===3?(g=n.stateNode,h&&a!==null&&(h=31-yt(i),n=g.hiddenUpdates,c=n[h],c===null?n[h]=[a]:c.push(a),a.lane=i|536870912),g):null}function Dl(n){if(50<fo)throw fo=0,gh=null,Error(r(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var _r={};function H_(n,a,i,c){this.tag=n,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zt(n,a,i,c){return new H_(n,a,i,c)}function ld(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Jn(n,a){var i=n.alternate;return i===null?(i=Zt(n.tag,a,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=a,i.type=n.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=n.flags&65011712,i.childLanes=n.childLanes,i.lanes=n.lanes,i.child=n.child,i.memoizedProps=n.memoizedProps,i.memoizedState=n.memoizedState,i.updateQueue=n.updateQueue,a=n.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function lg(n,a){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=i.childLanes,n.lanes=i.lanes,n.child=i.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=i.memoizedProps,n.memoizedState=i.memoizedState,n.updateQueue=i.updateQueue,n.type=i.type,a=i.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function Ml(n,a,i,c,h,g){var x=0;if(c=n,typeof n=="function")ld(n)&&(x=1);else if(typeof n=="string")x=Xj(n,i,ne.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case J:return n=Zt(31,i,a,h),n.elementType=J,n.lanes=g,n;case E:return xa(i.children,h,g,a);case T:x=8,h|=24;break;case A:return n=Zt(12,i,a,h|2),n.elementType=A,n.lanes=g,n;case G:return n=Zt(13,i,a,h),n.elementType=G,n.lanes=g,n;case F:return n=Zt(19,i,a,h),n.elementType=F,n.lanes=g,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:x=10;break e;case D:x=9;break e;case L:x=11;break e;case U:x=14;break e;case M:x=16,c=null;break e}x=29,i=Error(r(130,n===null?"null":typeof n,"")),c=null}return a=Zt(x,i,a,h),a.elementType=n,a.type=c,a.lanes=g,a}function xa(n,a,i,c){return n=Zt(7,n,c,a),n.lanes=i,n}function cd(n,a,i){return n=Zt(6,n,null,a),n.lanes=i,n}function cg(n){var a=Zt(18,null,null,0);return a.stateNode=n,a}function ud(n,a,i){return a=Zt(4,n.children!==null?n.children:[],n.key,a),a.lanes=i,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var ug=new WeakMap;function fn(n,a){if(typeof n=="object"&&n!==null){var i=ug.get(n);return i!==void 0?i:(a={value:n,source:a,stack:Ni(a)},ug.set(n,a),a)}return{value:n,source:a,stack:Ni(a)}}var jr=[],Er=0,zl=null,Gi=0,mn=[],pn=0,Ss=null,Un=1,Pn="";function Qn(n,a){jr[Er++]=Gi,jr[Er++]=zl,zl=n,Gi=a}function dg(n,a,i){mn[pn++]=Un,mn[pn++]=Pn,mn[pn++]=Ss,Ss=n;var c=Un;n=Pn;var h=32-yt(c)-1;c&=~(1<<h),i+=1;var g=32-yt(a)+h;if(30<g){var x=h-h%5;g=(c&(1<<x)-1).toString(32),c>>=x,h-=x,Un=1<<32-yt(a)+h|i<<h|c,Pn=g+n}else Un=1<<g|i<<h|c,Pn=n}function dd(n){n.return!==null&&(Qn(n,1),dg(n,1,0))}function hd(n){for(;n===zl;)zl=jr[--Er],jr[Er]=null,Gi=jr[--Er],jr[Er]=null;for(;n===Ss;)Ss=mn[--pn],mn[pn]=null,Pn=mn[--pn],mn[pn]=null,Un=mn[--pn],mn[pn]=null}function hg(n,a){mn[pn++]=Un,mn[pn++]=Pn,mn[pn++]=Ss,Un=a.id,Pn=a.overflow,Ss=n}var Nt=null,Xe=null,ze=!1,_s=null,gn=!1,fd=Error(r(519));function js(n){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fi(fn(a,n)),fd}function fg(n){var a=n.stateNode,i=n.type,c=n.memoizedProps;switch(a[q]=n,a[te]=c,i){case"dialog":Re("cancel",a),Re("close",a);break;case"iframe":case"object":case"embed":Re("load",a);break;case"video":case"audio":for(i=0;i<po.length;i++)Re(po[i],a);break;case"source":Re("error",a);break;case"img":case"image":case"link":Re("error",a),Re("load",a);break;case"details":Re("toggle",a);break;case"input":Re("invalid",a),Tp(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Re("invalid",a);break;case"textarea":Re("invalid",a),Ap(a,c.value,c.defaultValue,c.children)}i=c.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||c.suppressHydrationWarning===!0||Cv(a.textContent,i)?(c.popover!=null&&(Re("beforetoggle",a),Re("toggle",a)),c.onScroll!=null&&Re("scroll",a),c.onScrollEnd!=null&&Re("scrollend",a),c.onClick!=null&&(a.onclick=Xn),a=!0):a=!1,a||js(n,!0)}function mg(n){for(Nt=n.return;Nt;)switch(Nt.tag){case 5:case 31:case 13:gn=!1;return;case 27:case 3:gn=!0;return;default:Nt=Nt.return}}function Tr(n){if(n!==Nt)return!1;if(!ze)return mg(n),ze=!0,!1;var a=n.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||Rh(n.type,n.memoizedProps)),i=!i),i&&Xe&&js(n),mg(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));Xe=Vv(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));Xe=Vv(n)}else a===27?(a=Xe,Ps(n.type)?(n=Lh,Lh=null,Xe=n):Xe=a):Xe=Nt?vn(n.stateNode.nextSibling):null;return!0}function ba(){Xe=Nt=null,ze=!1}function md(){var n=_s;return n!==null&&(Xt===null?Xt=n:Xt.push.apply(Xt,n),_s=null),n}function Fi(n){_s===null?_s=[n]:_s.push(n)}var pd=R(null),wa=null,Zn=null;function Es(n,a,i){Z(pd,a._currentValue),a._currentValue=i}function es(n){n._currentValue=pd.current,Y(pd)}function gd(n,a,i){for(;n!==null;){var c=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,c!==null&&(c.childLanes|=a)):c!==null&&(c.childLanes&a)!==a&&(c.childLanes|=a),n===i)break;n=n.return}}function yd(n,a,i,c){var h=n.child;for(h!==null&&(h.return=n);h!==null;){var g=h.dependencies;if(g!==null){var x=h.child;g=g.firstContext;e:for(;g!==null;){var j=g;g=h;for(var k=0;k<a.length;k++)if(j.context===a[k]){g.lanes|=i,j=g.alternate,j!==null&&(j.lanes|=i),gd(g.return,i,n),c||(x=null);break e}g=j.next}}else if(h.tag===18){if(x=h.return,x===null)throw Error(r(341));x.lanes|=i,g=x.alternate,g!==null&&(g.lanes|=i),gd(x,i,n),x=null}else x=h.child;if(x!==null)x.return=h;else for(x=h;x!==null;){if(x===n){x=null;break}if(h=x.sibling,h!==null){h.return=x.return,x=h;break}x=x.return}h=x}}function Nr(n,a,i,c){n=null;for(var h=a,g=!1;h!==null;){if(!g){if((h.flags&524288)!==0)g=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var x=h.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var j=h.type;Qt(h.pendingProps.value,x.value)||(n!==null?n.push(j):n=[j])}}else if(h===pe.current){if(x=h.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(bo):n=[bo])}h=h.return}n!==null&&yd(a,n,i,c),a.flags|=262144}function Ll(n){for(n=n.firstContext;n!==null;){if(!Qt(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Sa(n){wa=n,Zn=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function At(n){return pg(wa,n)}function Ul(n,a){return wa===null&&Sa(n),pg(n,a)}function pg(n,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},Zn===null){if(n===null)throw Error(r(308));Zn=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Zn=Zn.next=a;return i}var G_=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(i,c){n.push(c)}};this.abort=function(){a.aborted=!0,n.forEach(function(i){return i()})}},F_=t.unstable_scheduleCallback,K_=t.unstable_NormalPriority,ut={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vd(){return{controller:new G_,data:new Map,refCount:0}}function Ki(n){n.refCount--,n.refCount===0&&F_(K_,function(){n.controller.abort()})}var Yi=null,xd=0,Ar=0,kr=null;function Y_(n,a){if(Yi===null){var i=Yi=[];xd=0,Ar=Sh(),kr={status:"pending",value:void 0,then:function(c){i.push(c)}}}return xd++,a.then(gg,gg),a}function gg(){if(--xd===0&&Yi!==null){kr!==null&&(kr.status="fulfilled");var n=Yi;Yi=null,Ar=0,kr=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function X_(n,a){var i=[],c={status:"pending",value:null,reason:null,then:function(h){i.push(h)}};return n.then(function(){c.status="fulfilled",c.value=a;for(var h=0;h<i.length;h++)(0,i[h])(a)},function(h){for(c.status="rejected",c.reason=h,h=0;h<i.length;h++)(0,i[h])(void 0)}),c}var yg=C.S;C.S=function(n,a){ev=Et(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&Y_(n,a),yg!==null&&yg(n,a)};var _a=R(null);function bd(){var n=_a.current;return n!==null?n:Ke.pooledCache}function Pl(n,a){a===null?Z(_a,_a.current):Z(_a,a.pool)}function vg(){var n=bd();return n===null?null:{parent:ut._currentValue,pool:n}}var Cr=Error(r(460)),wd=Error(r(474)),Vl=Error(r(542)),Bl={then:function(){}};function xg(n){return n=n.status,n==="fulfilled"||n==="rejected"}function bg(n,a,i){switch(i=n[i],i===void 0?n.push(a):i!==a&&(a.then(Xn,Xn),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Sg(n),n;default:if(typeof a.status=="string")a.then(Xn,Xn);else{if(n=Ke,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=a,n.status="pending",n.then(function(c){if(a.status==="pending"){var h=a;h.status="fulfilled",h.value=c}},function(c){if(a.status==="pending"){var h=a;h.status="rejected",h.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Sg(n),n}throw Ea=a,Cr}}function ja(n){try{var a=n._init;return a(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Ea=i,Cr):i}}var Ea=null;function wg(){if(Ea===null)throw Error(r(459));var n=Ea;return Ea=null,n}function Sg(n){if(n===Cr||n===Vl)throw Error(r(483))}var Rr=null,Xi=0;function Il(n){var a=Xi;return Xi+=1,Rr===null&&(Rr=[]),bg(Rr,n,a)}function Wi(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function ql(n,a){throw a.$$typeof===b?Error(r(525)):(n=Object.prototype.toString.call(a),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function _g(n){function a(z,O){if(n){var P=z.deletions;P===null?(z.deletions=[O],z.flags|=16):P.push(O)}}function i(z,O){if(!n)return null;for(;O!==null;)a(z,O),O=O.sibling;return null}function c(z){for(var O=new Map;z!==null;)z.key!==null?O.set(z.key,z):O.set(z.index,z),z=z.sibling;return O}function h(z,O){return z=Jn(z,O),z.index=0,z.sibling=null,z}function g(z,O,P){return z.index=P,n?(P=z.alternate,P!==null?(P=P.index,P<O?(z.flags|=67108866,O):P):(z.flags|=67108866,O)):(z.flags|=1048576,O)}function x(z){return n&&z.alternate===null&&(z.flags|=67108866),z}function j(z,O,P,X){return O===null||O.tag!==6?(O=cd(P,z.mode,X),O.return=z,O):(O=h(O,P),O.return=z,O)}function k(z,O,P,X){var me=P.type;return me===E?K(z,O,P.props.children,X,P.key):O!==null&&(O.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===M&&ja(me)===O.type)?(O=h(O,P.props),Wi(O,P),O.return=z,O):(O=Ml(P.type,P.key,P.props,null,z.mode,X),Wi(O,P),O.return=z,O)}function V(z,O,P,X){return O===null||O.tag!==4||O.stateNode.containerInfo!==P.containerInfo||O.stateNode.implementation!==P.implementation?(O=ud(P,z.mode,X),O.return=z,O):(O=h(O,P.children||[]),O.return=z,O)}function K(z,O,P,X,me){return O===null||O.tag!==7?(O=xa(P,z.mode,X,me),O.return=z,O):(O=h(O,P),O.return=z,O)}function W(z,O,P){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=cd(""+O,z.mode,P),O.return=z,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case S:return P=Ml(O.type,O.key,O.props,null,z.mode,P),Wi(P,O),P.return=z,P;case _:return O=ud(O,z.mode,P),O.return=z,O;case M:return O=ja(O),W(z,O,P)}if(ee(O)||ue(O))return O=xa(O,z.mode,P,null),O.return=z,O;if(typeof O.then=="function")return W(z,Il(O),P);if(O.$$typeof===N)return W(z,Ul(z,O),P);ql(z,O)}return null}function $(z,O,P,X){var me=O!==null?O.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return me!==null?null:j(z,O,""+P,X);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case S:return P.key===me?k(z,O,P,X):null;case _:return P.key===me?V(z,O,P,X):null;case M:return P=ja(P),$(z,O,P,X)}if(ee(P)||ue(P))return me!==null?null:K(z,O,P,X,null);if(typeof P.then=="function")return $(z,O,Il(P),X);if(P.$$typeof===N)return $(z,O,Ul(z,P),X);ql(z,P)}return null}function H(z,O,P,X,me){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return z=z.get(P)||null,j(O,z,""+X,me);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case S:return z=z.get(X.key===null?P:X.key)||null,k(O,z,X,me);case _:return z=z.get(X.key===null?P:X.key)||null,V(O,z,X,me);case M:return X=ja(X),H(z,O,P,X,me)}if(ee(X)||ue(X))return z=z.get(P)||null,K(O,z,X,me,null);if(typeof X.then=="function")return H(z,O,P,Il(X),me);if(X.$$typeof===N)return H(z,O,P,Ul(O,X),me);ql(O,X)}return null}function ie(z,O,P,X){for(var me=null,Ue=null,he=O,Ne=O=0,De=null;he!==null&&Ne<P.length;Ne++){he.index>Ne?(De=he,he=null):De=he.sibling;var Pe=$(z,he,P[Ne],X);if(Pe===null){he===null&&(he=De);break}n&&he&&Pe.alternate===null&&a(z,he),O=g(Pe,O,Ne),Ue===null?me=Pe:Ue.sibling=Pe,Ue=Pe,he=De}if(Ne===P.length)return i(z,he),ze&&Qn(z,Ne),me;if(he===null){for(;Ne<P.length;Ne++)he=W(z,P[Ne],X),he!==null&&(O=g(he,O,Ne),Ue===null?me=he:Ue.sibling=he,Ue=he);return ze&&Qn(z,Ne),me}for(he=c(he);Ne<P.length;Ne++)De=H(he,z,Ne,P[Ne],X),De!==null&&(n&&De.alternate!==null&&he.delete(De.key===null?Ne:De.key),O=g(De,O,Ne),Ue===null?me=De:Ue.sibling=De,Ue=De);return n&&he.forEach(function($s){return a(z,$s)}),ze&&Qn(z,Ne),me}function ge(z,O,P,X){if(P==null)throw Error(r(151));for(var me=null,Ue=null,he=O,Ne=O=0,De=null,Pe=P.next();he!==null&&!Pe.done;Ne++,Pe=P.next()){he.index>Ne?(De=he,he=null):De=he.sibling;var $s=$(z,he,Pe.value,X);if($s===null){he===null&&(he=De);break}n&&he&&$s.alternate===null&&a(z,he),O=g($s,O,Ne),Ue===null?me=$s:Ue.sibling=$s,Ue=$s,he=De}if(Pe.done)return i(z,he),ze&&Qn(z,Ne),me;if(he===null){for(;!Pe.done;Ne++,Pe=P.next())Pe=W(z,Pe.value,X),Pe!==null&&(O=g(Pe,O,Ne),Ue===null?me=Pe:Ue.sibling=Pe,Ue=Pe);return ze&&Qn(z,Ne),me}for(he=c(he);!Pe.done;Ne++,Pe=P.next())Pe=H(he,z,Ne,Pe.value,X),Pe!==null&&(n&&Pe.alternate!==null&&he.delete(Pe.key===null?Ne:Pe.key),O=g(Pe,O,Ne),Ue===null?me=Pe:Ue.sibling=Pe,Ue=Pe);return n&&he.forEach(function(iE){return a(z,iE)}),ze&&Qn(z,Ne),me}function Fe(z,O,P,X){if(typeof P=="object"&&P!==null&&P.type===E&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case S:e:{for(var me=P.key;O!==null;){if(O.key===me){if(me=P.type,me===E){if(O.tag===7){i(z,O.sibling),X=h(O,P.props.children),X.return=z,z=X;break e}}else if(O.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===M&&ja(me)===O.type){i(z,O.sibling),X=h(O,P.props),Wi(X,P),X.return=z,z=X;break e}i(z,O);break}else a(z,O);O=O.sibling}P.type===E?(X=xa(P.props.children,z.mode,X,P.key),X.return=z,z=X):(X=Ml(P.type,P.key,P.props,null,z.mode,X),Wi(X,P),X.return=z,z=X)}return x(z);case _:e:{for(me=P.key;O!==null;){if(O.key===me)if(O.tag===4&&O.stateNode.containerInfo===P.containerInfo&&O.stateNode.implementation===P.implementation){i(z,O.sibling),X=h(O,P.children||[]),X.return=z,z=X;break e}else{i(z,O);break}else a(z,O);O=O.sibling}X=ud(P,z.mode,X),X.return=z,z=X}return x(z);case M:return P=ja(P),Fe(z,O,P,X)}if(ee(P))return ie(z,O,P,X);if(ue(P)){if(me=ue(P),typeof me!="function")throw Error(r(150));return P=me.call(P),ge(z,O,P,X)}if(typeof P.then=="function")return Fe(z,O,Il(P),X);if(P.$$typeof===N)return Fe(z,O,Ul(z,P),X);ql(z,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,O!==null&&O.tag===6?(i(z,O.sibling),X=h(O,P),X.return=z,z=X):(i(z,O),X=cd(P,z.mode,X),X.return=z,z=X),x(z)):i(z,O)}return function(z,O,P,X){try{Xi=0;var me=Fe(z,O,P,X);return Rr=null,me}catch(he){if(he===Cr||he===Vl)throw he;var Ue=Zt(29,he,null,z.mode);return Ue.lanes=X,Ue.return=z,Ue}}}var Ta=_g(!0),jg=_g(!1),Ts=!1;function Sd(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _d(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Ns(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function As(n,a,i){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(Be&2)!==0){var h=c.pending;return h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a,a=Dl(n),og(n,null,i),a}return Ol(n,c,a,i),Dl(n)}function Ji(n,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,i|=c,a.lanes=i,pl(n,i)}}function jd(n,a){var i=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,i===c)){var h=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var x={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?h=g=x:g=g.next=x,i=i.next}while(i!==null);g===null?h=g=a:g=g.next=a}else h=g=a;i={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=a:n.next=a,i.lastBaseUpdate=a}var Ed=!1;function Qi(){if(Ed){var n=kr;if(n!==null)throw n}}function Zi(n,a,i,c){Ed=!1;var h=n.updateQueue;Ts=!1;var g=h.firstBaseUpdate,x=h.lastBaseUpdate,j=h.shared.pending;if(j!==null){h.shared.pending=null;var k=j,V=k.next;k.next=null,x===null?g=V:x.next=V,x=k;var K=n.alternate;K!==null&&(K=K.updateQueue,j=K.lastBaseUpdate,j!==x&&(j===null?K.firstBaseUpdate=V:j.next=V,K.lastBaseUpdate=k))}if(g!==null){var W=h.baseState;x=0,K=V=k=null,j=g;do{var $=j.lane&-536870913,H=$!==j.lane;if(H?(Oe&$)===$:(c&$)===$){$!==0&&$===Ar&&(Ed=!0),K!==null&&(K=K.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ie=n,ge=j;$=a;var Fe=i;switch(ge.tag){case 1:if(ie=ge.payload,typeof ie=="function"){W=ie.call(Fe,W,$);break e}W=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=ge.payload,$=typeof ie=="function"?ie.call(Fe,W,$):ie,$==null)break e;W=v({},W,$);break e;case 2:Ts=!0}}$=j.callback,$!==null&&(n.flags|=64,H&&(n.flags|=8192),H=h.callbacks,H===null?h.callbacks=[$]:H.push($))}else H={lane:$,tag:j.tag,payload:j.payload,callback:j.callback,next:null},K===null?(V=K=H,k=W):K=K.next=H,x|=$;if(j=j.next,j===null){if(j=h.shared.pending,j===null)break;H=j,j=H.next,H.next=null,h.lastBaseUpdate=H,h.shared.pending=null}}while(!0);K===null&&(k=W),h.baseState=k,h.firstBaseUpdate=V,h.lastBaseUpdate=K,g===null&&(h.shared.lanes=0),Ds|=x,n.lanes=x,n.memoizedState=W}}function Eg(n,a){if(typeof n!="function")throw Error(r(191,n));n.call(a)}function Tg(n,a){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)Eg(i[n],a)}var Or=R(null),$l=R(0);function Ng(n,a){n=cs,Z($l,n),Z(Or,a),cs=n|a.baseLanes}function Td(){Z($l,cs),Z(Or,Or.current)}function Nd(){cs=$l.current,Y(Or),Y($l)}var en=R(null),yn=null;function ks(n){var a=n.alternate;Z(lt,lt.current&1),Z(en,n),yn===null&&(a===null||Or.current!==null||a.memoizedState!==null)&&(yn=n)}function Ad(n){Z(lt,lt.current),Z(en,n),yn===null&&(yn=n)}function Ag(n){n.tag===22?(Z(lt,lt.current),Z(en,n),yn===null&&(yn=n)):Cs()}function Cs(){Z(lt,lt.current),Z(en,en.current)}function tn(n){Y(en),yn===n&&(yn=null),Y(lt)}var lt=R(0);function Hl(n){for(var a=n;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Mh(i)||zh(i)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ts=0,Ee=null,He=null,dt=null,Gl=!1,Dr=!1,Na=!1,Fl=0,eo=0,Mr=null,W_=0;function st(){throw Error(r(321))}function kd(n,a){if(a===null)return!1;for(var i=0;i<a.length&&i<n.length;i++)if(!Qt(n[i],a[i]))return!1;return!0}function Cd(n,a,i,c,h,g){return ts=g,Ee=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,C.H=n===null||n.memoizedState===null?dy:Gd,Na=!1,g=i(c,h),Na=!1,Dr&&(g=Cg(a,i,c,h)),kg(n),g}function kg(n){C.H=so;var a=He!==null&&He.next!==null;if(ts=0,dt=He=Ee=null,Gl=!1,eo=0,Mr=null,a)throw Error(r(300));n===null||ht||(n=n.dependencies,n!==null&&Ll(n)&&(ht=!0))}function Cg(n,a,i,c){Ee=n;var h=0;do{if(Dr&&(Mr=null),eo=0,Dr=!1,25<=h)throw Error(r(301));if(h+=1,dt=He=null,n.updateQueue!=null){var g=n.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}C.H=hy,g=a(i,c)}while(Dr);return g}function J_(){var n=C.H,a=n.useState()[0];return a=typeof a.then=="function"?to(a):a,n=n.useState()[0],(He!==null?He.memoizedState:null)!==n&&(Ee.flags|=1024),a}function Rd(){var n=Fl!==0;return Fl=0,n}function Od(n,a,i){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~i}function Dd(n){if(Gl){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Gl=!1}ts=0,dt=He=Ee=null,Dr=!1,eo=Fl=0,Mr=null}function Vt(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ee.memoizedState=dt=n:dt=dt.next=n,dt}function ct(){if(He===null){var n=Ee.alternate;n=n!==null?n.memoizedState:null}else n=He.next;var a=dt===null?Ee.memoizedState:dt.next;if(a!==null)dt=a,He=n;else{if(n===null)throw Ee.alternate===null?Error(r(467)):Error(r(310));He=n,n={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},dt===null?Ee.memoizedState=dt=n:dt=dt.next=n}return dt}function Kl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function to(n){var a=eo;return eo+=1,Mr===null&&(Mr=[]),n=bg(Mr,n,a),a=Ee,(dt===null?a.memoizedState:dt.next)===null&&(a=a.alternate,C.H=a===null||a.memoizedState===null?dy:Gd),n}function Yl(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return to(n);if(n.$$typeof===N)return At(n)}throw Error(r(438,String(n)))}function Md(n){var a=null,i=Ee.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var c=Ee.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(h){return h.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=Kl(),Ee.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(n),c=0;c<n;c++)i[c]=re;return a.index++,i}function ns(n,a){return typeof a=="function"?a(n):a}function Xl(n){var a=ct();return zd(a,He,n)}function zd(n,a,i){var c=n.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=i;var h=n.baseQueue,g=c.pending;if(g!==null){if(h!==null){var x=h.next;h.next=g.next,g.next=x}a.baseQueue=h=g,c.pending=null}if(g=n.baseState,h===null)n.memoizedState=g;else{a=h.next;var j=x=null,k=null,V=a,K=!1;do{var W=V.lane&-536870913;if(W!==V.lane?(Oe&W)===W:(ts&W)===W){var $=V.revertLane;if($===0)k!==null&&(k=k.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),W===Ar&&(K=!0);else if((ts&$)===$){V=V.next,$===Ar&&(K=!0);continue}else W={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},k===null?(j=k=W,x=g):k=k.next=W,Ee.lanes|=$,Ds|=$;W=V.action,Na&&i(g,W),g=V.hasEagerState?V.eagerState:i(g,W)}else $={lane:W,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},k===null?(j=k=$,x=g):k=k.next=$,Ee.lanes|=W,Ds|=W;V=V.next}while(V!==null&&V!==a);if(k===null?x=g:k.next=j,!Qt(g,n.memoizedState)&&(ht=!0,K&&(i=kr,i!==null)))throw i;n.memoizedState=g,n.baseState=x,n.baseQueue=k,c.lastRenderedState=g}return h===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function Ld(n){var a=ct(),i=a.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=n;var c=i.dispatch,h=i.pending,g=a.memoizedState;if(h!==null){i.pending=null;var x=h=h.next;do g=n(g,x.action),x=x.next;while(x!==h);Qt(g,a.memoizedState)||(ht=!0),a.memoizedState=g,a.baseQueue===null&&(a.baseState=g),i.lastRenderedState=g}return[g,c]}function Rg(n,a,i){var c=Ee,h=ct(),g=ze;if(g){if(i===void 0)throw Error(r(407));i=i()}else i=a();var x=!Qt((He||h).memoizedState,i);if(x&&(h.memoizedState=i,ht=!0),h=h.queue,Vd(Mg.bind(null,c,h,n),[n]),h.getSnapshot!==a||x||dt!==null&&dt.memoizedState.tag&1){if(c.flags|=2048,zr(9,{destroy:void 0},Dg.bind(null,c,h,i,a),null),Ke===null)throw Error(r(349));g||(ts&127)!==0||Og(c,a,i)}return i}function Og(n,a,i){n.flags|=16384,n={getSnapshot:a,value:i},a=Ee.updateQueue,a===null?(a=Kl(),Ee.updateQueue=a,a.stores=[n]):(i=a.stores,i===null?a.stores=[n]:i.push(n))}function Dg(n,a,i,c){a.value=i,a.getSnapshot=c,zg(a)&&Lg(n)}function Mg(n,a,i){return i(function(){zg(a)&&Lg(n)})}function zg(n){var a=n.getSnapshot;n=n.value;try{var i=a();return!Qt(n,i)}catch{return!0}}function Lg(n){var a=va(n,2);a!==null&&Wt(a,n,2)}function Ud(n){var a=Vt();if(typeof n=="function"){var i=n;if(n=i(),Na){Kn(!0);try{i()}finally{Kn(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:n},a}function Ug(n,a,i,c){return n.baseState=i,zd(n,He,typeof c=="function"?c:ns)}function Q_(n,a,i,c,h){if(Ql(n))throw Error(r(485));if(n=a.action,n!==null){var g={payload:h,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){g.listeners.push(x)}};C.T!==null?i(!0):g.isTransition=!1,c(g),i=a.pending,i===null?(g.next=a.pending=g,Pg(a,g)):(g.next=i.next,a.pending=i.next=g)}}function Pg(n,a){var i=a.action,c=a.payload,h=n.state;if(a.isTransition){var g=C.T,x={};C.T=x;try{var j=i(h,c),k=C.S;k!==null&&k(x,j),Vg(n,a,j)}catch(V){Pd(n,a,V)}finally{g!==null&&x.types!==null&&(g.types=x.types),C.T=g}}else try{g=i(h,c),Vg(n,a,g)}catch(V){Pd(n,a,V)}}function Vg(n,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(c){Bg(n,a,c)},function(c){return Pd(n,a,c)}):Bg(n,a,i)}function Bg(n,a,i){a.status="fulfilled",a.value=i,Ig(a),n.state=i,a=n.pending,a!==null&&(i=a.next,i===a?n.pending=null:(i=i.next,a.next=i,Pg(n,i)))}function Pd(n,a,i){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=i,Ig(a),a=a.next;while(a!==c)}n.action=null}function Ig(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function qg(n,a){return a}function $g(n,a){if(ze){var i=Ke.formState;if(i!==null){e:{var c=Ee;if(ze){if(Xe){t:{for(var h=Xe,g=gn;h.nodeType!==8;){if(!g){h=null;break t}if(h=vn(h.nextSibling),h===null){h=null;break t}}g=h.data,h=g==="F!"||g==="F"?h:null}if(h){Xe=vn(h.nextSibling),c=h.data==="F!";break e}}js(c)}c=!1}c&&(a=i[0])}}return i=Vt(),i.memoizedState=i.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qg,lastRenderedState:a},i.queue=c,i=ly.bind(null,Ee,c),c.dispatch=i,c=Ud(!1),g=Hd.bind(null,Ee,!1,c.queue),c=Vt(),h={state:a,dispatch:null,action:n,pending:null},c.queue=h,i=Q_.bind(null,Ee,h,g,i),h.dispatch=i,c.memoizedState=n,[a,i,!1]}function Hg(n){var a=ct();return Gg(a,He,n)}function Gg(n,a,i){if(a=zd(n,a,qg)[0],n=Xl(ns)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=to(a)}catch(x){throw x===Cr?Vl:x}else c=a;a=ct();var h=a.queue,g=h.dispatch;return i!==a.memoizedState&&(Ee.flags|=2048,zr(9,{destroy:void 0},Z_.bind(null,h,i),null)),[c,g,n]}function Z_(n,a){n.action=a}function Fg(n){var a=ct(),i=He;if(i!==null)return Gg(a,i,n);ct(),a=a.memoizedState,i=ct();var c=i.queue.dispatch;return i.memoizedState=n,[a,c,!1]}function zr(n,a,i,c){return n={tag:n,create:i,deps:c,inst:a,next:null},a=Ee.updateQueue,a===null&&(a=Kl(),Ee.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=n.next=n:(c=i.next,i.next=n,n.next=c,a.lastEffect=n),n}function Kg(){return ct().memoizedState}function Wl(n,a,i,c){var h=Vt();Ee.flags|=n,h.memoizedState=zr(1|a,{destroy:void 0},i,c===void 0?null:c)}function Jl(n,a,i,c){var h=ct();c=c===void 0?null:c;var g=h.memoizedState.inst;He!==null&&c!==null&&kd(c,He.memoizedState.deps)?h.memoizedState=zr(a,g,i,c):(Ee.flags|=n,h.memoizedState=zr(1|a,g,i,c))}function Yg(n,a){Wl(8390656,8,n,a)}function Vd(n,a){Jl(2048,8,n,a)}function ej(n){Ee.flags|=4;var a=Ee.updateQueue;if(a===null)a=Kl(),Ee.updateQueue=a,a.events=[n];else{var i=a.events;i===null?a.events=[n]:i.push(n)}}function Xg(n){var a=ct().memoizedState;return ej({ref:a,nextImpl:n}),function(){if((Be&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Wg(n,a){return Jl(4,2,n,a)}function Jg(n,a){return Jl(4,4,n,a)}function Qg(n,a){if(typeof a=="function"){n=n();var i=a(n);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function Zg(n,a,i){i=i!=null?i.concat([n]):null,Jl(4,4,Qg.bind(null,a,n),i)}function Bd(){}function ey(n,a){var i=ct();a=a===void 0?null:a;var c=i.memoizedState;return a!==null&&kd(a,c[1])?c[0]:(i.memoizedState=[n,a],n)}function ty(n,a){var i=ct();a=a===void 0?null:a;var c=i.memoizedState;if(a!==null&&kd(a,c[1]))return c[0];if(c=n(),Na){Kn(!0);try{n()}finally{Kn(!1)}}return i.memoizedState=[c,a],c}function Id(n,a,i){return i===void 0||(ts&1073741824)!==0&&(Oe&261930)===0?n.memoizedState=a:(n.memoizedState=i,n=nv(),Ee.lanes|=n,Ds|=n,i)}function ny(n,a,i,c){return Qt(i,a)?i:Or.current!==null?(n=Id(n,i,c),Qt(n,a)||(ht=!0),n):(ts&42)===0||(ts&1073741824)!==0&&(Oe&261930)===0?(ht=!0,n.memoizedState=i):(n=nv(),Ee.lanes|=n,Ds|=n,a)}function sy(n,a,i,c,h){var g=I.p;I.p=g!==0&&8>g?g:8;var x=C.T,j={};C.T=j,Hd(n,!1,a,i);try{var k=h(),V=C.S;if(V!==null&&V(j,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var K=X_(k,c);no(n,a,K,an(n))}else no(n,a,c,an(n))}catch(W){no(n,a,{then:function(){},status:"rejected",reason:W},an())}finally{I.p=g,x!==null&&j.types!==null&&(x.types=j.types),C.T=x}}function tj(){}function qd(n,a,i,c){if(n.tag!==5)throw Error(r(476));var h=ay(n).queue;sy(n,h,a,B,i===null?tj:function(){return ry(n),i(c)})}function ay(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:B},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:i},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function ry(n){var a=ay(n);a.next===null&&(a=n.alternate.memoizedState),no(n,a.next.queue,{},an())}function $d(){return At(bo)}function iy(){return ct().memoizedState}function oy(){return ct().memoizedState}function nj(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var i=an();n=Ns(i);var c=As(a,n,i);c!==null&&(Wt(c,a,i),Ji(c,a,i)),a={cache:vd()},n.payload=a;return}a=a.return}}function sj(n,a,i){var c=an();i={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ql(n)?cy(a,i):(i=od(n,a,i,c),i!==null&&(Wt(i,n,c),uy(i,a,c)))}function ly(n,a,i){var c=an();no(n,a,i,c)}function no(n,a,i,c){var h={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Ql(n))cy(a,h);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=a.lastRenderedReducer,g!==null))try{var x=a.lastRenderedState,j=g(x,i);if(h.hasEagerState=!0,h.eagerState=j,Qt(j,x))return Ol(n,a,h,0),Ke===null&&Rl(),!1}catch{}if(i=od(n,a,h,c),i!==null)return Wt(i,n,c),uy(i,a,c),!0}return!1}function Hd(n,a,i,c){if(c={lane:2,revertLane:Sh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Ql(n)){if(a)throw Error(r(479))}else a=od(n,i,c,2),a!==null&&Wt(a,n,2)}function Ql(n){var a=n.alternate;return n===Ee||a!==null&&a===Ee}function cy(n,a){Dr=Gl=!0;var i=n.pending;i===null?a.next=a:(a.next=i.next,i.next=a),n.pending=a}function uy(n,a,i){if((i&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,i|=c,a.lanes=i,pl(n,i)}}var so={readContext:At,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};so.useEffectEvent=st;var dy={readContext:At,use:Yl,useCallback:function(n,a){return Vt().memoizedState=[n,a===void 0?null:a],n},useContext:At,useEffect:Yg,useImperativeHandle:function(n,a,i){i=i!=null?i.concat([n]):null,Wl(4194308,4,Qg.bind(null,a,n),i)},useLayoutEffect:function(n,a){return Wl(4194308,4,n,a)},useInsertionEffect:function(n,a){Wl(4,2,n,a)},useMemo:function(n,a){var i=Vt();a=a===void 0?null:a;var c=n();if(Na){Kn(!0);try{n()}finally{Kn(!1)}}return i.memoizedState=[c,a],c},useReducer:function(n,a,i){var c=Vt();if(i!==void 0){var h=i(a);if(Na){Kn(!0);try{i(a)}finally{Kn(!1)}}}else h=a;return c.memoizedState=c.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},c.queue=n,n=n.dispatch=sj.bind(null,Ee,n),[c.memoizedState,n]},useRef:function(n){var a=Vt();return n={current:n},a.memoizedState=n},useState:function(n){n=Ud(n);var a=n.queue,i=ly.bind(null,Ee,a);return a.dispatch=i,[n.memoizedState,i]},useDebugValue:Bd,useDeferredValue:function(n,a){var i=Vt();return Id(i,n,a)},useTransition:function(){var n=Ud(!1);return n=sy.bind(null,Ee,n.queue,!0,!1),Vt().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,i){var c=Ee,h=Vt();if(ze){if(i===void 0)throw Error(r(407));i=i()}else{if(i=a(),Ke===null)throw Error(r(349));(Oe&127)!==0||Og(c,a,i)}h.memoizedState=i;var g={value:i,getSnapshot:a};return h.queue=g,Yg(Mg.bind(null,c,g,n),[n]),c.flags|=2048,zr(9,{destroy:void 0},Dg.bind(null,c,g,i,a),null),i},useId:function(){var n=Vt(),a=Ke.identifierPrefix;if(ze){var i=Pn,c=Un;i=(c&~(1<<32-yt(c)-1)).toString(32)+i,a="_"+a+"R_"+i,i=Fl++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=W_++,a="_"+a+"r_"+i.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:$d,useFormState:$g,useActionState:$g,useOptimistic:function(n){var a=Vt();a.memoizedState=a.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=Hd.bind(null,Ee,!0,i),i.dispatch=a,[n,a]},useMemoCache:Md,useCacheRefresh:function(){return Vt().memoizedState=nj.bind(null,Ee)},useEffectEvent:function(n){var a=Vt(),i={impl:n};return a.memoizedState=i,function(){if((Be&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},Gd={readContext:At,use:Yl,useCallback:ey,useContext:At,useEffect:Vd,useImperativeHandle:Zg,useInsertionEffect:Wg,useLayoutEffect:Jg,useMemo:ty,useReducer:Xl,useRef:Kg,useState:function(){return Xl(ns)},useDebugValue:Bd,useDeferredValue:function(n,a){var i=ct();return ny(i,He.memoizedState,n,a)},useTransition:function(){var n=Xl(ns)[0],a=ct().memoizedState;return[typeof n=="boolean"?n:to(n),a]},useSyncExternalStore:Rg,useId:iy,useHostTransitionStatus:$d,useFormState:Hg,useActionState:Hg,useOptimistic:function(n,a){var i=ct();return Ug(i,He,n,a)},useMemoCache:Md,useCacheRefresh:oy};Gd.useEffectEvent=Xg;var hy={readContext:At,use:Yl,useCallback:ey,useContext:At,useEffect:Vd,useImperativeHandle:Zg,useInsertionEffect:Wg,useLayoutEffect:Jg,useMemo:ty,useReducer:Ld,useRef:Kg,useState:function(){return Ld(ns)},useDebugValue:Bd,useDeferredValue:function(n,a){var i=ct();return He===null?Id(i,n,a):ny(i,He.memoizedState,n,a)},useTransition:function(){var n=Ld(ns)[0],a=ct().memoizedState;return[typeof n=="boolean"?n:to(n),a]},useSyncExternalStore:Rg,useId:iy,useHostTransitionStatus:$d,useFormState:Fg,useActionState:Fg,useOptimistic:function(n,a){var i=ct();return He!==null?Ug(i,He,n,a):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:Md,useCacheRefresh:oy};hy.useEffectEvent=Xg;function Fd(n,a,i,c){a=n.memoizedState,i=i(c,a),i=i==null?a:v({},a,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var Kd={enqueueSetState:function(n,a,i){n=n._reactInternals;var c=an(),h=Ns(c);h.payload=a,i!=null&&(h.callback=i),a=As(n,h,c),a!==null&&(Wt(a,n,c),Ji(a,n,c))},enqueueReplaceState:function(n,a,i){n=n._reactInternals;var c=an(),h=Ns(c);h.tag=1,h.payload=a,i!=null&&(h.callback=i),a=As(n,h,c),a!==null&&(Wt(a,n,c),Ji(a,n,c))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var i=an(),c=Ns(i);c.tag=2,a!=null&&(c.callback=a),a=As(n,c,i),a!==null&&(Wt(a,n,i),Ji(a,n,i))}};function fy(n,a,i,c,h,g,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,g,x):a.prototype&&a.prototype.isPureReactComponent?!$i(i,c)||!$i(h,g):!0}function my(n,a,i,c){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,c),a.state!==n&&Kd.enqueueReplaceState(a,a.state,null)}function Aa(n,a){var i=a;if("ref"in a){i={};for(var c in a)c!=="ref"&&(i[c]=a[c])}if(n=n.defaultProps){i===a&&(i=v({},i));for(var h in n)i[h]===void 0&&(i[h]=n[h])}return i}function py(n){Cl(n)}function gy(n){console.error(n)}function yy(n){Cl(n)}function Zl(n,a){try{var i=n.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function vy(n,a,i){try{var c=n.onCaughtError;c(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Yd(n,a,i){return i=Ns(i),i.tag=3,i.payload={element:null},i.callback=function(){Zl(n,a)},i}function xy(n){return n=Ns(n),n.tag=3,n}function by(n,a,i,c){var h=i.type.getDerivedStateFromError;if(typeof h=="function"){var g=c.value;n.payload=function(){return h(g)},n.callback=function(){vy(a,i,c)}}var x=i.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){vy(a,i,c),typeof h!="function"&&(Ms===null?Ms=new Set([this]):Ms.add(this));var j=c.stack;this.componentDidCatch(c.value,{componentStack:j!==null?j:""})})}function aj(n,a,i,c,h){if(i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=i.alternate,a!==null&&Nr(a,i,h,!0),i=en.current,i!==null){switch(i.tag){case 31:case 13:return yn===null?dc():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=h,c===Bl?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([c]):a.add(c),xh(n,c,h)),!1;case 22:return i.flags|=65536,c===Bl?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([c]):i.add(c)),xh(n,c,h)),!1}throw Error(r(435,i.tag))}return xh(n,c,h),dc(),!1}if(ze)return a=en.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=h,c!==fd&&(n=Error(r(422),{cause:c}),Fi(fn(n,i)))):(c!==fd&&(a=Error(r(423),{cause:c}),Fi(fn(a,i))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,c=fn(c,i),h=Yd(n.stateNode,c,h),jd(n,h),at!==4&&(at=2)),!1;var g=Error(r(520),{cause:c});if(g=fn(g,i),ho===null?ho=[g]:ho.push(g),at!==4&&(at=2),a===null)return!0;c=fn(c,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,n=h&-h,i.lanes|=n,n=Yd(i.stateNode,c,n),jd(i,n),!1;case 1:if(a=i.type,g=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Ms===null||!Ms.has(g))))return i.flags|=65536,h&=-h,i.lanes|=h,h=xy(h),by(h,n,i,c),jd(i,h),!1}i=i.return}while(i!==null);return!1}var Xd=Error(r(461)),ht=!1;function kt(n,a,i,c){a.child=n===null?jg(a,null,i,c):Ta(a,n.child,i,c)}function wy(n,a,i,c,h){i=i.render;var g=a.ref;if("ref"in c){var x={};for(var j in c)j!=="ref"&&(x[j]=c[j])}else x=c;return Sa(a),c=Cd(n,a,i,x,g,h),j=Rd(),n!==null&&!ht?(Od(n,a,h),ss(n,a,h)):(ze&&j&&dd(a),a.flags|=1,kt(n,a,c,h),a.child)}function Sy(n,a,i,c,h){if(n===null){var g=i.type;return typeof g=="function"&&!ld(g)&&g.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=g,_y(n,a,g,c,h)):(n=Ml(i.type,null,c,a,a.mode,h),n.ref=a.ref,n.return=a,a.child=n)}if(g=n.child,!sh(n,h)){var x=g.memoizedProps;if(i=i.compare,i=i!==null?i:$i,i(x,c)&&n.ref===a.ref)return ss(n,a,h)}return a.flags|=1,n=Jn(g,c),n.ref=a.ref,n.return=a,a.child=n}function _y(n,a,i,c,h){if(n!==null){var g=n.memoizedProps;if($i(g,c)&&n.ref===a.ref)if(ht=!1,a.pendingProps=c=g,sh(n,h))(n.flags&131072)!==0&&(ht=!0);else return a.lanes=n.lanes,ss(n,a,h)}return Wd(n,a,i,c,h)}function jy(n,a,i,c){var h=c.children,g=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((a.flags&128)!==0){if(g=g!==null?g.baseLanes|i:i,n!==null){for(c=a.child=n.child,h=0;c!==null;)h=h|c.lanes|c.childLanes,c=c.sibling;c=h&~g}else c=0,a.child=null;return Ey(n,a,g,i,c)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Pl(a,g!==null?g.cachePool:null),g!==null?Ng(a,g):Td(),Ag(a);else return c=a.lanes=536870912,Ey(n,a,g!==null?g.baseLanes|i:i,i,c)}else g!==null?(Pl(a,g.cachePool),Ng(a,g),Cs(),a.memoizedState=null):(n!==null&&Pl(a,null),Td(),Cs());return kt(n,a,h,i),a.child}function ao(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Ey(n,a,i,c,h){var g=bd();return g=g===null?null:{parent:ut._currentValue,pool:g},a.memoizedState={baseLanes:i,cachePool:g},n!==null&&Pl(a,null),Td(),Ag(a),n!==null&&Nr(n,a,c,!0),a.childLanes=h,null}function ec(n,a){return a=nc({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function Ty(n,a,i){return Ta(a,n.child,null,i),n=ec(a,a.pendingProps),n.flags|=2,tn(a),a.memoizedState=null,n}function rj(n,a,i){var c=a.pendingProps,h=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(ze){if(c.mode==="hidden")return n=ec(a,c),a.lanes=536870912,ao(null,n);if(Ad(a),(n=Xe)?(n=Pv(n,gn),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Ss!==null?{id:Un,overflow:Pn}:null,retryLane:536870912,hydrationErrors:null},i=cg(n),i.return=a,a.child=i,Nt=a,Xe=null)):n=null,n===null)throw js(a);return a.lanes=536870912,null}return ec(a,c)}var g=n.memoizedState;if(g!==null){var x=g.dehydrated;if(Ad(a),h)if(a.flags&256)a.flags&=-257,a=Ty(n,a,i);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(r(558));else if(ht||Nr(n,a,i,!1),h=(i&n.childLanes)!==0,ht||h){if(c=Ke,c!==null&&(x=gl(c,i),x!==0&&x!==g.retryLane))throw g.retryLane=x,va(n,x),Wt(c,n,x),Xd;dc(),a=Ty(n,a,i)}else n=g.treeContext,Xe=vn(x.nextSibling),Nt=a,ze=!0,_s=null,gn=!1,n!==null&&hg(a,n),a=ec(a,c),a.flags|=4096;return a}return n=Jn(n.child,{mode:c.mode,children:c.children}),n.ref=a.ref,a.child=n,n.return=a,n}function tc(n,a){var i=a.ref;if(i===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(n===null||n.ref!==i)&&(a.flags|=4194816)}}function Wd(n,a,i,c,h){return Sa(a),i=Cd(n,a,i,c,void 0,h),c=Rd(),n!==null&&!ht?(Od(n,a,h),ss(n,a,h)):(ze&&c&&dd(a),a.flags|=1,kt(n,a,i,h),a.child)}function Ny(n,a,i,c,h,g){return Sa(a),a.updateQueue=null,i=Cg(a,c,i,h),kg(n),c=Rd(),n!==null&&!ht?(Od(n,a,g),ss(n,a,g)):(ze&&c&&dd(a),a.flags|=1,kt(n,a,i,g),a.child)}function Ay(n,a,i,c,h){if(Sa(a),a.stateNode===null){var g=_r,x=i.contextType;typeof x=="object"&&x!==null&&(g=At(x)),g=new i(c,g),a.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Kd,a.stateNode=g,g._reactInternals=a,g=a.stateNode,g.props=c,g.state=a.memoizedState,g.refs={},Sd(a),x=i.contextType,g.context=typeof x=="object"&&x!==null?At(x):_r,g.state=a.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&(Fd(a,i,x,c),g.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(x=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),x!==g.state&&Kd.enqueueReplaceState(g,g.state,null),Zi(a,c,g,h),Qi(),g.state=a.memoizedState),typeof g.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(n===null){g=a.stateNode;var j=a.memoizedProps,k=Aa(i,j);g.props=k;var V=g.context,K=i.contextType;x=_r,typeof K=="object"&&K!==null&&(x=At(K));var W=i.getDerivedStateFromProps;K=typeof W=="function"||typeof g.getSnapshotBeforeUpdate=="function",j=a.pendingProps!==j,K||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(j||V!==x)&&my(a,g,c,x),Ts=!1;var $=a.memoizedState;g.state=$,Zi(a,c,g,h),Qi(),V=a.memoizedState,j||$!==V||Ts?(typeof W=="function"&&(Fd(a,i,W,c),V=a.memoizedState),(k=Ts||fy(a,i,k,c,$,V,x))?(K||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"&&(a.flags|=4194308)):(typeof g.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=V),g.props=c,g.state=V,g.context=x,c=k):(typeof g.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{g=a.stateNode,_d(n,a),x=a.memoizedProps,K=Aa(i,x),g.props=K,W=a.pendingProps,$=g.context,V=i.contextType,k=_r,typeof V=="object"&&V!==null&&(k=At(V)),j=i.getDerivedStateFromProps,(V=typeof j=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(x!==W||$!==k)&&my(a,g,c,k),Ts=!1,$=a.memoizedState,g.state=$,Zi(a,c,g,h),Qi();var H=a.memoizedState;x!==W||$!==H||Ts||n!==null&&n.dependencies!==null&&Ll(n.dependencies)?(typeof j=="function"&&(Fd(a,i,j,c),H=a.memoizedState),(K=Ts||fy(a,i,K,c,$,H,k)||n!==null&&n.dependencies!==null&&Ll(n.dependencies))?(V||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(c,H,k),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(c,H,k)),typeof g.componentDidUpdate=="function"&&(a.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof g.componentDidUpdate!="function"||x===n.memoizedProps&&$===n.memoizedState||(a.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&$===n.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=H),g.props=c,g.state=H,g.context=k,c=K):(typeof g.componentDidUpdate!="function"||x===n.memoizedProps&&$===n.memoizedState||(a.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&$===n.memoizedState||(a.flags|=1024),c=!1)}return g=c,tc(n,a),c=(a.flags&128)!==0,g||c?(g=a.stateNode,i=c&&typeof i.getDerivedStateFromError!="function"?null:g.render(),a.flags|=1,n!==null&&c?(a.child=Ta(a,n.child,null,h),a.child=Ta(a,null,i,h)):kt(n,a,i,h),a.memoizedState=g.state,n=a.child):n=ss(n,a,h),n}function ky(n,a,i,c){return ba(),a.flags|=256,kt(n,a,i,c),a.child}var Jd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qd(n){return{baseLanes:n,cachePool:vg()}}function Zd(n,a,i){return n=n!==null?n.childLanes&~i:0,a&&(n|=sn),n}function Cy(n,a,i){var c=a.pendingProps,h=!1,g=(a.flags&128)!==0,x;if((x=g)||(x=n!==null&&n.memoizedState===null?!1:(lt.current&2)!==0),x&&(h=!0,a.flags&=-129),x=(a.flags&32)!==0,a.flags&=-33,n===null){if(ze){if(h?ks(a):Cs(),(n=Xe)?(n=Pv(n,gn),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Ss!==null?{id:Un,overflow:Pn}:null,retryLane:536870912,hydrationErrors:null},i=cg(n),i.return=a,a.child=i,Nt=a,Xe=null)):n=null,n===null)throw js(a);return zh(n)?a.lanes=32:a.lanes=536870912,null}var j=c.children;return c=c.fallback,h?(Cs(),h=a.mode,j=nc({mode:"hidden",children:j},h),c=xa(c,h,i,null),j.return=a,c.return=a,j.sibling=c,a.child=j,c=a.child,c.memoizedState=Qd(i),c.childLanes=Zd(n,x,i),a.memoizedState=Jd,ao(null,c)):(ks(a),eh(a,j))}var k=n.memoizedState;if(k!==null&&(j=k.dehydrated,j!==null)){if(g)a.flags&256?(ks(a),a.flags&=-257,a=th(n,a,i)):a.memoizedState!==null?(Cs(),a.child=n.child,a.flags|=128,a=null):(Cs(),j=c.fallback,h=a.mode,c=nc({mode:"visible",children:c.children},h),j=xa(j,h,i,null),j.flags|=2,c.return=a,j.return=a,c.sibling=j,a.child=c,Ta(a,n.child,null,i),c=a.child,c.memoizedState=Qd(i),c.childLanes=Zd(n,x,i),a.memoizedState=Jd,a=ao(null,c));else if(ks(a),zh(j)){if(x=j.nextSibling&&j.nextSibling.dataset,x)var V=x.dgst;x=V,c=Error(r(419)),c.stack="",c.digest=x,Fi({value:c,source:null,stack:null}),a=th(n,a,i)}else if(ht||Nr(n,a,i,!1),x=(i&n.childLanes)!==0,ht||x){if(x=Ke,x!==null&&(c=gl(x,i),c!==0&&c!==k.retryLane))throw k.retryLane=c,va(n,c),Wt(x,n,c),Xd;Mh(j)||dc(),a=th(n,a,i)}else Mh(j)?(a.flags|=192,a.child=n.child,a=null):(n=k.treeContext,Xe=vn(j.nextSibling),Nt=a,ze=!0,_s=null,gn=!1,n!==null&&hg(a,n),a=eh(a,c.children),a.flags|=4096);return a}return h?(Cs(),j=c.fallback,h=a.mode,k=n.child,V=k.sibling,c=Jn(k,{mode:"hidden",children:c.children}),c.subtreeFlags=k.subtreeFlags&65011712,V!==null?j=Jn(V,j):(j=xa(j,h,i,null),j.flags|=2),j.return=a,c.return=a,c.sibling=j,a.child=c,ao(null,c),c=a.child,j=n.child.memoizedState,j===null?j=Qd(i):(h=j.cachePool,h!==null?(k=ut._currentValue,h=h.parent!==k?{parent:k,pool:k}:h):h=vg(),j={baseLanes:j.baseLanes|i,cachePool:h}),c.memoizedState=j,c.childLanes=Zd(n,x,i),a.memoizedState=Jd,ao(n.child,c)):(ks(a),i=n.child,n=i.sibling,i=Jn(i,{mode:"visible",children:c.children}),i.return=a,i.sibling=null,n!==null&&(x=a.deletions,x===null?(a.deletions=[n],a.flags|=16):x.push(n)),a.child=i,a.memoizedState=null,i)}function eh(n,a){return a=nc({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function nc(n,a){return n=Zt(22,n,null,a),n.lanes=0,n}function th(n,a,i){return Ta(a,n.child,null,i),n=eh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function Ry(n,a,i){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a),gd(n.return,a,i)}function nh(n,a,i,c,h,g){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:h,treeForkCount:g}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=c,x.tail=i,x.tailMode=h,x.treeForkCount=g)}function Oy(n,a,i){var c=a.pendingProps,h=c.revealOrder,g=c.tail;c=c.children;var x=lt.current,j=(x&2)!==0;if(j?(x=x&1|2,a.flags|=128):x&=1,Z(lt,x),kt(n,a,c,i),c=ze?Gi:0,!j&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Ry(n,i,a);else if(n.tag===19)Ry(n,i,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(h){case"forwards":for(i=a.child,h=null;i!==null;)n=i.alternate,n!==null&&Hl(n)===null&&(h=i),i=i.sibling;i=h,i===null?(h=a.child,a.child=null):(h=i.sibling,i.sibling=null),nh(a,!1,h,i,g,c);break;case"backwards":case"unstable_legacy-backwards":for(i=null,h=a.child,a.child=null;h!==null;){if(n=h.alternate,n!==null&&Hl(n)===null){a.child=h;break}n=h.sibling,h.sibling=i,i=h,h=n}nh(a,!0,i,null,g,c);break;case"together":nh(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function ss(n,a,i){if(n!==null&&(a.dependencies=n.dependencies),Ds|=a.lanes,(i&a.childLanes)===0)if(n!==null){if(Nr(n,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(r(153));if(a.child!==null){for(n=a.child,i=Jn(n,n.pendingProps),a.child=i,i.return=a;n.sibling!==null;)n=n.sibling,i=i.sibling=Jn(n,n.pendingProps),i.return=a;i.sibling=null}return a.child}function sh(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&Ll(n)))}function ij(n,a,i){switch(a.tag){case 3:ot(a,a.stateNode.containerInfo),Es(a,ut,n.memoizedState.cache),ba();break;case 27:case 5:cn(a);break;case 4:ot(a,a.stateNode.containerInfo);break;case 10:Es(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Ad(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(ks(a),a.flags|=128,null):(i&a.child.childLanes)!==0?Cy(n,a,i):(ks(a),n=ss(n,a,i),n!==null?n.sibling:null);ks(a);break;case 19:var h=(n.flags&128)!==0;if(c=(i&a.childLanes)!==0,c||(Nr(n,a,i,!1),c=(i&a.childLanes)!==0),h){if(c)return Oy(n,a,i);a.flags|=128}if(h=a.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),Z(lt,lt.current),c)break;return null;case 22:return a.lanes=0,jy(n,a,i,a.pendingProps);case 24:Es(a,ut,n.memoizedState.cache)}return ss(n,a,i)}function Dy(n,a,i){if(n!==null)if(n.memoizedProps!==a.pendingProps)ht=!0;else{if(!sh(n,i)&&(a.flags&128)===0)return ht=!1,ij(n,a,i);ht=(n.flags&131072)!==0}else ht=!1,ze&&(a.flags&1048576)!==0&&dg(a,Gi,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(n=ja(a.elementType),a.type=n,typeof n=="function")ld(n)?(c=Aa(n,c),a.tag=1,a=Ay(null,a,n,c,i)):(a.tag=0,a=Wd(null,a,n,c,i));else{if(n!=null){var h=n.$$typeof;if(h===L){a.tag=11,a=wy(null,a,n,c,i);break e}else if(h===U){a.tag=14,a=Sy(null,a,n,c,i);break e}}throw a=Ve(n)||n,Error(r(306,a,""))}}return a;case 0:return Wd(n,a,a.type,a.pendingProps,i);case 1:return c=a.type,h=Aa(c,a.pendingProps),Ay(n,a,c,h,i);case 3:e:{if(ot(a,a.stateNode.containerInfo),n===null)throw Error(r(387));c=a.pendingProps;var g=a.memoizedState;h=g.element,_d(n,a),Zi(a,c,null,i);var x=a.memoizedState;if(c=x.cache,Es(a,ut,c),c!==g.cache&&yd(a,[ut],i,!0),Qi(),c=x.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:x.cache},a.updateQueue.baseState=g,a.memoizedState=g,a.flags&256){a=ky(n,a,c,i);break e}else if(c!==h){h=fn(Error(r(424)),a),Fi(h),a=ky(n,a,c,i);break e}else for(n=a.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,Xe=vn(n.firstChild),Nt=a,ze=!0,_s=null,gn=!0,i=jg(a,null,c,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(ba(),c===h){a=ss(n,a,i);break e}kt(n,a,c,i)}a=a.child}return a;case 26:return tc(n,a),n===null?(i=Hv(a.type,null,a.pendingProps,null))?a.memoizedState=i:ze||(i=a.type,n=a.pendingProps,c=vc(_e.current).createElement(i),c[q]=a,c[te]=n,Ct(c,i,n),St(c),a.stateNode=c):a.memoizedState=Hv(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return cn(a),n===null&&ze&&(c=a.stateNode=Iv(a.type,a.pendingProps,_e.current),Nt=a,gn=!0,h=Xe,Ps(a.type)?(Lh=h,Xe=vn(c.firstChild)):Xe=h),kt(n,a,a.pendingProps.children,i),tc(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&ze&&((h=c=Xe)&&(c=Lj(c,a.type,a.pendingProps,gn),c!==null?(a.stateNode=c,Nt=a,Xe=vn(c.firstChild),gn=!1,h=!0):h=!1),h||js(a)),cn(a),h=a.type,g=a.pendingProps,x=n!==null?n.memoizedProps:null,c=g.children,Rh(h,g)?c=null:x!==null&&Rh(h,x)&&(a.flags|=32),a.memoizedState!==null&&(h=Cd(n,a,J_,null,null,i),bo._currentValue=h),tc(n,a),kt(n,a,c,i),a.child;case 6:return n===null&&ze&&((n=i=Xe)&&(i=Uj(i,a.pendingProps,gn),i!==null?(a.stateNode=i,Nt=a,Xe=null,n=!0):n=!1),n||js(a)),null;case 13:return Cy(n,a,i);case 4:return ot(a,a.stateNode.containerInfo),c=a.pendingProps,n===null?a.child=Ta(a,null,c,i):kt(n,a,c,i),a.child;case 11:return wy(n,a,a.type,a.pendingProps,i);case 7:return kt(n,a,a.pendingProps,i),a.child;case 8:return kt(n,a,a.pendingProps.children,i),a.child;case 12:return kt(n,a,a.pendingProps.children,i),a.child;case 10:return c=a.pendingProps,Es(a,a.type,c.value),kt(n,a,c.children,i),a.child;case 9:return h=a.type._context,c=a.pendingProps.children,Sa(a),h=At(h),c=c(h),a.flags|=1,kt(n,a,c,i),a.child;case 14:return Sy(n,a,a.type,a.pendingProps,i);case 15:return _y(n,a,a.type,a.pendingProps,i);case 19:return Oy(n,a,i);case 31:return rj(n,a,i);case 22:return jy(n,a,i,a.pendingProps);case 24:return Sa(a),c=At(ut),n===null?(h=bd(),h===null&&(h=Ke,g=vd(),h.pooledCache=g,g.refCount++,g!==null&&(h.pooledCacheLanes|=i),h=g),a.memoizedState={parent:c,cache:h},Sd(a),Es(a,ut,h)):((n.lanes&i)!==0&&(_d(n,a),Zi(a,null,null,i),Qi()),h=n.memoizedState,g=a.memoizedState,h.parent!==c?(h={parent:c,cache:c},a.memoizedState=h,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=h),Es(a,ut,c)):(c=g.cache,Es(a,ut,c),c!==h.cache&&yd(a,[ut],i,!0))),kt(n,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function as(n){n.flags|=4}function ah(n,a,i,c,h){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(h&335544128)===h)if(n.stateNode.complete)n.flags|=8192;else if(iv())n.flags|=8192;else throw Ea=Bl,wd}else n.flags&=-16777217}function My(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Xv(a))if(iv())n.flags|=8192;else throw Ea=Bl,wd}function sc(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?fl():536870912,n.lanes|=a,Vr|=a)}function ro(n,a){if(!ze)switch(n.tailMode){case"hidden":a=n.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function We(n){var a=n.alternate!==null&&n.alternate.child===n.child,i=0,c=0;if(a)for(var h=n.child;h!==null;)i|=h.lanes|h.childLanes,c|=h.subtreeFlags&65011712,c|=h.flags&65011712,h.return=n,h=h.sibling;else for(h=n.child;h!==null;)i|=h.lanes|h.childLanes,c|=h.subtreeFlags,c|=h.flags,h.return=n,h=h.sibling;return n.subtreeFlags|=c,n.childLanes=i,a}function oj(n,a,i){var c=a.pendingProps;switch(hd(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(a),null;case 1:return We(a),null;case 3:return i=a.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),es(ut),Le(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Tr(a)?as(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,md())),We(a),null;case 26:var h=a.type,g=a.memoizedState;return n===null?(as(a),g!==null?(We(a),My(a,g)):(We(a),ah(a,h,null,c,i))):g?g!==n.memoizedState?(as(a),We(a),My(a,g)):(We(a),a.flags&=-16777217):(n=n.memoizedProps,n!==c&&as(a),We(a),ah(a,h,n,c,i)),null;case 27:if(Ht(a),i=_e.current,h=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&as(a);else{if(!c){if(a.stateNode===null)throw Error(r(166));return We(a),null}n=ne.current,Tr(a)?fg(a):(n=Iv(h,c,i),a.stateNode=n,as(a))}return We(a),null;case 5:if(Ht(a),h=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&as(a);else{if(!c){if(a.stateNode===null)throw Error(r(166));return We(a),null}if(g=ne.current,Tr(a))fg(a);else{var x=vc(_e.current);switch(g){case 1:g=x.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:g=x.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":g=x.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":g=x.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":g=x.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?x.createElement("select",{is:c.is}):x.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?x.createElement(h,{is:c.is}):x.createElement(h)}}g[q]=a,g[te]=c;e:for(x=a.child;x!==null;){if(x.tag===5||x.tag===6)g.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===a)break e;for(;x.sibling===null;){if(x.return===null||x.return===a)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}a.stateNode=g;e:switch(Ct(g,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&as(a)}}return We(a),ah(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,i),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&as(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(r(166));if(n=_e.current,Tr(a)){if(n=a.stateNode,i=a.memoizedProps,c=null,h=Nt,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}n[q]=a,n=!!(n.nodeValue===i||c!==null&&c.suppressHydrationWarning===!0||Cv(n.nodeValue,i)),n||js(a,!0)}else n=vc(n).createTextNode(c),n[q]=a,a.stateNode=n}return We(a),null;case 31:if(i=a.memoizedState,n===null||n.memoizedState!==null){if(c=Tr(a),i!==null){if(n===null){if(!c)throw Error(r(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[q]=a}else ba(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;We(a),n=!1}else i=md(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return a.flags&256?(tn(a),a):(tn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return We(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Tr(a),c!==null&&c.dehydrated!==null){if(n===null){if(!h)throw Error(r(318));if(h=a.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));h[q]=a}else ba(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;We(a),h=!1}else h=md(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return a.flags&256?(tn(a),a):(tn(a),null)}return tn(a),(a.flags&128)!==0?(a.lanes=i,a):(i=c!==null,n=n!==null&&n.memoizedState!==null,i&&(c=a.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==h&&(c.flags|=2048)),i!==n&&i&&(a.child.flags|=8192),sc(a,a.updateQueue),We(a),null);case 4:return Le(),n===null&&Th(a.stateNode.containerInfo),We(a),null;case 10:return es(a.type),We(a),null;case 19:if(Y(lt),c=a.memoizedState,c===null)return We(a),null;if(h=(a.flags&128)!==0,g=c.rendering,g===null)if(h)ro(c,!1);else{if(at!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(g=Hl(n),g!==null){for(a.flags|=128,ro(c,!1),n=g.updateQueue,a.updateQueue=n,sc(a,n),a.subtreeFlags=0,n=i,i=a.child;i!==null;)lg(i,n),i=i.sibling;return Z(lt,lt.current&1|2),ze&&Qn(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&Et()>lc&&(a.flags|=128,h=!0,ro(c,!1),a.lanes=4194304)}else{if(!h)if(n=Hl(g),n!==null){if(a.flags|=128,h=!0,n=n.updateQueue,a.updateQueue=n,sc(a,n),ro(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!ze)return We(a),null}else 2*Et()-c.renderingStartTime>lc&&i!==536870912&&(a.flags|=128,h=!0,ro(c,!1),a.lanes=4194304);c.isBackwards?(g.sibling=a.child,a.child=g):(n=c.last,n!==null?n.sibling=g:a.child=g,c.last=g)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=Et(),n.sibling=null,i=lt.current,Z(lt,h?i&1|2:i&1),ze&&Qn(a,c.treeForkCount),n):(We(a),null);case 22:case 23:return tn(a),Nd(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(i&536870912)!==0&&(a.flags&128)===0&&(We(a),a.subtreeFlags&6&&(a.flags|=8192)):We(a),i=a.updateQueue,i!==null&&sc(a,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==i&&(a.flags|=2048),n!==null&&Y(_a),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),es(ut),We(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function lj(n,a){switch(hd(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return es(ut),Le(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Ht(a),null;case 31:if(a.memoizedState!==null){if(tn(a),a.alternate===null)throw Error(r(340));ba()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(tn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(r(340));ba()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return Y(lt),null;case 4:return Le(),null;case 10:return es(a.type),null;case 22:case 23:return tn(a),Nd(),n!==null&&Y(_a),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return es(ut),null;case 25:return null;default:return null}}function zy(n,a){switch(hd(a),a.tag){case 3:es(ut),Le();break;case 26:case 27:case 5:Ht(a);break;case 4:Le();break;case 31:a.memoizedState!==null&&tn(a);break;case 13:tn(a);break;case 19:Y(lt);break;case 10:es(a.type);break;case 22:case 23:tn(a),Nd(),n!==null&&Y(_a);break;case 24:es(ut)}}function io(n,a){try{var i=a.updateQueue,c=i!==null?i.lastEffect:null;if(c!==null){var h=c.next;i=h;do{if((i.tag&n)===n){c=void 0;var g=i.create,x=i.inst;c=g(),x.destroy=c}i=i.next}while(i!==h)}}catch(j){$e(a,a.return,j)}}function Rs(n,a,i){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var g=h.next;c=g;do{if((c.tag&n)===n){var x=c.inst,j=x.destroy;if(j!==void 0){x.destroy=void 0,h=a;var k=i,V=j;try{V()}catch(K){$e(h,k,K)}}}c=c.next}while(c!==g)}}catch(K){$e(a,a.return,K)}}function Ly(n){var a=n.updateQueue;if(a!==null){var i=n.stateNode;try{Tg(a,i)}catch(c){$e(n,n.return,c)}}}function Uy(n,a,i){i.props=Aa(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(c){$e(n,a,c)}}function oo(n,a){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof i=="function"?n.refCleanup=i(c):i.current=c}}catch(h){$e(n,a,h)}}function Vn(n,a){var i=n.ref,c=n.refCleanup;if(i!==null)if(typeof c=="function")try{c()}catch(h){$e(n,a,h)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(h){$e(n,a,h)}else i.current=null}function Py(n){var a=n.type,i=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&c.focus();break e;case"img":i.src?c.src=i.src:i.srcSet&&(c.srcset=i.srcSet)}}catch(h){$e(n,n.return,h)}}function rh(n,a,i){try{var c=n.stateNode;Cj(c,n.type,i,a),c[te]=a}catch(h){$e(n,n.return,h)}}function Vy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ps(n.type)||n.tag===4}function ih(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Vy(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Ps(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function oh(n,a,i){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(n),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=Xn));else if(c!==4&&(c===27&&Ps(n.type)&&(i=n.stateNode,a=null),n=n.child,n!==null))for(oh(n,a,i),n=n.sibling;n!==null;)oh(n,a,i),n=n.sibling}function ac(n,a,i){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?i.insertBefore(n,a):i.appendChild(n);else if(c!==4&&(c===27&&Ps(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(ac(n,a,i),n=n.sibling;n!==null;)ac(n,a,i),n=n.sibling}function By(n){var a=n.stateNode,i=n.memoizedProps;try{for(var c=n.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);Ct(a,c,i),a[q]=n,a[te]=i}catch(g){$e(n,n.return,g)}}var rs=!1,ft=!1,lh=!1,Iy=typeof WeakSet=="function"?WeakSet:Set,_t=null;function cj(n,a){if(n=n.containerInfo,kh=Ec,n=Zp(n),td(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var h=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var x=0,j=-1,k=-1,V=0,K=0,W=n,$=null;t:for(;;){for(var H;W!==i||h!==0&&W.nodeType!==3||(j=x+h),W!==g||c!==0&&W.nodeType!==3||(k=x+c),W.nodeType===3&&(x+=W.nodeValue.length),(H=W.firstChild)!==null;)$=W,W=H;for(;;){if(W===n)break t;if($===i&&++V===h&&(j=x),$===g&&++K===c&&(k=x),(H=W.nextSibling)!==null)break;W=$,$=W.parentNode}W=H}i=j===-1||k===-1?null:{start:j,end:k}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ch={focusedElem:n,selectionRange:i},Ec=!1,_t=a;_t!==null;)if(a=_t,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,_t=n;else for(;_t!==null;){switch(a=_t,g=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(i=0;i<n.length;i++)h=n[i],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&g!==null){n=void 0,i=a,h=g.memoizedProps,g=g.memoizedState,c=i.stateNode;try{var ie=Aa(i.type,h);n=c.getSnapshotBeforeUpdate(ie,g),c.__reactInternalSnapshotBeforeUpdate=n}catch(ge){$e(i,i.return,ge)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,i=n.nodeType,i===9)Dh(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Dh(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(r(163))}if(n=a.sibling,n!==null){n.return=a.return,_t=n;break}_t=a.return}}function qy(n,a,i){var c=i.flags;switch(i.tag){case 0:case 11:case 15:os(n,i),c&4&&io(5,i);break;case 1:if(os(n,i),c&4)if(n=i.stateNode,a===null)try{n.componentDidMount()}catch(x){$e(i,i.return,x)}else{var h=Aa(i.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(h,a,n.__reactInternalSnapshotBeforeUpdate)}catch(x){$e(i,i.return,x)}}c&64&&Ly(i),c&512&&oo(i,i.return);break;case 3:if(os(n,i),c&64&&(n=i.updateQueue,n!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{Tg(n,a)}catch(x){$e(i,i.return,x)}}break;case 27:a===null&&c&4&&By(i);case 26:case 5:os(n,i),a===null&&c&4&&Py(i),c&512&&oo(i,i.return);break;case 12:os(n,i);break;case 31:os(n,i),c&4&&Gy(n,i);break;case 13:os(n,i),c&4&&Fy(n,i),c&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=vj.bind(null,i),Pj(n,i))));break;case 22:if(c=i.memoizedState!==null||rs,!c){a=a!==null&&a.memoizedState!==null||ft,h=rs;var g=ft;rs=c,(ft=a)&&!g?ls(n,i,(i.subtreeFlags&8772)!==0):os(n,i),rs=h,ft=g}break;case 30:break;default:os(n,i)}}function $y(n){var a=n.alternate;a!==null&&(n.alternate=null,$y(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&Mi(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Ze=null,Ft=!1;function is(n,a,i){for(i=i.child;i!==null;)Hy(n,a,i),i=i.sibling}function Hy(n,a,i){if(Tt&&typeof Tt.onCommitFiberUnmount=="function")try{Tt.onCommitFiberUnmount(bs,i)}catch{}switch(i.tag){case 26:ft||Vn(i,a),is(n,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:ft||Vn(i,a);var c=Ze,h=Ft;Ps(i.type)&&(Ze=i.stateNode,Ft=!1),is(n,a,i),yo(i.stateNode),Ze=c,Ft=h;break;case 5:ft||Vn(i,a);case 6:if(c=Ze,h=Ft,Ze=null,is(n,a,i),Ze=c,Ft=h,Ze!==null)if(Ft)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(i.stateNode)}catch(g){$e(i,a,g)}else try{Ze.removeChild(i.stateNode)}catch(g){$e(i,a,g)}break;case 18:Ze!==null&&(Ft?(n=Ze,Lv(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),Kr(n)):Lv(Ze,i.stateNode));break;case 4:c=Ze,h=Ft,Ze=i.stateNode.containerInfo,Ft=!0,is(n,a,i),Ze=c,Ft=h;break;case 0:case 11:case 14:case 15:Rs(2,i,a),ft||Rs(4,i,a),is(n,a,i);break;case 1:ft||(Vn(i,a),c=i.stateNode,typeof c.componentWillUnmount=="function"&&Uy(i,a,c)),is(n,a,i);break;case 21:is(n,a,i);break;case 22:ft=(c=ft)||i.memoizedState!==null,is(n,a,i),ft=c;break;default:is(n,a,i)}}function Gy(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Kr(n)}catch(i){$e(a,a.return,i)}}}function Fy(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Kr(n)}catch(i){$e(a,a.return,i)}}function uj(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new Iy),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new Iy),a;default:throw Error(r(435,n.tag))}}function rc(n,a){var i=uj(n);a.forEach(function(c){if(!i.has(c)){i.add(c);var h=xj.bind(null,n,c);c.then(h,h)}})}function Kt(n,a){var i=a.deletions;if(i!==null)for(var c=0;c<i.length;c++){var h=i[c],g=n,x=a,j=x;e:for(;j!==null;){switch(j.tag){case 27:if(Ps(j.type)){Ze=j.stateNode,Ft=!1;break e}break;case 5:Ze=j.stateNode,Ft=!1;break e;case 3:case 4:Ze=j.stateNode.containerInfo,Ft=!0;break e}j=j.return}if(Ze===null)throw Error(r(160));Hy(g,x,h),Ze=null,Ft=!1,g=h.alternate,g!==null&&(g.return=null),h.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Ky(a,n),a=a.sibling}var Nn=null;function Ky(n,a){var i=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Kt(a,n),Yt(n),c&4&&(Rs(3,n,n.return),io(3,n),Rs(5,n,n.return));break;case 1:Kt(a,n),Yt(n),c&512&&(ft||i===null||Vn(i,i.return)),c&64&&rs&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?c:i.concat(c))));break;case 26:var h=Nn;if(Kt(a,n),Yt(n),c&512&&(ft||i===null||Vn(i,i.return)),c&4){var g=i!==null?i.memoizedState:null;if(c=n.memoizedState,i===null)if(c===null)if(n.stateNode===null){e:{c=n.type,i=n.memoizedProps,h=h.ownerDocument||h;t:switch(c){case"title":g=h.getElementsByTagName("title")[0],(!g||g[fa]||g[q]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=h.createElement(c),h.head.insertBefore(g,h.querySelector("head > title"))),Ct(g,c,i),g[q]=n,St(g),c=g;break e;case"link":var x=Kv("link","href",h).get(c+(i.href||""));if(x){for(var j=0;j<x.length;j++)if(g=x[j],g.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&g.getAttribute("rel")===(i.rel==null?null:i.rel)&&g.getAttribute("title")===(i.title==null?null:i.title)&&g.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){x.splice(j,1);break t}}g=h.createElement(c),Ct(g,c,i),h.head.appendChild(g);break;case"meta":if(x=Kv("meta","content",h).get(c+(i.content||""))){for(j=0;j<x.length;j++)if(g=x[j],g.getAttribute("content")===(i.content==null?null:""+i.content)&&g.getAttribute("name")===(i.name==null?null:i.name)&&g.getAttribute("property")===(i.property==null?null:i.property)&&g.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&g.getAttribute("charset")===(i.charSet==null?null:i.charSet)){x.splice(j,1);break t}}g=h.createElement(c),Ct(g,c,i),h.head.appendChild(g);break;default:throw Error(r(468,c))}g[q]=n,St(g),c=g}n.stateNode=c}else Yv(h,n.type,n.stateNode);else n.stateNode=Fv(h,c,n.memoizedProps);else g!==c?(g===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):g.count--,c===null?Yv(h,n.type,n.stateNode):Fv(h,c,n.memoizedProps)):c===null&&n.stateNode!==null&&rh(n,n.memoizedProps,i.memoizedProps)}break;case 27:Kt(a,n),Yt(n),c&512&&(ft||i===null||Vn(i,i.return)),i!==null&&c&4&&rh(n,n.memoizedProps,i.memoizedProps);break;case 5:if(Kt(a,n),Yt(n),c&512&&(ft||i===null||Vn(i,i.return)),n.flags&32){h=n.stateNode;try{gr(h,"")}catch(ie){$e(n,n.return,ie)}}c&4&&n.stateNode!=null&&(h=n.memoizedProps,rh(n,h,i!==null?i.memoizedProps:h)),c&1024&&(lh=!0);break;case 6:if(Kt(a,n),Yt(n),c&4){if(n.stateNode===null)throw Error(r(162));c=n.memoizedProps,i=n.stateNode;try{i.nodeValue=c}catch(ie){$e(n,n.return,ie)}}break;case 3:if(wc=null,h=Nn,Nn=xc(a.containerInfo),Kt(a,n),Nn=h,Yt(n),c&4&&i!==null&&i.memoizedState.isDehydrated)try{Kr(a.containerInfo)}catch(ie){$e(n,n.return,ie)}lh&&(lh=!1,Yy(n));break;case 4:c=Nn,Nn=xc(n.stateNode.containerInfo),Kt(a,n),Yt(n),Nn=c;break;case 12:Kt(a,n),Yt(n);break;case 31:Kt(a,n),Yt(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,rc(n,c)));break;case 13:Kt(a,n),Yt(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(oc=Et()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,rc(n,c)));break;case 22:h=n.memoizedState!==null;var k=i!==null&&i.memoizedState!==null,V=rs,K=ft;if(rs=V||h,ft=K||k,Kt(a,n),ft=K,rs=V,Yt(n),c&8192)e:for(a=n.stateNode,a._visibility=h?a._visibility&-2:a._visibility|1,h&&(i===null||k||rs||ft||ka(n)),i=null,a=n;;){if(a.tag===5||a.tag===26){if(i===null){k=i=a;try{if(g=k.stateNode,h)x=g.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{j=k.stateNode;var W=k.memoizedProps.style,$=W!=null&&W.hasOwnProperty("display")?W.display:null;j.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(ie){$e(k,k.return,ie)}}}else if(a.tag===6){if(i===null){k=a;try{k.stateNode.nodeValue=h?"":k.memoizedProps}catch(ie){$e(k,k.return,ie)}}}else if(a.tag===18){if(i===null){k=a;try{var H=k.stateNode;h?Uv(H,!0):Uv(k.stateNode,!1)}catch(ie){$e(k,k.return,ie)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=n.updateQueue,c!==null&&(i=c.retryQueue,i!==null&&(c.retryQueue=null,rc(n,i))));break;case 19:Kt(a,n),Yt(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,rc(n,c)));break;case 30:break;case 21:break;default:Kt(a,n),Yt(n)}}function Yt(n){var a=n.flags;if(a&2){try{for(var i,c=n.return;c!==null;){if(Vy(c)){i=c;break}c=c.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var h=i.stateNode,g=ih(n);ac(n,g,h);break;case 5:var x=i.stateNode;i.flags&32&&(gr(x,""),i.flags&=-33);var j=ih(n);ac(n,j,x);break;case 3:case 4:var k=i.stateNode.containerInfo,V=ih(n);oh(n,V,k);break;default:throw Error(r(161))}}catch(K){$e(n,n.return,K)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function Yy(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Yy(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function os(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)qy(n,a.alternate,a),a=a.sibling}function ka(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:Rs(4,a,a.return),ka(a);break;case 1:Vn(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&Uy(a,a.return,i),ka(a);break;case 27:yo(a.stateNode);case 26:case 5:Vn(a,a.return),ka(a);break;case 22:a.memoizedState===null&&ka(a);break;case 30:ka(a);break;default:ka(a)}n=n.sibling}}function ls(n,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,h=n,g=a,x=g.flags;switch(g.tag){case 0:case 11:case 15:ls(h,g,i),io(4,g);break;case 1:if(ls(h,g,i),c=g,h=c.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(V){$e(c,c.return,V)}if(c=g,h=c.updateQueue,h!==null){var j=c.stateNode;try{var k=h.shared.hiddenCallbacks;if(k!==null)for(h.shared.hiddenCallbacks=null,h=0;h<k.length;h++)Eg(k[h],j)}catch(V){$e(c,c.return,V)}}i&&x&64&&Ly(g),oo(g,g.return);break;case 27:By(g);case 26:case 5:ls(h,g,i),i&&c===null&&x&4&&Py(g),oo(g,g.return);break;case 12:ls(h,g,i);break;case 31:ls(h,g,i),i&&x&4&&Gy(h,g);break;case 13:ls(h,g,i),i&&x&4&&Fy(h,g);break;case 22:g.memoizedState===null&&ls(h,g,i),oo(g,g.return);break;case 30:break;default:ls(h,g,i)}a=a.sibling}}function ch(n,a){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&Ki(i))}function uh(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Ki(n))}function An(n,a,i,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Xy(n,a,i,c),a=a.sibling}function Xy(n,a,i,c){var h=a.flags;switch(a.tag){case 0:case 11:case 15:An(n,a,i,c),h&2048&&io(9,a);break;case 1:An(n,a,i,c);break;case 3:An(n,a,i,c),h&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Ki(n)));break;case 12:if(h&2048){An(n,a,i,c),n=a.stateNode;try{var g=a.memoizedProps,x=g.id,j=g.onPostCommit;typeof j=="function"&&j(x,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(k){$e(a,a.return,k)}}else An(n,a,i,c);break;case 31:An(n,a,i,c);break;case 13:An(n,a,i,c);break;case 23:break;case 22:g=a.stateNode,x=a.alternate,a.memoizedState!==null?g._visibility&2?An(n,a,i,c):lo(n,a):g._visibility&2?An(n,a,i,c):(g._visibility|=2,Lr(n,a,i,c,(a.subtreeFlags&10256)!==0||!1)),h&2048&&ch(x,a);break;case 24:An(n,a,i,c),h&2048&&uh(a.alternate,a);break;default:An(n,a,i,c)}}function Lr(n,a,i,c,h){for(h=h&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var g=n,x=a,j=i,k=c,V=x.flags;switch(x.tag){case 0:case 11:case 15:Lr(g,x,j,k,h),io(8,x);break;case 23:break;case 22:var K=x.stateNode;x.memoizedState!==null?K._visibility&2?Lr(g,x,j,k,h):lo(g,x):(K._visibility|=2,Lr(g,x,j,k,h)),h&&V&2048&&ch(x.alternate,x);break;case 24:Lr(g,x,j,k,h),h&&V&2048&&uh(x.alternate,x);break;default:Lr(g,x,j,k,h)}a=a.sibling}}function lo(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=n,c=a,h=c.flags;switch(c.tag){case 22:lo(i,c),h&2048&&ch(c.alternate,c);break;case 24:lo(i,c),h&2048&&uh(c.alternate,c);break;default:lo(i,c)}a=a.sibling}}var co=8192;function Ur(n,a,i){if(n.subtreeFlags&co)for(n=n.child;n!==null;)Wy(n,a,i),n=n.sibling}function Wy(n,a,i){switch(n.tag){case 26:Ur(n,a,i),n.flags&co&&n.memoizedState!==null&&Wj(i,Nn,n.memoizedState,n.memoizedProps);break;case 5:Ur(n,a,i);break;case 3:case 4:var c=Nn;Nn=xc(n.stateNode.containerInfo),Ur(n,a,i),Nn=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=co,co=16777216,Ur(n,a,i),co=c):Ur(n,a,i));break;default:Ur(n,a,i)}}function Jy(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function uo(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var c=a[i];_t=c,Zy(c,n)}Jy(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Qy(n),n=n.sibling}function Qy(n){switch(n.tag){case 0:case 11:case 15:uo(n),n.flags&2048&&Rs(9,n,n.return);break;case 3:uo(n);break;case 12:uo(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,ic(n)):uo(n);break;default:uo(n)}}function ic(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var c=a[i];_t=c,Zy(c,n)}Jy(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:Rs(8,a,a.return),ic(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,ic(a));break;default:ic(a)}n=n.sibling}}function Zy(n,a){for(;_t!==null;){var i=_t;switch(i.tag){case 0:case 11:case 15:Rs(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var c=i.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Ki(i.memoizedState.cache)}if(c=i.child,c!==null)c.return=i,_t=c;else e:for(i=n;_t!==null;){c=_t;var h=c.sibling,g=c.return;if($y(c),c===i){_t=null;break e}if(h!==null){h.return=g,_t=h;break e}_t=g}}}var dj={getCacheForType:function(n){var a=At(ut),i=a.data.get(n);return i===void 0&&(i=n(),a.data.set(n,i)),i},cacheSignal:function(){return At(ut).controller.signal}},hj=typeof WeakMap=="function"?WeakMap:Map,Be=0,Ke=null,Ce=null,Oe=0,qe=0,nn=null,Os=!1,Pr=!1,dh=!1,cs=0,at=0,Ds=0,Ca=0,hh=0,sn=0,Vr=0,ho=null,Xt=null,fh=!1,oc=0,ev=0,lc=1/0,cc=null,Ms=null,vt=0,zs=null,Br=null,us=0,mh=0,ph=null,tv=null,fo=0,gh=null;function an(){return(Be&2)!==0&&Oe!==0?Oe&-Oe:C.T!==null?Sh():yl()}function nv(){if(sn===0)if((Oe&536870912)===0||ze){var n=Ci;Ci<<=1,(Ci&3932160)===0&&(Ci=262144),sn=n}else sn=536870912;return n=en.current,n!==null&&(n.flags|=32),sn}function Wt(n,a,i){(n===Ke&&(qe===2||qe===9)||n.cancelPendingCommit!==null)&&(Ir(n,0),Ls(n,Oe,sn,!1)),da(n,i),((Be&2)===0||n!==Ke)&&(n===Ke&&((Be&2)===0&&(Ca|=i),at===4&&Ls(n,Oe,sn,!1)),Bn(n))}function sv(n,a,i){if((Be&6)!==0)throw Error(r(327));var c=!i&&(a&127)===0&&(a&n.expiredLanes)===0||ua(n,a),h=c?pj(n,a):vh(n,a,!0),g=c;do{if(h===0){Pr&&!c&&Ls(n,a,0,!1);break}else{if(i=n.current.alternate,g&&!fj(i)){h=vh(n,a,!1),g=!1;continue}if(h===2){if(g=a,n.errorRecoveryDisabledLanes&g)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){a=x;e:{var j=n;h=ho;var k=j.current.memoizedState.isDehydrated;if(k&&(Ir(j,x).flags|=256),x=vh(j,x,!1),x!==2){if(dh&&!k){j.errorRecoveryDisabledLanes|=g,Ca|=g,h=4;break e}g=Xt,Xt=h,g!==null&&(Xt===null?Xt=g:Xt.push.apply(Xt,g))}h=x}if(g=!1,h!==2)continue}}if(h===1){Ir(n,0),Ls(n,a,0,!0);break}e:{switch(c=n,g=h,g){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Ls(c,a,sn,!Os);break e;case 2:Xt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(h=oc+300-Et(),10<h)){if(Ls(c,a,sn,!Os),ca(c,0,!0)!==0)break e;us=a,c.timeoutHandle=Mv(av.bind(null,c,i,Xt,cc,fh,a,sn,Ca,Vr,Os,g,"Throttled",-0,0),h);break e}av(c,i,Xt,cc,fh,a,sn,Ca,Vr,Os,g,null,-0,0)}}break}while(!0);Bn(n)}function av(n,a,i,c,h,g,x,j,k,V,K,W,$,H){if(n.timeoutHandle=-1,W=a.subtreeFlags,W&8192||(W&16785408)===16785408){W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xn},Wy(a,g,W);var ie=(g&62914560)===g?oc-Et():(g&4194048)===g?ev-Et():0;if(ie=Jj(W,ie),ie!==null){us=g,n.cancelPendingCommit=ie(hv.bind(null,n,a,g,i,c,h,x,j,k,K,W,null,$,H)),Ls(n,g,x,!V);return}}hv(n,a,g,i,c,h,x,j,k)}function fj(n){for(var a=n;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var c=0;c<i.length;c++){var h=i[c],g=h.getSnapshot;h=h.value;try{if(!Qt(g(),h))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ls(n,a,i,c){a&=~hh,a&=~Ca,n.suspendedLanes|=a,n.pingedLanes&=~a,c&&(n.warmLanes|=a),c=n.expirationTimes;for(var h=a;0<h;){var g=31-yt(h),x=1<<g;c[g]=-1,h&=~x}i!==0&&ml(n,i,a)}function uc(){return(Be&6)===0?(mo(0),!1):!0}function yh(){if(Ce!==null){if(qe===0)var n=Ce.return;else n=Ce,Zn=wa=null,Dd(n),Rr=null,Xi=0,n=Ce;for(;n!==null;)zy(n.alternate,n),n=n.return;Ce=null}}function Ir(n,a){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,Dj(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),us=0,yh(),Ke=n,Ce=i=Jn(n.current,null),Oe=a,qe=0,nn=null,Os=!1,Pr=ua(n,a),dh=!1,Vr=sn=hh=Ca=Ds=at=0,Xt=ho=null,fh=!1,(a&8)!==0&&(a|=a&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=a;0<c;){var h=31-yt(c),g=1<<h;a|=n[h],c&=~g}return cs=a,Rl(),i}function rv(n,a){Ee=null,C.H=so,a===Cr||a===Vl?(a=wg(),qe=3):a===wd?(a=wg(),qe=4):qe=a===Xd?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,nn=a,Ce===null&&(at=1,Zl(n,fn(a,n.current)))}function iv(){var n=en.current;return n===null?!0:(Oe&4194048)===Oe?yn===null:(Oe&62914560)===Oe||(Oe&536870912)!==0?n===yn:!1}function ov(){var n=C.H;return C.H=so,n===null?so:n}function lv(){var n=C.A;return C.A=dj,n}function dc(){at=4,Os||(Oe&4194048)!==Oe&&en.current!==null||(Pr=!0),(Ds&134217727)===0&&(Ca&134217727)===0||Ke===null||Ls(Ke,Oe,sn,!1)}function vh(n,a,i){var c=Be;Be|=2;var h=ov(),g=lv();(Ke!==n||Oe!==a)&&(cc=null,Ir(n,a)),a=!1;var x=at;e:do try{if(qe!==0&&Ce!==null){var j=Ce,k=nn;switch(qe){case 8:yh(),x=6;break e;case 3:case 2:case 9:case 6:en.current===null&&(a=!0);var V=qe;if(qe=0,nn=null,qr(n,j,k,V),i&&Pr){x=0;break e}break;default:V=qe,qe=0,nn=null,qr(n,j,k,V)}}mj(),x=at;break}catch(K){rv(n,K)}while(!0);return a&&n.shellSuspendCounter++,Zn=wa=null,Be=c,C.H=h,C.A=g,Ce===null&&(Ke=null,Oe=0,Rl()),x}function mj(){for(;Ce!==null;)cv(Ce)}function pj(n,a){var i=Be;Be|=2;var c=ov(),h=lv();Ke!==n||Oe!==a?(cc=null,lc=Et()+500,Ir(n,a)):Pr=ua(n,a);e:do try{if(qe!==0&&Ce!==null){a=Ce;var g=nn;t:switch(qe){case 1:qe=0,nn=null,qr(n,a,g,1);break;case 2:case 9:if(xg(g)){qe=0,nn=null,uv(a);break}a=function(){qe!==2&&qe!==9||Ke!==n||(qe=7),Bn(n)},g.then(a,a);break e;case 3:qe=7;break e;case 4:qe=5;break e;case 7:xg(g)?(qe=0,nn=null,uv(a)):(qe=0,nn=null,qr(n,a,g,7));break;case 5:var x=null;switch(Ce.tag){case 26:x=Ce.memoizedState;case 5:case 27:var j=Ce;if(x?Xv(x):j.stateNode.complete){qe=0,nn=null;var k=j.sibling;if(k!==null)Ce=k;else{var V=j.return;V!==null?(Ce=V,hc(V)):Ce=null}break t}}qe=0,nn=null,qr(n,a,g,5);break;case 6:qe=0,nn=null,qr(n,a,g,6);break;case 8:yh(),at=6;break e;default:throw Error(r(462))}}gj();break}catch(K){rv(n,K)}while(!0);return Zn=wa=null,C.H=c,C.A=h,Be=i,Ce!==null?0:(Ke=null,Oe=0,Rl(),at)}function gj(){for(;Ce!==null&&!ll();)cv(Ce)}function cv(n){var a=Dy(n.alternate,n,cs);n.memoizedProps=n.pendingProps,a===null?hc(n):Ce=a}function uv(n){var a=n,i=a.alternate;switch(a.tag){case 15:case 0:a=Ny(i,a,a.pendingProps,a.type,void 0,Oe);break;case 11:a=Ny(i,a,a.pendingProps,a.type.render,a.ref,Oe);break;case 5:Dd(a);default:zy(i,a),a=Ce=lg(a,cs),a=Dy(i,a,cs)}n.memoizedProps=n.pendingProps,a===null?hc(n):Ce=a}function qr(n,a,i,c){Zn=wa=null,Dd(a),Rr=null,Xi=0;var h=a.return;try{if(aj(n,h,a,i,Oe)){at=1,Zl(n,fn(i,n.current)),Ce=null;return}}catch(g){if(h!==null)throw Ce=h,g;at=1,Zl(n,fn(i,n.current)),Ce=null;return}a.flags&32768?(ze||c===1?n=!0:Pr||(Oe&536870912)!==0?n=!1:(Os=n=!0,(c===2||c===9||c===3||c===6)&&(c=en.current,c!==null&&c.tag===13&&(c.flags|=16384))),dv(a,n)):hc(a)}function hc(n){var a=n;do{if((a.flags&32768)!==0){dv(a,Os);return}n=a.return;var i=oj(a.alternate,a,cs);if(i!==null){Ce=i;return}if(a=a.sibling,a!==null){Ce=a;return}Ce=a=n}while(a!==null);at===0&&(at=5)}function dv(n,a){do{var i=lj(n.alternate,n);if(i!==null){i.flags&=32767,Ce=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(n=n.sibling,n!==null)){Ce=n;return}Ce=n=i}while(n!==null);at=6,Ce=null}function hv(n,a,i,c,h,g,x,j,k){n.cancelPendingCommit=null;do fc();while(vt!==0);if((Be&6)!==0)throw Error(r(327));if(a!==null){if(a===n.current)throw Error(r(177));if(g=a.lanes|a.childLanes,g|=id,Uu(n,i,g,x,j,k),n===Ke&&(Ce=Ke=null,Oe=0),Br=a,zs=n,us=i,mh=g,ph=h,tv=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,bj(la,function(){return yv(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=C.T,C.T=null,h=I.p,I.p=2,x=Be,Be|=4;try{cj(n,a,i)}finally{Be=x,I.p=h,C.T=c}}vt=1,fv(),mv(),pv()}}function fv(){if(vt===1){vt=0;var n=zs,a=Br,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=C.T,C.T=null;var c=I.p;I.p=2;var h=Be;Be|=4;try{Ky(a,n);var g=Ch,x=Zp(n.containerInfo),j=g.focusedElem,k=g.selectionRange;if(x!==j&&j&&j.ownerDocument&&Qp(j.ownerDocument.documentElement,j)){if(k!==null&&td(j)){var V=k.start,K=k.end;if(K===void 0&&(K=V),"selectionStart"in j)j.selectionStart=V,j.selectionEnd=Math.min(K,j.value.length);else{var W=j.ownerDocument||document,$=W&&W.defaultView||window;if($.getSelection){var H=$.getSelection(),ie=j.textContent.length,ge=Math.min(k.start,ie),Fe=k.end===void 0?ge:Math.min(k.end,ie);!H.extend&&ge>Fe&&(x=Fe,Fe=ge,ge=x);var z=Jp(j,ge),O=Jp(j,Fe);if(z&&O&&(H.rangeCount!==1||H.anchorNode!==z.node||H.anchorOffset!==z.offset||H.focusNode!==O.node||H.focusOffset!==O.offset)){var P=W.createRange();P.setStart(z.node,z.offset),H.removeAllRanges(),ge>Fe?(H.addRange(P),H.extend(O.node,O.offset)):(P.setEnd(O.node,O.offset),H.addRange(P))}}}}for(W=[],H=j;H=H.parentNode;)H.nodeType===1&&W.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<W.length;j++){var X=W[j];X.element.scrollLeft=X.left,X.element.scrollTop=X.top}}Ec=!!kh,Ch=kh=null}finally{Be=h,I.p=c,C.T=i}}n.current=a,vt=2}}function mv(){if(vt===2){vt=0;var n=zs,a=Br,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=C.T,C.T=null;var c=I.p;I.p=2;var h=Be;Be|=4;try{qy(n,a.alternate,a)}finally{Be=h,I.p=c,C.T=i}}vt=3}}function pv(){if(vt===4||vt===3){vt=0,cl();var n=zs,a=Br,i=us,c=tv;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?vt=5:(vt=0,Br=zs=null,gv(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(Ms=null),ur(i),a=a.stateNode,Tt&&typeof Tt.onCommitFiberRoot=="function")try{Tt.onCommitFiberRoot(bs,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=C.T,h=I.p,I.p=2,C.T=null;try{for(var g=n.onRecoverableError,x=0;x<c.length;x++){var j=c[x];g(j.value,{componentStack:j.stack})}}finally{C.T=a,I.p=h}}(us&3)!==0&&fc(),Bn(n),h=n.pendingLanes,(i&261930)!==0&&(h&42)!==0?n===gh?fo++:(fo=0,gh=n):fo=0,mo(0)}}function gv(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,Ki(a)))}function fc(){return fv(),mv(),pv(),yv()}function yv(){if(vt!==5)return!1;var n=zs,a=mh;mh=0;var i=ur(us),c=C.T,h=I.p;try{I.p=32>i?32:i,C.T=null,i=ph,ph=null;var g=zs,x=us;if(vt=0,Br=zs=null,us=0,(Be&6)!==0)throw Error(r(331));var j=Be;if(Be|=4,Qy(g.current),Xy(g,g.current,x,i),Be=j,mo(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(bs,g)}catch{}return!0}finally{I.p=h,C.T=c,gv(n,a)}}function vv(n,a,i){a=fn(i,a),a=Yd(n.stateNode,a,2),n=As(n,a,2),n!==null&&(da(n,2),Bn(n))}function $e(n,a,i){if(n.tag===3)vv(n,n,i);else for(;a!==null;){if(a.tag===3){vv(a,n,i);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ms===null||!Ms.has(c))){n=fn(i,n),i=xy(2),c=As(a,i,2),c!==null&&(by(i,c,a,n),da(c,2),Bn(c));break}}a=a.return}}function xh(n,a,i){var c=n.pingCache;if(c===null){c=n.pingCache=new hj;var h=new Set;c.set(a,h)}else h=c.get(a),h===void 0&&(h=new Set,c.set(a,h));h.has(i)||(dh=!0,h.add(i),n=yj.bind(null,n,a,i),a.then(n,n))}function yj(n,a,i){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Ke===n&&(Oe&i)===i&&(at===4||at===3&&(Oe&62914560)===Oe&&300>Et()-oc?(Be&2)===0&&Ir(n,0):hh|=i,Vr===Oe&&(Vr=0)),Bn(n)}function xv(n,a){a===0&&(a=fl()),n=va(n,a),n!==null&&(da(n,a),Bn(n))}function vj(n){var a=n.memoizedState,i=0;a!==null&&(i=a.retryLane),xv(n,i)}function xj(n,a){var i=0;switch(n.tag){case 31:case 13:var c=n.stateNode,h=n.memoizedState;h!==null&&(i=h.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(a),xv(n,i)}function bj(n,a){return rr(n,a)}var mc=null,$r=null,bh=!1,pc=!1,wh=!1,Us=0;function Bn(n){n!==$r&&n.next===null&&($r===null?mc=$r=n:$r=$r.next=n),pc=!0,bh||(bh=!0,Sj())}function mo(n,a){if(!wh&&pc){wh=!0;do for(var i=!1,c=mc;c!==null;){if(n!==0){var h=c.pendingLanes;if(h===0)var g=0;else{var x=c.suspendedLanes,j=c.pingedLanes;g=(1<<31-yt(42|n)+1)-1,g&=h&~(x&~j),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,_v(c,g))}else g=Oe,g=ca(c,c===Ke?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||ua(c,g)||(i=!0,_v(c,g));c=c.next}while(i);wh=!1}}function wj(){bv()}function bv(){pc=bh=!1;var n=0;Us!==0&&Oj()&&(n=Us);for(var a=Et(),i=null,c=mc;c!==null;){var h=c.next,g=wv(c,a);g===0?(c.next=null,i===null?mc=h:i.next=h,h===null&&($r=i)):(i=c,(n!==0||(g&3)!==0)&&(pc=!0)),c=h}vt!==0&&vt!==5||mo(n),Us!==0&&(Us=0)}function wv(n,a){for(var i=n.suspendedLanes,c=n.pingedLanes,h=n.expirationTimes,g=n.pendingLanes&-62914561;0<g;){var x=31-yt(g),j=1<<x,k=h[x];k===-1?((j&i)===0||(j&c)!==0)&&(h[x]=Lu(j,a)):k<=a&&(n.expiredLanes|=j),g&=~j}if(a=Ke,i=Oe,i=ca(n,n===a?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,i===0||n===a&&(qe===2||qe===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&ir(c),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||ua(n,i)){if(a=i&-i,a===n.callbackPriority)return a;switch(c!==null&&ir(c),ur(i)){case 2:case 8:i=ki;break;case 32:i=la;break;case 268435456:i=ul;break;default:i=la}return c=Sv.bind(null,n),i=rr(i,c),n.callbackPriority=a,n.callbackNode=i,a}return c!==null&&c!==null&&ir(c),n.callbackPriority=2,n.callbackNode=null,2}function Sv(n,a){if(vt!==0&&vt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(fc()&&n.callbackNode!==i)return null;var c=Oe;return c=ca(n,n===Ke?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(sv(n,c,a),wv(n,Et()),n.callbackNode!=null&&n.callbackNode===i?Sv.bind(null,n):null)}function _v(n,a){if(fc())return null;sv(n,a,!0)}function Sj(){Mj(function(){(Be&6)!==0?rr(Ai,wj):bv()})}function Sh(){if(Us===0){var n=Ar;n===0&&(n=cr,cr<<=1,(cr&261888)===0&&(cr=256)),Us=n}return Us}function jv(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:_l(""+n)}function Ev(n,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,n.id&&i.setAttribute("form",n.id),a.parentNode.insertBefore(i,a),n=new FormData(n),i.parentNode.removeChild(i),n}function _j(n,a,i,c,h){if(a==="submit"&&i&&i.stateNode===h){var g=jv((h[te]||null).action),x=c.submitter;x&&(a=(a=x[te]||null)?jv(a.formAction):x.getAttribute("formAction"),a!==null&&(g=a,x=null));var j=new Nl("action","action",null,c,h);n.push({event:j,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Us!==0){var k=x?Ev(h,x):new FormData(h);qd(i,{pending:!0,data:k,method:h.method,action:g},null,k)}}else typeof g=="function"&&(j.preventDefault(),k=x?Ev(h,x):new FormData(h),qd(i,{pending:!0,data:k,method:h.method,action:g},g,k))},currentTarget:h}]})}}for(var _h=0;_h<rd.length;_h++){var jh=rd[_h],jj=jh.toLowerCase(),Ej=jh[0].toUpperCase()+jh.slice(1);Tn(jj,"on"+Ej)}Tn(ng,"onAnimationEnd"),Tn(sg,"onAnimationIteration"),Tn(ag,"onAnimationStart"),Tn("dblclick","onDoubleClick"),Tn("focusin","onFocus"),Tn("focusout","onBlur"),Tn(I_,"onTransitionRun"),Tn(q_,"onTransitionStart"),Tn($_,"onTransitionCancel"),Tn(rg,"onTransitionEnd"),mr("onMouseEnter",["mouseout","mouseover"]),mr("onMouseLeave",["mouseout","mouseover"]),mr("onPointerEnter",["pointerout","pointerover"]),mr("onPointerLeave",["pointerout","pointerover"]),ma("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ma("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ma("onBeforeInput",["compositionend","keypress","textInput","paste"]),ma("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ma("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ma("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var po="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(" "),Tj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(po));function Tv(n,a){a=(a&4)!==0;for(var i=0;i<n.length;i++){var c=n[i],h=c.event;c=c.listeners;e:{var g=void 0;if(a)for(var x=c.length-1;0<=x;x--){var j=c[x],k=j.instance,V=j.currentTarget;if(j=j.listener,k!==g&&h.isPropagationStopped())break e;g=j,h.currentTarget=V;try{g(h)}catch(K){Cl(K)}h.currentTarget=null,g=k}else for(x=0;x<c.length;x++){if(j=c[x],k=j.instance,V=j.currentTarget,j=j.listener,k!==g&&h.isPropagationStopped())break e;g=j,h.currentTarget=V;try{g(h)}catch(K){Cl(K)}h.currentTarget=null,g=k}}}}function Re(n,a){var i=a[Pt];i===void 0&&(i=a[Pt]=new Set);var c=n+"__bubble";i.has(c)||(Nv(a,n,2,!1),i.add(c))}function Eh(n,a,i){var c=0;a&&(c|=4),Nv(i,n,c,a)}var gc="_reactListening"+Math.random().toString(36).slice(2);function Th(n){if(!n[gc]){n[gc]=!0,bp.forEach(function(i){i!=="selectionchange"&&(Tj.has(i)||Eh(i,!1,n),Eh(i,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[gc]||(a[gc]=!0,Eh("selectionchange",!1,a))}}function Nv(n,a,i,c){switch(n0(a)){case 2:var h=eE;break;case 8:h=tE;break;default:h=Ih}i=h.bind(null,a,i,n),h=void 0,!Fu||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(h=!0),c?h!==void 0?n.addEventListener(a,i,{capture:!0,passive:h}):n.addEventListener(a,i,!0):h!==void 0?n.addEventListener(a,i,{passive:h}):n.addEventListener(a,i,!1)}function Nh(n,a,i,c,h){var g=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var j=c.stateNode.containerInfo;if(j===h)break;if(x===4)for(x=c.return;x!==null;){var k=x.tag;if((k===3||k===4)&&x.stateNode.containerInfo===h)return;x=x.return}for(;j!==null;){if(x=dr(j),x===null)return;if(k=x.tag,k===5||k===6||k===26||k===27){c=g=x;continue e}j=j.parentNode}}c=c.return}Op(function(){var V=g,K=Hu(i),W=[];e:{var $=ig.get(n);if($!==void 0){var H=Nl,ie=n;switch(n){case"keypress":if(El(i)===0)break e;case"keydown":case"keyup":H=x_;break;case"focusin":ie="focus",H=Wu;break;case"focusout":ie="blur",H=Wu;break;case"beforeblur":case"afterblur":H=Wu;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":H=zp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=o_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=S_;break;case ng:case sg:case ag:H=u_;break;case rg:H=j_;break;case"scroll":case"scrollend":H=r_;break;case"wheel":H=T_;break;case"copy":case"cut":case"paste":H=h_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=Up;break;case"toggle":case"beforetoggle":H=A_}var ge=(a&4)!==0,Fe=!ge&&(n==="scroll"||n==="scrollend"),z=ge?$!==null?$+"Capture":null:$;ge=[];for(var O=V,P;O!==null;){var X=O;if(P=X.stateNode,X=X.tag,X!==5&&X!==26&&X!==27||P===null||z===null||(X=Li(O,z),X!=null&&ge.push(go(O,X,P))),Fe)break;O=O.return}0<ge.length&&($=new H($,ie,null,i,K),W.push({event:$,listeners:ge}))}}if((a&7)===0){e:{if($=n==="mouseover"||n==="pointerover",H=n==="mouseout"||n==="pointerout",$&&i!==$u&&(ie=i.relatedTarget||i.fromElement)&&(dr(ie)||ie[Ae]))break e;if((H||$)&&($=K.window===K?K:($=K.ownerDocument)?$.defaultView||$.parentWindow:window,H?(ie=i.relatedTarget||i.toElement,H=V,ie=ie?dr(ie):null,ie!==null&&(Fe=u(ie),ge=ie.tag,ie!==Fe||ge!==5&&ge!==27&&ge!==6)&&(ie=null)):(H=null,ie=V),H!==ie)){if(ge=zp,X="onMouseLeave",z="onMouseEnter",O="mouse",(n==="pointerout"||n==="pointerover")&&(ge=Up,X="onPointerLeave",z="onPointerEnter",O="pointer"),Fe=H==null?$:zi(H),P=ie==null?$:zi(ie),$=new ge(X,O+"leave",H,i,K),$.target=Fe,$.relatedTarget=P,X=null,dr(K)===V&&(ge=new ge(z,O+"enter",ie,i,K),ge.target=P,ge.relatedTarget=Fe,X=ge),Fe=X,H&&ie)t:{for(ge=Nj,z=H,O=ie,P=0,X=z;X;X=ge(X))P++;X=0;for(var me=O;me;me=ge(me))X++;for(;0<P-X;)z=ge(z),P--;for(;0<X-P;)O=ge(O),X--;for(;P--;){if(z===O||O!==null&&z===O.alternate){ge=z;break t}z=ge(z),O=ge(O)}ge=null}else ge=null;H!==null&&Av(W,$,H,ge,!1),ie!==null&&Fe!==null&&Av(W,Fe,ie,ge,!0)}}e:{if($=V?zi(V):window,H=$.nodeName&&$.nodeName.toLowerCase(),H==="select"||H==="input"&&$.type==="file")var Ue=Gp;else if($p($))if(Fp)Ue=P_;else{Ue=L_;var he=z_}else H=$.nodeName,!H||H.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?V&&qu(V.elementType)&&(Ue=Gp):Ue=U_;if(Ue&&(Ue=Ue(n,V))){Hp(W,Ue,i,K);break e}he&&he(n,$,V),n==="focusout"&&V&&$.type==="number"&&V.memoizedProps.value!=null&&Iu($,"number",$.value)}switch(he=V?zi(V):window,n){case"focusin":($p(he)||he.contentEditable==="true")&&(br=he,nd=V,Hi=null);break;case"focusout":Hi=nd=br=null;break;case"mousedown":sd=!0;break;case"contextmenu":case"mouseup":case"dragend":sd=!1,eg(W,i,K);break;case"selectionchange":if(B_)break;case"keydown":case"keyup":eg(W,i,K)}var Ne;if(Qu)e:{switch(n){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else xr?Ip(n,i)&&(De="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(De="onCompositionStart");De&&(Pp&&i.locale!=="ko"&&(xr||De!=="onCompositionStart"?De==="onCompositionEnd"&&xr&&(Ne=Dp()):(ws=K,Ku="value"in ws?ws.value:ws.textContent,xr=!0)),he=yc(V,De),0<he.length&&(De=new Lp(De,n,null,i,K),W.push({event:De,listeners:he}),Ne?De.data=Ne:(Ne=qp(i),Ne!==null&&(De.data=Ne)))),(Ne=C_?R_(n,i):O_(n,i))&&(De=yc(V,"onBeforeInput"),0<De.length&&(he=new Lp("onBeforeInput","beforeinput",null,i,K),W.push({event:he,listeners:De}),he.data=Ne)),_j(W,n,V,i,K)}Tv(W,a)})}function go(n,a,i){return{instance:n,listener:a,currentTarget:i}}function yc(n,a){for(var i=a+"Capture",c=[];n!==null;){var h=n,g=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||g===null||(h=Li(n,i),h!=null&&c.unshift(go(n,h,g)),h=Li(n,a),h!=null&&c.push(go(n,h,g))),n.tag===3)return c;n=n.return}return[]}function Nj(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Av(n,a,i,c,h){for(var g=a._reactName,x=[];i!==null&&i!==c;){var j=i,k=j.alternate,V=j.stateNode;if(j=j.tag,k!==null&&k===c)break;j!==5&&j!==26&&j!==27||V===null||(k=V,h?(V=Li(i,g),V!=null&&x.unshift(go(i,V,k))):h||(V=Li(i,g),V!=null&&x.push(go(i,V,k)))),i=i.return}x.length!==0&&n.push({event:a,listeners:x})}var Aj=/\r\n?/g,kj=/\u0000|\uFFFD/g;function kv(n){return(typeof n=="string"?n:""+n).replace(Aj,`
9
+ `).replace(kj,"")}function Cv(n,a){return a=kv(a),kv(n)===a}function Ge(n,a,i,c,h,g){switch(i){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||gr(n,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&gr(n,""+c);break;case"className":wl(n,"class",c);break;case"tabIndex":wl(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":wl(n,i,c);break;case"style":Cp(n,c,g);break;case"data":if(a!=="object"){wl(n,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||i!=="href")){n.removeAttribute(i);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(i);break}c=_l(""+c),n.setAttribute(i,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(i,"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"&&(i==="formAction"?(a!=="input"&&Ge(n,a,"name",h.name,h,null),Ge(n,a,"formEncType",h.formEncType,h,null),Ge(n,a,"formMethod",h.formMethod,h,null),Ge(n,a,"formTarget",h.formTarget,h,null)):(Ge(n,a,"encType",h.encType,h,null),Ge(n,a,"method",h.method,h,null),Ge(n,a,"target",h.target,h,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(i);break}c=_l(""+c),n.setAttribute(i,c);break;case"onClick":c!=null&&(n.onclick=Xn);break;case"onScroll":c!=null&&Re("scroll",n);break;case"onScrollEnd":c!=null&&Re("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(i=c.__html,i!=null){if(h.children!=null)throw Error(r(60));n.innerHTML=i}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){n.removeAttribute("xlink:href");break}i=_l(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,""+c):n.removeAttribute(i);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":c&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":c===!0?n.setAttribute(i,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,c):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(i,c):n.removeAttribute(i);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(i):n.setAttribute(i,c);break;case"popover":Re("beforetoggle",n),Re("toggle",n),bl(n,"popover",c);break;case"xlinkActuate":Yn(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Yn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Yn(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Yn(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Yn(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Yn(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Yn(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Yn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Yn(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":bl(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=s_.get(i)||i,bl(n,i,c))}}function Ah(n,a,i,c,h,g){switch(i){case"style":Cp(n,c,g);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(i=c.__html,i!=null){if(h.children!=null)throw Error(r(60));n.innerHTML=i}}break;case"children":typeof c=="string"?gr(n,c):(typeof c=="number"||typeof c=="bigint")&&gr(n,""+c);break;case"onScroll":c!=null&&Re("scroll",n);break;case"onScrollEnd":c!=null&&Re("scrollend",n);break;case"onClick":c!=null&&(n.onclick=Xn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wp.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(h=i.endsWith("Capture"),a=i.slice(2,h?i.length-7:void 0),g=n[te]||null,g=g!=null?g[i]:null,typeof g=="function"&&n.removeEventListener(a,g,h),typeof c=="function")){typeof g!="function"&&g!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(a,c,h);break e}i in n?n[i]=c:c===!0?n.setAttribute(i,""):bl(n,i,c)}}}function Ct(n,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Re("error",n),Re("load",n);var c=!1,h=!1,g;for(g in i)if(i.hasOwnProperty(g)){var x=i[g];if(x!=null)switch(g){case"src":c=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Ge(n,a,g,x,i,null)}}h&&Ge(n,a,"srcSet",i.srcSet,i,null),c&&Ge(n,a,"src",i.src,i,null);return;case"input":Re("invalid",n);var j=g=x=h=null,k=null,V=null;for(c in i)if(i.hasOwnProperty(c)){var K=i[c];if(K!=null)switch(c){case"name":h=K;break;case"type":x=K;break;case"checked":k=K;break;case"defaultChecked":V=K;break;case"value":g=K;break;case"defaultValue":j=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,a));break;default:Ge(n,a,c,K,i,null)}}Tp(n,g,j,k,V,x,h,!1);return;case"select":Re("invalid",n),c=x=g=null;for(h in i)if(i.hasOwnProperty(h)&&(j=i[h],j!=null))switch(h){case"value":g=j;break;case"defaultValue":x=j;break;case"multiple":c=j;default:Ge(n,a,h,j,i,null)}a=g,i=x,n.multiple=!!c,a!=null?pr(n,!!c,a,!1):i!=null&&pr(n,!!c,i,!0);return;case"textarea":Re("invalid",n),g=h=c=null;for(x in i)if(i.hasOwnProperty(x)&&(j=i[x],j!=null))switch(x){case"value":c=j;break;case"defaultValue":h=j;break;case"children":g=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(r(91));break;default:Ge(n,a,x,j,i,null)}Ap(n,c,h,g);return;case"option":for(k in i)i.hasOwnProperty(k)&&(c=i[k],c!=null)&&(k==="selected"?n.selected=c&&typeof c!="function"&&typeof c!="symbol":Ge(n,a,k,c,i,null));return;case"dialog":Re("beforetoggle",n),Re("toggle",n),Re("cancel",n),Re("close",n);break;case"iframe":case"object":Re("load",n);break;case"video":case"audio":for(c=0;c<po.length;c++)Re(po[c],n);break;case"image":Re("error",n),Re("load",n);break;case"details":Re("toggle",n);break;case"embed":case"source":case"link":Re("error",n),Re("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in i)if(i.hasOwnProperty(V)&&(c=i[V],c!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Ge(n,a,V,c,i,null)}return;default:if(qu(a)){for(K in i)i.hasOwnProperty(K)&&(c=i[K],c!==void 0&&Ah(n,a,K,c,i,void 0));return}}for(j in i)i.hasOwnProperty(j)&&(c=i[j],c!=null&&Ge(n,a,j,c,i,null))}function Cj(n,a,i,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,g=null,x=null,j=null,k=null,V=null,K=null;for(H in i){var W=i[H];if(i.hasOwnProperty(H)&&W!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":k=W;default:c.hasOwnProperty(H)||Ge(n,a,H,null,c,W)}}for(var $ in c){var H=c[$];if(W=i[$],c.hasOwnProperty($)&&(H!=null||W!=null))switch($){case"type":g=H;break;case"name":h=H;break;case"checked":V=H;break;case"defaultChecked":K=H;break;case"value":x=H;break;case"defaultValue":j=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(137,a));break;default:H!==W&&Ge(n,a,$,H,c,W)}}Bu(n,x,j,k,V,K,g,h);return;case"select":H=x=j=$=null;for(g in i)if(k=i[g],i.hasOwnProperty(g)&&k!=null)switch(g){case"value":break;case"multiple":H=k;default:c.hasOwnProperty(g)||Ge(n,a,g,null,c,k)}for(h in c)if(g=c[h],k=i[h],c.hasOwnProperty(h)&&(g!=null||k!=null))switch(h){case"value":$=g;break;case"defaultValue":j=g;break;case"multiple":x=g;default:g!==k&&Ge(n,a,h,g,c,k)}a=j,i=x,c=H,$!=null?pr(n,!!i,$,!1):!!c!=!!i&&(a!=null?pr(n,!!i,a,!0):pr(n,!!i,i?[]:"",!1));return;case"textarea":H=$=null;for(j in i)if(h=i[j],i.hasOwnProperty(j)&&h!=null&&!c.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:Ge(n,a,j,null,c,h)}for(x in c)if(h=c[x],g=i[x],c.hasOwnProperty(x)&&(h!=null||g!=null))switch(x){case"value":$=h;break;case"defaultValue":H=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(r(91));break;default:h!==g&&Ge(n,a,x,h,c,g)}Np(n,$,H);return;case"option":for(var ie in i)$=i[ie],i.hasOwnProperty(ie)&&$!=null&&!c.hasOwnProperty(ie)&&(ie==="selected"?n.selected=!1:Ge(n,a,ie,null,c,$));for(k in c)$=c[k],H=i[k],c.hasOwnProperty(k)&&$!==H&&($!=null||H!=null)&&(k==="selected"?n.selected=$&&typeof $!="function"&&typeof $!="symbol":Ge(n,a,k,$,c,H));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 ge in i)$=i[ge],i.hasOwnProperty(ge)&&$!=null&&!c.hasOwnProperty(ge)&&Ge(n,a,ge,null,c,$);for(V in c)if($=c[V],H=i[V],c.hasOwnProperty(V)&&$!==H&&($!=null||H!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,a));break;default:Ge(n,a,V,$,c,H)}return;default:if(qu(a)){for(var Fe in i)$=i[Fe],i.hasOwnProperty(Fe)&&$!==void 0&&!c.hasOwnProperty(Fe)&&Ah(n,a,Fe,void 0,c,$);for(K in c)$=c[K],H=i[K],!c.hasOwnProperty(K)||$===H||$===void 0&&H===void 0||Ah(n,a,K,$,c,H);return}}for(var z in i)$=i[z],i.hasOwnProperty(z)&&$!=null&&!c.hasOwnProperty(z)&&Ge(n,a,z,null,c,$);for(W in c)$=c[W],H=i[W],!c.hasOwnProperty(W)||$===H||$==null&&H==null||Ge(n,a,W,$,c,H)}function Rv(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Rj(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,i=performance.getEntriesByType("resource"),c=0;c<i.length;c++){var h=i[c],g=h.transferSize,x=h.initiatorType,j=h.duration;if(g&&j&&Rv(x)){for(x=0,j=h.responseEnd,c+=1;c<i.length;c++){var k=i[c],V=k.startTime;if(V>j)break;var K=k.transferSize,W=k.initiatorType;K&&Rv(W)&&(k=k.responseEnd,x+=K*(k<j?1:(j-V)/(k-V)))}if(--c,a+=8*(g+x)/(h.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var kh=null,Ch=null;function vc(n){return n.nodeType===9?n:n.ownerDocument}function Ov(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Dv(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Rh(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Oh=null;function Oj(){var n=window.event;return n&&n.type==="popstate"?n===Oh?!1:(Oh=n,!0):(Oh=null,!1)}var Mv=typeof setTimeout=="function"?setTimeout:void 0,Dj=typeof clearTimeout=="function"?clearTimeout:void 0,zv=typeof Promise=="function"?Promise:void 0,Mj=typeof queueMicrotask=="function"?queueMicrotask:typeof zv<"u"?function(n){return zv.resolve(null).then(n).catch(zj)}:Mv;function zj(n){setTimeout(function(){throw n})}function Ps(n){return n==="head"}function Lv(n,a){var i=a,c=0;do{var h=i.nextSibling;if(n.removeChild(i),h&&h.nodeType===8)if(i=h.data,i==="/$"||i==="/&"){if(c===0){n.removeChild(h),Kr(a);return}c--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")c++;else if(i==="html")yo(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,yo(i);for(var g=i.firstChild;g;){var x=g.nextSibling,j=g.nodeName;g[fa]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&g.rel.toLowerCase()==="stylesheet"||i.removeChild(g),g=x}}else i==="body"&&yo(n.ownerDocument.body);i=h}while(i);Kr(a)}function Uv(n,a){var i=n;n=0;do{var c=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),c&&c.nodeType===8)if(i=c.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=c}while(i)}function Dh(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Dh(i),Mi(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function Lj(n,a,i,c){for(;n.nodeType===1;){var h=i;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[fa])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(g=n.getAttribute("rel"),g==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(g!==h.rel||n.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||n.getAttribute("title")!==(h.title==null?null:h.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(g=n.getAttribute("src"),(g!==(h.src==null?null:h.src)||n.getAttribute("type")!==(h.type==null?null:h.type)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&g&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var g=h.name==null?null:""+h.name;if(h.type==="hidden"&&n.getAttribute("name")===g)return n}else return n;if(n=vn(n.nextSibling),n===null)break}return null}function Uj(n,a,i){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=vn(n.nextSibling),n===null))return null;return n}function Pv(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=vn(n.nextSibling),n===null))return null;return n}function Mh(n){return n.data==="$?"||n.data==="$~"}function zh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Pj(n,a){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||i.readyState!=="loading")a();else{var c=function(){a(),i.removeEventListener("DOMContentLoaded",c)};i.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function vn(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Lh=null;function Vv(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(a===0)return vn(n.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}n=n.nextSibling}return null}function Bv(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return n;a--}else i!=="/$"&&i!=="/&"||a++}n=n.previousSibling}return null}function Iv(n,a,i){switch(a=vc(i),n){case"html":if(n=a.documentElement,!n)throw Error(r(452));return n;case"head":if(n=a.head,!n)throw Error(r(453));return n;case"body":if(n=a.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function yo(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Mi(n)}var xn=new Map,qv=new Set;function xc(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ds=I.d;I.d={f:Vj,r:Bj,D:Ij,C:qj,L:$j,m:Hj,X:Fj,S:Gj,M:Kj};function Vj(){var n=ds.f(),a=uc();return n||a}function Bj(n){var a=hr(n);a!==null&&a.tag===5&&a.type==="form"?ry(a):ds.r(n)}var Hr=typeof document>"u"?null:document;function $v(n,a,i){var c=Hr;if(c&&typeof a=="string"&&a){var h=dn(a);h='link[rel="'+n+'"][href="'+h+'"]',typeof i=="string"&&(h+='[crossorigin="'+i+'"]'),qv.has(h)||(qv.add(h),n={rel:n,crossOrigin:i,href:a},c.querySelector(h)===null&&(a=c.createElement("link"),Ct(a,"link",n),St(a),c.head.appendChild(a)))}}function Ij(n){ds.D(n),$v("dns-prefetch",n,null)}function qj(n,a){ds.C(n,a),$v("preconnect",n,a)}function $j(n,a,i){ds.L(n,a,i);var c=Hr;if(c&&n&&a){var h='link[rel="preload"][as="'+dn(a)+'"]';a==="image"&&i&&i.imageSrcSet?(h+='[imagesrcset="'+dn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(h+='[imagesizes="'+dn(i.imageSizes)+'"]')):h+='[href="'+dn(n)+'"]';var g=h;switch(a){case"style":g=Gr(n);break;case"script":g=Fr(n)}xn.has(g)||(n=v({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:n,as:a},i),xn.set(g,n),c.querySelector(h)!==null||a==="style"&&c.querySelector(vo(g))||a==="script"&&c.querySelector(xo(g))||(a=c.createElement("link"),Ct(a,"link",n),St(a),c.head.appendChild(a)))}}function Hj(n,a){ds.m(n,a);var i=Hr;if(i&&n){var c=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+dn(c)+'"][href="'+dn(n)+'"]',g=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Fr(n)}if(!xn.has(g)&&(n=v({rel:"modulepreload",href:n},a),xn.set(g,n),i.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(xo(g)))return}c=i.createElement("link"),Ct(c,"link",n),St(c),i.head.appendChild(c)}}}function Gj(n,a,i){ds.S(n,a,i);var c=Hr;if(c&&n){var h=fr(c).hoistableStyles,g=Gr(n);a=a||"default";var x=h.get(g);if(!x){var j={loading:0,preload:null};if(x=c.querySelector(vo(g)))j.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":a},i),(i=xn.get(g))&&Uh(n,i);var k=x=c.createElement("link");St(k),Ct(k,"link",n),k._p=new Promise(function(V,K){k.onload=V,k.onerror=K}),k.addEventListener("load",function(){j.loading|=1}),k.addEventListener("error",function(){j.loading|=2}),j.loading|=4,bc(x,a,c)}x={type:"stylesheet",instance:x,count:1,state:j},h.set(g,x)}}}function Fj(n,a){ds.X(n,a);var i=Hr;if(i&&n){var c=fr(i).hoistableScripts,h=Fr(n),g=c.get(h);g||(g=i.querySelector(xo(h)),g||(n=v({src:n,async:!0},a),(a=xn.get(h))&&Ph(n,a),g=i.createElement("script"),St(g),Ct(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function Kj(n,a){ds.M(n,a);var i=Hr;if(i&&n){var c=fr(i).hoistableScripts,h=Fr(n),g=c.get(h);g||(g=i.querySelector(xo(h)),g||(n=v({src:n,async:!0,type:"module"},a),(a=xn.get(h))&&Ph(n,a),g=i.createElement("script"),St(g),Ct(g,"link",n),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function Hv(n,a,i,c){var h=(h=_e.current)?xc(h):null;if(!h)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=Gr(i.href),i=fr(h).hoistableStyles,c=i.get(a),c||(c={type:"style",instance:null,count:0,state:null},i.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=Gr(i.href);var g=fr(h).hoistableStyles,x=g.get(n);if(x||(h=h.ownerDocument||h,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,x),(g=h.querySelector(vo(n)))&&!g._p&&(x.instance=g,x.state.loading=5),xn.has(n)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},xn.set(n,i),g||Yj(h,n,i,x.state))),a&&c===null)throw Error(r(528,""));return x}if(a&&c!==null)throw Error(r(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Fr(i),i=fr(h).hoistableScripts,c=i.get(a),c||(c={type:"script",instance:null,count:0,state:null},i.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function Gr(n){return'href="'+dn(n)+'"'}function vo(n){return'link[rel="stylesheet"]['+n+"]"}function Gv(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function Yj(n,a,i,c){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=n.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),Ct(a,"link",i),St(a),n.head.appendChild(a))}function Fr(n){return'[src="'+dn(n)+'"]'}function xo(n){return"script[async]"+n}function Fv(n,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+dn(i.href)+'"]');if(c)return a.instance=c,St(c),c;var h=v({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),St(c),Ct(c,"style",h),bc(c,i.precedence,n),a.instance=c;case"stylesheet":h=Gr(i.href);var g=n.querySelector(vo(h));if(g)return a.state.loading|=4,a.instance=g,St(g),g;c=Gv(i),(h=xn.get(h))&&Uh(c,h),g=(n.ownerDocument||n).createElement("link"),St(g);var x=g;return x._p=new Promise(function(j,k){x.onload=j,x.onerror=k}),Ct(g,"link",c),a.state.loading|=4,bc(g,i.precedence,n),a.instance=g;case"script":return g=Fr(i.src),(h=n.querySelector(xo(g)))?(a.instance=h,St(h),h):(c=i,(h=xn.get(g))&&(c=v({},i),Ph(c,h)),n=n.ownerDocument||n,h=n.createElement("script"),St(h),Ct(h,"link",c),n.head.appendChild(h),a.instance=h);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,bc(c,i.precedence,n));return a.instance}function bc(n,a,i){for(var c=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,g=h,x=0;x<c.length;x++){var j=c[x];if(j.dataset.precedence===a)g=j;else if(g!==h)break}g?g.parentNode.insertBefore(n,g.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(n,a.firstChild))}function Uh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function Ph(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var wc=null;function Kv(n,a,i){if(wc===null){var c=new Map,h=wc=new Map;h.set(i,c)}else h=wc,c=h.get(i),c||(c=new Map,h.set(i,c));if(c.has(n))return c;for(c.set(n,null),i=i.getElementsByTagName(n),h=0;h<i.length;h++){var g=i[h];if(!(g[fa]||g[q]||n==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var x=g.getAttribute(a)||"";x=n+x;var j=c.get(x);j?j.push(g):c.set(x,[g])}}return c}function Yv(n,a,i){n=n.ownerDocument||n,n.head.insertBefore(i,a==="title"?n.querySelector("head > title"):null)}function Xj(n,a,i){if(i===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(n=a.disabled,typeof a.precedence=="string"&&n==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Xv(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Wj(n,a,i,c){if(i.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var h=Gr(c.href),g=a.querySelector(vo(h));if(g){a=g._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=Sc.bind(n),a.then(n,n)),i.state.loading|=4,i.instance=g,St(g);return}g=a.ownerDocument||a,c=Gv(c),(h=xn.get(h))&&Uh(c,h),g=g.createElement("link"),St(g);var x=g;x._p=new Promise(function(j,k){x.onload=j,x.onerror=k}),Ct(g,"link",c),i.instance=g}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=Sc.bind(n),a.addEventListener("load",i),a.addEventListener("error",i))}}var Vh=0;function Jj(n,a){return n.stylesheets&&n.count===0&&jc(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var c=setTimeout(function(){if(n.stylesheets&&jc(n,n.stylesheets),n.unsuspend){var g=n.unsuspend;n.unsuspend=null,g()}},6e4+a);0<n.imgBytes&&Vh===0&&(Vh=62500*Rj());var h=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&jc(n,n.stylesheets),n.unsuspend)){var g=n.unsuspend;n.unsuspend=null,g()}},(n.imgBytes>Vh?50:800)+a);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(h)}}: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 n=this.unsuspend;this.unsuspend=null,n()}}}var _c=null;function jc(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,_c=new Map,a.forEach(Qj,n),_c=null,Sc.call(n))}function Qj(n,a){if(!(a.state.loading&4)){var i=_c.get(n);if(i)var c=i.get(null);else{i=new Map,_c.set(n,i);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<h.length;g++){var x=h[g];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(i.set(x.dataset.precedence,x),c=x)}c&&i.set(null,c)}h=a.instance,x=h.getAttribute("data-precedence"),g=i.get(x)||c,g===c&&i.set(null,h),i.set(x,h),this.count++,c=Sc.bind(this),h.addEventListener("load",c),h.addEventListener("error",c),g?g.parentNode.insertBefore(h,g.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(h,n.firstChild)),a.state.loading|=4}}var bo={$$typeof:N,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function Zj(n,a,i,c,h,g,x,j,k){this.tag=1,this.containerInfo=n,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=Oi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oi(0),this.hiddenUpdates=Oi(null),this.identifierPrefix=c,this.onUncaughtError=h,this.onCaughtError=g,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=k,this.incompleteTransitions=new Map}function Wv(n,a,i,c,h,g,x,j,k,V,K,W){return n=new Zj(n,a,i,x,k,V,K,W,j),a=1,g===!0&&(a|=24),g=Zt(3,null,null,a),n.current=g,g.stateNode=n,a=vd(),a.refCount++,n.pooledCache=a,a.refCount++,g.memoizedState={element:c,isDehydrated:i,cache:a},Sd(g),n}function Jv(n){return n?(n=_r,n):_r}function Qv(n,a,i,c,h,g){h=Jv(h),c.context===null?c.context=h:c.pendingContext=h,c=Ns(a),c.payload={element:i},g=g===void 0?null:g,g!==null&&(c.callback=g),i=As(n,c,a),i!==null&&(Wt(i,n,a),Ji(i,n,a))}function Zv(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<a?i:a}}function Bh(n,a){Zv(n,a),(n=n.alternate)&&Zv(n,a)}function e0(n){if(n.tag===13||n.tag===31){var a=va(n,67108864);a!==null&&Wt(a,n,67108864),Bh(n,67108864)}}function t0(n){if(n.tag===13||n.tag===31){var a=an();a=Di(a);var i=va(n,a);i!==null&&Wt(i,n,a),Bh(n,a)}}var Ec=!0;function eE(n,a,i,c){var h=C.T;C.T=null;var g=I.p;try{I.p=2,Ih(n,a,i,c)}finally{I.p=g,C.T=h}}function tE(n,a,i,c){var h=C.T;C.T=null;var g=I.p;try{I.p=8,Ih(n,a,i,c)}finally{I.p=g,C.T=h}}function Ih(n,a,i,c){if(Ec){var h=qh(c);if(h===null)Nh(n,a,c,Tc,i),s0(n,c);else if(sE(h,n,a,i,c))c.stopPropagation();else if(s0(n,c),a&4&&-1<nE.indexOf(n)){for(;h!==null;){var g=hr(h);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var x=Ut(g.pendingLanes);if(x!==0){var j=g;for(j.pendingLanes|=2,j.entangledLanes|=2;x;){var k=1<<31-yt(x);j.entanglements[1]|=k,x&=~k}Bn(g),(Be&6)===0&&(lc=Et()+500,mo(0))}}break;case 31:case 13:j=va(g,2),j!==null&&Wt(j,g,2),uc(),Bh(g,2)}if(g=qh(c),g===null&&Nh(n,a,c,Tc,i),g===h)break;h=g}h!==null&&c.stopPropagation()}else Nh(n,a,c,null,i)}}function qh(n){return n=Hu(n),$h(n)}var Tc=null;function $h(n){if(Tc=null,n=dr(n),n!==null){var a=u(n);if(a===null)n=null;else{var i=a.tag;if(i===13){if(n=d(a),n!==null)return n;n=null}else if(i===31){if(n=f(a),n!==null)return n;n=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return Tc=n,null}function n0(n){switch(n){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(or()){case Ai:return 2;case ki:return 8;case la:case Fn:return 32;case ul:return 268435456;default:return 32}default:return 32}}var Hh=!1,Vs=null,Bs=null,Is=null,wo=new Map,So=new Map,qs=[],nE="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 s0(n,a){switch(n){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":wo.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":So.delete(a.pointerId)}}function _o(n,a,i,c,h,g){return n===null||n.nativeEvent!==g?(n={blockedOn:a,domEventName:i,eventSystemFlags:c,nativeEvent:g,targetContainers:[h]},a!==null&&(a=hr(a),a!==null&&e0(a)),n):(n.eventSystemFlags|=c,a=n.targetContainers,h!==null&&a.indexOf(h)===-1&&a.push(h),n)}function sE(n,a,i,c,h){switch(a){case"focusin":return Vs=_o(Vs,n,a,i,c,h),!0;case"dragenter":return Bs=_o(Bs,n,a,i,c,h),!0;case"mouseover":return Is=_o(Is,n,a,i,c,h),!0;case"pointerover":var g=h.pointerId;return wo.set(g,_o(wo.get(g)||null,n,a,i,c,h)),!0;case"gotpointercapture":return g=h.pointerId,So.set(g,_o(So.get(g)||null,n,a,i,c,h)),!0}return!1}function a0(n){var a=dr(n.target);if(a!==null){var i=u(a);if(i!==null){if(a=i.tag,a===13){if(a=d(i),a!==null){n.blockedOn=a,vl(n.priority,function(){t0(i)});return}}else if(a===31){if(a=f(i),a!==null){n.blockedOn=a,vl(n.priority,function(){t0(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Nc(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var i=qh(n.nativeEvent);if(i===null){i=n.nativeEvent;var c=new i.constructor(i.type,i);$u=c,i.target.dispatchEvent(c),$u=null}else return a=hr(i),a!==null&&e0(a),n.blockedOn=i,!1;a.shift()}return!0}function r0(n,a,i){Nc(n)&&i.delete(a)}function aE(){Hh=!1,Vs!==null&&Nc(Vs)&&(Vs=null),Bs!==null&&Nc(Bs)&&(Bs=null),Is!==null&&Nc(Is)&&(Is=null),wo.forEach(r0),So.forEach(r0)}function Ac(n,a){n.blockedOn===a&&(n.blockedOn=null,Hh||(Hh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,aE)))}var kc=null;function i0(n){kc!==n&&(kc=n,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){kc===n&&(kc=null);for(var a=0;a<n.length;a+=3){var i=n[a],c=n[a+1],h=n[a+2];if(typeof c!="function"){if($h(c||i)===null)continue;break}var g=hr(i);g!==null&&(n.splice(a,3),a-=3,qd(g,{pending:!0,data:h,method:i.method,action:c},c,h))}}))}function Kr(n){function a(k){return Ac(k,n)}Vs!==null&&Ac(Vs,n),Bs!==null&&Ac(Bs,n),Is!==null&&Ac(Is,n),wo.forEach(a),So.forEach(a);for(var i=0;i<qs.length;i++){var c=qs[i];c.blockedOn===n&&(c.blockedOn=null)}for(;0<qs.length&&(i=qs[0],i.blockedOn===null);)a0(i),i.blockedOn===null&&qs.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(c=0;c<i.length;c+=3){var h=i[c],g=i[c+1],x=h[te]||null;if(typeof g=="function")x||i0(i);else if(x){var j=null;if(g&&g.hasAttribute("formAction")){if(h=g,x=g[te]||null)j=x.formAction;else if($h(h)!==null)continue}else j=x.action;typeof j=="function"?i[c+1]=j:(i.splice(c,3),c-=3),i0(i)}}}function o0(){function n(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(x){return h=x})},focusReset:"manual",scroll:"manual"})}function a(){h!==null&&(h(),h=null),c||setTimeout(i,20)}function i(){if(!c&&!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 c=!1,h=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),h!==null&&(h(),h=null)}}}function Gh(n){this._internalRoot=n}Cc.prototype.render=Gh.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(r(409));var i=a.current,c=an();Qv(i,c,n,a,null,null)},Cc.prototype.unmount=Gh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;Qv(n.current,2,null,n,null,null),uc(),a[Ae]=null}};function Cc(n){this._internalRoot=n}Cc.prototype.unstable_scheduleHydration=function(n){if(n){var a=yl();n={blockedOn:null,target:n,priority:a};for(var i=0;i<qs.length&&a!==0&&a<qs[i].priority;i++);qs.splice(i,0,n),i===0&&a0(n)}};var l0=e.version;if(l0!=="19.2.3")throw Error(r(527,l0,"19.2.3"));I.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=m(a),n=n!==null?y(n):null,n=n===null?null:n.stateNode,n};var rE={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:C,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(rE),Tt=Rc}catch{}}return Eo.createRoot=function(n,a){if(!o(n))throw Error(r(299));var i=!1,c="",h=py,g=gy,x=yy;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(g=a.onCaughtError),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),a=Wv(n,1,!1,null,null,i,c,null,h,g,x,o0),n[Ae]=a.current,Th(n),new Gh(a)},Eo.hydrateRoot=function(n,a,i){if(!o(n))throw Error(r(299));var c=!1,h="",g=py,x=gy,j=yy,k=null;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(j=i.onRecoverableError),i.formState!==void 0&&(k=i.formState)),a=Wv(n,1,!0,a,i??null,c,h,k,g,x,j,o0),a.context=Jv(null),i=a.current,c=an(),c=Di(c),h=Ns(c),h.callback=null,As(i,h,c),i=c,a.current.lanes=i,da(a,i),Bn(a),n[Ae]=a.current,Th(n),new Cc(a)},Eo.version="19.2.3",Eo}var v0;function pE(){if(v0)return Yh.exports;v0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Yh.exports=mE(),Yh.exports}var gE=pE();const yE=_m(gE);const vE=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xE=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,r)=>r?r.toUpperCase():s.toLowerCase()),x0=t=>{const e=xE(t);return e.charAt(0).toUpperCase()+e.slice(1)},Ob=(...t)=>t.filter((e,s,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===s).join(" ").trim(),bE=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var wE={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 SE=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:o="",children:u,iconNode:d,...f},p)=>w.createElement("svg",{ref:p,...wE,width:e,height:e,stroke:t,strokeWidth:r?Number(s)*24/Number(e):s,className:Ob("lucide",o),...!u&&!bE(f)&&{"aria-hidden":"true"},...f},[...d.map(([m,y])=>w.createElement(m,y)),...Array.isArray(u)?u:[u]]));const ae=(t,e)=>{const s=w.forwardRef(({className:r,...o},u)=>w.createElement(SE,{ref:u,iconNode:e,className:Ob(`lucide-${vE(x0(t))}`,`lucide-${t}`,r),...o}));return s.displayName=x0(t),s};const _E=[["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"}]],jE=ae("activity",_E);const EE=[["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"}]],TE=ae("archive",EE);const NE=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],AE=ae("arrow-down",NE);const kE=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Tm=ae("arrow-left",kE);const CE=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],RE=ae("arrow-up",CE);const OE=[["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"}]],DE=ae("boxes",OE);const ME=[["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"}]],Po=ae("brain",ME);const zE=[["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"}]],LE=ae("briefcase",zE);const UE=[["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"}]],PE=ae("calendar",UE);const VE=[["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"}]],BE=ae("camera",VE);const IE=[["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=ae("chart-column",IE);const qE=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ks=ae("check",qE);const $E=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mb=ae("chevron-down",$E);const HE=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],GE=ae("chevron-left",HE);const FE=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],au=ae("chevron-right",FE);const KE=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],YE=ae("chevron-up",KE);const XE=[["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"}]],Mn=ae("circle-alert",XE);const WE=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ru=ae("circle-check-big",WE);const JE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Nm=ae("circle-check",JE);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"}]],ZE=ae("circle-user",QE);const eT=[["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"}]],tT=ae("circle-x",eT);const nT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Qa=ae("clock",nT);const sT=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],ps=ae("code",sT);const aT=[["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"}]],wu=ae("cpu",aT);const rT=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],hi=ae("database",rT);const iT=[["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"}]],Vo=ae("external-link",iT);const oT=[["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"}]],lT=ae("eye-off",oT);const cT=[["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=ae("eye",cT);const uT=[["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"}]],dT=ae("flag",uT);const hT=[["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"}]],fT=ae("globe",hT);const mT=[["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"}]],pT=ae("hash",mT);const gT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],yi=ae("info",gT);const yT=[["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"}]],b0=ae("key-round",yT);const vT=[["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=ae("key",vT);const xT=[["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"}]],bT=ae("layout-dashboard",xT);const wT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],zt=ae("loader-circle",wT);const ST=[["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"}]],_T=ae("log-in",ST);const jT=[["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"}]],ET=ae("log-out",jT);const TT=[["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"}]],Bo=ae("mail",TT);const NT=[["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"}]],AT=ae("minimize-2",NT);const kT=[["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"}]],CT=ae("moon",kT);const RT=[["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=ae("paperclip",RT);const OT=[["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"}]],DT=ae("pen",OT);const MT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ia=ae("plus",MT);const zT=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Ub=ae("power",zT);const LT=[["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"}]],Jt=ae("refresh-cw",LT);const UT=[["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"}]],PT=ae("rocket",UT);const VT=[["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=ae("rotate-ccw",VT);const BT=[["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"}]],IT=ae("save",BT);const qT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],$T=ae("search",qT);const HT=[["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"}]],GT=ae("send",HT);const FT=[["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"}]],Io=ae("settings",FT);const KT=[["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"}]],YT=ae("settings-2",KT);const XT=[["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=ae("shield-check",XT);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"}]],km=ae("shield",WT);const JT=[["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=ae("sparkles",JT);const QT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ZT=ae("square",QT);const eN=[["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"}]],tN=ae("sun",eN);const nN=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],iu=ae("terminal",nN);const sN=[["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"}]],Su=ae("trash-2",sN);const aN=[["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"}]],vi=ae("triangle-alert",aN);const rN=[["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"}]],iN=ae("upload",rN);const oN=[["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"}]],lN=ae("user-plus",oN);const cN=[["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"}]],Bb=ae("user",cN);const uN=[["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"}]],dN=ae("volume-2",uN);const hN=[["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"}]],fN=ae("volume-x",hN);const mN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],aa=ae("x",mN);const pN=[["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"}]],qo=ae("zap",pN),gN={theme:"system",setTheme:()=>null},Ib=w.createContext(gN);function yN({children:t,defaultTheme:e="system",storageKey:s="vite-ui-theme"}){const[r,o]=w.useState(()=>localStorage.getItem(s)||e);w.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),r==="system"){const f=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(f);return}d.classList.add(r)},[r]);const u={theme:r,setTheme:d=>{localStorage.setItem(s,d),o(d)}};return l.jsx(Ib.Provider,{value:u,children:t})}const vN=()=>{const t=w.useContext(Ib);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t};function w0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _u(...t){return e=>{let s=!1;const r=t.map(o=>{const u=w0(o,e);return!s&&typeof u=="function"&&(s=!0),u});if(s)return()=>{for(let o=0;o<r.length;o++){const u=r[o];typeof u=="function"?u():w0(t[o],null)}}}}function nr(...t){return w.useCallback(_u(...t),t)}var xN=Symbol.for("react.lazy"),ou=Em[" use ".trim().toString()];function bN(t){return typeof t=="object"&&t!==null&&"then"in t}function qb(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===xN&&"_payload"in t&&bN(t._payload)}function $b(t){const e=SN(t),s=w.forwardRef((r,o)=>{let{children:u,...d}=r;qb(u)&&typeof ou=="function"&&(u=ou(u._payload));const f=w.Children.toArray(u),p=f.find(jN);if(p){const m=p.props.children,y=f.map(v=>v===p?w.Children.count(m)>1?w.Children.only(null):w.isValidElement(m)?m.props.children:null:v);return l.jsx(e,{...d,ref:o,children:w.isValidElement(m)?w.cloneElement(m,void 0,y):null})}return l.jsx(e,{...d,ref:o,children:u})});return s.displayName=`${t}.Slot`,s}var wN=$b("Slot");function SN(t){const e=w.forwardRef((s,r)=>{let{children:o,...u}=s;if(qb(o)&&typeof ou=="function"&&(o=ou(o._payload)),w.isValidElement(o)){const d=TN(o),f=EN(u,o.props);return o.type!==w.Fragment&&(f.ref=r?_u(r,d):d),w.cloneElement(o,f)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var _N=Symbol("radix.slottable");function jN(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===_N}function EN(t,e){const s={...e};for(const r in e){const o=t[r],u=e[r];/^on[A-Z]/.test(r)?o&&u?s[r]=(...f)=>{const p=u(...f);return o(...f),p}:o&&(s[r]=o):r==="style"?s[r]={...o,...u}:r==="className"&&(s[r]=[o,u].filter(Boolean).join(" "))}return{...t,...s}}function TN(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}function Hb(t){var e,s,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(s=Hb(t[e]))&&(r&&(r+=" "),r+=s)}else for(s in t)t[s]&&(r&&(r+=" "),r+=s);return r}function Gb(){for(var t,e,s=0,r="",o=arguments.length;s<o;s++)(t=arguments[s])&&(e=Hb(t))&&(r&&(r+=" "),r+=e);return r}const S0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,_0=Gb,Fb=(t,e)=>s=>{var r;if(e?.variants==null)return _0(t,s?.class,s?.className);const{variants:o,defaultVariants:u}=e,d=Object.keys(o).map(m=>{const y=s?.[m],v=u?.[m];if(y===null)return null;const b=S0(y)||S0(v);return o[m][b]}),f=s&&Object.entries(s).reduce((m,y)=>{let[v,b]=y;return b===void 0||(m[v]=b),m},{}),p=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((m,y)=>{let{class:v,className:b,...S}=y;return Object.entries(S).every(_=>{let[E,T]=_;return Array.isArray(T)?T.includes({...u,...f}[E]):{...u,...f}[E]===T})?[...m,v,b]:m},[]);return _0(t,d,p,s?.class,s?.className)},NN=(t,e)=>{const s=new Array(t.length+e.length);for(let r=0;r<t.length;r++)s[r]=t[r];for(let r=0;r<e.length;r++)s[t.length+r]=e[r];return s},AN=(t,e)=>({classGroupId:t,validator:e}),Kb=(t=new Map,e=null,s)=>({nextPart:t,validators:e,classGroupId:s}),lu="-",j0=[],kN="arbitrary..",CN=t=>{const e=ON(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return RN(d);const f=d.split(lu),p=f[0]===""&&f.length>1?1:0;return Yb(f,p,e)},getConflictingClassGroupIds:(d,f)=>{if(f){const p=r[d],m=s[d];return p?m?NN(m,p):p:m||j0}return s[d]||j0}}},Yb=(t,e,s)=>{if(t.length-e===0)return s.classGroupId;const o=t[e],u=s.nextPart.get(o);if(u){const m=Yb(t,e+1,u);if(m)return m}const d=s.validators;if(d===null)return;const f=e===0?t.join(lu):t.slice(e).join(lu),p=d.length;for(let m=0;m<p;m++){const y=d[m];if(y.validator(f))return y.classGroupId}},RN=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),s=e.indexOf(":"),r=e.slice(0,s);return r?kN+r:void 0})(),ON=t=>{const{theme:e,classGroups:s}=t;return DN(s,e)},DN=(t,e)=>{const s=Kb();for(const r in t){const o=t[r];Cm(o,s,r,e)}return s},Cm=(t,e,s,r)=>{const o=t.length;for(let u=0;u<o;u++){const d=t[u];MN(d,e,s,r)}},MN=(t,e,s,r)=>{if(typeof t=="string"){zN(t,e,s);return}if(typeof t=="function"){LN(t,e,s,r);return}UN(t,e,s,r)},zN=(t,e,s)=>{const r=t===""?e:Xb(e,t);r.classGroupId=s},LN=(t,e,s,r)=>{if(PN(t)){Cm(t(r),e,s,r);return}e.validators===null&&(e.validators=[]),e.validators.push(AN(s,t))},UN=(t,e,s,r)=>{const o=Object.entries(t),u=o.length;for(let d=0;d<u;d++){const[f,p]=o[d];Cm(p,Xb(e,f),s,r)}},Xb=(t,e)=>{let s=t;const r=e.split(lu),o=r.length;for(let u=0;u<o;u++){const d=r[u];let f=s.nextPart.get(d);f||(f=Kb(),s.nextPart.set(d,f)),s=f}return s},PN=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,VN=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,s=Object.create(null),r=Object.create(null);const o=(u,d)=>{s[u]=d,e++,e>t&&(e=0,r=s,s=Object.create(null))};return{get(u){let d=s[u];if(d!==void 0)return d;if((d=r[u])!==void 0)return o(u,d),d},set(u,d){u in s?s[u]=d:o(u,d)}}},Lf="!",E0=":",BN=[],T0=(t,e,s,r,o)=>({modifiers:t,hasImportantModifier:e,baseClassName:s,maybePostfixModifierPosition:r,isExternal:o}),IN=t=>{const{prefix:e,experimentalParseClassName:s}=t;let r=o=>{const u=[];let d=0,f=0,p=0,m;const y=o.length;for(let E=0;E<y;E++){const T=o[E];if(d===0&&f===0){if(T===E0){u.push(o.slice(p,E)),p=E+1;continue}if(T==="/"){m=E;continue}}T==="["?d++:T==="]"?d--:T==="("?f++:T===")"&&f--}const v=u.length===0?o:o.slice(p);let b=v,S=!1;v.endsWith(Lf)?(b=v.slice(0,-1),S=!0):v.startsWith(Lf)&&(b=v.slice(1),S=!0);const _=m&&m>p?m-p:void 0;return T0(u,S,b,_)};if(e){const o=e+E0,u=r;r=d=>d.startsWith(o)?u(d.slice(o.length)):T0(BN,!1,d,void 0,!0)}if(s){const o=r;r=u=>s({className:u,parseClassName:o})}return r},qN=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((s,r)=>{e.set(s,1e6+r)}),s=>{const r=[];let o=[];for(let u=0;u<s.length;u++){const d=s[u],f=d[0]==="[",p=e.has(d);f||p?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(d)):o.push(d)}return o.length>0&&(o.sort(),r.push(...o)),r}},$N=t=>({cache:VN(t.cacheSize),parseClassName:IN(t),sortModifiers:qN(t),...CN(t)}),HN=/\s+/,GN=(t,e)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:u}=e,d=[],f=t.trim().split(HN);let p="";for(let m=f.length-1;m>=0;m-=1){const y=f[m],{isExternal:v,modifiers:b,hasImportantModifier:S,baseClassName:_,maybePostfixModifierPosition:E}=s(y);if(v){p=y+(p.length>0?" "+p:p);continue}let T=!!E,A=r(T?_.substring(0,E):_);if(!A){if(!T){p=y+(p.length>0?" "+p:p);continue}if(A=r(_),!A){p=y+(p.length>0?" "+p:p);continue}T=!1}const D=b.length===0?"":b.length===1?b[0]:u(b).join(":"),N=S?D+Lf:D,L=N+A;if(d.indexOf(L)>-1)continue;d.push(L);const G=o(A,T);for(let F=0;F<G.length;++F){const U=G[F];d.push(N+U)}p=y+(p.length>0?" "+p:p)}return p},FN=(...t)=>{let e=0,s,r,o="";for(;e<t.length;)(s=t[e++])&&(r=Wb(s))&&(o&&(o+=" "),o+=r);return o},Wb=t=>{if(typeof t=="string")return t;let e,s="";for(let r=0;r<t.length;r++)t[r]&&(e=Wb(t[r]))&&(s&&(s+=" "),s+=e);return s},KN=(t,...e)=>{let s,r,o,u;const d=p=>{const m=e.reduce((y,v)=>v(y),t());return s=$N(m),r=s.cache.get,o=s.cache.set,u=f,f(p)},f=p=>{const m=r(p);if(m)return m;const y=GN(p,s);return o(p,y),y};return u=d,(...p)=>u(FN(...p))},YN=[],xt=t=>{const e=s=>s[t]||YN;return e.isThemeGetter=!0,e},Jb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,XN=/^\d+\/\d+$/,WN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JN=/\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)\(.+\)$/,ZN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,e2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yr=t=>XN.test(t),ke=t=>!!t&&!Number.isNaN(Number(t)),Hs=t=>!!t&&Number.isInteger(Number(t)),Qh=t=>t.endsWith("%")&&ke(t.slice(0,-1)),hs=t=>WN.test(t),t2=()=>!0,n2=t=>JN.test(t)&&!QN.test(t),Zb=()=>!1,s2=t=>ZN.test(t),a2=t=>e2.test(t),r2=t=>!oe(t)&&!le(t),i2=t=>bi(t,nw,Zb),oe=t=>Jb.test(t),Ra=t=>bi(t,sw,n2),Zh=t=>bi(t,d2,ke),N0=t=>bi(t,ew,Zb),o2=t=>bi(t,tw,a2),Oc=t=>bi(t,aw,s2),le=t=>Qb.test(t),To=t=>wi(t,sw),l2=t=>wi(t,h2),A0=t=>wi(t,ew),c2=t=>wi(t,nw),u2=t=>wi(t,tw),Dc=t=>wi(t,aw,!0),bi=(t,e,s)=>{const r=Jb.exec(t);return r?r[1]?e(r[1]):s(r[2]):!1},wi=(t,e,s=!1)=>{const r=Qb.exec(t);return r?r[1]?e(r[1]):s:!1},ew=t=>t==="position"||t==="percentage",tw=t=>t==="image"||t==="url",nw=t=>t==="length"||t==="size"||t==="bg-size",sw=t=>t==="length",d2=t=>t==="number",h2=t=>t==="family-name",aw=t=>t==="shadow",f2=()=>{const t=xt("color"),e=xt("font"),s=xt("text"),r=xt("font-weight"),o=xt("tracking"),u=xt("leading"),d=xt("breakpoint"),f=xt("container"),p=xt("spacing"),m=xt("radius"),y=xt("shadow"),v=xt("inset-shadow"),b=xt("text-shadow"),S=xt("drop-shadow"),_=xt("blur"),E=xt("perspective"),T=xt("aspect"),A=xt("ease"),D=xt("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],G=()=>[...L(),le,oe],F=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto","contain","none"],M=()=>[le,oe,p],J=()=>[Yr,"full","auto",...M()],re=()=>[Hs,"none","subgrid",le,oe],xe=()=>["auto",{span:["full",Hs,le,oe]},Hs,le,oe],ue=()=>[Hs,"auto",le,oe],Ie=()=>["auto","min","max","fr",le,oe],Ve=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...M()],I=()=>[Yr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],B=()=>[t,le,oe],de=()=>[...L(),A0,N0,{position:[le,oe]}],Se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",c2,i2,{size:[le,oe]}],Y=()=>[Qh,To,Ra],Z=()=>["","none","full",m,le,oe],ne=()=>["",ke,To,Ra],be=()=>["solid","dashed","dotted","double"],_e=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[ke,Qh,A0,N0],ot=()=>["","none",_,le,oe],Le=()=>["none",ke,le,oe],cn=()=>["none",ke,le,oe],Ht=()=>[ke,le,oe],jt=()=>[Yr,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hs],breakpoint:[hs],color:[t2],container:[hs],"drop-shadow":[hs],ease:["in","out","in-out"],font:[r2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hs],shadow:[hs],spacing:["px",ke],text:[hs],"text-shadow":[hs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Yr,oe,le,T]}],container:["container"],columns:[{columns:[ke,oe,le,f]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:G()}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:J()}],"inset-x":[{"inset-x":J()}],"inset-y":[{"inset-y":J()}],start:[{start:J()}],end:[{end:J()}],top:[{top:J()}],right:[{right:J()}],bottom:[{bottom:J()}],left:[{left:J()}],visibility:["visible","invisible","collapse"],z:[{z:[Hs,"auto",le,oe]}],basis:[{basis:[Yr,"full","auto",f,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ke,Yr,"auto","initial","none",oe]}],grow:[{grow:["",ke,le,oe]}],shrink:[{shrink:["",ke,le,oe]}],order:[{order:[Hs,"first","last","none",le,oe]}],"grid-cols":[{"grid-cols":re()}],"col-start-end":[{col:xe()}],"col-start":[{"col-start":ue()}],"col-end":[{"col-end":ue()}],"grid-rows":[{"grid-rows":re()}],"row-start-end":[{row:xe()}],"row-start":[{"row-start":ue()}],"row-end":[{"row-end":ue()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ie()}],"auto-rows":[{"auto-rows":Ie()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...Ve(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...Ve()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ve()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],w:[{w:[f,"screen",...I()]}],"min-w":[{"min-w":[f,"screen","none",...I()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",s,To,Ra]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,le,Zh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qh,oe]}],"font-family":[{font:[l2,oe,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:[o,le,oe]}],"line-clamp":[{"line-clamp":[ke,"none",le,Zh]}],leading:[{leading:[u,...M()]}],"list-image":[{"list-image":["none",le,oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",le,oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:[ke,"from-font","auto",le,Ra]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[ke,"auto",le,oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le,oe]}],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",le,oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:de()}],"bg-repeat":[{bg:Se()}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hs,le,oe],radial:["",le,oe],conic:[Hs,le,oe]},u2,o2]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...be(),"hidden","none"]}],"divide-style":[{divide:[...be(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ke,le,oe]}],"outline-w":[{outline:["",ke,To,Ra]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",y,Dc,Oc]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",v,Dc,Oc]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[ke,Ra]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",b,Dc,Oc]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[ke,le,oe]}],"mix-blend":[{"mix-blend":[..._e(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":_e()}],"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":[ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[le,oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"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":L()}],"mask-image-conic-pos":[{"mask-conic":[ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:de()}],"mask-repeat":[{mask:Se()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",le,oe]}],filter:[{filter:["","none",le,oe]}],blur:[{blur:ot()}],brightness:[{brightness:[ke,le,oe]}],contrast:[{contrast:[ke,le,oe]}],"drop-shadow":[{"drop-shadow":["","none",S,Dc,Oc]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",ke,le,oe]}],"hue-rotate":[{"hue-rotate":[ke,le,oe]}],invert:[{invert:["",ke,le,oe]}],saturate:[{saturate:[ke,le,oe]}],sepia:[{sepia:["",ke,le,oe]}],"backdrop-filter":[{"backdrop-filter":["","none",le,oe]}],"backdrop-blur":[{"backdrop-blur":ot()}],"backdrop-brightness":[{"backdrop-brightness":[ke,le,oe]}],"backdrop-contrast":[{"backdrop-contrast":[ke,le,oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ke,le,oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ke,le,oe]}],"backdrop-invert":[{"backdrop-invert":["",ke,le,oe]}],"backdrop-opacity":[{"backdrop-opacity":[ke,le,oe]}],"backdrop-saturate":[{"backdrop-saturate":[ke,le,oe]}],"backdrop-sepia":[{"backdrop-sepia":["",ke,le,oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",le,oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ke,"initial",le,oe]}],ease:[{ease:["linear","initial",A,le,oe]}],delay:[{delay:[ke,le,oe]}],animate:[{animate:["none",D,le,oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[E,le,oe]}],"perspective-origin":[{"perspective-origin":G()}],rotate:[{rotate:Le()}],"rotate-x":[{"rotate-x":Le()}],"rotate-y":[{"rotate-y":Le()}],"rotate-z":[{"rotate-z":Le()}],scale:[{scale:cn()}],"scale-x":[{"scale-x":cn()}],"scale-y":[{"scale-y":cn()}],"scale-z":[{"scale-z":cn()}],"scale-3d":["scale-3d"],skew:[{skew:Ht()}],"skew-x":[{"skew-x":Ht()}],"skew-y":[{"skew-y":Ht()}],transform:[{transform:[le,oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:G()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:jt()}],"translate-x":[{"translate-x":jt()}],"translate-y":[{"translate-y":jt()}],"translate-z":[{"translate-z":jt()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"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",le,oe]}],"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":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",le,oe]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[ke,To,Ra,Zh]}],stroke:[{stroke:["none",...B()]}],"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"]}},m2=KN(f2);function we(...t){return m2(Gb(t))}const p2=Fb("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"}}),Q=w.forwardRef(({className:t,variant:e,size:s,asChild:r=!1,...o},u)=>{const d=r?wN:"button";return l.jsx(d,{className:we(p2({variant:e,size:s,className:t})),ref:u,...o})});Q.displayName="Button";function rw(){const{setTheme:t,theme:e}=vN();return l.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>t(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"?l.jsx(tN,{className:"h-[1.2rem] w-[1.2rem]"}):l.jsx(CT,{className:"h-[1.2rem] w-[1.2rem]"}),l.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var qn=function(){return qn=Object.assign||function(e){for(var s,r=1,o=arguments.length;r<o;r++){s=arguments[r];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(e[u]=s[u])}return e},qn.apply(this,arguments)};function Si(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(s[r[o]]=t[r[o]]);return s}function g2(t,e,s,r){function o(u){return u instanceof s?u:new s(function(d){d(u)})}return new(s||(s=Promise))(function(u,d){function f(y){try{m(r.next(y))}catch(v){d(v)}}function p(y){try{m(r.throw(y))}catch(v){d(v)}}function m(y){y.done?u(y.value):o(y.value).then(f,p)}m((r=r.apply(t,e||[])).next())})}function y2(t,e,s){if(s||arguments.length===2)for(var r=0,o=e.length,u;r<o;r++)(u||!(r in e))&&(u||(u=Array.prototype.slice.call(e,0,r)),u[r]=e[r]);return t.concat(u||Array.prototype.slice.call(e))}const v2=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Rm extends Error{constructor(e,s="FunctionsError",r){super(e),this.name=s,this.context=r}}class x2 extends Rm{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class k0 extends Rm{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class C0 extends Rm{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Uf;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Uf||(Uf={}));class b2{constructor(e,{headers:s={},customFetch:r,region:o=Uf.Any}={}){this.url=e,this.headers=s,this.region=o,this.fetch=v2(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return g2(this,arguments,void 0,function*(s,r={}){var o;let u,d;try{const{headers:f,method:p,body:m,signal:y,timeout:v}=r;let b={},{region:S}=r;S||(S=this.region);const _=new URL(`${this.url}/${s}`);S&&S!=="any"&&(b["x-region"]=S,_.searchParams.set("forceFunctionRegion",S));let E;m&&(f&&!Object.prototype.hasOwnProperty.call(f,"Content-Type")||!f)?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(b["Content-Type"]="application/octet-stream",E=m):typeof m=="string"?(b["Content-Type"]="text/plain",E=m):typeof FormData<"u"&&m instanceof FormData?E=m:(b["Content-Type"]="application/json",E=JSON.stringify(m)):m&&typeof m!="string"&&!(typeof Blob<"u"&&m instanceof Blob)&&!(m instanceof ArrayBuffer)&&!(typeof FormData<"u"&&m instanceof FormData)?E=JSON.stringify(m):E=m;let T=y;v&&(d=new AbortController,u=setTimeout(()=>d.abort(),v),y?(T=d.signal,y.addEventListener("abort",()=>d.abort())):T=d.signal);const A=yield this.fetch(_.toString(),{method:p||"POST",headers:Object.assign(Object.assign(Object.assign({},b),this.headers),f),body:E,signal:T}).catch(G=>{throw new x2(G)}),D=A.headers.get("x-relay-error");if(D&&D==="true")throw new k0(A);if(!A.ok)throw new C0(A);let N=((o=A.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),L;return N==="application/json"?L=yield A.json():N==="application/octet-stream"||N==="application/pdf"?L=yield A.blob():N==="text/event-stream"?L=A:N==="multipart/form-data"?L=yield A.formData():L=yield A.text(),{data:L,error:null,response:A}}catch(f){return{data:null,error:f,response:f instanceof C0||f instanceof k0?f.context:void 0}}finally{u&&clearTimeout(u)}})}}var w2=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},S2=class{constructor(t){var e,s;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(s=t.isMaybeSingle)!==null&&s!==void 0?s:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var s=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 r=this.fetch;let o=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async u=>{let d=null,f=null,p=null,m=u.status,y=u.statusText;if(u.ok){var v,b;if(s.method!=="HEAD"){var S;const A=await u.text();A===""||(s.headers.get("Accept")==="text/csv"||s.headers.get("Accept")&&(!((S=s.headers.get("Accept"))===null||S===void 0)&&S.includes("application/vnd.pgrst.plan+text"))?f=A:f=JSON.parse(A))}const E=(v=s.headers.get("Prefer"))===null||v===void 0?void 0:v.match(/count=(exact|planned|estimated)/),T=(b=u.headers.get("content-range"))===null||b===void 0?void 0:b.split("/");E&&T&&T.length>1&&(p=parseInt(T[1])),s.isMaybeSingle&&s.method==="GET"&&Array.isArray(f)&&(f.length>1?(d={code:"PGRST116",details:`Results contain ${f.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},f=null,p=null,m=406,y="Not Acceptable"):f.length===1?f=f[0]:f=null)}else{var _;const E=await u.text();try{d=JSON.parse(E),Array.isArray(d)&&u.status===404&&(f=[],d=null,m=200,y="OK")}catch{u.status===404&&E===""?(m=204,y="No Content"):d={message:E}}if(d&&s.isMaybeSingle&&(!(d==null||(_=d.details)===null||_===void 0)&&_.includes("0 rows"))&&(d=null,m=200,y="OK"),d&&s.shouldThrowOnError)throw new w2(d)}return{error:d,data:f,count:p,status:m,statusText:y}});return this.shouldThrowOnError||(o=o.catch(u=>{var d;let f="";const p=u?.cause;if(p){var m,y,v,b;const _=(m=p?.message)!==null&&m!==void 0?m:"",E=(y=p?.code)!==null&&y!==void 0?y:"";f=`${(v=u?.name)!==null&&v!==void 0?v:"FetchError"}: ${u?.message}`,f+=`
10
+
11
+ Caused by: ${(b=p?.name)!==null&&b!==void 0?b:"Error"}: ${_}`,E&&(f+=` (${E})`),p?.stack&&(f+=`
12
+ ${p.stack}`)}else{var S;f=(S=u?.stack)!==null&&S!==void 0?S:""}return{error:{message:`${(d=u?.name)!==null&&d!==void 0?d:"FetchError"}: ${u?.message}`,details:f,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(t,e)}returns(){return this}overrideTypes(){return this}},_2=class extends S2{select(t){let e=!1;const s=(t??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:s,foreignTable:r,referencedTable:o=r}={}){const u=o?`${o}.order`:"order",d=this.url.searchParams.get(u);return this.url.searchParams.set(u,`${d?`${d},`:""}${t}.${e?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:s=e}={}){const r=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,e,{foreignTable:s,referencedTable:r=s}={}){const o=typeof r>"u"?"offset":`${r}.offset`,u=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(o,`${t}`),this.url.searchParams.set(u,`${e-t+1}`),this}abortSignal(t){return this.signal=t,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:t=!1,verbose:e=!1,settings:s=!1,buffers:r=!1,wal:o=!1,format:u="text"}={}){var d;const f=[t?"analyze":null,e?"verbose":null,s?"settings":null,r?"buffers":null,o?"wal":null].filter(Boolean).join("|"),p=(d=this.headers.get("Accept"))!==null&&d!==void 0?d:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${u}; for="${p}"; options=${f};`),u==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const R0=new RegExp("[,()]");var ai=class extends _2{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const s=Array.from(new Set(e)).map(r=>typeof r=="string"&&R0.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`in.(${s})`),this}notIn(t,e){const s=Array.from(new Set(e)).map(r=>typeof r=="string"&&R0.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`not.in.(${s})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:s,type:r}={}){let o="";r==="plain"?o="pl":r==="phrase"?o="ph":r==="websearch"&&(o="w");const u=s===void 0?"":`(${s})`;return this.url.searchParams.append(t,`${o}fts${u}.${e}`),this}match(t){return Object.entries(t).forEach(([e,s])=>{this.url.searchParams.append(e,`eq.${s}`)}),this}not(t,e,s){return this.url.searchParams.append(t,`not.${e}.${s}`),this}or(t,{foreignTable:e,referencedTable:s=e}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,e,s){return this.url.searchParams.append(t,`${e}.${s}`),this}},j2=class{constructor(t,{headers:e={},schema:s,fetch:r}){this.url=t,this.headers=new Headers(e),this.schema=s,this.fetch=r}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:s=!1,count:r}=e??{},o=s?"HEAD":"GET";let u=!1;const d=(t??"*").split("").map(m=>/\s/.test(m)&&!u?"":(m==='"'&&(u=!u),m)).join(""),{url:f,headers:p}=this.cloneRequestState();return f.searchParams.set("select",d),r&&p.append("Prefer",`count=${r}`),new ai({method:o,url:f,headers:p,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:s=!0}={}){var r;const o="POST",{url:u,headers:d}=this.cloneRequestState();if(e&&d.append("Prefer",`count=${e}`),s||d.append("Prefer","missing=default"),Array.isArray(t)){const f=t.reduce((p,m)=>p.concat(Object.keys(m)),[]);if(f.length>0){const p=[...new Set(f)].map(m=>`"${m}"`);u.searchParams.set("columns",p.join(","))}}return new ai({method:o,url:u,headers:d,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:s=!1,count:r,defaultToNull:o=!0}={}){var u;const d="POST",{url:f,headers:p}=this.cloneRequestState();if(p.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),e!==void 0&&f.searchParams.set("on_conflict",e),r&&p.append("Prefer",`count=${r}`),o||p.append("Prefer","missing=default"),Array.isArray(t)){const m=t.reduce((y,v)=>y.concat(Object.keys(v)),[]);if(m.length>0){const y=[...new Set(m)].map(v=>`"${v}"`);f.searchParams.set("columns",y.join(","))}}return new ai({method:d,url:f,headers:p,schema:this.schema,body:t,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}update(t,{count:e}={}){var s;const r="PATCH",{url:o,headers:u}=this.cloneRequestState();return e&&u.append("Prefer",`count=${e}`),new ai({method:r,url:o,headers:u,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}delete({count:t}={}){var e;const s="DELETE",{url:r,headers:o}=this.cloneRequestState();return t&&o.append("Prefer",`count=${t}`),new ai({method:s,url:r,headers:o,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},E2=class iw{constructor(e,{headers:s={},schema:r,fetch:o}={}){this.url=e,this.headers=new Headers(s),this.schemaName=r,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new j2(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new iw(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,s={},{head:r=!1,get:o=!1,count:u}={}){var d;let f;const p=new URL(`${this.url}/rpc/${e}`);let m;const y=S=>S!==null&&typeof S=="object"&&(!Array.isArray(S)||S.some(y)),v=r&&Object.values(s).some(y);v?(f="POST",m=s):r||o?(f=r?"HEAD":"GET",Object.entries(s).filter(([S,_])=>_!==void 0).map(([S,_])=>[S,Array.isArray(_)?`{${_.join(",")}}`:`${_}`]).forEach(([S,_])=>{p.searchParams.append(S,_)})):(f="POST",m=s);const b=new Headers(this.headers);return v?b.set("Prefer",u?`count=${u},return=minimal`:"return=minimal"):u&&b.set("Prefer",`count=${u}`),new ai({method:f,url:p,headers:b,schema:this.schemaName,body:m,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}};class T2{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 s=globalThis.process;if(s){const r=s.versions;if(r&&r.node){const o=r.node,u=parseInt(o.replace(/^v/,"").split(".")[0]);return u>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${u} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${u} 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 s=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(s+=`
15
+
16
+ Suggested solution: ${e.workaround}`),new Error(s)}static createWebSocket(e,s){const r=this.getWebSocketConstructor();return new r(e,s)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const N2="2.90.1",A2=`realtime-js/${N2}`,ow="1.0.0",k2="2.0.0",O0=ow,Pf=1e4,C2=1e3,R2=100;var Ys;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(Ys||(Ys={}));var bt;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(bt||(bt={}));var Dn;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Dn||(Dn={}));var Vf;(function(t){t.websocket="websocket"})(Vf||(Vf={}));var Pa;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Pa||(Pa={}));class O2{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,s){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return s(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var s;return this._isArrayBuffer((s=e.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var s,r;const o=(r=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(e){var s,r;const o=(r=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&r!==void 0?r:{},d=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,d)}_encodeUserBroadcastPush(e,s,r){var o,u;const d=e.topic,f=(o=e.ref)!==null&&o!==void 0?o:"",p=(u=e.join_ref)!==null&&u!==void 0?u:"",m=e.payload.event,y=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},v=Object.keys(y).length===0?"":JSON.stringify(y);if(p.length>255)throw new Error(`joinRef length ${p.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`ref length ${f.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`topic length ${d.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`userEvent length ${m.length} exceeds maximum of 255`);if(v.length>255)throw new Error(`metadata length ${v.length} exceeds maximum of 255`);const b=this.USER_BROADCAST_PUSH_META_LENGTH+p.length+f.length+d.length+m.length+v.length,S=new ArrayBuffer(this.HEADER_LENGTH+b);let _=new DataView(S),E=0;_.setUint8(E++,this.KINDS.userBroadcastPush),_.setUint8(E++,p.length),_.setUint8(E++,f.length),_.setUint8(E++,d.length),_.setUint8(E++,m.length),_.setUint8(E++,v.length),_.setUint8(E++,s),Array.from(p,A=>_.setUint8(E++,A.charCodeAt(0))),Array.from(f,A=>_.setUint8(E++,A.charCodeAt(0))),Array.from(d,A=>_.setUint8(E++,A.charCodeAt(0))),Array.from(m,A=>_.setUint8(E++,A.charCodeAt(0))),Array.from(v,A=>_.setUint8(E++,A.charCodeAt(0)));var T=new Uint8Array(S.byteLength+r.byteLength);return T.set(new Uint8Array(S),0),T.set(new Uint8Array(r),S.byteLength),T.buffer}decode(e,s){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return s(r)}if(typeof e=="string"){const r=JSON.parse(e),[o,u,d,f,p]=r;return s({join_ref:o,ref:u,topic:d,event:f,payload:p})}return s({})}_binaryDecode(e){const s=new DataView(e),r=s.getUint8(0),o=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,s,o)}_decodeUserBroadcast(e,s,r){const o=s.getUint8(1),u=s.getUint8(2),d=s.getUint8(3),f=s.getUint8(4);let p=this.HEADER_LENGTH+4;const m=r.decode(e.slice(p,p+o));p=p+o;const y=r.decode(e.slice(p,p+u));p=p+u;const v=r.decode(e.slice(p,p+d));p=p+d;const b=e.slice(p,e.byteLength),S=f===this.JSON_ENCODING?JSON.parse(r.decode(b)):b,_={type:this.BROADCAST_EVENT,event:y,payload:S};return d>0&&(_.meta=JSON.parse(v)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:_}}_isArrayBuffer(e){var s;return e instanceof ArrayBuffer||((s=e?.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(e,s){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>s.includes(r)))}}class lw{constructor(e,s){this.callback=e,this.timerCalc=s,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=s}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 Ye;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Ye||(Ye={}));const D0=(t,e,s={})=>{var r;const o=(r=s.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((u,d)=>(u[d]=D2(d,t,e,o),u),{}):{}},D2=(t,e,s,r)=>{const o=e.find(f=>f.name===t),u=o?.type,d=s[t];return u&&!r.includes(u)?cw(u,d):Bf(d)},cw=(t,e)=>{if(t.charAt(0)==="_"){const s=t.slice(1,t.length);return U2(e,s)}switch(t){case Ye.bool:return M2(e);case Ye.float4:case Ye.float8:case Ye.int2:case Ye.int4:case Ye.int8:case Ye.numeric:case Ye.oid:return z2(e);case Ye.json:case Ye.jsonb:return L2(e);case Ye.timestamp:return P2(e);case Ye.abstime:case Ye.date:case Ye.daterange:case Ye.int4range:case Ye.int8range:case Ye.money:case Ye.reltime:case Ye.text:case Ye.time:case Ye.timestamptz:case Ye.timetz:case Ye.tsrange:case Ye.tstzrange:return Bf(e);default:return Bf(e)}},Bf=t=>t,M2=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},z2=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},L2=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},U2=(t,e)=>{if(typeof t!="string")return t;const s=t.length-1,r=t[s];if(t[0]==="{"&&r==="}"){let u;const d=t.slice(1,s);try{u=JSON.parse("["+d+"]")}catch{u=d?d.split(","):[]}return u.map(f=>cw(e,f))}return t},P2=t=>typeof t=="string"?t.replace(" ","T"):t,uw=t=>{const e=new URL(t);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 ef{constructor(e,s,r={},o=Pf){this.channel=e,this.event=s,this.payload=r,this.timeout=o,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,s){var r;return this._hasReceived(e)&&s((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:s}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=s=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=s,this._matchReceive(s)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,s){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:s})}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:s}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(s))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var M0;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(M0||(M0={}));class Oo{constructor(e,s){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=s?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},o=>{const{onJoin:u,onLeave:d,onSync:f}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Oo.syncState(this.state,o,u,d),this.pendingDiffs.forEach(p=>{this.state=Oo.syncDiff(this.state,p,u,d)}),this.pendingDiffs=[],f()}),this.channel._on(r.diff,{},o=>{const{onJoin:u,onLeave:d,onSync:f}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=Oo.syncDiff(this.state,o,u,d),f())}),this.onJoin((o,u,d)=>{this.channel._trigger("presence",{event:"join",key:o,currentPresences:u,newPresences:d})}),this.onLeave((o,u,d)=>{this.channel._trigger("presence",{event:"leave",key:o,currentPresences:u,leftPresences:d})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,s,r,o){const u=this.cloneDeep(e),d=this.transformState(s),f={},p={};return this.map(u,(m,y)=>{d[m]||(p[m]=y)}),this.map(d,(m,y)=>{const v=u[m];if(v){const b=y.map(T=>T.presence_ref),S=v.map(T=>T.presence_ref),_=y.filter(T=>S.indexOf(T.presence_ref)<0),E=v.filter(T=>b.indexOf(T.presence_ref)<0);_.length>0&&(f[m]=_),E.length>0&&(p[m]=E)}else f[m]=y}),this.syncDiff(u,{joins:f,leaves:p},r,o)}static syncDiff(e,s,r,o){const{joins:u,leaves:d}={joins:this.transformState(s.joins),leaves:this.transformState(s.leaves)};return r||(r=()=>{}),o||(o=()=>{}),this.map(u,(f,p)=>{var m;const y=(m=e[f])!==null&&m!==void 0?m:[];if(e[f]=this.cloneDeep(p),y.length>0){const v=e[f].map(S=>S.presence_ref),b=y.filter(S=>v.indexOf(S.presence_ref)<0);e[f].unshift(...b)}r(f,y,p)}),this.map(d,(f,p)=>{let m=e[f];if(!m)return;const y=p.map(v=>v.presence_ref);m=m.filter(v=>y.indexOf(v.presence_ref)<0),e[f]=m,o(f,m,p),m.length===0&&delete e[f]}),e}static map(e,s){return Object.getOwnPropertyNames(e).map(r=>s(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((s,r)=>{const o=e[r];return"metas"in o?s[r]=o.metas.map(u=>(u.presence_ref=u.phx_ref,delete u.phx_ref,delete u.phx_ref_prev,u)):s[r]=o,s},{})}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 z0;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(z0||(z0={}));var Do;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Do||(Do={}));var fs;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(fs||(fs={}));class oi{constructor(e,s={config:{}},r){var o,u;if(this.topic=e,this.params=s,this.socket=r,this.bindings={},this.state=bt.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},s.config),this.timeout=this.socket.timeout,this.joinPush=new ef(this,Dn.join,this.params,this.timeout),this.rejoinTimer=new lw(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=bt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(d=>d.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=bt.closed,this.socket._remove(this)}),this._onError(d=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,d),this.state=bt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=bt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",d=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,d),this.state=bt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Dn.reply,{},(d,f)=>{this._trigger(this._replyEventName(f),d)}),this.presence=new Oo(this),this.broadcastEndpointURL=uw(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((u=(o=this.params.config)===null||o===void 0?void 0:o.broadcast)===null||u===void 0)&&u.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,s=this.timeout){var r,o,u;if(this.socket.isConnected()||this.socket.connect(),this.state==bt.closed){const{config:{broadcast:d,presence:f,private:p}}=this.params,m=(o=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(S=>S.filter))!==null&&o!==void 0?o:[],y=!!this.bindings[Do.PRESENCE]&&this.bindings[Do.PRESENCE].length>0||((u=this.params.config.presence)===null||u===void 0?void 0:u.enabled)===!0,v={},b={broadcast:d,presence:Object.assign(Object.assign({},f),{enabled:y}),postgres_changes:m,private:p};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(S=>e?.(fs.CHANNEL_ERROR,S)),this._onClose(()=>e?.(fs.CLOSED)),this.updateJoinPayload(Object.assign({config:b},v)),this.joinedOnce=!0,this._rejoin(s),this.joinPush.receive("ok",async({postgres_changes:S})=>{var _;if(this.socket._isManualToken()||this.socket.setAuth(),S===void 0){e?.(fs.SUBSCRIBED);return}else{const E=this.bindings.postgres_changes,T=(_=E?.length)!==null&&_!==void 0?_:0,A=[];for(let D=0;D<T;D++){const N=E[D],{filter:{event:L,schema:G,table:F,filter:U}}=N,M=S&&S[D];if(M&&M.event===L&&oi.isFilterValueEqual(M.schema,G)&&oi.isFilterValueEqual(M.table,F)&&oi.isFilterValueEqual(M.filter,U))A.push(Object.assign(Object.assign({},N),{id:M.id}));else{this.unsubscribe(),this.state=bt.errored,e?.(fs.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=A,e&&e(fs.SUBSCRIBED);return}}).receive("error",S=>{this.state=bt.errored,e?.(fs.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{e?.(fs.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,s={}){return await this.send({type:"presence",event:"track",payload:e},s.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,s,r){return this.state===bt.joined&&e===Do.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,s,r)}async httpSend(e,s,r={}){var o;if(s==null)return Promise.reject("Payload is required for httpSend()");const u={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(u.Authorization=`Bearer ${this.socket.accessTokenValue}`);const d={method:"POST",headers:u,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:s,private:this.private}]})},f=await this._fetchWithTimeout(this.broadcastEndpointURL,d,(o=r.timeout)!==null&&o!==void 0?o:this.timeout);if(f.status===202)return{success:!0};let p=f.statusText;try{const m=await f.json();p=m.error||m.message||p}catch{}return Promise.reject(new Error(p))}async send(e,s={}){var r,o;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:u,payload:d}=e,f={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(f.Authorization=`Bearer ${this.socket.accessTokenValue}`);const p={method:"POST",headers:f,body:JSON.stringify({messages:[{topic:this.subTopic,event:u,payload:d,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,p,(r=s.timeout)!==null&&r!==void 0?r:this.timeout);return await((o=m.body)===null||o===void 0?void 0:o.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(u=>{var d,f,p;const m=this._push(e.type,e,s.timeout||this.timeout);e.type==="broadcast"&&!(!((p=(f=(d=this.params)===null||d===void 0?void 0:d.config)===null||f===void 0?void 0:f.broadcast)===null||p===void 0)&&p.ack)&&u("ok"),m.receive("ok",()=>u("ok")),m.receive("error",()=>u("error")),m.receive("timeout",()=>u("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=bt.leaving;const s=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Dn.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(o=>{r=new ef(this,Dn.leave,{},e),r.receive("ok",()=>{s(),o("ok")}).receive("timeout",()=>{s(),o("timed out")}).receive("error",()=>{o("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=bt.closed,this.bindings={}}async _fetchWithTimeout(e,s,r){const o=new AbortController,u=setTimeout(()=>o.abort(),r),d=await this.socket.fetch(e,Object.assign(Object.assign({},s),{signal:o.signal}));return clearTimeout(u),d}_push(e,s,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let o=new ef(this,e,s,r);return this._canPush()?o.send():this._addToPushBuffer(o),o}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>R2){const s=this.pushBuffer.shift();s&&(s.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${s.event}`,s.payload))}}_onMessage(e,s,r){return s}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,s,r){var o,u;const d=e.toLocaleLowerCase(),{close:f,error:p,leave:m,join:y}=Dn;if(r&&[f,p,m,y].indexOf(d)>=0&&r!==this._joinRef())return;let b=this._onMessage(d,s,r);if(s&&!b)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(d)?(o=this.bindings.postgres_changes)===null||o===void 0||o.filter(S=>{var _,E,T;return((_=S.filter)===null||_===void 0?void 0:_.event)==="*"||((T=(E=S.filter)===null||E===void 0?void 0:E.event)===null||T===void 0?void 0:T.toLocaleLowerCase())===d}).map(S=>S.callback(b,r)):(u=this.bindings[d])===null||u===void 0||u.filter(S=>{var _,E,T,A,D,N,L,G;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in S){const F=S.id,U=(_=S.filter)===null||_===void 0?void 0:_.event;return F&&((E=s.ids)===null||E===void 0?void 0:E.includes(F))&&(U==="*"||U?.toLocaleLowerCase()===((T=s.data)===null||T===void 0?void 0:T.type.toLocaleLowerCase()))&&(!(!((A=S.filter)===null||A===void 0)&&A.table)||S.filter.table===((D=s.data)===null||D===void 0?void 0:D.table))}else{const F=(L=(N=S?.filter)===null||N===void 0?void 0:N.event)===null||L===void 0?void 0:L.toLocaleLowerCase();return F==="*"||F===((G=s?.event)===null||G===void 0?void 0:G.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===d}).map(S=>{if(typeof b=="object"&&"ids"in b){const _=b.data,{schema:E,table:T,commit_timestamp:A,type:D,errors:N}=_;b=Object.assign(Object.assign({},{schema:E,table:T,commit_timestamp:A,eventType:D,new:{},old:{},errors:N}),this._getPayloadRecords(_))}S.callback(b,r)})}_isClosed(){return this.state===bt.closed}_isJoined(){return this.state===bt.joined}_isJoining(){return this.state===bt.joining}_isLeaving(){return this.state===bt.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,s,r){const o=e.toLocaleLowerCase(),u={type:o,filter:s,callback:r};return this.bindings[o]?this.bindings[o].push(u):this.bindings[o]=[u],this}_off(e,s){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(o=>{var u;return!(((u=o.type)===null||u===void 0?void 0:u.toLocaleLowerCase())===r&&oi.isEqual(o.filter,s))})),this}static isEqual(e,s){if(Object.keys(e).length!==Object.keys(s).length)return!1;for(const r in e)if(e[r]!==s[r])return!1;return!0}static isFilterValueEqual(e,s){return(e??void 0)===(s??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Dn.close,{},e)}_onError(e){this._on(Dn.error,{},s=>e(s))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=bt.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const s={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(s.new=D0(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(s.old=D0(e.columns,e.old_record)),s}}const tf=()=>{},Mc={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},V2=[1e3,2e3,5e3,1e4],B2=1e4,I2=`
17
+ addEventListener("message", (e) => {
18
+ if (e.data.event === "start") {
19
+ setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
20
+ }
21
+ });`;class q2{constructor(e,s){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Pf,this.transport=null,this.heartbeatIntervalMs=Mc.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=tf,this.ref=0,this.reconnectTimer=null,this.vsn=O0,this.logger=tf,this.conn=null,this.sendBuffer=[],this.serializer=new O2,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=o=>o?(...u)=>o(...u):(...u)=>fetch(...u),!(!((r=s?.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey,this.endPoint=`${e}/${Vf.websocket}`,this.httpEndpoint=uw(e),this._initializeOptions(s),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(s?.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=T2.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const s=e.message;throw s.includes("Node.js")?new Error(`${s}
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: ${s}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,s){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,s??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const s=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),s}async removeAllChannels(){const e=await Promise.all(this.channels.map(s=>s.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,s,r){this.logger(e,s,r)}connectionState(){switch(this.conn&&this.conn.readyState){case Ys.connecting:return Pa.Connecting;case Ys.open:return Pa.Open;case Ys.closing:return Pa.Closing;default:return Pa.Closed}}isConnected(){return this.connectionState()===Pa.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,s={config:{}}){const r=`realtime:${e}`,o=this.getChannels().find(u=>u.topic===r);if(o)return o;{const u=new oi(`realtime:${e}`,s,this);return this.channels.push(u),u}}push(e){const{topic:s,event:r,payload:o,ref:u}=e,d=()=>{this.encode(e,f=>{var p;(p=this.conn)===null||p===void 0||p.send(f)})};this.log("push",`${s} ${r} (${u})`,o),this.isConnected()?d():this.sendBuffer.push(d)}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(s){this.log("error","error in heartbeat callback",s)}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(s){this.log("error","error in heartbeat callback",s)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(C2,"heartbeat timeout"),setTimeout(()=>{var s;this.isConnected()||(s=this.reconnectTimer)===null||s===void 0||s.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(s){this.log("error","error in heartbeat callback",s)}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 s=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));s&&(this.log("transport",`leaving duplicate topic "${e}"`),s.unsubscribe())}_remove(e){this.channels=this.channels.filter(s=>s.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,s=>{if(s.topic==="phoenix"&&s.event==="phx_reply"&&s.ref&&s.ref===this.pendingHeartbeatRef){const m=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(s.payload.status==="ok"?"ok":"error",m)}catch(y){this.log("error","error in heartbeat callback",y)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:o,payload:u,ref:d}=s,f=d?`(${d})`:"",p=u.status||"";this.log("receive",`${p} ${r} ${o} ${f}`.trim(),u),this.channels.filter(m=>m._isMember(r)).forEach(m=>m._trigger(o,u,d)),this._triggerStateCallbacks("message",s)})}_clearTimer(e){var s;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((s=this.reconnectTimer)===null||s===void 0||s.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(s=>{this.log("error","error waiting for auth on connect",s),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=s=>{this.log("worker","worker error",s.message),this._terminateWorker()},this.workerRef.onmessage=s=>{s.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 s;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(s=this.reconnectTimer)===null||s===void 0||s.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(Dn.error))}_appendParams(e,s){if(Object.keys(s).length===0)return e;const r=e.match(/\?/)?"&":"?",o=new URLSearchParams(s);return`${e}${r}${o}`}_workerObjectUrl(e){let s;if(e)s=e;else{const r=new Blob([I2],{type:"application/javascript"});s=URL.createObjectURL(r)}return s}_setConnectionState(e,s=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=s)}async _performAuth(e=null){let s,r=!1;if(e)s=e,r=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),s=this.accessTokenValue}else s=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(o=>{const u={access_token:s,version:A2};s&&o.updateJoinPayload(u),o.joinedOnce&&o._isJoined()&&o._push(Dn.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${e}`,s)})}_triggerStateCallbacks(e,s){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(s)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new lw(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Mc.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var s,r,o,u,d,f,p,m,y,v,b,S;switch(this.transport=(s=e?.transport)!==null&&s!==void 0?s:null,this.timeout=(r=e?.timeout)!==null&&r!==void 0?r:Pf,this.heartbeatIntervalMs=(o=e?.heartbeatIntervalMs)!==null&&o!==void 0?o:Mc.HEARTBEAT_INTERVAL,this.worker=(u=e?.worker)!==null&&u!==void 0?u:!1,this.accessToken=(d=e?.accessToken)!==null&&d!==void 0?d:null,this.heartbeatCallback=(f=e?.heartbeatCallback)!==null&&f!==void 0?f:tf,this.vsn=(p=e?.vsn)!==null&&p!==void 0?p:O0,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=(m=e?.reconnectAfterMs)!==null&&m!==void 0?m:(_=>V2[_-1]||B2),this.vsn){case ow:this.encode=(y=e?.encode)!==null&&y!==void 0?y:((_,E)=>E(JSON.stringify(_))),this.decode=(v=e?.decode)!==null&&v!==void 0?v:((_,E)=>E(JSON.parse(_)));break;case k2:this.encode=(b=e?.encode)!==null&&b!==void 0?b:this.serializer.encode.bind(this.serializer),this.decode=(S=e?.decode)!==null&&S!==void 0?S:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}}var $o=class extends Error{constructor(t,e){super(t),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 $2(t,e,s){const r=new URL(e,t);if(s)for(const[o,u]of Object.entries(s))u!==void 0&&r.searchParams.set(o,u);return r.toString()}async function H2(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function G2(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:s,path:r,query:o,body:u,headers:d}){const f=$2(t.baseUrl,r,o),p=await H2(t.auth),m=await e(f,{method:s,headers:{...u?{"Content-Type":"application/json"}:{},...p,...d},body:u?JSON.stringify(u):void 0}),y=await m.text(),v=(m.headers.get("content-type")||"").includes("application/json"),b=v&&y?JSON.parse(y):y;if(!m.ok){const S=v?b:void 0,_=S?.error;throw new $o(_?.message??`Request failed with status ${m.status}`,{status:m.status,icebergType:_?.type,icebergCode:_?.code,details:S})}return{status:m.status,headers:m.headers,data:b}}}}function zc(t){return t.join("")}var F2=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:zc(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const s={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${zc(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${zc(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${zc(t.namespace)}`}),!0}catch(e){if(e instanceof $o&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(s){if(s instanceof $o&&s.status===409)return;throw s}}};function Xr(t){return t.join("")}var K2=class{constructor(t,e="",s){this.client=t,this.prefix=e,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables`,body:e,headers:s})).data.metadata}async updateTable(t,e){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(s){if(s instanceof $o&&s.status===404)return!1;throw s}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(s){if(s instanceof $o&&s.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw s}}},Y2=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=G2({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new F2(this.client,e),this.tableOps=new K2(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},ju=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function et(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var X2=class extends ju{constructor(t,e,s){super(t),this.name="StorageApiError",this.status=e,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},If=class extends ju{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Om=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),W2=()=>Response,qf=t=>{if(Array.isArray(t))return t.map(s=>qf(s));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([s,r])=>{const o=s.replace(/([-_][a-z])/gi,u=>u.toUpperCase().replace(/[-_]/g,""));e[o]=qf(r)}),e},J2=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Q2=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function Ho(t){"@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(t)}function Z2(t,e){if(Ho(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(Ho(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function eA(t){var e=Z2(t,"string");return Ho(e)=="symbol"?e:e+""}function tA(t,e,s){return(e=eA(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function L0(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),s.push.apply(s,r)}return s}function ve(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?L0(Object(s),!0).forEach(function(r){tA(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):L0(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const nf=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},nA=async(t,e,s)=>{t instanceof await W2()&&!s?.noResolveJson?t.json().then(r=>{const o=t.status||500,u=r?.statusCode||o+"";e(new X2(nf(r),o,u))}).catch(r=>{e(new If(nf(r),r))}):e(new If(nf(t),t))},sA=(t,e,s,r)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"||!r?o:(J2(r)?(o.headers=ve({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(r)):o.body=r,e?.duplex&&(o.duplex=e.duplex),ve(ve({},o),s))};async function nl(t,e,s,r,o,u){return new Promise((d,f)=>{t(s,sA(e,r,o,u)).then(p=>{if(!p.ok)throw p;return r?.noResolveJson?p:p.json()}).then(p=>d(p)).catch(p=>nA(p,f,r))})}async function Go(t,e,s,r){return nl(t,"GET",e,s,r)}async function On(t,e,s,r,o){return nl(t,"POST",e,r,o,s)}async function $f(t,e,s,r,o){return nl(t,"PUT",e,r,o,s)}async function aA(t,e,s,r){return nl(t,"HEAD",e,ve(ve({},s),{},{noResolveJson:!0}),r)}async function Dm(t,e,s,r,o){return nl(t,"DELETE",e,r,o,s)}var rA=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(et(e))return{data:null,error:e};throw e}}};let dw;dw=Symbol.toStringTag;var iA=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[dw]="BlobDownloadBuilder",this.promise=null}asStream(){return new rA(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(et(e))return{data:null,error:e};throw e}}};const oA={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},U0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var lA=class{constructor(t,e={},s,r){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=s,this.fetch=Om(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,s,r){var o=this;try{let u;const d=ve(ve({},U0),r);let f=ve(ve({},o.headers),t==="POST"&&{"x-upsert":String(d.upsert)});const p=d.metadata;typeof Blob<"u"&&s instanceof Blob?(u=new FormData,u.append("cacheControl",d.cacheControl),p&&u.append("metadata",o.encodeMetadata(p)),u.append("",s)):typeof FormData<"u"&&s instanceof FormData?(u=s,u.has("cacheControl")||u.append("cacheControl",d.cacheControl),p&&!u.has("metadata")&&u.append("metadata",o.encodeMetadata(p))):(u=s,f["cache-control"]=`max-age=${d.cacheControl}`,f["content-type"]=d.contentType,p&&(f["x-metadata"]=o.toBase64(o.encodeMetadata(p))),(typeof ReadableStream<"u"&&u instanceof ReadableStream||u&&typeof u=="object"&&"pipe"in u&&typeof u.pipe=="function")&&!d.duplex&&(d.duplex="half")),r?.headers&&(f=ve(ve({},f),r.headers));const m=o._removeEmptyFolders(e),y=o._getFinalPath(m),v=await(t=="PUT"?$f:On)(o.fetch,`${o.url}/object/${y}`,u,ve({headers:f},d?.duplex?{duplex:d.duplex}:{}));return{data:{path:m,id:v.Id,fullPath:v.Key},error:null}}catch(u){if(o.shouldThrowOnError)throw u;if(et(u))return{data:null,error:u};throw u}}async upload(t,e,s){return this.uploadOrUpdate("POST",t,e,s)}async uploadToSignedUrl(t,e,s,r){var o=this;const u=o._removeEmptyFolders(t),d=o._getFinalPath(u),f=new URL(o.url+`/object/upload/sign/${d}`);f.searchParams.set("token",e);try{let p;const m=ve({upsert:U0.upsert},r),y=ve(ve({},o.headers),{"x-upsert":String(m.upsert)});return typeof Blob<"u"&&s instanceof Blob?(p=new FormData,p.append("cacheControl",m.cacheControl),p.append("",s)):typeof FormData<"u"&&s instanceof FormData?(p=s,p.append("cacheControl",m.cacheControl)):(p=s,y["cache-control"]=`max-age=${m.cacheControl}`,y["content-type"]=m.contentType),{data:{path:u,fullPath:(await $f(o.fetch,f.toString(),p,{headers:y})).Key},error:null}}catch(p){if(o.shouldThrowOnError)throw p;if(et(p))return{data:null,error:p};throw p}}async createSignedUploadUrl(t,e){var s=this;try{let r=s._getFinalPath(t);const o=ve({},s.headers);e?.upsert&&(o["x-upsert"]="true");const u=await On(s.fetch,`${s.url}/object/upload/sign/${r}`,{},{headers:o}),d=new URL(s.url+u.url),f=d.searchParams.get("token");if(!f)throw new ju("No token returned by API");return{data:{signedUrl:d.toString(),path:t,token:f},error:null}}catch(r){if(s.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}}async update(t,e,s){return this.uploadOrUpdate("PUT",t,e,s)}async move(t,e,s){var r=this;try{return{data:await On(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s?.destinationBucket},{headers:r.headers}),error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(et(o))return{data:null,error:o};throw o}}async copy(t,e,s){var r=this;try{return{data:{path:(await On(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s?.destinationBucket},{headers:r.headers})).Key},error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(et(o))return{data:null,error:o};throw o}}async createSignedUrl(t,e,s){var r=this;try{let o=r._getFinalPath(t),u=await On(r.fetch,`${r.url}/object/sign/${o}`,ve({expiresIn:e},s?.transform?{transform:s.transform}:{}),{headers:r.headers});const d=s?.download?`&download=${s.download===!0?"":s.download}`:"";return u={signedUrl:encodeURI(`${r.url}${u.signedURL}${d}`)},{data:u,error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(et(o))return{data:null,error:o};throw o}}async createSignedUrls(t,e,s){var r=this;try{const o=await On(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),u=s?.download?`&download=${s.download===!0?"":s.download}`:"";return{data:o.map(d=>ve(ve({},d),{},{signedUrl:d.signedURL?encodeURI(`${r.url}${d.signedURL}${u}`):null})),error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(et(o))return{data:null,error:o};throw o}}download(t,e){const s=typeof e?.transform<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString(e?.transform||{}),o=r?`?${r}`:"",u=this._getFinalPath(t),d=()=>Go(this.fetch,`${this.url}/${s}/${u}${o}`,{headers:this.headers,noResolveJson:!0});return new iA(d,this.shouldThrowOnError)}async info(t){var e=this;const s=e._getFinalPath(t);try{return{data:qf(await Go(e.fetch,`${e.url}/object/info/${s}`,{headers:e.headers})),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}}async exists(t){var e=this;const s=e._getFinalPath(t);try{return await aA(e.fetch,`${e.url}/object/${s}`,{headers:e.headers}),{data:!0,error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(et(r)&&r instanceof If){const o=r.originalError;if([400,404].includes(o?.status))return{data:!1,error:r}}throw r}}getPublicUrl(t,e){const s=this._getFinalPath(t),r=[],o=e?.download?`download=${e.download===!0?"":e.download}`:"";o!==""&&r.push(o);const u=typeof e?.transform<"u"?"render/image":"object",d=this.transformOptsToQueryString(e?.transform||{});d!==""&&r.push(d);let f=r.join("&");return f!==""&&(f=`?${f}`),{data:{publicUrl:encodeURI(`${this.url}/${u}/public/${s}${f}`)}}}async remove(t){var e=this;try{return{data:await Dm(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}}async list(t,e,s){var r=this;try{const o=ve(ve(ve({},oA),e),{},{prefix:t||""});return{data:await On(r.fetch,`${r.url}/object/list/${r.bucketId}`,o,{headers:r.headers},s),error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(et(o))return{data:null,error:o};throw o}}async listV2(t,e){var s=this;try{const r=ve({},t);return{data:await On(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,r,{headers:s.headers},e),error:null}}catch(r){if(s.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const hw="2.90.1",fw={"X-Client-Info":`storage-js/${hw}`};var cA=class{constructor(t,e={},s,r){this.shouldThrowOnError=!1;const o=new URL(t);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=ve(ve({},fw),e),this.fetch=Om(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const s=e.listBucketOptionsToQueryString(t);return{data:await Go(e.fetch,`${e.url}/bucket${s}`,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}}async getBucket(t){var e=this;try{return{data:await Go(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}}async createBucket(t,e={public:!1}){var s=this;try{return{data:await On(s.fetch,`${s.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}),error:null}}catch(r){if(s.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}}async updateBucket(t,e){var s=this;try{return{data:await $f(s.fetch,`${s.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}),error:null}}catch(r){if(s.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}}async emptyBucket(t){var e=this;try{return{data:await On(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await Dm(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},uA=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=ve(ve({},fw),e),this.fetch=Om(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await On(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}}async listBuckets(t){var e=this;try{const s=new URLSearchParams;t?.limit!==void 0&&s.set("limit",t.limit.toString()),t?.offset!==void 0&&s.set("offset",t.offset.toString()),t?.sortColumn&&s.set("sortColumn",t.sortColumn),t?.sortOrder&&s.set("sortOrder",t.sortOrder),t?.search&&s.set("search",t.search);const r=s.toString(),o=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return{data:await Go(e.fetch,o,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await Dm(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}}from(t){var e=this;if(!Q2(t))throw new ju("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 s=new Y2({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(s,{get(o,u){const d=o[u];return typeof d!="function"?d:async(...f)=>{try{return{data:await d.apply(o,f),error:null}}catch(p){if(r)throw p;return{data:null,error:p}}}}})}};const Mm={"X-Client-Info":`storage-js/${hw}`,"Content-Type":"application/json"};var mw=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function on(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var sf=class extends mw{constructor(t,e,s){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},dA=class extends mw{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const zm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),hA=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},P0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),fA=async(t,e,s)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!s?.noResolveJson){const r=t.status||500,o=t;if(typeof o.json=="function")o.json().then(u=>{const d=u?.statusCode||u?.code||r+"";e(new sf(P0(u),r,d))}).catch(()=>{const u=r+"";e(new sf(o.statusText||`HTTP ${r} error`,r,u))});else{const u=r+"";e(new sf(o.statusText||`HTTP ${r} error`,r,u))}}else e(new dA(P0(t),t))},mA=(t,e,s,r)=>{const o={method:t,headers:e?.headers||{}};return r?(hA(r)?(o.headers=ve({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(r)):o.body=r,ve(ve({},o),s)):o};async function pA(t,e,s,r,o,u){return new Promise((d,f)=>{t(s,mA(e,r,o,u)).then(p=>{if(!p.ok)throw p;if(r?.noResolveJson)return p;const m=p.headers.get("content-type");return!m||!m.includes("application/json")?{}:p.json()}).then(p=>d(p)).catch(p=>fA(p,f,r))})}async function ln(t,e,s,r,o){return pA(t,"POST",e,r,o,s)}var gA=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=ve(ve({},Mm),e),this.fetch=zm(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await ln(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async getIndex(t,e){var s=this;try{return{data:await ln(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers}),error:null}}catch(r){if(s.shouldThrowOnError)throw r;if(on(r))return{data:null,error:r};throw r}}async listIndexes(t){var e=this;try{return{data:await ln(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async deleteIndex(t,e){var s=this;try{return{data:await ln(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers})||{},error:null}}catch(r){if(s.shouldThrowOnError)throw r;if(on(r))return{data:null,error:r};throw r}}},yA=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=ve(ve({},Mm),e),this.fetch=zm(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await ln(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async getVectors(t){var e=this;try{return{data:await ln(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await ln(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async queryVectors(t){var e=this;try{return{data:await ln(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await ln(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}},vA=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=ve(ve({},Mm),e),this.fetch=zm(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await ln(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async getBucket(t){var e=this;try{return{data:await ln(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async listBuckets(t={}){var e=this;try{return{data:await ln(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await ln(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(on(s))return{data:null,error:s};throw s}}},xA=class extends vA{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new bA(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,s=this;return e().call(s,t)}async getBucket(t){var e=()=>super.getBucket,s=this;return e().call(s,t)}async listBuckets(t={}){var e=()=>super.listBuckets,s=this;return e().call(s,t)}async deleteBucket(t){var e=()=>super.deleteBucket,s=this;return e().call(s,t)}},bA=class extends gA{constructor(t,e,s,r){super(t,e,r),this.vectorBucketName=s}async createIndex(t){var e=()=>super.createIndex,s=this;return e().call(s,ve(ve({},t),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,s=this;return e().call(s,ve(ve({},t),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,s=this;return e().call(s,s.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,s=this;return e().call(s,s.vectorBucketName,t)}index(t){return new wA(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},wA=class extends yA{constructor(t,e,s,r,o){super(t,e,o),this.vectorBucketName=s,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,s=this;return e().call(s,ve(ve({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(t){var e=()=>super.getVectors,s=this;return e().call(s,ve(ve({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,s=this;return e().call(s,ve(ve({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,s=this;return e().call(s,ve(ve({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,s=this;return e().call(s,ve(ve({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},SA=class extends cA{constructor(t,e={},s,r){super(t,e,s,r)}from(t){return new lA(this.url,this.headers,t,this.fetch)}get vectors(){return new xA(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new uA(this.url+"/iceberg",this.headers,this.fetch)}};const pw="2.90.1",ri=30*1e3,Hf=3,af=Hf*ri,_A="http://localhost:9999",jA="supabase.auth.token",EA={"X-Client-Info":`gotrue-js/${pw}`},Gf="X-Supabase-Api-Version",gw={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},TA=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,NA=600*1e3;class Fo extends Error{constructor(e,s,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=r}}function fe(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class AA extends Fo{constructor(e,s,r){super(e,s,r),this.name="AuthApiError",this.status=s,this.code=r}}function kA(t){return fe(t)&&t.name==="AuthApiError"}class Va extends Fo{constructor(e,s){super(e),this.name="AuthUnknownError",this.originalError=s}}class vs extends Fo{constructor(e,s,r,o){super(e,r,o),this.name=s,this.status=r}}class rn extends vs{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function CA(t){return fe(t)&&t.name==="AuthSessionMissingError"}class Wr 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,s=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function RA(t){return fe(t)&&t.name==="AuthImplicitGrantRedirectError"}class V0 extends vs{constructor(e,s=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class OA 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 Ff extends vs{constructor(e,s){super(e,"AuthRetryableFetchError",s,void 0)}}function rf(t){return fe(t)&&t.name==="AuthRetryableFetchError"}class B0 extends vs{constructor(e,s,r){super(e,"AuthWeakPasswordError",s,"weak_password"),this.reasons=r}}class Kf extends vs{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),I0=`
35
+ \r=`.split(""),DA=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<I0.length;e+=1)t[I0[e].charCodeAt(0)]=-2;for(let e=0;e<cu.length;e+=1)t[cu[e].charCodeAt(0)]=e;return t})();function q0(t,e,s){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;s(cu[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;s(cu[r]),e.queuedBits-=6}}function yw(t,e,s){const r=DA[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)s(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function $0(t){const e=[],s=d=>{e.push(String.fromCodePoint(d))},r={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},u=d=>{LA(d,r,s)};for(let d=0;d<t.length;d+=1)yw(t.charCodeAt(d),o,u);return e.join("")}function MA(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function zA(t,e){for(let s=0;s<t.length;s+=1){let r=t.charCodeAt(s);if(r>55295&&r<=56319){const o=(r-55296)*1024&65535;r=(t.charCodeAt(s+1)-56320&65535|o)+65536,s+=1}MA(r,e)}}function LA(t,e,s){if(e.utf8seq===0){if(t<=127){s(t);return}for(let r=1;r<6;r+=1)if((t>>7-r&1)===0){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&s(e.codepoint)}}function fi(t){const e=[],s={queue:0,queuedBits:0},r=o=>{e.push(o)};for(let o=0;o<t.length;o+=1)yw(t.charCodeAt(o),s,r);return new Uint8Array(e)}function UA(t){const e=[];return zA(t,s=>e.push(s)),new Uint8Array(e)}function qa(t){const e=[],s={queue:0,queuedBits:0},r=o=>{e.push(o)};return t.forEach(o=>q0(o,s,r)),q0(null,s,r),e.join("")}function PA(t){return Math.round(Date.now()/1e3)+t}function VA(){return Symbol("auth-callback")}const Ot=()=>typeof window<"u"&&typeof document<"u",Oa={tested:!1,writable:!1},vw=()=>{if(!Ot())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Oa.tested)return Oa.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Oa.tested=!0,Oa.writable=!0}catch{Oa.tested=!0,Oa.writable=!1}return Oa.writable};function BA(t){const e={},s=new URL(t);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((o,u)=>{e[u]=o})}catch{}return s.searchParams.forEach((r,o)=>{e[o]=r}),e}const xw=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),IA=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",ii=async(t,e,s)=>{await t.setItem(e,JSON.stringify(s))},Da=async(t,e)=>{const s=await t.getItem(e);if(!s)return null;try{return JSON.parse(s)}catch{return s}},Rt=async(t,e)=>{await t.removeItem(e)};class Eu{constructor(){this.promise=new Eu.promiseConstructor((e,s)=>{this.resolve=e,this.reject=s})}}Eu.promiseConstructor=Promise;function of(t){const e=t.split(".");if(e.length!==3)throw new Kf("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!TA.test(e[r]))throw new Kf("JWT not in base64url format");return{header:JSON.parse($0(e[0])),payload:JSON.parse($0(e[1])),signature:fi(e[2]),raw:{header:e[0],payload:e[1]}}}async function qA(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function $A(t,e){return new Promise((r,o)=>{(async()=>{for(let u=0;u<1/0;u++)try{const d=await t(u);if(!e(u,null,d)){r(d);return}}catch(d){if(!e(u,d)){o(d);return}}})()})}function HA(t){return("0"+t.toString(16)).substr(-2)}function GA(){const e=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=s.length;let o="";for(let u=0;u<56;u++)o+=s.charAt(Math.floor(Math.random()*r));return o}return crypto.getRandomValues(e),Array.from(e,HA).join("")}async function FA(t){const s=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",s),o=new Uint8Array(r);return Array.from(o).map(u=>String.fromCharCode(u)).join("")}async function KA(t){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."),t;const s=await FA(t);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Jr(t,e,s=!1){const r=GA();let o=r;s&&(o+="/PASSWORD_RECOVERY"),await ii(t,`${e}-code-verifier`,o);const u=await KA(r);return[u,r===u?"plain":"s256"]}const YA=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function XA(t){const e=t.headers.get(Gf);if(!e||!e.match(YA))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function WA(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function JA(t){switch(t){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(t){if(!QA.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function lf(){const t={};return new Proxy(t,{get:(e,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const r=s.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="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 "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function ZA(t,e){return new Proxy(t,{get:(s,r,o)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const u=r.toString();if(u==="Symbol(Symbol.toPrimitive)"||u==="Symbol(Symbol.toStringTag)"||u==="Symbol(util.inspect.custom)"||u==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,r,o)}return!e.value&&typeof r=="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(s,r,o)}})}function H0(t){return JSON.parse(JSON.stringify(t))}const za=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),ek=[502,503,504];async function G0(t){var e;if(!IA(t))throw new Ff(za(t),0);if(ek.includes(t.status))throw new Ff(za(t),t.status);let s;try{s=await t.json()}catch(u){throw new Va(za(u),u)}let r;const o=XA(t);if(o&&o.getTime()>=gw["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?r=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(r=s.error_code),r){if(r==="weak_password")throw new B0(za(s),t.status,((e=s.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new rn}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((u,d)=>u&&typeof d=="string",!0))throw new B0(za(s),t.status,s.weak_password.reasons);throw new AA(za(s),t.status||500,r)}const tk=(t,e,s,r)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),o.body=JSON.stringify(r),Object.assign(Object.assign({},o),s))};async function ye(t,e,s,r){var o;const u=Object.assign({},r?.headers);u[Gf]||(u[Gf]=gw["2024-01-01"].name),r?.jwt&&(u.Authorization=`Bearer ${r.jwt}`);const d=(o=r?.query)!==null&&o!==void 0?o:{};r?.redirectTo&&(d.redirect_to=r.redirectTo);const f=Object.keys(d).length?"?"+new URLSearchParams(d).toString():"",p=await nk(t,e,s+f,{headers:u,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(p):{data:Object.assign({},p),error:null}}async function nk(t,e,s,r,o,u){const d=tk(e,r,o,u);let f;try{f=await t(s,Object.assign({},d))}catch(p){throw console.error(p),new Ff(za(p),0)}if(f.ok||await G0(f),r?.noResolveJson)return f;try{return await f.json()}catch(p){await G0(p)}}function Cn(t){var e;let s=null;rk(t)&&(s=Object.assign({},t),t.expires_at||(s.expires_at=PA(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:s,user:r},error:null}}function F0(t){const e=Cn(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((s,r)=>s&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Xs(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function sk(t){return{data:t,error:null}}function ak(t){const{action_link:e,email_otp:s,hashed_token:r,redirect_to:o,verification_type:u}=t,d=Si(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),f={action_link:e,email_otp:s,hashed_token:r,redirect_to:o,verification_type:u},p=Object.assign({},d);return{data:{properties:f,user:p},error:null}}function K0(t){return t}function rk(t){return t.access_token&&t.refresh_token&&t.expires_in}const cf=["global","local","others"];class ik{constructor({url:e="",headers:s={},fetch:r}){this.url=e,this.headers=s,this.fetch=xw(r),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,s=cf[0]){if(cf.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${cf.join(", ")}`);try{return await ye(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(fe(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,s={}){try{return await ye(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:Xs})}catch(r){if(fe(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:s}=e,r=Si(e,["options"]),o=Object.assign(Object.assign({},r),s);return"newEmail"in r&&(o.new_email=r?.newEmail,delete o.newEmail),await ye(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:ak,redirectTo:s?.redirectTo})}catch(s){if(fe(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(e){try{return await ye(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Xs})}catch(s){if(fe(s))return{data:{user:null},error:s};throw s}}async listUsers(e){var s,r,o,u,d,f,p;try{const m={nextPage:null,lastPage:0,total:0},y=await ye(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(s=e?.page)===null||s===void 0?void 0:s.toString())!==null&&r!==void 0?r:"",per_page:(u=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&u!==void 0?u:""},xform:K0});if(y.error)throw y.error;const v=await y.json(),b=(d=y.headers.get("x-total-count"))!==null&&d!==void 0?d:0,S=(p=(f=y.headers.get("link"))===null||f===void 0?void 0:f.split(","))!==null&&p!==void 0?p:[];return S.length>0&&(S.forEach(_=>{const E=parseInt(_.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(_.split(";")[1].split("=")[1]);m[`${T}Page`]=E}),m.total=parseInt(b)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(fe(m))return{data:{users:[]},error:m};throw m}}async getUserById(e){Qr(e);try{return await ye(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Xs})}catch(s){if(fe(s))return{data:{user:null},error:s};throw s}}async updateUserById(e,s){Qr(e);try{return await ye(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:s,headers:this.headers,xform:Xs})}catch(r){if(fe(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,s=!1){Qr(e);try{return await ye(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:s},xform:Xs})}catch(r){if(fe(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Qr(e.userId);try{const{data:s,error:r}=await ye(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:s,error:r}}catch(s){if(fe(s))return{data:null,error:s};throw s}}async _deleteFactor(e){Qr(e.userId),Qr(e.id);try{return{data:await ye(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(s){if(fe(s))return{data:null,error:s};throw s}}async _listOAuthClients(e){var s,r,o,u,d,f,p;try{const m={nextPage:null,lastPage:0,total:0},y=await ye(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(s=e?.page)===null||s===void 0?void 0:s.toString())!==null&&r!==void 0?r:"",per_page:(u=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&u!==void 0?u:""},xform:K0});if(y.error)throw y.error;const v=await y.json(),b=(d=y.headers.get("x-total-count"))!==null&&d!==void 0?d:0,S=(p=(f=y.headers.get("link"))===null||f===void 0?void 0:f.split(","))!==null&&p!==void 0?p:[];return S.length>0&&(S.forEach(_=>{const E=parseInt(_.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(_.split(";")[1].split("=")[1]);m[`${T}Page`]=E}),m.total=parseInt(b)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(fe(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(e){try{return await ye(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(fe(s))return{data:null,error:s};throw s}}async _getOAuthClient(e){try{return await ye(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(fe(s))return{data:null,error:s};throw s}}async _updateOAuthClient(e,s){try{return await ye(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(fe(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await ye(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(fe(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(e){try{return await ye(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(fe(s))return{data:null,error:s};throw s}}}function Y0(t={}){return{getItem:e=>t[e]||null,setItem:(e,s)=>{t[e]=s},removeItem:e=>{delete t[e]}}}const Zr={debug:!!(globalThis&&vw()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class bw extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class ok extends bw{}async function lk(t,e,s){Zr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),Zr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async o=>{if(o){Zr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,o.name);try{return await s()}finally{Zr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,o.name)}}else{if(e===0)throw Zr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new ok(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Zr.debug)try{const u=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(u,null," "))}catch(u){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",u)}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 s()}}))}function ck(){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 ww(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function uk(t){return parseInt(t,16)}function dk(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function hk(t){var e;const{chainId:s,domain:r,expirationTime:o,issuedAt:u=new Date,nonce:d,notBefore:f,requestId:p,resources:m,scheme:y,uri:v,version:b}=t;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(d&&d.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${d}`);if(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(b!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${b}`);if(!((e=t.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: ${t.statement}`)}const S=ww(t.address),_=y?`${y}://${r}`:r,E=t.statement?`${t.statement}
37
+ `:"",T=`${_} wants you to sign in with your Ethereum account:
38
+ ${S}
39
+
40
+ ${E}`;let A=`URI: ${v}
41
+ Version: ${b}
42
+ Chain ID: ${s}${d?`
43
+ Nonce: ${d}`:""}
44
+ Issued At: ${u.toISOString()}`;if(o&&(A+=`
45
+ Expiration Time: ${o.toISOString()}`),f&&(A+=`
46
+ Not Before: ${f.toISOString()}`),p&&(A+=`
47
+ Request ID: ${p}`),m){let D=`
48
+ Resources:`;for(const N of m){if(!N||typeof N!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${N}`);D+=`
49
+ - ${N}`}A+=D}return`${T}
50
+ ${A}`}class mt extends Error{constructor({message:e,code:s,cause:r,name:o}){var u;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(u=o??(r instanceof Error?r.name:void 0))!==null&&u!==void 0?u:"Unknown Error",this.code=s}}class uu extends mt{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function fk({error:t,options:e}){var s,r,o;const{publicKey:u}=e;if(!u)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new mt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((s=u.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new mt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=u.authenticatorSelection)===null||r===void 0?void 0:r.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:t});if(((o=u.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new mt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new mt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new mt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return u.pubKeyCredParams.filter(f=>f.type==="public-key").length===0?new mt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new mt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const d=window.location.hostname;if(Sw(d)){if(u.rp.id!==d)return new mt({message:`The RP ID "${u.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new mt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(u.user.id.byteLength<1||u.user.id.byteLength>64)return new mt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.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:t})}return new mt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function mk({error:t,options:e}){const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new mt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new mt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(Sw(r)){if(s.rpId!==r)return new mt({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new mt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.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:t})}return new mt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class pk{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}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 gk=new pk;function yk(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:s,excludeCredentials:r}=t,o=Si(t,["challenge","user","excludeCredentials"]),u=fi(e).buffer,d=Object.assign(Object.assign({},s),{id:fi(s.id).buffer}),f=Object.assign(Object.assign({},o),{challenge:u,user:d});if(r&&r.length>0){f.excludeCredentials=new Array(r.length);for(let p=0;p<r.length;p++){const m=r[p];f.excludeCredentials[p]=Object.assign(Object.assign({},m),{id:fi(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return f}function vk(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:s}=t,r=Si(t,["challenge","allowCredentials"]),o=fi(e).buffer,u=Object.assign(Object.assign({},r),{challenge:o});if(s&&s.length>0){u.allowCredentials=new Array(s.length);for(let d=0;d<s.length;d++){const f=s[d];u.allowCredentials[d]=Object.assign(Object.assign({},f),{id:fi(f.id).buffer,type:f.type||"public-key",transports:f.transports})}}return u}function xk(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t;return{id:t.id,rawId:t.id,response:{attestationObject:qa(new Uint8Array(t.response.attestationObject)),clientDataJSON:qa(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function bk(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t,r=t.getClientExtensionResults(),o=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:qa(new Uint8Array(o.authenticatorData)),clientDataJSON:qa(new Uint8Array(o.clientDataJSON)),signature:qa(new Uint8Array(o.signature)),userHandle:o.userHandle?qa(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Sw(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function X0(){var t,e;return!!(Ot()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function wk(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new uu("Browser returned unexpected credential type",e)}:{data:null,error:new uu("Empty credential response",e)}}catch(e){return{data:null,error:fk({error:e,options:t})}}}async function Sk(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new uu("Browser returned unexpected credential type",e)}:{data:null,error:new uu("Empty credential response",e)}}catch(e){return{data:null,error:mk({error:e,options:t})}}}const _k={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},jk={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function du(...t){const e=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),s=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),r={};for(const o of t)if(o)for(const u in o){const d=o[u];if(d!==void 0)if(Array.isArray(d))r[u]=d;else if(s(d))r[u]=d;else if(e(d)){const f=r[u];e(f)?r[u]=du(f,d):r[u]=du(d)}else r[u]=d}return r}function Ek(t,e){return du(_k,t,e||{})}function Tk(t,e){return du(jk,t,e||{})}class Nk{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:s,friendlyName:r,signal:o},u){try{const{data:d,error:f}=await this.client.mfa.challenge({factorId:e,webauthn:s});if(!d)return{data:null,error:f};const p=o??gk.createNewAbortSignal();if(d.webauthn.type==="create"){const{user:m}=d.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${r}`),m.displayName||(m.displayName=m.name)}switch(d.webauthn.type){case"create":{const m=Ek(d.webauthn.credential_options.publicKey,u?.create),{data:y,error:v}=await wk({publicKey:m,signal:p});return y?{data:{factorId:e,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}case"request":{const m=Tk(d.webauthn.credential_options.publicKey,u?.request),{data:y,error:v}=await Sk(Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:m,signal:p}));return y?{data:{factorId:e,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}}}catch(d){return fe(d)?{data:null,error:d}:{data:null,error:new Va("Unexpected error in challenge",d)}}}async _verify({challengeId:e,factorId:s,webauthn:r}){return this.client.mfa.verify({factorId:s,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},u){if(!s)return{data:null,error:new Fo("rpId is required for WebAuthn authentication")};try{if(!X0())return{data:null,error:new Va("Browser does not support WebAuthn",null)};const{data:d,error:f}=await this.challenge({factorId:e,webauthn:{rpId:s,rpOrigins:r},signal:o},{request:u});if(!d)return{data:null,error:f};const{webauthn:p}=d;return this._verify({factorId:e,challengeId:d.challengeId,webauthn:{type:p.type,rpId:s,rpOrigins:r,credential_response:p.credential_response}})}catch(d){return fe(d)?{data:null,error:d}:{data:null,error:new Va("Unexpected error in authenticate",d)}}}async _register({friendlyName:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},u){if(!s)return{data:null,error:new Fo("rpId is required for WebAuthn registration")};try{if(!X0())return{data:null,error:new Va("Browser does not support WebAuthn",null)};const{data:d,error:f}=await this._enroll({friendlyName:e});if(!d)return await this.client.mfa.listFactors().then(y=>{var v;return(v=y.data)===null||v===void 0?void 0:v.all.find(b=>b.factor_type==="webauthn"&&b.friendly_name===e&&b.status!=="unverified")}).then(y=>y?this.client.mfa.unenroll({factorId:y?.id}):void 0),{data:null,error:f};const{data:p,error:m}=await this._challenge({factorId:d.id,friendlyName:d.friendly_name,webauthn:{rpId:s,rpOrigins:r},signal:o},{create:u});return p?this._verify({factorId:d.id,challengeId:p.challengeId,webauthn:{rpId:s,rpOrigins:r,type:p.webauthn.type,credential_response:p.webauthn.credential_response}}):{data:null,error:m}}catch(d){return fe(d)?{data:null,error:d}:{data:null,error:new Va("Unexpected error in register",d)}}}}ck();const Ak={url:_A,storageKey:jA,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:EA,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function W0(t,e,s){return await s()}const ei={};class Ko{get jwks(){var e,s;return(s=(e=ei[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){ei[this.storageKey]=Object.assign(Object.assign({},ei[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=ei[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ei[this.storageKey]=Object.assign(Object.assign({},ei[this.storageKey]),{cachedAt:e})}constructor(e){var s,r,o;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 u=Object.assign(Object.assign({},Ak),e);if(this.storageKey=u.storageKey,this.instanceID=(s=Ko.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Ko.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!u.debug,typeof u.debug=="function"&&(this.logger=u.debug),this.instanceID>0&&Ot()){const d=`${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(d),this.logDebugMessages&&console.trace(d)}if(this.persistSession=u.persistSession,this.autoRefreshToken=u.autoRefreshToken,this.admin=new ik({url:u.url,headers:u.headers,fetch:u.fetch}),this.url=u.url,this.headers=u.headers,this.fetch=xw(u.fetch),this.lock=u.lock||W0,this.detectSessionInUrl=u.detectSessionInUrl,this.flowType=u.flowType,this.hasCustomAuthorizationHeader=u.hasCustomAuthorizationHeader,this.throwOnError=u.throwOnError,this.lockAcquireTimeout=u.lockAcquireTimeout,u.lock?this.lock=u.lock:this.persistSession&&Ot()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=lk:this.lock=W0,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 Nk(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?(u.storage?this.storage=u.storage:vw()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Y0(this.memoryStorage)),u.userStorage&&(this.userStorage=u.userStorage)):(this.memoryStorage={},this.storage=Y0(this.memoryStorage)),Ot()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(d){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",d)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async d=>{this._debug("received broadcast notification from other tab or client",d),await this._notifyAllSubscribers(d.data.event,d.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} (${pw}) ${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 s={},r="none";if(Ot()&&(s=BA(window.location.href),this._isImplicitGrantCallback(s)?r="implicit":await this._isPKCECallback(s)&&(r="pkce")),Ot()&&this.detectSessionInUrl&&r!=="none"){const{data:o,error:u}=await this._getSessionFromURL(s,r);if(u){if(this._debug("#_initialize()","error detecting session from URL",u),RA(u)){const p=(e=u.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:u}}return{error:u}}const{session:d,redirectType:f}=o;return this._debug("#_initialize()","detected session in URL",d,"redirect type",f),await this._saveSession(d),setTimeout(async()=>{f==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",d):await this._notifyAllSubscribers("SIGNED_IN",d)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return fe(s)?this._returnResult({error:s}):this._returnResult({error:new Va("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var s,r,o;try{const u=await ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(s=e?.options)===null||s===void 0?void 0:s.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(o=e?.options)===null||o===void 0?void 0:o.captchaToken}},xform:Cn}),{data:d,error:f}=u;if(f||!d)return this._returnResult({data:{user:null,session:null},error:f});const p=d.session,m=d.user;return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:m,session:p},error:null})}catch(u){if(fe(u))return this._returnResult({data:{user:null,session:null},error:u});throw u}}async signUp(e){var s,r,o;try{let u;if("email"in e){const{email:y,password:v,options:b}=e;let S=null,_=null;this.flowType==="pkce"&&([S,_]=await Jr(this.storage,this.storageKey)),u=await ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:b?.emailRedirectTo,body:{email:y,password:v,data:(s=b?.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:b?.captchaToken},code_challenge:S,code_challenge_method:_},xform:Cn})}else if("phone"in e){const{phone:y,password:v,options:b}=e;u=await ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:y,password:v,data:(r=b?.data)!==null&&r!==void 0?r:{},channel:(o=b?.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:b?.captchaToken}},xform:Cn})}else throw new Lc("You must provide either an email or phone number and a password");const{data:d,error:f}=u;if(f||!d)return await Rt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:f});const p=d.session,m=d.user;return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:m,session:p},error:null})}catch(u){if(await Rt(this.storage,`${this.storageKey}-code-verifier`),fe(u))return this._returnResult({data:{user:null,session:null},error:u});throw u}}async signInWithPassword(e){try{let s;if("email"in e){const{email:u,password:d,options:f}=e;s=await ye(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:u,password:d,gotrue_meta_security:{captcha_token:f?.captchaToken}},xform:F0})}else if("phone"in e){const{phone:u,password:d,options:f}=e;s=await ye(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:u,password:d,gotrue_meta_security:{captcha_token:f?.captchaToken}},xform:F0})}else throw new Lc("You must provide either an email or phone number and a password");const{data:r,error:o}=s;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!r||!r.session||!r.user){const u=new Wr;return this._returnResult({data:{user:null,session:null},error:u})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:o})}catch(s){if(fe(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(e){var s,r,o,u;return await this._handleProviderSignIn(e.provider,{redirectTo:(s=e.options)===null||s===void 0?void 0:s.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(o=e.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(u=e.options)===null||u===void 0?void 0:u.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:s}=e;switch(s){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(e){var s,r,o,u,d,f,p,m,y,v,b;let S,_;if("message"in e)S=e.message,_=e.signature;else{const{chain:E,wallet:T,statement:A,options:D}=e;let N;if(Ot())if(typeof T=="object")N=T;else{const J=window;if("ethereum"in J&&typeof J.ethereum=="object"&&"request"in J.ethereum&&typeof J.ethereum.request=="function")N=J.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 T!="object"||!D?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=T}const L=new URL((s=D?.url)!==null&&s!==void 0?s:window.location.href),G=await N.request({method:"eth_requestAccounts"}).then(J=>J).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!G||G.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const F=ww(G[0]);let U=(r=D?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!U){const J=await N.request({method:"eth_chainId"});U=uk(J)}const M={domain:L.host,address:F,statement:A,uri:L.href,version:"1",chainId:U,nonce:(o=D?.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(d=(u=D?.signInWithEthereum)===null||u===void 0?void 0:u.issuedAt)!==null&&d!==void 0?d:new Date,expirationTime:(f=D?.signInWithEthereum)===null||f===void 0?void 0:f.expirationTime,notBefore:(p=D?.signInWithEthereum)===null||p===void 0?void 0:p.notBefore,requestId:(m=D?.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(y=D?.signInWithEthereum)===null||y===void 0?void 0:y.resources};S=hk(M),_=await N.request({method:"personal_sign",params:[dk(S),F]})}try{const{data:E,error:T}=await ye(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:_},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(b=e.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:Cn});if(T)throw T;if(!E||!E.session||!E.user){const A=new Wr;return this._returnResult({data:{user:null,session:null},error:A})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:T})}catch(E){if(fe(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async signInWithSolana(e){var s,r,o,u,d,f,p,m,y,v,b,S;let _,E;if("message"in e)_=e.message,E=e.signature;else{const{chain:T,wallet:A,statement:D,options:N}=e;let L;if(Ot())if(typeof A=="object")L=A;else{const F=window;if("solana"in F&&typeof F.solana=="object"&&("signIn"in F.solana&&typeof F.solana.signIn=="function"||"signMessage"in F.solana&&typeof F.solana.signMessage=="function"))L=F.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"||!N?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");L=A}const G=new URL((s=N?.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in L&&L.signIn){const F=await L.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N?.signInWithSolana),{version:"1",domain:G.host,uri:G.href}),D?{statement:D}:null));let U;if(Array.isArray(F)&&F[0]&&typeof F[0]=="object")U=F[0];else if(F&&typeof F=="object"&&"signedMessage"in F&&"signature"in F)U=F;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in U&&"signature"in U&&(typeof U.signedMessage=="string"||U.signedMessage instanceof Uint8Array)&&U.signature instanceof Uint8Array)_=typeof U.signedMessage=="string"?U.signedMessage:new TextDecoder().decode(U.signedMessage),E=U.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in L)||typeof L.signMessage!="function"||!("publicKey"in L)||typeof L!="object"||!L.publicKey||!("toBase58"in L.publicKey)||typeof L.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");_=[`${G.host} wants you to sign in with your Solana account:`,L.publicKey.toBase58(),...D?["",D,""]:[""],"Version: 1",`URI: ${G.href}`,`Issued At: ${(o=(r=N?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((u=N?.signInWithSolana)===null||u===void 0)&&u.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((d=N?.signInWithSolana)===null||d===void 0)&&d.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((f=N?.signInWithSolana)===null||f===void 0)&&f.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((p=N?.signInWithSolana)===null||p===void 0)&&p.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((m=N?.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((v=(y=N?.signInWithSolana)===null||y===void 0?void 0:y.resources)===null||v===void 0)&&v.length?["Resources",...N.signInWithSolana.resources.map(U=>`- ${U}`)]:[]].join(`
51
+ `);const F=await L.signMessage(new TextEncoder().encode(_),"utf8");if(!F||!(F instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");E=F}}try{const{data:T,error:A}=await ye(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:_,signature:qa(E)},!((b=e.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(S=e.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:Cn});if(A)throw A;if(!T||!T.session||!T.user){const D=new Wr;return this._returnResult({data:{user:null,session:null},error:D})}return T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),this._returnResult({data:Object.assign({},T),error:A})}catch(T){if(fe(T))return this._returnResult({data:{user:null,session:null},error:T});throw T}}async _exchangeCodeForSession(e){const s=await Da(this.storage,`${this.storageKey}-code-verifier`),[r,o]=(s??"").split("/");try{if(!r&&this.flowType==="pkce")throw new OA;const{data:u,error:d}=await ye(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Cn});if(await Rt(this.storage,`${this.storageKey}-code-verifier`),d)throw d;if(!u||!u.session||!u.user){const f=new Wr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:f})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:Object.assign(Object.assign({},u),{redirectType:o??null}),error:d})}catch(u){if(await Rt(this.storage,`${this.storageKey}-code-verifier`),fe(u))return this._returnResult({data:{user:null,session:null,redirectType:null},error:u});throw u}}async signInWithIdToken(e){try{const{options:s,provider:r,token:o,access_token:u,nonce:d}=e,f=await ye(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:o,access_token:u,nonce:d,gotrue_meta_security:{captcha_token:s?.captchaToken}},xform:Cn}),{data:p,error:m}=f;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!p||!p.session||!p.user){const y=new Wr;return this._returnResult({data:{user:null,session:null},error:y})}return p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("SIGNED_IN",p.session)),this._returnResult({data:p,error:m})}catch(s){if(fe(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(e){var s,r,o,u,d;try{if("email"in e){const{email:f,options:p}=e;let m=null,y=null;this.flowType==="pkce"&&([m,y]=await Jr(this.storage,this.storageKey));const{error:v}=await ye(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:f,data:(s=p?.data)!==null&&s!==void 0?s:{},create_user:(r=p?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},code_challenge:m,code_challenge_method:y},redirectTo:p?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:v})}if("phone"in e){const{phone:f,options:p}=e,{data:m,error:y}=await ye(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:f,data:(o=p?.data)!==null&&o!==void 0?o:{},create_user:(u=p?.shouldCreateUser)!==null&&u!==void 0?u:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},channel:(d=p?.channel)!==null&&d!==void 0?d:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m?.message_id},error:y})}throw new Lc("You must provide either an email or phone number.")}catch(f){if(await Rt(this.storage,`${this.storageKey}-code-verifier`),fe(f))return this._returnResult({data:{user:null,session:null},error:f});throw f}}async verifyOtp(e){var s,r;try{let o,u;"options"in e&&(o=(s=e.options)===null||s===void 0?void 0:s.redirectTo,u=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:d,error:f}=await ye(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:u}}),redirectTo:o,xform:Cn});if(f)throw f;if(!d)throw new Error("An error occurred on token verification.");const p=d.session,m=d.user;return p?.access_token&&(await this._saveSession(p),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",p)),this._returnResult({data:{user:m,session:p},error:null})}catch(o){if(fe(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(e){var s,r,o,u,d;try{let f=null,p=null;this.flowType==="pkce"&&([f,p]=await Jr(this.storage,this.storageKey));const m=await ye(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:(r=(s=e.options)===null||s===void 0?void 0:s.redirectTo)!==null&&r!==void 0?r:void 0}),!((o=e?.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:f,code_challenge_method:p}),headers:this.headers,xform:sk});return!((u=m.data)===null||u===void 0)&&u.url&&Ot()&&!(!((d=e.options)===null||d===void 0)&&d.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(f){if(await Rt(this.storage,`${this.storageKey}-code-verifier`),fe(f))return this._returnResult({data:null,error:f});throw f}}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:s},error:r}=e;if(r)throw r;if(!s)throw new rn;const{error:o}=await ye(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(e){if(fe(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const s=`${this.url}/resend`;if("email"in e){const{email:r,type:o,options:u}=e,{error:d}=await ye(this.fetch,"POST",s,{headers:this.headers,body:{email:r,type:o,gotrue_meta_security:{captcha_token:u?.captchaToken}},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}else if("phone"in e){const{phone:r,type:o,options:u}=e,{data:d,error:f}=await ye(this.fetch,"POST",s,{headers:this.headers,body:{phone:r,type:o,gotrue_meta_security:{captcha_token:u?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:d?.message_id},error:f})}throw new Lc("You must provide either an email or phone number and a type")}catch(s){if(fe(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async s=>s))}async _acquireLock(e,s){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await r,await s()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=s();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await r}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 s=await this.__loadSession();return await e(s)}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 s=await Da(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?e=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<af:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const d=await Da(this.userStorage,this.storageKey+"-user");d?.user?e.user=d.user:e.user=lf()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const d={value:this.suppressGetSessionWarning};e.user=ZA(e.user,d),d.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:o,error:u}=await this._callRefreshToken(e.refresh_token);return u?this._returnResult({data:{session:null},error:u}):this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(e){try{return e?await ye(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Xs}):await this._useSession(async s=>{var r,o,u;const{data:d,error:f}=s;if(f)throw f;return!(!((r=d.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new rn}:await ye(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(u=(o=d.session)===null||o===void 0?void 0:o.access_token)!==null&&u!==void 0?u:void 0,xform:Xs})})}catch(s){if(fe(s))return CA(s)&&(await this._removeSession(),await Rt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(e,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,s))}async _updateUser(e,s={}){try{return await this._useSession(async r=>{const{data:o,error:u}=r;if(u)throw u;if(!o.session)throw new rn;const d=o.session;let f=null,p=null;this.flowType==="pkce"&&e.email!=null&&([f,p]=await Jr(this.storage,this.storageKey));const{data:m,error:y}=await ye(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:f,code_challenge_method:p}),jwt:d.access_token,xform:Xs});if(y)throw y;return d.user=m.user,await this._saveSession(d),await this._notifyAllSubscribers("USER_UPDATED",d),this._returnResult({data:{user:d.user},error:null})})}catch(r){if(await Rt(this.storage,`${this.storageKey}-code-verifier`),fe(r))return this._returnResult({data:{user:null},error:r});throw r}}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 rn;const s=Date.now()/1e3;let r=s,o=!0,u=null;const{payload:d}=of(e.access_token);if(d.exp&&(r=d.exp,o=r<=s),o){const{data:f,error:p}=await this._callRefreshToken(e.refresh_token);if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!f)return{data:{user:null,session:null},error:null};u=f}else{const{data:f,error:p}=await this._getUser(e.access_token);if(p)throw p;u={access_token:e.access_token,refresh_token:e.refresh_token,user:f.user,token_type:"bearer",expires_in:r-s,expires_at:r},await this._saveSession(u),await this._notifyAllSubscribers("SIGNED_IN",u)}return this._returnResult({data:{user:u.user,session:u},error:null})}catch(s){if(fe(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}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 s=>{var r;if(!e){const{data:d,error:f}=s;if(f)throw f;e=(r=d.session)!==null&&r!==void 0?r:void 0}if(!e?.refresh_token)throw new rn;const{data:o,error:u}=await this._callRefreshToken(e.refresh_token);return u?this._returnResult({data:{user:null,session:null},error:u}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(fe(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){try{if(!Ot())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(s){case"implicit":if(this.flowType==="pkce")throw new V0("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(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new V0("No code detected.");const{data:D,error:N}=await this._exchangeCodeForSession(e.code);if(N)throw N;const L=new URL(window.location.href);return L.searchParams.delete("code"),window.history.replaceState(window.history.state,"",L.toString()),{data:{session:D.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:o,access_token:u,refresh_token:d,expires_in:f,expires_at:p,token_type:m}=e;if(!u||!f||!d||!m)throw new Uc("No session defined in URL");const y=Math.round(Date.now()/1e3),v=parseInt(f);let b=y+v;p&&(b=parseInt(p));const S=b-y;S*1e3<=ri&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${v}s`);const _=b-v;y-_>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",_,b,y):y-_<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",_,b,y);const{data:E,error:T}=await this._getUser(u);if(T)throw T;const A={provider_token:r,provider_refresh_token:o,access_token:u,expires_in:v,expires_at:b,refresh_token:d,token_type:m,user:E.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:A,redirectType:e.type},error:null})}catch(r){if(fe(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_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 s=await Da(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&s)}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 s=>{var r;const{data:o,error:u}=s;if(u)return this._returnResult({error:u});const d=(r=o.session)===null||r===void 0?void 0:r.access_token;if(d){const{error:f}=await this.admin.signOut(d,e);if(f&&!(kA(f)&&(f.status===404||f.status===401||f.status===403)))return this._returnResult({error:f})}return e!=="others"&&(await this._removeSession(),await Rt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const s=VA(),r={id:s,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async s=>{var r,o;try{const{data:{session:u},error:d}=s;if(d)throw d;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",u)),this._debug("INITIAL_SESSION","callback id",e,"session",u)}catch(u){await((o=this.stateChangeEmitters.get(e))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",u),console.error(u)}})}async resetPasswordForEmail(e,s={}){let r=null,o=null;this.flowType==="pkce"&&([r,o]=await Jr(this.storage,this.storageKey,!0));try{return await ye(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:o,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(u){if(await Rt(this.storage,`${this.storageKey}-code-verifier`),fe(u))return this._returnResult({data:null,error:u});throw u}}async getUserIdentities(){var e;try{const{data:s,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=s.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(s){if(fe(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var s;try{const{data:r,error:o}=await this._useSession(async u=>{var d,f,p,m,y;const{data:v,error:b}=u;if(b)throw b;const S=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(d=e.options)===null||d===void 0?void 0:d.redirectTo,scopes:(f=e.options)===null||f===void 0?void 0:f.scopes,queryParams:(p=e.options)===null||p===void 0?void 0:p.queryParams,skipBrowserRedirect:!0});return await ye(this.fetch,"GET",S,{headers:this.headers,jwt:(y=(m=v.session)===null||m===void 0?void 0:m.access_token)!==null&&y!==void 0?y:void 0})});if(o)throw o;return Ot()&&!(!((s=e.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(r?.url),this._returnResult({data:{provider:e.provider,url:r?.url},error:null})}catch(r){if(fe(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async s=>{var r;try{const{error:o,data:{session:u}}=s;if(o)throw o;const{options:d,provider:f,token:p,access_token:m,nonce:y}=e,v=await ye(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=u?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:f,id_token:p,access_token:m,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:Cn}),{data:b,error:S}=v;return S?this._returnResult({data:{user:null,session:null},error:S}):!b||!b.session||!b.user?this._returnResult({data:{user:null,session:null},error:new Wr}):(b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("USER_UPDATED",b.session)),this._returnResult({data:b,error:S}))}catch(o){if(await Rt(this.storage,`${this.storageKey}-code-verifier`),fe(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(e){try{return await this._useSession(async s=>{var r,o;const{data:u,error:d}=s;if(d)throw d;return await ye(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(o=(r=u.session)===null||r===void 0?void 0:r.access_token)!==null&&o!==void 0?o:void 0})})}catch(s){if(fe(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(e){const s=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{const r=Date.now();return await $A(async o=>(o>0&&await qA(200*Math.pow(2,o-1)),this._debug(s,"refreshing attempt",o),await ye(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Cn})),(o,u)=>{const d=200*Math.pow(2,o);return u&&rf(u)&&Date.now()+d-r<ri})}catch(r){if(this._debug(s,"error",r),fe(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(s,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,s){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",s,"url",r),Ot()&&!s.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,s;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const o=await Da(this.storage,this.storageKey);if(o&&this.userStorage){let d=await Da(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!d&&(d={user:o.user},await ii(this.userStorage,this.storageKey+"-user",d)),o.user=(e=d?.user)!==null&&e!==void 0?e:lf()}else if(o&&!o.user&&!o.user){const d=await Da(this.storage,this.storageKey+"-user");d&&d?.user?(o.user=d.user,await Rt(this.storage,this.storageKey+"-user"),await ii(this.storage,this.storageKey,o)):o.user=lf()}if(this._debug(r,"session from storage",o),!this._isValidSession(o)){this._debug(r,"session is not valid"),o!==null&&await this._removeSession();return}const u=((s=o.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<af;if(this._debug(r,`session has${u?"":" not"} expired with margin of ${af}s`),u){if(this.autoRefreshToken&&o.refresh_token){const{error:d}=await this._callRefreshToken(o.refresh_token);d&&(console.error(d),rf(d)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",d),await this._removeSession()))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{const{data:d,error:f}=await this._getUser(o.access_token);!f&&d?.user?(o.user=d.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(d){console.error("Error getting user data:",d),this._debug(r,"error getting user data, skipping SIGNED_IN notification",d)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(r,"error",o),console.error(o);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var s,r;if(!e)throw new rn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new Eu;const{data:u,error:d}=await this._refreshAccessToken(e);if(d)throw d;if(!u.session)throw new rn;await this._saveSession(u.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",u.session);const f={data:u.session,error:null};return this.refreshingDeferred.resolve(f),f}catch(u){if(this._debug(o,"error",u),fe(u)){const d={data:null,error:u};return rf(u)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(d),d}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(u),u}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(e,s,r=!0){const o=`#_notifyAllSubscribers(${e})`;this._debug(o,"begin",s,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:s});const u=[],d=Array.from(this.stateChangeEmitters.values()).map(async f=>{try{await f.callback(e,s)}catch(p){u.push(p)}});if(await Promise.all(d),u.length>0){for(let f=0;f<u.length;f+=1)console.error(u[f]);throw u[0]}}finally{this._debug(o,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Rt(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},e),r=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&s.user&&await ii(this.userStorage,this.storageKey+"-user",{user:s.user});const o=Object.assign({},s);delete o.user;const u=H0(o);await ii(this.storage,this.storageKey,u)}else{const o=H0(s);await ii(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Rt(this.storage,this.storageKey),await Rt(this.storage,this.storageKey+"-code-verifier"),await Rt(this.storage,this.storageKey+"-user"),this.userStorage&&await Rt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Ot()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ri);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}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 s=>{const{data:{session:r}}=s;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((r.expires_at*1e3-e)/ri);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${ri}ms, refresh threshold is ${Hf} ticks`),o<=Hf&&await this._callRefreshToken(r.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof bw)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ot()||!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 s=`#_onVisibilityChanged(${e})`;this._debug(s,"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(s,"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,s,r){const o=[`provider=${encodeURIComponent(s)}`];if(r?.redirectTo&&o.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&o.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[u,d]=await Jr(this.storage,this.storageKey),f=new URLSearchParams({code_challenge:`${encodeURIComponent(u)}`,code_challenge_method:`${encodeURIComponent(d)}`});o.push(f.toString())}if(r?.queryParams){const u=new URLSearchParams(r.queryParams);o.push(u.toString())}return r?.skipBrowserRedirect&&o.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${o.join("&")}`}async _unenroll(e){try{return await this._useSession(async s=>{var r;const{data:o,error:u}=s;return u?this._returnResult({data:null,error:u}):await ye(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=o?.session)===null||r===void 0?void 0:r.access_token})})}catch(s){if(fe(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(e){try{return await this._useSession(async s=>{var r,o;const{data:u,error:d}=s;if(d)return this._returnResult({data:null,error:d});const f=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:m}=await ye(this.fetch,"POST",`${this.url}/factors`,{body:f,headers:this.headers,jwt:(r=u?.session)===null||r===void 0?void 0:r.access_token});return m?this._returnResult({data:null,error:m}):(e.factorType==="totp"&&p.type==="totp"&&(!((o=p?.totp)===null||o===void 0)&&o.qr_code)&&(p.totp.qr_code=`data:image/svg+xml;utf-8,${p.totp.qr_code}`),this._returnResult({data:p,error:null}))})}catch(s){if(fe(s))return this._returnResult({data:null,error:s});throw s}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:o,error:u}=s;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?xk(e.webauthn.credential_response):bk(e.webauthn.credential_response)})}:{code:e.code}),{data:f,error:p}=await ye(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:d,headers:this.headers,jwt:(r=o?.session)===null||r===void 0?void 0:r.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+f.expires_in},f)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",f),this._returnResult({data:f,error:p}))})}catch(s){if(fe(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:o,error:u}=s;if(u)return this._returnResult({data:null,error:u});const d=await ye(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=o?.session)===null||r===void 0?void 0:r.access_token});if(d.error)return d;const{data:f}=d;if(f.type!=="webauthn")return{data:f,error:null};switch(f.webauthn.type){case"create":return{data:Object.assign(Object.assign({},f),{webauthn:Object.assign(Object.assign({},f.webauthn),{credential_options:Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:yk(f.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},f),{webauthn:Object.assign(Object.assign({},f.webauthn),{credential_options:Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:vk(f.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(fe(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(e){const{data:s,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:s.id,code:e.code})}async _listFactors(){var e;const{data:{user:s},error:r}=await this.getUser();if(r)return{data:null,error:r};const o={all:[],phone:[],totp:[],webauthn:[]};for(const u of(e=s?.factors)!==null&&e!==void 0?e:[])o.all.push(u),u.status==="verified"&&o[u.factor_type].push(u);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(){var e,s;const{data:{session:r},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:u}=of(r.access_token);let d=null;u.aal&&(d=u.aal);let f=d;((s=(e=r.user.factors)===null||e===void 0?void 0:e.filter(y=>y.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(f="aal2");const m=u.amr||[];return{data:{currentLevel:d,nextLevel:f,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async s=>{const{data:{session:r},error:o}=s;return o?this._returnResult({data:null,error:o}):r?await ye(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:u=>({data:u,error:null})}):this._returnResult({data:null,error:new rn})})}catch(s){if(fe(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:o},error:u}=r;if(u)return this._returnResult({data:null,error:u});if(!o)return this._returnResult({data:null,error:new rn});const d=await ye(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:f=>({data:f,error:null})});return d.data&&d.data.redirect_url&&Ot()&&!s?.skipBrowserRedirect&&window.location.assign(d.data.redirect_url),d})}catch(r){if(fe(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:o},error:u}=r;if(u)return this._returnResult({data:null,error:u});if(!o)return this._returnResult({data:null,error:new rn});const d=await ye(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:f=>({data:f,error:null})});return d.data&&d.data.redirect_url&&Ot()&&!s?.skipBrowserRedirect&&window.location.assign(d.data.redirect_url),d})}catch(r){if(fe(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;return r?this._returnResult({data:null,error:r}):s?await ye(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new rn})})}catch(e){if(fe(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async s=>{const{data:{session:r},error:o}=s;return o?this._returnResult({data:null,error:o}):r?(await ye(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new rn})})}catch(s){if(fe(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,s={keys:[]}){let r=s.keys.find(f=>f.kid===e);if(r)return r;const o=Date.now();if(r=this.jwks.keys.find(f=>f.kid===e),r&&this.jwks_cached_at+NA>o)return r;const{data:u,error:d}=await ye(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(d)throw d;return!u.keys||u.keys.length===0||(this.jwks=u,this.jwks_cached_at=o,r=u.keys.find(f=>f.kid===e),!r)?null:r}async getClaims(e,s={}){try{let r=e;if(!r){const{data:S,error:_}=await this.getSession();if(_||!S.session)return this._returnResult({data:null,error:_});r=S.session.access_token}const{header:o,payload:u,signature:d,raw:{header:f,payload:p}}=of(r);s?.allowExpired||WA(u.exp);const m=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,s?.keys?{keys:s.keys}:s?.jwks);if(!m){const{error:S}=await this.getUser(r);if(S)throw S;return{data:{claims:u,header:o,signature:d},error:null}}const y=JA(o.alg),v=await crypto.subtle.importKey("jwk",m,y,!0,["verify"]);if(!await crypto.subtle.verify(y,v,d,UA(`${f}.${p}`)))throw new Kf("Invalid JWT signature");return{data:{claims:u,header:o,signature:d},error:null}}catch(r){if(fe(r))return this._returnResult({data:null,error:r});throw r}}}Ko.nextInstanceID={};const kk=Ko,Ck="2.90.1";let ko="";typeof Deno<"u"?ko="deno":typeof document<"u"?ko="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ko="react-native":ko="node";const Rk={"X-Client-Info":`supabase-js-${ko}/${Ck}`},Ok={headers:Rk},Dk={schema:"public"},Mk={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},zk={};function Yo(t){"@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(t)}function Lk(t,e){if(Yo(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(Yo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Uk(t){var e=Lk(t,"string");return Yo(e)=="symbol"?e:e+""}function Pk(t,e,s){return(e=Uk(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function J0(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),s.push.apply(s,r)}return s}function rt(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?J0(Object(s),!0).forEach(function(r){Pk(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):J0(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const Vk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Bk=()=>Headers,Ik=(t,e,s)=>{const r=Vk(s),o=Bk();return async(u,d)=>{var f;const p=(f=await e())!==null&&f!==void 0?f:t;let m=new o(d?.headers);return m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${p}`),r(u,rt(rt({},d),{},{headers:m}))}};function qk(t){return t.endsWith("/")?t:t+"/"}function $k(t,e){var s,r;const{db:o,auth:u,realtime:d,global:f}=t,{db:p,auth:m,realtime:y,global:v}=e,b={db:rt(rt({},p),o),auth:rt(rt({},m),u),realtime:rt(rt({},y),d),storage:{},global:rt(rt(rt({},v),f),{},{headers:rt(rt({},(s=v?.headers)!==null&&s!==void 0?s:{}),(r=f?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?b.accessToken=t.accessToken:delete b.accessToken,b}function Hk(t){const e=t?.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(qk(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Gk=class extends kk{constructor(t){super(t)}},Fk=class{constructor(t,e,s){var r,o;this.supabaseUrl=t,this.supabaseKey=e;const u=Hk(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",u),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",u),this.storageUrl=new URL("storage/v1",u),this.functionsUrl=new URL("functions/v1",u);const d=`sb-${u.hostname.split(".")[0]}-auth-token`,f={db:Dk,realtime:zk,auth:rt(rt({},Mk),{},{storageKey:d}),global:Ok},p=$k(s??{},f);if(this.storageKey=(r=p.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(o=p.global.headers)!==null&&o!==void 0?o:{},p.accessToken)this.accessToken=p.accessToken,this.auth=new Proxy({},{get:(y,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}});else{var m;this.auth=this._initSupabaseAuthClient((m=p.auth)!==null&&m!==void 0?m:{},this.headers,p.global.fetch)}this.fetch=Ik(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(y=>this.realtime.setAuth(y)).catch(y=>console.warn("Failed to set initial Realtime auth token:",y)),this.rest=new E2(new URL("rest/v1",u).href,{headers:this.headers,schema:p.db.schema,fetch:this.fetch}),this.storage=new SA(this.storageUrl.href,this.headers,this.fetch,s?.storage),p.accessToken||this._listenForAuthEvents()}get functions(){return new b2(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,s)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,s;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();return(e=(s=r.session)===null||s===void 0?void 0:s.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:o,storageKey:u,flowType:d,lock:f,debug:p,throwOnError:m},y,v){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Gk({url:this.authUrl.href,headers:rt(rt({},b),y),storageKey:u,autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:o,flowType:d,lock:f,debug:p,throwOnError:m,fetch:v,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new q2(this.realtimeUrl.href,rt(rt({},t),{},{params:rt(rt({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Yf=(t,e,s)=>new Fk(t,e,s);function Kk(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const s=e.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}Kk()&&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 Tu="email_automator_supabase_config";function _i(){const t=s=>s&&typeof s.url=="string"&&typeof s.anonKey=="string"&&s.url.startsWith("http")&&!s.url.includes("placeholder.supabase.co")&&s.url!=="your_supabase_url"&&s.anonKey!=="your_supabase_anon_key";try{const s=localStorage.getItem(Tu);if(s){const r=JSON.parse(s);if(t(r))return r}}catch(s){console.error("Error reading Supabase config:",s)}const e={url:void 0,anonKey:void 0};return t(e)?e:null}function uf(t){try{localStorage.setItem(Tu,JSON.stringify(t))}catch(e){console.error("Error saving Supabase config:",e)}}function Yk(){try{localStorage.removeItem(Tu)}catch(t){console.error("Error clearing Supabase config:",t)}}async function Xk(t,e){try{if(!t.startsWith("http://")&&!t.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const s=e.startsWith("eyJ"),r=e.startsWith("sb_publishable_");if(!s&&!r)return{valid:!1,error:"Invalid API key format (must be anon or publishable key)"};if(r)return{valid:!0};const o=await fetch(`${t}/rest/v1/`,{method:"GET",headers:{apikey:e,Authorization:`Bearer ${e}`}});return o.ok?{valid:!0}:o.status===401||o.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${o.statusText}`}}catch(s){return{valid:!1,error:s instanceof Error?s.message:"Connection failed"}}}function Wk(){return localStorage.getItem(Tu)?"ui":"none"}function Jk(){const t=_i();return!t||!t.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Yf("https://placeholder.supabase.co","placeholder-key")):Yf(t.url,t.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const Je=Jk();function Q0(){const t=_i(),e=t?`${t.url}/functions/v1`:"",s=t?t.anonKey:"",r=window.location.port==="5173";let o="";return r?o="http://localhost:3004":o=window.location.origin,{edgeFunctionsUrl:e,expressApiUrl:o,anonKey:s}}class Qk{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const e=Q0();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,s,r={}){const{auth:o=!0,...u}=r,d={"Content-Type":"application/json",...r.headers||{}};if(o&&this.supabaseClient)try{const{data:{session:f},error:p}=await this.supabaseClient.auth.getSession();p?console.error("[HybridApiClient] Failed to get Supabase session:",p):f?.access_token&&(this.token=f.access_token)}catch(f){console.error("[HybridApiClient] Session recovery error:",f)}if(o&&!this.token)return console.warn(`[HybridApiClient] Attempted protected request to ${s} without token`),{error:{code:"AUTH_REQUIRED",message:"You must be logged in to perform this action"}};o&&this.token&&(d.Authorization=`Bearer ${this.token}`);try{console.debug(`[HybridApiClient] ${r.method||"GET"} ${e}${s}`);const f=await fetch(`${e}${s}`,{...u,headers:d});if(!f.ok){const m=await f.json().catch(()=>({})),y=typeof m.error=="string"?m.error:m.error?.message||`Request failed: ${f.status}`;return{error:{code:m.error?.code||"API_ERROR",message:y}}}return{data:await f.json()}}catch(f){return{error:{code:"NETWORK_ERROR",message:f instanceof Error?f.message:"Network error"}}}}edgeRequest(e,s){const r={...s?.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,e,{...s,headers:r})}expressRequest(e,s){const r=Q0(),o={...s?.headers||{},"X-Supabase-Url":r.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":r.anonKey};return this.request(this.expressApiUrl,e,{...s,headers:o})}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,s){return this.edgeRequest(`/api-v1-accounts/${e}`,{method:"PATCH",body:JSON.stringify(s)})}async getEmails(e={}){const s=new URLSearchParams;return e.limit&&s.set("limit",e.limit.toString()),e.offset&&s.set("offset",e.offset.toString()),e.category&&s.set("category",e.category),e.search&&s.set("search",e.search),e.sort_by&&s.set("sort_by",e.sort_by),e.sort_order&&s.set("sort_order",e.sort_order),this.edgeRequest(`/api-v1-emails?${s}`)}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,s){return this.expressRequest(`/api/rules/${e}`,{method:"PATCH",body:JSON.stringify(s)})}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,s,r){return this.expressRequest("/api/actions/execute",{method:"POST",body:JSON.stringify({emailId:e,action:s,draftContent:r})})}async generateDraft(e,s){return this.expressRequest(`/api/actions/draft/${e}`,{method:"POST",body:JSON.stringify({instructions:s})})}async bulkAction(e,s){return this.expressRequest("/api/actions/bulk",{method:"POST",body:JSON.stringify({emailIds:e,action:s})})}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:s,error:r}=await this.supabaseClient.from("profiles").select("*").eq("id",e.id).single();return{data:s,error:r}}async updateProfile(e){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:s}}=await this.supabaseClient.auth.getUser();if(!s)return{error:"Not authenticated"};const{data:r,error:o}=await this.supabaseClient.from("profiles").update({...e,updated_at:new Date().toISOString()}).eq("id",s.id).select().single();return{data:r,error:o}}async changePassword(e){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{error:s}=await this.supabaseClient.auth.updateUser({password:e});return{success:!s,error:s}}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 Me=new Qk;async function _w(t){Me.setSupabaseClient(t);const{data:{session:e}}=await t.auth.getSession();e?.access_token&&Me.setToken(e.access_token),t.auth.onAuthStateChange((s,r)=>{Me.setToken(r?.access_token||null)})}const Zk=Object.freeze(Object.defineProperty({__proto__:null,api:Me,initializeApi:_w},Symbol.toStringTag,{value:"Module"}));function eC({userId:t,onInsert:e,onUpdate:s,onDelete:r,enabled:o=!0}){const[u,d]=w.useState(!1);return w.useEffect(()=>{if(!o||!t){d(!1);return}const f=Je.channel(`emails-realtime-${t}`).on("postgres_changes",{event:"*",schema:"public",table:"emails"},p=>{p.eventType==="INSERT"?e?.(p.new):p.eventType==="UPDATE"?s?.(p.new):p.eventType==="DELETE"&&r?.(p.old.id)}).subscribe(p=>{d(p==="SUBSCRIBED")});return()=>{Je.removeChannel(f)}},[t,o,e,s,r]),{isSubscribed:u}}class tC{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(),s=e.createOscillator(),r=e.createGain();s.type="sine",s.frequency.setValueAtTime(880,e.currentTime),s.frequency.exponentialRampToValueAtTime(440,e.currentTime+.1),r.gain.setValueAtTime(0,e.currentTime),r.gain.linearRampToValueAtTime(.1,e.currentTime+.01),r.gain.exponentialRampToValueAtTime(.001,e.currentTime+.3),s.connect(r),r.connect(e.destination),s.start(),s.stop(e.currentTime+.3),this.haptic(10)}playAlert(){if(!this.enabled)return;const e=this.initCtx(),s=(r,o)=>{const u=e.createOscillator(),d=e.createGain();u.type="sine",u.frequency.setValueAtTime(r,e.currentTime+o),d.gain.setValueAtTime(0,e.currentTime+o),d.gain.linearRampToValueAtTime(.1,e.currentTime+o+.05),d.gain.exponentialRampToValueAtTime(.001,e.currentTime+o+.4),u.connect(d),d.connect(e.destination),u.start(e.currentTime+o),u.stop(e.currentTime+o+.4)};s(660,0),s(880,.1),this.haptic([20,50,20])}playStart(){if(!this.enabled)return;const e=this.initCtx(),s=e.createOscillator(),r=e.createGain();s.type="sine",s.frequency.setValueAtTime(440,e.currentTime),s.frequency.exponentialRampToValueAtTime(880,e.currentTime+.2),r.gain.setValueAtTime(0,e.currentTime),r.gain.linearRampToValueAtTime(.05,e.currentTime+.05),r.gain.exponentialRampToValueAtTime(.001,e.currentTime+.2),s.connect(r),r.connect(e.destination),s.start(),s.stop(e.currentTime+.2),this.haptic(10)}playSuccess(){if(!this.enabled)return;const e=this.initCtx(),s=e.createOscillator(),r=e.createGain();s.type="triangle",s.frequency.setValueAtTime(523.25,e.currentTime),s.frequency.exponentialRampToValueAtTime(1046.5,e.currentTime+.1),r.gain.setValueAtTime(0,e.currentTime),r.gain.linearRampToValueAtTime(.05,e.currentTime+.02),r.gain.exponentialRampToValueAtTime(.001,e.currentTime+.2),s.connect(r),r.connect(e.destination),s.start(),s.stop(e.currentTime+.2),this.haptic(15)}}const $n=new tC;let In=[],Xf=new Set;function Wf(){Xf.forEach(t=>t())}const se={success:(t,e)=>Pc("success",t,e),error:(t,e)=>Pc("error",t,e),info:(t,e)=>Pc("info",t,e),warning:(t,e)=>Pc("warning",t,e)};function Pc(t,e,s=5e3){const r=In.findIndex(u=>u.message===e&&u.type===t);if(r!==-1){const u=In[r];In=[...In],In[r]={...u,count:(u.count||1)+1,lastUpdated:Date.now()},Wf();return}const o=Math.random().toString(36).substr(2,9);In=[...In,{id:o,type:t,message:e,duration:s,count:1,lastUpdated:Date.now()}],Wf(),s>0&&setTimeout(()=>jw(o),s)}function jw(t){In=In.filter(e=>e.id!==t),Wf()}function nC(){const[,t]=w.useState(0);return w.useEffect(()=>{const e=()=>t(s=>s+1);return Xf.add(e),()=>{Xf.delete(e)}},[]),In}const sC={success:ru,error:Mn,info:yi,warning:vi},aC={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 rC({toast:t}){const e=sC[t.type];return l.jsxs("div",{className:we("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-left-full duration-300",aC[t.type]),children:[l.jsxs("div",{className:"relative",children:[l.jsx(e,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),t.count&&t.count>1&&l.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:t.count})]}),l.jsx("p",{className:"text-sm flex-1",children:t.message}),l.jsx("button",{onClick:()=>jw(t.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:l.jsx(aa,{className:"w-4 h-4"})})]})}function iC(){const t=nC();return t.length===0?null:l.jsx("div",{className:"fixed bottom-4 left-4 z-50 flex flex-col-reverse gap-2 max-w-sm w-full",children:t.map(e=>l.jsx(rC,{toast:e},e.id))})}function bn(t,e){return t?typeof t=="string"?t:t.message||e:e}const Ew={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 oC(t,e){switch(e.type){case"SET_USER":return{...t,user:e.payload,isAuthenticated:!!e.payload,isLoading:!1};case"SET_LOADING":return{...t,isLoading:e.payload};case"SET_INITIALIZED":return{...t,isInitialized:e.payload};case"SET_ERROR":return{...t,error:e.payload,isLoading:!1};case"SET_EMAILS":return{...t,emails:e.payload.emails,emailsTotal:e.payload.total,emailsOffset:e.payload.offset,activeCategory:e.payload.category!==void 0?e.payload.category:t.activeCategory,activeSearch:e.payload.search!==void 0?e.payload.search:t.activeSearch,sortBy:e.payload.sortBy||t.sortBy,sortOrder:e.payload.sortOrder||t.sortOrder};case"ADD_EMAIL":{const s=e.payload,r=!t.activeCategory||s.category===t.activeCategory,o=!t.activeSearch||s.subject?.toLowerCase().includes(t.activeSearch.toLowerCase())||s.sender?.toLowerCase().includes(t.activeSearch.toLowerCase());return!r||!o?{...t,emailsTotal:t.emailsTotal+1}:{...t,emails:[s,...t.emails],emailsTotal:t.emailsTotal+1}}case"UPDATE_EMAIL":{const s=e.payload;if(t.emails.findIndex(d=>d.id===s.id)!==-1)return{...t,emails:t.emails.map(d=>d.id===s.id?s:d)};const o=!t.activeCategory||s.category===t.activeCategory,u=!t.activeSearch||s.subject?.toLowerCase().includes(t.activeSearch.toLowerCase())||s.sender?.toLowerCase().includes(t.activeSearch.toLowerCase());return o&&u?{...t,emails:[s,...t.emails]}:t}case"REMOVE_EMAIL":return{...t,emails:t.emails.filter(s=>s.id!==e.payload),emailsTotal:Math.max(0,t.emailsTotal-1)};case"SET_PROFILE":return{...t,profile:e.payload};case"UPDATE_PROFILE":return{...t,profile:e.payload};case"SET_ACCOUNTS":return{...t,accounts:e.payload};case"ADD_ACCOUNT":return{...t,accounts:[e.payload,...t.accounts]};case"REMOVE_ACCOUNT":return{...t,accounts:t.accounts.filter(s=>s.id!==e.payload)};case"SET_RULES":return{...t,rules:e.payload};case"ADD_RULE":return{...t,rules:[e.payload,...t.rules]};case"UPDATE_RULE":return{...t,rules:t.rules.map(s=>s.id===e.payload.id?e.payload:s)};case"REMOVE_RULE":return{...t,rules:t.rules.filter(s=>s.id!==e.payload)};case"SET_SETTINGS":return{...t,settings:e.payload};case"SET_STATS":return{...t,stats:e.payload};case"SET_SELECTED_EMAIL":return{...t,selectedEmailId:e.payload};case"SET_SYNCING":return{...t,isSyncing:e.payload};case"CLEAR_DATA":return{...Ew,isLoading:!1,isInitialized:!0};default:return t}}const Tw=w.createContext(null);function lC({children:t}){const[e,s]=w.useReducer(oC,Ew),r=w.useCallback(async(m,y=3,v=500)=>{for(let b=1;b<=y;b++){const S=await Me.getEmail(m);if(S.data?.email)return S.data.email;b<y&&await new Promise(_=>setTimeout(_,v))}return null},[]),o=w.useCallback(async m=>{const y=await r(m.id);y&&(s({type:"ADD_EMAIL",payload:y}),y.processing_status==="completed"&&(y.ai_analysis?.priority==="High"?($n.playAlert(),se.success("High Priority Email Processed!")):($n.playNotify(),se.info("New email processed"))))},[s,r]),u=w.useCallback(async m=>{const y=await r(m.id);y&&(s({type:"UPDATE_EMAIL",payload:y}),y.processing_status==="completed"&&m.processing_status==="completed"&&(y.ai_analysis?.priority==="High"?($n.playAlert(),se.success("High Priority Email Processed!")):($n.playNotify(),se.info("Email analysis complete"))))},[s,r]),d=w.useCallback(m=>{s({type:"REMOVE_EMAIL",payload:m})},[s]),{isSubscribed:f}=eC({userId:e.user?.id,onInsert:o,onUpdate:u,onDelete:d,enabled:e.isAuthenticated});w.useEffect(()=>{async function m(){if(!_i()){s({type:"SET_INITIALIZED",payload:!0});return}try{const{error:v}=await Je.from("init_state").select("count",{count:"exact",head:!0});if(v&&v.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),s({type:"SET_INITIALIZED",payload:!0});return}await _w(Je);const{data:{session:b}}=await Je.auth.getSession();s({type:"SET_USER",payload:b?.user||null}),s({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:S}}=Je.auth.onAuthStateChange((_,E)=>{s({type:"SET_USER",payload:E?.user||null}),E||s({type:"CLEAR_DATA"})});return()=>S.unsubscribe()}catch(v){console.error("[AppContext] Init error:",v),s({type:"SET_ERROR",payload:"Failed to initialize"}),s({type:"SET_INITIALIZED",payload:!0})}}m()},[]);const p={fetchEmails:async(m={})=>{const y=await Me.getEmails({limit:20,offset:m.offset||0,category:m.category,search:m.search,sort_by:m.sortBy||e.sortBy,sort_order:m.sortOrder||e.sortOrder});y.data&&s({type:"SET_EMAILS",payload:{emails:y.data.emails,total:y.data.total,offset:m.offset||0,category:m.category||null,search:m.search||"",sortBy:m.sortBy,sortOrder:m.sortOrder}})},fetchAccounts:async()=>{const m=await Me.getAccounts();m.data&&s({type:"SET_ACCOUNTS",payload:m.data.accounts})},fetchRules:async()=>{const m=await Me.getRules();m.data&&s({type:"SET_RULES",payload:m.data.rules})},fetchSettings:async()=>{const m=await Me.getSettings();m.data&&s({type:"SET_SETTINGS",payload:m.data.settings})},fetchProfile:async()=>{const m=await Me.getProfile();m.data&&s({type:"SET_PROFILE",payload:m.data})},fetchStats:async()=>{const m=await Me.getStats();m.data&&s({type:"SET_STATS",payload:m.data.stats})},executeAction:async(m,y,v)=>{const b=await Me.executeAction(m,y,v);if(b.data?.success){const S=e.emails.find(_=>_.id===m);return S&&s({type:"UPDATE_EMAIL",payload:{...S,action_taken:y}}),!0}return s({type:"SET_ERROR",payload:bn(b.error,"Action failed")}),!1},triggerSync:async m=>{s({type:"SET_SYNCING",payload:!0});try{const y=m?await Me.triggerSync(m):await Me.syncAll();return await p.fetchAccounts(),y.error?(s({type:"SET_ERROR",payload:bn(y.error,"Sync failed")}),!1):!0}finally{s({type:"SET_SYNCING",payload:!1})}},stopSync:async()=>{const m=await Me.stopSync();return m.data?.success?(se.info("Stop request sent"),!0):(s({type:"SET_ERROR",payload:bn(m.error,"Failed to stop sync")}),!1)},disconnectAccount:async m=>{const y=await Me.disconnectAccount(m);return y.data?.success?(s({type:"REMOVE_ACCOUNT",payload:m}),!0):(s({type:"SET_ERROR",payload:bn(y.error,"Failed to disconnect")}),!1)},updateSettings:async m=>{const y=await Me.updateSettings(m);return y.data?(s({type:"SET_SETTINGS",payload:y.data.settings}),!0):(s({type:"SET_ERROR",payload:bn(y.error,"Failed to update settings")}),!1)},updateProfile:async m=>{const y=await Me.updateProfile(m);return y.data?(s({type:"UPDATE_PROFILE",payload:y.data}),!0):(s({type:"SET_ERROR",payload:bn(y.error,"Failed to update profile")}),!1)},updateAccount:async(m,y)=>{const v=await Me.updateAccount(m,y);return v.data?(s({type:"SET_ACCOUNTS",payload:e.accounts.map(b=>b.id===m?{...b,...y}:b)}),!0):(s({type:"SET_ERROR",payload:bn(v.error,"Failed to update account")}),!1)},retryProcessing:async m=>{const y=await Me.retryEmail(m);if(y.data?.success){const v=e.emails.find(b=>b.id===m);return v&&s({type:"UPDATE_EMAIL",payload:{...v,processing_status:"pending",processing_error:null}}),!0}return s({type:"SET_ERROR",payload:bn(y.error,"Retry failed")}),!1},createRule:async m=>{const y=await Me.createRule(m);return y.data?(s({type:"ADD_RULE",payload:y.data.rule}),!0):(s({type:"SET_ERROR",payload:bn(y.error,"Failed to create rule")}),!1)},updateRule:async(m,y)=>{const v=await Me.updateRule(m,y);return v.data?(s({type:"UPDATE_RULE",payload:v.data.rule}),!0):(s({type:"SET_ERROR",payload:bn(v.error,"Failed to update rule")}),!1)},deleteRule:async m=>{const y=await Me.deleteRule(m);return y.data?.success?(s({type:"REMOVE_RULE",payload:m}),!0):(s({type:"SET_ERROR",payload:bn(y.error,"Failed to delete rule")}),!1)},toggleRule:async m=>{const y=await Me.toggleRule(m);return y.data?(s({type:"UPDATE_RULE",payload:y.data.rule}),!0):(s({type:"SET_ERROR",payload:bn(y.error,"Failed to toggle rule")}),!1)}};return l.jsx(Tw.Provider,{value:{state:e,isSubscribed:f,dispatch:s,actions:p},children:t})}function ra(){const t=w.useContext(Tw);if(!t)throw new Error("useApp must be used within AppProvider");return t}const cC=w.createContext(void 0);function uC({children:t,value:e}){return l.jsx(cC.Provider,{value:e,children:t})}const Nw=w.createContext(null);function dC({children:t}){const[e,s]=w.useState(!1),r=()=>s(!0),o=()=>s(!1);return l.jsx(Nw.Provider,{value:{isExpanded:e,setIsExpanded:s,openTerminal:r,closeTerminal:o},children:t})}function Aw(){const t=w.useContext(Nw);if(!t)throw new Error("useTerminal must be used within a TerminalProvider");return t}const Bt=w.forwardRef(({className:t,...e},s)=>l.jsx("div",{ref:s,className:we("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Bt.displayName="Card";const Js=w.forwardRef(({className:t,...e},s)=>l.jsx("div",{ref:s,className:we("flex flex-col space-y-1.5 p-6",t),...e}));Js.displayName="CardHeader";const Qs=w.forwardRef(({className:t,...e},s)=>l.jsx("div",{ref:s,className:we("font-semibold leading-none tracking-tight",t),...e}));Qs.displayName="CardTitle";const Ga=w.forwardRef(({className:t,...e},s)=>l.jsx("div",{ref:s,className:we("text-sm text-muted-foreground",t),...e}));Ga.displayName="CardDescription";const Zs=w.forwardRef(({className:t,...e},s)=>l.jsx("div",{ref:s,className:we("p-6 pt-0",t),...e}));Zs.displayName="CardContent";const hC=w.forwardRef(({className:t,...e},s)=>l.jsx("div",{ref:s,className:we("flex items-center p-6 pt-0",t),...e}));hC.displayName="CardFooter";class fC extends w.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,s){console.error("ErrorBoundary caught an error:",e,s)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:l.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:l.jsxs(Bt,{className:"max-w-md w-full p-8 text-center",children:[l.jsx("div",{className:"w-16 h-16 bg-destructive/10 text-destructive rounded-full flex items-center justify-center mx-auto mb-6",children:l.jsx(vi,{className:"w-8 h-8"})}),l.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),l.jsx("p",{className:"text-muted-foreground mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&l.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}),l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsxs(Q,{onClick:this.handleReset,variant:"outline",children:[l.jsx(Jt,{className:"w-4 h-4 mr-2"}),"Try Again"]}),l.jsx(Q,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function pt({size:t="md",className:e,text:s}){const r={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};return l.jsxs("div",{className:we("flex flex-col items-center justify-center gap-3",e),children:[l.jsx(zt,{className:we("animate-spin text-primary",r[t])}),s&&l.jsx("p",{className:"text-sm text-muted-foreground",children:s})]})}function hu({text:t="Loading..."}){return l.jsx("div",{className:"min-h-screen flex items-center justify-center",children:l.jsx(pt,{size:"lg",text:t})})}function mC(){return l.jsx("div",{className:"p-12 flex items-center justify-center",children:l.jsx(pt,{size:"md"})})}const Lm=w.createContext({});function Um(t){const e=w.useRef(null);return e.current===null&&(e.current=t()),e.current}const kw=typeof window<"u",Cw=kw?w.useLayoutEffect:w.useEffect,Nu=w.createContext(null);function Pm(t,e){t.indexOf(e)===-1&&t.push(e)}function Vm(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const Gn=(t,e,s)=>s>e?e:s<t?t:s;let Bm=()=>{};const ys={},Rw=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Ow(t){return typeof t=="object"&&t!==null}const Dw=t=>/^0[^.\s]+$/u.test(t);function Im(t){let e;return()=>(e===void 0&&(e=t()),e)}const _n=t=>t,pC=(t,e)=>s=>e(t(s)),sl=(...t)=>t.reduce(pC),Xo=(t,e,s)=>{const r=e-t;return r===0?1:(s-t)/r};class qm{constructor(){this.subscriptions=[]}add(e){return Pm(this.subscriptions,e),()=>Vm(this.subscriptions,e)}notify(e,s,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,s,r);else for(let u=0;u<o;u++){const d=this.subscriptions[u];d&&d(e,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const gs=t=>t*1e3,Sn=t=>t/1e3;function Mw(t,e){return e?t*(1e3/e):0}const zw=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,gC=1e-7,yC=12;function vC(t,e,s,r,o){let u,d,f=0;do d=e+(s-e)/2,u=zw(d,r,o)-t,u>0?s=d:e=d;while(Math.abs(u)>gC&&++f<yC);return d}function al(t,e,s,r){if(t===e&&s===r)return _n;const o=u=>vC(u,0,1,t,s);return u=>u===0||u===1?u:zw(o(u),e,r)}const Lw=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Uw=t=>e=>1-t(1-e),Pw=al(.33,1.53,.69,.99),$m=Uw(Pw),Vw=Lw($m),Bw=t=>(t*=2)<1?.5*$m(t):.5*(2-Math.pow(2,-10*(t-1))),Hm=t=>1-Math.sin(Math.acos(t)),Iw=Uw(Hm),qw=Lw(Hm),xC=al(.42,0,1,1),bC=al(0,0,.58,1),$w=al(.42,0,.58,1),wC=t=>Array.isArray(t)&&typeof t[0]!="number",Hw=t=>Array.isArray(t)&&typeof t[0]=="number",SC={linear:_n,easeIn:xC,easeInOut:$w,easeOut:bC,circIn:Hm,circInOut:qw,circOut:Iw,backIn:$m,backInOut:Vw,backOut:Pw,anticipate:Bw},_C=t=>typeof t=="string",Z0=t=>{if(Hw(t)){Bm(t.length===4);const[e,s,r,o]=t;return al(e,s,r,o)}else if(_C(t))return SC[t];return t},Vc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function jC(t,e){let s=new Set,r=new Set,o=!1,u=!1;const d=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function p(y){d.has(y)&&(m.schedule(y),t()),y(f)}const m={schedule:(y,v=!1,b=!1)=>{const _=b&&o?s:r;return v&&d.add(y),_.has(y)||_.add(y),y},cancel:y=>{r.delete(y),d.delete(y)},process:y=>{if(f=y,o){u=!0;return}o=!0,[s,r]=[r,s],s.forEach(p),s.clear(),o=!1,u&&(u=!1,m.process(y))}};return m}const EC=40;function Gw(t,e){let s=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},u=()=>s=!0,d=Vc.reduce((N,L)=>(N[L]=jC(u),N),{}),{setup:f,read:p,resolveKeyframes:m,preUpdate:y,update:v,preRender:b,render:S,postRender:_}=d,E=()=>{const N=ys.useManualTiming?o.timestamp:performance.now();s=!1,ys.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(N-o.timestamp,EC),1)),o.timestamp=N,o.isProcessing=!0,f.process(o),p.process(o),m.process(o),y.process(o),v.process(o),b.process(o),S.process(o),_.process(o),o.isProcessing=!1,s&&e&&(r=!1,t(E))},T=()=>{s=!0,r=!0,o.isProcessing||t(E)};return{schedule:Vc.reduce((N,L)=>{const G=d[L];return N[L]=(F,U=!1,M=!1)=>(s||T(),G.schedule(F,U,M)),N},{}),cancel:N=>{for(let L=0;L<Vc.length;L++)d[Vc[L]].cancel(N)},state:o,steps:d}}const{schedule:Qe,cancel:na,state:Dt,steps:df}=Gw(typeof requestAnimationFrame<"u"?requestAnimationFrame:_n,!0);let Qc;function TC(){Qc=void 0}const It={now:()=>(Qc===void 0&&It.set(Dt.isProcessing||ys.useManualTiming?Dt.timestamp:performance.now()),Qc),set:t=>{Qc=t,queueMicrotask(TC)}},Fw=t=>e=>typeof e=="string"&&e.startsWith(t),Kw=Fw("--"),NC=Fw("var(--"),Gm=t=>NC(t)?AC.test(t.split("/*")[0].trim()):!1,AC=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ex(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const ji={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Wo={...ji,transform:t=>Gn(0,1,t)},Bc={...ji,default:1},Mo=t=>Math.round(t*1e5)/1e5,Fm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function kC(t){return t==null}const CC=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Km=(t,e)=>s=>!!(typeof s=="string"&&CC.test(s)&&s.startsWith(t)||e&&!kC(s)&&Object.prototype.hasOwnProperty.call(s,e)),Yw=(t,e,s)=>r=>{if(typeof r!="string")return r;const[o,u,d,f]=r.match(Fm);return{[t]:parseFloat(o),[e]:parseFloat(u),[s]:parseFloat(d),alpha:f!==void 0?parseFloat(f):1}},RC=t=>Gn(0,255,t),hf={...ji,transform:t=>Math.round(RC(t))},$a={test:Km("rgb","red"),parse:Yw("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:r=1})=>"rgba("+hf.transform(t)+", "+hf.transform(e)+", "+hf.transform(s)+", "+Mo(Wo.transform(r))+")"};function OC(t){let e="",s="",r="",o="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,s+=s,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const Jf={test:Km("#"),parse:OC,transform:$a.transform},rl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Gs=rl("deg"),Hn=rl("%"),ce=rl("px"),DC=rl("vh"),MC=rl("vw"),tx={...Hn,parse:t=>Hn.parse(t)/100,transform:t=>Hn.transform(t*100)},li={test:Km("hsl","hue"),parse:Yw("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:r=1})=>"hsla("+Math.round(t)+", "+Hn.transform(Mo(e))+", "+Hn.transform(Mo(s))+", "+Mo(Wo.transform(r))+")"},gt={test:t=>$a.test(t)||Jf.test(t)||li.test(t),parse:t=>$a.test(t)?$a.parse(t):li.test(t)?li.parse(t):Jf.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?$a.transform(t):li.transform(t),getAnimatableNone:t=>{const e=gt.parse(t);return e.alpha=0,gt.transform(e)}},zC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function LC(t){return isNaN(t)&&typeof t=="string"&&(t.match(Fm)?.length||0)+(t.match(zC)?.length||0)>0}const Xw="number",Ww="color",UC="var",PC="var(",nx="${}",VC=/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(t){const e=t.toString(),s=[],r={color:[],number:[],var:[]},o=[];let u=0;const f=e.replace(VC,p=>(gt.test(p)?(r.color.push(u),o.push(Ww),s.push(gt.parse(p))):p.startsWith(PC)?(r.var.push(u),o.push(UC),s.push(p)):(r.number.push(u),o.push(Xw),s.push(parseFloat(p))),++u,nx)).split(nx);return{values:s,split:f,indexes:r,types:o}}function Jw(t){return Jo(t).values}function Qw(t){const{split:e,types:s}=Jo(t),r=e.length;return o=>{let u="";for(let d=0;d<r;d++)if(u+=e[d],o[d]!==void 0){const f=s[d];f===Xw?u+=Mo(o[d]):f===Ww?u+=gt.transform(o[d]):u+=o[d]}return u}}const BC=t=>typeof t=="number"?0:gt.test(t)?gt.getAnimatableNone(t):t;function IC(t){const e=Jw(t);return Qw(t)(e.map(BC))}const sa={test:LC,parse:Jw,createTransformer:Qw,getAnimatableNone:IC};function ff(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function qC({hue:t,saturation:e,lightness:s,alpha:r}){t/=360,e/=100,s/=100;let o=0,u=0,d=0;if(!e)o=u=d=s;else{const f=s<.5?s*(1+e):s+e-s*e,p=2*s-f;o=ff(p,f,t+1/3),u=ff(p,f,t),d=ff(p,f,t-1/3)}return{red:Math.round(o*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:r}}function fu(t,e){return s=>s>0?e:t}const tt=(t,e,s)=>t+(e-t)*s,mf=(t,e,s)=>{const r=t*t,o=s*(e*e-r)+r;return o<0?0:Math.sqrt(o)},$C=[Jf,$a,li],HC=t=>$C.find(e=>e.test(t));function sx(t){const e=HC(t);if(!e)return!1;let s=e.parse(t);return e===li&&(s=qC(s)),s}const ax=(t,e)=>{const s=sx(t),r=sx(e);if(!s||!r)return fu(t,e);const o={...s};return u=>(o.red=mf(s.red,r.red,u),o.green=mf(s.green,r.green,u),o.blue=mf(s.blue,r.blue,u),o.alpha=tt(s.alpha,r.alpha,u),$a.transform(o))},Qf=new Set(["none","hidden"]);function GC(t,e){return Qf.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function FC(t,e){return s=>tt(t,e,s)}function Ym(t){return typeof t=="number"?FC:typeof t=="string"?Gm(t)?fu:gt.test(t)?ax:XC:Array.isArray(t)?Zw:typeof t=="object"?gt.test(t)?ax:KC:fu}function Zw(t,e){const s=[...t],r=s.length,o=t.map((u,d)=>Ym(u)(u,e[d]));return u=>{for(let d=0;d<r;d++)s[d]=o[d](u);return s}}function KC(t,e){const s={...t,...e},r={};for(const o in s)t[o]!==void 0&&e[o]!==void 0&&(r[o]=Ym(t[o])(t[o],e[o]));return o=>{for(const u in r)s[u]=r[u](o);return s}}function YC(t,e){const s=[],r={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const u=e.types[o],d=t.indexes[u][r[u]],f=t.values[d]??0;s[o]=f,r[u]++}return s}const XC=(t,e)=>{const s=sa.createTransformer(e),r=Jo(t),o=Jo(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Qf.has(t)&&!o.values.length||Qf.has(e)&&!r.values.length?GC(t,e):sl(Zw(YC(r,o),o.values),s):fu(t,e)};function e1(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?tt(t,e,s):Ym(t)(t,e)}const WC=t=>{const e=({timestamp:s})=>t(s);return{start:(s=!0)=>Qe.update(e,s),stop:()=>na(e),now:()=>Dt.isProcessing?Dt.timestamp:It.now()}},t1=(t,e,s=10)=>{let r="";const o=Math.max(Math.round(e/s),2);for(let u=0;u<o;u++)r+=Math.round(t(u/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},mu=2e4;function Xm(t){let e=0;const s=50;let r=t.next(e);for(;!r.done&&e<mu;)e+=s,r=t.next(e);return e>=mu?1/0:e}function JC(t,e=100,s){const r=s({...t,keyframes:[0,e]}),o=Math.min(Xm(r),mu);return{type:"keyframes",ease:u=>r.next(o*u).value/e,duration:Sn(o)}}const QC=5;function n1(t,e,s){const r=Math.max(e-QC,0);return Mw(s-t(r),e-r)}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},pf=.001;function ZC({duration:t=it.duration,bounce:e=it.bounce,velocity:s=it.velocity,mass:r=it.mass}){let o,u,d=1-e;d=Gn(it.minDamping,it.maxDamping,d),t=Gn(it.minDuration,it.maxDuration,Sn(t)),d<1?(o=m=>{const y=m*d,v=y*t,b=y-s,S=Zf(m,d),_=Math.exp(-v);return pf-b/S*_},u=m=>{const v=m*d*t,b=v*s+s,S=Math.pow(d,2)*Math.pow(m,2)*t,_=Math.exp(-v),E=Zf(Math.pow(m,2),d);return(-o(m)+pf>0?-1:1)*((b-S)*_)/E}):(o=m=>{const y=Math.exp(-m*t),v=(m-s)*t+1;return-pf+y*v},u=m=>{const y=Math.exp(-m*t),v=(s-m)*(t*t);return y*v});const f=5/t,p=tR(o,u,f);if(t=gs(t),isNaN(p))return{stiffness:it.stiffness,damping:it.damping,duration:t};{const m=Math.pow(p,2)*r;return{stiffness:m,damping:d*2*Math.sqrt(r*m),duration:t}}}const eR=12;function tR(t,e,s){let r=s;for(let o=1;o<eR;o++)r=r-t(r)/e(r);return r}function Zf(t,e){return t*Math.sqrt(1-e*e)}const nR=["duration","bounce"],sR=["stiffness","damping","mass"];function rx(t,e){return e.some(s=>t[s]!==void 0)}function aR(t){let e={velocity:it.velocity,stiffness:it.stiffness,damping:it.damping,mass:it.mass,isResolvedFromDuration:!1,...t};if(!rx(t,sR)&&rx(t,nR))if(t.visualDuration){const s=t.visualDuration,r=2*Math.PI/(s*1.2),o=r*r,u=2*Gn(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:it.mass,stiffness:o,damping:u}}else{const s=ZC(t);e={...e,...s,mass:it.mass},e.isResolvedFromDuration=!0}return e}function pu(t=it.visualDuration,e=it.bounce){const s=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=s;const u=s.keyframes[0],d=s.keyframes[s.keyframes.length-1],f={done:!1,value:u},{stiffness:p,damping:m,mass:y,duration:v,velocity:b,isResolvedFromDuration:S}=aR({...s,velocity:-Sn(s.velocity||0)}),_=b||0,E=m/(2*Math.sqrt(p*y)),T=d-u,A=Sn(Math.sqrt(p/y)),D=Math.abs(T)<5;r||(r=D?it.restSpeed.granular:it.restSpeed.default),o||(o=D?it.restDelta.granular:it.restDelta.default);let N;if(E<1){const G=Zf(A,E);N=F=>{const U=Math.exp(-E*A*F);return d-U*((_+E*A*T)/G*Math.sin(G*F)+T*Math.cos(G*F))}}else if(E===1)N=G=>d-Math.exp(-A*G)*(T+(_+A*T)*G);else{const G=A*Math.sqrt(E*E-1);N=F=>{const U=Math.exp(-E*A*F),M=Math.min(G*F,300);return d-U*((_+E*A*T)*Math.sinh(M)+G*T*Math.cosh(M))/G}}const L={calculatedDuration:S&&v||null,next:G=>{const F=N(G);if(S)f.done=G>=v;else{let U=G===0?_:0;E<1&&(U=G===0?gs(_):n1(N,G,F));const M=Math.abs(U)<=r,J=Math.abs(d-F)<=o;f.done=M&&J}return f.value=f.done?d:F,f},toString:()=>{const G=Math.min(Xm(L),mu),F=t1(U=>L.next(G*U).value,G,30);return G+"ms "+F},toTransition:()=>{}};return L}pu.applyToOptions=t=>{const e=JC(t,100,pu);return t.ease=e.ease,t.duration=gs(e.duration),t.type="keyframes",t};function em({keyframes:t,velocity:e=0,power:s=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:u=500,modifyTarget:d,min:f,max:p,restDelta:m=.5,restSpeed:y}){const v=t[0],b={done:!1,value:v},S=M=>f!==void 0&&M<f||p!==void 0&&M>p,_=M=>f===void 0?p:p===void 0||Math.abs(f-M)<Math.abs(p-M)?f:p;let E=s*e;const T=v+E,A=d===void 0?T:d(T);A!==T&&(E=A-v);const D=M=>-E*Math.exp(-M/r),N=M=>A+D(M),L=M=>{const J=D(M),re=N(M);b.done=Math.abs(J)<=m,b.value=b.done?A:re};let G,F;const U=M=>{S(b.value)&&(G=M,F=pu({keyframes:[b.value,_(b.value)],velocity:n1(N,M,b.value),damping:o,stiffness:u,restDelta:m,restSpeed:y}))};return U(0),{calculatedDuration:null,next:M=>{let J=!1;return!F&&G===void 0&&(J=!0,L(M),U(M)),G!==void 0&&M>=G?F.next(M-G):(!J&&L(M),b)}}}function rR(t,e,s){const r=[],o=s||ys.mix||e1,u=t.length-1;for(let d=0;d<u;d++){let f=o(t[d],t[d+1]);if(e){const p=Array.isArray(e)?e[d]||_n:e;f=sl(p,f)}r.push(f)}return r}function iR(t,e,{clamp:s=!0,ease:r,mixer:o}={}){const u=t.length;if(Bm(u===e.length),u===1)return()=>e[0];if(u===2&&e[0]===e[1])return()=>e[1];const d=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),e=[...e].reverse());const f=rR(e,r,o),p=f.length,m=y=>{if(d&&y<t[0])return e[0];let v=0;if(p>1)for(;v<t.length-2&&!(y<t[v+1]);v++);const b=Xo(t[v],t[v+1],y);return f[v](b)};return s?y=>m(Gn(t[0],t[u-1],y)):m}function oR(t,e){const s=t[t.length-1];for(let r=1;r<=e;r++){const o=Xo(0,e,r);t.push(tt(s,1,o))}}function lR(t){const e=[0];return oR(e,t.length-1),e}function cR(t,e){return t.map(s=>s*e)}function uR(t,e){return t.map(()=>e||$w).splice(0,t.length-1)}function zo({duration:t=300,keyframes:e,times:s,ease:r="easeInOut"}){const o=wC(r)?r.map(Z0):Z0(r),u={done:!1,value:e[0]},d=cR(s&&s.length===e.length?s:lR(e),t),f=iR(d,e,{ease:Array.isArray(o)?o:uR(e,o)});return{calculatedDuration:t,next:p=>(u.value=f(p),u.done=p>=t,u)}}const dR=t=>t!==null;function Wm(t,{repeat:e,repeatType:s="loop"},r,o=1){const u=t.filter(dR),f=o<0||e&&s!=="loop"&&e%2===1?0:u.length-1;return!f||r===void 0?u[f]:r}const hR={decay:em,inertia:em,tween:zo,keyframes:zo,spring:pu};function s1(t){typeof t.type=="string"&&(t.type=hR[t.type])}class Jm{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,s){return this.finished.then(e,s)}}const fR=t=>t/100;class Qm extends Jm{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:s}=this.options;s&&s.updatedAt!==It.now()&&this.tick(It.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;s1(e);const{type:s=zo,repeat:r=0,repeatDelay:o=0,repeatType:u,velocity:d=0}=e;let{keyframes:f}=e;const p=s||zo;p!==zo&&typeof f[0]!="number"&&(this.mixKeyframes=sl(fR,e1(f[0],f[1])),f=[0,100]);const m=p({...e,keyframes:f});u==="mirror"&&(this.mirroredGenerator=p({...e,keyframes:[...f].reverse(),velocity:-d})),m.calculatedDuration===null&&(m.calculatedDuration=Xm(m));const{calculatedDuration:y}=m;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=m}updateTime(e){const s=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(e,s=!1){const{generator:r,totalDuration:o,mixKeyframes:u,mirroredGenerator:d,resolvedDuration:f,calculatedDuration:p}=this;if(this.startTime===null)return r.next(0);const{delay:m=0,keyframes:y,repeat:v,repeatType:b,repeatDelay:S,type:_,onUpdate:E,finalKeyframe:T}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-o/this.speed,this.startTime)),s?this.currentTime=e:this.updateTime(e);const A=this.currentTime-m*(this.playbackSpeed>=0?1:-1),D=this.playbackSpeed>=0?A<0:A>o;this.currentTime=Math.max(A,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let N=this.currentTime,L=r;if(v){const M=Math.min(this.currentTime,o)/f;let J=Math.floor(M),re=M%1;!re&&M>=1&&(re=1),re===1&&J--,J=Math.min(J,v+1),J%2&&(b==="reverse"?(re=1-re,S&&(re-=S/f)):b==="mirror"&&(L=d)),N=Gn(0,1,re)*f}const G=D?{done:!1,value:y[0]}:L.next(N);u&&(G.value=u(G.value));let{done:F}=G;!D&&p!==null&&(F=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const U=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&F);return U&&_!==em&&(G.value=Wm(y,this.options,T,this.speed)),E&&E(G.value),U&&this.finish(),G}then(e,s){return this.finished.then(e,s)}get duration(){return Sn(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Sn(e)}get time(){return Sn(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(It.now());const s=this.playbackSpeed!==e;this.playbackSpeed=e,s&&(this.time=Sn(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=WC,startTime:s}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=s??r),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(It.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 mR(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ha=t=>t*180/Math.PI,tm=t=>{const e=Ha(Math.atan2(t[1],t[0]));return nm(e)},pR={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:tm,rotateZ:tm,skewX:t=>Ha(Math.atan(t[1])),skewY:t=>Ha(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},nm=t=>(t=t%360,t<0&&(t+=360),t),ix=tm,ox=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),lx=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),gR={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ox,scaleY:lx,scale:t=>(ox(t)+lx(t))/2,rotateX:t=>nm(Ha(Math.atan2(t[6],t[5]))),rotateY:t=>nm(Ha(Math.atan2(-t[2],t[0]))),rotateZ:ix,rotate:ix,skewX:t=>Ha(Math.atan(t[4])),skewY:t=>Ha(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function sm(t){return t.includes("scale")?1:0}function am(t,e){if(!t||t==="none")return sm(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(s)r=gR,o=s;else{const f=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=pR,o=f}if(!o)return sm(e);const u=r[e],d=o[1].split(",").map(vR);return typeof u=="function"?u(d):d[u]}const yR=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return am(s,e)};function vR(t){return parseFloat(t.trim())}const Ei=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ti=new Set(Ei),cx=t=>t===ji||t===ce,xR=new Set(["x","y","z"]),bR=Ei.filter(t=>!xR.has(t));function wR(t){const e=[];return bR.forEach(s=>{const r=t.getValue(s);r!==void 0&&(e.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),e}const Ws={width:({x:t},{paddingLeft:e="0",paddingRight:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),height:({y:t},{paddingTop:e="0",paddingBottom:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>am(e,"x"),y:(t,{transform:e})=>am(e,"y")};Ws.translateX=Ws.x;Ws.translateY=Ws.y;const Fa=new Set;let rm=!1,im=!1,om=!1;function a1(){if(im){const t=Array.from(Fa).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),s=new Map;e.forEach(r=>{const o=wR(r);o.length&&(s.set(r,o),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const o=s.get(r);o&&o.forEach(([u,d])=>{r.getValue(u)?.set(d)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}im=!1,rm=!1,Fa.forEach(t=>t.complete(om)),Fa.clear()}function r1(){Fa.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(im=!0)})}function SR(){om=!0,r1(),a1(),om=!1}class Zm{constructor(e,s,r,o,u,d=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=s,this.name=r,this.motionValue=o,this.element=u,this.isAsync=d}scheduleResolve(){this.state="scheduled",this.isAsync?(Fa.add(this),rm||(rm=!0,Qe.read(r1),Qe.resolveKeyframes(a1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:r,motionValue:o}=this;if(e[0]===null){const u=o?.get(),d=e[e.length-1];if(u!==void 0)e[0]=u;else if(r&&s){const f=r.readValue(s,d);f!=null&&(e[0]=f)}e[0]===void 0&&(e[0]=d),o&&u===void 0&&o.set(e[0])}mR(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Fa.delete(this)}cancel(){this.state==="scheduled"&&(Fa.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const _R=t=>t.startsWith("--");function jR(t,e,s){_R(e)?t.style.setProperty(e,s):t.style[e]=s}const ER=Im(()=>window.ScrollTimeline!==void 0),TR={};function NR(t,e){const s=Im(t);return()=>TR[e]??s()}const i1=NR(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Co=([t,e,s,r])=>`cubic-bezier(${t}, ${e}, ${s}, ${r})`,ux={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Co([0,.65,.55,1]),circOut:Co([.55,0,1,.45]),backIn:Co([.31,.01,.66,-.59]),backOut:Co([.33,1.53,.69,.99])};function o1(t,e){if(t)return typeof t=="function"?i1()?t1(t,e):"ease-out":Hw(t)?Co(t):Array.isArray(t)?t.map(s=>o1(s,e)||ux.easeOut):ux[t]}function AR(t,e,s,{delay:r=0,duration:o=300,repeat:u=0,repeatType:d="loop",ease:f="easeOut",times:p}={},m=void 0){const y={[e]:s};p&&(y.offset=p);const v=o1(f,o);Array.isArray(v)&&(y.easing=v);const b={delay:r,duration:o,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"};return m&&(b.pseudoElement=m),t.animate(y,b)}function l1(t){return typeof t=="function"&&"applyToOptions"in t}function kR({type:t,...e}){return l1(t)&&i1()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class CR extends Jm{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:s,name:r,keyframes:o,pseudoElement:u,allowFlatten:d=!1,finalKeyframe:f,onComplete:p}=e;this.isPseudoElement=!!u,this.allowFlatten=d,this.options=e,Bm(typeof e.type!="string");const m=kR(e);this.animation=AR(s,r,o,m,u),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=Wm(o,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):jR(s,r,y),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 Sn(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Sn(e)}get time(){return Sn(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:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&ER()?(this.animation.timeline=e,_n):s(this)}}const c1={anticipate:Bw,backInOut:Vw,circInOut:qw};function RR(t){return t in c1}function OR(t){typeof t.ease=="string"&&RR(t.ease)&&(t.ease=c1[t.ease])}const gf=10;class DR extends CR{constructor(e){OR(e),s1(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:s,onUpdate:r,onComplete:o,element:u,...d}=this.options;if(!s)return;if(e!==void 0){s.set(e);return}const f=new Qm({...d,autoplay:!1}),p=Math.max(gf,It.now()-this.startTime),m=Gn(0,gf,p-gf);s.setWithVelocity(f.sample(Math.max(0,p-m)).value,f.sample(p).value,m),f.stop()}}const dx=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(sa.test(t)||t==="0")&&!t.startsWith("url("));function MR(t){const e=t[0];if(t.length===1)return!0;for(let s=0;s<t.length;s++)if(t[s]!==e)return!0}function zR(t,e,s,r){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const u=t[t.length-1],d=dx(o,e),f=dx(u,e);return!d||!f?!1:MR(t)||(s==="spring"||l1(s))&&r}function lm(t){t.duration=0,t.type="keyframes"}const LR=new Set(["opacity","clipPath","filter","transform"]),UR=Im(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function PR(t){const{motionValue:e,name:s,repeatDelay:r,repeatType:o,damping:u,type:d}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:m}=e.owner.getProps();return UR()&&s&&LR.has(s)&&(s!=="transform"||!m)&&!p&&!r&&o!=="mirror"&&u!==0&&d!=="inertia"}const VR=40;class BR extends Jm{constructor({autoplay:e=!0,delay:s=0,type:r="keyframes",repeat:o=0,repeatDelay:u=0,repeatType:d="loop",keyframes:f,name:p,motionValue:m,element:y,...v}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=It.now();const b={autoplay:e,delay:s,type:r,repeat:o,repeatDelay:u,repeatType:d,name:p,motionValue:m,element:y,...v},S=y?.KeyframeResolver||Zm;this.keyframeResolver=new S(f,(_,E,T)=>this.onKeyframesResolved(_,E,b,!T),p,m,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,s,r,o){this.keyframeResolver=void 0;const{name:u,type:d,velocity:f,delay:p,isHandoff:m,onUpdate:y}=r;this.resolvedAt=It.now(),zR(e,u,d,f)||((ys.instantAnimations||!p)&&y?.(Wm(e,r,s)),e[0]=e[e.length-1],lm(r),r.repeat=0);const b={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>VR?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...r,keyframes:e},S=!m&&PR(b),_=b.motionValue?.owner?.current,E=S?new DR({...b,element:_}):new Qm(b);E.finished.then(()=>{this.notifyFinished()}).catch(_n),this.pendingTimeline&&(this.stopTimeline=E.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=E}get finished(){return this._animation?this.animation.finished:this._finished}then(e,s){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),SR()),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 u1(t,e,s,r=0,o=1){const u=Array.from(t).sort((m,y)=>m.sortNodePosition(y)).indexOf(e),d=t.size,f=(d-1)*r;return typeof s=="function"?s(u,d):o===1?u*r:f-u*r}const IR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function qR(t){const e=IR.exec(t);if(!e)return[,];const[,s,r,o]=e;return[`--${s??r}`,o]}function d1(t,e,s=1){const[r,o]=qR(t);if(!r)return;const u=window.getComputedStyle(e).getPropertyValue(r);if(u){const d=u.trim();return Rw(d)?parseFloat(d):d}return Gm(o)?d1(o,e,s+1):o}const $R={type:"spring",stiffness:500,damping:25,restSpeed:10},HR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),GR={type:"keyframes",duration:.8},FR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KR=(t,{keyframes:e})=>e.length>2?GR:Ti.has(t)?t.startsWith("scale")?HR(e[1]):$R:FR,YR=t=>t!==null;function XR(t,{repeat:e,repeatType:s="loop"},r){const o=t.filter(YR),u=e&&s!=="loop"&&e%2===1?0:o.length-1;return o[u]}function ep(t,e){return t?.[e]??t?.default??t}function WR({when:t,delay:e,delayChildren:s,staggerChildren:r,staggerDirection:o,repeat:u,repeatType:d,repeatDelay:f,from:p,elapsed:m,...y}){return!!Object.keys(y).length}const tp=(t,e,s,r={},o,u)=>d=>{const f=ep(r,t)||{},p=f.delay||r.delay||0;let{elapsed:m=0}=r;m=m-gs(p);const y={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:e.getVelocity(),...f,delay:-m,onUpdate:b=>{e.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{d(),f.onComplete&&f.onComplete()},name:t,motionValue:e,element:u?void 0:o};WR(f)||Object.assign(y,KR(t,y)),y.duration&&(y.duration=gs(y.duration)),y.repeatDelay&&(y.repeatDelay=gs(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let v=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(lm(y),y.delay===0&&(v=!0)),(ys.instantAnimations||ys.skipAnimations)&&(v=!0,lm(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,v&&!u&&e.get()!==void 0){const b=XR(y.keyframes,f);if(b!==void 0){Qe.update(()=>{y.onUpdate(b),y.onComplete()});return}}return f.isSync?new Qm(y):new BR(y)};function hx(t){const e=[{},{}];return t?.values.forEach((s,r)=>{e[0][r]=s.get(),e[1][r]=s.getVelocity()}),e}function np(t,e,s,r){if(typeof e=="function"){const[o,u]=hx(r);e=e(s!==void 0?s:t.custom,o,u)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,u]=hx(r);e=e(s!==void 0?s:t.custom,o,u)}return e}function mi(t,e,s){const r=t.getProps();return np(r,e,s!==void 0?s:r.custom,t)}const h1=new Set(["width","height","top","left","right","bottom",...Ei]),fx=30,JR=t=>!isNaN(parseFloat(t));class QR{constructor(e,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const o=It.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const u of this.dependents)u.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=s.owner}setCurrent(e){this.current=e,this.updatedAt=It.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=JR(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,s){this.events[e]||(this.events[e]=new qm);const r=this.events[e].add(s);return e==="change"?()=>{r(),Qe.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,s){this.passiveEffect=e,this.stopPassiveEffect=s}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,s=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&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=It.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>fx)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,fx);return Mw(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(e){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=e(s),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 xi(t,e){return new QR(t,e)}const cm=t=>Array.isArray(t);function ZR(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,xi(s))}function eO(t){return cm(t)?t[t.length-1]||0:t}function tO(t,e){const s=mi(t,e);let{transitionEnd:r={},transition:o={},...u}=s||{};u={...u,...r};for(const d in u){const f=eO(u[d]);ZR(t,d,f)}}const Lt=t=>!!(t&&t.getVelocity);function nO(t){return!!(Lt(t)&&t.add)}function um(t,e){const s=t.getValue("willChange");if(nO(s))return s.add(e);if(!s&&ys.WillChange){const r=new ys.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function sp(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const sO="framerAppearId",f1="data-"+sp(sO);function m1(t){return t.props[f1]}function aO({protectedKeys:t,needsAnimating:e},s){const r=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,r}function p1(t,e,{delay:s=0,transitionOverride:r,type:o}={}){let{transition:u=t.getDefaultTransition(),transitionEnd:d,...f}=e;const p=u?.reduceMotion;r&&(u=r);const m=[],y=o&&t.animationState&&t.animationState.getState()[o];for(const v in f){const b=t.getValue(v,t.latestValues[v]??null),S=f[v];if(S===void 0||y&&aO(y,v))continue;const _={delay:s,...ep(u||{},v)},E=b.get();if(E!==void 0&&!b.isAnimating&&!Array.isArray(S)&&S===E&&!_.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const N=m1(t);if(N){const L=window.MotionHandoffAnimation(N,v,Qe);L!==null&&(_.startTime=L,T=!0)}}um(t,v);const A=p??t.shouldReduceMotion;b.start(tp(v,b,S,A&&h1.has(v)?{type:!1}:_,t,T));const D=b.animation;D&&m.push(D)}return d&&Promise.all(m).then(()=>{Qe.update(()=>{d&&tO(t,d)})}),m}function dm(t,e,s={}){const r=mi(t,e,s.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(o=s.transitionOverride);const u=r?()=>Promise.all(p1(t,r,s)):()=>Promise.resolve(),d=t.variantChildren&&t.variantChildren.size?(p=0)=>{const{delayChildren:m=0,staggerChildren:y,staggerDirection:v}=o;return rO(t,e,p,m,y,v,s)}:()=>Promise.resolve(),{when:f}=o;if(f){const[p,m]=f==="beforeChildren"?[u,d]:[d,u];return p().then(()=>m())}else return Promise.all([u(),d(s.delay)])}function rO(t,e,s=0,r=0,o=0,u=1,d){const f=[];for(const p of t.variantChildren)p.notify("AnimationStart",e),f.push(dm(p,e,{...d,delay:s+(typeof r=="function"?0:r)+u1(t.variantChildren,p,r,o,u)}).then(()=>p.notify("AnimationComplete",e)));return Promise.all(f)}function iO(t,e,s={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const o=e.map(u=>dm(t,u,s));r=Promise.all(o)}else if(typeof e=="string")r=dm(t,e,s);else{const o=typeof e=="function"?mi(t,e,s.custom):e;r=Promise.all(p1(t,o,s))}return r.then(()=>{t.notify("AnimationComplete",e)})}const oO={test:t=>t==="auto",parse:t=>t},g1=t=>e=>e.test(t),y1=[ji,ce,Hn,Gs,MC,DC,oO],mx=t=>y1.find(g1(t));function lO(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Dw(t):!0}const cO=new Set(["brightness","contrast","saturate","opacity"]);function uO(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=s.match(Fm)||[];if(!r)return t;const o=s.replace(r,"");let u=cO.has(e)?1:0;return r!==s&&(u*=100),e+"("+u+o+")"}const dO=/\b([a-z-]*)\(.*?\)/gu,hm={...sa,getAnimatableNone:t=>{const e=t.match(dO);return e?e.map(uO).join(" "):t}},px={...ji,transform:Math.round},hO={rotate:Gs,rotateX:Gs,rotateY:Gs,rotateZ:Gs,scale:Bc,scaleX:Bc,scaleY:Bc,scaleZ:Bc,skew:Gs,skewX:Gs,skewY:Gs,distance:ce,translateX:ce,translateY:ce,translateZ:ce,x:ce,y:ce,z:ce,perspective:ce,transformPerspective:ce,opacity:Wo,originX:tx,originY:tx,originZ:ce},ap={borderWidth:ce,borderTopWidth:ce,borderRightWidth:ce,borderBottomWidth:ce,borderLeftWidth:ce,borderRadius:ce,borderTopLeftRadius:ce,borderTopRightRadius:ce,borderBottomRightRadius:ce,borderBottomLeftRadius:ce,width:ce,maxWidth:ce,height:ce,maxHeight:ce,top:ce,right:ce,bottom:ce,left:ce,inset:ce,insetBlock:ce,insetBlockStart:ce,insetBlockEnd:ce,insetInline:ce,insetInlineStart:ce,insetInlineEnd:ce,padding:ce,paddingTop:ce,paddingRight:ce,paddingBottom:ce,paddingLeft:ce,paddingBlock:ce,paddingBlockStart:ce,paddingBlockEnd:ce,paddingInline:ce,paddingInlineStart:ce,paddingInlineEnd:ce,margin:ce,marginTop:ce,marginRight:ce,marginBottom:ce,marginLeft:ce,marginBlock:ce,marginBlockStart:ce,marginBlockEnd:ce,marginInline:ce,marginInlineStart:ce,marginInlineEnd:ce,fontSize:ce,backgroundPositionX:ce,backgroundPositionY:ce,...hO,zIndex:px,fillOpacity:Wo,strokeOpacity:Wo,numOctaves:px},fO={...ap,color:gt,backgroundColor:gt,outlineColor:gt,fill:gt,stroke:gt,borderColor:gt,borderTopColor:gt,borderRightColor:gt,borderBottomColor:gt,borderLeftColor:gt,filter:hm,WebkitFilter:hm},v1=t=>fO[t];function x1(t,e){let s=v1(t);return s!==hm&&(s=sa),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const mO=new Set(["auto","none","0"]);function pO(t,e,s){let r=0,o;for(;r<t.length&&!o;){const u=t[r];typeof u=="string"&&!mO.has(u)&&Jo(u).values.length&&(o=t[r]),r++}if(o&&s)for(const u of e)t[u]=x1(s,o)}class gO extends Zm{constructor(e,s,r,o,u){super(e,s,r,o,u,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let y=0;y<e.length;y++){let v=e[y];if(typeof v=="string"&&(v=v.trim(),Gm(v))){const b=d1(v,s.current);b!==void 0&&(e[y]=b),y===e.length-1&&(this.finalKeyframe=v)}}if(this.resolveNoneKeyframes(),!h1.has(r)||e.length!==2)return;const[o,u]=e,d=mx(o),f=mx(u),p=ex(o),m=ex(u);if(p!==m&&Ws[r]){this.needsMeasurement=!0;return}if(d!==f)if(cx(d)&&cx(f))for(let y=0;y<e.length;y++){const v=e[y];typeof v=="string"&&(e[y]=parseFloat(v))}else Ws[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,r=[];for(let o=0;o<e.length;o++)(e[o]===null||lO(e[o]))&&r.push(o);r.length&&pO(e,r,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ws[r](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const o=s[s.length-1];o!==void 0&&e.getValue(r,o).jump(o,!1)}measureEndState(){const{element:e,name:s,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(s);o&&o.jump(this.measuredOrigin,!1);const u=r.length-1,d=r[u];r[u]=Ws[s](e.measureViewportBox(),window.getComputedStyle(e.current)),d!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=d),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,p])=>{e.getValue(f).set(p)}),this.resolveNoneKeyframes()}}function yO(t,e,s){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const o=s?.[t]??r.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t).filter(r=>r!=null)}const b1=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function fm(t){return Ow(t)&&"offsetHeight"in t}const{schedule:rp}=Gw(queueMicrotask,!1),Rn={x:!1,y:!1};function w1(){return Rn.x||Rn.y}function vO(t){return t==="x"||t==="y"?Rn[t]?null:(Rn[t]=!0,()=>{Rn[t]=!1}):Rn.x||Rn.y?null:(Rn.x=Rn.y=!0,()=>{Rn.x=Rn.y=!1})}function S1(t,e){const s=yO(t),r=new AbortController,o={passive:!0,...e,signal:r.signal};return[s,o,()=>r.abort()]}function gx(t){return!(t.pointerType==="touch"||w1())}function xO(t,e,s={}){const[r,o,u]=S1(t,s),d=f=>{if(!gx(f))return;const{target:p}=f,m=e(p,f);if(typeof m!="function"||!p)return;const y=v=>{gx(v)&&(m(v),p.removeEventListener("pointerleave",y))};p.addEventListener("pointerleave",y,o)};return r.forEach(f=>{f.addEventListener("pointerenter",d,o)}),u}const _1=(t,e)=>e?t===e?!0:_1(t,e.parentElement):!1,ip=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,bO=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function j1(t){return bO.has(t.tagName)||t.isContentEditable===!0}const Zc=new WeakSet;function yx(t){return e=>{e.key==="Enter"&&t(e)}}function yf(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const wO=(t,e)=>{const s=t.currentTarget;if(!s)return;const r=yx(()=>{if(Zc.has(s))return;yf(s,"down");const o=yx(()=>{yf(s,"up")}),u=()=>yf(s,"cancel");s.addEventListener("keyup",o,e),s.addEventListener("blur",u,e)});s.addEventListener("keydown",r,e),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),e)};function vx(t){return ip(t)&&!w1()}function SO(t,e,s={}){const[r,o,u]=S1(t,s),d=f=>{const p=f.currentTarget;if(!vx(f))return;Zc.add(p);const m=e(p,f),y=(S,_)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",b),Zc.has(p)&&Zc.delete(p),vx(S)&&typeof m=="function"&&m(S,{success:_})},v=S=>{y(S,p===window||p===document||s.useGlobalTarget||_1(p,S.target))},b=S=>{y(S,!1)};window.addEventListener("pointerup",v,o),window.addEventListener("pointercancel",b,o)};return r.forEach(f=>{(s.useGlobalTarget?window:f).addEventListener("pointerdown",d,o),fm(f)&&(f.addEventListener("focus",m=>wO(m,o)),!j1(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),u}function E1(t){return Ow(t)&&"ownerSVGElement"in t}function _O(t){return E1(t)&&t.tagName==="svg"}const jO=[...y1,gt,sa],EO=t=>jO.find(g1(t)),xx=()=>({translate:0,scale:1,origin:0,originPoint:0}),ci=()=>({x:xx(),y:xx()}),bx=()=>({min:0,max:0}),wt=()=>({x:bx(),y:bx()}),mm={current:null},T1={current:!1},TO=typeof window<"u";function NO(){if(T1.current=!0,!!TO)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>mm.current=t.matches;t.addEventListener("change",e),e()}else mm.current=!1}const AO=new WeakMap;function Au(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Qo(t){return typeof t=="string"||Array.isArray(t)}const op=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lp=["initial",...op];function ku(t){return Au(t.animate)||lp.some(e=>Qo(t[e]))}function N1(t){return!!(ku(t)||t.variants)}function kO(t,e,s){for(const r in e){const o=e[r],u=s[r];if(Lt(o))t.addValue(r,o);else if(Lt(u))t.addValue(r,xi(o,{owner:t}));else if(u!==o)if(t.hasValue(r)){const d=t.getValue(r);d.liveStyle===!0?d.jump(o):d.hasAnimated||d.set(o)}else{const d=t.getStaticValue(r);t.addValue(r,xi(d!==void 0?d:o,{owner:t}))}}for(const r in s)e[r]===void 0&&t.removeValue(r);return e}const wx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let gu={};function A1(t){gu=t}function CO(){return gu}class RO{scrapeMotionValuesFromProps(e,s,r){return{}}constructor({parent:e,props:s,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:u,visualState:d},f={}){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 b=It.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,Qe.render(this.render,!1,!0))};const{latestValues:p,renderState:m}=d;this.latestValues=p,this.baseTarget={...p},this.initialValues=s.initial?{...p}:{},this.renderState=m,this.parent=e,this.props=s,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=f,this.blockInitialAnimation=!!u,this.isControllingVariants=ku(s),this.isVariantNode=N1(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:y,...v}=this.scrapeMotionValuesFromProps(s,{},this);for(const b in v){const S=v[b];p[b]!==void 0&&Lt(S)&&S.set(p[b])}}mount(e){this.current=e,AO.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((s,r)=>this.bindToMotionValue(r,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(T1.current||NO(),this.shouldReduceMotion=mm.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),na(this.notifyUpdate),na(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 s=this.features[e];s&&(s.unmount(),s.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,s){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Ti.has(e);r&&this.onBindTransform&&this.onBindTransform();const o=s.on("change",d=>{this.latestValues[e]=d,this.props.onUpdate&&Qe.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let u;typeof window<"u"&&window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{o(),u&&u(),s.owner&&s.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 gu){const s=gu[e];if(!s)continue;const{isEnabled:r,Feature:o}=s;if(!this.features[e]&&o&&r(this.props)&&(this.features[e]=new o(this)),this.features[e]){const u=this.features[e];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):wt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,s){this.latestValues[e]=s}update(e,s){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<wx.length;r++){const o=wx[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const u="on"+o,d=e[u];d&&(this.propEventSubscriptions[o]=this.on(o,d))}this.prevMotionValues=kO(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 s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(e),()=>s.variantChildren.delete(e)}addValue(e,s){const r=this.values.get(e);s!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,s),this.values.set(e,s),this.latestValues[e]=s.get())}removeValue(e){this.values.delete(e);const s=this.valueSubscriptions.get(e);s&&(s(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,s){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&s!==void 0&&(r=xi(s===null?void 0:s,{owner:this}),this.addValue(e,r)),r}readValue(e,s){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(Rw(r)||Dw(r))?r=parseFloat(r):!EO(r)&&sa.test(s)&&(r=x1(e,s)),this.setBaseTarget(e,Lt(r)?r.get():r)),Lt(r)?r.get():r}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){const{initial:s}=this.props;let r;if(typeof s=="string"||typeof s=="object"){const u=np(this.props,s,this.presenceContext?.custom);u&&(r=u[e])}if(s&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Lt(o)?o:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new qm),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}scheduleRenderMicrotask(){rp.render(this.render)}}class k1 extends RO{constructor(){super(...arguments),this.KeyframeResolver=gO}sortInstanceNodePosition(e,s){return e.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(e,s){const r=e.style;return r?r[s]:void 0}removeValueFromRenderState(e,{vars:s,style:r}){delete s[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Lt(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class ia{constructor(e){this.isMounted=!1,this.node=e}update(){}}function C1({top:t,left:e,right:s,bottom:r}){return{x:{min:e,max:s},y:{min:t,max:r}}}function OO({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function DO(t,e){if(!e)return t;const s=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function vf(t){return t===void 0||t===1}function pm({scale:t,scaleX:e,scaleY:s}){return!vf(t)||!vf(e)||!vf(s)}function La(t){return pm(t)||R1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function R1(t){return Sx(t.x)||Sx(t.y)}function Sx(t){return t&&t!=="0%"}function yu(t,e,s){const r=t-s,o=e*r;return s+o}function _x(t,e,s,r,o){return o!==void 0&&(t=yu(t,o,r)),yu(t,s,r)+e}function gm(t,e=0,s=1,r,o){t.min=_x(t.min,e,s,r,o),t.max=_x(t.max,e,s,r,o)}function O1(t,{x:e,y:s}){gm(t.x,e.translate,e.scale,e.originPoint),gm(t.y,s.translate,s.scale,s.originPoint)}const jx=.999999999999,Ex=1.0000000000001;function MO(t,e,s,r=!1){const o=s.length;if(!o)return;e.x=e.y=1;let u,d;for(let f=0;f<o;f++){u=s[f],d=u.projectionDelta;const{visualElement:p}=u.options;p&&p.props.style&&p.props.style.display==="contents"||(r&&u.options.layoutScroll&&u.scroll&&u!==u.root&&di(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(e.x*=d.x.scale,e.y*=d.y.scale,O1(t,d)),r&&La(u.latestValues)&&di(t,u.latestValues))}e.x<Ex&&e.x>jx&&(e.x=1),e.y<Ex&&e.y>jx&&(e.y=1)}function ui(t,e){t.min=t.min+e,t.max=t.max+e}function Tx(t,e,s,r,o=.5){const u=tt(t.min,t.max,o);gm(t,e,s,u,r)}function di(t,e){Tx(t.x,e.x,e.scaleX,e.scale,e.originX),Tx(t.y,e.y,e.scaleY,e.scale,e.originY)}function D1(t,e){return C1(DO(t.getBoundingClientRect(),e))}function zO(t,e,s){const r=D1(t,s),{scroll:o}=e;return o&&(ui(r.x,o.offset.x),ui(r.y,o.offset.y)),r}const LO={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},UO=Ei.length;function PO(t,e,s){let r="",o=!0;for(let u=0;u<UO;u++){const d=Ei[u],f=t[d];if(f===void 0)continue;let p=!0;if(typeof f=="number")p=f===(d.startsWith("scale")?1:0);else{const m=parseFloat(f);p=d.startsWith("scale")?m===1:m===0}if(!p||s){const m=b1(f,ap[d]);if(!p){o=!1;const y=LO[d]||d;r+=`${y}(${m}) `}s&&(e[d]=m)}}return r=r.trim(),s?r=s(e,o?"":r):o&&(r="none"),r}function cp(t,e,s){const{style:r,vars:o,transformOrigin:u}=t;let d=!1,f=!1;for(const p in e){const m=e[p];if(Ti.has(p)){d=!0;continue}else if(Kw(p)){o[p]=m;continue}else{const y=b1(m,ap[p]);p.startsWith("origin")?(f=!0,u[p]=y):r[p]=y}}if(e.transform||(d||s?r.transform=PO(e,t.transform,s):r.transform&&(r.transform="none")),f){const{originX:p="50%",originY:m="50%",originZ:y=0}=u;r.transformOrigin=`${p} ${m} ${y}`}}function M1(t,{style:e,vars:s},r,o){const u=t.style;let d;for(d in e)u[d]=e[d];o?.applyProjectionStyles(u,r);for(d in s)u.setProperty(d,s[d])}function Nx(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const No={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(ce.test(t))t=parseFloat(t);else return t;const s=Nx(t,e.target.x),r=Nx(t,e.target.y);return`${s}% ${r}%`}},VO={correct:(t,{treeScale:e,projectionDelta:s})=>{const r=t,o=sa.parse(t);if(o.length>5)return r;const u=sa.createTransformer(t),d=typeof o[0]!="number"?1:0,f=s.x.scale*e.x,p=s.y.scale*e.y;o[0+d]/=f,o[1+d]/=p;const m=tt(f,p,.5);return typeof o[2+d]=="number"&&(o[2+d]/=m),typeof o[3+d]=="number"&&(o[3+d]/=m),u(o)}},ym={borderRadius:{...No,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:No,borderTopRightRadius:No,borderBottomLeftRadius:No,borderBottomRightRadius:No,boxShadow:VO};function z1(t,{layout:e,layoutId:s}){return Ti.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!ym[t]||t==="opacity")}function up(t,e,s){const r=t.style,o=e?.style,u={};if(!r)return u;for(const d in r)(Lt(r[d])||o&&Lt(o[d])||z1(d,t)||s?.getValue(d)?.liveStyle!==void 0)&&(u[d]=r[d]);return u}function BO(t){return window.getComputedStyle(t)}class IO extends k1{constructor(){super(...arguments),this.type="html",this.renderInstance=M1}readValueFromInstance(e,s){if(Ti.has(s))return this.projection?.isProjecting?sm(s):yR(e,s);{const r=BO(e),o=(Kw(s)?r.getPropertyValue(s):r[s])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:s}){return D1(e,s)}build(e,s,r){cp(e,s,r.transformTemplate)}scrapeMotionValuesFromProps(e,s,r){return up(e,s,r)}}const qO={offset:"stroke-dashoffset",array:"stroke-dasharray"},$O={offset:"strokeDashoffset",array:"strokeDasharray"};function HO(t,e,s=1,r=0,o=!0){t.pathLength=1;const u=o?qO:$O;t[u.offset]=`${-r}`,t[u.array]=`${e} ${s}`}const GO=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function L1(t,{attrX:e,attrY:s,attrScale:r,pathLength:o,pathSpacing:u=1,pathOffset:d=0,...f},p,m,y){if(cp(t,f,m),p){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:v,style:b}=t;v.transform&&(b.transform=v.transform,delete v.transform),(b.transform||v.transformOrigin)&&(b.transformOrigin=v.transformOrigin??"50% 50%",delete v.transformOrigin),b.transform&&(b.transformBox=y?.transformBox??"fill-box",delete v.transformBox);for(const S of GO)v[S]!==void 0&&(b[S]=v[S],delete v[S]);e!==void 0&&(v.x=e),s!==void 0&&(v.y=s),r!==void 0&&(v.scale=r),o!==void 0&&HO(v,o,u,d,!1)}const U1=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"]),P1=t=>typeof t=="string"&&t.toLowerCase()==="svg";function FO(t,e,s,r){M1(t,e,void 0,r);for(const o in e.attrs)t.setAttribute(U1.has(o)?o:sp(o),e.attrs[o])}function V1(t,e,s){const r=up(t,e,s);for(const o in t)if(Lt(t[o])||Lt(e[o])){const u=Ei.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[u]=t[o]}return r}class KO extends k1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=wt}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(Ti.has(s)){const r=v1(s);return r&&r.default||0}return s=U1.has(s)?s:sp(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,r){return V1(e,s,r)}build(e,s,r){L1(e,s,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,s,r,o){FO(e,s,r,o)}mount(e){this.isSVGTag=P1(e.tagName),super.mount(e)}}const YO=lp.length;function B1(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?B1(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<YO;s++){const r=lp[s],o=t.props[r];(Qo(o)||o===!1)&&(e[r]=o)}return e}function I1(t,e){if(!Array.isArray(e))return!1;const s=e.length;if(s!==t.length)return!1;for(let r=0;r<s;r++)if(e[r]!==t[r])return!1;return!0}const XO=[...op].reverse(),WO=op.length;function JO(t){return e=>Promise.all(e.map(({animation:s,options:r})=>iO(t,s,r)))}function QO(t){let e=JO(t),s=Ax(),r=!0;const o=p=>(m,y)=>{const v=mi(t,y,p==="exit"?t.presenceContext?.custom:void 0);if(v){const{transition:b,transitionEnd:S,..._}=v;m={...m,..._,...S}}return m};function u(p){e=p(t)}function d(p){const{props:m}=t,y=B1(t.parent)||{},v=[],b=new Set;let S={},_=1/0;for(let T=0;T<WO;T++){const A=XO[T],D=s[A],N=m[A]!==void 0?m[A]:y[A],L=Qo(N),G=A===p?D.isActive:null;G===!1&&(_=T);let F=N===y[A]&&N!==m[A]&&L;if(F&&r&&t.manuallyAnimateOnMount&&(F=!1),D.protectedKeys={...S},!D.isActive&&G===null||!N&&!D.prevProp||Au(N)||typeof N=="boolean")continue;const U=ZO(D.prevProp,N);let M=U||A===p&&D.isActive&&!F&&L||T>_&&L,J=!1;const re=Array.isArray(N)?N:[N];let xe=re.reduce(o(A),{});G===!1&&(xe={});const{prevResolvedValues:ue={}}=D,Ie={...ue,...xe},Ve=I=>{M=!0,b.has(I)&&(J=!0,b.delete(I)),D.needsAnimating[I]=!0;const B=t.getValue(I);B&&(B.liveStyle=!1)};for(const I in Ie){const B=xe[I],de=ue[I];if(S.hasOwnProperty(I))continue;let Se=!1;cm(B)&&cm(de)?Se=!I1(B,de):Se=B!==de,Se?B!=null?Ve(I):b.add(I):B!==void 0&&b.has(I)?Ve(I):D.protectedKeys[I]=!0}D.prevProp=N,D.prevResolvedValues=xe,D.isActive&&(S={...S,...xe}),r&&t.blockInitialAnimation&&(M=!1);const ee=F&&U;M&&(!ee||J)&&v.push(...re.map(I=>{const B={type:A};if(typeof I=="string"&&r&&!ee&&t.manuallyAnimateOnMount&&t.parent){const{parent:de}=t,Se=mi(de,I);if(de.enteringChildren&&Se){const{delayChildren:R}=Se.transition||{};B.delay=u1(de.enteringChildren,t,R)}}return{animation:I,options:B}}))}if(b.size){const T={};if(typeof m.initial!="boolean"){const A=mi(t,Array.isArray(m.initial)?m.initial[0]:m.initial);A&&A.transition&&(T.transition=A.transition)}b.forEach(A=>{const D=t.getBaseTarget(A),N=t.getValue(A);N&&(N.liveStyle=!0),T[A]=D??null}),v.push({animation:T})}let E=!!v.length;return r&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(E=!1),r=!1,E?e(v):Promise.resolve()}function f(p,m){if(s[p].isActive===m)return Promise.resolve();t.variantChildren?.forEach(v=>v.animationState?.setActive(p,m)),s[p].isActive=m;const y=d(p);for(const v in s)s[v].protectedKeys={};return y}return{animateChanges:d,setActive:f,setAnimateFunction:u,getState:()=>s,reset:()=>{s=Ax()}}}function ZO(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!I1(e,t):!1}function Ma(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ax(){return{animate:Ma(!0),whileInView:Ma(),whileHover:Ma(),whileTap:Ma(),whileDrag:Ma(),whileFocus:Ma(),exit:Ma()}}function kx(t,e){t.min=e.min,t.max=e.max}function kn(t,e){kx(t.x,e.x),kx(t.y,e.y)}function Cx(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const q1=1e-4,eD=1-q1,tD=1+q1,$1=.01,nD=0-$1,sD=0+$1;function qt(t){return t.max-t.min}function aD(t,e,s){return Math.abs(t-e)<=s}function Rx(t,e,s,r=.5){t.origin=r,t.originPoint=tt(e.min,e.max,t.origin),t.scale=qt(s)/qt(e),t.translate=tt(s.min,s.max,t.origin)-t.originPoint,(t.scale>=eD&&t.scale<=tD||isNaN(t.scale))&&(t.scale=1),(t.translate>=nD&&t.translate<=sD||isNaN(t.translate))&&(t.translate=0)}function Lo(t,e,s,r){Rx(t.x,e.x,s.x,r?r.originX:void 0),Rx(t.y,e.y,s.y,r?r.originY:void 0)}function Ox(t,e,s){t.min=s.min+e.min,t.max=t.min+qt(e)}function rD(t,e,s){Ox(t.x,e.x,s.x),Ox(t.y,e.y,s.y)}function Dx(t,e,s){t.min=e.min-s.min,t.max=t.min+qt(e)}function vu(t,e,s){Dx(t.x,e.x,s.x),Dx(t.y,e.y,s.y)}function Mx(t,e,s,r,o){return t-=e,t=yu(t,1/s,r),o!==void 0&&(t=yu(t,1/o,r)),t}function iD(t,e=0,s=1,r=.5,o,u=t,d=t){if(Hn.test(e)&&(e=parseFloat(e),e=tt(d.min,d.max,e/100)-d.min),typeof e!="number")return;let f=tt(u.min,u.max,r);t===u&&(f-=e),t.min=Mx(t.min,e,s,f,o),t.max=Mx(t.max,e,s,f,o)}function zx(t,e,[s,r,o],u,d){iD(t,e[s],e[r],e[o],e.scale,u,d)}const oD=["x","scaleX","originX"],lD=["y","scaleY","originY"];function Lx(t,e,s,r){zx(t.x,e,oD,s?s.x:void 0,r?r.x:void 0),zx(t.y,e,lD,s?s.y:void 0,r?r.y:void 0)}function Ux(t){return t.translate===0&&t.scale===1}function H1(t){return Ux(t.x)&&Ux(t.y)}function Px(t,e){return t.min===e.min&&t.max===e.max}function cD(t,e){return Px(t.x,e.x)&&Px(t.y,e.y)}function Vx(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function G1(t,e){return Vx(t.x,e.x)&&Vx(t.y,e.y)}function Bx(t){return qt(t.x)/qt(t.y)}function Ix(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function wn(t){return[t("x"),t("y")]}function uD(t,e,s){let r="";const o=t.x.translate/e.x,u=t.y.translate/e.y,d=s?.z||0;if((o||u||d)&&(r=`translate3d(${o}px, ${u}px, ${d}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:m,rotate:y,rotateX:v,rotateY:b,skewX:S,skewY:_}=s;m&&(r=`perspective(${m}px) ${r}`),y&&(r+=`rotate(${y}deg) `),v&&(r+=`rotateX(${v}deg) `),b&&(r+=`rotateY(${b}deg) `),S&&(r+=`skewX(${S}deg) `),_&&(r+=`skewY(${_}deg) `)}const f=t.x.scale*e.x,p=t.y.scale*e.y;return(f!==1||p!==1)&&(r+=`scale(${f}, ${p})`),r||"none"}const F1=["TopLeft","TopRight","BottomLeft","BottomRight"],dD=F1.length,qx=t=>typeof t=="string"?parseFloat(t):t,$x=t=>typeof t=="number"||ce.test(t);function hD(t,e,s,r,o,u){o?(t.opacity=tt(0,s.opacity??1,fD(r)),t.opacityExit=tt(e.opacity??1,0,mD(r))):u&&(t.opacity=tt(e.opacity??1,s.opacity??1,r));for(let d=0;d<dD;d++){const f=`border${F1[d]}Radius`;let p=Hx(e,f),m=Hx(s,f);if(p===void 0&&m===void 0)continue;p||(p=0),m||(m=0),p===0||m===0||$x(p)===$x(m)?(t[f]=Math.max(tt(qx(p),qx(m),r),0),(Hn.test(m)||Hn.test(p))&&(t[f]+="%")):t[f]=m}(e.rotate||s.rotate)&&(t.rotate=tt(e.rotate||0,s.rotate||0,r))}function Hx(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const fD=K1(0,.5,Iw),mD=K1(.5,.95,_n);function K1(t,e,s){return r=>r<t?0:r>e?1:s(Xo(t,e,r))}function pD(t,e,s){const r=Lt(t)?t:xi(t);return r.start(tp("",r,e,s)),r.animation}function Zo(t,e,s,r={passive:!0}){return t.addEventListener(e,s,r),()=>t.removeEventListener(e,s)}const gD=(t,e)=>t.depth-e.depth;class yD{constructor(){this.children=[],this.isDirty=!1}add(e){Pm(this.children,e),this.isDirty=!0}remove(e){Vm(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(gD),this.isDirty=!1,this.children.forEach(e)}}function vD(t,e){const s=It.now(),r=({timestamp:o})=>{const u=o-s;u>=e&&(na(r),t(u-e))};return Qe.setup(r,!0),()=>na(r)}function eu(t){return Lt(t)?t.get():t}class xD{constructor(){this.members=[]}add(e){Pm(this.members,e),e.scheduleRender()}remove(e){if(Vm(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(e){const s=this.members.findIndex(o=>e===o);if(s===0)return!1;let r;for(let o=s;o>=0;o--){const u=this.members[o];if(u.isPresent!==!1){r=u;break}}return r?(this.promote(r),!0):!1}promote(e,s){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();const o=r.options.layoutDependency,u=e.options.layoutDependency;o!==void 0&&u!==void 0&&o===u||(e.resumeFrom=r,s&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));const{crossfade:f}=e.options;f===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:s,resumingFrom:r}=e;s.onExitComplete&&s.onExitComplete(),r&&r.options.onExitComplete&&r.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},xf=["","X","Y","Z"],bD=1e3;let wD=0;function bf(t,e,s,r){const{latestValues:o}=e;o[t]&&(s[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Y1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=m1(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:o,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",Qe,!(o||u))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Y1(r)}function X1({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(d={},f=e?.()){this.id=wD++,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(jD),this.nodes.forEach(AD),this.nodes.forEach(kD),this.nodes.forEach(ED)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let p=0;p<this.path.length;p++)this.path[p].shouldResetTransform=!0;this.root===this&&(this.nodes=new yD)}addEventListener(d,f){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new qm),this.eventHandlers.get(d).add(f)}notifyListeners(d,...f){const p=this.eventHandlers.get(d);p&&p.notify(...f)}hasListeners(d){return this.eventHandlers.has(d)}mount(d){if(this.instance)return;this.isSVG=E1(d)&&!_O(d),this.instance=d;const{layoutId:f,layout:p,visualElement:m}=this.options;if(m&&!m.current&&m.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(p||f)&&(this.isLayoutDirty=!0),t){let y,v=0;const b=()=>this.root.updateBlockedByResize=!1;Qe.read(()=>{v=window.innerWidth}),t(d,()=>{const S=window.innerWidth;S!==v&&(v=S,this.root.updateBlockedByResize=!0,y&&y(),y=vD(b,250),tu.hasAnimatedSinceResize&&(tu.hasAnimatedSinceResize=!1,this.nodes.forEach(Kx)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&m&&(f||p)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:v,hasRelativeLayoutChanged:b,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const _=this.options.transition||m.getDefaultTransition()||MD,{onLayoutAnimationStart:E,onLayoutAnimationComplete:T}=m.getProps(),A=!this.targetLayout||!G1(this.targetLayout,S),D=!v&&b;if(this.options.layoutRoot||this.resumeFrom||D||v&&(A||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const N={...ep(_,"layout"),onPlay:E,onComplete:T};(m.shouldReduceMotion||this.options.layoutRoot)&&(N.delay=0,N.type=!1),this.startAnimation(N),this.setAnimationOrigin(y,D)}else v||Kx(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),na(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(CD),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Y1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const v=this.path[y];v.shouldResetTransform=!0,v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:f,layout:p}=this.options;if(f===void 0&&!p)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Gx);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Fx);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ND),this.nodes.forEach(SD),this.nodes.forEach(_D)):this.nodes.forEach(Fx),this.clearAllSnapshots();const f=It.now();Dt.delta=Gn(0,1e3/60,f-Dt.timestamp),Dt.timestamp=f,Dt.isProcessing=!0,df.update.process(Dt),df.preRender.process(Dt),df.render.process(Dt),Dt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,rp.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(TD),this.sharedNodes.forEach(RD)}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&&!qt(this.snapshot.measuredBox.x)&&!qt(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 d=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=wt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(f=!1),f&&this.instance){const p=r(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:p,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:p}}}resetTransform(){if(!o)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!H1(this.projectionDelta),p=this.getTransformTemplate(),m=p?p(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;d&&this.instance&&(f||La(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const f=this.measurePageBox();let p=this.removeElementScroll(f);return d&&(p=this.removeTransform(p)),zD(p),{animationId:this.root.animationId,measuredBox:f,layoutBox:p,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:d}=this.options;if(!d)return wt();const f=d.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(LD))){const{scroll:m}=this.root;m&&(ui(f.x,m.offset.x),ui(f.y,m.offset.y))}return f}removeElementScroll(d){const f=wt();if(kn(f,d),this.scroll?.wasRoot)return f;for(let p=0;p<this.path.length;p++){const m=this.path[p],{scroll:y,options:v}=m;m!==this.root&&y&&v.layoutScroll&&(y.wasRoot&&kn(f,d),ui(f.x,y.offset.x),ui(f.y,y.offset.y))}return f}applyTransform(d,f=!1){const p=wt();kn(p,d);for(let m=0;m<this.path.length;m++){const y=this.path[m];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&di(p,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),La(y.latestValues)&&di(p,y.latestValues)}return La(this.latestValues)&&di(p,this.latestValues),p}removeTransform(d){const f=wt();kn(f,d);for(let p=0;p<this.path.length;p++){const m=this.path[p];if(!m.instance||!La(m.latestValues))continue;pm(m.latestValues)&&m.updateSnapshot();const y=wt(),v=m.measurePageBox();kn(y,v),Lx(f,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return La(this.latestValues)&&Lx(f,this.latestValues),f}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.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!==Dt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const p=!!this.resumingFrom||this!==f;if(!(d||p&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:v}=this.options;if(!this.layout||!(y||v))return;this.resolvedRelativeTargetAt=Dt.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=wt(),this.targetWithTransforms=wt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),rD(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):kn(this.target,this.layout.layoutBox),O1(this.target,this.targetDelta)):kn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||pm(this.parent.latestValues)||R1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(d,f,p){this.relativeParent=d,this.linkedParentVersion=d.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=wt(),this.relativeTargetOrigin=wt(),vu(this.relativeTargetOrigin,f,p),kn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const d=this.getLead(),f=!!this.resumingFrom||this!==d;let p=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(p=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(p=!1),this.resolvedRelativeTargetAt===Dt.timestamp&&(p=!1),p)return;const{layout:m,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(m||y))return;kn(this.layoutCorrected,this.layout.layoutBox);const v=this.treeScale.x,b=this.treeScale.y;MO(this.layoutCorrected,this.treeScale,this.path,f),d.layout&&!d.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(d.target=d.layout.layoutBox,d.targetWithTransforms=wt());const{target:S}=d;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Cx(this.prevProjectionDelta.x,this.projectionDelta.x),Cx(this.prevProjectionDelta.y,this.projectionDelta.y)),Lo(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==v||this.treeScale.y!==b||!Ix(this.projectionDelta.x,this.prevProjectionDelta.x)||!Ix(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){if(this.options.visualElement?.scheduleRender(),d){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ci(),this.projectionDelta=ci(),this.projectionDeltaWithTransform=ci()}setAnimationOrigin(d,f=!1){const p=this.snapshot,m=p?p.latestValues:{},y={...this.latestValues},v=ci();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const b=wt(),S=p?p.source:void 0,_=this.layout?this.layout.source:void 0,E=S!==_,T=this.getStack(),A=!T||T.members.length<=1,D=!!(E&&!A&&this.options.crossfade===!0&&!this.path.some(DD));this.animationProgress=0;let N;this.mixTargetDelta=L=>{const G=L/1e3;Yx(v.x,d.x,G),Yx(v.y,d.y,G),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(vu(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),OD(this.relativeTarget,this.relativeTargetOrigin,b,G),N&&cD(this.relativeTarget,N)&&(this.isProjectionDirty=!1),N||(N=wt()),kn(N,this.relativeTarget)),E&&(this.animationValues=y,hD(y,m,this.latestValues,G,D,A)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=G},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(na(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Qe.update(()=>{tu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=xi(0)),this.currentAnimation=pD(this.motionValue,[0,1e3],{...d,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),d.onUpdate&&d.onUpdate(f)},onStop:()=>{},onComplete:()=>{d.onComplete&&d.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 d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bD),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:f,target:p,layout:m,latestValues:y}=d;if(!(!f||!p||!m)){if(this!==d&&this.layout&&m&&W1(this.options.animationType,this.layout.layoutBox,m.layoutBox)){p=this.target||wt();const v=qt(this.layout.layoutBox.x);p.x.min=d.target.x.min,p.x.max=p.x.min+v;const b=qt(this.layout.layoutBox.y);p.y.min=d.target.y.min,p.y.max=p.y.min+b}kn(f,p),di(f,y),Lo(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(d,f){this.sharedNodes.has(d)||this.sharedNodes.set(d,new xD),this.sharedNodes.get(d).add(f);const m=f.options.initialPromotionConfig;f.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(f):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){const{layoutId:d}=this.options;return d?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:d}=this.options;return d?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:f,preserveFollowOpacity:p}={}){const m=this.getStack();m&&m.promote(this,p),d&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let f=!1;const{latestValues:p}=d;if((p.z||p.rotate||p.rotateX||p.rotateY||p.rotateZ||p.skewX||p.skewY)&&(f=!0),!f)return;const m={};p.z&&bf("z",d,m,this.animationValues);for(let y=0;y<xf.length;y++)bf(`rotate${xf[y]}`,d,m,this.animationValues),bf(`skew${xf[y]}`,d,m,this.animationValues);d.render();for(const y in m)d.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);d.scheduleRender()}applyProjectionStyles(d,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){d.visibility="hidden";return}const p=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,d.visibility="",d.opacity="",d.pointerEvents=eu(f?.pointerEvents)||"",d.transform=p?p(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(d.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,d.pointerEvents=eu(f?.pointerEvents)||""),this.hasProjected&&!La(this.latestValues)&&(d.transform=p?p({},""):"none",this.hasProjected=!1);return}d.visibility="";const y=m.animationValues||m.latestValues;this.applyTransformsToTarget();let v=uD(this.projectionDeltaWithTransform,this.treeScale,y);p&&(v=p(y,v)),d.transform=v;const{x:b,y:S}=this.projectionDelta;d.transformOrigin=`${b.origin*100}% ${S.origin*100}% 0`,m.animationValues?d.opacity=m===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:d.opacity=m===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const _ in ym){if(y[_]===void 0)continue;const{correct:E,applyTo:T,isCSSVariable:A}=ym[_],D=v==="none"?y[_]:E(y[_],m);if(T){const N=T.length;for(let L=0;L<N;L++)d[T[L]]=D}else A?this.options.visualElement.renderState.vars[_]=D:d[_]=D}this.options.layoutId&&(d.pointerEvents=m===this?eu(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>d.currentAnimation?.stop()),this.root.nodes.forEach(Gx),this.root.sharedNodes.clear()}}}function SD(t){t.updateLayout()}function _D(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=t.layout,{animationType:o}=t.options,u=e.source!==t.layout.source;o==="size"?wn(y=>{const v=u?e.measuredBox[y]:e.layoutBox[y],b=qt(v);v.min=s[y].min,v.max=v.min+b}):W1(o,e.layoutBox,s)&&wn(y=>{const v=u?e.measuredBox[y]:e.layoutBox[y],b=qt(s[y]);v.max=v.min+b,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+b)});const d=ci();Lo(d,s,e.layoutBox);const f=ci();u?Lo(f,t.applyTransform(r,!0),e.measuredBox):Lo(f,s,e.layoutBox);const p=!H1(d);let m=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:v,layout:b}=y;if(v&&b){const S=wt();vu(S,e.layoutBox,v.layoutBox);const _=wt();vu(_,s,b.layoutBox),G1(S,_)||(m=!0),y.options.layoutRoot&&(t.relativeTarget=_,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:e,delta:f,layoutDelta:d,hasLayoutChanged:p,hasRelativeLayoutChanged:m})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function jD(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ED(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function TD(t){t.clearSnapshot()}function Gx(t){t.clearMeasurements()}function Fx(t){t.isLayoutDirty=!1}function ND(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Kx(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function AD(t){t.resolveTargetDelta()}function kD(t){t.calcProjection()}function CD(t){t.resetSkewAndRotation()}function RD(t){t.removeLeadSnapshot()}function Yx(t,e,s){t.translate=tt(e.translate,0,s),t.scale=tt(e.scale,1,s),t.origin=e.origin,t.originPoint=e.originPoint}function Xx(t,e,s,r){t.min=tt(e.min,s.min,r),t.max=tt(e.max,s.max,r)}function OD(t,e,s,r){Xx(t.x,e.x,s.x,r),Xx(t.y,e.y,s.y,r)}function DD(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const MD={duration:.45,ease:[.4,0,.1,1]},Wx=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Jx=Wx("applewebkit/")&&!Wx("chrome/")?Math.round:_n;function Qx(t){t.min=Jx(t.min),t.max=Jx(t.max)}function zD(t){Qx(t.x),Qx(t.y)}function W1(t,e,s){return t==="position"||t==="preserve-aspect"&&!aD(Bx(e),Bx(s),.2)}function LD(t){return t!==t.root&&t.scroll?.wasRoot}const UD=X1({attachResizeListener:(t,e)=>Zo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),wf={current:void 0},J1=X1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!wf.current){const t=new UD({});t.mount(window),t.setOptions({layoutScroll:!0}),wf.current=t}return wf.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),dp=w.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Zx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function PD(...t){return e=>{let s=!1;const r=t.map(o=>{const u=Zx(o,e);return!s&&typeof u=="function"&&(s=!0),u});if(s)return()=>{for(let o=0;o<r.length;o++){const u=r[o];typeof u=="function"?u():Zx(t[o],null)}}}}function VD(...t){return w.useCallback(PD(...t),t)}class BD extends w.Component{getSnapshotBeforeUpdate(e){const s=this.props.childRef.current;if(s&&e.isPresent&&!this.props.isPresent){const r=s.offsetParent,o=fm(r)&&r.offsetWidth||0,u=fm(r)&&r.offsetHeight||0,d=this.props.sizeRef.current;d.height=s.offsetHeight||0,d.width=s.offsetWidth||0,d.top=s.offsetTop,d.left=s.offsetLeft,d.right=o-d.width-d.left,d.bottom=u-d.height-d.top}return null}componentDidUpdate(){}render(){return this.props.children}}function ID({children:t,isPresent:e,anchorX:s,anchorY:r,root:o}){const u=w.useId(),d=w.useRef(null),f=w.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:p}=w.useContext(dp),m=t.props?.ref??t?.ref,y=VD(d,m);return w.useInsertionEffect(()=>{const{width:v,height:b,top:S,left:_,right:E,bottom:T}=f.current;if(e||!d.current||!v||!b)return;const A=s==="left"?`left: ${_}`:`right: ${E}`,D=r==="bottom"?`bottom: ${T}`:`top: ${S}`;d.current.dataset.motionPopId=u;const N=document.createElement("style");p&&(N.nonce=p);const L=o??document.head;return L.appendChild(N),N.sheet&&N.sheet.insertRule(`
52
+ [data-motion-pop-id="${u}"] {
53
+ position: absolute !important;
54
+ width: ${v}px !important;
55
+ height: ${b}px !important;
56
+ ${A}px !important;
57
+ ${D}px !important;
58
+ }
59
+ `),()=>{L.contains(N)&&L.removeChild(N)}},[e]),l.jsx(BD,{isPresent:e,childRef:d,sizeRef:f,children:w.cloneElement(t,{ref:y})})}const qD=({children:t,initial:e,isPresent:s,onExitComplete:r,custom:o,presenceAffectsLayout:u,mode:d,anchorX:f,anchorY:p,root:m})=>{const y=Um($D),v=w.useId();let b=!0,S=w.useMemo(()=>(b=!1,{id:v,initial:e,isPresent:s,custom:o,onExitComplete:_=>{y.set(_,!0);for(const E of y.values())if(!E)return;r&&r()},register:_=>(y.set(_,!1),()=>y.delete(_))}),[s,y,r]);return u&&b&&(S={...S}),w.useMemo(()=>{y.forEach((_,E)=>y.set(E,!1))},[s]),w.useEffect(()=>{!s&&!y.size&&r&&r()},[s]),d==="popLayout"&&(t=l.jsx(ID,{isPresent:s,anchorX:f,anchorY:p,root:m,children:t})),l.jsx(Nu.Provider,{value:S,children:t})};function $D(){return new Map}function Q1(t=!0){const e=w.useContext(Nu);if(e===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:o}=e,u=w.useId();w.useEffect(()=>{if(t)return o(u)},[t]);const d=w.useCallback(()=>t&&r&&r(u),[u,r,t]);return!s&&r?[!1,d]:[!0]}const Ic=t=>t.key||"";function eb(t){const e=[];return w.Children.forEach(t,s=>{w.isValidElement(s)&&e.push(s)}),e}const Z1=({children:t,custom:e,initial:s=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:u="sync",propagate:d=!1,anchorX:f="left",anchorY:p="top",root:m})=>{const[y,v]=Q1(d),b=w.useMemo(()=>eb(t),[t]),S=d&&!y?[]:b.map(Ic),_=w.useRef(!0),E=w.useRef(b),T=Um(()=>new Map),A=w.useRef(new Set),[D,N]=w.useState(b),[L,G]=w.useState(b);Cw(()=>{_.current=!1,E.current=b;for(let M=0;M<L.length;M++){const J=Ic(L[M]);S.includes(J)?(T.delete(J),A.current.delete(J)):T.get(J)!==!0&&T.set(J,!1)}},[L,S.length,S.join("-")]);const F=[];if(b!==D){let M=[...b];for(let J=0;J<L.length;J++){const re=L[J],xe=Ic(re);S.includes(xe)||(M.splice(J,0,re),F.push(re))}return u==="wait"&&F.length&&(M=F),G(eb(M)),N(b),null}const{forceRender:U}=w.useContext(Lm);return l.jsx(l.Fragment,{children:L.map(M=>{const J=Ic(M),re=d&&!y?!1:b===L||S.includes(J),xe=()=>{if(A.current.has(J))return;if(A.current.add(J),T.has(J))T.set(J,!0);else return;let ue=!0;T.forEach(Ie=>{Ie||(ue=!1)}),ue&&(U?.(),G(E.current),d&&v?.(),r&&r())};return l.jsx(qD,{isPresent:re,initial:!_.current||s?void 0:!1,custom:e,presenceAffectsLayout:o,mode:u,root:m,onExitComplete:re?void 0:xe,anchorX:f,anchorY:p,children:M},J)})})},eS=w.createContext({strict:!1}),tb={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 nb=!1;function HD(){if(nb)return;const t={};for(const e in tb)t[e]={isEnabled:s=>tb[e].some(r=>!!s[r])};A1(t),nb=!0}function tS(){return HD(),CO()}function GD(t){const e=tS();for(const s in t)e[s]={...e[s],...t[s]};A1(e)}const FD=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 xu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||FD.has(t)}let nS=t=>!xu(t);function KD(t){typeof t=="function"&&(nS=e=>e.startsWith("on")?!xu(e):t(e))}try{KD(require("@emotion/is-prop-valid").default)}catch{}function YD(t,e,s){const r={};for(const o in t)o==="values"&&typeof t.values=="object"||(nS(o)||s===!0&&xu(o)||!e&&!xu(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}const Cu=w.createContext({});function XD(t,e){if(ku(t)){const{initial:s,animate:r}=t;return{initial:s===!1||Qo(s)?s:void 0,animate:Qo(r)?r:void 0}}return t.inherit!==!1?e:{}}function WD(t){const{initial:e,animate:s}=XD(t,w.useContext(Cu));return w.useMemo(()=>({initial:e,animate:s}),[sb(e),sb(s)])}function sb(t){return Array.isArray(t)?t.join(" "):t}const hp=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function sS(t,e,s){for(const r in e)!Lt(e[r])&&!z1(r,s)&&(t[r]=e[r])}function JD({transformTemplate:t},e){return w.useMemo(()=>{const s=hp();return cp(s,e,t),Object.assign({},s.vars,s.style)},[e])}function QD(t,e){const s=t.style||{},r={};return sS(r,s,t),Object.assign(r,JD(t,e)),r}function ZD(t,e){const s={},r=QD(t,e);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=r,s}const aS=()=>({...hp(),attrs:{}});function e5(t,e,s,r){const o=w.useMemo(()=>{const u=aS();return L1(u,e,P1(r),t.transformTemplate,t.style),{...u.attrs,style:{...u.style}}},[e]);if(t.style){const u={};sS(u,t.style,t),o.style={...u,...o.style}}return o}const t5=["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 fp(t){return typeof t!="string"||t.includes("-")?!1:!!(t5.indexOf(t)>-1||/[A-Z]/u.test(t))}function n5(t,e,s,{latestValues:r},o,u=!1,d){const p=(d??fp(t)?e5:ZD)(e,r,o,t),m=YD(e,typeof t=="string",u),y=t!==w.Fragment?{...m,...p,ref:s}:{},{children:v}=e,b=w.useMemo(()=>Lt(v)?v.get():v,[v]);return w.createElement(t,{...y,children:b})}function s5({scrapeMotionValuesFromProps:t,createRenderState:e},s,r,o){return{latestValues:a5(s,r,o,t),renderState:e()}}function a5(t,e,s,r){const o={},u=r(t,{});for(const b in u)o[b]=eu(u[b]);let{initial:d,animate:f}=t;const p=ku(t),m=N1(t);e&&m&&!p&&t.inherit!==!1&&(d===void 0&&(d=e.initial),f===void 0&&(f=e.animate));let y=s?s.initial===!1:!1;y=y||d===!1;const v=y?f:d;if(v&&typeof v!="boolean"&&!Au(v)){const b=Array.isArray(v)?v:[v];for(let S=0;S<b.length;S++){const _=np(t,b[S]);if(_){const{transitionEnd:E,transition:T,...A}=_;for(const D in A){let N=A[D];if(Array.isArray(N)){const L=y?N.length-1:0;N=N[L]}N!==null&&(o[D]=N)}for(const D in E)o[D]=E[D]}}}return o}const rS=t=>(e,s)=>{const r=w.useContext(Cu),o=w.useContext(Nu),u=()=>s5(t,e,r,o);return s?u():Um(u)},r5=rS({scrapeMotionValuesFromProps:up,createRenderState:hp}),i5=rS({scrapeMotionValuesFromProps:V1,createRenderState:aS}),o5=Symbol.for("motionComponentSymbol");function l5(t,e,s){const r=w.useRef(s);w.useInsertionEffect(()=>{r.current=s});const o=w.useRef(null);return w.useCallback(u=>{u&&t.onMount?.(u),e&&(u?e.mount(u):e.unmount());const d=r.current;if(typeof d=="function")if(u){const f=d(u);typeof f=="function"&&(o.current=f)}else o.current?(o.current(),o.current=null):d(u);else d&&(d.current=u)},[e])}const iS=w.createContext({});function Ro(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function c5(t,e,s,r,o,u){const{visualElement:d}=w.useContext(Cu),f=w.useContext(eS),p=w.useContext(Nu),m=w.useContext(dp).reducedMotion,y=w.useRef(null),v=w.useRef(!1);r=r||f.renderer,!y.current&&r&&(y.current=r(t,{visualState:e,parent:d,props:s,presenceContext:p,blockInitialAnimation:p?p.initial===!1:!1,reducedMotionConfig:m,isSVG:u}),v.current&&y.current&&(y.current.manuallyAnimateOnMount=!0));const b=y.current,S=w.useContext(iS);b&&!b.projection&&o&&(b.type==="html"||b.type==="svg")&&u5(y.current,s,o,S);const _=w.useRef(!1);w.useInsertionEffect(()=>{b&&_.current&&b.update(s,p)});const E=s[f1],T=w.useRef(!!E&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return Cw(()=>{v.current=!0,b&&(_.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),b.scheduleRenderMicrotask(),T.current&&b.animationState&&b.animationState.animateChanges())}),w.useEffect(()=>{b&&(!T.current&&b.animationState&&b.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),T.current=!1),b.enteringChildren=void 0)}),b}function u5(t,e,s,r){const{layoutId:o,layout:u,drag:d,dragConstraints:f,layoutScroll:p,layoutRoot:m,layoutCrossfade:y}=e;t.projection=new s(t.latestValues,e["data-framer-portal-id"]?void 0:oS(t.parent)),t.projection.setOptions({layoutId:o,layout:u,alwaysMeasureLayout:!!d||f&&Ro(f),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:p,layoutRoot:m})}function oS(t){if(t)return t.options.allowProjection!==!1?t.projection:oS(t.parent)}function Sf(t,{forwardMotionProps:e=!1,type:s}={},r,o){r&&GD(r);const u=s?s==="svg":fp(t),d=u?i5:r5;function f(m,y){let v;const b={...w.useContext(dp),...m,layoutId:d5(m)},{isStatic:S}=b,_=WD(m),E=d(m,S);if(!S&&kw){h5();const T=f5(b);v=T.MeasureLayout,_.visualElement=c5(t,E,b,o,T.ProjectionNode,u)}return l.jsxs(Cu.Provider,{value:_,children:[v&&_.visualElement?l.jsx(v,{visualElement:_.visualElement,...b}):null,n5(t,m,l5(E,_.visualElement,y),E,S,e,u)]})}f.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const p=w.forwardRef(f);return p[o5]=t,p}function d5({layoutId:t}){const e=w.useContext(Lm).id;return e&&t!==void 0?e+"-"+t:t}function h5(t,e){w.useContext(eS).strict}function f5(t){const e=tS(),{drag:s,layout:r}=e;if(!s&&!r)return{};const o={...s,...r};return{MeasureLayout:s?.isEnabled(t)||r?.isEnabled(t)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function m5(t,e){if(typeof Proxy>"u")return Sf;const s=new Map,r=(u,d)=>Sf(u,d,t,e),o=(u,d)=>r(u,d);return new Proxy(o,{get:(u,d)=>d==="create"?r:(s.has(d)||s.set(d,Sf(d,void 0,t,e)),s.get(d))})}const p5=(t,e)=>e.isSVG??fp(t)?new KO(e):new IO(e,{allowProjection:t!==w.Fragment});class g5 extends ia{constructor(e){super(e),e.animationState||(e.animationState=QO(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Au(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:s}=this.node.prevProps||{};e!==s&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let y5=0;class v5 extends ia{constructor(){super(...arguments),this.id=y5++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:s}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const o=this.node.animationState.setActive("exit",!e);s&&!e&&o.then(()=>{s(this.id)})}mount(){const{register:e,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const x5={animation:{Feature:g5},exit:{Feature:v5}};function il(t){return{point:{x:t.pageX,y:t.pageY}}}const b5=t=>e=>ip(e)&&t(e,il(e));function Uo(t,e,s,r){return Zo(t,e,b5(s),r)}const lS=({current:t})=>t?t.ownerDocument.defaultView:null,ab=(t,e)=>Math.abs(t-e);function w5(t,e){const s=ab(t.x,e.x),r=ab(t.y,e.y);return Math.sqrt(s**2+r**2)}const rb=new Set(["auto","scroll"]);class cS{constructor(e,s,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:u=!1,distanceThreshold:d=3,element:f}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=S=>{this.handleScroll(S.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=jf(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,E=w5(S.offset,{x:0,y:0})>=this.distanceThreshold;if(!_&&!E)return;const{point:T}=S,{timestamp:A}=Dt;this.history.push({...T,timestamp:A});const{onStart:D,onMove:N}=this.handlers;_||(D&&D(this.lastMoveEvent,S),this.startEvent=this.lastMoveEvent),N&&N(this.lastMoveEvent,S)},this.handlePointerMove=(S,_)=>{this.lastMoveEvent=S,this.lastMoveEventInfo=_f(_,this.transformPagePoint),Qe.update(this.updatePoint,!0)},this.handlePointerUp=(S,_)=>{this.end();const{onEnd:E,onSessionEnd:T,resumeAnimation:A}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&A&&A(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=jf(S.type==="pointercancel"?this.lastMoveEventInfo:_f(_,this.transformPagePoint),this.history);this.startEvent&&E&&E(S,D),T&&T(S,D)},!ip(e))return;this.dragSnapToOrigin=u,this.handlers=s,this.transformPagePoint=r,this.distanceThreshold=d,this.contextWindow=o||window;const p=il(e),m=_f(p,this.transformPagePoint),{point:y}=m,{timestamp:v}=Dt;this.history=[{...y,timestamp:v}];const{onSessionStart:b}=s;b&&b(e,jf(m,this.history)),this.removeListeners=sl(Uo(this.contextWindow,"pointermove",this.handlePointerMove),Uo(this.contextWindow,"pointerup",this.handlePointerUp),Uo(this.contextWindow,"pointercancel",this.handlePointerUp)),f&&this.startScrollTracking(f)}startScrollTracking(e){let s=e.parentElement;for(;s;){const r=getComputedStyle(s);(rb.has(r.overflowX)||rb.has(r.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.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 s=this.scrollPositions.get(e);if(!s)return;const r=e===window,o=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},u={x:o.x-s.x,y:o.y-s.y};u.x===0&&u.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=u.x,this.lastMoveEventInfo.point.y+=u.y):this.history.length>0&&(this.history[0].x-=u.x,this.history[0].y-=u.y),this.scrollPositions.set(e,o),Qe.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),na(this.updatePoint)}}function _f(t,e){return e?{point:e(t.point)}:t}function ib(t,e){return{x:t.x-e.x,y:t.y-e.y}}function jf({point:t},e){return{point:t,delta:ib(t,uS(e)),offset:ib(t,S5(e)),velocity:_5(e,.1)}}function S5(t){return t[0]}function uS(t){return t[t.length-1]}function _5(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,r=null;const o=uS(t);for(;s>=0&&(r=t[s],!(o.timestamp-r.timestamp>gs(e)));)s--;if(!r)return{x:0,y:0};const u=Sn(o.timestamp-r.timestamp);if(u===0)return{x:0,y:0};const d={x:(o.x-r.x)/u,y:(o.y-r.y)/u};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}function j5(t,{min:e,max:s},r){return e!==void 0&&t<e?t=r?tt(e,t,r.min):Math.max(t,e):s!==void 0&&t>s&&(t=r?tt(s,t,r.max):Math.min(t,s)),t}function ob(t,e,s){return{min:e!==void 0?t.min+e:void 0,max:s!==void 0?t.max+s-(t.max-t.min):void 0}}function E5(t,{top:e,left:s,bottom:r,right:o}){return{x:ob(t.x,s,o),y:ob(t.y,e,r)}}function lb(t,e){let s=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([s,r]=[r,s]),{min:s,max:r}}function T5(t,e){return{x:lb(t.x,e.x),y:lb(t.y,e.y)}}function N5(t,e){let s=.5;const r=qt(t),o=qt(e);return o>r?s=Xo(e.min,e.max-r,t.min):r>o&&(s=Xo(t.min,t.max-o,e.min)),Gn(0,1,s)}function A5(t,e){const s={};return e.min!==void 0&&(s.min=e.min-t.min),e.max!==void 0&&(s.max=e.max-t.min),s}const vm=.35;function k5(t=vm){return t===!1?t=0:t===!0&&(t=vm),{x:cb(t,"left","right"),y:cb(t,"top","bottom")}}function cb(t,e,s){return{min:ub(t,e),max:ub(t,s)}}function ub(t,e){return typeof t=="number"?t:t[e]||0}const C5=new WeakMap;class R5{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=wt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:s=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const u=v=>{s?(this.stopAnimation(),this.snapToCursor(il(v).point)):this.pauseAnimation()},d=(v,b)=>{this.stopAnimation();const{drag:S,dragPropagation:_,onDragStart:E}=this.getProps();if(S&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=vO(S),!this.openDragLock))return;this.latestPointerEvent=v,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wn(A=>{let D=this.getAxisMotionValue(A).get()||0;if(Hn.test(D)){const{projection:N}=this.visualElement;if(N&&N.layout){const L=N.layout.layoutBox[A];L&&(D=qt(L)*(parseFloat(D)/100))}}this.originPoint[A]=D}),E&&Qe.postRender(()=>E(v,b)),um(this.visualElement,"transform");const{animationState:T}=this.visualElement;T&&T.setActive("whileDrag",!0)},f=(v,b)=>{this.latestPointerEvent=v,this.latestPanInfo=b;const{dragPropagation:S,dragDirectionLock:_,onDirectionLock:E,onDrag:T}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:A}=b;if(_&&this.currentDirection===null){this.currentDirection=O5(A),this.currentDirection!==null&&E&&E(this.currentDirection);return}this.updateAxis("x",b.point,A),this.updateAxis("y",b.point,A),this.visualElement.render(),T&&T(v,b)},p=(v,b)=>{this.latestPointerEvent=v,this.latestPanInfo=b,this.stop(v,b),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>wn(v=>this.getAnimationState(v)==="paused"&&this.getAxisMotionValue(v).animation?.play()),{dragSnapToOrigin:y}=this.getProps();this.panSession=new cS(e,{onSessionStart:u,onStart:d,onMove:f,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:lS(this.visualElement),element:this.visualElement.current})}stop(e,s){const r=e||this.latestPointerEvent,o=s||this.latestPanInfo,u=this.isDragging;if(this.cancel(),!u||!o||!r)return;const{velocity:d}=o;this.startAnimation(d);const{onDragEnd:f}=this.getProps();f&&Qe.postRender(()=>f(r,o))}cancel(){this.isDragging=!1;const{projection:e,animationState:s}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,s,r){const{drag:o}=this.getProps();if(!r||!qc(e,o,this.currentDirection))return;const u=this.getAxisMotionValue(e);let d=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(d=j5(d,this.constraints[e],this.elastic[e])),u.set(d)}resolveConstraints(){const{dragConstraints:e,dragElastic:s}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;e&&Ro(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=E5(r.layoutBox,e):this.constraints=!1,this.elastic=k5(s),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&wn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=A5(r.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!Ro(e))return!1;const r=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const u=zO(r,o.root,this.visualElement.getTransformPagePoint());let d=T5(o.layout.layoutBox,u);if(s){const f=s(OO(d));this.hasMutatedConstraints=!!f,f&&(d=C1(f))}return d}startAnimation(e){const{drag:s,dragMomentum:r,dragElastic:o,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:f}=this.getProps(),p=this.constraints||{},m=wn(y=>{if(!qc(y,s,this.currentDirection))return;let v=p&&p[y]||{};d&&(v={min:0,max:0});const b=o?200:1e6,S=o?40:1e7,_={type:"inertia",velocity:r?e[y]:0,bounceStiffness:b,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...v};return this.startAxisValueAnimation(y,_)});return Promise.all(m).then(f)}startAxisValueAnimation(e,s){const r=this.getAxisMotionValue(e);return um(this.visualElement,e),r.start(tp(e,r,0,s,this.visualElement,!1))}stopAnimation(){wn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){wn(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const s=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),o=r[s];return o||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){wn(s=>{const{drag:r}=this.getProps();if(!qc(s,r,this.currentDirection))return;const{projection:o}=this.visualElement,u=this.getAxisMotionValue(s);if(o&&o.layout){const{min:d,max:f}=o.layout.layoutBox[s],p=u.get()||0;u.set(e[s]-tt(d,f,.5)+p)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:s}=this.getProps(),{projection:r}=this.visualElement;if(!Ro(s)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};wn(d=>{const f=this.getAxisMotionValue(d);if(f&&this.constraints!==!1){const p=f.get();o[d]=N5({min:p,max:p},this.constraints[d])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),wn(d=>{if(!qc(d,e,null))return;const f=this.getAxisMotionValue(d),{min:p,max:m}=this.constraints[d];f.set(tt(p,m,o[d]))})}addListeners(){if(!this.visualElement.current)return;C5.set(this.visualElement,this);const e=this.visualElement.current,s=Uo(e,"pointerdown",p=>{const{drag:m,dragListener:y=!0}=this.getProps(),v=p.target,b=v!==e&&j1(v);m&&y&&!b&&this.start(p)}),r=()=>{const{dragConstraints:p}=this.getProps();Ro(p)&&p.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,u=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Qe.read(r);const d=Zo(window,"resize",()=>this.scalePositionWithinConstraints()),f=o.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:m})=>{this.isDragging&&m&&(wn(y=>{const v=this.getAxisMotionValue(y);v&&(this.originPoint[y]+=p[y].translate,v.set(v.get()+p[y].translate))}),this.visualElement.render())}));return()=>{d(),s(),u(),f&&f()}}getProps(){const e=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:u=!1,dragElastic:d=vm,dragMomentum:f=!0}=e;return{...e,drag:s,dragDirectionLock:r,dragPropagation:o,dragConstraints:u,dragElastic:d,dragMomentum:f}}}function qc(t,e,s){return(e===!0||e===t)&&(s===null||s===t)}function O5(t,e=10){let s=null;return Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x"),s}class D5 extends ia{constructor(e){super(e),this.removeGroupControls=_n,this.removeListeners=_n,this.controls=new R5(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_n}update(){const{dragControls:e}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};e!==s&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const db=t=>(e,s)=>{t&&Qe.postRender(()=>t(e,s))};class M5 extends ia{constructor(){super(...arguments),this.removePointerDownListener=_n}onPointerDown(e){this.session=new cS(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lS(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:db(e),onStart:db(s),onMove:r,onEnd:(u,d)=>{delete this.session,o&&Qe.postRender(()=>o(u,d))}}}mount(){this.removePointerDownListener=Uo(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 Ef=!1;class z5 extends w.Component{componentDidMount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:r,layoutId:o}=this.props,{projection:u}=e;u&&(s.group&&s.group.add(u),r&&r.register&&o&&r.register(u),Ef&&u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),tu.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:s,visualElement:r,drag:o,isPresent:u}=this.props,{projection:d}=r;return d&&(d.isPresent=u,e.layoutDependency!==s&&d.setOptions({...d.options,layoutDependency:s}),Ef=!0,o||e.layoutDependency!==s||s===void 0||e.isPresent!==u?d.willUpdate():this.safeToRemove(),e.isPresent!==u&&(u?d.promote():d.relegate()||Qe.postRender(()=>{const f=d.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),rp.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:o}=e;Ef=!0,o&&(o.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function dS(t){const[e,s]=Q1(),r=w.useContext(Lm);return l.jsx(z5,{...t,layoutGroup:r,switchLayoutGroup:w.useContext(iS),isPresent:e,safeToRemove:s})}const L5={pan:{Feature:M5},drag:{Feature:D5,ProjectionNode:J1,MeasureLayout:dS}};function hb(t,e,s){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",s==="Start");const o="onHover"+s,u=r[o];u&&Qe.postRender(()=>u(e,il(e)))}class U5 extends ia{mount(){const{current:e}=this.node;e&&(this.unmount=xO(e,(s,r)=>(hb(this.node,r,"Start"),o=>hb(this.node,o,"End"))))}unmount(){}}class P5 extends ia{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(Zo(this.node.current,"focus",()=>this.onFocus()),Zo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function fb(t,e,s){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",s==="Start");const o="onTap"+(s==="End"?"":s),u=r[o];u&&Qe.postRender(()=>u(e,il(e)))}class V5 extends ia{mount(){const{current:e}=this.node;e&&(this.unmount=SO(e,(s,r)=>(fb(this.node,r,"Start"),(o,{success:u})=>fb(this.node,o,u?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const xm=new WeakMap,Tf=new WeakMap,B5=t=>{const e=xm.get(t.target);e&&e(t)},I5=t=>{t.forEach(B5)};function q5({root:t,...e}){const s=t||document;Tf.has(s)||Tf.set(s,{});const r=Tf.get(s),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(I5,{root:t,...e})),r[o]}function $5(t,e,s){const r=q5(e);return xm.set(t,s),r.observe(t),()=>{xm.delete(t),r.unobserve(t)}}const H5={some:0,all:1};class G5 extends ia{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:s,margin:r,amount:o="some",once:u}=e,d={root:s?s.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:H5[o]},f=p=>{const{isIntersecting:m}=p;if(this.isInView===m||(this.isInView=m,u&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:v}=this.node.getProps(),b=m?y:v;b&&b(p)};return $5(this.node.current,d,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:s}=this.node;["amount","margin","root"].some(F5(e,s))&&this.startObserver()}unmount(){}}function F5({viewport:t={}},{viewport:e={}}={}){return s=>t[s]!==e[s]}const K5={inView:{Feature:G5},tap:{Feature:V5},focus:{Feature:P5},hover:{Feature:U5}},Y5={layout:{ProjectionNode:J1,MeasureLayout:dS}},X5={...x5,...K5,...L5,...Y5},ms=m5(X5,p5),W5="modulepreload",J5=function(t){return"/"+t},mb={},Ua=function(e,s,r){let o=Promise.resolve();if(s&&s.length>0){let m=function(y){return Promise.all(y.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};var d=m;document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),p=f?.nonce||f?.getAttribute("nonce");o=m(s.map(y=>{if(y=J5(y),y in mb)return;mb[y]=!0;const v=y.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${b}`))return;const S=document.createElement("link");if(S.rel=v?"stylesheet":W5,v||(S.as="script"),S.crossOrigin="",S.href=y,p&&S.setAttribute("nonce",p),document.head.appendChild(S),v)return new Promise((_,E)=>{S.addEventListener("load",_),S.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${y}`)))})}))}function u(f){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=f,window.dispatchEvent(p),!p.defaultPrevented)throw f}return o.then(f=>{for(const p of f||[])p.status==="rejected"&&u(p.reason);return e().catch(u)})},Q5=(t,e,s)=>{const r=t[e];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((o,u)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(u.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==s?". Note that variables only represent file names one level deep.":""))))})},hS={"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":"System Setup","setup.initiation":"Welcome","setup.coordinates":"Connection Details","setup.foundation":"Database Setup","setup.ignition":"Launch","setup.start":"Start Setup","setup.welcomeTitle":"Automator Initializing","setup.welcomeSubtitle":"Setting up your specialized environment 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 mode","setup.quickIgnition":"Quick Start","setup.autoProvision":"Auto-provision via token","setup.manualSync":"Manual Sync","setup.existingCredentials":"Existing Credentials","setup.abortAccess":"Abort Access","setup.injectCoordinates":"Enter existing credentials","setup.platformUrl":"Platform URL","setup.urlHelp":"Enter full URL or just the Project ID","setup.anonMatrixKey":"Supabase Anon Key","setup.keyHelp":"Found in your Supabase project settings","setup.back":"Back","setup.engage":"Connect","setup.installation":"Installation","setup.applyingSchema":"Setting up database...","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"},Z5=Object.freeze(Object.defineProperty({__proto__:null,default:hS},Symbol.toStringTag,{value:"Module"})),pb={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=hS,fS=w.createContext(void 0);function e4({children:t}){const[e,s]=w.useState(()=>localStorage.getItem("app_language")||"en"),[r,o]=w.useState(e==="en"?$c:{}),[u,d]=w.useState(e!=="en");w.useEffect(()=>{localStorage.setItem("app_language",e),document.documentElement.lang=e,(async()=>{if(e==="en"){o($c),d(!1);return}d(!0);try{const y=await Q5(Object.assign({"../locales/languages/en.json":()=>Ua(()=>Promise.resolve().then(()=>Z5),void 0),"../locales/languages/es.json":()=>Ua(()=>import("./es-161lTAAC.js"),[]),"../locales/languages/fr.json":()=>Ua(()=>import("./fr-CUSL8GiW.js"),[]),"../locales/languages/ja.json":()=>Ua(()=>import("./ja-BFTHcNh2.js"),[]),"../locales/languages/ko.json":()=>Ua(()=>import("./ko-BBna20Zx.js"),[]),"../locales/languages/vi.json":()=>Ua(()=>import("./vi-BckXN65g.js"),[])}),`../locales/languages/${e}.json`,4);o(y.default)}catch(y){console.error(`Failed to load translations for ${e}:`,y),o($c)}finally{d(!1)}})()},[e]);const f=m=>{s(m)},p=m=>r[m]||$c[m]||m;return l.jsx(fS.Provider,{value:{language:e,setLanguage:f,t:p,isLoading:u},children:t})}function nt(){const t=w.useContext(fS);if(t===void 0)throw new Error("useLanguage must be used within a LanguageProvider");return t}function mp({className:t}){const{language:e,setLanguage:s}=nt(),[r,o]=w.useState(!1),u=w.useRef(null);w.useEffect(()=>{function f(p){u.current&&!u.current.contains(p.target)&&o(!1)}return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const d=pb[e];return l.jsxs("div",{className:we("relative z-50",t),ref:u,children:[l.jsxs("button",{onClick:()=>o(!r),className:we("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",r&&"ring-2 ring-primary/20 border-primary/50"),children:[l.jsx("span",{className:"text-lg leading-none",children:d.flag}),l.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",children:e}),l.jsx(Mb,{className:we("w-3 h-3 transition-transform duration-200",r&&"rotate-180")})]}),r&&l.jsxs("div",{className:we("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:[l.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(pb).map(([f,{name:p,flag:m}])=>l.jsxs("button",{onClick:()=>{s(f),o(!1)},className:we("flex items-center justify-between w-full px-3 py-2 rounded-lg text-sm transition-colors",e===f?"bg-primary/10 text-primary font-bold":"hover:bg-secondary text-muted-foreground hover:text-foreground"),children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-lg leading-none",children:m}),l.jsx("span",{children:p})]}),e===f&&l.jsx(Ks,{className:"w-4 h-4"})]},f))]})]})}const pi="2.19.2",t4="20260131210000";function n4(t,e){const s=t.split(".").map(Number),r=e.split(".").map(Number);for(let o=0;o<Math.max(s.length,r.length);o++){const u=s[o]||0,d=r[o]||0;if(u>d)return 1;if(u<d)return-1}return 0}async function s4(t){try{const{data:e,error:s}=await t.rpc("get_latest_migration_timestamp");return s?s.code==="42883"?(console.info("[Migration Check] RPC function missing - assuming fresh DB."),{version:null,latestMigrationTimestamp:"0"}):(console.warn("Could not get latest migration timestamp:",s.message),{version:null,latestMigrationTimestamp:null}):{version:pi,latestMigrationTimestamp:e||null}}catch(e){return console.error("Error checking database migration info:",e),{version:null,latestMigrationTimestamp:null}}}async function pp(t){const e=pi,s=t4,r=await s4(t);if(console.log("[Migration Check]",{appVersion:e,appMigrationTimestamp:s,dbVersion:r.version,dbMigrationTimestamp:r.latestMigrationTimestamp}),r.latestMigrationTimestamp&&r.latestMigrationTimestamp.trim()!==""){const o=s,u=r.latestMigrationTimestamp;return o>u?{needsMigration:!0,appVersion:e,dbVersion:r.version,latestMigrationTimestamp:u,message:`New migrations available. Database is at ${u}, app has ${o}.`}:o<u?(console.warn("[Migration Check] DB is ahead of app - possible downgrade"),{needsMigration:!1,appVersion:e,dbVersion:r.version,latestMigrationTimestamp:u,message:`Database (${u}) is ahead of app (${o}).`}):(console.log("[Migration Check] Timestamps match - database is up-to-date"),{needsMigration:!1,appVersion:e,dbVersion:r.version,latestMigrationTimestamp:u,message:"Database schema is up-to-date."})}if(r.version){console.log("[Migration Check] Legacy DB detected (no timestamp). Falling back to SemVer.");const o=n4(e,r.version);return o>0?{needsMigration:!0,appVersion:e,dbVersion:r.version,latestMigrationTimestamp:null,message:`Database schema (v${r.version}) is outdated. Migration to v${e} required.`}:o===0?(console.warn("[Migration Check] Legacy DB with matching version - forcing migration to add timestamp tracking"),{needsMigration:!0,appVersion:e,dbVersion:r.version,latestMigrationTimestamp:null,message:`Database lacks timestamp tracking. Please run migration to upgrade to modern schema (v${e}).`}):{needsMigration:!1,appVersion:e,dbVersion:r.version,latestMigrationTimestamp:null,message:`Database version (v${r.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 mS="email_automator_migration_reminder_dismissed_at";function a4(t=24){try{const e=localStorage.getItem(mS);if(!e)return!1;const s=new Date(e).getTime();return(Date.now()-s)/(1e3*60*60)<t}catch(e){return console.error("Error checking migration reminder:",e),!1}}function r4(){try{localStorage.setItem(mS,new Date().toISOString())}catch(t){console.error("Error dismissing migration reminder:",t)}}const bm={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 i4(t,e){switch(e.type){case"SET_STEP":return{...t,step:e.payload,error:null};case"SET_ACCESS_TOKEN":return{...t,managed:{...t.managed,accessToken:e.payload}};case"SET_ORGANIZATIONS":return{...t,managed:{...t.managed,organizations:e.payload,selectedOrg:e.payload.length>0?e.payload[0].id:""}};case"SET_SELECTED_ORG":return{...t,managed:{...t.managed,selectedOrg:e.payload}};case"SET_PROJECT_NAME":return{...t,managed:{...t.managed,projectName:e.payload}};case"SET_REGION":return{...t,managed:{...t.managed,region:e.payload}};case"SET_FETCHING_ORGS":return{...t,managed:{...t.managed,isFetchingOrgs:e.payload}};case"SET_MANUAL_URL":return{...t,manual:{...t.manual,url:e.payload}};case"SET_MANUAL_ANON_KEY":return{...t,manual:{...t.manual,anonKey:e.payload}};case"SET_PROJECT_ID":return{...t,projectId:e.payload};case"ADD_LOG":return{...t,logs:[...t.logs,{...e.payload,timestamp:Date.now()}].slice(-500)};case"CLEAR_LOGS":return{...t,logs:[]};case"SET_ERROR":return{...t,error:e.payload};case"SET_MIGRATING":return{...t,isMigrating:e.payload};case"SET_MIGRATION_STATUS":return{...t,migrationStatus:e.payload};case"RESET_MANAGED_FLOW":return{...t,managed:{...bm.managed},error:null};case"RESET_MANUAL_FLOW":return{...t,manual:{...bm.manual},error:null};default:return t}}function Nf(t){const e=t.trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}.supabase.co`:""}function pS(t){const e=t.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 gb(t){const e=t.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 o4{buffer="";processChunk(e){const s=[];this.buffer+=e;const r=this.buffer.split(`
60
+ `);this.buffer=r.pop()||"";for(const o of r)if(o.startsWith("data: "))try{const u=o.slice(6),d=JSON.parse(u);s.push(d)}catch(u){console.warn("[SSEParser] Failed to parse event:",o,u)}return s}flush(){if(!this.buffer.trim())return[];const e=[];if(this.buffer.startsWith("data: "))try{const s=this.buffer.slice(6),r=JSON.parse(s);e.push(r)}catch(s){console.warn("[SSEParser] Failed to parse final buffer:",this.buffer,s)}return this.buffer="",e}reset(){this.buffer=""}}async function gS(t,e,s={}){const{timeout:r=3e5,onError:o}=s;if(!t.body)throw new Error("Response body is empty");const u=t.body.getReader(),d=new TextDecoder,f=new o4,p=setTimeout(()=>{u.cancel("Timeout")},r);try{for(;;){const{value:m,done:y}=await u.read();if(y){f.flush().forEach(e);break}const v=d.decode(m,{stream:!0});f.processChunk(v).forEach(e)}}catch(m){const y=m instanceof Error?m:new Error(String(m));if(o)o(y);else throw y}finally{clearTimeout(p),f.reset()}}class ea extends Error{constructor(e,s,r){super(e),this.code=s,this.status=r,this.name="SetupApiError"}}async function l4(t){const e=await fetch("/api/setup/organizations",{headers:{Authorization:`Bearer ${t}`}}),s=await e.json();if(!e.ok)throw new ea(s.error||"Failed to fetch organizations","FETCH_ORGS_FAILED",e.status);return s}async function c4(t,e){const s=await fetch("/api/setup/auto-provision",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.accessToken}`},body:JSON.stringify({orgId:t.orgId,projectName:t.projectName,region:t.region})});if(!s.ok){const r=await s.json().catch(()=>({}));throw new ea(r.error||"Failed to provision project","PROVISION_FAILED",s.status)}await gS(s,e,{timeout:3e5,onError:r=>{throw new ea(`Provisioning stream error: ${r.message}`,"STREAM_ERROR")}})}async function u4(t,e){const s=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:t.projectRef,dbPassword:t.dbPassword,accessToken:t.accessToken})});if(!s.ok){const r=await s.json().catch(()=>({}));throw new ea(r.error||"Failed to start migration","MIGRATION_FAILED",s.status)}await gS(s,e,{timeout:6e5,onError:r=>{throw new ea(`Migration stream error: ${r.message}`,"STREAM_ERROR")}})}function d4({onNext:t}){const{t:e}=nt();return l.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-8",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-4xl font-black italic tracking-tighter uppercase leading-none",children:e("setup.welcomeTitle")}),l.jsx("p",{className:"text-sm text-muted-foreground font-medium max-w-sm",children:e("setup.welcomeSubtitle")})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.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:[l.jsx(km,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),l.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest",children:e("setup.encryptedTitle")}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:e("setup.encryptedDesc")})]}),l.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:[l.jsx(qo,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),l.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest",children:e("setup.turboTitle")}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:e("setup.turboDesc")})]})]}),l.jsxs(Q,{onClick:t,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"),l.jsx(Tm,{className:"w-5 h-5 ml-4 rotate-180 group-hover:translate-x-1 transition-transform","aria-hidden":"true"})]})]})}function h4({onManaged:t,onManual:e,onBack:s}){const{t:r}=nt();return l.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:r("setup.connectionMode")}),l.jsx("p",{className:"text-xs text-muted-foreground font-bold tracking-widest uppercase",children:r("setup.selectVector")})]}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("button",{onClick:t,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:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"p-3 bg-primary rounded-xl shadow-lg ring-4 ring-primary/10",children:l.jsx(PT,{className:"w-6 h-6 text-primary-foreground","aria-hidden":"true"})}),l.jsxs("div",{children:[l.jsx("p",{className:"font-black uppercase italic text-sm tracking-tight",children:r("setup.quickIgnition")}),l.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:r("setup.autoProvision")})]})]}),l.jsx(au,{className:"w-5 h-5 text-primary opacity-50 group-hover:opacity-100 transition-all group-hover:translate-x-1"})]}),l.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:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"p-3 bg-muted rounded-xl",children:l.jsx(wu,{className:"w-6 h-6 text-muted-foreground","aria-hidden":"true"})}),l.jsxs("div",{children:[l.jsx("p",{className:"font-black uppercase italic text-sm tracking-tight text-foreground/80",children:r("setup.manualSync")}),l.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:r("setup.existingCredentials")})]})]}),l.jsx(au,{className:"w-5 h-5 text-muted-foreground opacity-50 group-hover:opacity-100 transition-all group-hover:translate-x-1"})]})]}),l.jsxs("button",{onClick:s,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:[l.jsx(Tm,{size:12,"aria-hidden":"true"})," ",r("setup.abortAccess")]})]})}const Te=w.forwardRef(({className:t,type:e,...s},r)=>l.jsx("input",{type:e,className:we("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",t),ref:r,...s}));Te.displayName="Input";var yS=Rb();const f4=_m(yS);var m4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],p4=m4.reduce((t,e)=>{const s=$b(`Primitive.${e}`),r=w.forwardRef((o,u)=>{const{asChild:d,...f}=o,p=d?s:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(p,{...f,ref:u})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),g4="Label",vS=w.forwardRef((t,e)=>l.jsx(p4.label,{...t,ref:e,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(t.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));vS.displayName=g4;var y4=vS;function $t({className:t,...e}){return l.jsx(y4,{"data-slot":"label",className:we("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",t),...e})}const v4=Fb("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 Za({className:t,variant:e,...s}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:we(v4({variant:e}),t),...s})}function er({className:t,...e}){return l.jsx("div",{"data-slot":"alert-description",className:we("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...e})}function x4({accessToken:t,error:e,isFetching:s,onTokenChange:r,onFetchOrgs:o,onBack:u}){const f=pS(t).valid;return l.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Forge Token"}),l.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Supabase API coordinates"})]}),e&&l.jsxs(Za,{variant:"destructive",className:"rounded-xl bg-destructive/5 text-destructive border-destructive/20 text-[11px] font-bold",children:[l.jsx(Mn,{className:"h-4 w-4"}),l.jsx(er,{children:e})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx($t,{htmlFor:"access-token",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Personal Access Token"}),l.jsxs("div",{className:"relative",children:[l.jsx(Am,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:14,"aria-hidden":"true"}),l.jsx(Te,{id:"access-token",type:"password",placeholder:"sbp_xxxxxxxxxxxxxxxx",value:t,onChange:p=>r(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"})]}),l.jsxs("p",{id:"token-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:["Generate at"," ",l.jsx("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"supabase.com/dashboard/tokens"})]})]}),l.jsxs("div",{className:"flex gap-3 pt-4",children:[l.jsx(Q,{variant:"outline",onClick:u,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",disabled:s,children:"Back"}),l.jsx(Q,{onClick:o,disabled:!f||s,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest group shadow-lg hover:shadow-primary/20",children:s?l.jsx(zt,{className:"w-4 h-4 animate-spin"}):l.jsxs(l.Fragment,{children:["Scan Organizations"," ",l.jsx(au,{size:14,className:"ml-2 group-hover:translate-x-1 transition-transform"})]})})]})]})]})}function b4({organizations:t,selectedOrg:e,projectName:s,region:r,onOrgSelect:o,onProjectNameChange:u,onRegionChange:d,onProvision:f,onBack:p}){return l.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Project Config"}),l.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Engine parameters"})]}),l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx($t,{htmlFor:"project-name",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Project Name"}),l.jsx(Te,{id:"project-name",value:s,onChange:m=>u(m.target.value),className:"bg-muted/20 border-border/50 rounded-xl text-[11px]"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx($t,{htmlFor:"region",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Hosting Sector"}),l.jsxs("select",{id:"region",value:r,onChange:m=>d(m.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:[l.jsx("option",{value:"us-east-1",children:"US East (N. Virginia)"}),l.jsx("option",{value:"us-west-1",children:"US West (N. California)"}),l.jsx("option",{value:"eu-central-1",children:"Europe (Frankfurt)"}),l.jsx("option",{value:"ap-southeast-1",children:"Asia Pacific (Singapore)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx($t,{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Vessel (Organization)"}),l.jsx("div",{className:"max-h-[160px] overflow-y-auto space-y-2 pr-1 custom-scrollbar",role:"radiogroup","aria-label":"Select organization",children:t.map(m=>l.jsxs("button",{onClick:()=>o(m.id),role:"radio","aria-checked":e===m.id,className:we("w-full flex items-center justify-between p-3 rounded-xl border text-[11px] font-bold transition-all",e===m.id?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/30 border-border/50"),children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(fT,{className:we("w-3.5 h-3.5",e===m.id?"text-primary":"text-muted-foreground/50"),"aria-hidden":"true"}),l.jsx("span",{children:m.name})]}),e===m.id&&l.jsx("div",{className:"w-2 h-2 rounded-full bg-primary animate-pulse","aria-hidden":"true"})]},m.id))})]}),l.jsxs("div",{className:"flex gap-3 pt-2",children:[l.jsx(Q,{variant:"outline",onClick:p,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Back"}),l.jsx(Q,{onClick:f,disabled:!e,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest shadow-md",children:"Initialize System"})]})]})]})}function xS({logs:t,className:e}){const s=w.useRef(null);return w.useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth"})},[t]),l.jsxs("div",{className:we("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:[l.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:[l.jsx(iu,{size:10,"aria-hidden":"true"}),l.jsx("span",{children:"Live Feed"})]}),t.length===0?l.jsx("div",{className:"text-slate-600 italic animate-pulse",role:"status",children:"Awaiting kernel signals..."}):l.jsxs(l.Fragment,{children:[t.map((r,o)=>l.jsxs("div",{className:we("mb-1 break-all transition-all duration-300",r.type==="error"&&"text-red-400 font-bold",r.type==="success"&&"text-green-400 font-bold",r.type==="info"&&"text-blue-300",r.type==="stdout"&&"text-slate-400",r.type==="stderr"&&"text-yellow-400"),children:[l.jsxs("span",{className:"text-slate-600 mr-2 tabular-nums",children:["[",new Date(r.timestamp).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),"]"]}),r.message]},`${r.timestamp}-${o}`)),l.jsx("div",{ref:s})]})]})}function w4({logs:t,error:e,onRetry:s}){return l.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(zt,{className:"w-5 h-5 animate-spin text-primary","aria-hidden":"true"}),l.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Provisioning"})]}),l.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Assembling infrastructure..."})]}),l.jsx(xS,{logs:t}),e&&l.jsx(Q,{variant:"destructive",onClick:s,className:"w-full h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Re-Initialize Engine"})]})}function S4({url:t,anonKey:e,error:s,onUrlChange:r,onAnonKeyChange:o,onSave:u,onBack:d}){const{t:f}=nt(),p=t.trim().length>0&&e.trim().length>0;return l.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:f("setup.manualSync")}),l.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:f("setup.injectCoordinates")})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx($t,{htmlFor:"platform-url",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:f("setup.platformUrl")}),l.jsx(Te,{id:"platform-url",placeholder:"https://xyz.supabase.co",value:t,onChange:m=>r(m.target.value),className:"bg-muted/20 border-border/50 rounded-xl h-12","aria-describedby":"url-help","aria-invalid":s?"true":"false"}),l.jsx("p",{id:"url-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:f("setup.urlHelp")})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx($t,{htmlFor:"anon-key",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:f("setup.anonMatrixKey")}),l.jsx(Te,{id:"anon-key",type:"password",placeholder:"eyJ...",value:e,onChange:m=>o(m.target.value),className:"bg-muted/20 border-border/50 rounded-xl h-12","aria-describedby":"key-help","aria-invalid":s?"true":"false"}),l.jsx("p",{id:"key-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:f("setup.keyHelp")})]})]}),s&&l.jsxs(ms.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:[l.jsx(Mn,{size:14,"aria-hidden":"true"}),l.jsx("span",{children:s})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-4",children:[l.jsx(Q,{variant:"outline",onClick:d,className:"h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:f("setup.back")}),l.jsx(Q,{onClick:u,disabled:!p,className:"h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest bg-primary shadow-lg hover:shadow-primary/20",children:f("setup.engage")})]})]})}function _4({logs:t,error:e,isMigrating:s,migrationStatus:r,accessToken:o,onTokenChange:u,onRunMigration:d,onBypass:f}){const p=!o,m=r?.dbVersion!==null&&!r?.isUnknown,y=r?.dbVersion===null||r?.isUnknown;return l.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[s?l.jsx(zt,{className:"w-5 h-5 animate-spin text-primary","aria-hidden":"true"}):l.jsx(DE,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),l.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Installation"})]}),l.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Applying schema DNA..."})]}),l.jsx(xS,{logs:t}),!s&&l.jsxs(ms.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:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed font-medium",children:y?"Empty project detected. Initialization is mandatory to install core AI systems.":`Version mismatch detected (v${r?.dbVersion||"?.?"} → v${r?.appVersion||pi}). Normalization is recommended.`}),p&&l.jsxs("div",{className:"space-y-2 pt-2 border-t border-primary/10",children:[l.jsx($t,{htmlFor:"migration-token",className:"text-[10px] font-bold uppercase tracking-widest text-primary/60",children:"Management Token Required"}),l.jsxs("div",{className:"relative",children:[l.jsx(Am,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-primary/30",size:12,"aria-hidden":"true"}),l.jsx(Te,{id:"migration-token",type:"password",placeholder:"sbp_xxxxxxxxxxxxxxxx",value:o,onChange:v=>u(v.target.value),className:"pl-9 h-10 bg-background/50 border-primary/20 rounded-xl text-[11px]","aria-describedby":"migration-token-help"})]}),l.jsxs("p",{id:"migration-token-help",className:"text-[9px] text-muted-foreground/60 italic px-1",children:["Used once to run ",l.jsx("code",{className:"text-primary/70",children:"migrate.sh"})," on your backend."]})]})]}),l.jsxs("div",{className:"flex gap-3",children:[m&&l.jsx(Q,{variant:"ghost",onClick:f,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)"}),l.jsx(Q,{onClick:d,disabled:p,className:"flex-1 h-11 bg-primary text-[10px] font-bold uppercase tracking-widest shadow-lg hover:shadow-primary/30",children:y?"Install Systems":"Normalize System"})]})]}),e&&l.jsxs("div",{className:"space-y-3",children:[l.jsxs(Za,{variant:"destructive",className:"rounded-xl border-destructive/20 bg-destructive/5 text-destructive font-bold text-[11px]",children:[l.jsx(Mn,{className:"h-4 w-4"}),l.jsx(er,{children:e})]}),l.jsx(Q,{variant:"outline",onClick:d,className:"w-full h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Retry Installation"})]})]})}function Hc({step:t,currentStep:e,label:s}){const r=Array.isArray(t)?t.includes(e):e===t;return l.jsx("div",{className:we("px-3 py-1.5 rounded-full text-[9px] font-black uppercase tracking-[0.2em] transition-all duration-500",r?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground opacity-40"),role:"status","aria-current":r,children:s})}function gp({className:t}){return l.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:we("w-9 h-9",t),children:[l.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"}),l.jsx("path",{d:"M64 160 L240 290 C250 295 262 295 272 290 L448 160",stroke:"currentColor",strokeWidth:"28",strokeLinecap:"round",strokeLinejoin:"round"}),l.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 bS({onComplete:t,open:e=!0,canClose:s=!1}){const[r,o]=w.useReducer(i4,bm),{t:u}=nt(),d=w.useRef(""),f=w.useRef("");w.useEffect(()=>()=>{d.current="",f.current=""},[]);const p=w.useCallback((_,E)=>{o({type:"ADD_LOG",payload:{type:_,message:E}})},[]),m=w.useCallback(async()=>{o({type:"SET_ERROR",payload:null}),o({type:"SET_FETCHING_ORGS",payload:!0});const _=r.managed.accessToken.trim(),E=pS(_);if(!E.valid){o({type:"SET_ERROR",payload:E.message||"Invalid token"}),o({type:"SET_FETCHING_ORGS",payload:!1});return}try{d.current=_;const T=await l4(_);o({type:"SET_ORGANIZATIONS",payload:T}),o({type:"SET_STEP",payload:"managed-org"})}catch(T){const A=T instanceof ea?T:new Error(String(T));o({type:"SET_ERROR",payload:A.message})}finally{o({type:"SET_FETCHING_ORGS",payload:!1})}},[r.managed.accessToken]),y=w.useCallback(async()=>{o({type:"SET_ERROR",payload:null}),o({type:"SET_STEP",payload:"provisioning"}),o({type:"CLEAR_LOGS"}),p("info","Connecting to Supabase provisioning engine...");const _=d.current||r.managed.accessToken.trim();let E=null;try{if(await c4({accessToken:_,orgId:r.managed.selectedOrg,projectName:r.managed.projectName,region:r.managed.region},T=>{switch(T.type){case"info":p("info",T.data);break;case"project_id":o({type:"SET_PROJECT_ID",payload:T.data});break;case"success":E=T.data,p("success","✨ Project ready! Initializing database..."),uf({url:Nf(E.url),anonKey:E.anonKey.trim()}),f.current=E.dbPass,o({type:"SET_MIGRATION_STATUS",payload:{needsMigration:!0,dbVersion:null,appVersion:pi,isUnknown:!0}});break;case"error":o({type:"SET_ERROR",payload:T.data}),p("error",T.data);break}}),E){const T=E;await v(T.projectId,_,T.url,T.anonKey)}}catch(T){const A=T instanceof ea?T:new Error(String(T));o({type:"SET_ERROR",payload:A.message}),p("error",`Provisioning failed: ${A.message}`)}},[r.managed.selectedOrg,r.managed.projectName,r.managed.region,r.managed.accessToken,p]),v=w.useCallback(async(_,E,T,A)=>{const D=_||r.projectId||gb(r.manual.url),N=E||d.current||r.managed.accessToken.trim(),L=T||r.manual.url,G=A||r.manual.anonKey;if(!D||!N){o({type:"SET_ERROR",payload:"Project ID and Access Token are required for migration."});return}o({type:"SET_STEP",payload:"migration"}),o({type:"SET_ERROR",payload:null}),o({type:"SET_MIGRATING",payload:!0}),o({type:"CLEAR_LOGS"}),p("info","📦 Preparing database schema initialization...");try{let F=!1;if(await u4({projectRef:D,dbPassword:f.current,accessToken:N},U=>{switch(U.type){case"stdout":p("stdout",U.data);break;case"stderr":p("stderr",`⚠️ ${U.data}`);break;case"info":p("info",U.data);break;case"error":p("error",U.data);break;case"done":U.data==="success"?(F=!0,p("success","✅ Database setup complete!"),L&&G&&uf({url:Nf(L),anonKey:G.trim()}),d.current="",f.current="",setTimeout(()=>{t(),window.location.reload()},2e3)):o({type:"SET_ERROR",payload:"Migration failed. Check terminal logs for details."});break}}),!F)throw new Error("Migration did not complete successfully")}catch(F){const U=F instanceof ea?F:new Error(String(F));o({type:"SET_ERROR",payload:U.message}),p("error",`Migration failed: ${U.message}`)}finally{o({type:"SET_MIGRATING",payload:!1})}},[r.projectId,r.manual.url,r.manual.anonKey,r.managed.accessToken,p,t]),b=w.useCallback(async()=>{o({type:"SET_ERROR",payload:null}),o({type:"SET_STEP",payload:"validating"});const _=Nf(r.manual.url),E=r.manual.anonKey.trim(),T=await Xk(_,E);if(T.valid){o({type:"SET_MANUAL_URL",payload:_});const A=gb(_);A&&o({type:"SET_PROJECT_ID",payload:A}),uf({url:_,anonKey:E});try{const D=Yf(_,E),N=await pp(D);o({type:"SET_MIGRATION_STATUS",payload:N}),N.needsMigration?o({type:"SET_STEP",payload:"migration"}):(p("success","✨ Database is already up-to-date! Redirecting..."),setTimeout(()=>{t(),window.location.reload()},2e3))}catch(D){console.warn("[SetupWizard] Migration check failed:",D),o({type:"SET_MIGRATION_STATUS",payload:{needsMigration:!0,dbVersion:null,appVersion:pi,isUnknown:!0}}),o({type:"SET_STEP",payload:"migration"})}}else o({type:"SET_ERROR",payload:T.error||"Connection failed"}),o({type:"SET_STEP",payload:"credentials"})},[r.manual.url,r.manual.anonKey,p,t]);if(!e)return null;const S={initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20}};return l.jsx("div",{className:"fixed inset-0 z-50 bg-background flex flex-col items-center justify-center p-0 md:p-8",children:l.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:[l.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:[l.jsxs("div",{className:"space-y-8 relative z-10",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[l.jsx("div",{className:"p-2 bg-primary rounded-lg flex-shrink-0",children:l.jsx(gp,{className:"w-5 h-5 text-primary-foreground"})}),l.jsx("span",{className:"font-black italic tracking-tighter uppercase text-xs truncate",children:"Automator Forge"})]}),l.jsxs("div",{className:"space-y-6",children:[l.jsx("p",{className:"text-[9px] font-black uppercase tracking-[0.4em] text-muted-foreground/30 ml-1",children:"Assembly Phase"}),l.jsxs("div",{className:"space-y-4 px-1",children:[l.jsx(Hc,{step:"welcome",currentStep:r.step,label:u("setup.initiation")}),l.jsx(Hc,{step:["type","managed-token","credentials"],currentStep:r.step,label:u("setup.coordinates")}),l.jsx(Hc,{step:["managed-org","provisioning","validating"],currentStep:r.step,label:u("setup.foundation")}),l.jsx(Hc,{step:"migration",currentStep:r.step,label:u("setup.ignition")})]})]})]}),l.jsx("div",{className:"relative z-10 space-y-4",children:l.jsxs("p",{className:"text-[9px] font-bold text-muted-foreground/30 uppercase tracking-[0.4em] px-2 text-center",children:["v",pi," // Stable Build"]})})]}),l.jsxs("div",{className:"flex-1 p-8 md:p-12 flex flex-col relative",children:[s&&l.jsx("button",{onClick:t,className:"absolute top-6 right-6 p-2 rounded-full hover:bg-secondary transition-colors z-[60]","aria-label":"Close setup wizard",children:l.jsx(aa,{className:"w-5 h-5 text-muted-foreground opacity-40 hover:opacity-100 transition-opacity"})}),l.jsx("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:l.jsx(mp,{})}),l.jsx(Z1,{mode:"wait",children:l.jsxs(ms.div,{initial:"initial",animate:"animate",exit:"exit",variants:S,transition:{type:"spring",damping:25,stiffness:200},className:"flex-1 flex flex-col",children:[r.step==="welcome"&&l.jsx(d4,{onNext:()=>o({type:"SET_STEP",payload:"type"})}),r.step==="type"&&l.jsx(h4,{onManaged:()=>{o({type:"RESET_MANUAL_FLOW"}),o({type:"SET_STEP",payload:"managed-token"})},onManual:()=>{o({type:"RESET_MANAGED_FLOW"}),o({type:"SET_STEP",payload:"credentials"})},onBack:()=>o({type:"SET_STEP",payload:"welcome"})}),r.step==="managed-token"&&l.jsx(x4,{accessToken:r.managed.accessToken,error:r.error,isFetching:r.managed.isFetchingOrgs,onTokenChange:_=>o({type:"SET_ACCESS_TOKEN",payload:_}),onFetchOrgs:m,onBack:()=>o({type:"SET_STEP",payload:"type"})}),r.step==="managed-org"&&l.jsx(b4,{organizations:r.managed.organizations,selectedOrg:r.managed.selectedOrg,projectName:r.managed.projectName,region:r.managed.region,onOrgSelect:_=>o({type:"SET_SELECTED_ORG",payload:_}),onProjectNameChange:_=>o({type:"SET_PROJECT_NAME",payload:_}),onRegionChange:_=>o({type:"SET_REGION",payload:_}),onProvision:y,onBack:()=>o({type:"SET_STEP",payload:"managed-token"})}),r.step==="provisioning"&&l.jsx(w4,{logs:r.logs,error:r.error,onRetry:()=>o({type:"SET_STEP",payload:"managed-token"})}),r.step==="credentials"&&l.jsx(S4,{url:r.manual.url,anonKey:r.manual.anonKey,error:r.error,onUrlChange:_=>o({type:"SET_MANUAL_URL",payload:_}),onAnonKeyChange:_=>o({type:"SET_MANUAL_ANON_KEY",payload:_}),onSave:b,onBack:()=>o({type:"SET_STEP",payload:"type"})}),r.step==="migration"&&l.jsx(_4,{logs:r.logs,error:r.error,isMigrating:r.isMigrating,migrationStatus:r.migrationStatus,accessToken:r.managed.accessToken,onTokenChange:_=>o({type:"SET_ACCESS_TOKEN",payload:_}),onRunMigration:()=>v(),onBypass:()=>{t(),window.location.reload()}})]},r.step)})]})]})})}function ta(t,e,{checkForDefaultPrevented:s=!0}={}){return function(o){if(t?.(o),s===!1||!o.defaultPrevented)return e?.(o)}}function j4(t,e){const s=w.createContext(e),r=u=>{const{children:d,...f}=u,p=w.useMemo(()=>f,Object.values(f));return l.jsx(s.Provider,{value:p,children:d})};r.displayName=t+"Provider";function o(u){const d=w.useContext(s);if(d)return d;if(e!==void 0)return e;throw new Error(`\`${u}\` must be used within \`${t}\``)}return[r,o]}function E4(t,e=[]){let s=[];function r(u,d){const f=w.createContext(d),p=s.length;s=[...s,d];const m=v=>{const{scope:b,children:S,..._}=v,E=b?.[t]?.[p]||f,T=w.useMemo(()=>_,Object.values(_));return l.jsx(E.Provider,{value:T,children:S})};m.displayName=u+"Provider";function y(v,b){const S=b?.[t]?.[p]||f,_=w.useContext(S);if(_)return _;if(d!==void 0)return d;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[m,y]}const o=()=>{const u=s.map(d=>w.createContext(d));return function(f){const p=f?.[t]||u;return w.useMemo(()=>({[`__scope${t}`]:{...f,[t]:p}}),[f,p])}};return o.scopeName=t,[r,T4(o,...e)]}function T4(...t){const e=t[0];if(t.length===1)return e;const s=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(u){const d=r.reduce((f,{useScope:p,scopeName:m})=>{const v=p(u)[`__scope${m}`];return{...f,...v}},{});return w.useMemo(()=>({[`__scope${e.scopeName}`]:d}),[d])}};return s.scopeName=e.scopeName,s}var el=globalThis?.document?w.useLayoutEffect:()=>{},N4=Em[" useId ".trim().toString()]||(()=>{}),A4=0;function Af(t){const[e,s]=w.useState(N4());return el(()=>{s(r=>r??String(A4++))},[t]),t||(e?`radix-${e}`:"")}var k4=Em[" useInsertionEffect ".trim().toString()]||el;function C4({prop:t,defaultProp:e,onChange:s=()=>{},caller:r}){const[o,u,d]=R4({defaultProp:e,onChange:s}),f=t!==void 0,p=f?t:o;{const y=w.useRef(t!==void 0);w.useEffect(()=>{const v=y.current;v!==f&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${f?"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.`),y.current=f},[f,r])}const m=w.useCallback(y=>{if(f){const v=O4(y)?y(t):y;v!==t&&d.current?.(v)}else u(y)},[f,t,u,d]);return[p,m]}function R4({defaultProp:t,onChange:e}){const[s,r]=w.useState(t),o=w.useRef(s),u=w.useRef(e);return k4(()=>{u.current=e},[e]),w.useEffect(()=>{o.current!==s&&(u.current?.(s),o.current=s)},[s,o]),[s,r,u]}function O4(t){return typeof t=="function"}function D4(t){const e=M4(t),s=w.forwardRef((r,o)=>{const{children:u,...d}=r,f=w.Children.toArray(u),p=f.find(L4);if(p){const m=p.props.children,y=f.map(v=>v===p?w.Children.count(m)>1?w.Children.only(null):w.isValidElement(m)?m.props.children:null:v);return l.jsx(e,{...d,ref:o,children:w.isValidElement(m)?w.cloneElement(m,void 0,y):null})}return l.jsx(e,{...d,ref:o,children:u})});return s.displayName=`${t}.Slot`,s}function M4(t){const e=w.forwardRef((s,r)=>{const{children:o,...u}=s;if(w.isValidElement(o)){const d=P4(o),f=U4(u,o.props);return o.type!==w.Fragment&&(f.ref=r?_u(r,d):d),w.cloneElement(o,f)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var z4=Symbol("radix.slottable");function L4(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===z4}function U4(t,e){const s={...e};for(const r in e){const o=t[r],u=e[r];/^on[A-Z]/.test(r)?o&&u?s[r]=(...f)=>{const p=u(...f);return o(...f),p}:o&&(s[r]=o):r==="style"?s[r]={...o,...u}:r==="className"&&(s[r]=[o,u].filter(Boolean).join(" "))}return{...t,...s}}function P4(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var V4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xs=V4.reduce((t,e)=>{const s=D4(`Primitive.${e}`),r=w.forwardRef((o,u)=>{const{asChild:d,...f}=o,p=d?s:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(p,{...f,ref:u})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function B4(t,e){t&&yS.flushSync(()=>t.dispatchEvent(e))}function tl(t){const e=w.useRef(t);return w.useEffect(()=>{e.current=t}),w.useMemo(()=>(...s)=>e.current?.(...s),[])}function I4(t,e=globalThis?.document){const s=tl(t);w.useEffect(()=>{const r=o=>{o.key==="Escape"&&s(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[s,e])}var q4="DismissableLayer",wm="dismissableLayer.update",$4="dismissableLayer.pointerDownOutside",H4="dismissableLayer.focusOutside",yb,wS=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),SS=w.forwardRef((t,e)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:u,onInteractOutside:d,onDismiss:f,...p}=t,m=w.useContext(wS),[y,v]=w.useState(null),b=y?.ownerDocument??globalThis?.document,[,S]=w.useState({}),_=nr(e,U=>v(U)),E=Array.from(m.layers),[T]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),A=E.indexOf(T),D=y?E.indexOf(y):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,L=D>=A,G=K4(U=>{const M=U.target,J=[...m.branches].some(re=>re.contains(M));!L||J||(o?.(U),d?.(U),U.defaultPrevented||f?.())},b),F=Y4(U=>{const M=U.target;[...m.branches].some(re=>re.contains(M))||(u?.(U),d?.(U),U.defaultPrevented||f?.())},b);return I4(U=>{D===m.layers.size-1&&(r?.(U),!U.defaultPrevented&&f&&(U.preventDefault(),f()))},b),w.useEffect(()=>{if(y)return s&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(yb=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(y)),m.layers.add(y),vb(),()=>{s&&m.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=yb)}},[y,b,s,m]),w.useEffect(()=>()=>{y&&(m.layers.delete(y),m.layersWithOutsidePointerEventsDisabled.delete(y),vb())},[y,m]),w.useEffect(()=>{const U=()=>S({});return document.addEventListener(wm,U),()=>document.removeEventListener(wm,U)},[]),l.jsx(xs.div,{...p,ref:_,style:{pointerEvents:N?L?"auto":"none":void 0,...t.style},onFocusCapture:ta(t.onFocusCapture,F.onFocusCapture),onBlurCapture:ta(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:ta(t.onPointerDownCapture,G.onPointerDownCapture)})});SS.displayName=q4;var G4="DismissableLayerBranch",F4=w.forwardRef((t,e)=>{const s=w.useContext(wS),r=w.useRef(null),o=nr(e,r);return w.useEffect(()=>{const u=r.current;if(u)return s.branches.add(u),()=>{s.branches.delete(u)}},[s.branches]),l.jsx(xs.div,{...t,ref:o})});F4.displayName=G4;function K4(t,e=globalThis?.document){const s=tl(t),r=w.useRef(!1),o=w.useRef(()=>{});return w.useEffect(()=>{const u=f=>{if(f.target&&!r.current){let p=function(){_S($4,s,m,{discrete:!0})};const m={originalEvent:f};f.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=p,e.addEventListener("click",o.current,{once:!0})):p()}else e.removeEventListener("click",o.current);r.current=!1},d=window.setTimeout(()=>{e.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(d),e.removeEventListener("pointerdown",u),e.removeEventListener("click",o.current)}},[e,s]),{onPointerDownCapture:()=>r.current=!0}}function Y4(t,e=globalThis?.document){const s=tl(t),r=w.useRef(!1);return w.useEffect(()=>{const o=u=>{u.target&&!r.current&&_S(H4,s,{originalEvent:u},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,s]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function vb(){const t=new CustomEvent(wm);document.dispatchEvent(t)}function _S(t,e,s,{discrete:r}){const o=s.originalEvent.target,u=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:s});e&&o.addEventListener(t,e,{once:!0}),r?B4(o,u):o.dispatchEvent(u)}var kf="focusScope.autoFocusOnMount",Cf="focusScope.autoFocusOnUnmount",xb={bubbles:!1,cancelable:!0},X4="FocusScope",jS=w.forwardRef((t,e)=>{const{loop:s=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:u,...d}=t,[f,p]=w.useState(null),m=tl(o),y=tl(u),v=w.useRef(null),b=nr(e,E=>p(E)),S=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let E=function(N){if(S.paused||!f)return;const L=N.target;f.contains(L)?v.current=L:Fs(v.current,{select:!0})},T=function(N){if(S.paused||!f)return;const L=N.relatedTarget;L!==null&&(f.contains(L)||Fs(v.current,{select:!0}))},A=function(N){if(document.activeElement===document.body)for(const G of N)G.removedNodes.length>0&&Fs(f)};document.addEventListener("focusin",E),document.addEventListener("focusout",T);const D=new MutationObserver(A);return f&&D.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",T),D.disconnect()}}},[r,f,S.paused]),w.useEffect(()=>{if(f){wb.add(S);const E=document.activeElement;if(!f.contains(E)){const A=new CustomEvent(kf,xb);f.addEventListener(kf,m),f.dispatchEvent(A),A.defaultPrevented||(W4(tM(ES(f)),{select:!0}),document.activeElement===E&&Fs(f))}return()=>{f.removeEventListener(kf,m),setTimeout(()=>{const A=new CustomEvent(Cf,xb);f.addEventListener(Cf,y),f.dispatchEvent(A),A.defaultPrevented||Fs(E??document.body,{select:!0}),f.removeEventListener(Cf,y),wb.remove(S)},0)}}},[f,m,y,S]);const _=w.useCallback(E=>{if(!s&&!r||S.paused)return;const T=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,A=document.activeElement;if(T&&A){const D=E.currentTarget,[N,L]=J4(D);N&&L?!E.shiftKey&&A===L?(E.preventDefault(),s&&Fs(N,{select:!0})):E.shiftKey&&A===N&&(E.preventDefault(),s&&Fs(L,{select:!0})):A===D&&E.preventDefault()}},[s,r,S.paused]);return l.jsx(xs.div,{tabIndex:-1,...d,ref:b,onKeyDown:_})});jS.displayName=X4;function W4(t,{select:e=!1}={}){const s=document.activeElement;for(const r of t)if(Fs(r,{select:e}),document.activeElement!==s)return}function J4(t){const e=ES(t),s=bb(e,t),r=bb(e.reverse(),t);return[s,r]}function ES(t){const e=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)e.push(s.currentNode);return e}function bb(t,e){for(const s of t)if(!Q4(s,{upTo:e}))return s}function Q4(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Z4(t){return t instanceof HTMLInputElement&&"select"in t}function Fs(t,{select:e=!1}={}){if(t&&t.focus){const s=document.activeElement;t.focus({preventScroll:!0}),t!==s&&Z4(t)&&e&&t.select()}}var wb=eM();function eM(){let t=[];return{add(e){const s=t[0];e!==s&&s?.pause(),t=Sb(t,e),t.unshift(e)},remove(e){t=Sb(t,e),t[0]?.resume()}}}function Sb(t,e){const s=[...t],r=s.indexOf(e);return r!==-1&&s.splice(r,1),s}function tM(t){return t.filter(e=>e.tagName!=="A")}var nM="Portal",TS=w.forwardRef((t,e)=>{const{container:s,...r}=t,[o,u]=w.useState(!1);el(()=>u(!0),[]);const d=s||o&&globalThis?.document?.body;return d?f4.createPortal(l.jsx(xs.div,{...r,ref:e}),d):null});TS.displayName=nM;function sM(t,e){return w.useReducer((s,r)=>e[s][r]??s,t)}var Ru=t=>{const{present:e,children:s}=t,r=aM(e),o=typeof s=="function"?s({present:r.isPresent}):w.Children.only(s),u=nr(r.ref,rM(o));return typeof s=="function"||r.isPresent?w.cloneElement(o,{ref:u}):null};Ru.displayName="Presence";function aM(t){const[e,s]=w.useState(),r=w.useRef(null),o=w.useRef(t),u=w.useRef("none"),d=t?"mounted":"unmounted",[f,p]=sM(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const m=Gc(r.current);u.current=f==="mounted"?m:"none"},[f]),el(()=>{const m=r.current,y=o.current;if(y!==t){const b=u.current,S=Gc(m);t?p("MOUNT"):S==="none"||m?.display==="none"?p("UNMOUNT"):p(y&&b!==S?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,p]),el(()=>{if(e){let m;const y=e.ownerDocument.defaultView??window,v=S=>{const E=Gc(r.current).includes(CSS.escape(S.animationName));if(S.target===e&&E&&(p("ANIMATION_END"),!o.current)){const T=e.style.animationFillMode;e.style.animationFillMode="forwards",m=y.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=T)})}},b=S=>{S.target===e&&(u.current=Gc(r.current))};return e.addEventListener("animationstart",b),e.addEventListener("animationcancel",v),e.addEventListener("animationend",v),()=>{y.clearTimeout(m),e.removeEventListener("animationstart",b),e.removeEventListener("animationcancel",v),e.removeEventListener("animationend",v)}}else p("ANIMATION_END")},[e,p]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:w.useCallback(m=>{r.current=m?getComputedStyle(m):null,s(m)},[])}}function Gc(t){return t?.animationName||"none"}function rM(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var Rf=0;function iM(){w.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??_b()),document.body.insertAdjacentElement("beforeend",t[1]??_b()),Rf++,()=>{Rf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Rf--}},[])}function _b(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var nu="right-scroll-bar-position",su="width-before-scroll-bar",oM="with-scroll-bars-hidden",lM="--removed-body-scroll-bar-size";function Of(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function cM(t,e){var s=w.useState(function(){return{value:t,callback:e,facade:{get current(){return s.value},set current(r){var o=s.value;o!==r&&(s.value=r,s.callback(r,o))}}}})[0];return s.callback=e,s.facade}var uM=typeof window<"u"?w.useLayoutEffect:w.useEffect,jb=new WeakMap;function dM(t,e){var s=cM(null,function(r){return t.forEach(function(o){return Of(o,r)})});return uM(function(){var r=jb.get(s);if(r){var o=new Set(r),u=new Set(t),d=s.current;o.forEach(function(f){u.has(f)||Of(f,null)}),u.forEach(function(f){o.has(f)||Of(f,d)})}jb.set(s,t)},[t]),s}function hM(t){return t}function fM(t,e){e===void 0&&(e=hM);var s=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:t},useMedium:function(u){var d=e(u,r);return s.push(d),function(){s=s.filter(function(f){return f!==d})}},assignSyncMedium:function(u){for(r=!0;s.length;){var d=s;s=[],d.forEach(u)}s={push:function(f){return u(f)},filter:function(){return s}}},assignMedium:function(u){r=!0;var d=[];if(s.length){var f=s;s=[],f.forEach(u),d=s}var p=function(){var y=d;d=[],y.forEach(u)},m=function(){return Promise.resolve().then(p)};m(),s={push:function(y){d.push(y),m()},filter:function(y){return d=d.filter(y),s}}}};return o}function mM(t){t===void 0&&(t={});var e=fM(null);return e.options=qn({async:!0,ssr:!1},t),e}var NS=function(t){var e=t.sideCar,s=Si(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return w.createElement(r,qn({},s))};NS.isSideCarExport=!0;function pM(t,e){return t.useMedium(e),NS}var AS=mM(),Df=function(){},Ou=w.forwardRef(function(t,e){var s=w.useRef(null),r=w.useState({onScrollCapture:Df,onWheelCapture:Df,onTouchMoveCapture:Df}),o=r[0],u=r[1],d=t.forwardProps,f=t.children,p=t.className,m=t.removeScrollBar,y=t.enabled,v=t.shards,b=t.sideCar,S=t.noRelative,_=t.noIsolation,E=t.inert,T=t.allowPinchZoom,A=t.as,D=A===void 0?"div":A,N=t.gapMode,L=Si(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),G=b,F=dM([s,e]),U=qn(qn({},L),o);return w.createElement(w.Fragment,null,y&&w.createElement(G,{sideCar:AS,removeScrollBar:m,shards:v,noRelative:S,noIsolation:_,inert:E,setCallbacks:u,allowPinchZoom:!!T,lockRef:s,gapMode:N}),d?w.cloneElement(w.Children.only(f),qn(qn({},U),{ref:F})):w.createElement(D,qn({},U,{className:p,ref:F}),f))});Ou.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ou.classNames={fullWidth:su,zeroRight:nu};var gM=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function yM(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=gM();return e&&t.setAttribute("nonce",e),t}function vM(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function xM(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var bM=function(){var t=0,e=null;return{add:function(s){t==0&&(e=yM())&&(vM(e,s),xM(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},wM=function(){var t=bM();return function(e,s){w.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&s])}},kS=function(){var t=wM(),e=function(s){var r=s.styles,o=s.dynamic;return t(r,o),null};return e},SM={left:0,top:0,right:0,gap:0},Mf=function(t){return parseInt(t||"",10)||0},_M=function(t){var e=window.getComputedStyle(document.body),s=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[Mf(s),Mf(r),Mf(o)]},jM=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return SM;var e=_M(t),s=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-s+e[2]-e[0])}},EM=kS(),gi="data-scroll-locked",TM=function(t,e,s,r){var o=t.left,u=t.top,d=t.right,f=t.gap;return s===void 0&&(s="margin"),`
61
+ .`.concat(oM,` {
62
+ overflow: hidden `).concat(r,`;
63
+ padding-right: `).concat(f,"px ").concat(r,`;
64
+ }
65
+ body[`).concat(gi,`] {
66
+ overflow: hidden `).concat(r,`;
67
+ overscroll-behavior: contain;
68
+ `).concat([e&&"position: relative ".concat(r,";"),s==="margin"&&`
69
+ padding-left: `.concat(o,`px;
70
+ padding-top: `).concat(u,`px;
71
+ padding-right: `).concat(d,`px;
72
+ margin-left:0;
73
+ margin-top:0;
74
+ margin-right: `).concat(f,"px ").concat(r,`;
75
+ `),s==="padding"&&"padding-right: ".concat(f,"px ").concat(r,";")].filter(Boolean).join(""),`
76
+ }
77
+
78
+ .`).concat(nu,` {
79
+ right: `).concat(f,"px ").concat(r,`;
80
+ }
81
+
82
+ .`).concat(su,` {
83
+ margin-right: `).concat(f,"px ").concat(r,`;
84
+ }
85
+
86
+ .`).concat(nu," .").concat(nu,` {
87
+ right: 0 `).concat(r,`;
88
+ }
89
+
90
+ .`).concat(su," .").concat(su,` {
91
+ margin-right: 0 `).concat(r,`;
92
+ }
93
+
94
+ body[`).concat(gi,`] {
95
+ `).concat(lM,": ").concat(f,`px;
96
+ }
97
+ `)},Eb=function(){var t=parseInt(document.body.getAttribute(gi)||"0",10);return isFinite(t)?t:0},NM=function(){w.useEffect(function(){return document.body.setAttribute(gi,(Eb()+1).toString()),function(){var t=Eb()-1;t<=0?document.body.removeAttribute(gi):document.body.setAttribute(gi,t.toString())}},[])},AM=function(t){var e=t.noRelative,s=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;NM();var u=w.useMemo(function(){return jM(o)},[o]);return w.createElement(EM,{styles:TM(u,!e,o,s?"":"!important")})},Sm=!1;if(typeof window<"u")try{var Fc=Object.defineProperty({},"passive",{get:function(){return Sm=!0,!0}});window.addEventListener("test",Fc,Fc),window.removeEventListener("test",Fc,Fc)}catch{Sm=!1}var ti=Sm?{passive:!1}:!1,kM=function(t){return t.tagName==="TEXTAREA"},CS=function(t,e){if(!(t instanceof Element))return!1;var s=window.getComputedStyle(t);return s[e]!=="hidden"&&!(s.overflowY===s.overflowX&&!kM(t)&&s[e]==="visible")},CM=function(t){return CS(t,"overflowY")},RM=function(t){return CS(t,"overflowX")},Tb=function(t,e){var s=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=RS(t,r);if(o){var u=OS(t,r),d=u[1],f=u[2];if(d>f)return!0}r=r.parentNode}while(r&&r!==s.body);return!1},OM=function(t){var e=t.scrollTop,s=t.scrollHeight,r=t.clientHeight;return[e,s,r]},DM=function(t){var e=t.scrollLeft,s=t.scrollWidth,r=t.clientWidth;return[e,s,r]},RS=function(t,e){return t==="v"?CM(e):RM(e)},OS=function(t,e){return t==="v"?OM(e):DM(e)},MM=function(t,e){return t==="h"&&e==="rtl"?-1:1},zM=function(t,e,s,r,o){var u=MM(t,window.getComputedStyle(e).direction),d=u*r,f=s.target,p=e.contains(f),m=!1,y=d>0,v=0,b=0;do{if(!f)break;var S=OS(t,f),_=S[0],E=S[1],T=S[2],A=E-T-u*_;(_||A)&&RS(t,f)&&(v+=A,b+=_);var D=f.parentNode;f=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!p&&f!==document.body||p&&(e.contains(f)||e===f));return(y&&Math.abs(v)<1||!y&&Math.abs(b)<1)&&(m=!0),m},Kc=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Nb=function(t){return[t.deltaX,t.deltaY]},Ab=function(t){return t&&"current"in t?t.current:t},LM=function(t,e){return t[0]===e[0]&&t[1]===e[1]},UM=function(t){return`
98
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
99
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
100
+ `)},PM=0,ni=[];function VM(t){var e=w.useRef([]),s=w.useRef([0,0]),r=w.useRef(),o=w.useState(PM++)[0],u=w.useState(kS)[0],d=w.useRef(t);w.useEffect(function(){d.current=t},[t]),w.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var E=y2([t.lockRef.current],(t.shards||[]).map(Ab),!0).filter(Boolean);return E.forEach(function(T){return T.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),E.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var f=w.useCallback(function(E,T){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!d.current.allowPinchZoom;var A=Kc(E),D=s.current,N="deltaX"in E?E.deltaX:D[0]-A[0],L="deltaY"in E?E.deltaY:D[1]-A[1],G,F=E.target,U=Math.abs(N)>Math.abs(L)?"h":"v";if("touches"in E&&U==="h"&&F.type==="range")return!1;var M=window.getSelection(),J=M&&M.anchorNode,re=J?J===F||J.contains(F):!1;if(re)return!1;var xe=Tb(U,F);if(!xe)return!0;if(xe?G=U:(G=U==="v"?"h":"v",xe=Tb(U,F)),!xe)return!1;if(!r.current&&"changedTouches"in E&&(N||L)&&(r.current=G),!G)return!0;var ue=r.current||G;return zM(ue,T,E,ue==="h"?N:L)},[]),p=w.useCallback(function(E){var T=E;if(!(!ni.length||ni[ni.length-1]!==u)){var A="deltaY"in T?Nb(T):Kc(T),D=e.current.filter(function(G){return G.name===T.type&&(G.target===T.target||T.target===G.shadowParent)&&LM(G.delta,A)})[0];if(D&&D.should){T.cancelable&&T.preventDefault();return}if(!D){var N=(d.current.shards||[]).map(Ab).filter(Boolean).filter(function(G){return G.contains(T.target)}),L=N.length>0?f(T,N[0]):!d.current.noIsolation;L&&T.cancelable&&T.preventDefault()}}},[]),m=w.useCallback(function(E,T,A,D){var N={name:E,delta:T,target:A,should:D,shadowParent:BM(A)};e.current.push(N),setTimeout(function(){e.current=e.current.filter(function(L){return L!==N})},1)},[]),y=w.useCallback(function(E){s.current=Kc(E),r.current=void 0},[]),v=w.useCallback(function(E){m(E.type,Nb(E),E.target,f(E,t.lockRef.current))},[]),b=w.useCallback(function(E){m(E.type,Kc(E),E.target,f(E,t.lockRef.current))},[]);w.useEffect(function(){return ni.push(u),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:b}),document.addEventListener("wheel",p,ti),document.addEventListener("touchmove",p,ti),document.addEventListener("touchstart",y,ti),function(){ni=ni.filter(function(E){return E!==u}),document.removeEventListener("wheel",p,ti),document.removeEventListener("touchmove",p,ti),document.removeEventListener("touchstart",y,ti)}},[]);var S=t.removeScrollBar,_=t.inert;return w.createElement(w.Fragment,null,_?w.createElement(u,{styles:UM(o)}):null,S?w.createElement(AM,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function BM(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const IM=pM(AS,VM);var DS=w.forwardRef(function(t,e){return w.createElement(Ou,qn({},t,{ref:e,sideCar:IM}))});DS.classNames=Ou.classNames;var qM=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},si=new WeakMap,Yc=new WeakMap,Xc={},zf=0,MS=function(t){return t&&(t.host||MS(t.parentNode))},$M=function(t,e){return e.map(function(s){if(t.contains(s))return s;var r=MS(s);return r&&t.contains(r)?r:(console.error("aria-hidden",s,"in not contained inside",t,". Doing nothing"),null)}).filter(function(s){return!!s})},HM=function(t,e,s,r){var o=$M(e,Array.isArray(t)?t:[t]);Xc[s]||(Xc[s]=new WeakMap);var u=Xc[s],d=[],f=new Set,p=new Set(o),m=function(v){!v||f.has(v)||(f.add(v),m(v.parentNode))};o.forEach(m);var y=function(v){!v||p.has(v)||Array.prototype.forEach.call(v.children,function(b){if(f.has(b))y(b);else try{var S=b.getAttribute(r),_=S!==null&&S!=="false",E=(si.get(b)||0)+1,T=(u.get(b)||0)+1;si.set(b,E),u.set(b,T),d.push(b),E===1&&_&&Yc.set(b,!0),T===1&&b.setAttribute(s,"true"),_||b.setAttribute(r,"true")}catch(A){console.error("aria-hidden: cannot operate on ",b,A)}})};return y(e),f.clear(),zf++,function(){d.forEach(function(v){var b=si.get(v)-1,S=u.get(v)-1;si.set(v,b),u.set(v,S),b||(Yc.has(v)||v.removeAttribute(r),Yc.delete(v)),S||v.removeAttribute(s)}),zf--,zf||(si=new WeakMap,si=new WeakMap,Yc=new WeakMap,Xc={})}},GM=function(t,e,s){s===void 0&&(s="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=qM(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),HM(r,o,s,"aria-hidden")):function(){return null}};function FM(t){const e=KM(t),s=w.forwardRef((r,o)=>{const{children:u,...d}=r,f=w.Children.toArray(u),p=f.find(XM);if(p){const m=p.props.children,y=f.map(v=>v===p?w.Children.count(m)>1?w.Children.only(null):w.isValidElement(m)?m.props.children:null:v);return l.jsx(e,{...d,ref:o,children:w.isValidElement(m)?w.cloneElement(m,void 0,y):null})}return l.jsx(e,{...d,ref:o,children:u})});return s.displayName=`${t}.Slot`,s}function KM(t){const e=w.forwardRef((s,r)=>{const{children:o,...u}=s;if(w.isValidElement(o)){const d=JM(o),f=WM(u,o.props);return o.type!==w.Fragment&&(f.ref=r?_u(r,d):d),w.cloneElement(o,f)}return w.Children.count(o)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var YM=Symbol("radix.slottable");function XM(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===YM}function WM(t,e){const s={...e};for(const r in e){const o=t[r],u=e[r];/^on[A-Z]/.test(r)?o&&u?s[r]=(...f)=>{const p=u(...f);return o(...f),p}:o&&(s[r]=o):r==="style"?s[r]={...o,...u}:r==="className"&&(s[r]=[o,u].filter(Boolean).join(" "))}return{...t,...s}}function JM(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var Du="Dialog",[zS]=E4(Du),[QM,zn]=zS(Du),LS=t=>{const{__scopeDialog:e,children:s,open:r,defaultOpen:o,onOpenChange:u,modal:d=!0}=t,f=w.useRef(null),p=w.useRef(null),[m,y]=C4({prop:r,defaultProp:o??!1,onChange:u,caller:Du});return l.jsx(QM,{scope:e,triggerRef:f,contentRef:p,contentId:Af(),titleId:Af(),descriptionId:Af(),open:m,onOpenChange:y,onOpenToggle:w.useCallback(()=>y(v=>!v),[y]),modal:d,children:s})};LS.displayName=Du;var US="DialogTrigger",ZM=w.forwardRef((t,e)=>{const{__scopeDialog:s,...r}=t,o=zn(US,s),u=nr(e,o.triggerRef);return l.jsx(xs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":xp(o.open),...r,ref:u,onClick:ta(t.onClick,o.onOpenToggle)})});ZM.displayName=US;var yp="DialogPortal",[e3,PS]=zS(yp,{forceMount:void 0}),VS=t=>{const{__scopeDialog:e,forceMount:s,children:r,container:o}=t,u=zn(yp,e);return l.jsx(e3,{scope:e,forceMount:s,children:w.Children.map(r,d=>l.jsx(Ru,{present:s||u.open,children:l.jsx(TS,{asChild:!0,container:o,children:d})}))})};VS.displayName=yp;var bu="DialogOverlay",BS=w.forwardRef((t,e)=>{const s=PS(bu,t.__scopeDialog),{forceMount:r=s.forceMount,...o}=t,u=zn(bu,t.__scopeDialog);return u.modal?l.jsx(Ru,{present:r||u.open,children:l.jsx(n3,{...o,ref:e})}):null});BS.displayName=bu;var t3=FM("DialogOverlay.RemoveScroll"),n3=w.forwardRef((t,e)=>{const{__scopeDialog:s,...r}=t,o=zn(bu,s);return l.jsx(DS,{as:t3,allowPinchZoom:!0,shards:[o.contentRef],children:l.jsx(xs.div,{"data-state":xp(o.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),tr="DialogContent",IS=w.forwardRef((t,e)=>{const s=PS(tr,t.__scopeDialog),{forceMount:r=s.forceMount,...o}=t,u=zn(tr,t.__scopeDialog);return l.jsx(Ru,{present:r||u.open,children:u.modal?l.jsx(s3,{...o,ref:e}):l.jsx(a3,{...o,ref:e})})});IS.displayName=tr;var s3=w.forwardRef((t,e)=>{const s=zn(tr,t.__scopeDialog),r=w.useRef(null),o=nr(e,s.contentRef,r);return w.useEffect(()=>{const u=r.current;if(u)return GM(u)},[]),l.jsx(qS,{...t,ref:o,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ta(t.onCloseAutoFocus,u=>{u.preventDefault(),s.triggerRef.current?.focus()}),onPointerDownOutside:ta(t.onPointerDownOutside,u=>{const d=u.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0;(d.button===2||f)&&u.preventDefault()}),onFocusOutside:ta(t.onFocusOutside,u=>u.preventDefault())})}),a3=w.forwardRef((t,e)=>{const s=zn(tr,t.__scopeDialog),r=w.useRef(!1),o=w.useRef(!1);return l.jsx(qS,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{t.onCloseAutoFocus?.(u),u.defaultPrevented||(r.current||s.triggerRef.current?.focus(),u.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:u=>{t.onInteractOutside?.(u),u.defaultPrevented||(r.current=!0,u.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const d=u.target;s.triggerRef.current?.contains(d)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&o.current&&u.preventDefault()}})}),qS=w.forwardRef((t,e)=>{const{__scopeDialog:s,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:u,...d}=t,f=zn(tr,s),p=w.useRef(null),m=nr(e,p);return iM(),l.jsxs(l.Fragment,{children:[l.jsx(jS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:u,children:l.jsx(SS,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":xp(f.open),...d,ref:m,onDismiss:()=>f.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(r3,{titleId:f.titleId}),l.jsx(o3,{contentRef:p,descriptionId:f.descriptionId})]})]})}),vp="DialogTitle",$S=w.forwardRef((t,e)=>{const{__scopeDialog:s,...r}=t,o=zn(vp,s);return l.jsx(xs.h2,{id:o.titleId,...r,ref:e})});$S.displayName=vp;var HS="DialogDescription",GS=w.forwardRef((t,e)=>{const{__scopeDialog:s,...r}=t,o=zn(HS,s);return l.jsx(xs.p,{id:o.descriptionId,...r,ref:e})});GS.displayName=HS;var FS="DialogClose",KS=w.forwardRef((t,e)=>{const{__scopeDialog:s,...r}=t,o=zn(FS,s);return l.jsx(xs.button,{type:"button",...r,ref:e,onClick:ta(t.onClick,()=>o.onOpenChange(!1))})});KS.displayName=FS;function xp(t){return t?"open":"closed"}var YS="DialogTitleWarning",[Q3,XS]=j4(YS,{contentName:tr,titleName:vp,docsSlug:"dialog"}),r3=({titleId:t})=>{const e=XS(YS),s=`\`${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 w.useEffect(()=>{t&&(document.getElementById(t)||console.error(s))},[s,t]),null},i3="DialogDescriptionWarning",o3=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${XS(i3).contentName}}.`;return w.useEffect(()=>{const o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},l3=LS,c3=VS,u3=BS,d3=IS,h3=$S,f3=GS,m3=KS;function Ka({...t}){return l.jsx(l3,{"data-slot":"dialog",...t})}function p3({...t}){return l.jsx(c3,{"data-slot":"dialog-portal",...t})}function g3({className:t,...e}){return l.jsx(u3,{"data-slot":"dialog-overlay",className:we("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",t),...e})}function Ya({className:t,children:e,...s}){return l.jsxs(p3,{"data-slot":"dialog-portal",children:[l.jsx(g3,{}),l.jsxs(d3,{"data-slot":"dialog-content",className:we("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",t),...s,children:[e,l.jsxs(m3,{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:[l.jsx(aa,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Xa({className:t,...e}){return l.jsx("div",{"data-slot":"dialog-header",className:we("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Ba({className:t,...e}){return l.jsx("div",{"data-slot":"dialog-footer",className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Wa({className:t,...e}){return l.jsx(h3,{"data-slot":"dialog-title",className:we("text-lg leading-none font-semibold",t),...e})}function Ja({className:t,...e}){return l.jsx(f3,{"data-slot":"dialog-description",className:we("text-muted-foreground text-sm",t),...e})}function y3({email:t,isOpen:e,onOpenChange:s,onRetry:r}){const{t:o}=nt(),[u,d]=w.useState([]),[f,p]=w.useState(!1);w.useEffect(()=>{e&&t&&m()},[e,t]);const m=async()=>{if(t){p(!0);try{const v=await Me.getEmailEvents(t.id);v.data&&d(v.data.events)}catch(v){console.error("Failed to fetch trace:",v)}finally{p(!1)}}},y=v=>{switch(v){case"analysis":return l.jsx(Po,{className:"w-4 h-4 text-purple-500"});case"action":return l.jsx(qo,{className:"w-4 h-4 text-emerald-500"});case"error":return l.jsx(Mn,{className:"w-4 h-4 text-red-500"});default:return l.jsx(yi,{className:"w-4 h-4 text-blue-500"})}};return l.jsx(Ka,{open:e,onOpenChange:s,children:l.jsxs(Ya,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[l.jsxs(Xa,{className:"p-6 border-b flex flex-row items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(wu,{className:"w-5 h-5 text-primary"}),l.jsx(Wa,{children:o("dashboard.aiTrace")})]}),l.jsx(Ja,{children:o("dashboard.aiTraceDesc")})]}),t?.processing_status==="failed"&&r&&l.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>{r(t),s(!1)},className:"gap-2 text-destructive border-destructive/20 hover:bg-destructive/10",children:[l.jsx(Jt,{className:"w-3.5 h-3.5"}),o("dashboard.retryProcessing")]})]}),l.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:f?l.jsx("div",{className:"py-20 flex justify-center",children:l.jsx(pt,{})}):u.length===0?l.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:o("dashboard.noTrace")}):u.map((v,b)=>l.jsxs("div",{className:"relative pl-8",children:[b!==u.length-1&&l.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),l.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:y(v.event_type)}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground/70",children:v.agent_state}),l.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[l.jsx(Qa,{className:"w-3 h-3"}),new Date(v.created_at).toLocaleTimeString()]})]}),l.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[v.event_type==="info"&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-sm text-foreground/90",children:v.details?.message}),v.details?.system_prompt&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[l.jsx(ps,{className:"w-3 h-3"})," System Prompt"]}),l.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:v.details.system_prompt})]}),v.details?.content_preview&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[l.jsx(ps,{className:"w-3 h-3"})," ",o("dashboard.emailContent")]}),l.jsx("pre",{className:"text-[10px] bg-blue-500/5 p-2 rounded border border-blue-500/10 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:v.details.content_preview})]})]}),v.event_type==="analysis"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[l.jsxs("span",{className:"text-muted-foreground mr-1",children:[o("config.rules.category"),":"]}),l.jsx("span",{className:"font-bold uppercase",children:v.details?.category||o("dashboard.analyzing")})]}),l.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[l.jsxs("span",{className:"text-muted-foreground mr-1",children:[o("config.rules.sentiment"),":"]}),l.jsx("span",{className:"font-bold uppercase",children:v.details?.sentiment||o("dashboard.analyzing")})]})]}),v.details?.system_prompt&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[l.jsx(ps,{className:"w-3 h-3"})," System Prompt"]}),l.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:v.details?.system_prompt})]}),v.details?._raw_response&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[l.jsx(ps,{className:"w-3 h-3"})," Raw LLM Response"]}),l.jsx("pre",{className:"text-[10px] bg-emerald-500/5 p-2 rounded border border-emerald-500/10 overflow-x-auto font-mono",children:JSON.stringify(JSON.parse(v.details._raw_response),null,2)})]}),v.details?.usage&&l.jsxs("div",{className:"flex gap-4 pt-2 border-t border-border/50",children:[l.jsxs("div",{className:"text-[10px]",children:[l.jsx("span",{className:"text-muted-foreground mr-1",children:"Prompt:"}),l.jsx("span",{className:"font-mono font-bold",children:v.details.usage.prompt_tokens})]}),l.jsxs("div",{className:"text-[10px]",children:[l.jsx("span",{className:"text-muted-foreground mr-1",children:"Completion:"}),l.jsx("span",{className:"font-mono font-bold",children:v.details.usage.completion_tokens})]}),l.jsxs("div",{className:"text-[10px]",children:[l.jsx("span",{className:"text-muted-foreground mr-1",children:"Total:"}),l.jsx("span",{className:"font-mono font-bold text-primary",children:v.details.usage.total_tokens})]})]})]}),v.event_type==="action"&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:[o("dashboard.done")," ",v.details?.action]}),l.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',v.details?.reason,'"']})]}),l.jsx(Nm,{className:"w-5 h-5 text-emerald-500"})]}),v.event_type==="error"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:typeof v.details?.error=="object"?v.details.error.message||JSON.stringify(v.details.error):v.details?.error}),v.details?.raw_response&&l.jsx("pre",{className:"text-[10px] bg-red-500/5 p-2 rounded border border-red-500/10 overflow-x-auto whitespace-pre-wrap font-mono",children:typeof v.details.raw_response=="object"?JSON.stringify(v.details.raw_response,null,2):v.details.raw_response})]})]})]})]},v.id))})]})})}const v3={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 x3(){const{state:t,actions:e}=ra(),{t:s}=nt(),{openTerminal:r}=Aw(),[o,u]=w.useState(!0),{isSyncing:d}=t,[f,p]=w.useState(""),[m,y]=w.useState(null),[v,b]=w.useState(null),[S,_]=w.useState({}),[E,T]=w.useState(null),[A,D]=w.useState(!1),[N,L]=w.useState(null);w.useEffect(()=>{t.isAuthenticated?(G(),e.fetchStats()):u(!1)},[m,t.isAuthenticated]);const G=async(ee=0)=>{u(!0),await e.fetchEmails({category:m||void 0,search:f||void 0,offset:ee,sortBy:t.sortBy,sortOrder:t.sortOrder}),u(!1)},F=ee=>{e.fetchEmails({category:m||void 0,search:f||void 0,offset:0,sortBy:ee,sortOrder:t.sortOrder})},U=()=>{e.fetchEmails({category:m||void 0,search:f||void 0,offset:0,sortBy:t.sortBy,sortOrder:t.sortOrder==="asc"?"desc":"asc"})},M=async()=>{if(t.accounts.length===0){se.warning(s("dashboard.noEmailsConnected"));return}$n.playStart(),r(),await e.triggerSync()?($n.playSuccess(),se.success(s("dashboard.syncSuccess"))):se.error(s("dashboard.syncFailed"))},J=async(ee,C)=>{if(C==="delete"&&E!==ee.id){T(ee.id);return}T(null),_(B=>({...B,[ee.id]:C}));const I=await e.executeAction(ee.id,C);_(B=>{const de={...B};return delete de[ee.id],de}),I&&(se.success(`Email ${C==="delete"?"deleted":C==="archive"?"archived":"updated"}`),C==="delete"&&G(t.emailsOffset))},re=()=>{T(null)},xe=ee=>{ee.preventDefault(),G()},ue=ee=>{const C=ee==="next"?t.emailsOffset+20:Math.max(0,t.emailsOffset-20);G(C)},Ie=ee=>{L(ee),D(!0)},Ve=async ee=>{await e.retryProcessing(ee.id)&&se.success("Retrying email processing...")};return l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 animate-in fade-in duration-500",children:[l.jsxs("section",{className:"lg:col-span-2 space-y-4",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-4",children:[l.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[l.jsx(Bo,{className:"w-5 h-5 text-primary"}),s("dashboard.recentAnalysis")]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsxs(Q,{onClick:M,size:"sm",variant:"default",className:"h-9 shadow-md px-4",disabled:d,children:[l.jsx(Jt,{className:we("w-3.5 h-3.5 mr-2",d&&"animate-spin")}),s(d?"dashboard.syncing":"dashboard.syncNow")]}),l.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:[t.emailsTotal," ",s("dashboard.emails")]})]})]}),d&&l.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:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:l.jsx(zt,{className:"w-5 h-5 text-primary animate-spin"})}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-sm",children:s("dashboard.syncInProgress")}),l.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard.syncInProgressDesc")})]})]}),l.jsxs(Q,{variant:"outline",size:"sm",onClick:r,className:"h-8 text-xs",children:[l.jsx(wu,{className:"w-3.5 h-3.5 mr-2"}),s("common.viewLogs")]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-center",children:[l.jsxs("form",{onSubmit:xe,className:"flex-1 flex gap-2 w-full",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx($T,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),l.jsx(Te,{placeholder:s("dashboard.searchPlaceholder"),value:f,onChange:ee=>p(ee.target.value),className:"pl-9 h-9"})]}),l.jsx(Q,{type:"submit",size:"sm",className:"h-9 px-4",children:s("dashboard.search")})]}),l.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50 h-9",children:[l.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-full",value:t.sortBy,onChange:ee=>F(ee.target.value),children:[l.jsx("option",{value:"date",children:s("dashboard.receivedTime")}),l.jsx("option",{value:"created_at",children:s("dashboard.processedTime")})]}),l.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-primary",onClick:U,title:t.sortOrder==="asc"?s("dashboard.sortOldest"):s("dashboard.sortNewest"),children:t.sortOrder==="asc"?l.jsx(RE,{className:"w-3.5 h-3.5"}):l.jsx(AE,{className:"w-3.5 h-3.5"})})]})]}),l.jsxs("div",{className:"flex gap-1 flex-wrap",children:[l.jsx(Q,{size:"sm",variant:t.activeCategory===null?"secondary":"ghost",onClick:()=>y(null),children:s("dashboard.category.all")}),["spam","client","newsletter","support"].map(ee=>l.jsx(Q,{size:"sm",variant:t.activeCategory===ee?"secondary":"ghost",onClick:()=>y(ee),className:"capitalize",children:ee},ee))]}),o?l.jsx(mC,{}):t.emails.length===0?l.jsxs(Bt,{className:"p-20 text-center shadow-sm",children:[l.jsx("div",{className:"w-16 h-16 bg-primary/10 text-primary rounded-full flex items-center justify-center mx-auto mb-6",children:l.jsx(Bo,{className:"w-8 h-8"})}),l.jsx("h3",{className:"text-lg font-medium",children:s("dashboard.noEmails")}),l.jsx("p",{className:"text-muted-foreground mt-2 mb-6",children:t.accounts.length===0?s("dashboard.noEmailsConnected"):s("dashboard.noEmailsFilters")}),t.accounts.length>0&&l.jsxs(Q,{onClick:()=>{r(),M()},disabled:d,children:[l.jsx(Jt,{className:we("w-4 h-4 mr-2",d&&"animate-spin")}),s("dashboard.syncNow")]})]}):l.jsxs(l.Fragment,{children:[t.emails.map(ee=>l.jsx(S3,{email:ee,onAction:J,onRetry:Ve,onViewTrace:Ie,onSelect:()=>b(ee),isSelected:v?.id===ee.id,loadingAction:S[ee.id],isDeletePending:E===ee.id,onCancelDelete:re},ee.id)),l.jsx(y3,{isOpen:A,onOpenChange:D,email:N,onRetry:Ve}),t.emailsTotal>20&&l.jsxs("div",{className:"flex items-center justify-between pt-4",children:[l.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>ue("prev"),disabled:t.emailsOffset===0,children:[l.jsx(GE,{className:"w-4 h-4 mr-1"}),s("common.previous")]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.emailsOffset+1," - ",Math.min(t.emailsOffset+20,t.emailsTotal)," ",s("common.of")," ",t.emailsTotal]}),l.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>ue("next"),disabled:t.emailsOffset+20>=t.emailsTotal,children:[s("common.next"),l.jsx(au,{className:"w-4 h-4 ml-1"})]})]})]})]}),l.jsxs("aside",{className:"space-y-6",children:[v&&l.jsxs(Bt,{className:"p-6 border-primary/20 bg-primary/5 animate-in slide-in-from-right-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"font-semibold",children:s("dashboard.emailDetails")}),l.jsx(Q,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>b(null),children:l.jsx(aa,{className:"w-4 h-4"})})]}),l.jsxs("div",{className:"space-y-3 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:s("dashboard.from")}),l.jsx("p",{className:"font-medium truncate",children:v.sender})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:s("dashboard.subject")}),l.jsx("p",{className:"font-medium",children:v.subject})]}),v.ai_analysis&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:s("dashboard.summary")}),l.jsx("p",{className:"text-xs mt-1",children:v.ai_analysis.summary})]}),v.ai_analysis.key_points&&l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:s("dashboard.keyPoints")}),l.jsx("ul",{className:"text-xs mt-1 list-disc list-inside",children:v.ai_analysis.key_points.map((ee,C)=>l.jsx("li",{children:ee},C))})]}),v.ai_analysis.draft_response&&l.jsxs("div",{className:"mt-4 p-3 bg-emerald-500/5 border border-emerald-500/20 rounded-lg",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2 text-emerald-600 dark:text-emerald-400",children:[l.jsx(GT,{className:"w-3.5 h-3.5"}),l.jsx("span",{className:"text-xs font-bold uppercase",children:s("dashboard.aiDraftReply")})]}),l.jsx("p",{className:"text-xs leading-relaxed whitespace-pre-wrap italic text-foreground/80",children:v.ai_analysis.draft_response}),l.jsx("p",{className:"mt-2 text-[9px] text-muted-foreground",children:s("dashboard.draftSavedHelp").replace("{provider}",v.email_accounts?.provider==="gmail"?"Gmail":"Outlook")})]})]})]})]}),l.jsx(b3,{accounts:t.accounts,onUpdate:e.updateAccount,onSync:e.triggerSync,settings:t.settings,onUpdateSettings:e.updateSettings,openTerminal:r}),l.jsxs(Bt,{className:"p-6",children:[l.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[l.jsx(Pb,{className:"w-4 h-4 text-primary"}),s("dashboard.syncHistory")]}),l.jsx("div",{className:"space-y-4",children:!t.stats?.recentSyncs||t.stats.recentSyncs.length===0?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:s("dashboard.noSyncHistory")}):t.stats.recentSyncs.slice(0,5).map(ee=>l.jsxs("div",{className:"flex justify-between items-start text-sm border-b last:border-0 pb-3 last:pb-0",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:we("w-1.5 h-1.5 rounded-full",ee.status==="success"?"bg-emerald-500":ee.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),l.jsxs("p",{className:"font-medium text-xs",children:[new Date(ee.started_at).toLocaleDateString()," ",new Date(ee.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),l.jsxs("p",{className:"text-[10px] text-muted-foreground pl-3.5",children:[s("dashboard.processed")," ",l.jsx("span",{className:"font-medium text-foreground",children:ee.emails_processed})," •",s("dashboard.actioned")," ",l.jsx("span",{className:"font-medium text-foreground",children:ee.emails_deleted+ee.emails_drafted})]}),ee.error_message&&l.jsxs("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:ee.error_message,children:[s("dashboard.error")," ",ee.error_message]})]}),l.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:ee.status==="running"?s("dashboard.running"):ee.completed_at?`${Math.round((new Date(ee.completed_at).getTime()-new Date(ee.started_at).getTime())/1e3)}s`:"..."})]},ee.id))})]}),l.jsxs(Bt,{className:"p-6",children:[l.jsx("h3",{className:"font-semibold mb-4",children:s("dashboard.quickStats")}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:s("dashboard.totalProcessed")}),l.jsx("span",{className:"font-medium",children:t.emailsTotal})]}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:s("dashboard.connectedAccounts")}),l.jsx("span",{className:"font-medium",children:t.accounts.length})]}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:s("dashboard.activeRules")}),l.jsx("span",{className:"font-medium",children:t.rules.filter(ee=>ee.is_enabled).length})]})]})]})]})]})}function b3({accounts:t,onUpdate:e,onSync:s,settings:r,onUpdateSettings:o,openTerminal:u}){const{t:d}=nt();return t.length===0?null:l.jsxs(Bt,{className:"p-6",children:[l.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[l.jsx(YT,{className:"w-4 h-4 text-primary"}),d("dashboard.syncScope")]}),l.jsx("div",{className:"space-y-6",children:t.map(f=>l.jsx(w3,{account:f,onUpdate:e,onSync:s,openTerminal:u},f.id))})]})}function w3({account:t,onUpdate:e,onSync:s,openTerminal:r}){const{t:o}=nt(),[u,d]=w.useState(!1),[f,p]=w.useState(""),[m,y]=w.useState(""),v=E=>{if(!E)return"";const T=typeof E=="string"&&/^\d+$/.test(E)?parseInt(E):E,A=new Date(T);if(isNaN(A.getTime()))return"";const D=N=>N<10?"0"+N:N;return A.getFullYear()+"-"+D(A.getMonth()+1)+"-"+D(A.getDate())+"T"+D(A.getHours())+":"+D(A.getMinutes())};w.useEffect(()=>{const E=t.sync_start_date||t.last_sync_checkpoint||t.last_sync_at;p(v(E)),y((t.sync_max_emails_per_run||50).toString())},[t.id,t.sync_start_date,t.last_sync_checkpoint,t.last_sync_at,t.sync_max_emails_per_run]);const b=async E=>{d(!0),await e(t.id,E),d(!1)},S=()=>{const E=t.sync_start_date?new Date(t.sync_start_date).toISOString():"",T=f?new Date(f).toISOString():"";T!==E&&b({sync_start_date:T||null})},_=()=>{const E=parseInt(m,10)||50;E!==t.sync_max_emails_per_run&&b({sync_max_emails_per_run:E})};return l.jsxs("div",{className:"space-y-3 pb-4 border-b last:border-0 last:pb-0",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs font-medium truncate max-w-[150px]",title:t.email_address,children:t.email_address}),l.jsxs("div",{className:"flex items-center gap-1",children:[t.last_sync_status==="syncing"?l.jsx(zt,{className:"w-3 h-3 text-primary animate-spin"}):t.last_sync_status==="success"?l.jsx(Nm,{className:"w-3 h-3 text-emerald-500"}):t.last_sync_status==="error"?l.jsx("span",{title:t.last_sync_error||"Error",children:l.jsx(Mn,{className:"w-3 h-3 text-destructive"})}):null,l.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{r(),s(t.id)},disabled:t.last_sync_status==="syncing",children:l.jsx(Jt,{className:we("w-3 h-3",t.last_sync_status==="syncing"&&"animate-spin")})}),l.jsx(Q,{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(t.id,{last_sync_checkpoint:null}),disabled:t.last_sync_status==="syncing",children:l.jsx(Pb,{className:"w-3 h-3"})})]})]}),l.jsxs("div",{className:"grid grid-cols-[1.5fr_1fr] gap-2",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[l.jsx(PE,{className:"w-2.5 h-2.5"})," ",o("dashboard.syncFrom")]}),l.jsx(Te,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:f,onChange:E=>p(E.target.value),onBlur:S,disabled:u||t.last_sync_status==="syncing"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[l.jsx(pT,{className:"w-2.5 h-2.5"})," ",o("dashboard.maxEmails")]}),l.jsx(Te,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:m,onChange:E=>y(E.target.value),onBlur:_,disabled:u||t.last_sync_status==="syncing"})]})]}),t.last_sync_at&&l.jsxs("p",{className:"text-[9px] text-muted-foreground",children:[o("dashboard.lastSync")," ",new Date(t.last_sync_at).toLocaleString()]}),t.last_sync_error&&l.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:t.last_sync_error,children:[o("dashboard.error")," ",t.last_sync_error]})]})}function S3({email:t,onAction:e,onRetry:s,onViewTrace:r,onSelect:o,isSelected:u,loadingAction:d,isDeletePending:f,onCancelDelete:p}){const{t:m}=nt();if(!t)return null;const y=v3[t.category||"other"],v=!!d,b=()=>{if(!t.email_accounts)return"#";const{provider:S,email_address:_}=t.email_accounts;return S==="gmail"?`https://mail.google.com/mail/u/${_}/#all/${t.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(t.external_id)}`};return l.jsx(Bt,{className:we("hover:shadow-md transition-shadow group cursor-pointer",u&&"ring-2 ring-primary"),onClick:o,children:l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex justify-between items-start mb-3 gap-4",children:[l.jsxs("div",{className:"flex gap-3 flex-1 min-w-0",children:[l.jsx("div",{className:we("w-8 h-8 rounded-full flex-shrink-0 flex items-center justify-center font-bold text-white text-xs",t.category==="spam"?"bg-destructive":"bg-primary"),children:t.sender?.[0]?.toUpperCase()||"?"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:t.subject||m("dashboard.noSubject")}),l.jsx("p",{className:"text-xs text-muted-foreground truncate",title:t.sender||"",children:t.sender})]})]}),l.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[l.jsx("span",{className:we("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",y),children:t.category||"unknown"}),l.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.processing_status==="pending"&&l.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[l.jsx(Qa,{className:"w-2.5 h-2.5"})," ",m("dashboard.queued")]}),t.processing_status==="processing"&&l.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:[l.jsx(zt,{className:"w-2.5 h-2.5 animate-spin"})," ",m("dashboard.analyzing")]}),t.processing_status==="completed"&&l.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:[l.jsx(Po,{className:"w-2.5 h-2.5"})," ",m("dashboard.analyzed")]}),t.processing_status==="failed"&&l.jsxs("div",{className:"flex items-center gap-1",children:[l.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:t.processing_error||m("common.error"),children:[l.jsx(Mn,{className:"w-2.5 h-2.5"})," ",m("dashboard.failed")]}),l.jsx(Q,{variant:"ghost",size:"icon",className:"h-5 w-5 text-red-600 hover:bg-red-500/10",onClick:S=>{S.stopPropagation(),s(t)},title:m("dashboard.retryProcessing"),children:l.jsx(Jt,{className:"w-2.5 h-2.5"})})]}),!t.processing_status&&!t.ai_analysis&&l.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[l.jsx(zt,{className:"w-2.5 h-2.5 animate-spin"})," ",m("dashboard.queued")]}),!t.processing_status&&t.ai_analysis&&l.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:[l.jsx(Po,{className:"w-2.5 h-2.5"})," ",m("dashboard.analyzed")]})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2 text-[10px] text-muted-foreground/80 leading-tight",children:[l.jsxs("span",{title:t.date?new Date(t.date).toLocaleString():"",className:"whitespace-nowrap",children:[l.jsxs("span",{className:"opacity-70 text-[9px]",children:[m("dashboard.receivedAbbr"),":"]})," ",t.date?new Date(t.date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),l.jsx("span",{className:"opacity-30",children:"•"}),l.jsxs("span",{title:new Date(t.created_at).toLocaleString(),className:"whitespace-nowrap",children:[l.jsxs("span",{className:"opacity-70 text-[9px]",children:[m("dashboard.processedAbbr"),":"]})," ",new Date(t.created_at).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),l.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:t.body_snippet}),l.jsxs("div",{className:"bg-secondary/30 p-3 rounded-lg border border-border/50 flex justify-between items-center",children:[l.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[l.jsx(Vb,{className:"w-3.5 h-3.5 text-emerald-500"}),m("dashboard.suggested"),t.suggested_actions&&t.suggested_actions.length>0?l.jsx("div",{className:"flex gap-1 flex-wrap",children:t.suggested_actions.map(S=>l.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:S},S))}):l.jsx("span",{className:"text-foreground",children:t.suggested_action||m("dashboard.category.none")}),t.actions_taken&&t.actions_taken.length>0?l.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:t.actions_taken.join(", "),children:["(",m("dashboard.done")," ",t.actions_taken.join(", "),")"]}):t.action_taken?l.jsxs("span",{className:"text-muted-foreground ml-2",children:["(",m("dashboard.done")," ",t.action_taken,")"]}):null]}),l.jsx("div",{className:"flex gap-1 items-center",onClick:S=>S.stopPropagation(),children:f?l.jsxs("div",{className:"flex items-center gap-1 animate-in fade-in duration-200",children:[l.jsx("span",{className:"text-xs text-destructive mr-1",children:m("dashboard.deleteConfirm")}),l.jsx(Q,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>e(t,"delete"),disabled:v,children:d==="delete"?l.jsx(zt,{className:"w-3 h-3 animate-spin"}):m("common.yes")}),l.jsx(Q,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:p,disabled:v,children:m("common.no")})]}):l.jsxs(l.Fragment,{children:[l.jsx("a",{href:b(),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:m("dashboard.openIn").replace("{provider}",t.email_accounts?.provider==="gmail"?"Gmail":"Outlook"),children:l.jsx(Vo,{className:"w-3.5 h-3.5"})}),l.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>r(t),title:m("dashboard.viewTraceTooltip"),children:l.jsx(zb,{className:"w-3.5 h-3.5"})}),l.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>e(t,"delete"),disabled:v,title:m("common.delete"),children:d==="delete"?l.jsx(zt,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Su,{className:"w-3.5 h-3.5"})}),l.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>e(t,"archive"),disabled:v,title:m("common.archive"),children:d==="archive"?l.jsx(zt,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(TE,{className:"w-3.5 h-3.5"})}),l.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>e(t,"flag"),disabled:v,title:m("common.flag"),children:d==="flag"?l.jsx(zt,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(dT,{className:"w-3.5 h-3.5"})})]})})]})]})})}const Ao="realtimexai";function _3(){const{state:t,actions:e}=ra(),{t:s}=nt(),[r,o]=w.useState(!1),[u,d]=w.useState(!1),[f,p]=w.useState(null),[m,y]=w.useState(!1),[v,b]=w.useState(!1),[S,_]=w.useState({}),[E,T]=w.useState(!1),[A,D]=w.useState("credentials"),[N,L]=w.useState(""),[G,F]=w.useState(""),[U,M]=w.useState(""),[J,re]=w.useState(""),[xe,ue]=w.useState(!1),[Ie,Ve]=w.useState(!1),[ee,C]=w.useState(!1),[I,B]=w.useState("credentials"),[de,Se]=w.useState(""),[R,Y]=w.useState(""),[Z,ne]=w.useState(!1),[be,_e]=w.useState(!1),[pe,ot]=w.useState(""),[Le,cn]=w.useState("category"),[Ht,jt]=w.useState("newsletter"),[jn,En]=w.useState(["archive"]),[oa,sr]=w.useState(""),[ol,Ni]=w.useState(""),[ar,rr]=w.useState(""),[ir,ll]=w.useState(""),[cl,Et]=w.useState([]),[or,Ai]=w.useState(!1),[ki,la]=w.useState(!1),[Fn,ul]=w.useState([]),[lr,dl]=w.useState(!1),[bs,Tt]=w.useState(null);w.useEffect(()=>{(async()=>{dl(!0),Tt(null);try{const te=await Me.getChatProviders();te.data?.success?ul(te.data.providers||[]):Tt(te.data?.message||"Failed to load providers")}catch(te){console.error("Failed to fetch providers:",te),Tt("Failed to load providers. Using defaults.")}finally{dl(!1)}})()},[]);const yt=Fn.find(q=>q.provider===(S.llm_provider||Ao))?.models||[],hl=w.useMemo(()=>!S.llm_model||yt.some(te=>te.id===S.llm_model)?yt:[{id:S.llm_model,name:`${S.llm_model} (saved)`},...yt],[yt,S.llm_model]),Mu=w.useMemo(()=>!S.llm_provider||S.llm_provider===Ao||Fn.some(te=>te.provider===S.llm_provider)?Fn:[{provider:S.llm_provider,name:`${S.llm_provider} (saved)`,models:[]},...Fn],[Fn,S.llm_provider]),zu=q=>{const te=Fn.find(Ae=>Ae.provider===q);_(Ae=>({...Ae,llm_provider:q,llm_model:te?.models?.[0]?.id||""}))},cr=async()=>{b(!0);try{const q=await Me.testLlm({llm_provider:S.llm_provider||void 0,llm_model:S.llm_model||void 0});q.data?.success?se.success(q.data.message):se.error(q.data?.message||"Connection failed")}catch(q){se.error(q.response?.data?.message||"Connection failed")}finally{b(!1)}},[Ci,Ri]=w.useState(null),[Ut,ca]=w.useState(null);w.useEffect(()=>{e.fetchAccounts(),e.fetchRules(),e.fetchSettings()},[]),w.useEffect(()=>{t.settings&&_(t.settings)},[t.settings]);const ua=w.useRef(null),Lu=()=>{D("credentials"),L(""),F(""),M(""),re(""),T(!0)},fl=q=>{L(q);try{const te=JSON.parse(q),Ae=te.installed||te.web||te;Ae.client_id&&F(Ae.client_id),Ae.client_secret&&M(Ae.client_secret),te.installed?se.success("Detected Desktop app credentials"):te.web&&se.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Oi=async()=>{if(!G||!U){se.error("Please provide both Client ID and Client Secret");return}ue(!0);try{if(await e.updateSettings({...S,google_client_id:G,google_client_secret:U})){_(Ae=>({...Ae,google_client_id:G,google_client_secret:U}));const te=await Me.getGmailAuthUrl();if(te.data?.url)window.open(te.data.url,"_blank"),D("code"),se.success("Please authorize in the opened tab, then paste the code here");else{const Ae=typeof te.error=="string"?te.error:te.error?.message;se.error(Ae||"Failed to get OAuth URL")}}else se.error("Failed to save credentials")}catch{se.error("Failed to save credentials")}finally{ue(!1)}},da=async()=>{if(!J.trim()){se.error("Please paste the authorization code");return}Ve(!0);try{const q=await Me.connectGmail(J.trim());if(q.data?.success)se.success("Gmail account connected successfully!"),T(!1),e.fetchAccounts();else{const te=typeof q.error=="string"?q.error:q.error?.message;se.error(te||"Failed to connect Gmail")}}catch{se.error("Failed to connect Gmail")}finally{Ve(!1)}},Uu=()=>{B("credentials"),Se(""),Y(""),C(!0)},ml=async()=>{if(!de){se.error("Please provide the Client ID");return}ne(!0);try{if(await e.updateSettings({...S,microsoft_client_id:de,microsoft_tenant_id:R||"common"})){_(Ae=>({...Ae,microsoft_client_id:de,microsoft_tenant_id:R||"common"}));const te=await Me.startMicrosoftDeviceFlow();if(te.data)p(te.data),B("device-code"),pl(te.data.deviceCode,te.data.interval);else{const Ae=typeof te.error=="string"?te.error:te.error?.message;se.error(Ae||"Failed to start device flow")}}else se.error("Failed to save credentials")}catch{se.error("Failed to save credentials")}finally{ne(!1)}},pl=async(q,te)=>{const Ae=setInterval(async()=>{try{const Pt=await Me.pollMicrosoftDeviceCode(q);Pt.data?.status==="completed"?(clearInterval(Ae),p(null),d(!1),C(!1),se.success("Outlook account connected"),e.fetchAccounts()):Pt.error&&typeof Pt.error=="object"&&Pt.error.code}catch{}},te*1e3);setTimeout(()=>{clearInterval(Ae),u&&(p(null),d(!1),C(!1),se.error("Connection timed out. Please try again."))},900*1e3)},gl=async()=>{if(!pe){se.error("Please name your rule");return}if(jn.length===0){se.error("Please select at least one action");return}la(!0);try{const q={[Le]:Ht};oa&&(q.older_than_days=parseInt(oa,10));const te=jn.includes("draft"),Ae={name:pe,description:ar||void 0,intent:ir||void 0,condition:q,actions:jn,instructions:te?ol:void 0,attachments:te?cl:[],is_enabled:!0};let Pt=!1;Ut?Pt=await e.updateRule(Ut.id,Ae):Pt=await e.createRule(Ae),Pt?(se.success(Ut?"Rule updated":"Rule created"),_e(!1),ca(null),ot(""),En(["archive"]),sr(""),Ni(""),rr(""),ll(""),Et([]),e.fetchRules()):se.error(`Failed to ${Ut?"update":"create"} rule`)}catch{se.error("An error occurred while saving the rule")}finally{la(!1)}},Di=async q=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await e.disconnectAccount(q)&&se.success("Account disconnected")},ur=async()=>{y(!0);const q=await e.updateSettings(S);y(!1),q&&se.success("Settings saved")},yl=async q=>{const te=q.target.files;if(!te||te.length===0)return;Ai(!0);const Ae=te[0],Pt=Ae.name.split(".").pop(),Pu=`${Math.random().toString(36).substring(2)}.${Pt}`,xl=`${t.user.id}/${Pu}`;try{const{error:ha}=await Je.storage.from("rule-attachments").upload(xl,Ae);if(ha)throw ha;const fa={name:Ae.name,path:xl,type:Ae.type,size:Ae.size};Et(Mi=>[...Mi,fa]),se.success("File uploaded")}catch(ha){console.error("Upload error:",ha),se.error("Failed to upload file")}finally{Ai(!1),q.target.value=""}},vl=q=>{Et(te=>te.filter(Ae=>Ae.path!==q))},Ln=q=>q==="gmail"?l.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"}):l.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 l.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[l.jsx(Ka,{open:E,onOpenChange:T,children:l.jsxs(Ya,{className:"sm:max-w-lg",children:[l.jsxs(Xa,{children:[l.jsxs(Wa,{className:"flex items-center gap-2",children:[l.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"}),s("config.gmail.connect")]}),l.jsx(Ja,{children:s(A==="credentials"?"config.gmail.credentialsDesc":"config.gmail.authCodeDesc")})]}),A==="credentials"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[l.jsx(iN,{className:"w-4 h-4"}),s("config.gmail.pasteJson")]}),l.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:N,onChange:q=>fl(q.target.value)}),l.jsx("p",{className:"text-xs text-muted-foreground",children:s("config.gmail.downloadHelp")})]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 flex items-center",children:l.jsx("span",{className:"w-full border-t"})}),l.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:l.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:s("config.gmail.orEnterManually")})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),l.jsx(Te,{placeholder:"xxx.apps.googleusercontent.com",value:G,onChange:q=>F(q.target.value)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),l.jsx(Te,{type:"password",placeholder:"GOCSPX-...",value:U,onChange:q=>M(q.target.value)})]})]})]}),l.jsxs(Ba,{children:[l.jsx(Q,{variant:"outline",onClick:()=>T(!1),children:s("common.cancel")}),l.jsxs(Q,{onClick:Oi,disabled:xe||!G||!U,children:[xe?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Ks,{className:"w-4 h-4 mr-2"}),s("common.save")," & ",s("setup.engage")]})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:l.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["1. A new tab opened with Google Sign-In",l.jsx("br",{}),"2. Sign in and authorize the app",l.jsx("br",{}),"3. Copy the authorization code shown",l.jsx("br",{}),"4. Paste it below"]})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Authorization Code"}),l.jsx(Te,{placeholder:"4/0AQlEd8x...",value:J,onChange:q=>re(q.target.value),className:"font-mono"})]})]}),l.jsxs(Ba,{children:[l.jsx(Q,{variant:"outline",onClick:()=>D("credentials"),children:s("setup.back")}),l.jsxs(Q,{onClick:da,disabled:Ie||!J.trim(),children:[Ie?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Ks,{className:"w-4 h-4 mr-2"}),s("setup.engage")]})]})]})]})}),l.jsx(Ka,{open:ee,onOpenChange:C,children:l.jsxs(Ya,{className:"sm:max-w-lg",children:[l.jsxs(Xa,{children:[l.jsxs(Wa,{className:"flex items-center gap-2",children:[l.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"}),s("config.outlook.connect")]}),l.jsx(Ja,{children:s(I==="credentials"?"config.outlook.credentialsDesc":"config.outlook.instructions")})]}),I==="credentials"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsx("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:l.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"Note: You need an Azure App Registration for this to work."})}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Client ID (Application ID)"}),l.jsx(Te,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:de,onChange:q=>Se(q.target.value)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),l.jsx(Te,{placeholder:"common",value:R,onChange:q=>Y(q.target.value)}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:'Default is "common". Use your specific Tenant ID for organization accounts.'})]})]})]}),l.jsxs(Ba,{children:[l.jsx(Q,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),l.jsxs(Q,{onClick:ml,disabled:Z||!de,children:[Z?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Ks,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):l.jsxs(l.Fragment,{children:[f&&l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[l.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Action Required"}),l.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:f.message}),l.jsxs("div",{className:"flex flex-col gap-3",children:[l.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:l.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:f.userCode})}),l.jsxs(Q,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(f.verificationUri,"_blank"),children:["Open Microsoft Login",l.jsx(Vo,{className:"w-4 h-4 ml-2"})]})]})]}),l.jsx("div",{className:"flex justify-center",children:l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(pt,{size:"sm"}),"Waiting for authorization..."]})})]}),l.jsx(Ba,{children:l.jsx(Q,{variant:"outline",onClick:()=>C(!1),children:"Cancel"})})]})]})}),l.jsx(Ka,{open:be,onOpenChange:q=>{_e(q),q||ca(null)},children:l.jsxs(Ya,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[l.jsxs(Xa,{className:"p-6 border-b",children:[l.jsx(Wa,{children:s(Ut?"config.rules.edit":"config.rules.create")}),l.jsx(Ja,{children:s("config.rules.desc")})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.rules.name")}),l.jsx(Te,{placeholder:s("config.rules.namePlaceholder"),value:pe,onChange:q=>ot(q.target.value)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.rules.description")}),l.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:s("config.rules.descriptionPlaceholder"),value:ar,onChange:q=>rr(q.target.value)}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("config.rules.semanticHelp")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.rules.intent")}),l.jsx(Te,{placeholder:s("config.rules.intentPlaceholder"),value:ir,onChange:q=>ll(q.target.value)}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("config.rules.intentHelp")})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.rules.conditionField")}),l.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Le,onChange:q=>{cn(q.target.value),q.target.value==="category"?jt("newsletter"):q.target.value==="sentiment"?jt("Positive"):q.target.value==="priority"?jt("High"):jt("")},children:[l.jsxs("optgroup",{label:s("config.rules.aiAnalysis"),children:[l.jsx("option",{value:"category",children:s("config.rules.category")}),l.jsx("option",{value:"sentiment",children:s("config.rules.sentiment")}),l.jsx("option",{value:"priority",children:s("config.rules.priority")})]}),l.jsxs("optgroup",{label:s("config.rules.metadata"),children:[l.jsx("option",{value:"sender_email",children:s("config.rules.senderEmail")}),l.jsx("option",{value:"sender_domain",children:s("config.rules.senderDomain")}),l.jsx("option",{value:"sender_contains",children:s("config.rules.senderContains")}),l.jsx("option",{value:"subject_contains",children:s("config.rules.subjectContains")}),l.jsx("option",{value:"body_contains",children:s("config.rules.bodyContains")})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.rules.equalsValue")}),Le==="category"?l.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ht,onChange:q=>jt(q.target.value),children:[l.jsx("option",{value:"newsletter",children:"Newsletter"}),l.jsx("option",{value:"spam",children:"Spam"}),l.jsx("option",{value:"promotional",children:"Promotional"}),l.jsx("option",{value:"transactional",children:"Transactional"}),l.jsx("option",{value:"social",children:"Social"}),l.jsx("option",{value:"support",children:"Support"}),l.jsx("option",{value:"client",children:"Client"}),l.jsx("option",{value:"internal",children:"Internal"}),l.jsx("option",{value:"personal",children:"Personal"}),l.jsx("option",{value:"other",children:"Other"})]}):Le==="sentiment"?l.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ht,onChange:q=>jt(q.target.value),children:[l.jsx("option",{value:"Positive",children:"Positive"}),l.jsx("option",{value:"Neutral",children:"Neutral"}),l.jsx("option",{value:"Negative",children:"Negative"})]}):Le==="priority"?l.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ht,onChange:q=>jt(q.target.value),children:[l.jsx("option",{value:"High",children:"High"}),l.jsx("option",{value:"Medium",children:"Medium"}),l.jsx("option",{value:"Low",children:"Low"})]}):l.jsx(Te,{placeholder:Le==="sender_domain"?"rta.vn":Le==="sender_email"?"john@example.com":s("config.rules.keywordsPlaceholder"),value:Ht,onChange:q=>jt(q.target.value)})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[l.jsx(Qa,{className:"w-4 h-4"}),s("config.rules.olderThan")]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Te,{type:"number",min:"0",placeholder:"0",className:"w-24",value:oa,onChange:q=>sr(q.target.value)}),l.jsx("span",{className:"text-sm text-muted-foreground",children:"days"})]}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("config.rules.olderThanHelp")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.rules.performActions")}),l.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Select one or more actions to execute when the rule matches"}),l.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"archive",label:s("common.archive")},{value:"delete",label:s("common.delete")},{value:"draft",label:s("common.draft")},{value:"star",label:s("common.star")}].map(q=>l.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${jn.includes(q.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[l.jsx("input",{type:"checkbox",checked:jn.includes(q.value),onChange:te=>{te.target.checked?En([...jn,q.value]):En(jn.filter(Ae=>Ae!==q.value))},className:"rounded border-gray-300"}),l.jsx("span",{className:"text-sm",children:q.label})]},q.value))})]}),jn.includes("draft")&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.rules.draftInstructions")}),l.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:q=>Ni(q.target.value)}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("config.rules.contextHelp")})]}),l.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[l.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[l.jsx(Lb,{className:"w-4 h-4"}),"Attachments (Optional)"]}),l.jsxs("div",{className:"flex flex-col gap-2",children:[cl.map(q=>l.jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary/50 rounded border text-xs",children:[l.jsx("span",{className:"truncate max-w-[200px]",children:q.name}),l.jsx(Q,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>vl(q.path),children:l.jsx(aa,{className:"w-3 h-3"})})]},q.path)),l.jsxs("div",{className:"relative",children:[l.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:yl,disabled:or}),l.jsxs(Q,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:or,children:[or?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Ia,{className:"w-3 h-3 mr-2"}),s(or?"config.rules.uploading":"config.rules.addAttachment")]})]})]}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("config.rules.attachmentHelp")})]})]})]}),l.jsxs(Ba,{className:"p-6 border-t bg-secondary/5",children:[l.jsx(Q,{variant:"outline",onClick:()=>_e(!1),children:s("common.cancel")}),l.jsxs(Q,{onClick:gl,disabled:ki,children:[ki?l.jsx(pt,{size:"sm",className:"mr-2"}):Ut?l.jsx(Ks,{className:"w-4 h-4 mr-2"}):l.jsx(Ia,{className:"w-4 h-4 mr-2"}),s(Ut?"config.rules.saveChanges":"config.rules.createRule")]})]})]})}),l.jsxs(Bt,{children:[l.jsxs(Js,{children:[l.jsxs(Qs,{className:"flex items-center gap-2",children:[l.jsx(hi,{className:"w-5 h-5 text-primary"}),s("config.accounts.title")]}),l.jsx(Ga,{children:s("config.accounts.desc")})]}),l.jsx(Zs,{children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold mb-3",children:s("config.accounts.addNew")}),l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsx(Q,{className:"w-full border-dashed justify-start h-auto py-4",variant:"outline",onClick:Lu,disabled:r||u,children:l.jsxs("div",{className:"flex items-center gap-3 w-full",children:[l.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"}),l.jsxs("div",{className:"flex-1 text-left",children:[l.jsx("div",{className:"font-medium",children:"Gmail"}),l.jsx("div",{className:"text-xs text-muted-foreground",children:s("config.gmail.connectDesc")})]}),r?l.jsx(pt,{size:"sm"}):l.jsx(Ia,{className:"w-5 h-5 shrink-0"})]})}),l.jsx(Q,{className:"w-full border-dashed justify-start h-auto py-4",variant:"outline",onClick:Uu,disabled:r||u,children:l.jsxs("div",{className:"flex items-center gap-3 w-full",children:[l.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"}),l.jsxs("div",{className:"flex-1 text-left",children:[l.jsx("div",{className:"font-medium",children:"Outlook"}),l.jsx("div",{className:"text-xs text-muted-foreground",children:s("config.outlook.connectDesc")})]}),u&&!f?l.jsx(pt,{size:"sm"}):l.jsx(Ia,{className:"w-5 h-5 shrink-0"})]})})]})]}),f&&l.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:[l.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:s("config.outlook.signinRequired")}),l.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:f.message}),l.jsxs("div",{className:"flex flex-col gap-3",children:[l.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:l.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:f.userCode})}),l.jsxs(Q,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(f.verificationUri,"_blank"),children:["Open Microsoft Login",l.jsx(Vo,{className:"w-4 h-4 ml-2"})]}),l.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:s("config.outlook.waitingSignin")})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-sm font-semibold mb-3",children:s("config.accounts.yourAccounts")}),t.accounts.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 border-2 border-dashed rounded-lg",children:[l.jsx(hi,{className:"w-12 h-12 text-muted-foreground/40 mb-3"}),l.jsx("p",{className:"text-sm text-muted-foreground text-center",children:s("config.accounts.noAccounts")}),l.jsx("p",{className:"text-xs text-muted-foreground text-center mt-1",children:s("config.accounts.connectHelp")})]}):l.jsx("div",{className:"space-y-3",children:t.accounts.map(q=>l.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-card hover:bg-secondary/30 transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[Ln(q.provider),l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium capitalize",children:q.provider}),l.jsx("p",{className:"text-xs text-muted-foreground",children:q.email_address})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[q.is_active?l.jsx("span",{className:"text-xs text-emerald-600 bg-emerald-500/10 px-2 py-1 rounded-full",children:s("common.active")}):l.jsx("span",{className:"text-xs text-yellow-600 bg-yellow-500/10 px-2 py-1 rounded-full",children:s("common.inactive")}),l.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",onClick:()=>Di(q.id),title:s("config.accounts.disconnect"),children:l.jsx(Su,{className:"w-4 h-4"})})]})]},q.id))})]})]})})]}),l.jsxs(Bt,{children:[l.jsxs(Js,{children:[l.jsxs(Qs,{className:"flex items-center gap-2",children:[l.jsx(Jt,{className:"w-5 h-5 text-indigo-500"}),s("config.model.title")]}),l.jsx(Ga,{children:s("config.model.desc")})]}),l.jsxs(Zs,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.model.provider")}),lr?l.jsxs("div",{className:"h-10 border rounded-md flex items-center px-3 bg-muted/20",children:[l.jsx(pt,{size:"sm",className:"mr-2"}),l.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Discovering..."})]}):l.jsxs(l.Fragment,{children:[l.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:S.llm_provider||Ao,onChange:q=>zu(q.target.value),disabled:lr,children:[l.jsx("option",{value:Ao,children:"RealTimeX AI (Default)"}),Mu.filter(q=>q.provider!==Ao).map(q=>l.jsx("option",{value:q.provider,children:q.name||q.provider},q.provider))]}),bs&&l.jsxs("div",{className:"text-[10px] text-amber-500 mt-1 px-1 bg-amber-50/50 rounded",children:["⚠️ ",bs]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:s("config.model.name")}),hl.length>0||lr?l.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:S.llm_model||"",onChange:q=>_(te=>({...te,llm_model:q.target.value})),disabled:lr,children:[!S.llm_model&&l.jsx("option",{value:"",children:s("config.model.selectModel")}),hl.map(q=>l.jsx("option",{value:q.id,children:q.name||q.id},q.id))]}):l.jsx(Te,{placeholder:"e.g. gpt-4o-mini",value:S.llm_model||"",onChange:q=>_(te=>({...te,llm_model:q.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[l.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[l.jsx(hi,{className:"w-4 h-4"}),s("config.model.storagePath")]}),l.jsx(Te,{placeholder:s("config.model.storagePlaceholder"),value:S.storage_path||"",onChange:q=>_(te=>({...te,storage_path:q.target.value}))}),l.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:s("config.model.storageHelp")})]}),l.jsxs("div",{className:"flex justify-between items-center py-3 border-t border-border/50",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm",children:s("config.model.intelligentRename")}),l.jsx("p",{className:"text-xs text-muted-foreground",children:s("config.model.renameHelp")})]}),l.jsxs(Q,{variant:S.intelligent_rename?"default":"outline",size:"sm",onClick:()=>_(q=>({...q,intelligent_rename:!q.intelligent_rename})),children:[l.jsx(Ub,{className:"w-4 h-4 mr-1"}),S.intelligent_rename?s("common.enabled"):s("common.disabled")]})]}),l.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[l.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[l.jsx(Qa,{className:"w-4 h-4"}),s("config.model.syncInterval")]}),l.jsx(Te,{type:"number",min:1,max:1440,value:S.sync_interval_minutes||5,onChange:q=>_(te=>({...te,sync_interval_minutes:parseInt(q.target.value,10)||5}))}),l.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:s("config.model.syncHelp")})]}),l.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[l.jsxs(Q,{variant:"outline",onClick:cr,disabled:v,children:[v?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Jt,{className:"w-4 h-4 mr-2"}),s("config.model.checkConnection")]}),l.jsxs(Q,{onClick:ur,disabled:m,children:[m?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Ks,{className:"w-4 h-4 mr-2"}),s("config.model.saveConfig")]})]})]})]}),l.jsx("div",{ref:ua,children:l.jsxs(Bt,{children:[l.jsxs(Js,{children:[l.jsxs(Qs,{className:"flex items-center gap-2",children:[l.jsx(Vb,{className:"w-5 h-5 text-orange-500"}),s("config.byok.title")]}),l.jsxs(Ga,{children:[s("config.byok.desc"),s("config.byok.systemDefault")]})]}),l.jsxs(Zs,{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-4 border-b pb-4",children:[l.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Google / Gmail"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),l.jsx(Te,{type:"password",placeholder:"...apps.googleusercontent.com",value:S.google_client_id||"",onChange:q=>_(te=>({...te,google_client_id:q.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),l.jsx(Te,{type:"password",placeholder:"GOCSPX-...",value:S.google_client_secret||"",onChange:q=>_(te=>({...te,google_client_secret:q.target.value}))})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500"})," Microsoft / Outlook"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),l.jsx(Te,{type:"password",value:S.microsoft_client_id||"",onChange:q=>_(te=>({...te,microsoft_client_id:q.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),l.jsx(Te,{type:"password",value:S.microsoft_client_secret||"",onChange:q=>_(te=>({...te,microsoft_client_secret:q.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),l.jsx(Te,{placeholder:"common",value:S.microsoft_tenant_id||"",onChange:q=>_(te=>({...te,microsoft_tenant_id:q.target.value}))})]})]})]}),l.jsx("div",{className:"flex justify-end mt-4",children:l.jsxs(Q,{onClick:ur,disabled:m,variant:"secondary",children:[m?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Ks,{className:"w-4 h-4 mr-2"}),s("config.byok.save")]})})]})]})})]})}function j3(){const{t}=nt(),[e,s]=w.useState("profile"),{state:r,actions:o}=ra();w.useEffect(()=>{o.fetchProfile()},[]);const u=[{id:"profile",label:t("account.profile"),icon:Bb},{id:"security",label:t("account.security"),icon:km},{id:"database",label:t("account.database"),icon:hi}];return l.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 animate-in fade-in duration-500",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:t("account.title")}),l.jsx("p",{className:"text-muted-foreground",children:t("account.subtitle")})]}),l.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[l.jsxs("aside",{className:"w-full md:w-64 flex flex-col justify-between",children:[l.jsx("nav",{className:"space-y-1",children:u.map(d=>{const f=d.icon,p=e===d.id;return l.jsxs("button",{onClick:()=>s(d.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:[l.jsx(f,{className:"w-4 h-4"}),d.label]},d.id)})}),l.jsxs("div",{className:"mt-auto space-y-1",children:[l.jsxs("button",{onClick:async()=>{await Je.auth.signOut(),se.success(t("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:[l.jsx(ET,{className:"w-4 h-4"}),t("account.logout")]}),l.jsxs("div",{className:"px-4 py-4 border-t border-border/40 text-center md:text-left",children:[l.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-widest mb-1",children:t("account.version")}),l.jsxs("p",{className:"text-xs font-mono text-muted-foreground/70",children:["v","2.19.2"]})]})]})]}),l.jsxs("div",{className:"flex-1 space-y-6",children:[e==="profile"&&l.jsx(E3,{}),e==="security"&&l.jsx(T3,{}),e==="database"&&l.jsx(N3,{})]})]})]})}function E3(){const{t}=nt(),{state:e,actions:s}=ra(),[r,o]=w.useState(""),[u,d]=w.useState(""),[f,p]=w.useState(!1),[m,y]=w.useState(!1),[v,b]=w.useState($n.isEnabled());w.useEffect(()=>{e.profile&&(o(e.profile.first_name||""),d(e.profile.last_name||""))},[e.profile]);const S=()=>{const T=!v;$n.setEnabled(T),b(T),T?($n.playSuccess(),se.success(t("account.profile.soundsEnabled"))):se.info(t("account.profile.soundsDisabled"))},_=async()=>{p(!0);const T=await s.updateProfile({first_name:r,last_name:u});p(!1),T&&se.success(t("account.profile.updated"))},E=async T=>{const A=T.target.files?.[0];if(!(!A||!e.user)){y(!0);try{const D=A.name.split(".").pop(),N=`${e.user.id}/avatar.${D}`,{data:L,error:G}=await Je.storage.from("avatars").upload(N,A,{upsert:!0});if(G)throw G;const{data:{publicUrl:F}}=Je.storage.from("avatars").getPublicUrl(N);await s.updateProfile({avatar_url:F}),se.success(t("account.profile.avatarUpdated"))}catch(D){console.error("Avatar upload error:",D),se.error(t("account.profile.avatarError"))}finally{y(!1)}}};return l.jsxs(Bt,{children:[l.jsxs(Js,{children:[l.jsx(Qs,{children:t("account.profile.title")}),l.jsx(Ga,{children:t("account.profile.desc")})]}),l.jsxs(Zs,{className:"space-y-6",children:[l.jsxs("div",{className:"flex flex-col items-center sm:flex-row sm:items-start gap-6",children:[l.jsxs("div",{className:"relative group",children:[l.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?l.jsx("img",{src:e.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):l.jsx(Bb,{className:"w-12 h-12 text-muted-foreground"})}),l.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:[l.jsx(BE,{className:"w-6 h-6 text-white"}),l.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:E,disabled:m})]}),m&&l.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:l.jsx(pt,{size:"sm"})})]}),l.jsxs("div",{className:"flex-1 space-y-4 w-full",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx($t,{htmlFor:"first-name",children:t("account.profile.firstName")}),l.jsx(Te,{id:"first-name",value:r,onChange:T=>o(T.target.value),placeholder:t("account.profile.firstNamePlaceholder")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx($t,{htmlFor:"last-name",children:t("account.profile.lastName")}),l.jsx(Te,{id:"last-name",value:u,onChange:T=>d(T.target.value),placeholder:t("account.profile.lastNamePlaceholder")})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx($t,{htmlFor:"email",children:t("account.profile.email")}),l.jsx(Te,{id:"email",value:e.profile?.email||"",disabled:!0,className:"bg-secondary/50"}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:t("account.profile.emailHelp")})]})]})]}),l.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx("label",{className:"text-sm font-medium",children:t("account.profile.sounds")}),l.jsx("p",{className:"text-xs text-muted-foreground",children:t("account.profile.soundsHelp")})]}),l.jsxs(Q,{variant:v?"default":"outline",size:"sm",onClick:S,className:"gap-2",children:[v?l.jsx(dN,{className:"w-4 h-4"}):l.jsx(fN,{className:"w-4 h-4"}),t(v?"common.enabled":"common.disabled")]})]}),l.jsx("div",{className:"flex justify-end pt-4 border-t",children:l.jsxs(Q,{onClick:_,disabled:f,children:[f?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(IT,{className:"w-4 h-4 mr-2"}),t("common.saveChanges")]})})]})]})}function T3(){const{t}=nt(),[e,s]=w.useState(""),[r,o]=w.useState(""),[u,d]=w.useState(!1),f=async()=>{if(!e){se.error(t("account.security.enterPassword"));return}if(e!==r){se.error(t("account.security.passwordsMismatch"));return}if(e.length<6){se.error(t("account.security.passwordTooShort"));return}d(!0);try{const{api:p}=await Ua(async()=>{const{api:y}=await Promise.resolve().then(()=>Zk);return{api:y}},void 0),m=await p.changePassword(e);m.success?(se.success(t("account.security.passwordChanged")),s(""),o("")):se.error(m.error?.message||"Failed to change password")}catch{se.error(t("common.errorOccurred"))}finally{d(!1)}};return l.jsxs(Bt,{children:[l.jsxs(Js,{children:[l.jsx(Qs,{children:t("account.security.title")}),l.jsx(Ga,{children:t("account.security.desc")})]}),l.jsxs(Zs,{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx($t,{htmlFor:"new-password",children:t("account.security.newPassword")}),l.jsx(Te,{id:"new-password",type:"password",value:e,onChange:p=>s(p.target.value),placeholder:"••••••••"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx($t,{htmlFor:"confirm-password",children:t("account.security.confirmPassword")}),l.jsx(Te,{id:"confirm-password",type:"password",value:r,onChange:p=>o(p.target.value),placeholder:"••••••••"})]}),l.jsx("div",{className:"flex justify-end pt-4 border-t",children:l.jsxs(Q,{onClick:f,disabled:u,children:[u?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Am,{className:"w-4 h-4 mr-2"}),t("account.security.updatePassword")]})})]})]})}function N3(){const{t}=nt(),[e,s]=w.useState(!1),[r,o]=w.useState(null),u=_i(),d=Wk();w.useEffect(()=>{u&&pp(Je).then(o)},[]);const f=()=>{confirm(t("account.database.clearConfirm"))&&(Yk(),window.location.reload())};return l.jsxs(l.Fragment,{children:[l.jsxs(Bt,{children:[l.jsxs(Js,{children:[l.jsxs(Qs,{className:"flex items-center gap-2",children:[l.jsx(hi,{className:"w-5 h-5 text-primary"}),t("account.database.title")]}),l.jsx(Ga,{children:t("account.database.desc")})]}),l.jsx(Zs,{className:"space-y-6",children:u?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-xl bg-emerald-500/5 border-emerald-500/20",children:[l.jsx(ru,{className:"w-6 h-6 text-emerald-500 mt-0.5"}),l.jsxs("div",{className:"flex-1 space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:"font-semibold text-emerald-700 dark:text-emerald-400",children:t("account.database.connected")}),r?.latestMigrationTimestamp&&l.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 ",r.latestMigrationTimestamp]})]}),l.jsx("p",{className:"text-sm font-mono break-all opacity-80",children:u.url})]})]}),d==="env"&&l.jsxs(Za,{className:"bg-amber-500/5 border-amber-500/20",children:[l.jsx(Io,{className:"h-4 w-4 text-amber-500"}),l.jsx(er,{className:"text-amber-700 dark:text-amber-400 text-xs",children:t("account.database.envAlert")})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[l.jsxs(Q,{variant:"outline",onClick:()=>s(!0),className:"w-full",children:[l.jsx(Io,{className:"w-4 h-4 mr-2"}),t("account.database.changeConnection")]}),d==="ui"&&l.jsxs(Q,{variant:"outline",onClick:f,className:"w-full text-destructive hover:bg-destructive/10",children:[l.jsx(Su,{className:"w-4 h-4 mr-2"}),t("account.database.clearConfig")]})]}),l.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[l.jsx($t,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:t("account.database.anonKey")}),l.jsxs("div",{className:"p-2 bg-secondary/50 rounded-lg font-mono text-xs break-all",children:[u.anonKey.substring(0,20),"...",u.anonKey.substring(u.anonKey.length-10)]})]})]}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center space-y-4",children:[l.jsx(tT,{className:"w-12 h-12 text-destructive opacity-20"}),l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",children:t("account.database.noConnection")}),l.jsx("p",{className:"text-sm text-muted-foreground",children:t("account.database.configureHelp")})]}),l.jsxs(Q,{onClick:()=>s(!0),children:[l.jsx(hi,{className:"w-4 h-4 mr-2"}),t("account.database.setup")]})]})})]}),l.jsx(bS,{open:e,onComplete:()=>s(!1),canClose:!0})]})}function kb({rules:t,onToggleRule:e,onEditRule:s,onDeleteRule:r}){const{t:o}=nt(),u={email_organization:{label:o("autopilot.category.email_organization.label"),icon:Bo,emoji:"📧",description:o("autopilot.category.email_organization.desc")},priority_alerts:{label:o("autopilot.category.priority_alerts.label"),icon:Mn,emoji:"🚨",description:o("autopilot.category.priority_alerts.desc")},development:{label:o("autopilot.category.development.label"),icon:ps,emoji:"💻",description:o("autopilot.category.development.desc")},sales_business:{label:o("autopilot.category.sales_business.label"),icon:LE,emoji:"💼",description:o("autopilot.category.sales_business.desc")},operations:{label:o("autopilot.category.operations.label"),icon:Io,emoji:"⚙️",description:o("autopilot.category.operations.desc")}},d=t.reduce((m,y)=>{const v=y.category||"email_organization";return m[v]||(m[v]=[]),m[v].push(y),m},{}),f=m=>{const y=m.filter(b=>b.is_enabled).length,v=m.length;return{enabled:y,total:v}},p=m=>!m||m.length===0?"":m.map(y=>y.startsWith("label:")?`label:${y.substring(6)}`:y).join(" + ");return l.jsx("div",{className:"space-y-8",children:Object.entries(u).map(([m,y])=>{const v=d[m]||[];if(v.length===0)return null;const b=f(v);return l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"flex items-center justify-between",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-lg bg-secondary/50 flex items-center justify-center",children:l.jsx("span",{className:"text-xl",children:y.emoji})}),l.jsxs("div",{children:[l.jsxs("h3",{className:"font-semibold text-base flex items-center gap-2",children:[y.label,l.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:o("autopilot.enabledCount").replace("{enabled}",b.enabled.toString()).replace("{total}",b.total.toString())})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:y.description})]})]})}),l.jsx("div",{className:"space-y-1",children:v.map(S=>l.jsxs("div",{className:"flex items-center justify-between py-3 px-4 rounded-lg hover:bg-secondary/30 transition-colors",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h4",{className:"font-medium text-sm truncate",children:S.name}),S.is_system_managed&&l.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:o("autopilot.badge")})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[S.intent&&l.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.intent}),S.actions&&S.actions.length>0&&l.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["→ ",p(S.actions)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[l.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>s(S.id),title:o("autopilot.editRuleTooltip"),children:l.jsx(DT,{className:"w-4 h-4 text-muted-foreground"})}),l.jsxs(Q,{variant:S.is_enabled?"default":"outline",size:"sm",onClick:()=>e(S.id,!S.is_enabled),className:"h-8 px-3",children:[l.jsx(Ub,{className:"w-4 h-4 mr-1"}),S.is_enabled?o("common.on"):o("common.off")]}),!S.is_system_managed&&r&&l.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",onClick:()=>r(S.id),title:o("autopilot.deleteRuleTooltip"),children:l.jsx(Su,{className:"w-4 h-4"})})]})]},S.id))})]},m)})})}function A3({open:t,rule:e,onClose:s,onSave:r,onFileUpload:o,onRemoveAttachment:u}){const{t:d}=nt(),[f,p]=w.useState(!1),[m,y]=w.useState(!1),[v,b]=w.useState(""),[S,_]=w.useState(""),[E,T]=w.useState(""),[A,D]=w.useState("category"),[N,L]=w.useState("newsletter"),[G,F]=w.useState(""),[U,M]=w.useState(["archive"]),[J,re]=w.useState(""),[xe,ue]=w.useState([]);w.useEffect(()=>{if(e){b(e.name||""),_(e.description||""),T(e.intent||""),M(e.actions||["archive"]),re(e.instructions||""),ue(e.attachments||[]);const C=e.condition||{},I=Object.keys(C).filter(B=>B!=="older_than_days");I.length>0&&(D(I[0]),L(C[I[0]])),C.older_than_days&&F(String(C.older_than_days))}else b(""),_(""),T(""),D("category"),L("newsletter"),F(""),M(["archive"]),re(""),ue([])},[e,t]);const Ie=async()=>{if(v.trim()&&U.length!==0){p(!0);try{const C={[A]:N};G&&(C.older_than_days=parseInt(G,10));const I=U.includes("draft"),B={name:v.trim(),description:S.trim()||void 0,intent:E.trim()||void 0,condition:C,actions:U,instructions:I?J:void 0,attachments:I?xe:[],is_enabled:!0};await r(B)&&s()}finally{p(!1)}}},Ve=async C=>{if(!o)return;const I=C.target.files;if(!(!I||I.length===0)){y(!0);try{const B=await o(I[0]);B&&ue(de=>[...de,B])}finally{y(!1),C.target.value=""}}},ee=C=>{ue(I=>I.filter(B=>B.path!==C)),u&&u(C)};return l.jsx(Ka,{open:t,onOpenChange:C=>!C&&s(),children:l.jsxs(Ya,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[l.jsxs(Xa,{className:"p-6 border-b",children:[l.jsx(Wa,{children:d(e?"autopilot.editDialog.editTitle":"autopilot.editDialog.createTitle")}),l.jsx(Ja,{children:d("autopilot.editDialog.desc")})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:d("autopilot.editDialog.ruleName")}),l.jsx(Te,{placeholder:d("autopilot.editDialog.namePlaceholder"),value:v,onChange:C=>b(C.target.value)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:d("autopilot.editDialog.description")}),l.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:d("autopilot.editDialog.descPlaceholder"),value:S,onChange:C=>_(C.target.value)}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:d("autopilot.editDialog.descriptionHelp")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:d("autopilot.editDialog.intent")}),l.jsx(Te,{placeholder:d("autopilot.editDialog.intentPlaceholder"),value:E,onChange:C=>T(C.target.value)}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:d("autopilot.editDialog.intentHelp")})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:d("autopilot.editDialog.conditionField")}),l.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:A,onChange:C=>{D(C.target.value),C.target.value==="category"?L("newsletter"):C.target.value==="sentiment"?L("Positive"):C.target.value==="priority"?L("High"):L("")},children:[l.jsxs("optgroup",{label:d("autopilot.editDialog.aiAnalysisGroup"),children:[l.jsx("option",{value:"category",children:d("autopilot.editDialog.category")}),l.jsx("option",{value:"sentiment",children:d("autopilot.editDialog.sentiment")}),l.jsx("option",{value:"priority",children:d("autopilot.editDialog.priority")})]}),l.jsxs("optgroup",{label:d("autopilot.editDialog.metadataGroup"),children:[l.jsx("option",{value:"sender_email",children:d("autopilot.editDialog.senderEmail")}),l.jsx("option",{value:"sender_domain",children:d("autopilot.editDialog.senderDomain")}),l.jsx("option",{value:"sender_contains",children:d("autopilot.editDialog.senderContains")}),l.jsx("option",{value:"subject_contains",children:d("autopilot.editDialog.subjectContains")}),l.jsx("option",{value:"body_contains",children:d("autopilot.editDialog.bodyContains")})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:d("autopilot.editDialog.equalsValue")}),A==="category"?l.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:N,onChange:C=>L(C.target.value),children:[l.jsx("option",{value:"newsletter",children:d("autopilot.editDialog.cat.newsletter")}),l.jsx("option",{value:"spam",children:d("autopilot.editDialog.cat.spam")}),l.jsx("option",{value:"promotional",children:d("autopilot.editDialog.cat.promotional")}),l.jsx("option",{value:"transactional",children:d("autopilot.editDialog.cat.transactional")}),l.jsx("option",{value:"social",children:d("autopilot.editDialog.cat.social")}),l.jsx("option",{value:"support",children:d("autopilot.editDialog.cat.support")}),l.jsx("option",{value:"client",children:d("autopilot.editDialog.cat.client")}),l.jsx("option",{value:"internal",children:d("autopilot.editDialog.cat.internal")}),l.jsx("option",{value:"personal",children:d("autopilot.editDialog.cat.personal")}),l.jsx("option",{value:"other",children:d("autopilot.editDialog.cat.other")})]}):A==="sentiment"?l.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:N,onChange:C=>L(C.target.value),children:[l.jsx("option",{value:"Positive",children:d("autopilot.editDialog.sent.positive")}),l.jsx("option",{value:"Neutral",children:d("autopilot.editDialog.sent.neutral")}),l.jsx("option",{value:"Negative",children:d("autopilot.editDialog.sent.negative")})]}):A==="priority"?l.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:N,onChange:C=>L(C.target.value),children:[l.jsx("option",{value:"High",children:d("autopilot.editDialog.prio.high")}),l.jsx("option",{value:"Medium",children:d("autopilot.editDialog.prio.medium")}),l.jsx("option",{value:"Low",children:d("autopilot.editDialog.prio.low")})]}):l.jsx(Te,{placeholder:A==="sender_domain"?"rta.vn":A==="sender_email"?"john@example.com":d("autopilot.editDialog.keywordsPlaceholder"),value:N,onChange:C=>L(C.target.value)})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[l.jsx(Qa,{className:"w-4 h-4"}),d("autopilot.editDialog.olderThan")]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Te,{type:"number",min:"0",placeholder:"0",className:"w-24",value:G,onChange:C=>F(C.target.value)}),l.jsx("span",{className:"text-sm text-muted-foreground",children:d("autopilot.editDialog.days")})]}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:d("autopilot.editDialog.olderThanHelp")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-sm font-medium",children:d("autopilot.editDialog.performActions")}),l.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:d("autopilot.editDialog.actionsDesc")}),l.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"archive",label:d("autopilot.editDialog.action.archive")},{value:"delete",label:d("autopilot.editDialog.action.delete")},{value:"draft",label:d("autopilot.editDialog.action.draft")},{value:"star",label:d("autopilot.editDialog.action.star")}].map(C=>l.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${U.includes(C.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[l.jsx("input",{type:"checkbox",checked:U.includes(C.value),onChange:I=>{I.target.checked?M([...U,C.value]):M(U.filter(B=>B!==C.value))},className:"rounded border-gray-300"}),l.jsx("span",{className:"text-sm",children:C.label})]},C.value))})]}),U.includes("draft")&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[l.jsx("label",{className:"text-sm font-medium",children:d("autopilot.editDialog.draftInstructions")}),l.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[80px] text-sm",placeholder:d("autopilot.editDialog.draftInstPlaceholder"),value:J,onChange:C=>re(C.target.value)}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:d("autopilot.editDialog.draftInstHelp")})]}),o&&l.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[l.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[l.jsx(Lb,{className:"w-4 h-4"}),d("autopilot.editDialog.attachments")]}),l.jsxs("div",{className:"flex flex-col gap-2",children:[xe.map(C=>l.jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary/50 rounded border text-xs",children:[l.jsx("span",{className:"truncate max-w-[200px]",children:C.name}),l.jsx(Q,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>ee(C.path),children:l.jsx(aa,{className:"w-3 h-3"})})]},C.path)),l.jsxs("div",{className:"relative",children:[l.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:Ve,disabled:m}),l.jsxs(Q,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:m,children:[m?l.jsx(pt,{size:"sm",className:"mr-2"}):l.jsx(Ia,{className:"w-3 h-3 mr-2"}),d(m?"autopilot.editDialog.uploading":"autopilot.editDialog.addAttachment")]})]})]}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:d("autopilot.editDialog.attachmentsHelp")})]})]})]}),l.jsxs(Ba,{className:"p-6 border-t bg-secondary/5",children:[l.jsx(Q,{variant:"outline",onClick:s,children:d("common.cancel")}),l.jsxs(Q,{onClick:Ie,disabled:f||!v.trim()||U.length===0,children:[f?l.jsx(pt,{size:"sm",className:"mr-2"}):e?l.jsx(Ks,{className:"w-4 h-4 mr-2"}):l.jsx(Ia,{className:"w-4 h-4 mr-2"}),d(e?"common.saveChanges":"autopilot.addCustomRule")]})]})]})})}function k3(){const{state:t,actions:e}=ra(),{t:s}=nt(),[r,o]=w.useState([]),[u,d]=w.useState(!0),[f,p]=w.useState(null),[m,y]=w.useState(!1),[v,b]=w.useState(null),S=async()=>{d(!0),p(null);try{const M=await Me.getRules();if(M.error)throw new Error(typeof M.error=="string"?M.error:M.error.message);o(M.data?.rules||[])}catch(M){p(M instanceof Error?M.message:s("autopilot.loadError")),console.error("Error fetching rules:",M)}finally{d(!1)}};w.useEffect(()=>{S()},[]);const _=async(M,J)=>{try{const re=await Me.updateRule(M,{is_enabled:J});if(re.error)throw new Error(typeof re.error=="string"?re.error:re.error.message);o(xe=>xe.map(ue=>ue.id===M?{...ue,is_enabled:J}:ue))}catch(re){console.error("Error toggling rule:",re),await S()}},E=M=>{const J=r.find(re=>re.id===M);J&&(b(J),y(!0))},T=async M=>{if(confirm(s("autopilot.deleteConfirm")))try{await e.deleteRule(M)?(se.success(s("autopilot.ruleDeleted")),o(re=>re.filter(xe=>xe.id!==M))):se.error(s("autopilot.ruleDeleteFailed"))}catch(J){console.error("Error deleting rule:",J),se.error(s("autopilot.ruleDeleteError"))}},A=()=>{b(null),y(!0)},D=async M=>{try{let J=!1;return v?J=await e.updateRule(v.id,M):J=await e.createRule(M),J?(se.success(s(v?"autopilot.ruleUpdated":"autopilot.ruleCreated")),await S(),!0):(se.error(s(v?"autopilot.ruleUpdateFailed":"autopilot.ruleCreateFailed")),!1)}catch(J){return console.error("Error saving rule:",J),se.error(s("autopilot.ruleSaveError")),!1}},N=async M=>{try{const J=M.name.split(".").pop(),re=`${Math.random().toString(36).substring(2)}.${J}`,xe=`${t.user.id}/${re}`,{error:ue}=await Je.storage.from("rule-attachments").upload(xe,M);if(ue)throw ue;return se.success(s("autopilot.fileUploaded")),{name:M.name,path:xe,type:M.type,size:M.size}}catch(J){return console.error("Upload error:",J),se.error(s("autopilot.fileUploadFailed")),null}},L=()=>{y(!1),b(null)};if(u)return l.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:l.jsxs("div",{className:"flex flex-col items-center gap-4",children:[l.jsx(Jt,{className:"w-8 h-8 animate-spin text-gray-400"}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("autopilot.loadingRules")})]})});if(f)return l.jsxs(Za,{variant:"destructive",children:[l.jsx(Mn,{className:"h-4 w-4"}),l.jsxs(er,{children:[f,l.jsxs(Q,{variant:"outline",size:"sm",onClick:S,className:"ml-4",children:[l.jsx(Jt,{className:"w-4 h-4 mr-2"}),s("autopilot.refresh")]})]})]});const G=r.filter(M=>M.is_system_managed),F=r.filter(M=>!M.is_system_managed),U=G.filter(M=>M.is_enabled).length;return r.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] p-8",children:[l.jsx(Jc,{className:"w-16 h-16 text-gray-300 dark:text-gray-700 mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:s("autopilot.noRulesTitle")}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 text-center max-w-md mb-4",children:s("autopilot.noRulesDesc")})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-8",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[l.jsx(Jc,{className:"w-6 h-6 text-blue-500"}),s("autopilot.title")]}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("autopilot.rulesEnabled").replace("{enabled}",U.toString()).replace("{total}",G.length.toString())})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(Q,{variant:"default",size:"sm",onClick:A,children:[l.jsx(Ia,{className:"w-4 h-4 mr-2"}),s("autopilot.addCustomRule")]}),l.jsxs(Q,{variant:"outline",size:"sm",onClick:S,disabled:u,children:[l.jsx(Jt,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`}),s("autopilot.refresh")]})]})]}),G.length>0&&l.jsxs(Za,{children:[l.jsx(Jc,{className:"h-4 w-4"}),l.jsx(er,{children:s("autopilot.infoDesc")})]}),G.length>0&&l.jsx(kb,{rules:G,onToggleRule:_,onEditRule:E,onDeleteRule:T}),F.length>0&&l.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:s("autopilot.customRules")}),l.jsx("p",{className:"text-sm text-muted-foreground",children:s("autopilot.customRulesDesc")})]}),l.jsx(kb,{rules:F,onToggleRule:_,onEditRule:E,onDeleteRule:T})]})]}),l.jsx(A3,{open:m,rule:v,onClose:L,onSave:D,onFileUpload:N})]})}function C3({length:t=6,value:e,onChange:s,onComplete:r,disabled:o=!1,error:u=!1}){const d=w.useRef([]),[f,p]=w.useState(null),m=(b,S)=>{const _=S.replace(/[^0-9]/g,"");if(_.length===0){const A=e.split("");A[b]=" ",e.split("");let D=e.split("");b<D.length&&D.splice(b,1);const N=D.join("");s(N),b>0&&d.current[b-1]?.focus();return}e.split("");const E=[...e];E[b]=_[0],s(E.join("")),b<t-1&&d.current[b+1]?.focus();const T=E.join("");T.length===t&&r&&r(T)},y=(b,S)=>{S.key==="Backspace"&&!e[b]&&b>0||S.key==="ArrowLeft"&&b>0?d.current[b-1]?.focus():S.key==="ArrowRight"&&b<t-1&&d.current[b+1]?.focus()},v=b=>{b.preventDefault();const _=b.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,t);s(_);const E=Math.min(_.length,t-1);d.current[E]?.focus(),_.length===t&&r&&r(_)};return l.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:t}).map((b,S)=>l.jsx(Te,{ref:_=>{d.current[S]=_},type:"text",inputMode:"numeric",maxLength:1,value:e[S]||"",onChange:_=>m(S,_.target.value),onKeyDown:_=>y(S,_),onPaste:v,onFocus:()=>p(S),onBlur:()=>p(null),disabled:o,className:we("w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-semibold px-0",u&&"border-destructive focus-visible:ring-destructive",f===S&&"ring-2 ring-ring"),"aria-label":`Digit ${S+1}`},S))})}function R3({onSuccess:t,onConfigure:e,isInitialized:s}){const{t:r}=nt(),[o,u]=w.useState(""),[d,f]=w.useState(""),[p,m]=w.useState(""),[y,v]=w.useState(""),[b,S]=w.useState(!1),[_,E]=w.useState(s===void 0),[T,A]=w.useState(s??!1),[D,N]=w.useState(""),[L,G]=w.useState(!1),[F,U]=w.useState("password"),[M,J]=w.useState("email"),[re,xe]=w.useState(""),[ue,Ie]=w.useState(!1);w.useEffect(()=>{s===void 0?Ve():Ie(!s)},[s]);const Ve=async()=>{try{const{data:I,error:B}=await Je.from("init_state").select("is_initialized");if(B){if(B.code==="42P01"){console.info("[Login] init_state relation missing - fresh database detected."),A(!1),Ie(!0);return}console.warn("[Login] Init check error:",B),A(!1),Ie(!0),N(B.message);return}const de=I&&I.length>0&&I[0].is_initialized>0;A(de),Ie(!de)}catch(I){console.warn("[Login] Init check exception:",I),A(!1),Ie(!0),N(I.message||"Connection failed")}finally{E(!1)}},ee=async I=>{I.preventDefault(),S(!0),N("");try{if(T){if(F==="password"){const{error:B}=await Je.auth.signInWithPassword({email:o,password:d});if(B)throw B;se.success("Logged in successfully"),t?.()}else if(M==="email"){const{error:B}=await Je.auth.signInWithOtp({email:o,options:{shouldCreateUser:!1}});if(B)throw B;J("verify"),se.success("Validation code sent to your email")}}else{const{data:B,error:de}=await Je.functions.invoke("setup",{body:{email:o,password:d,first_name:p,last_name:y}});if(de||!B){if(de?.message?.includes("First user already exists")){se.info("System already initialized. Please log in."),A(!0);return}throw new Error(de?.message||"Failed to create admin account")}se.success("Admin account created! Signing you in...");const{error:Se}=await Je.auth.signInWithPassword({email:o,password:d});if(Se)throw Se;A(!0),t?.()}}catch(B){N(B?.message||"Authentication failed"),console.error("[Login] Error:",B)}finally{S(!1)}},C=async()=>{S(!0),N("");try{const{data:I,error:B}=await Je.auth.verifyOtp({email:o,token:re,type:"magiclink"});if(B)throw B;if(!I.session)throw new Error("Failed to create session");se.success("Logged in successfully"),t?.()}catch(I){N(I?.message||"Invalid code")}finally{S(!1)}};return _?l.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:l.jsxs("div",{className:"flex flex-col items-center gap-4",children:[l.jsx(zt,{className:"w-10 h-10 animate-spin text-primary"}),l.jsx("p",{className:"text-xs font-mono uppercase tracking-widest text-muted-foreground",children:"Initializing Engine..."})]})}):l.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-8 relative overflow-hidden",children:[l.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[e&&l.jsxs(Q,{variant:"ghost",size:"sm",onClick:e,className:"text-xs font-bold uppercase tracking-widest text-muted-foreground hover:text-primary transition-all",children:[l.jsx(Io,{className:"w-3.5 h-3.5 mr-2"}),"Configure"]}),l.jsx(rw,{}),l.jsx(mp,{})]}),l.jsxs(ms.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md relative z-10",children:[l.jsxs("div",{className:"glass p-10 space-y-8 relative overflow-hidden",children:[l.jsxs("div",{className:"text-center space-y-3",children:[l.jsx("div",{className:"mx-auto w-16 h-16 bg-primary rounded-2xl flex items-center justify-center mb-6",children:l.jsx(gp,{className:"w-10 h-10 text-primary-foreground"})}),l.jsx("h2",{className:"text-3xl font-black italic tracking-tighter uppercase text-foreground",children:r(ue?"login.initialize":"login.secureLogin")}),l.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-[0.2em] uppercase",children:ue?"Create your primary administrator account":F==="otp"?"Magic link authentication":"Personal Access Key Required"})]}),l.jsxs("form",{onSubmit:ee,className:"space-y-4",children:[l.jsxs(Z1,{mode:"wait",children:[ue&&l.jsxs(ms.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"First Name"}),l.jsx(Te,{value:p,onChange:I=>m(I.target.value),required:ue,placeholder:r("login.firstNamePlaceholder"),className:"bg-background"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Last Name"}),l.jsx(Te,{value:y,onChange:I=>v(I.target.value),required:ue,placeholder:r("login.lastNamePlaceholder"),className:"bg-background"})]})]},"signup-fields"),F==="password"||M==="email"?l.jsxs(ms.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Email Coordinates"}),l.jsxs("div",{className:"relative",children:[l.jsx(Bo,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:16}),l.jsx(Te,{type:"email",placeholder:r("login.emailPlaceholder"),value:o,onChange:I=>u(I.target.value),required:!0,className:"pl-10 bg-background",autoComplete:"email",disabled:M==="verify"})]})]},"email-field"):null,F==="password"&&l.jsxs(ms.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Access Password"}),l.jsxs("div",{className:"relative",children:[l.jsx(b0,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:16}),l.jsx(Te,{type:L?"text":"password",placeholder:"••••••••",value:d,onChange:I=>f(I.target.value),required:!0,minLength:6,className:"pl-10 pr-10 bg-background",autoComplete:ue?"new-password":"current-password"}),l.jsx("button",{type:"button",onClick:()=>G(!L),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground/30 hover:text-primary transition-colors",children:L?l.jsx(lT,{size:16}):l.jsx(zb,{size:16})})]})]},"password-field"),F==="otp"&&M==="verify"&&l.jsxs(ms.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"space-y-6 py-4",children:[l.jsx("div",{className:"flex justify-center",children:l.jsx(C3,{value:re,onChange:xe,length:6,onComplete:()=>{}})}),l.jsx(Q,{type:"button",variant:"link",className:"w-full text-[10px] font-bold uppercase tracking-widest text-primary/60",onClick:()=>J("email"),children:"Change Coordinates"}),l.jsxs(Q,{type:"button",onClick:C,disabled:b||re.length!==6,className:"w-full h-12 shadow-md",children:[b?l.jsx(zt,{className:"w-5 h-5 animate-spin mr-2"}):l.jsx(km,{size:18,className:"mr-2"}),"Verify Access"]})]},"otp-field")]}),D&&l.jsxs(ms.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:[l.jsx(Mn,{size:14,className:"mt-0.5 shrink-0"}),l.jsx("p",{children:D})]}),F!=="otp"||M==="email"?l.jsx(Q,{type:"submit",disabled:b||!o||F==="password"&&!d,className:"w-full h-12 shadow-md mt-4",children:b?l.jsx(zt,{className:"w-5 h-5 animate-spin"}):l.jsxs(l.Fragment,{children:[ue?l.jsx(lN,{className:"w-5 h-5 mr-2"}):F==="otp"?l.jsx(Bo,{className:"w-5 h-5 mr-2"}):l.jsx(_T,{className:"w-5 h-5 mr-2"}),r(ue?"login.initializeMaster":F==="otp"?"login.sendMagicLink":"login.openDashboard")]})}):null]}),l.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/10",children:[!ue&&l.jsx("div",{className:"flex flex-col gap-2",children:F==="password"?l.jsxs("button",{type:"button",onClick:()=>{U("otp"),J("email"),N("")},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:[l.jsx(b0,{size:14})," Magic Link Login"]}):l.jsxs("button",{type:"button",onClick:()=>{U("password"),N("")},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:[l.jsx(Tm,{size:14})," Password Access"]})}),l.jsxs("p",{className:"text-center text-[10px] text-muted-foreground font-bold uppercase tracking-wider",children:[ue?"Already have an account?":"Need a new account?"," "," ",l.jsx("button",{onClick:()=>{Ie(!ue),U("password"),N("")},className:"text-primary hover:underline ml-1",children:ue?"Login Instead":"Create Account"})]})]})]}),l.jsx("div",{className:"mt-8 text-center",children:l.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/30 uppercase tracking-[0.4em]",children:"Powered by RealTimeX Intelligence"})})]})]})}function O3({status:t,onDismiss:e,onLearnMore:s}){const[r,o]=w.useState(!0);if(!r)return null;const u=()=>{r4(),o(!1),e?.()},d=()=>{s?s():(navigator.clipboard.writeText("npx email-automator migrate"),se.success("Command copied to clipboard"))};return l.jsx("div",{className:"fixed right-4 top-16 z-50 max-w-sm animate-in slide-in-from-top-5",children:l.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:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(vi,{className:"h-5 w-5 flex-shrink-0 text-yellow-600 dark:text-yellow-500 mt-0.5"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:"Database Update Required"}),l.jsxs(Q,{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:u,children:[l.jsx(aa,{className:"h-3 w-3"}),l.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),l.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-200",children:["Your app version (",t.appVersion,") requires a database schema update."]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Q,{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:d,children:"Update Now"}),l.jsx(Q,{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:u,children:"Remind Later"})]})]})]})})})}function D3({open:t,onOpenChange:e,status:s}){const r=_i(),[o,u]=w.useState(!1),[d,f]=w.useState([]),[p,m]=w.useState(""),y=w.useRef(null),v=w.useMemo(()=>{const S=r?.url;if(!S)return"";try{return new URL(S).hostname.split(".")[0]||""}catch{return""}},[r?.url]);w.useEffect(()=>{y.current&&y.current.scrollIntoView({behavior:"smooth"})},[d]);const b=async()=>{if(!v){se.error("Missing Project ID");return}if(!p){se.error("Provide a Supabase Personal Access Token.");return}u(!0),f(["Initializing migration..."]);try{const S=async A=>{const D=new TextDecoder;let N="",L=null;const G=F=>{const U=F.trim();if(!(!U||!U.startsWith("data: ")))try{const M=U.substring(6),J=JSON.parse(M);J.type==="done"?(J.data==="success"||J.data==="failed")&&(L=J.data==="success"?"success":"failure"):J.data&&f(re=>[...re,J.data])}catch(M){console.error("Failed to parse SSE line:",U,M)}};for(;;){const{done:F,value:U}=await A.read();if(F)break;N+=D.decode(U,{stream:!0});const M=N.split(`
105
+ `);N=M.pop()||"",M.forEach(G)}return N+=D.decode(),N&&G(N),L};f(A=>[...A,"","📦 Database Migration & Edge Functions Deployment"]);const _=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:v,accessToken:p})});if(!_.ok)throw new Error(`Migration failed: ${_.status} ${_.statusText}`);const E=_.body?.getReader();if(!E)throw new Error("No migration response stream received.");if(await S(E)!=="success")throw new Error("Migration did not complete successfully");f(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(S){console.error(S),f(_=>[..._,"",`❌ Error: ${S instanceof Error?S.message:String(S)}`]),se.error("Setup failed. Check logs for details.")}finally{u(!1)}};return l.jsx(Ka,{open:t,onOpenChange:S=>!o&&e(S),children:l.jsxs(Ya,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[l.jsxs(Xa,{children:[l.jsxs(Wa,{className:"flex items-center gap-2 text-xl",children:[l.jsx(vi,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Setup Required"]}),l.jsxs(Ja,{children:["Your application version (",s.appVersion,") requires database migration and Edge Functions deployment to function correctly."]})]}),l.jsxs("div",{className:"space-y-6",children:[l.jsxs(Za,{children:[l.jsx(yi,{className:"h-4 w-4"}),l.jsxs(er,{children:[l.jsx("strong",{children:"Why is this needed?"}),l.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[l.jsxs("li",{children:["Updates your database schema to match version ",s.appVersion]}),l.jsx("li",{children:"Deploys Edge Functions (API endpoints) to your Supabase project"}),l.jsx("li",{children:"Enables new features and performance improvements"}),l.jsx("li",{children:"Your existing data will be preserved (safe migration)"})]})]})]}),l.jsxs("div",{className:"space-y-4 py-2",children:[l.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm p-6",children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Automated Setup"}),l.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."}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx($t,{htmlFor:"project-id",children:"Supabase Project ID"}),l.jsx(Te,{id:"project-id",value:v,disabled:!0,readOnly:!0,className:"bg-muted"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx($t,{htmlFor:"access-token",children:"Access Token"}),l.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 ",l.jsx(Vo,{className:"h-3 w-3"})]})]}),l.jsx(Te,{id:"access-token",type:"password",placeholder:"sbp_...",value:p,onChange:S=>m(S.target.value),disabled:o}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"This token is used only for this migration and is not stored."})]}),l.jsx(Q,{onClick:b,disabled:o||!p,className:"w-full",children:o?l.jsxs(l.Fragment,{children:[l.jsx(zt,{className:"mr-2 h-4 w-4 animate-spin"}),"Running Setup..."]}):l.jsxs(l.Fragment,{children:[l.jsx(iu,{className:"mr-2 h-4 w-4"}),"Start Setup"]})})]})]}),l.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[d.length===0?l.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):d.map((S,_)=>l.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:S},_)),l.jsx("div",{ref:y})]})]}),l.jsxs(Za,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[l.jsx(vi,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),l.jsxs(er,{children:[l.jsx("strong",{children:"Troubleshooting"}),l.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[l.jsxs("li",{children:["Ensure your Access Token has ",l.jsx("code",{children:"read"})," and ",l.jsx("code",{children:"write"})," permissions."]}),l.jsx("li",{children:"Verify that your Supabase Project ID is correct and active."})]})]})]})]}),l.jsx(Ba,{children:l.jsx(Q,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:o,children:"Close"})})]})})}const M3="https://registry.npmjs.org/@realtimex/email-automator/latest",z3=300*1e3,WS="email_automator_last_version_check",JS="email_automator_update_dismissed";function L3(){return"2.19.2"}async function U3(){try{const t=await fetch(M3,{cache:"no-store"});return t.ok?(await t.json()).version||null:(console.warn("[Version Check] Failed to fetch latest version"),null)}catch(t){return console.error("[Version Check] Error fetching latest version:",t),null}}function P3(t,e){if(e==="unknown")return!1;const s=m=>m.replace(/^v/,"").split(".").map(v=>parseInt(v,10)||0),[r,o,u]=s(t),[d,f,p]=s(e);return d>r?!0:d<r?!1:f>o?!0:f<o?!1:p>u}function V3(){try{const t=localStorage.getItem(WS);if(!t)return!0;const e=new Date(t).getTime();return Date.now()-e>z3}catch{return!0}}function B3(){try{localStorage.setItem(WS,new Date().toISOString())}catch(t){console.error("[Version Check] Error saving check timestamp:",t)}}function I3(t=24){try{const e=localStorage.getItem(JS);if(!e)return!1;const s=new Date(e).getTime();return(Date.now()-s)/(1e3*60*60)<t}catch{return!1}}function q3(){try{localStorage.setItem(JS,new Date().toISOString())}catch(t){console.error("[Version Check] Error dismissing update prompt:",t)}}async function $3(){if(!V3())return console.log("[Version Check] Skipping (throttled)"),null;const t=L3(),e=await U3();if(B3(),!e)return console.warn("[Version Check] Could not determine latest version"),null;const s=P3(t,e);return console.log("[Version Check]",{current:t,latest:e,updateAvailable:s}),s?{current:t,latest:e,updateAvailable:!0,updateUrl:"https://github.com/realtimex/email-automator/releases/latest"}:null}function H3(){typeof window<"u"&&window.location.reload(),window.electron?.ipcRenderer&&window.electron.ipcRenderer.send("restart-app")}function G3({versionInfo:t,onDismiss:e}){const[s,r]=w.useState(!0),[o,u]=w.useState(!1);if(!s)return null;const d=()=>{q3(),r(!1),e?.()},f=()=>{u(!0),setTimeout(()=>{H3()},500)},p=()=>{t.updateUrl&&window.open(t.updateUrl,"_blank")};return l.jsx("div",{className:"fixed right-4 top-16 z-50 max-w-sm animate-in slide-in-from-top-5",children:l.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:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Jt,{className:"h-5 w-5 flex-shrink-0 text-blue-600 dark:text-blue-500 mt-0.5"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"Update Available"}),l.jsxs(Q,{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:d,children:[l.jsx(aa,{className:"h-3 w-3"}),l.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),l.jsxs("p",{className:"text-xs text-blue-800 dark:text-blue-200",children:["Version ",t.latest," is now available (you're on ",t.current,")"]}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx(Q,{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:f,disabled:o,children:o?l.jsxs(l.Fragment,{children:[l.jsx(Jt,{className:"h-3 w-3 mr-1 animate-spin"}),"Updating..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Jt,{className:"h-3 w-3 mr-1"}),"Update Now"]})}),t.updateUrl&&l.jsxs(Q,{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:[l.jsx(Vo,{className:"h-3 w-3 mr-1"}),"What's New"]}),l.jsx(Q,{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:d,children:"Later"})]})]})]})})})}function F3(){const{t}=nt(),[e,s]=w.useState([]),{isExpanded:r,setIsExpanded:o}=Aw(),{state:u,actions:d}=ra(),{isSyncing:f}=u,[p,m]=w.useState({});w.useEffect(()=>{y();const _=Je.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},E=>{const T=E.new;T.event_type==="error"&&m(A=>({...A,[T.id]:!0})),s(A=>{const D=[T,...A];return T.details?.is_completion&&r&&setTimeout(()=>{o(!1)},3e3),D.length>100?D.slice(0,100):D})}).subscribe();return()=>{Je.removeChannel(_)}},[r,o]);const y=async()=>{const{data:_}=await Je.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);_&&s(_)},v=_=>{m(E=>({...E,[_]:!E[_]}))},b=_=>{if(_.details?.is_completion)return l.jsx(ru,{className:"w-3 h-3 text-emerald-500"});switch(_.event_type){case"analysis":return l.jsx(Po,{className:"w-3 h-3 text-purple-500"});case"action":return l.jsx(qo,{className:"w-3 h-3 text-emerald-500"});case"error":return l.jsx(vi,{className:"w-3 h-3 text-red-500"});default:return l.jsx(yi,{className:"w-3 h-3 text-blue-500"})}},S=_=>new Date(_).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return r?l.jsxs(Bt,{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:[l.jsxs(Js,{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:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(iu,{className:"w-4 h-4 text-primary"}),l.jsx(Qs,{className:"text-sm font-mono font-bold",children:t("terminal.title")}),l.jsxs("div",{className:we("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded-full border font-bold animate-pulse transition-colors duration-500",f?"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:[l.jsx(jE,{className:"w-3 h-3"}),t(f?"terminal.syncing":"terminal.live")]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[f&&l.jsxs(Q,{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:()=>d.stopSync(),children:[l.jsx(ZT,{className:"w-3 h-3 mr-1 fill-current"}),t("terminal.stopSync")]}),l.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>s([]),children:t("terminal.clear")}),l.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>o(!1),children:l.jsx(AT,{className:"w-4 h-4"})})]})]}),l.jsxs(Zs,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[e.length===0&&l.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:t("terminal.waiting")}),e.map((_,E)=>l.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[E!==e.length-1&&l.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),l.jsx("div",{className:we("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:b(_)}),l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between group",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:we("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}),l.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:S(_.created_at)})]}),(_.details?.system_prompt||_.details?._raw_response||_.details?.raw_response)&&l.jsxs(Q,{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:()=>v(_.id),children:[p[_.id]?l.jsx(YE,{className:"w-3 h-3 mr-1"}):l.jsx(Mb,{className:"w-3 h-3 mr-1"}),t("terminal.details")]})]}),_.event_type==="analysis"&&_.details?l.jsxs("div",{className:"bg-purple-500/5 border border-purple-500/10 rounded-lg p-3 space-y-2",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("span",{className:we("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?t("terminal.useless"):t("terminal.relevant")}),l.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})]}),l.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',_.details.summary,'"']}),_.details.suggested_actions&&_.details.suggested_actions.length>0&&l.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:_.details.suggested_actions.map(T=>l.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:[l.jsx(qo,{className:"w-2.5 h-2.5"}),T]},T))}),_.details.usage&&l.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:l.jsxs("span",{children:["Tokens: ",_.details.usage.prompt_tokens," (in) + ",_.details.usage.completion_tokens," (out) = ",l.jsx("span",{className:"text-purple-500 font-bold",children:_.details.usage.total_tokens})]})})]}):_.event_type==="action"&&_.details?l.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/10 rounded-lg p-3",children:[l.jsx("p",{className:"text-emerald-600 dark:text-emerald-400 font-bold mb-1 uppercase text-[9px] tracking-widest",children:t("terminal.executionComplete")}),l.jsxs("p",{className:"text-foreground font-medium",children:[_.details.action==="delete"&&t("terminal.action.delete"),_.details.action==="archive"&&t("terminal.action.archive"),_.details.action==="draft"&&t("terminal.action.draft"),_.details.action==="star"&&t("terminal.action.star"),!["delete","archive","draft","star"].includes(_.details.action)&&_.details.action]}),_.details.reason&&l.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[l.jsx(yi,{className:"w-3 h-3"}),_.details.reason]})]}):_.event_type==="error"&&_.details?l.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?l.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-lg p-3 space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 dark:text-emerald-400 font-bold uppercase text-[9px] tracking-[0.2em]",children:[l.jsx(ru,{className:"w-3.5 h-3.5"}),t("terminal.batchFinished")]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-1",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:t("terminal.processed")}),l.jsx("p",{className:"text-sm font-bold",children:_.details.total_processed||0})]}),l.jsxs("div",{className:"space-y-0.5",children:[l.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:t("terminal.actions")}),l.jsx("p",{className:"text-sm font-bold text-emerald-500",children:(_.details.deleted||0)+(_.details.drafted||0)})]})]}),_.details.errors>0&&l.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."]})]}):l.jsx("p",{className:"text-muted-foreground leading-relaxed",children:_.details?.message||JSON.stringify(_.details)}),p[_.id]&&l.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[_.details?.system_prompt&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[l.jsx(ps,{className:"w-3 h-3"})," System Prompt"]}),l.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:l.jsx("pre",{className:"whitespace-pre-wrap break-words text-[10px] leading-normal text-muted-foreground select-all",children:_.details.system_prompt})})]}),_.details?.content_preview&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[l.jsx(ps,{className:"w-3 h-3"})," Input Content (Cleaned)"]}),l.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border",children:l.jsx("p",{className:"whitespace-pre-wrap break-words text-[10px] text-muted-foreground",children:_.details.content_preview})})]}),_.details?._raw_response&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[l.jsx(ps,{className:"w-3 h-3"})," Raw LLM JSON Output"]}),l.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:l.jsx("pre",{className:"text-[10px] text-muted-foreground select-all",children:JSON.stringify(JSON.parse(_.details._raw_response),null,2)})})]}),_.details?.raw_response&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[l.jsx(ps,{className:"w-3 h-3"})," Raw Response (from Error)"]}),l.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:l.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))]})]}):l.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:l.jsxs(Q,{onClick:()=>o(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[l.jsx(iu,{className:"w-4 h-4 mr-2"}),t("terminal.liveActivity"),(e.length>0||f)&&l.jsxs("span",{className:"ml-2 flex h-2 w-2 relative",children:[l.jsx("span",{className:we("animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",f?"bg-red-400":"bg-green-400")}),l.jsx("span",{className:we("relative inline-flex rounded-full h-2 w-2",f?"bg-red-500":"bg-green-500")})]})]})})}function K3(){const{state:t,isSubscribed:e,actions:s}=ra(),{t:r}=nt(),[o,u]=w.useState(null),[d,f]=w.useState(!0),[p,m]=w.useState(!1),[y,v]=w.useState(!0),[b,S]=w.useState("dashboard"),[_,E]=w.useState(!1),[T,A]=w.useState(null),[D,N]=w.useState(!1),[L,G]=w.useState(!1),[F,U]=w.useState(!1),[M,J]=w.useState(null),[re,xe]=w.useState(!1);if(w.useEffect(()=>{const ee=new URLSearchParams(window.location.search).get("code");ee&&!_&&(async()=>{E(!0);try{const I=await Me.connectGmail(ee);if(I.data?.success)se.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),s.fetchAccounts());else{const B=typeof I.error=="string"?I.error:I.error?.message;se.error(B||"Failed to connect Gmail")}}catch{se.error("Connection failed")}finally{E(!1)}})()},[]),_)return l.jsx(hu,{text:r("app.connecting")});w.useEffect(()=>{(async()=>{if(!_i()){m(!0),f(!1);return}try{const{data:B,error:de}=await Je.from("init_state").select("is_initialized").single();de?(console.warn("[App] Init check error (might be fresh DB):",de),de.code==="42P01"&&v(!1)):v(B.is_initialized>0);const{data:{session:Se}}=await Je.auth.getSession();if(u(Se?.user??null),Se?.user){const Y=await pp(Je);A(Y.needsMigration?Y:null),Y.needsMigration&&!a4()&&N(!0)}const R=await $3();R&&!I3()&&(J(R),xe(!0))}catch(B){console.error("[App] Status check failed:",B),B instanceof Error&&B.message.includes("Invalid API key")&&m(!0)}finally{f(!1)}})();const{data:{subscription:ee}}=Je.auth.onAuthStateChange((I,B)=>{u(B?.user??null),B||(A(null),N(!1))}),C=()=>{if($n.isEnabled()){const I=new(window.AudioContext||window.webkitAudioContext);I.state==="suspended"&&I.resume()}window.removeEventListener("click",C),window.removeEventListener("keydown",C)};return window.addEventListener("click",C),window.addEventListener("keydown",C),()=>{ee.unsubscribe(),window.removeEventListener("click",C),window.removeEventListener("keydown",C)}},[]),w.useEffect(()=>{o&&(s.fetchAccounts(),s.fetchRules(),s.fetchSettings(),s.fetchProfile())},[o]),w.useEffect(()=>{const Ve=async()=>{try{await Me.healthCheck()}catch{console.warn("[App] Keep-alive ping failed")}};Ve();const ee=setInterval(Ve,3e4);return()=>clearInterval(ee)},[]);const ue=()=>{G(!0),N(!1)},Ie={migrationStatus:T,showMigrationBanner:D,showMigrationModal:L,openMigrationModal:ue,suppressMigrationBanner:F,setSuppressMigrationBanner:U};return d?l.jsx(hu,{text:r("app.loadingWorkspace")}):p?l.jsx(bS,{onComplete:()=>m(!1)}):o?l.jsx(uC,{value:Ie,children:l.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[l.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:l.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("button",{onClick:()=>S("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[l.jsx(gp,{className:"w-8 h-8"}),l.jsx("span",{className:"hidden sm:inline",children:r("app.name")}),l.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),l.jsxs("div",{className:we("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:[l.jsxs("div",{className:"relative flex items-center justify-center",children:[e&&l.jsx("span",{className:"absolute inline-flex h-3 w-3 rounded-full bg-emerald-500/40 animate-ping"}),l.jsx("div",{className:we("relative w-2 h-2 rounded-full",e?"bg-emerald-500":"bg-yellow-500")})]}),l.jsx("span",{className:"hidden xs:inline leading-none",children:r(e?"app.statusLive":"app.statusOffline")})]})]}),l.jsxs("div",{className:"flex gap-4 items-center",children:[l.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[l.jsxs(Q,{variant:b==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>S("dashboard"),className:"gap-2",children:[l.jsx(bT,{className:"w-4 h-4"}),l.jsx("span",{className:"hidden sm:inline",children:r("nav.dashboard")})]}),l.jsxs(Q,{variant:b==="autopilot"?"secondary":"ghost",size:"sm",onClick:()=>S("autopilot"),className:"gap-2",children:[l.jsx(Jc,{className:"w-4 h-4"}),l.jsx("span",{className:"hidden sm:inline",children:r("nav.autopilot")})]}),l.jsxs(Q,{variant:b==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>S("analytics"),className:"gap-2",children:[l.jsx(Db,{className:"w-4 h-4"}),l.jsx("span",{className:"hidden sm:inline",children:r("nav.analytics")})]}),l.jsxs(Q,{variant:b==="config"?"secondary":"ghost",size:"sm",onClick:()=>S("config"),className:"gap-2",children:[l.jsx(Io,{className:"w-4 h-4"}),l.jsx("span",{className:"hidden sm:inline",children:r("nav.configuration")})]})]}),l.jsx("div",{className:"h-6 w-px bg-border/50 mx-2 hidden sm:block"}),l.jsx(mp,{}),l.jsx(rw,{}),l.jsx(Q,{variant:b==="account"?"secondary":"ghost",size:"sm",onClick:()=>S("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:r("nav.accountSettings"),children:t.profile?.avatar_url?l.jsx("img",{src:t.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):l.jsx(ZE,{className:"w-5 h-5"})})]})]})}),l.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4 mb-12",children:[b==="dashboard"&&l.jsx(x3,{}),b==="autopilot"&&l.jsx(k3,{}),b==="config"&&l.jsx(_3,{}),b==="analytics"&&l.jsx(X3,{}),b==="account"&&l.jsx(j3,{})]}),l.jsx("footer",{className:"max-w-7xl mx-auto px-4 sm:px-8 pb-8 text-center sm:text-left",children:l.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/40 uppercase tracking-[0.2em]",children:["Email Automator ",l.jsx("span",{className:"mx-1",children:"•"})," v","2.19.2"]})}),t.error&&l.jsx("div",{className:"fixed bottom-20 left-4 right-4 sm:left-auto sm:right-4 sm:max-w-sm z-50",children:l.jsx("div",{className:"bg-destructive/10 border border-destructive/20 text-destructive p-4 rounded-lg",children:l.jsx("p",{className:"text-sm",children:t.error})})}),T&&D&&!F&&l.jsx(O3,{status:T,onDismiss:()=>N(!1),onLearnMore:ue}),M&&re&&l.jsx(G3,{versionInfo:M,onDismiss:()=>xe(!1)}),T&&l.jsx(D3,{open:L,onOpenChange:G,status:T}),l.jsx(F3,{})]})}):l.jsx(R3,{onSuccess:()=>s.fetchProfile(),onConfigure:()=>m(!0),isInitialized:y})}function Y3({runId:t,accountEmail:e,isOpen:s,onOpenChange:r}){const{t:o}=nt(),[u,d]=w.useState([]),[f,p]=w.useState(!1);w.useEffect(()=>{s&&t&&m()},[s,t]);const m=async()=>{if(t){p(!0);try{const v=await Me.getRunEvents(t);v.data&&d(v.data.events)}catch(v){console.error("Failed to fetch run trace:",v)}finally{p(!1)}}},y=v=>{switch(v){case"analysis":return l.jsx(Po,{className:"w-4 h-4 text-purple-500"});case"action":return l.jsx(qo,{className:"w-4 h-4 text-emerald-500"});case"error":return l.jsx(Mn,{className:"w-4 h-4 text-red-500"});default:return l.jsx(yi,{className:"w-4 h-4 text-blue-500"})}};return l.jsx(Ka,{open:s,onOpenChange:r,children:l.jsxs(Ya,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[l.jsxs(Xa,{className:"p-6 border-b",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(wu,{className:"w-5 h-5 text-primary"}),l.jsx(Wa,{children:o("trace.runTrace")})]}),l.jsx(Ja,{children:e?o("trace.fullLogFor").replace("{email}",e):o("trace.historicalLog")})]}),l.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:f?l.jsx("div",{className:"py-20 flex justify-center",children:l.jsx(hu,{text:o("trace.loadingTrace")})}):u.length===0?l.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:o("trace.noTraceEvents")}):u.map((v,b)=>l.jsxs("div",{className:"relative pl-8",children:[b!==u.length-1&&l.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),l.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:y(v.event_type)}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-foreground/70",children:v.agent_state}),v.emails?.subject&&l.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",v.emails.subject]})]}),l.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[l.jsx(Qa,{className:"w-3 h-3"}),new Date(v.created_at).toLocaleTimeString()]})]}),l.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[v.event_type==="info"&&l.jsx("p",{className:"text-sm text-foreground/90",children:v.details?.message}),v.event_type==="analysis"&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',v.details?.summary,'"']}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("span",{className:"text-[9px] bg-secondary px-1.5 py-0.5 rounded font-bold uppercase",children:v.details?.category}),v.details?.suggested_actions?.map(S=>l.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:S},S))]}),v.details?.usage&&l.jsxs("div",{className:"flex gap-3 pt-1.5 mt-1 border-t border-border/50 text-[9px] text-muted-foreground",children:[l.jsxs("span",{children:["In: ",l.jsx("b",{children:v.details.usage.prompt_tokens})]}),l.jsxs("span",{children:["Out: ",l.jsx("b",{children:v.details.usage.completion_tokens})]}),l.jsxs("span",{children:["Total: ",l.jsx("span",{className:"text-primary font-bold",children:v.details.usage.total_tokens})]})]})]}),v.event_type==="action"&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:[o("dashboard.done")," ",v.details?.action]}),l.jsx(Nm,{className:"w-4 h-4 text-emerald-500"})]}),v.event_type==="error"&&l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:v.details?.error})]})]})]},v.id))})]})})}function X3(){const{state:t,actions:e}=ra(),{t:s}=nt(),[r,o]=w.useState(null),[u,d]=w.useState(void 0),[f,p]=w.useState(!1);if(w.useEffect(()=>{e.fetchStats()},[]),!t.stats)return l.jsx(hu,{text:s("common.loading")});const m=(v,b)=>{o(v),d(b),p(!0)},{stats:y}=t;return l.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[l.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[l.jsx(Db,{className:"w-6 h-6 text-primary"}),s("analytics.title")]}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[l.jsx(Wc,{title:s("analytics.totalEmails"),value:y.totalEmails,color:"primary"}),l.jsx(Wc,{title:s("analytics.spamCaught"),value:y.categoryCounts.spam||0,color:"destructive"}),l.jsx(Wc,{title:s("analytics.actionsTaken"),value:Object.values(y.actionCounts).reduce((v,b)=>v+b,0)-(y.actionCounts.none||0),color:"emerald"}),l.jsx(Wc,{title:s("analytics.accounts"),value:y.accountCount,color:"blue"})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[l.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[l.jsx("h3",{className:"font-semibold mb-4",children:s("analytics.categories")}),l.jsx("div",{className:"space-y-3",children:Object.entries(y.categoryCounts).map(([v,b])=>l.jsx("div",{className:"flex items-center gap-3",children:l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[l.jsx("span",{className:"capitalize",children:v}),l.jsx("span",{className:"text-muted-foreground",children:b})]}),l.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${b/y.totalEmails*100}%`}})})]})},v))})]}),l.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[l.jsx("h3",{className:"font-semibold mb-4",children:s("analytics.actionsTaken")}),l.jsx("div",{className:"space-y-3",children:Object.entries(y.actionCounts).map(([v,b])=>l.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[l.jsx("span",{className:"capitalize",children:v}),l.jsx("span",{className:"font-medium",children:b})]},v))})]})]}),l.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[l.jsx("h3",{className:"font-semibold mb-4",children:s("analytics.recentActivity")}),y.recentSyncs.length===0?l.jsx("p",{className:"text-muted-foreground text-sm",children:s("analytics.noActivity")}):l.jsx("div",{className:"space-y-3",children:y.recentSyncs.map(v=>{const b=v.completed_at?Math.round((new Date(v.completed_at).getTime()-new Date(v.started_at).getTime())/1e3):null;return l.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:()=>m(v.id,v.email_accounts?.email_address),children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:we("w-2.5 h-2.5 rounded-full",v.status==="success"?"bg-emerald-500":v.status==="failed"?"bg-destructive":"bg-yellow-500 shadow-[0_0_8px_rgba(234,179,8,0.5)] animate-pulse")}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:v.email_accounts?.email_address||s("common.systemSync")}),l.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[l.jsx(Qa,{className:"w-3 h-3"}),new Date(v.started_at).toLocaleString(),b!==null&&l.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[b,"s"]})]})]})]}),l.jsx("div",{className:"flex items-center gap-4 text-xs",children:l.jsxs("div",{className:"flex flex-col items-end",children:[l.jsx("span",{className:"font-bold text-primary",children:s("analytics.emails").replace("{count}",v.emails_processed.toString())}),l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[s("analytics.deleted").replace("{count}",v.emails_deleted.toString()),", ",s("analytics.drafted").replace("{count}",v.emails_drafted.toString())]})]})})]},v.id)})})]}),l.jsx(Y3,{runId:r,accountEmail:u,isOpen:f,onOpenChange:p})]})}function Wc({title:t,value:e,color:s}){const r={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 l.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[l.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:t}),l.jsx("p",{className:`text-3xl font-bold ${r[s]||""}`,children:e})]})}function W3(){return l.jsx(e4,{children:l.jsx(yN,{defaultTheme:"system",storageKey:"email-automator-theme",children:l.jsx(fC,{children:l.jsx(dC,{children:l.jsxs(lC,{children:[l.jsx(K3,{}),l.jsx(iC,{})]})})})})})}yE.createRoot(document.getElementById("root")).render(l.jsx(Cb.StrictMode,{children:l.jsx(W3,{})}));